Matter SDK Coverage Report
Current view: top level - setup_payload - AdditionalDataPayloadParser.h (source / functions) Coverage Total Hit
Test: SHA:4d2388ac7eed75b2fe5e05e20de377999c632502 Lines: 100.0 % 3 3
Test Date: 2025-07-27 07:17:09 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /**
       2              :  *
       3              :  *    Copyright (c) 2020 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              : /**
      19              :  *    @file
      20              :  *      This file describes a AdditionalData Payload parser based on the
      21              :  *      CHIP specification.
      22              :  */
      23              : 
      24              : #pragma once
      25              : 
      26              : #include "AdditionalDataPayload.h"
      27              : 
      28              : #include <lib/core/CHIPError.h>
      29              : #include <stdint.h>
      30              : 
      31              : namespace chip {
      32              : 
      33              : /**
      34              :  * @class AdditionalDataPayloadParser
      35              :  * A class that can be used to convert a HEX encoded payload to a AdditionalDataPayload object
      36              :  * */
      37              : class AdditionalDataPayloadParser
      38              : {
      39              : private:
      40              :     const uint8_t * mPayloadBufferData;
      41              :     const size_t mPayloadBufferLength;
      42              : 
      43              : public:
      44              :     /**
      45              :      * Constructs the Additional Data payload parser with payload buffer data
      46              :      * and the buffer size
      47              :      *
      48              :      * @param[in] payloadBufferData        The buffer data for the additional data payload,
      49              :      *                                     it needs to outlive the lifetime of this parse.
      50              :      * @param[in] payloadBufferLength      The buffer data length for the additional data payload.
      51              :      */
      52            5 :     AdditionalDataPayloadParser(const uint8_t * payloadBufferData, const size_t payloadBufferLength) :
      53            5 :         mPayloadBufferData(payloadBufferData), mPayloadBufferLength(payloadBufferLength)
      54            5 :     {}
      55              : 
      56              :     /**
      57              :      * Parses the Additional Data payload buffer and constructs all the fields
      58              :      * of the Additional Data structure.
      59              :      *
      60              :      * @param[out] outPayload              Additional data payload stucture.
      61              :      *
      62              :      *
      63              :      * @retval #CHIP_NO_ERROR              If the reader was successfully positioned on a new element.
      64              :      * @retval #CHIP_END_OF_TLV            If no further elements are available.
      65              :      * @retval #CHIP_ERROR_TLV_UNDERRUN    If the underlying TLV encoding ended prematurely.
      66              :      * @retval #CHIP_ERROR_INVALID_TLV_ELEMENT
      67              :      *                                      If the reader encountered an invalid or unsupported TLV element
      68              :      *                                      type.
      69              :      * @retval #CHIP_ERROR_INVALID_TLV_TAG If the reader encountered a TLV tag in an invalid context.
      70              :      * @retval #CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG
      71              :      *                                      If the reader encountered a implicitly-encoded TLV tag for which
      72              :      *                                      the corresponding profile id is unknown.
      73              :      * @retval other                        Other CHIP or platform error codes returned by the configured
      74              :      *                                      GetNextBuffer() function. Only possible when GetNextBuffer is
      75              :      *                                      non-NULL.
      76              :      */
      77              :     CHIP_ERROR populatePayload(SetupPayloadData::AdditionalDataPayload & outPayload);
      78              : };
      79              : 
      80              : } // namespace chip
        

Generated by: LCOV version 2.0-1