Matter SDK Coverage Report
Current view: top level - controller - AbstractDnssdDiscoveryController.h (source / functions) Coverage Total Hit
Test: SHA:f84fe08d06f240e801b5d923f8a938a9938ca110 Lines: 100.0 % 1 1
Test Date: 2025-02-22 08:08:07 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2020 Project CHIP Authors
       4              :  *    All rights reserved.
       5              :  *
       6              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       7              :  *    you may not use this file except in compliance with the License.
       8              :  *    You may obtain a copy of the License at
       9              :  *
      10              :  *        http://www.apache.org/licenses/LICENSE-2.0
      11              :  *
      12              :  *    Unless required by applicable law or agreed to in writing, software
      13              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      14              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      15              :  *    See the License for the specific language governing permissions and
      16              :  *    limitations under the License.
      17              :  */
      18              : 
      19              : #pragma once
      20              : 
      21              : #include <controller/DeviceDiscoveryDelegate.h>
      22              : #include <lib/dnssd/ResolverProxy.h>
      23              : #include <lib/support/Span.h>
      24              : #include <platform/CHIPDeviceConfig.h>
      25              : 
      26              : namespace chip {
      27              : 
      28              : namespace Controller {
      29              : 
      30              : /**
      31              :  * @brief
      32              :  *   Convenient superclass for controller implementations that need to discover
      33              :  *   Commissioners or CommissionableNodes using mDNS. This Abstract class
      34              :  *   provides base implementations for logic to setup mDNS discovery requests,
      35              :  *   handling of received DiscoveredNodeData, etc. while expecting child classes
      36              :  *   to maintain a list of DiscoveredNodes and providing the implementation
      37              :  *   of the template GetDiscoveredNodes() function.
      38              :  */
      39              : class DLL_EXPORT AbstractDnssdDiscoveryController : public Dnssd::DiscoverNodeDelegate
      40              : {
      41              : public:
      42            8 :     explicit AbstractDnssdDiscoveryController(Dnssd::Resolver * resolver = nullptr) : mDNSResolver(resolver) {}
      43              : 
      44              :     void OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & nodeData) override;
      45              :     CHIP_ERROR StopDiscovery() { return mDNSResolver.StopDiscovery(); };
      46              : 
      47              : protected:
      48              :     using DiscoveredNodeList = FixedSpan<Dnssd::CommissionNodeData, CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES>;
      49              :     CHIP_ERROR SetUpNodeDiscovery();
      50              :     const Dnssd::CommissionNodeData * GetDiscoveredNode(int idx);
      51              :     virtual DiscoveredNodeList GetDiscoveredNodes()    = 0;
      52              :     DeviceDiscoveryDelegate * mDeviceDiscoveryDelegate = nullptr;
      53              :     Dnssd::ResolverProxy mDNSResolver;
      54              : };
      55              : 
      56              : } // namespace Controller
      57              : } // namespace chip
        

Generated by: LCOV version 2.0-1