Skip to content

Commit

Permalink
moved to signal_session_resumed_event in Charger.hpp
Browse files Browse the repository at this point in the history
Signed-off-by: pietfried <[email protected]>
  • Loading branch information
Pietfried committed Jul 31, 2024
1 parent 86ad055 commit 3d1328e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
5 changes: 2 additions & 3 deletions modules/EvseManager/Charger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class Charger {

// Signal for EvseEvents
sigslot::signal<types::evse_manager::SessionEventEnum> signal_simple_event;
sigslot::signal<std::string> signal_session_resumed_event;
sigslot::signal<types::evse_manager::StartSessionReason, std::optional<types::authorization::ProvidedIdToken>>
signal_session_started_event;
sigslot::signal<types::authorization::ProvidedIdToken> signal_transaction_started_event;
Expand Down Expand Up @@ -362,13 +363,11 @@ class Charger {

const std::unique_ptr<IECStateMachine>& bsp;
const std::unique_ptr<ErrorHandling>& error_handling;
const std::vector<std::unique_ptr<powermeterIntf>>& r_powermeter_billing;
const std::unique_ptr<PersistentStore>& store;

std::atomic<types::evse_board_support::Connector_type> connector_type{
types::evse_board_support::Connector_type::IEC62196Type2Cable};

const std::string evse_id;
const std::vector<std::unique_ptr<powermeterIntf>>& r_powermeter_billing;

// ErrorHandling events
enum class ErrorHandlingEvents : std::uint8_t {
Expand Down
6 changes: 1 addition & 5 deletions modules/EvseManager/EvseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,11 +931,7 @@ void EvseManager::ready() {
// informed that the EvseManager is aware of previous sessions so that no individual cleanup is required
const auto session_id = store->get_session();
if (!session_id.empty()) {
types::evse_manager::SessionEvent session_event;
session_event.uuid = session_id;
session_event.timestamp = Everest::Date::to_rfc3339(date::utc_clock::now());
session_event.event = types::evse_manager::SessionEventEnum::SessionResumed;
this->p_evse->publish_session_event(session_event);
charger->signal_session_resumed_event(session_id);
}

// By default cleanup left-over transaction from e.g. power loss
Expand Down
10 changes: 9 additions & 1 deletion modules/EvseManager/evse/evse_managerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,15 @@ void evse_managerImpl::ready() {
publish_selected_protocol(this->mod->selected_protocol);
});

mod->charger->signal_session_resumed_event.connect(
[this](const std::string& session_id) {
types::evse_manager::SessionEvent session_event;
session_event.uuid = session_id;
session_event.timestamp = Everest::Date::to_rfc3339(date::utc_clock::now());
session_event.event = types::evse_manager::SessionEventEnum::SessionResumed;
publish_session_event(session_event);
});

// Note: Deprecated. Only kept for Node red compatibility, will be removed in the future
// Legacy external mqtt pubs
mod->charger->signal_max_current.connect([this](float c) {
Expand All @@ -369,7 +378,6 @@ void evse_managerImpl::ready() {
mod->mqtt.publish(fmt::format("everest_external/nodered/{}/state/state", mod->config.connector_id),
static_cast<int>(s));
});
// /Deprecated
}

types::evse_manager::Evse evse_managerImpl::handle_get_evse() {
Expand Down

0 comments on commit 3d1328e

Please sign in to comment.