|
@@ -6765,20 +6765,15 @@ void CheckSystemValue(void)
|
|
|
|
|
|
|
|
|
|
|
|
- if((server_sign == TRUE) && (ShmOCPP20Data->ReserveNow[gun_index].expiryDateTime[0] != 0) )
|
|
|
+ if((server_sign == TRUE) && (ShmOCPP20Data->ReserveNow[gun_index].expiryDateTime[0] != 0))
|
|
|
{
|
|
|
- double diff_t;
|
|
|
- struct tm tp;
|
|
|
-
|
|
|
- time_t t = time(NULL);
|
|
|
- strptime((char *)ShmOCPP20Data->ReserveNow[gun_index].expiryDateTime, "%Y-%m-%dT%H:%M:%S", &tp);
|
|
|
- tp.tm_isdst = -1;
|
|
|
- time_t utc = mktime(&tp);
|
|
|
- diff_t = difftime(utc, t);
|
|
|
-
|
|
|
- if(diff_t <= 0)
|
|
|
+ if(isOvertNow((uint8_t *)ShmOCPP20Data->ReserveNow[gun_index].expiryDateTime))
|
|
|
{
|
|
|
DEBUG_INFO("reserve expired.\n");
|
|
|
+ ShmOCPP20Data->ReservationStatusUpdate[gun_index].reservationId = ShmOCPP20Data->ReserveNow[gun_index].id;
|
|
|
+ sprintf((char*)ShmOCPP20Data->ReservationStatusUpdate[gun_index].reservationUpdateStatus, ReservationUpdateStatusEnumTypeStr[ReservationUpdateStatusEnumType_Expired]);
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gun_index].ReservationStatusUpdateReq = ON;
|
|
|
+
|
|
|
memset(ShmOCPP20Data->ReserveNow[gun_index].expiryDateTime,0,ARRAY_SIZE(ShmOCPP20Data->ReserveNow[gun_index].expiryDateTime));
|
|
|
}
|
|
|
|
|
@@ -11330,6 +11325,9 @@ int handleCancelReservationRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
ShmOCPP20Data->CsMsg.bits[gunNO].CancelReservationReq = ON;
|
|
|
+ ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationId = reservationIdInt;
|
|
|
+ sprintf((char*)ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationUpdateStatus, ReservationUpdateStatusEnumTypeStr[ReservationUpdateStatusEnumType_Removed]);
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gunNO].ReservationStatusUpdateReq = ON;
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
@@ -11349,6 +11347,9 @@ int handleCancelReservationRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
ShmOCPP20Data->CsMsg.bits[gunNO].CancelReservationReq = ON;
|
|
|
+ ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationId = reservationIdInt;
|
|
|
+ sprintf((char*)ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationUpdateStatus, ReservationUpdateStatusEnumTypeStr[ReservationUpdateStatusEnumType_Removed]);
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gunNO].ReservationStatusUpdateReq = ON;
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
@@ -11369,6 +11370,9 @@ int handleCancelReservationRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
ShmOCPP20Data->CsMsg.bits[gunNO].CancelReservationReq = ON;
|
|
|
+ ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationId = reservationIdInt;
|
|
|
+ sprintf((char*)ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationUpdateStatus, ReservationUpdateStatusEnumTypeStr[ReservationUpdateStatusEnumType_Removed]);
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gunNO].ReservationStatusUpdateReq = ON;
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
@@ -11383,6 +11387,9 @@ int handleCancelReservationRequest(char *uuid, char *payload)
|
|
|
gunNO = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index;
|
|
|
|
|
|
ShmOCPP20Data->CsMsg.bits[gunNO].CancelReservationReq = ON;
|
|
|
+ ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationId = reservationIdInt;
|
|
|
+ sprintf((char*)ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationUpdateStatus, ReservationUpdateStatusEnumTypeStr[ReservationUpdateStatusEnumType_Removed]);
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gunNO].ReservationStatusUpdateReq = ON;
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
@@ -11404,6 +11411,9 @@ int handleCancelReservationRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
ShmOCPP20Data->CsMsg.bits[gunNO].CancelReservationReq = ON;
|
|
|
+ ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationId = reservationIdInt;
|
|
|
+ sprintf((char*)ShmOCPP20Data->ReservationStatusUpdate[gunNO].reservationUpdateStatus, ReservationUpdateStatusEnumTypeStr[ReservationUpdateStatusEnumType_Removed]);
|
|
|
+ ShmOCPP20Data->CpMsg.bits[gunNO].ReservationStatusUpdateReq = ON;
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
@@ -13146,6 +13156,19 @@ int handleDeleteCertificateRequest(char *uuid, char *payload)
|
|
|
* TODO:
|
|
|
* 1. Delete certification and response
|
|
|
*/
|
|
|
+ if(strstr((char*)ShmOCPP20Data->DeleteCertificate.certificateHashData.hashAlgorithm, HashAlgorithmEnumTypeStr[HashAlgorithmEnumType_SHA256]) != NULL)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(strstr((char*)ShmOCPP20Data->DeleteCertificate.certificateHashData.hashAlgorithm, HashAlgorithmEnumTypeStr[HashAlgorithmEnumType_SHA384]) != NULL)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
strcpy((char*)ShmOCPP20Data->GetBaseReport.Response_status, DeleteCertificateStatusEnumTypeStr[DeleteCertificateStatusEnumType_Accepted]);
|
|
|
}
|
|
|
}
|
|
@@ -13419,6 +13442,26 @@ int handleGetInstalledCertificateIdsRequest(char *uuid, char *payload)
|
|
|
* TODO:
|
|
|
* 1. Get installed certificate info for response
|
|
|
*/
|
|
|
+ if(strstr((char*)ShmOCPP20Data->GetInstalledCertificateIds.certificateType[idx], GetCertificateIdUseEnumTypeStr[GetCertificateIdUseEnumType_V2GRootCertificate]) != NULL)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(strstr((char*)ShmOCPP20Data->GetInstalledCertificateIds.certificateType[idx], GetCertificateIdUseEnumTypeStr[GetCertificateIdUseEnumType_MORootCertificate]) != NULL)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(strstr((char*)ShmOCPP20Data->GetInstalledCertificateIds.certificateType[idx], GetCertificateIdUseEnumTypeStr[GetCertificateIdUseEnumType_CSMSRootCertificate]) != NULL)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(strstr((char*)ShmOCPP20Data->GetInstalledCertificateIds.certificateType[idx], GetCertificateIdUseEnumTypeStr[GetCertificateIdUseEnumType_V2GCertificateChain]) != NULL)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
strcpy((char*)ShmOCPP20Data->GetInstalledCertificateIds.Response_status, GetInstalledCertificateStatusEnumTypeStr[GetInstalledCertificateStatusEnumType_Accepted]);
|
|
|
}
|
|
@@ -14174,6 +14217,23 @@ int handleInstallCertificateRequest(char *uuid, char *payload)
|
|
|
* TODO:
|
|
|
* 1. Install certification preocess and response
|
|
|
*/
|
|
|
+ if(strstr((char*)ShmOCPP20Data->InstallCertificate.certificateType, InstallCertificateUseEnumTypeStr[InstallCertificateUseEnumType_V2GRootCertificate]))
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(strstr((char*)ShmOCPP20Data->InstallCertificate.certificateType, InstallCertificateUseEnumTypeStr[InstallCertificateUseEnumType_MORootCertificate]))
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(strstr((char*)ShmOCPP20Data->InstallCertificate.certificateType, InstallCertificateUseEnumTypeStr[InstallCertificateUseEnumType_CSMSRootCertificate]))
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
strcpy((char*)ShmOCPP20Data->InstallCertificate.Response_status, InstallCertificateStatusEnumTypeStr[GenericStatusEnumType_Accepted]);
|
|
|
sendInstallCertificateConfirmation(uuid);
|
|
|
system("/bin/fsync -d /dev/mtdblock13;/bin/sync &");
|
|
@@ -17203,9 +17263,28 @@ void handleGetCertificateStatusResponse(char *payload, int gun_index)
|
|
|
|
|
|
if(json_object_object_get(GetCertificateStatus,"ocspResult") != NULL)
|
|
|
sprintf((char*)ShmOCPP20Data->GetCertificateStatus.Response_ocspResult, json_object_get_string(json_object_object_get(GetCertificateStatus,"ocspResult")));
|
|
|
+
|
|
|
+ if(json_object_object_get(GetCertificateStatus,"statusInfo") != NULL)
|
|
|
+ {
|
|
|
+ if(json_object_object_get(json_object_object_get(GetCertificateStatus,"statusInfo"), "reasonCode") != NULL)
|
|
|
+ sprintf((char*)ShmOCPP20Data->GetCertificateStatus.Response_statusInfo.reasonCode, json_object_get_string(json_object_object_get(json_object_object_get(GetCertificateStatus,"ocspResult"), "reasonCode")));
|
|
|
+
|
|
|
+ if(json_object_object_get(json_object_object_get(GetCertificateStatus,"statusInfo"), "additionalInfo") != NULL)
|
|
|
+ sprintf((char*)ShmOCPP20Data->GetCertificateStatus.Response_statusInfo.additionalInfo, json_object_get_string(json_object_object_get(json_object_object_get(GetCertificateStatus,"ocspResult"), "additionalInfo")));
|
|
|
+ }
|
|
|
}
|
|
|
json_object_put(GetCertificateStatus);
|
|
|
|
|
|
+
|
|
|
+ if(strstr((char*)ShmOCPP20Data->GetCertificateStatus.Response_status, GetCertificateStatusEnumTypeStr[GetCertificateStatusEnumType_Accepted]) != NULL)
|
|
|
+ {
|
|
|
+
|
|
|
+ * TODO:
|
|
|
+ * 1. If get certificate response accepted process something here
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
ShmOCPP20Data->SpMsg.bits.GetCertificateStatusReq = OFF;
|
|
|
ShmOCPP20Data->SpMsg.bits.GetCertificateStatusConf = ON;
|
|
|
}
|