LCOV - code coverage report
Current view: top level - lib/core - CHIPVendorIdentifiers.hpp (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 2 2 100.0 %
Date: 2024-02-15 08:20:41 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  *
       3             :  *    Copyright (c) 2020-2022 Project CHIP Authors
       4             :  *    Copyright (c) 2014-2017 Nest Labs, Inc.
       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             : /**
      20             :  *    @file
      21             :  *      This file defines chip vendor identifiers.
      22             :  *
      23             :  *      Vendor identifiers are assigned and administered by CHIP.
      24             :  *
      25             :  */
      26             : 
      27             : #pragma once
      28             : 
      29             : #include <cstdint>
      30             : 
      31             : namespace chip {
      32             : 
      33             : //
      34             : // CHIP Vendor Identifiers (16 bits max)
      35             : //
      36             : // These values are under administration by Connectivity Standards Alliance (CSA).
      37             : // For new value allocation make a formal request to CSA.
      38             : // The database of currently allocated identifiers can be found in this document:
      39             : // https://groups.csa-iot.org/wg/members-all/document/10905
      40             : //
      41             : // As per specifications (section 2.5.2 Vendor Identifier)
      42             : enum VendorId : uint16_t
      43             : {
      44             :     Common       = 0x0000u,
      45             :     Unspecified  = 0x0000u,
      46             :     Apple        = 0x1349u,
      47             :     Google       = 0x6006u,
      48             :     TestVendor1  = 0xFFF1u,
      49             :     TestVendor2  = 0xFFF2u,
      50             :     TestVendor3  = 0xFFF3u,
      51             :     TestVendor4  = 0xFFF4u,
      52             :     NotSpecified = 0xFFFFu
      53             : };
      54             : 
      55             : constexpr bool IsTestVendorId(VendorId vid)
      56             : {
      57             :     return (vid >= TestVendor1 && vid <= TestVendor4);
      58             : }
      59             : 
      60          42 : constexpr bool IsVendorIdValidOperationally(uint16_t vendorId)
      61             : {
      62          42 :     return (vendorId != static_cast<uint16_t>(VendorId::Common)) && (vendorId <= static_cast<uint16_t>(VendorId::TestVendor4));
      63             : }
      64             : 
      65             : constexpr bool IsVendorIdValidOperationally(VendorId vendorId)
      66             : {
      67             :     return IsVendorIdValidOperationally(static_cast<uint16_t>(vendorId));
      68             : }
      69             : 
      70             : } // namespace chip

Generated by: LCOV version 1.14