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

            Line data    Source code
       1              : /**
       2              :  *
       3              :  *    Copyright (c) 2021 Project CHIP Authors
       4              :  *
       5              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       6              :  *    you may not use this file except in compliance with the License.
       7              :  *    You may obtain a copy of the License at
       8              :  *
       9              :  *        http://www.apache.org/licenses/LICENSE-2.0
      10              :  *
      11              :  *    Unless required by applicable law or agreed to in writing, software
      12              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      13              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      14              :  *    See the License for the specific language governing permissions and
      15              :  *    limitations under the License.
      16              :  */
      17              : 
      18              : #pragma once
      19              : 
      20              : #include "AttributeDataIB.h"
      21              : #include "AttributeStatusIB.h"
      22              : #include "StructBuilder.h"
      23              : #include "StructParser.h"
      24              : 
      25              : #include <app/AppConfig.h>
      26              : #include <app/util/basic-types.h>
      27              : #include <lib/core/CHIPCore.h>
      28              : #include <lib/core/TLV.h>
      29              : #include <lib/support/CodeUtils.h>
      30              : #include <lib/support/logging/CHIPLogging.h>
      31              : 
      32              : namespace chip {
      33              : namespace app {
      34              : namespace AttributeReportIB {
      35              : enum class Tag : uint8_t
      36              : {
      37              :     kAttributeStatus = 0,
      38              :     kAttributeData   = 1,
      39              : };
      40              : 
      41              : class Parser : public StructParser
      42              : {
      43              : public:
      44              : #if CHIP_CONFIG_IM_PRETTY_PRINT
      45              :     CHIP_ERROR PrettyPrint() const;
      46              : #endif // CHIP_CONFIG_IM_PRETTY_PRINT
      47              : 
      48              :     /**
      49              :      *  @brief Get a TLVReader for the StatusIB. Next() must be called before accessing them.
      50              :      *
      51              :      *  @param [in] apAttributeStatus    A pointer to apAttributeStatus
      52              :      *
      53              :      *  @return #CHIP_NO_ERROR on success
      54              :      *          # CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a structure
      55              :      *          #CHIP_END_OF_TLV if there is no such element
      56              :      */
      57              :     CHIP_ERROR GetAttributeStatus(AttributeStatusIB::Parser * const apAttributeStatus) const;
      58              : 
      59              :     /**
      60              :      *  @brief Get a TLVReader for the AttributeDataIB. Next() must be called before accessing them.
      61              :      *
      62              :      *  @param [in] apAttributeData    A pointer to apAttributeData
      63              :      *
      64              :      *  @return #CHIP_NO_ERROR on success
      65              :      *          #CHIP_ERROR_WRONG_TLV_TYPE if there is such element but it's not a AttributeData
      66              :      *          #CHIP_END_OF_TLV if there is no such element
      67              :      */
      68              :     CHIP_ERROR GetAttributeData(AttributeDataIB::Parser * const apAttributeData) const;
      69              : };
      70              : 
      71              : class Builder : public StructBuilder
      72              : {
      73              : public:
      74              :     /**
      75              :      *  @brief Initialize a AttributeDataIB::Builder for writing into the TLV stream
      76              :      *
      77              :      *  @return A reference to AttributeDataIB::Builder
      78              :      */
      79              :     AttributeDataIB::Builder & CreateAttributeData();
      80              : 
      81        11027 :     AttributeDataIB::Builder & GetAttributeData() { return mAttributeData; }
      82              :     /**
      83              :      *  @brief Initialize a StatusIB::Builder for writing into the TLV stream
      84              :      *
      85              :      *  @return A reference to StatusIB::Builder
      86              :      */
      87              :     AttributeStatusIB::Builder & CreateAttributeStatus();
      88              : 
      89              :     /**
      90              :      *  @brief Mark the end of this AttributeReportIB
      91              :      *
      92              :      *  @return The builder's final status.
      93              :      */
      94              :     CHIP_ERROR EndOfAttributeReportIB();
      95              : 
      96              : private:
      97              :     AttributeStatusIB::Builder mAttributeStatus;
      98              :     AttributeDataIB::Builder mAttributeData;
      99              : };
     100              : } // namespace AttributeReportIB
     101              : } // namespace app
     102              : } // namespace chip
        

Generated by: LCOV version 2.0-1