/src/connectedhomeip/examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * |
3 | | * Copyright (c) 2021 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 <app/clusters/mode-select-server/supported-modes-manager.h> |
22 | | #include <app/util/config.h> |
23 | | #include <cstring> |
24 | | |
25 | | namespace chip { |
26 | | namespace app { |
27 | | namespace Clusters { |
28 | | namespace ModeSelect { |
29 | | |
30 | | /** |
31 | | * This implementation statically defines the options. |
32 | | */ |
33 | | |
34 | | class StaticSupportedModesManager : public SupportedModesManager |
35 | | { |
36 | | using ModeOptionStructType = Structs::ModeOptionStruct::Type; |
37 | | using storage_value_type = const ModeOptionStructType; |
38 | | |
39 | | struct EndpointSpanPair |
40 | | { |
41 | | const EndpointId mEndpointId; |
42 | | const Span<storage_value_type> mSpan; |
43 | | |
44 | | EndpointSpanPair(const EndpointId aEndpointId, const Span<storage_value_type> && aSpan) : |
45 | 2 | mEndpointId(aEndpointId), mSpan(aSpan) |
46 | 2 | {} |
47 | | |
48 | 0 | EndpointSpanPair() : mEndpointId(0), mSpan(Span<storage_value_type>()) {} |
49 | | }; |
50 | | |
51 | | static storage_value_type coffeeOptions[]; |
52 | | static const EndpointSpanPair supportedOptionsByEndpoints[MATTER_DM_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT]; |
53 | | |
54 | | public: |
55 | | SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; |
56 | | |
57 | | Protocols::InteractionModel::Status getModeOptionByMode(EndpointId endpointId, uint8_t mode, |
58 | | const ModeOptionStructType ** dataPtr) const override; |
59 | | |
60 | 0 | ~StaticSupportedModesManager(){}; |
61 | | |
62 | 2 | StaticSupportedModesManager() {} |
63 | | }; |
64 | | |
65 | | } // namespace ModeSelect |
66 | | } // namespace Clusters |
67 | | } // namespace app |
68 | | } // namespace chip |