Line data Source code
1 : /*
2 : * Copyright (c) 2022-2023 Project CHIP Authors
3 : * All rights reserved.
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 <app-common/zap-generated/ids/Attributes.h>
21 : #include <app/AppConfig.h>
22 : #include <lib/support/CodeUtils.h>
23 :
24 : namespace chip {
25 : namespace app {
26 :
27 : /**
28 : * List of attribute ids of attributes that appear on every cluster and have
29 : * values that are always produced via code, hence do not appear in attribute
30 : * metadata to save space. These _must_ appear in order.
31 : */
32 : constexpr AttributeId GlobalAttributesNotInMetadata[] = {
33 : Clusters::Globals::Attributes::GeneratedCommandList::Id,
34 : Clusters::Globals::Attributes::AcceptedCommandList::Id,
35 : Clusters::Globals::Attributes::AttributeList::Id,
36 : };
37 :
38 : static_assert(ArrayIsSorted(GlobalAttributesNotInMetadata), "Array of global attribute ids must be sorted");
39 :
40 4350 : inline bool IsSupportedGlobalAttributeNotInMetadata(AttributeId attributeId)
41 : {
42 15091 : for (auto & attr : GlobalAttributesNotInMetadata)
43 : {
44 11930 : if (attr == attributeId)
45 : {
46 1189 : return true;
47 : }
48 : }
49 :
50 3161 : return false;
51 : }
52 :
53 : } // namespace app
54 : } // namespace chip
|