Matter SDK Coverage Report
Current view: top level - app/MessageDef - EventFilterIBs.cpp (source / functions) Coverage Total Hit
Test: SHA:b879ecb8e99e175eea0a293a888bda853da2b19c Lines: 100.0 % 31 31
Test Date: 2025-01-17 19:00:11 Functions: 100.0 % 4 4

            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 "EventFilterIBs.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          317 : CHIP_ERROR EventFilterIBs::Parser::PrettyPrint() const
      31              : {
      32          317 :     CHIP_ERROR err = CHIP_NO_ERROR;
      33          317 :     TLV::TLVReader reader;
      34              : 
      35          317 :     PRETTY_PRINT("EventFilterIBs =");
      36          317 :     PRETTY_PRINT("[");
      37              : 
      38              :     // make a copy of the reader
      39          317 :     reader.Init(mReader);
      40              : 
      41          634 :     while (CHIP_NO_ERROR == (err = reader.Next()))
      42              :     {
      43          317 :         VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG);
      44              :         {
      45          317 :             EventFilterIB::Parser eventFilter;
      46          317 :             ReturnErrorOnFailure(eventFilter.Init(reader));
      47          317 :             PRETTY_PRINT_INCDEPTH();
      48          317 :             ReturnErrorOnFailure(eventFilter.PrettyPrint());
      49          317 :             PRETTY_PRINT_DECDEPTH();
      50              :         }
      51              :     }
      52              : 
      53          317 :     PRETTY_PRINT("],");
      54          317 :     PRETTY_PRINT_BLANK_LINE();
      55              : 
      56              :     // if we have exhausted this container
      57          317 :     if (CHIP_END_OF_TLV == err)
      58              :     {
      59          317 :         err = CHIP_NO_ERROR;
      60              :     }
      61          317 :     ReturnErrorOnFailure(err);
      62          317 :     return reader.ExitContainer(mOuterContainerType);
      63              : }
      64              : #endif // CHIP_CONFIG_IM_PRETTY_PRINT
      65              : 
      66          317 : EventFilterIB::Builder & EventFilterIBs::Builder::CreateEventFilter()
      67              : {
      68          317 :     mError = mEventFilter.Init(mpWriter);
      69          317 :     return mEventFilter;
      70              : }
      71              : 
      72          317 : CHIP_ERROR EventFilterIBs::Builder::EndOfEventFilters()
      73              : {
      74          317 :     EndOfContainer();
      75          317 :     return GetError();
      76              : }
      77              : 
      78          314 : CHIP_ERROR EventFilterIBs::Builder::GenerateEventFilter(EventNumber aEventNumber)
      79              : {
      80          314 :     EventFilterIB::Builder & eventFilter = CreateEventFilter();
      81          314 :     ReturnErrorOnFailure(GetError());
      82          314 :     ReturnErrorOnFailure(eventFilter.EventMin(aEventNumber).EndOfEventFilterIB());
      83          314 :     ReturnErrorOnFailure(EndOfEventFilters());
      84          314 :     return CHIP_NO_ERROR;
      85              : }
      86              : 
      87              : }; // namespace app
      88              : }; // namespace chip
        

Generated by: LCOV version 2.0-1