Coverage Report

Created: 2025-06-20 06:55

/src/connectedhomeip/src/app/MessageDef/EventPathIBs.cpp
Line
Count
Source (jump to first uncovered line)
1
/**
2
 *
3
 *    Copyright (c) 2020 Project CHIP Authors
4
 *    Copyright (c) 2018 Google LLC.
5
 *    Copyright (c) 2016-2017 Nest Labs, Inc.
6
 *    Licensed under the Apache License, Version 2.0 (the "License");
7
 *    you may not use this file except in compliance with the License.
8
 *    You may obtain a copy of the License at
9
 *
10
 *        http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 *    Unless required by applicable law or agreed to in writing, software
13
 *    distributed under the License is distributed on an "AS IS" BASIS,
14
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 *    See the License for the specific language governing permissions and
16
 *    limitations under the License.
17
 */
18
19
#include "EventPathIBs.h"
20
21
#include "MessageDefHelper.h"
22
23
#include <inttypes.h>
24
#include <stdarg.h>
25
#include <stdio.h>
26
27
#include <app/AppConfig.h>
28
29
namespace chip {
30
namespace app {
31
#if CHIP_CONFIG_IM_PRETTY_PRINT
32
CHIP_ERROR EventPathIBs::Parser::PrettyPrint() const
33
0
{
34
0
    CHIP_ERROR err = CHIP_NO_ERROR;
35
0
    TLV::TLVReader reader;
36
37
0
    PRETTY_PRINT("EventPathIBs =");
38
0
    PRETTY_PRINT("[");
39
40
    // make a copy of the EventPathIBs reader
41
0
    reader.Init(mReader);
42
43
0
    while (CHIP_NO_ERROR == (err = reader.Next()))
44
0
    {
45
0
        VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
46
0
        VerifyOrReturnError(TLV::kTLVType_List == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE);
47
48
0
        {
49
0
            EventPathIB::Parser path;
50
0
            ReturnErrorOnFailure(path.Init(reader));
51
52
0
            PRETTY_PRINT_INCDEPTH();
53
0
            ReturnErrorOnFailure(path.PrettyPrint());
54
0
            PRETTY_PRINT_DECDEPTH();
55
0
        }
56
0
    }
57
58
0
    PRETTY_PRINT("],");
59
0
    PRETTY_PRINT_BLANK_LINE();
60
61
    // if we have exhausted this container
62
0
    if (CHIP_END_OF_TLV == err)
63
0
    {
64
0
        err = CHIP_NO_ERROR;
65
0
    }
66
0
    ReturnErrorOnFailure(err);
67
0
    return reader.ExitContainer(mOuterContainerType);
68
0
}
69
#endif // CHIP_CONFIG_IM_PRETTY_PRINT
70
71
EventPathIB::Builder & EventPathIBs::Builder::CreatePath()
72
0
{
73
0
    if (mError == CHIP_NO_ERROR)
74
0
    {
75
0
        mError = mEventPath.Init(mpWriter);
76
0
    }
77
0
    return mEventPath;
78
0
}
79
80
CHIP_ERROR EventPathIBs::Builder::EndOfEventPaths()
81
0
{
82
0
    EndOfContainer();
83
0
    return GetError();
84
0
}
85
}; // namespace app
86
}; // namespace chip