-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> * Update src/app/clusters/device-energy-management-server/device-energy-management-server.h Co-authored-by: Boris Zbarsky <[email protected]> * 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 <[email protected]> * Update examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/include/EVSECallbacks.h Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp Co-authored-by: Boris Zbarsky <[email protected]> * Address review comments from Boris * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp Co-authored-by: Boris Zbarsky <[email protected]> * 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 <[email protected]> * Address further review comments from Boris * Update examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp Co-authored-by: Boris Zbarsky <[email protected]> * 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 <[email protected]> * Update examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp Co-authored-by: Boris Zbarsky <[email protected]> * Update examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp Co-authored-by: Boris Zbarsky <[email protected]> * 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 <[email protected]> Co-authored-by: Boris Zbarsky <[email protected]>
- Loading branch information
Showing
49 changed files
with
3,002 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/energy-management-app/energy-management-common/BUILD.gn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
examples/energy-management-app/energy-management-common/include/DEMManufacturerDelegate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <app-common/zap-generated/cluster-objects.h> | ||
#include <lib/core/DataModelTypes.h> | ||
|
||
namespace chip { | ||
namespace app { | ||
namespace Clusters { | ||
namespace DeviceEnergyManagement { | ||
|
||
/** | ||
* Class to abstract manufacturer specific functionality | ||
*/ | ||
class DEMManufacturerDelegate | ||
{ | ||
public: | ||
DEMManufacturerDelegate() {} | ||
|
||
virtual ~DEMManufacturerDelegate() {} | ||
|
||
// The PowerAdjustEnd event needs to report the approximate energy used by the ESA during the session. | ||
virtual int64_t GetApproxEnergyDuringSession() = 0; | ||
|
||
virtual CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustRequest(const int64_t powerMw, const uint32_t durationS, | ||
AdjustmentCauseEnum cause) | ||
{ | ||
return CHIP_NO_ERROR; | ||
} | ||
|
||
virtual CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustCompletion() { return CHIP_NO_ERROR; } | ||
|
||
virtual CHIP_ERROR HandleDeviceEnergyManagementCancelPowerAdjustRequest(CauseEnum cause) { return CHIP_NO_ERROR; } | ||
|
||
virtual CHIP_ERROR HandleDeviceEnergyManagementStartTimeAdjustRequest(const uint32_t requestedStartTimeUtc, | ||
AdjustmentCauseEnum cause) | ||
{ | ||
return CHIP_NO_ERROR; | ||
} | ||
|
||
virtual CHIP_ERROR HandleDeviceEnergyManagementPauseRequest(const uint32_t durationS, AdjustmentCauseEnum cause) | ||
{ | ||
return CHIP_NO_ERROR; | ||
} | ||
|
||
virtual CHIP_ERROR HandleDeviceEnergyManagementPauseCompletion() { return CHIP_NO_ERROR; } | ||
|
||
virtual CHIP_ERROR HandleDeviceEnergyManagementCancelPauseRequest(CauseEnum cause) { return CHIP_NO_ERROR; } | ||
|
||
virtual CHIP_ERROR HandleDeviceEnergyManagementCancelRequest() { return CHIP_NO_ERROR; } | ||
|
||
virtual CHIP_ERROR | ||
HandleModifyForecastRequest(const uint32_t forecastID, | ||
const DataModel::DecodableList<Structs::SlotAdjustmentStruct::DecodableType> & slotAdjustments, | ||
AdjustmentCauseEnum cause) | ||
{ | ||
return CHIP_NO_ERROR; | ||
} | ||
|
||
virtual CHIP_ERROR RequestConstraintBasedForecast( | ||
const DataModel::DecodableList<DeviceEnergyManagement::Structs::ConstraintsStruct::DecodableType> & constraints, | ||
AdjustmentCauseEnum cause) | ||
{ | ||
return CHIP_NO_ERROR; | ||
} | ||
}; | ||
|
||
} // namespace DeviceEnergyManagement | ||
} // namespace Clusters | ||
} // namespace app | ||
} // namespace chip |
Oops, something went wrong.