Skip to content

Commit afbc4fc

Browse files
author
dingo35
committed
tcp.cpp: make ISO2 more or less stateless
1 parent 32f025c commit afbc4fc

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

SmartEVSE-3/src/tcp.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ void decodeV2GTP(void) {
571571
memset(&exiDoc, 0, sizeof(struct iso2_exiDocument));
572572
decode_iso2_exiDocument(&stream, &exiDoc);
573573

574-
if (fsmState == stateWaitForSessionSetupRequest) {
574+
//if (fsmState == stateWaitForSessionSetupRequest) {
575575
// Check if we have received the correct message
576576
if (exiDoc.V2G_Message.Body.SessionSetupReq_isUsed) {
577577
// define a SessionID
@@ -618,8 +618,8 @@ void decodeV2GTP(void) {
618618
fsmState = stateWaitForServiceDiscoveryRequest;
619619
return;
620620
}
621-
}
622-
if (fsmState == stateWaitForServiceDiscoveryRequest) {
621+
//}
622+
//if (fsmState == stateWaitForServiceDiscoveryRequest) {
623623
// Check if we have received the correct message
624624
if (exiDoc.V2G_Message.Body.ServiceDiscoveryReq_isUsed) {
625625

@@ -663,9 +663,9 @@ void decodeV2GTP(void) {
663663
fsmState = stateWaitForServicePaymentSelectionRequest;
664664
return;
665665
}
666-
}
666+
//}
667667

668-
if (fsmState == stateWaitForServicePaymentSelectionRequest) {
668+
//if (fsmState == stateWaitForServicePaymentSelectionRequest) {
669669
// Check if we have received the correct message
670670
if (exiDoc.V2G_Message.Body.PaymentServiceSelectionReq_isUsed) {
671671
_LOG_I("ServicePaymentSelectionRequest\n");
@@ -685,9 +685,9 @@ void decodeV2GTP(void) {
685685
return;
686686
} //FIXME howto handle other payment options?
687687
}
688-
}
688+
//}
689689

690-
if (fsmState == stateWaitForContractAuthenticationRequest) {
690+
//if (fsmState == stateWaitForContractAuthenticationRequest) {
691691
// Check if we have received the correct message
692692
if (exiDoc.V2G_Message.Body.AuthorizationReq_isUsed) {
693693
_LOG_I("AuthorizationRequest\n");
@@ -712,9 +712,9 @@ void decodeV2GTP(void) {
712712
EncodeAndTransmit(&exiDoc);
713713
return;
714714
}
715-
}
715+
//}
716716

717-
if (fsmState == stateWaitForChargeParameterDiscoveryRequest) {
717+
//if (fsmState == stateWaitForChargeParameterDiscoveryRequest) {
718718
// Check if we have received the correct message
719719
if (exiDoc.V2G_Message.Body.ChargeParameterDiscoveryReq_isUsed) {
720720
_LOG_I("ChargeParameterDiscoveryRequest\n");
@@ -938,8 +938,8 @@ void decodeV2GTP(void) {
938938
fsmState = stateWaitForPowerDeliveryRequest; //we did not negotiate scheduled charging so no need to wait for ScheduleExchangeReq
939939
return;
940940
}
941-
}
942-
if (fsmState == stateWaitForPowerDeliveryRequest || fsmState == stateChargeLoop ) {
941+
//}
942+
//if (fsmState == stateWaitForPowerDeliveryRequest || fsmState == stateChargeLoop ) {
943943
if (exiDoc.V2G_Message.Body.PowerDeliveryReq_isUsed) {
944944
//example PowerDeliveryRequest:
945945
//{"V2G_Message": {"Header": {"SessionID": "E73110994DA0BF54"}, "Body": {"PowerDeliveryReq": {"ChargeProgress": "Start", "SAScheduleTupleID": 1, "ChargingProfile": {"ProfileEntry": [{"ChargingProfileEntryStart": 0, "ChargingProfileEntryMaxPower": {"Value": 11000, "Multiplier": 0, "Unit": "W"}}, {"ChargingProfileEntryStart": 86400, "ChargingProfileEntryMaxPower": {"Value": 0, "Multiplier": 0, "Unit": "W"}}]}}}}}
@@ -992,14 +992,14 @@ void decodeV2GTP(void) {
992992
fsmState = stateWaitForChargeParameterDiscoveryRequest; //FIXME
993993
return;
994994
}
995-
}
995+
//}
996996
#define INIT_ISO2_RESPONSE(X) \
997997
init_iso2_BodyType(&exiDoc.V2G_Message.Body); \
998998
init_iso2_##X##ResType(&exiDoc.V2G_Message.Body.X##Res); \
999999
exiDoc.V2G_Message.Body.X##Res_isUsed = 1; \
10001000
exiDoc.V2G_Message.Body.X##Res.ResponseCode = iso2_responseCodeType_OK;
10011001

1002-
if (fsmState == stateWaitForChargingStatusRequest || fsmState == stateChargeLoop) {
1002+
//if (fsmState == stateWaitForChargingStatusRequest || fsmState == stateChargeLoop) {
10031003
if (exiDoc.V2G_Message.Body.ChargingStatusReq_isUsed) {
10041004
_LOG_I("ChargingStatusRequest.\n");
10051005
INIT_ISO2_RESPONSE(ChargingStatus)
@@ -1031,7 +1031,7 @@ void decodeV2GTP(void) {
10311031
fsmState = stateChargeLoop; //FIXME
10321032
return;
10331033
}
1034-
}
1034+
//}
10351035

10361036
//this code will be executed regardless of fsmState
10371037
if (exiDoc.V2G_Message.Body.SessionStopReq_isUsed) { //formally only can be sent after sending PowerDeliveryReq with ChargeProgress equal to Stop

0 commit comments

Comments
 (0)