Line data Source code
1 : /*
2 : * Copyright (c) 2025 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 : #pragma once
18 :
19 : #include <app/data-model-provider/Provider.h>
20 : #include <protocols/interaction_model/StatusCode.h>
21 :
22 : namespace chip {
23 : namespace Test {
24 :
25 : /// A provider that is emtpy - it contains no endpoints and most
26 : /// calls fail with `Unsupported Endpoint`
27 : ///
28 : /// This is a bare minimum implentation to have somethign that claims to be a `Provider`
29 : /// however it has no real implementation that is useful. Over time this should be replaced
30 : /// with some code-generated/controllable provider to allow for better testing.
31 : class EmptyProvider : public app::DataModel::Provider
32 : {
33 : public:
34 : using ActionReturnStatus = app::DataModel::ActionReturnStatus;
35 : template <typename T>
36 : using ListBuilder = app::DataModel::ListBuilder<T>;
37 :
38 : CHIP_ERROR Shutdown() override;
39 : CHIP_ERROR Endpoints(ListBuilder<app::DataModel::EndpointEntry> & builder) override;
40 :
41 : CHIP_ERROR SemanticTags(EndpointId endpointId, ListBuilder<SemanticTag> & builder) override;
42 : CHIP_ERROR DeviceTypes(EndpointId endpointId, ListBuilder<app::DataModel::DeviceTypeEntry> & builder) override;
43 : CHIP_ERROR ClientClusters(EndpointId endpointId, ListBuilder<ClusterId> & builder) override;
44 : CHIP_ERROR ServerClusters(EndpointId endpointId, ListBuilder<app::DataModel::ServerClusterEntry> & builder) override;
45 : CHIP_ERROR Attributes(const app::ConcreteClusterPath & path, ListBuilder<app::DataModel::AttributeEntry> & builder) override;
46 : CHIP_ERROR GeneratedCommands(const app::ConcreteClusterPath & path, ListBuilder<CommandId> & builder) override;
47 : CHIP_ERROR AcceptedCommands(const app::ConcreteClusterPath & path,
48 : ListBuilder<app::DataModel::AcceptedCommandEntry> & builder) override;
49 0 : void ListAttributeWriteNotification(const app::ConcreteAttributePath & aPath,
50 : app::DataModel::ListWriteOperation opType) override
51 0 : {}
52 :
53 : void Temporary_ReportAttributeChanged(const app::AttributePathParams & path) override;
54 :
55 : ActionReturnStatus ReadAttribute(const app::DataModel::ReadAttributeRequest & request,
56 : app::AttributeValueEncoder & encoder) override;
57 : ActionReturnStatus WriteAttribute(const app::DataModel::WriteAttributeRequest & request,
58 : app::AttributeValueDecoder & decoder) override;
59 : std::optional<ActionReturnStatus> InvokeCommand(const app::DataModel::InvokeRequest & request,
60 : chip::TLV::TLVReader & input_arguments, app::CommandHandler * handler) override;
61 : };
62 :
63 : } // namespace Test
64 : } // namespace chip
|