@@ -72,16 +72,34 @@ public FirmwareStatusNotificationRequest convertRequest(ocpp.cs._2012._06.Firmwa
7272
7373 @ Override
7474 public StatusNotificationRequest convertRequest (ocpp .cs ._2012 ._06 .StatusNotificationRequest request ) {
75- ChargePointStatus status = ChargePointStatus .fromValue (request .getStatus ().value ());
75+
76+ //TODO: OCCUPIED was replaced with several more specific values. For now it will be replaced with "CHARGING",
77+ // but something else might make more sense at this place
78+
79+ ChargePointStatus status ;
80+ if (request .getStatus ().equals (ocpp .cs ._2012 ._06 .ChargePointStatus .OCCUPIED )) {
81+ status = ChargePointStatus .CHARGING ;
82+ } else {
83+ status = ChargePointStatus .fromValue (request .getErrorCode ().value ());
84+ }
7685
7786 ChargePointErrorCode errorCode16 ;
7887 ocpp .cs ._2012 ._06 .ChargePointErrorCode errorCode15 = request .getErrorCode ();
7988
8089
90+ // TODO: make sure this doesn't collide with logic implementation
91+ // New logic: Connector with Id 0 can only be AVAILABLE, UNAVAILABLE and FAULTED
92+
93+ if (request .getConnectorId () == 0
94+ && (request .getStatus ().equals (ocpp .cs ._2012 ._06 .ChargePointStatus .OCCUPIED )
95+ || request .getStatus ().equals (ocpp .cs ._2012 ._06 .ChargePointStatus .RESERVED ))) {
96+ status = ChargePointStatus .UNAVAILABLE ;
97+ }
98+
8199 // Mapping required: Enum values in both directions don't necessarily match.
82- // TODO: Make sure that no information is lost (by e.g. creating InsertConnectorStatusParams earlier in the pipeline)
100+ // Update: According to the 1.6 specification, MODE_3_ERROR was simply renamed to EV_COMMUNICATION_ERROR
83101 if (errorCode15 .equals (ocpp .cs ._2012 ._06 .ChargePointErrorCode .MODE_3_ERROR )) {
84- errorCode16 = ChargePointErrorCode .OTHER_ERROR ;
102+ errorCode16 = ChargePointErrorCode .EV_COMMUNICATION_ERROR ;
85103 } else {
86104 errorCode16 = ChargePointErrorCode .fromValue (request .getErrorCode ().value ());
87105 }
0 commit comments