|
@@ -78,12 +78,14 @@ static char *ChangeAvailabilityStatusEnumTypeStr[] = {
|
|
|
MACROSTR(Scheduled)
|
|
|
};
|
|
|
|
|
|
+#if 0
|
|
|
static char *ChargingLimitSourceEnumTypeStr[] = {
|
|
|
MACROSTR(EMS),
|
|
|
MACROSTR(Other),
|
|
|
MACROSTR(SO),
|
|
|
MACROSTR(CSO)
|
|
|
};
|
|
|
+#endif
|
|
|
|
|
|
static char *ChargingProfileKindEnumTypeStr[] = {
|
|
|
MACROSTR(Absolute),
|
|
@@ -144,6 +146,7 @@ static char *ComponentCriterionEnumTypeStr[] = {
|
|
|
MACROSTR(Problem)
|
|
|
};
|
|
|
|
|
|
+#if 0
|
|
|
static char *ConnectorEnumTypeStr[] = {
|
|
|
MACROSTR(cCCS1),
|
|
|
MACROSTR(cCCS2),
|
|
@@ -168,6 +171,7 @@ static char *ConnectorEnumTypeStr[] = {
|
|
|
MACROSTR(Undetermined),
|
|
|
MACROSTR(Unknown)
|
|
|
};
|
|
|
+#endif
|
|
|
|
|
|
static char *ConnectorStatusEnumTypeStr[] = {
|
|
|
MACROSTR(Available),
|
|
@@ -177,11 +181,13 @@ static char *ConnectorStatusEnumTypeStr[] = {
|
|
|
MACROSTR(Faulted)
|
|
|
};
|
|
|
|
|
|
+#if 0
|
|
|
static char *CostKindEnumTypeStr[] = {
|
|
|
MACROSTR(CarbonDioxideEmission),
|
|
|
MACROSTR(RelativePricePercentage),
|
|
|
MACROSTR(RenewableGenerationPercentage)
|
|
|
};
|
|
|
+#endif
|
|
|
|
|
|
static char *CustomerInformationStatusEnumTypeStr[] = {
|
|
|
MACROSTR(Accepted),
|
|
@@ -222,12 +228,14 @@ static char *DisplayMessageStatusEnumTypeStr[] = {
|
|
|
MACROSTR(UnknownTransaction)
|
|
|
};
|
|
|
|
|
|
+#if 0
|
|
|
static char *EnergyTransferModeEnumTypeStr[] = {
|
|
|
MACROSTR(DC),
|
|
|
MACROSTR(AC_single_phase),
|
|
|
MACROSTR(AC_two_phase),
|
|
|
MACROSTR(AC_three_phase)
|
|
|
};
|
|
|
+#endif
|
|
|
|
|
|
static char *EventNotificationEnumTypeStr[] = {
|
|
|
MACROSTR(HardWiredNotification),
|
|
@@ -4936,6 +4944,52 @@ void CheckSystemValue(void)
|
|
|
sendAuthorizeRequest(0);
|
|
|
}
|
|
|
|
|
|
+ if(isWebsocketSendable &&
|
|
|
+ (server_sign == TRUE) &&
|
|
|
+ (ShmOCPP20Data->GetReport.requestId > 0))
|
|
|
+ {
|
|
|
+ for(uint8_t idxCriterion=0;idxCriterion<ARRAY_SIZE(ShmOCPP20Data->GetReport.componentCriteria);idxCriterion++)
|
|
|
+ {
|
|
|
+ if(strcmp((char*)ShmOCPP20Data->GetReport.componentCriteria[idxCriterion], ComponentCriterionEnumTypeStr[ComponentCriterionEnumType_Active]) == 0)
|
|
|
+ {
|
|
|
+ /*
|
|
|
+ * TODO:
|
|
|
+ * 1. Report component that are active
|
|
|
+ */
|
|
|
+ }
|
|
|
+ else if(strcmp((char*)ShmOCPP20Data->GetReport.componentCriteria[idxCriterion], ComponentCriterionEnumTypeStr[ComponentCriterionEnumType_Available]) == 0)
|
|
|
+ {
|
|
|
+ /*
|
|
|
+ * TODO:
|
|
|
+ * 1. Report component that are available
|
|
|
+ */
|
|
|
+ }
|
|
|
+ else if(strcmp((char*)ShmOCPP20Data->GetReport.componentCriteria[idxCriterion], ComponentCriterionEnumTypeStr[ComponentCriterionEnumType_Enabled]) == 0)
|
|
|
+ {
|
|
|
+ /*
|
|
|
+ * TODO:
|
|
|
+ * 1. Report component that are enable
|
|
|
+ */
|
|
|
+ }
|
|
|
+ else if(strcmp((char*)ShmOCPP20Data->GetReport.componentCriteria[idxCriterion], ComponentCriterionEnumTypeStr[ComponentCriterionEnumType_Problem]) == 0)
|
|
|
+ {
|
|
|
+ /*
|
|
|
+ * TODO:
|
|
|
+ * 1. Report component that are problem
|
|
|
+ */
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ /*
|
|
|
+ * TODO:
|
|
|
+ * 1. Process unknown criteria condition
|
|
|
+ */
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ShmOCPP20Data->GetReport.requestId = 0;
|
|
|
+ }
|
|
|
+
|
|
|
if(isWebsocketSendable &&
|
|
|
(server_sign == TRUE) &&
|
|
|
(ShmOCPP20Data->GetBaseReport.requestId > 0))
|
|
@@ -5033,6 +5087,30 @@ void CheckSystemValue(void)
|
|
|
ShmOCPP20Data->SpMsg.bits.NotifyEventReq = OFF;
|
|
|
}
|
|
|
|
|
|
+ if(isWebsocketSendable &&
|
|
|
+ (server_sign == TRUE) &&
|
|
|
+ ShmOCPP20Data->SpMsg.bits.Get15118EVCertificateReq)
|
|
|
+ {
|
|
|
+ if(strcmp((char*)ShmOCPP20Data->Get15118EVCertificate.action, CertificateActionEnumTypeStr[CertificateActionEnumType_Install]) == 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(strcmp((char*)ShmOCPP20Data->Get15118EVCertificate.action, CertificateActionEnumTypeStr[CertificateActionEnumType_Update]) == 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ sendGet15118EVCertificateRequest();
|
|
|
+ ShmOCPP20Data->SpMsg.bits.Get15118EVCertificateReq = OFF;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//===============================
|
|
|
// Each connector operation check
|
|
|
//===============================
|
|
@@ -5636,6 +5714,14 @@ void CheckSystemValue(void)
|
|
|
sendFirmwareStatusNotificationRequest((char *)ShmOCPP20Data->FirmwareStatusNotification.status);
|
|
|
}
|
|
|
|
|
|
+ //==========================================
|
|
|
+ // csu cleared charging limit request
|
|
|
+ //==========================================
|
|
|
+ if(isWebsocketSendable && (server_sign == TRUE) && (ShmOCPP20Data->CSUMsg.bits[gun_index].ClearedChargingLimitReq == ON))
|
|
|
+ {
|
|
|
+ sendClearedChargingLimitRequest(gun_index);
|
|
|
+ }
|
|
|
+
|
|
|
//==========================================
|
|
|
// csu trigger CancelReservationConf
|
|
|
//==========================================
|
|
@@ -5644,6 +5730,14 @@ void CheckSystemValue(void)
|
|
|
sendCancelReservationConfirmation((char *)ShmOCPP20Data->CancelReservation[gun_index].guid, gun_index);
|
|
|
}
|
|
|
|
|
|
+ //==========================================
|
|
|
+ // csu notify EV charging need request
|
|
|
+ //==========================================
|
|
|
+ if(isWebsocketSendable && (server_sign == TRUE) && (ShmOCPP20Data->CSUMsg.bits[gun_index].NotifyEVChargingNeedsReq == ON))
|
|
|
+ {
|
|
|
+ sendNotifyEVChargingNeedsRequest(gun_index);
|
|
|
+ }
|
|
|
+
|
|
|
//==========================================
|
|
|
// csu trigger ChangeAvailabilityConf
|
|
|
//==========================================
|
|
@@ -5658,7 +5752,6 @@ void CheckSystemValue(void)
|
|
|
if(isWebsocketSendable && (server_sign == TRUE) && (ShmOCPP20Data->CsMsg.bits[gun_index].UnlockConnectorConf == ON))
|
|
|
{
|
|
|
sendUnlockConnectorConfirmation((char *)ShmOCPP20Data->UnlockConnector[gun_index].guid, gun_index);
|
|
|
- ShmOCPP20Data->CsMsg.bits[gun_index].UnlockConnectorConf = OFF;
|
|
|
}
|
|
|
|
|
|
//==========================================
|
|
@@ -5667,7 +5760,7 @@ void CheckSystemValue(void)
|
|
|
if(isWebsocketSendable && (server_sign == TRUE) && (ShmOCPP20Data->CsMsg.bits[gun_index].ReserveNowConf == ON))
|
|
|
{
|
|
|
sendReserveNowConfirmation((char *)ShmOCPP20Data->ReserveNow[gun_index].guid, gun_index);
|
|
|
- ShmOCPP20Data->CsMsg.bits[gun_index].ReserveNowConf = OFF;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -5758,13 +5851,13 @@ int sendAuthorizeRequest(int gun_index)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //initialize struct Authorize
|
|
|
- memset(&(ShmOCPP20Data->Authorize), 0 , sizeof(struct StructAuthorize));
|
|
|
-
|
|
|
//get data from shared memory
|
|
|
strcpy((char *)ShmOCPP20Data->Authorize.idToken.idToken, (const char *)ShmSysConfigAndInfo->SysConfig.UserId);
|
|
|
- strcpy((char *)ShmOCPP20Data->Authorize.idToken.type, IdTokenEnumTypeStr[IdTokenEnumType_ISO14443]);
|
|
|
|
|
|
+ /*
|
|
|
+ if(strlen((char*)ShmOCPP20Data->Authorize.idToken.type) == 0)
|
|
|
+ strcpy((char *)ShmOCPP20Data->Authorize.idToken.type, IdTokenEnumTypeStr[IdTokenEnumType_ISO14443]);
|
|
|
+*/
|
|
|
json_object_object_add(idToken, "idToken", json_object_new_string((char*)ShmOCPP20Data->Authorize.idToken.idToken));
|
|
|
json_object_object_add(idToken, "type", json_object_new_string((char*)ShmOCPP20Data->Authorize.idToken.type));
|
|
|
json_object_object_add(Authorize, "idToken", idToken);
|
|
@@ -5863,6 +5956,8 @@ int sendClearedChargingLimitRequest(int gun_index)
|
|
|
result = PASS;
|
|
|
}
|
|
|
|
|
|
+ ShmOCPP20Data->CSUMsg.bits[gun_index].ClearedChargingLimitReq = OFF;
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -9391,6 +9486,8 @@ int sendReserveNowConfirmation(char *uuid, unsigned char gun_index)
|
|
|
LWS_Send(message);
|
|
|
result = TRUE;
|
|
|
|
|
|
+ ShmOCPP20Data->CsMsg.bits[gun_index].ReserveNowConf = OFF;
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -9685,6 +9782,8 @@ int sendUnlockConnectorConfirmation(char *uuid, unsigned char gun_index)
|
|
|
LWS_Send(message);
|
|
|
result = TRUE;
|
|
|
|
|
|
+ ShmOCPP20Data->CsMsg.bits[gun_index].UnlockConnectorConf = OFF;
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -9896,6 +9995,19 @@ int handleCertificateSignedRequest(char *uuid, char *payload)
|
|
|
if(json_object_object_get(CertificateSigned, "certificateType") != NULL)
|
|
|
{
|
|
|
sprintf((char*)ShmOCPP20Data->CertificateSigned.certificateType, "%s", json_object_get_string(json_object_object_get(CertificateSigned, "certificateType")));
|
|
|
+
|
|
|
+ if(strcmp((char*)ShmOCPP20Data->CertificateSigned.certificateType, CertificateSigningUseEnumTypeStr[CertificateSignedStatusEnumType_ChargingStationCertificate]) == 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(strcmp((char*)ShmOCPP20Data->CertificateSigned.certificateType, CertificateSigningUseEnumTypeStr[CertificateSignedStatusEnumType_V2GCertificate]) == 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
strcpy((char*)ShmOCPP20Data->CertificateSigned.Response_status, CertificateSignedStatusEnumTypeStr[CertificateSignedStatusEnumType_Accepted]);
|
|
@@ -13836,13 +13948,12 @@ int handleSetDisplayMessageRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
json_object_put(SetDisplayMessage);
|
|
|
|
|
|
- /*
|
|
|
- * TODO:
|
|
|
- * 1. Configure display message and response
|
|
|
- */
|
|
|
strcpy((char*)ShmOCPP20Data->SetDisplayMessage.Response_status, DisplayMessageStatusEnumTypeStr[DisplayMessageStatusEnumType_Accepted]);
|
|
|
sendSetMonitoringBaseConfirmation(uuid);
|
|
|
|
|
|
+ // Anouce CSU there is display request come from server
|
|
|
+ ShmOCPP20Data->MsMsg.bits.SetDisplayMessageReq = ON;
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -14989,8 +15100,8 @@ void handleClearedChargingLimitResponse(char *payload, int gun_index)
|
|
|
}
|
|
|
json_object_put(ClearedChargingLimit);
|
|
|
|
|
|
- ShmOCPP20Data->MsMsg.bits.ClearedChargingLimitReq = OFF;
|
|
|
- ShmOCPP20Data->MsMsg.bits.ClearedChargingLimitConf = ON;
|
|
|
+ ShmOCPP20Data->CSUMsg.bits[gun_index].ClearedChargingLimitReq = OFF;
|
|
|
+ ShmOCPP20Data->CSUMsg.bits[gun_index].ClearedChargingLimitConf = ON;
|
|
|
}
|
|
|
|
|
|
void handleDataTransferResponse(char *payload, int gun_index)
|