From 42248d852d399952a51c32670f96ca8b0f2cbc91 Mon Sep 17 00:00:00 2001 From: corneliusclaussen <62659547+corneliusclaussen@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:36:16 +0200 Subject: [PATCH] Feature/bsp stop transaction (#733) * evse_board_support interface: allow stop transaction from bsp Signed-off-by: Cornelius Claussen --- interfaces/evse_board_support.yaml | 4 ++++ modules/EvseManager/EvseManager.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/interfaces/evse_board_support.yaml b/interfaces/evse_board_support.yaml index b968b14730..80f49b1949 100644 --- a/interfaces/evse_board_support.yaml +++ b/interfaces/evse_board_support.yaml @@ -129,5 +129,9 @@ vars: need to be implemented and the returned value is not used in those cases. type: object $ref: /board_support_common#/ProximityPilot + request_stop_transaction: + description: Publish to stop the transaction gracefully (e.g. user pressed the stop button) + type: object + $ref: /evse_manager#/StopTransactionRequest errors: - reference: /errors/evse_board_support diff --git a/modules/EvseManager/EvseManager.cpp b/modules/EvseManager/EvseManager.cpp index 8f8cd9798e..a57ff93392 100644 --- a/modules/EvseManager/EvseManager.cpp +++ b/modules/EvseManager/EvseManager.cpp @@ -112,6 +112,9 @@ void EvseManager::init() { [this](const auto& caps) { update_powersupply_capabilities(caps); }); } } + + r_bsp->subscribe_request_stop_transaction( + [this](types::evse_manager::StopTransactionRequest r) { charger->cancel_transaction(r); }); } void EvseManager::ready() {