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

            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 <app/AppConfig.h>
      21              : #include <app/util/basic-types.h>
      22              : #include <lib/core/CHIPCore.h>
      23              : #include <lib/core/TLV.h>
      24              : #include <lib/support/CodeUtils.h>
      25              : #include <lib/support/logging/CHIPLogging.h>
      26              : 
      27              : #include "CommandDataIB.h"
      28              : #include "CommandStatusIB.h"
      29              : #include "StructBuilder.h"
      30              : #include "StructParser.h"
      31              : 
      32              : namespace chip {
      33              : namespace app {
      34              : namespace InvokeResponseIB {
      35              : enum class Tag : uint8_t
      36              : {
      37              :     kCommand = 0,
      38              :     kStatus  = 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 parser for a Command.
      50              :      *
      51              :      *  @param [in] apCommand    A pointer to the CommandDataIB parser.
      52              :      *
      53              :      *  @return #CHIP_NO_ERROR on success
      54              :      *          #CHIP_END_OF_TLV if there is no such element
      55              :      */
      56              :     CHIP_ERROR GetCommand(CommandDataIB::Parser * const apCommand) const;
      57              : 
      58              :     /**
      59              :      *  @brief Get a parser for a Status.
      60              :      *
      61              :      *  @param [in] apStatus    A pointer to the CommandStatusIB parser.
      62              :      *
      63              :      *  @return #CHIP_NO_ERROR on success
      64              :      *          #CHIP_END_OF_TLV if there is no such element
      65              :      */
      66              :     CHIP_ERROR GetStatus(CommandStatusIB::Parser * const apStatus) const;
      67              : };
      68              : 
      69              : class Builder : public StructBuilder
      70              : {
      71              : public:
      72              :     /**
      73              :      *  @brief Initialize a CommandDataIB::Builder for writing into the TLV stream
      74              :      *
      75              :      *  @return A reference to CommandDataIB::Builder
      76              :      */
      77              :     CommandDataIB::Builder & CreateCommand();
      78              : 
      79              :     /**
      80              :      *  @return A reference to CommandDataIB::Builder
      81              :      */
      82           35 :     CommandDataIB::Builder & GetCommand() { return mCommand; }
      83              : 
      84              :     /**
      85              :      *  @return A reference to CommandStatusIB::Builder
      86              :      */
      87          114 :     CommandStatusIB::Builder & GetStatus() { return mStatus; }
      88              : 
      89              :     /**
      90              :      *  @brief Initialize a CommandStatusIB::Builder for writing into the TLV stream
      91              :      *
      92              :      *  @return A reference to CommandStatusIB::Builder
      93              :      */
      94              :     CommandStatusIB::Builder & CreateStatus();
      95              : 
      96              :     /**
      97              :      *  @brief Mark the end of this InvokeCommand
      98              :      *
      99              :      *  @return The builder's final status.
     100              :      */
     101              :     CHIP_ERROR EndOfInvokeResponseIB();
     102              : 
     103              : private:
     104              :     CommandDataIB::Builder mCommand;
     105              :     CommandStatusIB::Builder mStatus;
     106              : };
     107              : } // namespace InvokeResponseIB
     108              : } // namespace app
     109              : } // namespace chip
        

Generated by: LCOV version 2.0-1