Skip to content

Commit 04fbb8f

Browse files
PeterC1965restyled-commitsbzbarsky-apple
authored
Add device-energy-management cluster example app code for 1.4 (#33910)
* Get the EVSE app building and test TC_DEM_2_2 passing * Get all targets building * Address JamesH review comments * Rename utils.cpp to DEMUtils.cpp * Address JamesH review comments * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Restyled by autopep8 * Restyled by isort * Fix compilation problem by including lib/core/DataModelTypes.h * Fix compilation problem by including * Save examples/all-clusters-app/all-clusters-common/all-clusters-app.zap to update it * Restyled by clang-format * Apply further code review changes * Restyled by clang-format * Restyled by gn * Address code review comments from AndreiL * Restyled by whitespace * Restyled by clang-format * Fix ESP build * Fix ESP build * Restyled by clang-format * Rename src/python_testing/TC_DEM_Utils.py src/python_testing/DEMTestBase.py * Put time util funtions into namespace + drop the Utils prefix * Restyled by whitespace * Restyled by isort * Try to address setForecast comments from Boris * Remove unnecessary SetXXX methods from the device energy management cluster interface * Restyled by clang-format * Apply code review changes suggested by Louis-Philip Beliveau * Document the API for GetForecast and GetPowerAdjustmentCapability * Document the GetForecast and GetPowerAdjustmentCapability APIs * Update src/app/clusters/device-energy-management-server/device-energy-management-server.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/clusters/device-energy-management-server/device-energy-management-server.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Address review comments from Boris * Sync up with code review comments from PR34234 * Sync up with code review comments from PR34234 that caused some return codes to change * Restyled by clang-format * modifyForecastRequest: Failure should be returned if a slot number > num slots in a forecast * Update examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/include/EVSECallbacks.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Address review comments from Boris * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Address further review comments from Boris * Address further review comments from Boris * Address further review comments from Boris * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Address further review comments from Boris * Update examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Apply further review comments from Boris * Used a bitmap rather than uint8_t and sync EnergyTimeUtils files from the EVSE_Add_Get_Set_Clear_Targets_Support branch * Update following review comments from Boris * Allow more time for forecast.startTime in test setup as tests can take variable lengths of time to run * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Addressing further review comments from Boris * Fix small issue found as a result of the DEM test script review * Protect against forecast being null * Remove src/python_testing/DEMTestBase.py as renamed in PR34234 * Update following review comment from Andrei * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent 68ef6f1 commit 04fbb8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3002
-504
lines changed

examples/all-clusters-app/ameba/chip_main.cmake

100755100644
+2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@ list(
187187

188188
${chip_dir}/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp
189189

190+
${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp
190191
${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp
191192
${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp
193+
${chip_dir}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp
192194
${chip_dir}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp
193195
${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp
194196
${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp

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

100755100644
+2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ asr_executable("clusters_app") {
8484
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp",
8585
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp",
8686
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp",
87+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp",
8788
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
8889
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
8990
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
91+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp",
9092
"${examples_plat_dir}/ButtonHandler.cpp",
9193
"${examples_plat_dir}/CHIPDeviceManager.cpp",
9294
"${examples_plat_dir}/LEDWidget.cpp",

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

+2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ ti_simplelink_executable("all-clusters-app") {
7474
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp",
7575
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp",
7676
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp",
77+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp",
7778
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
7879
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
7980
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
81+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp",
8082
"${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp",
8183
"${chip_root}/src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerHandler.cpp",
8284
"${project_dir}/main/AppTask.cpp",

examples/all-clusters-app/infineon/psoc6/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ psoc6_executable("clusters_app") {
126126
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp",
127127
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp",
128128
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp",
129+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp",
129130
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
130131
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
131132
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
133+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp",
132134
"${examples_plat_dir}/LEDWidget.cpp",
133135
"${examples_plat_dir}/init_psoc6Platform.cpp",
134136
"src/AppTask.cpp",

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

+2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ source_set("chip-all-clusters-common") {
6060
"${chip_root}/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp",
6161
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp",
6262
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp",
63+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp",
6364
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
6465
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
6566
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
67+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp",
6668
"${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp",
6769
"${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp",
6870
"AllClustersCommandDelegate.cpp",

examples/all-clusters-app/mbed/CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@ target_sources(${APP_TARGET} PRIVATE
7272
${ALL_CLUSTERS_COMMON}/src/smco-stub.cpp
7373
${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp
7474
${ALL_CLUSTERS_COMMON}/src/static-supported-temperature-levels.cpp
75+
${ENERGY_MANAGEMENT_COMMON}/src/EnergyTimeUtils.cpp
76+
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp
77+
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp
78+
${ENERGY_MANAGEMENT_COMMON}/src/EVSEManufacturerImpl.cpp
7579
${ENERGY_MANAGEMENT_COMMON}/src/ElectricalPowerMeasurementDelegate.cpp
7680
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp
7781
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp
78-
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp
79-
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp
80-
8182
)
8283

8384
chip_configure_data_model(${APP_TARGET}

examples/all-clusters-app/nrfconnect/CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ include(${CHIP_ROOT}/src/app/chip_data_model.cmake)
4242
target_include_directories(app PRIVATE
4343
main/include
4444
${ALL_CLUSTERS_COMMON_DIR}/include
45-
${ENERGY_MANAGEMENT_COMMON_DIR}/include
45+
${ENERGY_MANAGEMENT_COMMON_DIR}/include
4646
${GEN_DIR}/app-common
4747
${GEN_DIR}/all-clusters-app
4848
${NRFCONNECT_COMMON}/util/include)
@@ -57,13 +57,15 @@ target_sources(app PRIVATE
5757
${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp
5858
${ALL_CLUSTERS_COMMON_DIR}/src/oven-modes.cpp
5959
${ALL_CLUSTERS_COMMON_DIR}/src/energy-evse-stub.cpp
60-
${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp
60+
${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp
6161
${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp
6262
${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp
6363
${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp
6464
${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp
65+
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyTimeUtils.cpp
6566
${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp
6667
${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp
68+
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EVSEManufacturerImpl.cpp
6769
${ENERGY_MANAGEMENT_COMMON_DIR}/src/ElectricalPowerMeasurementDelegate.cpp
6870
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp
6971
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp

examples/all-clusters-app/nxp/mw320/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ mw320_executable("shell_mw320") {
9191
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp",
9292
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp",
9393
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp",
94+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp",
9495
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
9596
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
9697
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
98+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp",
9799
"${chip_root}/src/lib/shell/streamer_mw320.cpp",
98100
"binding-handler.cpp",
99101
"include/CHIPProjectConfig.h",

examples/all-clusters-app/openiotsdk/CMakeLists.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ target_include_directories(${APP_TARGET}
4848
PRIVATE
4949
main/include
5050
${ALL_CLUSTERS_COMMON}/include
51-
${ENERGY_MANAGEMENT_COMMON}/include
51+
${ENERGY_MANAGEMENT_COMMON}/include
5252
)
5353

5454
target_sources(${APP_TARGET}
@@ -60,16 +60,18 @@ target_sources(${APP_TARGET}
6060
${ALL_CLUSTERS_COMMON}/src/concentration-measurement-instances.cpp
6161
${ALL_CLUSTERS_COMMON}/src/fan-stub.cpp
6262
${ALL_CLUSTERS_COMMON}/src/oven-modes.cpp
63-
${ALL_CLUSTERS_COMMON}/src/device-energy-management-stub.cpp
63+
${ALL_CLUSTERS_COMMON}/src/device-energy-management-stub.cpp
6464
${ALL_CLUSTERS_COMMON}/src/energy-evse-stub.cpp
6565
${ALL_CLUSTERS_COMMON}/src/resource-monitoring-delegates.cpp
6666
${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp
6767
${ALL_CLUSTERS_COMMON}/src/binding-handler.cpp
68+
${ENERGY_MANAGEMENT_COMMON}/src/EnergyTimeUtils.cpp
69+
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp
70+
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp
71+
${ENERGY_MANAGEMENT_COMMON}/src/EVSEManufacturerImpl.cpp
6872
${ENERGY_MANAGEMENT_COMMON}/src/ElectricalPowerMeasurementDelegate.cpp
6973
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp
7074
${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp
71-
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp
72-
${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp
7375
)
7476

7577
target_link_libraries(${APP_TARGET}

examples/all-clusters-app/telink/CMakeLists.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ project(chip-telink-all-clusters-app-example)
3131
target_include_directories(app PRIVATE
3232
include
3333
${ALL_CLUSTERS_COMMON_DIR}/include
34-
${ENERGY_MANAGEMENT_COMMON_DIR}/include
34+
${ENERGY_MANAGEMENT_COMMON_DIR}/include
3535
${GEN_DIR}/app-common
3636
${GEN_DIR}/all-clusters-app
3737
${TELINK_COMMON}/common/include
@@ -48,14 +48,16 @@ target_sources(app PRIVATE
4848
${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp
4949
${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp
5050
${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp
51-
${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp
51+
${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp
5252
${ALL_CLUSTERS_COMMON_DIR}/src/energy-evse-stub.cpp
5353
${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp
54+
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyTimeUtils.cpp
55+
${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp
56+
${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp
57+
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EVSEManufacturerImpl.cpp
5458
${ENERGY_MANAGEMENT_COMMON_DIR}/src/ElectricalPowerMeasurementDelegate.cpp
5559
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp
5660
${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp
57-
${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp
58-
${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp
5961
${TELINK_COMMON}/common/src/mainCommon.cpp
6062
${TELINK_COMMON}/common/src/AppTaskCommon.cpp
6163
${TELINK_COMMON}/util/src/LEDManager.cpp

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

+2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ source_set("chip-all-clusters-common") {
4040
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp",
4141
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp",
4242
"${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp",
43+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp",
4344
"${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp",
4445
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp",
4546
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp",
47+
"${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp",
4648
]
4749

4850
deps = [

examples/energy-management-app/energy-management-common/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023 Project CHIP Authors
1+
# Copyright (c) 2023-2024 Project CHIP Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+
#pragma once
20+
21+
#include <app-common/zap-generated/cluster-objects.h>
22+
#include <lib/core/DataModelTypes.h>
23+
24+
namespace chip {
25+
namespace app {
26+
namespace Clusters {
27+
namespace DeviceEnergyManagement {
28+
29+
/**
30+
* Class to abstract manufacturer specific functionality
31+
*/
32+
class DEMManufacturerDelegate
33+
{
34+
public:
35+
DEMManufacturerDelegate() {}
36+
37+
virtual ~DEMManufacturerDelegate() {}
38+
39+
// The PowerAdjustEnd event needs to report the approximate energy used by the ESA during the session.
40+
virtual int64_t GetApproxEnergyDuringSession() = 0;
41+
42+
virtual CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustRequest(const int64_t powerMw, const uint32_t durationS,
43+
AdjustmentCauseEnum cause)
44+
{
45+
return CHIP_NO_ERROR;
46+
}
47+
48+
virtual CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustCompletion() { return CHIP_NO_ERROR; }
49+
50+
virtual CHIP_ERROR HandleDeviceEnergyManagementCancelPowerAdjustRequest(CauseEnum cause) { return CHIP_NO_ERROR; }
51+
52+
virtual CHIP_ERROR HandleDeviceEnergyManagementStartTimeAdjustRequest(const uint32_t requestedStartTimeUtc,
53+
AdjustmentCauseEnum cause)
54+
{
55+
return CHIP_NO_ERROR;
56+
}
57+
58+
virtual CHIP_ERROR HandleDeviceEnergyManagementPauseRequest(const uint32_t durationS, AdjustmentCauseEnum cause)
59+
{
60+
return CHIP_NO_ERROR;
61+
}
62+
63+
virtual CHIP_ERROR HandleDeviceEnergyManagementPauseCompletion() { return CHIP_NO_ERROR; }
64+
65+
virtual CHIP_ERROR HandleDeviceEnergyManagementCancelPauseRequest(CauseEnum cause) { return CHIP_NO_ERROR; }
66+
67+
virtual CHIP_ERROR HandleDeviceEnergyManagementCancelRequest() { return CHIP_NO_ERROR; }
68+
69+
virtual CHIP_ERROR
70+
HandleModifyForecastRequest(const uint32_t forecastID,
71+
const DataModel::DecodableList<Structs::SlotAdjustmentStruct::DecodableType> & slotAdjustments,
72+
AdjustmentCauseEnum cause)
73+
{
74+
return CHIP_NO_ERROR;
75+
}
76+
77+
virtual CHIP_ERROR RequestConstraintBasedForecast(
78+
const DataModel::DecodableList<DeviceEnergyManagement::Structs::ConstraintsStruct::DecodableType> & constraints,
79+
AdjustmentCauseEnum cause)
80+
{
81+
return CHIP_NO_ERROR;
82+
}
83+
};
84+
85+
} // namespace DeviceEnergyManagement
86+
} // namespace Clusters
87+
} // namespace app
88+
} // namespace chip

0 commit comments

Comments
 (0)