LCOV - code coverage report
Current view: top level - app/MessageDef - InvokeResponseIBs.h (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 1 1 100.0 %
Date: 2024-02-15 08:20:41 Functions: 1 1 100.0 %

          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 "ArrayBuilder.h"
      28             : #include "ArrayParser.h"
      29             : #include "InvokeResponseIB.h"
      30             : 
      31             : namespace chip {
      32             : namespace app {
      33             : namespace InvokeResponseIBs {
      34             : class Parser : public ArrayParser
      35             : {
      36             : public:
      37             : #if CHIP_CONFIG_IM_PRETTY_PRINT
      38             :     CHIP_ERROR PrettyPrint() const;
      39             : #endif // CHIP_CONFIG_IM_PRETTY_PRINT
      40             : };
      41             : 
      42             : class Builder : public ArrayBuilder
      43             : {
      44             : public:
      45             :     /**
      46             :      *  @brief Performs underlying StructBuilder::Init, but reserves memory need in
      47             :      *  EndOfInvokeResponses() with underlying TLVWriter.
      48             :      */
      49             :     CHIP_ERROR InitWithEndBufferReserved(TLV::TLVWriter * const apWriter, const uint8_t aContextTagToUse);
      50             : 
      51             :     /**
      52             :      *  @brief Initialize a InvokeResponseIB::Builder for writing into the TLV stream
      53             :      *
      54             :      *  @return A reference to InvokeResponseIB::Builder
      55             :      */
      56             :     InvokeResponseIB::Builder & CreateInvokeResponse();
      57             : 
      58             :     /**
      59             :      *  @return A reference to InvokeResponseIB::Builder
      60             :      */
      61         194 :     InvokeResponseIB::Builder & GetInvokeResponse() { return mInvokeResponse; };
      62             : 
      63             :     /**
      64             :      *  @brief Mark the end of this InvokeResponseIBs
      65             :      *
      66             :      *  @return The builder's final status.
      67             :      */
      68             :     CHIP_ERROR EndOfInvokeResponses();
      69             : 
      70             :     /**
      71             :      *  @brief Get number of bytes required in the buffer by EndOfInvokeResponses()
      72             :      *
      73             :      *  @return Expected number of bytes required in the buffer by EndOfInvokeResponses()
      74             :      */
      75             :     uint32_t GetSizeToEndInvokeResponses();
      76             : 
      77             : private:
      78             :     InvokeResponseIB::Builder mInvokeResponse;
      79             :     bool mIsEndBufferReserved = false;
      80             : };
      81             : } // namespace InvokeResponseIBs
      82             : } // namespace app
      83             : } // namespace chip

Generated by: LCOV version 1.14