Skip to content

Commit cd5f3c6

Browse files
authored
Merge branch 'master' into feature/energypreferences
2 parents 3c4c635 + cc5b41a commit cd5f3c6

24 files changed

+609
-73
lines changed

examples/all-clusters-app/all-clusters-common/all-clusters-app.matter

+31
Original file line numberDiff line numberDiff line change
@@ -4489,6 +4489,27 @@ provisional cluster EnergyPreference = 155 {
44894489
readonly attribute int16u clusterRevision = 65533;
44904490
}
44914491

4492+
/** The Power Topology Cluster provides a mechanism for expressing how power is flowing between endpoints. */
4493+
provisional cluster PowerTopology = 156 {
4494+
revision 1;
4495+
4496+
bitmap Feature : bitmap32 {
4497+
kNodeTopology = 0x1;
4498+
kTreeTopology = 0x2;
4499+
kSetTopology = 0x4;
4500+
kDynamicPowerFlow = 0x8;
4501+
}
4502+
4503+
readonly attribute optional endpoint_no availableEndpoints[] = 0;
4504+
readonly attribute optional endpoint_no activeEndpoints[] = 1;
4505+
readonly attribute command_id generatedCommandList[] = 65528;
4506+
readonly attribute command_id acceptedCommandList[] = 65529;
4507+
readonly attribute event_id eventList[] = 65530;
4508+
readonly attribute attrib_id attributeList[] = 65531;
4509+
readonly attribute bitmap32 featureMap = 65532;
4510+
readonly attribute int16u clusterRevision = 65533;
4511+
}
4512+
44924513
/** Attributes and commands for selecting a mode from a list of supported options. */
44934514
provisional cluster EnergyEvseMode = 157 {
44944515
revision 1;
@@ -8386,6 +8407,16 @@ endpoint 1 {
83868407
callback attribute attributeList;
83878408
ram attribute featureMap default = 3;
83888409
ram attribute clusterRevision default = 1;
8410+
8411+
server cluster PowerTopology {
8412+
callback attribute availableEndpoints;
8413+
callback attribute activeEndpoints;
8414+
callback attribute generatedCommandList;
8415+
callback attribute acceptedCommandList;
8416+
callback attribute eventList;
8417+
callback attribute attributeList;
8418+
callback attribute featureMap;
8419+
ram attribute clusterRevision default = 1;
83898420
}
83908421

83918422
server cluster EnergyEvseMode {

examples/all-clusters-app/all-clusters-common/all-clusters-app.zap

+138
Original file line numberDiff line numberDiff line change
@@ -14240,6 +14240,144 @@
1424014240
}
1424114241
]
1424214242
},
14243+
{
14244+
"name": "Power Topology",
14245+
"code": 156,
14246+
"mfgCode": null,
14247+
"define": "POWER_TOPOLOGY_CLUSTER",
14248+
"side": "server",
14249+
"enabled": 1,
14250+
"attributes": [
14251+
{
14252+
"name": "AvailableEndpoints",
14253+
"code": 0,
14254+
"mfgCode": null,
14255+
"side": "server",
14256+
"type": "array",
14257+
"included": 1,
14258+
"storageOption": "External",
14259+
"singleton": 0,
14260+
"bounded": 0,
14261+
"defaultValue": null,
14262+
"reportable": 1,
14263+
"minInterval": 1,
14264+
"maxInterval": 65534,
14265+
"reportableChange": 0
14266+
},
14267+
{
14268+
"name": "ActiveEndpoints",
14269+
"code": 1,
14270+
"mfgCode": null,
14271+
"side": "server",
14272+
"type": "array",
14273+
"included": 1,
14274+
"storageOption": "External",
14275+
"singleton": 0,
14276+
"bounded": 0,
14277+
"defaultValue": null,
14278+
"reportable": 1,
14279+
"minInterval": 1,
14280+
"maxInterval": 65534,
14281+
"reportableChange": 0
14282+
},
14283+
{
14284+
"name": "GeneratedCommandList",
14285+
"code": 65528,
14286+
"mfgCode": null,
14287+
"side": "server",
14288+
"type": "array",
14289+
"included": 1,
14290+
"storageOption": "External",
14291+
"singleton": 0,
14292+
"bounded": 0,
14293+
"defaultValue": null,
14294+
"reportable": 1,
14295+
"minInterval": 1,
14296+
"maxInterval": 65534,
14297+
"reportableChange": 0
14298+
},
14299+
{
14300+
"name": "AcceptedCommandList",
14301+
"code": 65529,
14302+
"mfgCode": null,
14303+
"side": "server",
14304+
"type": "array",
14305+
"included": 1,
14306+
"storageOption": "External",
14307+
"singleton": 0,
14308+
"bounded": 0,
14309+
"defaultValue": null,
14310+
"reportable": 1,
14311+
"minInterval": 1,
14312+
"maxInterval": 65534,
14313+
"reportableChange": 0
14314+
},
14315+
{
14316+
"name": "EventList",
14317+
"code": 65530,
14318+
"mfgCode": null,
14319+
"side": "server",
14320+
"type": "array",
14321+
"included": 1,
14322+
"storageOption": "External",
14323+
"singleton": 0,
14324+
"bounded": 0,
14325+
"defaultValue": null,
14326+
"reportable": 1,
14327+
"minInterval": 1,
14328+
"maxInterval": 65534,
14329+
"reportableChange": 0
14330+
},
14331+
{
14332+
"name": "AttributeList",
14333+
"code": 65531,
14334+
"mfgCode": null,
14335+
"side": "server",
14336+
"type": "array",
14337+
"included": 1,
14338+
"storageOption": "External",
14339+
"singleton": 0,
14340+
"bounded": 0,
14341+
"defaultValue": null,
14342+
"reportable": 1,
14343+
"minInterval": 1,
14344+
"maxInterval": 65534,
14345+
"reportableChange": 0
14346+
},
14347+
{
14348+
"name": "FeatureMap",
14349+
"code": 65532,
14350+
"mfgCode": null,
14351+
"side": "server",
14352+
"type": "bitmap32",
14353+
"included": 1,
14354+
"storageOption": "External",
14355+
"singleton": 0,
14356+
"bounded": 0,
14357+
"defaultValue": null,
14358+
"reportable": 1,
14359+
"minInterval": 1,
14360+
"maxInterval": 65534,
14361+
"reportableChange": 0
14362+
},
14363+
{
14364+
"name": "ClusterRevision",
14365+
"code": 65533,
14366+
"mfgCode": null,
14367+
"side": "server",
14368+
"type": "int16u",
14369+
"included": 1,
14370+
"storageOption": "RAM",
14371+
"singleton": 0,
14372+
"bounded": 0,
14373+
"defaultValue": "1",
14374+
"reportable": 1,
14375+
"minInterval": 1,
14376+
"maxInterval": 65534,
14377+
"reportableChange": 0
14378+
}
14379+
]
14380+
},
1424314381
{
1424414382
"name": "Energy EVSE Mode",
1424514383
"code": 157,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 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+
#include <app/clusters/power-topology-server/power-topology-server.h>
20+
21+
using namespace chip;
22+
using namespace chip::app::Clusters;
23+
using namespace chip::app::Clusters::PowerTopology;
24+
25+
namespace chip {
26+
namespace app {
27+
namespace Clusters {
28+
namespace PowerTopology {
29+
30+
class PowerTopologyDelegate : public Delegate
31+
{
32+
public:
33+
~PowerTopologyDelegate() = default;
34+
35+
CHIP_ERROR GetAvailableEndpointAtIndex(size_t index, EndpointId & endpointId) override;
36+
CHIP_ERROR GetActiveEndpointAtIndex(size_t index, EndpointId & endpointId) override;
37+
};
38+
39+
CHIP_ERROR PowerTopologyDelegate::GetAvailableEndpointAtIndex(size_t index, EndpointId & endpointId)
40+
{
41+
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
42+
}
43+
44+
CHIP_ERROR PowerTopologyDelegate::GetActiveEndpointAtIndex(size_t index, EndpointId & endpointId)
45+
{
46+
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
47+
}
48+
49+
} // namespace PowerTopology
50+
} // namespace Clusters
51+
} // namespace app
52+
} // namespace chip
53+
54+
static std::unique_ptr<PowerTopology::Delegate> gDelegate;
55+
static std::unique_ptr<PowerTopology::Instance> gInstance;
56+
57+
void emberAfPowerTopologyClusterInitCallback(chip::EndpointId endpointId)
58+
{
59+
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
60+
VerifyOrDie(!gInstance);
61+
62+
gDelegate = std::make_unique<PowerTopologyDelegate>();
63+
if (gDelegate)
64+
{
65+
gInstance = std::make_unique<Instance>(
66+
endpointId, *gDelegate, BitMask<Feature, uint32_t>(Feature::kSetTopology, Feature::kDynamicPowerFlow),
67+
BitMask<OptionalAttributes, uint32_t>(OptionalAttributes::kOptionalAttributeAvailableEndpoints,
68+
OptionalAttributes::kOptionalAttributeActiveEndpoints));
69+
70+
gInstance->Init();
71+
}
72+
}

examples/all-clusters-app/esp32/main/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ set(SRC_DIRS_LIST
9090
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/pump-configuration-and-control-server"
9191
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server"
9292
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server"
93+
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-topology-server"
9394
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/resource-monitoring-server"
9495
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server"
9596
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server"

examples/all-clusters-app/linux/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ source_set("chip-all-clusters-common") {
4949
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp",
5050
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp",
5151
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp",
52+
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/power-topology-stub.cpp",
5253
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
5354
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp",
5455
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/rvc-operational-state-delegate-impl.cpp",

examples/all-clusters-app/tizen/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ source_set("chip-all-clusters-common") {
3333
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
3434
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
3535
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp",
36+
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/power-topology-stub.cpp",
3637
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp",
3738
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp",
3839
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",

0 commit comments

Comments
 (0)