Line data Source code
1 : /**
2 : *
3 : * Copyright (c) 2020-2021 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 "AttributeStatusIBs.h"
20 : #include "AttributeStatusIB.h"
21 :
22 : #include "MessageDefHelper.h"
23 :
24 : #include <inttypes.h>
25 : #include <stdarg.h>
26 : #include <stdio.h>
27 :
28 : #include <app/AppConfig.h>
29 :
30 : namespace chip {
31 : namespace app {
32 4262 : AttributeStatusIB::Builder & AttributeStatusIBs::Builder::CreateAttributeStatus()
33 : {
34 4262 : if (mError == CHIP_NO_ERROR)
35 : {
36 4262 : mError = mAttributeStatus.Init(mpWriter);
37 : }
38 4262 : return mAttributeStatus;
39 : }
40 :
41 3435 : CHIP_ERROR AttributeStatusIBs::Builder::EndOfAttributeStatuses()
42 : {
43 3435 : EndOfContainer();
44 3435 : return GetError();
45 : }
46 :
47 : #if CHIP_CONFIG_IM_PRETTY_PRINT
48 3425 : CHIP_ERROR AttributeStatusIBs::Parser::PrettyPrint() const
49 : {
50 3425 : CHIP_ERROR err = CHIP_NO_ERROR;
51 3425 : TLV::TLVReader reader;
52 :
53 3425 : PRETTY_PRINT("AttributeStatusIBs =");
54 3425 : PRETTY_PRINT("[");
55 :
56 : // make a copy of the AttributeStatusIBs reader
57 3425 : reader.Init(mReader);
58 :
59 7670 : while (CHIP_NO_ERROR == (err = reader.Next()))
60 : {
61 4245 : VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
62 : {
63 4245 : AttributeStatusIB::Parser status;
64 4245 : ReturnErrorOnFailure(status.Init(reader));
65 :
66 4245 : PRETTY_PRINT_INCDEPTH();
67 4245 : ReturnErrorOnFailure(status.PrettyPrint());
68 4245 : PRETTY_PRINT_DECDEPTH();
69 : }
70 : }
71 :
72 3425 : PRETTY_PRINT("],");
73 3425 : PRETTY_PRINT_BLANK_LINE();
74 : // if we have exhausted this container
75 3425 : if (CHIP_END_OF_TLV == err)
76 : {
77 3425 : err = CHIP_NO_ERROR;
78 : }
79 3425 : ReturnErrorOnFailure(err);
80 3425 : return reader.ExitContainer(mOuterContainerType);
81 : }
82 : #endif // CHIP_CONFIG_IM_PRETTY_PRINT
83 : }; // namespace app
84 : }; // namespace chip
|