Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions modules/EVSE/EvseV2G/connection/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,12 @@ void connection_teardown(struct v2g_connection* conn) {
v2g_ctx_init_charging_session(conn->ctx, true);

/* print dlink status */
switch (conn->dlink_action) {
case MQTT_DLINK_ACTION_ERROR:
dlog(DLOG_LEVEL_TRACE, "d_link/error");
break;
case MQTT_DLINK_ACTION_TERMINATE:
switch (conn->d_link_action) {
case dLinkAction::D_LINK_ACTION_TERMINATE:
conn->ctx->p_charger->publish_dlink_terminate(nullptr);
dlog(DLOG_LEVEL_TRACE, "d_link/terminate");
break;
case MQTT_DLINK_ACTION_PAUSE:
case dLinkAction::D_LINK_ACTION_PAUSE:
conn->ctx->p_charger->publish_dlink_pause(nullptr);
dlog(DLOG_LEVEL_TRACE, "d_link/pause");
break;
Expand Down
2 changes: 1 addition & 1 deletion modules/EVSE/EvseV2G/din_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ static enum v2g_event handle_din_session_stop(struct v2g_connection* conn) {
utils::din_validate_response_code(&res->ResponseCode, conn);

/* Setuo dlink action */
conn->dlink_action = MQTT_DLINK_ACTION_TERMINATE;
conn->d_link_action = dLinkAction::D_LINK_ACTION_TERMINATE;

/* Set next expected req msg */
conn->ctx->state = WAIT_FOR_TERMINATED_SESSION; // [V2G-DC-451]
Expand Down
8 changes: 4 additions & 4 deletions modules/EVSE/EvseV2G/iso_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ static enum v2g_event handle_iso_session_stop(struct v2g_connection* conn) {
/* Set the next charging state */
switch (req->ChargingSession) {
case iso2_chargingSessionType_Terminate:
conn->dlink_action = MQTT_DLINK_ACTION_TERMINATE;
conn->d_link_action = dLinkAction::D_LINK_ACTION_TERMINATE;
conn->ctx->hlc_pause_active = false;
/* Set next expected req msg */
conn->ctx->state = (int)iso_dc_state_id::WAIT_FOR_TERMINATED_SESSION;
Expand All @@ -2158,21 +2158,21 @@ static enum v2g_event handle_iso_session_stop(struct v2g_connection* conn) {
/* Check if the EV is allowed to request the sleep mode. TODO: Remove "true" if sleep mode is supported */
if (((conn->ctx->last_v2g_msg != V2G_POWER_DELIVERY_MSG) &&
(conn->ctx->last_v2g_msg != V2G_WELDING_DETECTION_MSG))) {
conn->dlink_action = MQTT_DLINK_ACTION_TERMINATE;
conn->d_link_action = dLinkAction::D_LINK_ACTION_TERMINATE;
res->ResponseCode = iso2_responseCodeType_FAILED;
conn->ctx->hlc_pause_active = false;
conn->ctx->state = (int)iso_dc_state_id::WAIT_FOR_TERMINATED_SESSION;
} else {
/* Init sleep mode for the EV */
conn->dlink_action = MQTT_DLINK_ACTION_PAUSE;
conn->d_link_action = dLinkAction::D_LINK_ACTION_PAUSE;
conn->ctx->hlc_pause_active = true;
conn->ctx->state = (int)iso_dc_state_id::WAIT_FOR_SESSIONSETUP;
}
break;

default:
/* Set next expected req msg */
conn->dlink_action = MQTT_DLINK_ACTION_TERMINATE;
conn->d_link_action = dLinkAction::D_LINK_ACTION_TERMINATE;
conn->ctx->state = (int)iso_dc_state_id::WAIT_FOR_TERMINATED_SESSION;
}

Expand Down
9 changes: 4 additions & 5 deletions modules/EVSE/EvseV2G/v2g.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,9 @@ struct v2g_context {
bool connection_initiated;
};

enum mqtt_dlink_action {
MQTT_DLINK_ACTION_ERROR,
MQTT_DLINK_ACTION_TERMINATE,
MQTT_DLINK_ACTION_PAUSE,
enum class dLinkAction {
D_LINK_ACTION_TERMINATE,
D_LINK_ACTION_PAUSE
};

/**
Expand Down Expand Up @@ -410,7 +409,7 @@ struct v2g_connection {
struct iso2_exiDocument* iso2EXIDocument;
} exi_out;

enum mqtt_dlink_action dlink_action; /* signaled action after connection is closed */
dLinkAction d_link_action; /* signaled data-link action after connection is closed */
};

#endif /* V2G_H */
2 changes: 1 addition & 1 deletion modules/EVSE/EvseV2G/v2g_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ int v2g_handle_connection(struct v2g_connection* conn) {

/* Here is a good point to wait until the customer is ready for a resumed session,
* because we are waiting for the incoming message of the ev */
if (conn->dlink_action == MQTT_DLINK_ACTION_PAUSE) {
if (conn->d_link_action == dLinkAction::D_LINK_ACTION_PAUSE) {
// TODO: D_LINK pause
}

Expand Down