-
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.
EVSE Delegate callbacks to user application (#30999)
* Fix #30665 (EVSE) - Changed to use amperage_mA, energy_mWh - removed max on epoch_s - removed access for operate - removed side for events * Fix #30665 updates to try to get further with ZAP and autogen, but still fails with some parts of regen_all * Added ember-compatibility-functions.cpp which was missing. * Made all types all lowercase to resolve regen_all issues. * Fixed lint issue (trailing whitespace). * Fixes #30727 - Added initial EVSE cluster and Example Energy Managament app. * Tidied up old comments. * Restyled by whitespace * Restyled by gn * Restyled by prettier-markdown * Added copy of files to all-clusters-app linux BUILD.gn and did basic test with chip-tool * Fixed lint error (Remove PRId64) * Fix for Documentation Build and publish checker. * Updated all-clusters-app.zap after merge and regen_all * Added Cluster to ESP32 CMakeLists.txt * Fixed ESP32 compile error caused by %d * Added missing source files to each build variant * Restyled by gn * Fixed incorrect uint64_t in EnableCharging/EnableDischarging command * Fixed more issues seen on different platforms * Removed unused mEndpointId * Add source files to shell standalone BUILD.gn, More %d fixes for different platforms * Restyled by gn * Removed unused mMinimumChargingCurrentLimitFromCommand * Removed yet more unused variables * Fixed missing semi-colon. How did the other compilers not pick this up? * Capitalise function names * PR comment - Moved PluginServerInitCallback to sdk. Capitalised more function names in energy-management-app. * Restyled by whitespace * Fixes #30805 Updated energy-evse-cluster.xml * Fixes #30805 zap_regen_all commit. * Made Fault Event allow a nullable SessionID * Updates based on review (use kMaximumChargeCurrent instead of duplicate #define). Add HwSetVehicleID implementation * Added RFID Event support. Removed more unnecessary chip:: * Added Feature flags, optional commands and optional attributes. * Made command handling conditional based on features * Added Feature support to all-clusters-app * Restyled by clang-format * Fix to Darwin compile error - not checking strcmp return * Attempt to fix Darwin errors (return after else) * Updated based on latest upstream master * Removed unnecessary mInstance and used 'this' instead. * Regen_all after merge to master. * Fix review comment. * Ensure Init() returns a failure if there is one. Aligned to mode-base-server.cpp * Backed out Read attr check based on features. * Fixed EnumerateAcceptedCommands to handle Loop::Break condition. * Had missed StartDiagnostic as an optional command in InvokeCommand * Removed extra chip:: in attr types. * Updated HwSetVehicleID to copy the value from callee * Fixed potential buffer overrun in HwSetVehicleID. * Fixed simple to address comments raised by Andrei in PR 30857 * Fixed simple to address comments raised by Andrei in PR 30857 * Check Delegate is initialized before calling functions. * Check Delegate is initialized before calling functions. * Added callbacks into Application code * Restyled by whitespace * Ensured that mVehicleID free's any malloc'd CharSpan in destructor * Sync EnergyEvseDelegateImpl.cpp from Example Energy Management * Ensured that mVehicleID free's any malloc'd CharSpan in destructor * Sync EnergyEvseDelegateImpl.cpp from Example Energy Management * Sync'd changes from example energy management app, and commits from #30857 & #30727 * Added namespace to avoid global namespace error in header file. * Re-write of ApplicationInit to handle potential errors * Re-write of ApplicationInit to handle potential errors * Removed unnecessary void in function decl. * Open and saved in ZAP, then regen_all * Updated Energy-management-app.zap / .matter after change to general-diagnostics.xml change to MS. * Updated Energy-management-app.zap / .matter after change to general-diagnostics.xml change to MS. * Restyled by whitespace * Fixed types to be signed=true * Fixed 31032 - revert removal of side="server". Also turned on Events. * PR comment fix - remove Localization Config and Time Format Localization cluster * Removed EVSE commands from ZAP to avoid emberAf linker errors since these are handled in the IM Commands handler * Regen_all to update energy-management.matter file to remove commands that cause linker errors. * Minor changes to align all-clusters and energy-management common. * Apply suggestions from code review Co-authored-by: Boris Zbarsky <[email protected]> * Addressed comment and replicated into example energy management copies. * Added documentation to EVSE Callbacks as to which struct in the union is used. * Added Energy EVSE and Device Energy Management to config-data.yml under CommandHandlerInterfaceOnlyClusters. Then turned on EVSE commands in ZAP. --------- Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Boris Zbarsky <[email protected]>
- Loading branch information
Showing
12 changed files
with
448 additions
and
130 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
84 changes: 84 additions & 0 deletions
84
examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.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,84 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 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 | ||
|
||
namespace chip { | ||
namespace app { | ||
namespace Clusters { | ||
|
||
using namespace chip::app::Clusters::EnergyEvse; | ||
|
||
/* This callbacks mechanism is intended to allow different delegates to | ||
* dispatch notifications that something has changed. | ||
* | ||
* This is not specific to the EnergyEVSE cluster, but includes DeviceEnergyManagement | ||
* and potential future clusters. | ||
*/ | ||
enum EVSECallbackType | ||
{ | ||
/* | ||
* The State has changed (e.g. from Disabled to Charging, or vice-versa) | ||
*/ | ||
StateChanged, | ||
/* | ||
* ChargeCurrent has changed | ||
*/ | ||
ChargeCurrentChanged, | ||
/* | ||
* Charging Preferences have changed | ||
*/ | ||
ChargingPreferencesChanged, | ||
/* | ||
* DeviceEnergyManagement has changed | ||
*/ | ||
DeviceEnergyManagementChanged, | ||
}; | ||
|
||
struct EVSECbInfo | ||
{ | ||
EVSECallbackType type; | ||
|
||
union | ||
{ | ||
/* for type = StateChanged */ | ||
struct | ||
{ | ||
StateEnum state; | ||
SupplyStateEnum supplyState; | ||
} StateChange; | ||
|
||
/* for type = ChargeCurrentChanged */ | ||
struct | ||
{ | ||
int64_t maximumChargeCurrent; | ||
} ChargingCurrent; | ||
}; | ||
}; | ||
|
||
typedef void (*EVSECallbackFunc)(const EVSECbInfo * cb, intptr_t arg); | ||
|
||
struct EVSECallbackWrapper | ||
{ | ||
EVSECallbackFunc handler; | ||
intptr_t arg; | ||
}; | ||
|
||
} // namespace Clusters | ||
} // namespace app | ||
} // namespace chip |
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
Oops, something went wrong.