LCOV - code coverage report
Current view: top level - lib/format - tlv_meta.h (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 10 10 100.0 %
Date: 2024-02-15 08:20:41 Functions: 5 5 100.0 %

          Line data    Source code
       1             : /*
       2             :  *
       3             :  *    Copyright (c) 2023 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             : #pragma once
      19             : 
      20             : #include <lib/core/TLVTags.h>
      21             : 
      22             : namespace chip {
      23             : namespace TLVMeta {
      24             : 
      25             : static constexpr uint32_t kAttributeProfile = 1;
      26             : static constexpr uint32_t kCommandProfile   = 2;
      27             : static constexpr uint32_t kEventProfile     = 3;
      28             : 
      29         125 : constexpr TLV::Tag ClusterTag(uint32_t cluster_id)
      30             : {
      31         125 :     return TLV::CommonTag(cluster_id);
      32             : }
      33             : 
      34          75 : constexpr TLV::Tag AttributeTag(uint32_t attribute_id)
      35             : {
      36          75 :     return TLV::ProfileTag(kAttributeProfile, attribute_id);
      37             : }
      38             : 
      39           5 : constexpr TLV::Tag CommandTag(uint32_t command_id)
      40             : {
      41           5 :     return TLV::ProfileTag(kCommandProfile, command_id);
      42             : }
      43             : 
      44           4 : constexpr TLV::Tag EventTag(uint32_t event_id)
      45             : {
      46           4 :     return TLV::ProfileTag(kEventProfile, event_id);
      47             : }
      48             : 
      49          10 : constexpr TLV::Tag ConstantValueTag(uint64_t value)
      50             : {
      51             :     // Re-use common tag for a constant value
      52             :     // Will make "RawValue be equal to value"
      53          10 :     return TLV::ProfileTag(static_cast<uint32_t>(value >> 32), static_cast<uint32_t>(value & 0xFFFFFFFF));
      54             : }
      55             : 
      56             : enum class ItemType : uint8_t
      57             : {
      58             :     kDefault,
      59             :     kList,
      60             :     kEnum,
      61             :     kBitmap,
      62             : 
      63             :     // Special protocol types
      64             :     kProtocolClusterId,
      65             :     kProtocolAttributeId,
      66             :     kProtocolCommandId,
      67             :     kProtocolEventId,
      68             : 
      69             :     kProtocolPayloadAttribute,
      70             :     kProtocolPayloadCommand,
      71             :     kProtocolPayloadEvent,
      72             : 
      73             :     kProtocolBinaryData,
      74             : };
      75             : 
      76             : struct ItemInfo
      77             : {
      78             :     TLV::Tag tag;
      79             :     const char * name;
      80             :     ItemType type;
      81             : };
      82             : 
      83             : } // namespace TLVMeta
      84             : } // namespace chip

Generated by: LCOV version 1.14