Coverage Report

Created: 2025-06-24 06:17

/src/connectedhomeip/examples/common/tracing/decoder/echo/Decoder.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
 *   Copyright (c) 2022 Project CHIP Authors
3
 *   All rights reserved.
4
 *
5
 *   Licensed under the Apache License, Version 2.0 (the "License");
6
 *   you may not use this file except in compliance with the License.
7
 *   You may obtain a copy of the License at
8
 *
9
 *       http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 *   Unless required by applicable law or agreed to in writing, software
12
 *   distributed under the License is distributed on an "AS IS" BASIS,
13
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 *   See the License for the specific language governing permissions and
15
 *   limitations under the License.
16
 *
17
 */
18
19
#include "Decoder.h"
20
21
#include <protocols/echo/Echo.h>
22
23
namespace {
24
constexpr char kProtocolName[] = "Echo";
25
26
constexpr char kUnknown[]      = "Unknown";
27
constexpr char kEchoRequest[]  = "Echo Request";
28
constexpr char kEchoResponse[] = "Echo Response";
29
} // namespace
30
31
using MessageType = chip::Protocols::Echo::MsgType;
32
33
namespace chip {
34
namespace trace {
35
namespace echo {
36
37
const char * ToProtocolName()
38
0
{
39
0
    return kProtocolName;
40
0
}
41
42
const char * ToProtocolMessageTypeName(uint8_t protocolCode)
43
0
{
44
0
    switch (protocolCode)
45
0
    {
46
0
    case to_underlying(MessageType::EchoRequest):
47
0
        return kEchoRequest;
48
0
    case to_underlying(MessageType::EchoResponse):
49
0
        return kEchoResponse;
50
0
    default:
51
0
        return kUnknown;
52
0
    }
53
0
}
54
55
CHIP_ERROR LogAsProtocolMessage(uint8_t protocolCode, const uint8_t * data, size_t len)
56
0
{
57
    // TODO Implement messages decoding
58
59
0
    switch (protocolCode)
60
0
    {
61
0
    case to_underlying(MessageType::EchoRequest):
62
0
        return CHIP_ERROR_NOT_IMPLEMENTED;
63
0
    case to_underlying(MessageType::EchoResponse):
64
0
        return CHIP_ERROR_NOT_IMPLEMENTED;
65
0
    default:
66
0
        return CHIP_ERROR_NOT_IMPLEMENTED;
67
0
    }
68
0
}
69
70
} // namespace echo
71
} // namespace trace
72
} // namespace chip