|
@@ -3979,6 +3979,7 @@ int sendStatusNotificationRequest(int gun_index)
|
|
|
char buf[28];//, usec_buf[6];
|
|
|
char tempdata[65]={0};
|
|
|
int tempIndex = 0;
|
|
|
+ uint8_t isStateChanged = TRUE;
|
|
|
|
|
|
DEBUG_INFO("sendStatusNotificationRequest...\n");
|
|
|
gettimeofday(&tmnow, NULL);
|
|
@@ -4319,6 +4320,11 @@ S_FAULT =12
|
|
|
}
|
|
|
|
|
|
//it's option
|
|
|
+ if(strstr((char *)ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[currentStatus]) != NULL)
|
|
|
+ {
|
|
|
+ isStateChanged = FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].Timestamp, buf);
|
|
|
strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].VendorId, (char*)ShmSysConfigAndInfo->SysConfig.chargePointVendor);
|
|
|
strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].Status, ChargePointStatusStr[currentStatus]);
|
|
@@ -4336,7 +4342,7 @@ S_FAULT =12
|
|
|
, ShmOCPP16Data->StatusNotification[gun_index].VendorId
|
|
|
, ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode);
|
|
|
|
|
|
- if((server_sign == TRUE))
|
|
|
+ if((server_sign == TRUE) && isStateChanged)
|
|
|
{
|
|
|
LWS_Send(message);
|
|
|
|
|
@@ -6215,6 +6221,133 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+int sendLogStatusNotificationRequest(char *status)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ char guid[37]={0};
|
|
|
+ char tempdata[128]={0};
|
|
|
+ json_object *LogStatusNotification = json_object_new_object();
|
|
|
+
|
|
|
+ DEBUG_INFO("sendLogStatusNotificationRequest...\n");
|
|
|
+ ShmOCPP16Data->LogStatusNotification.requestId = ShmOCPP16Data->GetLog.requestId;
|
|
|
+ sprintf((char *)ShmOCPP16Data->LogStatusNotification.status,"%s",(const char *)status);
|
|
|
+
|
|
|
+ json_object_object_add(LogStatusNotification, "status", json_object_new_string((char*)ShmOCPP16Data->LogStatusNotification.status));
|
|
|
+ json_object_object_add(LogStatusNotification, "requestId", json_object_new_int(ShmOCPP16Data->LogStatusNotification.requestId));
|
|
|
+
|
|
|
+ random_uuid(guid);
|
|
|
+ sprintf(message,"[%d,\"%s\",\"LogStatusNotification\",%s]",MESSAGE_TYPE_CALL, guid, json_object_to_json_string_ext(LogStatusNotification, JSON_C_TO_STRING_PLAIN));
|
|
|
+ json_object_put(LogStatusNotification);
|
|
|
+ LWS_SendNow(message);
|
|
|
+
|
|
|
+ sprintf(tempdata, "LogStatusNotification,%d", 0);
|
|
|
+
|
|
|
+ if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
|
|
|
+ {
|
|
|
+ result = PASS;
|
|
|
+ }
|
|
|
+
|
|
|
+ ShmOCPP16Data->SpMsg.bits.LogStatusNotificationReq = 0;
|
|
|
+ ShmOCPP16Data->SpMsg.bits.LogStatusNotificationConf = 0;
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendSecurityEventNotificationRequest(int gun_index)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ char guid[37]={0};
|
|
|
+ char tempdata[128]={0};
|
|
|
+ json_object *SecurityEventNotification = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendSecurityEventNotificationRequest...\n");
|
|
|
+
|
|
|
+ json_object_object_add(SecurityEventNotification, "type", json_object_new_string((char*)ShmOCPP16Data->SecurityEventNotification.type));
|
|
|
+ json_object_object_add(SecurityEventNotification, "timestamp", json_object_new_string((char*)ShmOCPP16Data->SecurityEventNotification.timestamp));
|
|
|
+ json_object_object_add(SecurityEventNotification, "techInfo", json_object_new_string((char*)ShmOCPP16Data->SecurityEventNotification.techInfo));
|
|
|
+
|
|
|
+ random_uuid(guid);
|
|
|
+ sprintf(message,"[%d,\"%s\",\"%s\",%s]",MESSAGE_TYPE_CALL, guid, "SecurityEventNotification", json_object_to_json_string_ext(SecurityEventNotification, JSON_C_TO_STRING_PLAIN));
|
|
|
+ json_object_put(SecurityEventNotification);
|
|
|
+ LWS_Send(message);
|
|
|
+
|
|
|
+ sprintf(tempdata, "SecurityEventNotification,0");
|
|
|
+ if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
|
|
|
+ {
|
|
|
+ result = PASS;
|
|
|
+ }
|
|
|
+
|
|
|
+ ShmOCPP16Data->SpMsg.bits.SecurityEventNotificationReq = 0;
|
|
|
+ ShmOCPP16Data->SpMsg.bits.SecurityEventNotificationConf = 0;
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendSignCertificateRequest(int gun_index)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ char guid[37]={0};
|
|
|
+ char tempdata[128]={0};
|
|
|
+ json_object *SignCertificate = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendSignCertificateRequest...\n");
|
|
|
+
|
|
|
+ json_object_object_add(SignCertificate, "csr", json_object_new_string((char*)ShmOCPP16Data->SignCertificate.csr));
|
|
|
+
|
|
|
+ random_uuid(guid);
|
|
|
+ sprintf(message,"[%d,\"%s\",\"%s\",%s]",MESSAGE_TYPE_CALL, guid, "SignCertificate", json_object_to_json_string_ext(SignCertificate, JSON_C_TO_STRING_PLAIN));
|
|
|
+ json_object_put(SignCertificate);
|
|
|
+ LWS_Send(message);
|
|
|
+
|
|
|
+ sprintf(tempdata, "SignCertificate,0");
|
|
|
+ if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
|
|
|
+ {
|
|
|
+ result = PASS;
|
|
|
+ }
|
|
|
+ ShmOCPP16Data->SpMsg.bits.SignCertificateReq = 0;
|
|
|
+ ShmOCPP16Data->SpMsg.bits.SignCertificateConf = 0;
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendSignedFirmwareStatusNotificationRequest(char *status)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[110]={0};
|
|
|
+ char guid[37]={0};
|
|
|
+ char tempdata[65]={0};
|
|
|
+ json_object *FirmwareStatusNotification = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendSignedFirmwareStatusNotificationRequest...\n");
|
|
|
+
|
|
|
+ sprintf((char *)ShmOCPP16Data->SignedFirmwareStatusNotification.status , "%s", (const char *)status);
|
|
|
+ ShmOCPP16Data->SignedFirmwareStatusNotification.requestId = ShmOCPP16Data->SignedUpdateFirmware.requestId;
|
|
|
+
|
|
|
+ json_object_object_add(FirmwareStatusNotification, "status", json_object_new_string((char*)ShmOCPP16Data->SignedFirmwareStatusNotification.status));
|
|
|
+ json_object_object_add(FirmwareStatusNotification, "requestId", json_object_new_int(ShmOCPP16Data->SignedFirmwareStatusNotification.requestId));
|
|
|
+
|
|
|
+ random_uuid(guid);
|
|
|
+ sprintf(message,"[%d,\"%s\",\"FirmwareStatusNotification\",%s]",MESSAGE_TYPE_CALL, guid, json_object_to_json_string_ext(FirmwareStatusNotification, JSON_C_TO_STRING_PLAIN));
|
|
|
+ json_object_put(FirmwareStatusNotification);
|
|
|
+ LWS_SendNow(message);
|
|
|
+
|
|
|
+ sprintf(tempdata, "FirmwareStatusNotification,%d", 0);
|
|
|
+
|
|
|
+ if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
|
|
|
+ {
|
|
|
+ result = PASS;
|
|
|
+ }
|
|
|
+
|
|
|
+ ShmOCPP16Data->SpMsg.bits.SignedFirmwareStatusNotificationReq = 0;
|
|
|
+ ShmOCPP16Data->SpMsg.bits.SignedFirmwareStatusNotificationConf = 0;
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
//==========================================
|
|
|
// send confirm routine
|
|
|
//==========================================
|
|
@@ -6647,21 +6780,197 @@ int sendUpdateFirmwareConfirmation(char *uuid)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-int sendUnknownConfirmation(char *uuid)
|
|
|
+int sendCertificateSignedConfirmation(char *uuid)
|
|
|
{
|
|
|
mtrace();
|
|
|
- int result = FAIL;
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ json_object *CertificateSigned = json_object_new_object();
|
|
|
+
|
|
|
+ DEBUG_INFO("sendCertificateSignedConfirmation...\n");
|
|
|
+
|
|
|
+ json_object_object_add(CertificateSigned, "status", json_object_new_string((char*)ShmOCPP16Data->CertificateSigned.Response_status));
|
|
|
+
|
|
|
+ sprintf(message,"[%d,\"%s\",%s]"
|
|
|
+ ,MESSAGE_TYPE_CALLRESULT
|
|
|
+ ,uuid
|
|
|
+ ,json_object_to_json_string_ext(CertificateSigned, JSON_C_TO_STRING_PLAIN));
|
|
|
+
|
|
|
+ json_object_put(CertificateSigned);
|
|
|
+ LWS_Send(message);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendDeleteCertificateConfirmation(char *uuid)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ json_object *DeleteCertificate = json_object_new_object();
|
|
|
+
|
|
|
+ DEBUG_INFO("sendDeleteCertificateConfirmation...\n");
|
|
|
+
|
|
|
+ json_object_object_add(DeleteCertificate, "status", json_object_new_string((char*)ShmOCPP16Data->DeleteCertificate.Response_status));
|
|
|
+
|
|
|
+ sprintf(message,"[%d,\"%s\",%s]"
|
|
|
+ ,MESSAGE_TYPE_CALLRESULT
|
|
|
+ ,uuid
|
|
|
+ ,json_object_to_json_string_ext(DeleteCertificate, JSON_C_TO_STRING_PLAIN));
|
|
|
+
|
|
|
+ json_object_put(DeleteCertificate);
|
|
|
+ LWS_Send(message);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendExtendedTriggerMessageConfirmation(char *uuid)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ json_object *ExtendedTriggerMessage = json_object_new_object();
|
|
|
+
|
|
|
+ DEBUG_INFO("sendExtendedTriggerMessageConfirmation...\n");
|
|
|
+
|
|
|
+ json_object_object_add(ExtendedTriggerMessage, "status", json_object_new_string((char*)ShmOCPP16Data->ExtendedTriggerMessage.Response_status));
|
|
|
+
|
|
|
+ sprintf(message,"[%d,\"%s\",%s]"
|
|
|
+ ,MESSAGE_TYPE_CALLRESULT
|
|
|
+ ,uuid
|
|
|
+ ,json_object_to_json_string_ext(ExtendedTriggerMessage, JSON_C_TO_STRING_PLAIN));
|
|
|
+
|
|
|
+ json_object_put(ExtendedTriggerMessage);
|
|
|
+ LWS_Send(message);
|
|
|
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendGetInstalledCertificateIdsConfirmation(char *uuid)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ json_object *GetInstalledCertificateIds = json_object_new_object();
|
|
|
+ json_object *certificateHashDataDatas = json_object_new_array();
|
|
|
+
|
|
|
+ DEBUG_INFO("sendGetInstalledCertificateIdsConfirmation...\n");
|
|
|
+
|
|
|
+ json_object_object_add(GetInstalledCertificateIds, "status", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_status));
|
|
|
+
|
|
|
+ if(strlen((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[0].hashAlgorithm) > 0)
|
|
|
+ {
|
|
|
+ for(int idx=0;idx<ARRAY_SIZE(ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData);idx++)
|
|
|
+ {
|
|
|
+ json_object *certificateHashData = json_object_new_object();
|
|
|
+
|
|
|
+ json_object_object_add(certificateHashData, "hashAlgorithm", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[idx].hashAlgorithm));
|
|
|
+ json_object_object_add(certificateHashData, "issuerNameHash", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[idx].issuerNameHash));
|
|
|
+ json_object_object_add(certificateHashData, "issuerKeyHash", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[idx].issuerKeyHash));
|
|
|
+ json_object_object_add(certificateHashData, "serialNumber", json_object_new_string((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData[idx].serialNumber));
|
|
|
+
|
|
|
+ json_object_array_add(certificateHashDataDatas, certificateHashData);
|
|
|
+ }
|
|
|
+ json_object_object_add(GetInstalledCertificateIds , "certificateHashData", certificateHashDataDatas);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ json_object_put(certificateHashDataDatas);
|
|
|
+ }
|
|
|
+
|
|
|
+ sprintf(message,"[%d,\"%s\",%s]"
|
|
|
+ ,MESSAGE_TYPE_CALLRESULT
|
|
|
+ ,uuid
|
|
|
+ ,json_object_to_json_string_ext(GetInstalledCertificateIds, JSON_C_TO_STRING_PLAIN));
|
|
|
+
|
|
|
+ json_object_put(GetInstalledCertificateIds);
|
|
|
+ LWS_Send(message);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendGetLogConfirmation(char *uuid)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ json_object *GetLog = json_object_new_object();
|
|
|
+
|
|
|
+ DEBUG_INFO("sendGetLogConfirmation...\n");
|
|
|
+
|
|
|
+ json_object_object_add(GetLog, "status", json_object_new_string((char*)ShmOCPP16Data->GetLog.Response_status));
|
|
|
+
|
|
|
+ if(strlen((char*)ShmOCPP16Data->GetLog.Response_filename) > 0)
|
|
|
+ json_object_object_add(GetLog, "filename", json_object_new_string((char*)ShmOCPP16Data->GetLog.Response_filename));
|
|
|
+
|
|
|
+ sprintf(message,"[%d,\"%s\",%s]"
|
|
|
+ ,MESSAGE_TYPE_CALLRESULT
|
|
|
+ ,uuid
|
|
|
+ ,json_object_to_json_string_ext(GetLog, JSON_C_TO_STRING_PLAIN));
|
|
|
+
|
|
|
+ json_object_put(GetLog);
|
|
|
+ LWS_Send(message);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendInstallCertificateConfirmation(char *uuid)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ json_object *InstallCertificate = json_object_new_object();
|
|
|
+
|
|
|
+ DEBUG_INFO("sendInstallCertificateConfirmation...\n");
|
|
|
+
|
|
|
+ json_object_object_add(InstallCertificate, "status", json_object_new_string((char*)ShmOCPP16Data->InstallCertificate.Response_status));
|
|
|
+
|
|
|
+ sprintf(message,"[%d,\"%s\",%s]"
|
|
|
+ ,MESSAGE_TYPE_CALLRESULT
|
|
|
+ ,uuid
|
|
|
+ ,json_object_to_json_string_ext(InstallCertificate, JSON_C_TO_STRING_PLAIN));
|
|
|
+
|
|
|
+ json_object_put(InstallCertificate);
|
|
|
+ LWS_Send(message);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendSignedUpdateFirmwareConfirmation(char *uuid)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ char message[4096]={0};
|
|
|
+ json_object *SignedUpdateFirmware = json_object_new_object();
|
|
|
+
|
|
|
+ DEBUG_INFO("sendSignedUpdateFirmwareConfirmation...\n");
|
|
|
+
|
|
|
+ json_object_object_add(SignedUpdateFirmware, "status", json_object_new_string((char*)ShmOCPP16Data->SignedUpdateFirmware.Response_status));
|
|
|
+
|
|
|
+ sprintf(message,"[%d,\"%s\",%s]"
|
|
|
+ ,MESSAGE_TYPE_CALLRESULT
|
|
|
+ ,uuid
|
|
|
+ ,json_object_to_json_string_ext(SignedUpdateFirmware, JSON_C_TO_STRING_PLAIN));
|
|
|
+
|
|
|
+ json_object_put(SignedUpdateFirmware);
|
|
|
+ LWS_Send(message);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int sendUnknownConfirmation(char *uuid)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
char message[256]={0};
|
|
|
|
|
|
- //[ 3, "ba1cbd49-2a76-493a-8f76-fa23e7606532", { "status": "Unlocked" } ]
|
|
|
DEBUG_INFO("sendUnknownConfirmation...\n");
|
|
|
sprintf(message,"[%d,\"%s\",\"NotImplemented\",\"Requested Action is not known by receiver\",{}]", MESSAGE_TYPE_CALLERROR, uuid);
|
|
|
LWS_Send(message);
|
|
|
- result = TRUE;
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
//==========================================
|
|
|
// Handle server request routine Start
|
|
|
//==========================================
|
|
@@ -11568,10 +11877,268 @@ void *UpdateFirmwareProcess(void *data)
|
|
|
|
|
|
}
|
|
|
|
|
|
+int handleCertificateSignedRequest(char *uuid, char *payload)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ json_object *CertificateSigned;
|
|
|
+
|
|
|
+ DEBUG_INFO("handleCertificateSignedRequest...\n");
|
|
|
+ CertificateSigned = json_tokener_parse(payload);
|
|
|
+ if(!is_error(CertificateSigned))
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->CertificateSigned.certificateChain, "%s", json_object_get_string(json_object_object_get(CertificateSigned, "certificateChain")));
|
|
|
+
|
|
|
+ /*
|
|
|
+ * TODO: CertificateSigned process
|
|
|
+ */
|
|
|
+ ShmOCPP16Data->MsMsg.bits.CertificateSignedReq = 1;
|
|
|
+ DEBUG_INFO("certificateChain: %s\n", ShmOCPP16Data->CertificateSigned.certificateChain);
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->CertificateSigned.Response_status, "Rejected");
|
|
|
+ sendCertificateSignedConfirmation(uuid);
|
|
|
+ }
|
|
|
+ json_object_put(CertificateSigned);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int handleDeleteCertificateRequest(char *uuid, char *payload)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ json_object *DeleteCertificate;
|
|
|
+
|
|
|
+ DEBUG_INFO("handleDeleteCertificateRequest...\n");
|
|
|
+ DeleteCertificate = json_tokener_parse(payload);
|
|
|
+ if(!is_error(DeleteCertificate))
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->DeleteCertificate.certificateHashData.hashAlgorithm, "%s", json_object_get_string(json_object_object_get(json_object_object_get(DeleteCertificate, "certificateHashData"), "hashAlgorithm")));
|
|
|
+ sprintf((char*)ShmOCPP16Data->DeleteCertificate.certificateHashData.issuerNameHash, "%s", json_object_get_string(json_object_object_get(json_object_object_get(DeleteCertificate, "certificateHashData"), "issuerNameHash")));
|
|
|
+ sprintf((char*)ShmOCPP16Data->DeleteCertificate.certificateHashData.issuerKeyHash, "%s", json_object_get_string(json_object_object_get(json_object_object_get(DeleteCertificate, "certificateHashData"), "issuerKeyHash")));
|
|
|
+ sprintf((char*)ShmOCPP16Data->DeleteCertificate.certificateHashData.serialNumber, "%s", json_object_get_string(json_object_object_get(json_object_object_get(DeleteCertificate, "certificateHashData"), "serialNumber")));
|
|
|
+
|
|
|
+ /*
|
|
|
+ * TODO: Delete certificateSigned process
|
|
|
+ */
|
|
|
+ ShmOCPP16Data->MsMsg.bits.DeleteCertificateReq = 1;
|
|
|
+ DEBUG_INFO("hashAlgorithm: %s\n", ShmOCPP16Data->DeleteCertificate.certificateHashData.hashAlgorithm);
|
|
|
+ DEBUG_INFO("issuerNameHash: %s\n", ShmOCPP16Data->DeleteCertificate.certificateHashData.issuerNameHash);
|
|
|
+ DEBUG_INFO("issuerKeyHash: %s\n", ShmOCPP16Data->DeleteCertificate.certificateHashData.issuerKeyHash);
|
|
|
+ DEBUG_INFO("serialNumber: %s\n", ShmOCPP16Data->DeleteCertificate.certificateHashData.serialNumber);
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->DeleteCertificate.Response_status, "NotFound");
|
|
|
+ sendDeleteCertificateConfirmation(uuid);
|
|
|
+ }
|
|
|
+ json_object_put(DeleteCertificate);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int handleExtendedTriggerMessageRequest(char *uuid, char *payload)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ json_object *ExtendedTriggerMessage;
|
|
|
+
|
|
|
+ DEBUG_INFO("handleExtendedTriggerMessageRequest...\n");
|
|
|
+ ExtendedTriggerMessage = json_tokener_parse(payload);
|
|
|
+ if(!is_error(ExtendedTriggerMessage))
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->ExtendedTriggerMessage.requestedMessage, "%s", json_object_get_string(json_object_object_get(ExtendedTriggerMessage, "requestedMessage")));
|
|
|
+
|
|
|
+ if(json_object_object_get(ExtendedTriggerMessage, "connectorId") != NULL)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->ExtendedTriggerMessage.connectorId = json_object_get_int(json_object_object_get(ExtendedTriggerMessage, "connectorId"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->ExtendedTriggerMessage.connectorId = -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * TODO: Trigger message process
|
|
|
+ */
|
|
|
+ ShmOCPP16Data->MsMsg.bits.ExtendedTriggerMessageReq = 1;
|
|
|
+
|
|
|
+ DEBUG_INFO("requestedMessage: %s\n", ShmOCPP16Data->ExtendedTriggerMessage.requestedMessage);
|
|
|
+ DEBUG_INFO("connectorIdInt: %d\n", ShmOCPP16Data->ExtendedTriggerMessage.connectorId);
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->ExtendedTriggerMessage.Response_status, "NotImplemented");
|
|
|
+ sendExtendedTriggerMessageConfirmation(uuid);
|
|
|
+ }
|
|
|
+ json_object_put(ExtendedTriggerMessage);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int handleGetInstalledCertificateIdsRequest(char *uuid, char *payload)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ json_object *GetInstalledCertificateIds;
|
|
|
+
|
|
|
+ DEBUG_INFO("handleGetInstalledCertificateIdsRequest...\n");
|
|
|
+ GetInstalledCertificateIds = json_tokener_parse(payload);
|
|
|
+ if(!is_error(GetInstalledCertificateIds))
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->GetInstalledCertificateIds.certificateType, "%s", json_object_get_string(json_object_object_get(GetInstalledCertificateIds, "certificateType")));
|
|
|
+
|
|
|
+ /*
|
|
|
+ * TODO: Return installed certificate process
|
|
|
+ */
|
|
|
+ ShmOCPP16Data->MsMsg.bits.GetInstalledCertificateIdsReq = 1;
|
|
|
+ DEBUG_INFO("requestedMessage: %s\n", (char*)ShmOCPP16Data->GetInstalledCertificateIds.certificateType);
|
|
|
+
|
|
|
+ memset(ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData, 0x00, ARRAY_SIZE(ShmOCPP16Data->GetInstalledCertificateIds.Response_certificateHashData)*sizeof(struct CertificateHashDataType));
|
|
|
+ sprintf((char*)ShmOCPP16Data->GetInstalledCertificateIds.Response_status, "NotFound");
|
|
|
+ sendGetInstalledCertificateIdsConfirmation(uuid);
|
|
|
+ }
|
|
|
+ json_object_put(GetInstalledCertificateIds);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int handleGetLogRequest(char *uuid, char *payload)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ json_object *GetLog;
|
|
|
+
|
|
|
+ DEBUG_INFO("handleGetLogRequest...\n");
|
|
|
+ GetLog = json_tokener_parse(payload);
|
|
|
+ if(!is_error(GetLog))
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->GetLog.logType, "%s", json_object_get_string(json_object_object_get(GetLog, "logType")));
|
|
|
+ ShmOCPP16Data->GetLog.requestId = json_object_get_int(json_object_object_get(GetLog, "requestId"));
|
|
|
+
|
|
|
+ if(json_object_object_get(GetLog, "retries") != NULL)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->GetLog.retries = json_object_get_int(json_object_object_get(GetLog, "retries"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(json_object_object_get(GetLog, "retryInterval") != NULL)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->GetLog.retryInterval = json_object_get_int(json_object_object_get(GetLog, "retryInterval"));
|
|
|
+ }
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->GetLog.log.remoteLocation, "%s", json_object_get_string(json_object_object_get(json_object_object_get(GetLog, "log"), "remoteLocation")));
|
|
|
+
|
|
|
+ if(json_object_object_get(json_object_object_get(GetLog, "log"), "oldestTimestamp") != NULL)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->GetLog.log.oldestTimestamp, "%s", json_object_get_string(json_object_object_get(json_object_object_get(GetLog, "log"), "oldestTimestamp")));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(json_object_object_get(json_object_object_get(GetLog, "log"), "latestTimestamp") != NULL)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->GetLog.log.latestTimestamp, "%s", json_object_get_string(json_object_object_get(json_object_object_get(GetLog, "log"), "latestTimestamp")));
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * TODO: Upload log process
|
|
|
+ */
|
|
|
+ ShmOCPP16Data->MsMsg.bits.GetLogReq = 1;
|
|
|
+ DEBUG_INFO("logType: %s\n", ShmOCPP16Data->GetLog.logType);
|
|
|
+ DEBUG_INFO("requestId: %d\n", ShmOCPP16Data->GetLog.requestId);
|
|
|
+ DEBUG_INFO("retries: %d\n", ShmOCPP16Data->GetLog.retries);
|
|
|
+ DEBUG_INFO("retryInterval: %d\n", ShmOCPP16Data->GetLog.retryInterval);
|
|
|
+ DEBUG_INFO("remoteLocation: %s\n", ShmOCPP16Data->GetLog.log.remoteLocation);
|
|
|
+ DEBUG_INFO("oldestTimestamp: %s\n", ShmOCPP16Data->GetLog.log.oldestTimestamp);
|
|
|
+ DEBUG_INFO("latestTimestamp: %s\n", ShmOCPP16Data->GetLog.log.latestTimestamp);
|
|
|
+ sprintf((char*)ShmOCPP16Data->GetLog.Response_status, "Rejected");
|
|
|
+ sendGetLogConfirmation(uuid);
|
|
|
+ }
|
|
|
+ json_object_put(GetLog);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int handleInstallCertificateRequest(char *uuid, char *payload)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ json_object *InstallCertificate;
|
|
|
+
|
|
|
+ DEBUG_INFO("handleInstallCertificateRequest...\n");
|
|
|
+ InstallCertificate = json_tokener_parse(payload);
|
|
|
+ if(!is_error(InstallCertificate))
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->InstallCertificate.certificateType, "%s", json_object_get_string(json_object_object_get(InstallCertificate, "certificateType")));
|
|
|
+ sprintf((char*)ShmOCPP16Data->InstallCertificate.certificate, "%s", json_object_get_string(json_object_object_get(InstallCertificate, "certificate")));
|
|
|
+
|
|
|
+ /*
|
|
|
+ * TODO: Install certificate process
|
|
|
+ */
|
|
|
+ ShmOCPP16Data->MsMsg.bits.InstallCertificateReq = 1;
|
|
|
+ DEBUG_INFO("certificateType: %s\n", (char*)ShmOCPP16Data->InstallCertificate.certificateType);
|
|
|
+ DEBUG_INFO("certificate: %s\n", (char*)ShmOCPP16Data->InstallCertificate.certificate);
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->InstallCertificate.Response_status, "Rejected");
|
|
|
+ sendInstallCertificateConfirmation(uuid);
|
|
|
+ }
|
|
|
+ json_object_put(InstallCertificate);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+int handleSignedUpdateFirmwareRequest(char *uuid, char *payload)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ int result = PASS;
|
|
|
+ json_object *SignedUpdateFirmware;
|
|
|
+
|
|
|
+ DEBUG_INFO("handleSignedUpdateFirmwareRequest...\n");
|
|
|
+ SignedUpdateFirmware = json_tokener_parse(payload);
|
|
|
+ if(!is_error(SignedUpdateFirmware))
|
|
|
+ {
|
|
|
+ if(json_object_object_get(SignedUpdateFirmware, "retries") != NULL)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->SignedUpdateFirmware.retries = json_object_get_int(json_object_object_get(SignedUpdateFirmware, "retries"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(json_object_object_get(SignedUpdateFirmware, "retryInterval") != NULL)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->SignedUpdateFirmware.retryInterval = json_object_get_int(json_object_object_get(SignedUpdateFirmware, "retryInterval"));
|
|
|
+ }
|
|
|
+
|
|
|
+ ShmOCPP16Data->SignedUpdateFirmware.requestId = json_object_get_int(json_object_object_get(SignedUpdateFirmware, "requestId"));
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.location, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "location")));
|
|
|
+ sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.retrieveDateTime, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "retrieveDateTime")));
|
|
|
+
|
|
|
+ if(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "installDateTime") != NULL)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.installDateTime, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "installDateTime")));
|
|
|
+ }
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.signingCertificate, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "signingCertificate")));
|
|
|
+ sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.firmware.signature, "%s", json_object_get_string(json_object_object_get(json_object_object_get(SignedUpdateFirmware, "firmware"), "signature")));
|
|
|
+
|
|
|
+ /*
|
|
|
+ * TODO: Upgrade firmware process
|
|
|
+ */
|
|
|
+ ShmOCPP16Data->MsMsg.bits.SignedUpdateFirmwareReq = 1;
|
|
|
+ DEBUG_INFO("retries: %d\n", ShmOCPP16Data->SignedUpdateFirmware.retries);
|
|
|
+ DEBUG_INFO("retryInterval: %d\n", ShmOCPP16Data->SignedUpdateFirmware.retryInterval);
|
|
|
+ DEBUG_INFO("requestId: %d\n", ShmOCPP16Data->SignedUpdateFirmware.requestId);
|
|
|
+ DEBUG_INFO("location: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.location);
|
|
|
+ DEBUG_INFO("retrieveDateTime: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.retrieveDateTime);
|
|
|
+ DEBUG_INFO("installDateTime: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.installDateTime);
|
|
|
+ DEBUG_INFO("signingCertificate: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.signingCertificate);
|
|
|
+ DEBUG_INFO("signature: %s\n", ShmOCPP16Data->SignedUpdateFirmware.firmware.signature);
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->SignedUpdateFirmware.Response_status, "Rejected");
|
|
|
+ sendInstallCertificateConfirmation(uuid);
|
|
|
+ }
|
|
|
+ json_object_put(SignedUpdateFirmware);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
int handleUnknownRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
mtrace();
|
|
|
- int result = FAIL;
|
|
|
+ int result = PASS;
|
|
|
DEBUG_INFO("handleUnknownRequest...\n");
|
|
|
|
|
|
sendUnknownConfirmation(uuid);
|
|
@@ -11579,6 +12146,7 @@ int handleUnknownRequest(char *uuid, char *payload)
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
//==========================================
|
|
|
// Handle server response routine
|
|
|
//==========================================
|
|
@@ -11862,6 +12430,44 @@ void handleStopTransactionnResponse(char *payload, int gun_index)
|
|
|
DEBUG_INFO("idTagInfo-status: %s\n", ShmOCPP16Data->StopTransaction[gun_index].ResponseIdTagInfo.Status);
|
|
|
}
|
|
|
|
|
|
+void handleLogStatusNotificationResponse(char *payload, int gun_index)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ DEBUG_INFO("handleLogStatusNotificationResponse...\n");
|
|
|
+ ShmOCPP16Data->SpMsg.bits.LogStatusNotificationConf = 1;
|
|
|
+}
|
|
|
+
|
|
|
+void handleSecurityEventNotificationResponse(char *payload, int gun_index)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ DEBUG_INFO("handleSecurityEventNotificationResponse...\n");
|
|
|
+ ShmOCPP16Data->SpMsg.bits.SecurityEventNotificationConf = 1;
|
|
|
+}
|
|
|
+
|
|
|
+void handleSignCertificateResponse(char *payload, int gun_index)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ DEBUG_INFO("handleSignCertificateResponse...\n");
|
|
|
+ json_object *SignCertificate;
|
|
|
+ SignCertificate = json_tokener_parse(payload);
|
|
|
+
|
|
|
+ if(!is_error(SignCertificate))
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->SignCertificate.Response_status, "%s", json_object_get_string(json_object_object_get(SignCertificate, "status")));
|
|
|
+ DEBUG_INFO("status: %s\n", ShmOCPP16Data->SignCertificate.Response_status);
|
|
|
+ }
|
|
|
+ json_object_put(SignCertificate);
|
|
|
+
|
|
|
+ ShmOCPP16Data->SpMsg.bits.SignCertificateConf = 1;
|
|
|
+}
|
|
|
+
|
|
|
+void handleSignedFirmwareStatusNotificationResponse(char *payload, int gun_index)
|
|
|
+{
|
|
|
+ mtrace();
|
|
|
+ DEBUG_INFO("handleSignedFirmwareStatusNotificationResponse...\n");
|
|
|
+ ShmOCPP16Data->SpMsg.bits.SignedFirmwareStatusNotificationConf = 1;
|
|
|
+}
|
|
|
+
|
|
|
//==========================================
|
|
|
// Handle Error routine
|
|
|
//==========================================
|