Matter SDK Coverage Report
Current view: top level - app/server - ThreadRendezvousAnnouncement.h (source / functions) Coverage Total Hit
Test: SHA:e021a368d10ac6f3f201c101585146211fdcdaa2 Lines: 100.0 % 3 3
Test Date: 2026-02-13 08:13:38 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2026 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 <lib/core/CHIPError.h>
      21              : #include <lib/dnssd/Advertiser.h>
      22              : #include <lib/support/CodeUtils.h>
      23              : #include <lib/support/logging/CHIPLogging.h>
      24              : #include <system/SystemPacketBuffer.h>
      25              : 
      26              : #include <stddef.h>
      27              : 
      28              : namespace chip {
      29              : namespace app {
      30              : 
      31              : /**
      32              :  * @brief Helper class to build TXT record entries for Thread MeshCoP advertisement.
      33              :  */
      34              : class TxtStringsBuilder
      35              : {
      36              : public:
      37            2 :     TxtStringsBuilder() = default;
      38              : 
      39              :     /**
      40              :      * @brief Fills the TXT record entries from the given advertising parameters.
      41              :      *
      42              :      * @param params The advertising parameters.
      43              :      * @return CHIP_ERROR CHIP_NO_ERROR on success, or CHIP_ERROR_BUFFER_TOO_SMALL if the buffer is too small.
      44              :      */
      45              :     CHIP_ERROR Fill(const Dnssd::CommissionAdvertisingParameters & params);
      46              : 
      47            1 :     size_t GetCount() const { return mCount; }
      48            1 :     const char ** GetEntries() const { return const_cast<const char **>(mTxtStrings); }
      49              : 
      50              : private:
      51              :     CHIP_ERROR FormatAndAdd(const char * format, ...) ENFORCE_FORMAT(2, 3);
      52              : 
      53              :     static constexpr size_t kMaxTxtStringsBuffer = 256;
      54              : 
      55              :     char mTxtBuffer[kMaxTxtStringsBuffer];
      56              :     char * mNextStart = &mTxtBuffer[0];
      57              :     size_t mCount     = 0;
      58              :     const char * mTxtStrings[Dnssd::CommissionAdvertisingParameters::kTxtMaxNumber];
      59              : };
      60              : 
      61              : #if CHIP_DEVICE_CONFIG_ENABLE_THREAD_MESHCOP
      62              : 
      63              : /**
      64              :  * @brief Builds the Thread Rendezvous Announcement packet buffer.
      65              :  *
      66              :  * @param params The advertising parameters.
      67              :  * @param outBuffer The resulting packet buffer handle.
      68              :  * @return CHIP_ERROR CHIP_NO_ERROR on success, or other error on failure.
      69              :  */
      70              : CHIP_ERROR BuildThreadRendezvousAnnouncement(const Dnssd::CommissionAdvertisingParameters & params,
      71              :                                              System::PacketBufferHandle & outBuffer);
      72              : 
      73              : #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_MESHCOP
      74              : 
      75              : } // namespace app
      76              : } // namespace chip
        

Generated by: LCOV version 2.0-1