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