|
@@ -447,6 +447,14 @@ int getTimePassSinceToday()
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+void getNowDatetime(uint8_t *data)
|
|
|
+{
|
|
|
+ time_t t = time(NULL);
|
|
|
+ struct tm tm = *localtime(&t);
|
|
|
+
|
|
|
+ sprintf((char*)data, "%04d-%02d-%02dT%02d:%02d:%02dZ", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
|
|
|
+}
|
|
|
+
|
|
|
//==========================================
|
|
|
// GetCompositeSchedule logic related function
|
|
|
//==========================================
|
|
@@ -2389,6 +2397,17 @@ void CheckSystemValue(void)
|
|
|
{
|
|
|
if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != ChademoPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn != ChademoPreviousConnectorPlugIn[index]) )
|
|
|
{
|
|
|
+ // Sent unplug message for California pricing logic
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_COMPLETE) && (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn == 0))
|
|
|
+ {
|
|
|
+ uint8_t ts[20];
|
|
|
+ getNowDatetime(ts);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].VendorId, "%s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].MessageId, "ConnectorUnplugged");
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].Data, "{\\\"idTx\\\":%d,\\\"timestamp\\\":\\\"%s\\\"}", ShmOCPP16Data->StopTransaction[gun_index].TransactionId, ts);
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].DataTransferReq = 1;
|
|
|
+ }
|
|
|
+
|
|
|
ChademoPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus;
|
|
|
ChademoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn;
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
|
|
@@ -2435,6 +2454,17 @@ void CheckSystemValue(void)
|
|
|
{
|
|
|
if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn != CcsPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
|
|
|
{
|
|
|
+ // Sent unplug message for California pricing logic
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_COMPLETE) && (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn == 0))
|
|
|
+ {
|
|
|
+ uint8_t ts[20];
|
|
|
+ getNowDatetime(ts);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].VendorId, "%s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].MessageId, "ConnectorUnplugged");
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].Data, "{\\\"idTx\\\":%d,\\\"timestamp\\\":\\\"%s\\\"}", ShmOCPP16Data->StopTransaction[gun_index].TransactionId, ts);
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].DataTransferReq = 1;
|
|
|
+ }
|
|
|
+
|
|
|
CcsPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus;
|
|
|
CcsPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn;
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
|
|
@@ -2480,6 +2510,17 @@ void CheckSystemValue(void)
|
|
|
{
|
|
|
if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != GbPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn != GbPreviousConnectorPlugIn[index]) )
|
|
|
{
|
|
|
+ // Sent unplug message for California pricing logic
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_COMPLETE) && (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn == 0))
|
|
|
+ {
|
|
|
+ uint8_t ts[20];
|
|
|
+ getNowDatetime(ts);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].VendorId, "%s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].MessageId, "ConnectorUnplugged");
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].Data, "{\\\"idTx\\\":%d,\\\"timestamp\\\":\\\"%s\\\"}", ShmOCPP16Data->StopTransaction[gun_index].TransactionId, ts);
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].DataTransferReq = 1;
|
|
|
+ }
|
|
|
+
|
|
|
GbPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus;
|
|
|
GbPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn;
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
|
|
@@ -2517,6 +2558,17 @@ void CheckSystemValue(void)
|
|
|
{
|
|
|
if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus != DoPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.ConnectorPlugIn != DoPreviousConnectorPlugIn[index]) )
|
|
|
{
|
|
|
+ // Sent unplug message for California pricing logic
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_COMPLETE) && (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.ConnectorPlugIn == 0))
|
|
|
+ {
|
|
|
+ uint8_t ts[20];
|
|
|
+ getNowDatetime(ts);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].VendorId, "%s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].MessageId, "ConnectorUnplugged");
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].Data, "{\\\"idTx\\\":%d,\\\"timestamp\\\":\\\"%s\\\"}", ShmOCPP16Data->StopTransaction[gun_index].TransactionId, ts);
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].DataTransferReq = 1;
|
|
|
+ }
|
|
|
+
|
|
|
DoPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus;
|
|
|
DoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.ConnectorPlugIn;
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
|
|
@@ -2561,6 +2613,17 @@ void CheckSystemValue(void)
|
|
|
{
|
|
|
if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState != AcPreviousConnectorPlugIn[index]) )
|
|
|
{
|
|
|
+ // Sent unplug message for California pricing logic
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_COMPLETE)
|
|
|
+ {
|
|
|
+ uint8_t ts[20];
|
|
|
+ getNowDatetime(ts);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].VendorId, "%s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].MessageId, "ConnectorUnplugged");
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[gun_index].Data, "{\\\"idTx\\\":%d,\\\"timestamp\\\":\\\"%s\\\"}", ShmOCPP16Data->StopTransaction[gun_index].TransactionId, ts);
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].DataTransferReq = 1;
|
|
|
+ }
|
|
|
+
|
|
|
AcPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus;
|
|
|
AcPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState;
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
|
|
@@ -2579,22 +2642,22 @@ void CheckSystemValue(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- #if 1 // for TempStopTransaction
|
|
|
+ #if 1 // for TempStopTransaction
|
|
|
if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_IDLE) && (ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq == 0))
|
|
|
{
|
|
|
checkTempStopTransaction(gun_index);
|
|
|
}
|
|
|
- #endif
|
|
|
+ #endif
|
|
|
}
|
|
|
}// END
|
|
|
}
|
|
|
|
|
|
if(isWebsocketSendable &&
|
|
|
- (
|
|
|
- (statusModeChage[gun_index] == TRUE) ||
|
|
|
- //((time((time_t*)NULL)-clientTime.StatusNotification[gun_index]) > (server_cycle_Status + (GunStatusInterval*gun_index))) ||
|
|
|
- ((cpinitateMsg.bits[gun_index].StatusNotificationReq == 1) && ((time((time_t*)NULL)-clientTime.StatusNotification[gun_index]) > 10))
|
|
|
- )
|
|
|
+ (
|
|
|
+ (statusModeChage[gun_index] == TRUE) ||
|
|
|
+ //((time((time_t*)NULL)-clientTime.StatusNotification[gun_index]) > (server_cycle_Status + (GunStatusInterval*gun_index))) ||
|
|
|
+ ((cpinitateMsg.bits[gun_index].StatusNotificationReq == 1) && ((time((time_t*)NULL)-clientTime.StatusNotification[gun_index]) > 10))
|
|
|
+ )
|
|
|
)
|
|
|
{
|
|
|
if(SystemInitial > 0)
|
|
@@ -3087,10 +3150,7 @@ int sendDataTransferRequest(int gun_index)
|
|
|
char tempdata[65]={0};
|
|
|
int result = FAIL;
|
|
|
|
|
|
-//[2,"696e8a35-f394-45e3-a0c7-7098b86f38a6","DataTransfer",{"vendorId":"Phihong","messageId":"FeePerKWH","data":"1"}]
|
|
|
-
|
|
|
random_uuid(guid);
|
|
|
-
|
|
|
sprintf(message,"[%d,\"%s\",\"DataTransfer\",{\"vendorId\":\"%s\",\"messageId\":\"%s\",\"data\":\"%s\"}]",
|
|
|
MESSAGE_TYPE_CALL,
|
|
|
guid,
|