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 2493 : AttributeStatusIB::Builder & AttributeStatusIBs::Builder::CreateAttributeStatus()
33 : {
34 2493 : if (mError == CHIP_NO_ERROR)
35 : {
36 2493 : mError = mAttributeStatus.Init(mpWriter);
37 : }
38 2493 : return mAttributeStatus;
39 : }
40 :
41 1738 : CHIP_ERROR AttributeStatusIBs::Builder::EndOfAttributeStatuses()
42 : {
43 1738 : EndOfContainer();
44 1738 : return GetError();
45 : }
46 :
47 : #if CHIP_CONFIG_IM_PRETTY_PRINT
48 1730 : CHIP_ERROR AttributeStatusIBs::Parser::PrettyPrint() const
49 : {
50 1730 : CHIP_ERROR err = CHIP_NO_ERROR;
51 1730 : TLV::TLVReader reader;
52 :
53 1730 : PRETTY_PRINT("AttributeStatusIBs =");
54 1730 : PRETTY_PRINT("[");
55 :
56 : // make a copy of the AttributeStatusIBs reader
57 1730 : reader.Init(mReader);
58 :
59 4209 : while (CHIP_NO_ERROR == (err = reader.Next()))
60 : {
61 2479 : VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
62 : {
63 2479 : AttributeStatusIB::Parser status;
64 2479 : ReturnErrorOnFailure(status.Init(reader));
65 :
66 2479 : PRETTY_PRINT_INCDEPTH();
67 2479 : ReturnErrorOnFailure(status.PrettyPrint());
68 2479 : PRETTY_PRINT_DECDEPTH();
69 : }
70 : }
71 :
72 1730 : PRETTY_PRINT("],");
73 1730 : PRETTY_PRINT_BLANK_LINE();
74 : // if we have exhausted this container
75 1730 : if (CHIP_END_OF_TLV == err)
76 : {
77 1730 : err = CHIP_NO_ERROR;
78 : }
79 1730 : ReturnErrorOnFailure(err);
80 1730 : return reader.ExitContainer(mOuterContainerType);
81 : }
82 : #endif // CHIP_CONFIG_IM_PRETTY_PRINT
83 : }; // namespace app
84 : }; // namespace chip
|