|
@@ -38,6 +38,7 @@
|
|
|
#include "TransactionQueue.h"
|
|
|
|
|
|
|
|
|
+
|
|
|
#define PASS 1
|
|
|
#define FAIL -1
|
|
|
|
|
@@ -131,7 +132,7 @@ extern char OcppPath[160];
|
|
|
extern char OcppProtocol[10];
|
|
|
extern char OcppHost[50];
|
|
|
extern char OcppTempPath[50];
|
|
|
-int OcppPort=0;
|
|
|
+static int OcppPort=0;
|
|
|
|
|
|
|
|
|
|
|
@@ -145,19 +146,18 @@ static int SystemInitial = CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY;
|
|
|
|
|
|
|
|
|
|
|
|
-int authenrequest = FALSE;
|
|
|
-int authorizeRetryTimes = 0;
|
|
|
+static int authorizeRetryTimes = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-static int TransactionId[CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY + AC_QUANTITY]={0};
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-int isUpdateRequest = FALSE;
|
|
|
+
|
|
|
static int HeartBeatWaitTime = 10;
|
|
|
static int FirstHeartBeat = 0;
|
|
|
static int FirmwareStatusNotificationStatus = 3;
|
|
@@ -168,7 +168,7 @@ static char CurrentChargingProfileScheduleStr[30]={0};
|
|
|
|
|
|
|
|
|
static int GunStatusInterval = 10;
|
|
|
-int statusModeChage[CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY + AC_QUANTITY] = {FALSE};
|
|
|
+static int statusModeChage[CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY + AC_QUANTITY] = {FALSE};
|
|
|
static int ChademoPreviousSystemStatus[CHAdeMO_QUANTITY];
|
|
|
static int CcsPreviousSystemStatus[CCS_QUANTITY];
|
|
|
static int GbPreviousSystemStatus[GB_QUANTITY];
|
|
@@ -177,8 +177,8 @@ static int ChademoPreviousConnectorPlugIn[CHAdeMO_QUANTITY];
|
|
|
static int CcsPreviousConnectorPlugIn[CCS_QUANTITY];
|
|
|
static int GbPreviousConnectorPlugIn[GB_QUANTITY];
|
|
|
static int AcPreviousConnectorPlugIn[AC_QUANTITY];
|
|
|
-int TransactionMessageAttemptsValue = 0;
|
|
|
-int TransactionMessageRetryIntervalValue = 0;
|
|
|
+static int TransactionMessageAttemptsValue = 0;
|
|
|
+static int TransactionMessageRetryIntervalValue = 0;
|
|
|
static struct OCPPAuthLocalElemet
|
|
|
{
|
|
|
int listVersionInt;
|
|
@@ -1043,8 +1043,9 @@ int InitShareMemory()
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+#if 0
|
|
|
gunTotalNumber = (ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') ? (CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY): AC_QUANTITY;
|
|
|
+
|
|
|
server_sign = FALSE;
|
|
|
|
|
|
for(int gun_index=0; gun_index < gunTotalNumber; gun_index++ )
|
|
@@ -1061,13 +1062,6 @@ int InitShareMemory()
|
|
|
memset( (void *)unknownkey, 0, sizeof(unknownkey));
|
|
|
|
|
|
clientTime.Heartbeat=time((time_t*)NULL);
|
|
|
-
|
|
|
-#if 0
|
|
|
- for(int gun_index=0;gun_index < gunTotalNumber ;gun_index++)
|
|
|
- {
|
|
|
- clientTime.StatusNotification[gun_index] = time((time_t*)NULL);
|
|
|
- clientTime.MeterValues[gun_index] = time((time_t*)NULL);
|
|
|
- }
|
|
|
#endif
|
|
|
|
|
|
ShmOCPP16Data->GetConfiguration.ResponseUnknownKey = NULL;
|
|
@@ -1079,7 +1073,7 @@ int InitShareMemory()
|
|
|
ShmOCPP16Data->GetConfiguration.ResponseUnknownKey = staticResponseUnknownKey;
|
|
|
ShmOCPP16Data->SendLocalList.LocalAuthorizationList = staticLocalAuthorizationList;
|
|
|
|
|
|
-
|
|
|
+#if 0
|
|
|
if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
|
|
|
{
|
|
|
SystemInitial = CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY;
|
|
@@ -1091,7 +1085,6 @@ int InitShareMemory()
|
|
|
DEBUG_INFO("AC ...\n");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
for (int index = 0; index < CHAdeMO_QUANTITY; index++)
|
|
|
{
|
|
@@ -1116,6 +1109,7 @@ int InitShareMemory()
|
|
|
AcPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PreviousSystemStatus;
|
|
|
AcPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState;
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@@ -1192,7 +1186,7 @@ void CheckSystemValue(void)
|
|
|
}
|
|
|
else if((server_sign == TRUE) &&(FirstHeartBeat == 0))
|
|
|
{
|
|
|
- printf("Heartbeat !!!\n");
|
|
|
+ printf("FirstHeartBeat !!!\n");
|
|
|
|
|
|
sendHeartbeatRequest(0);
|
|
|
|
|
@@ -1221,7 +1215,7 @@ void CheckSystemValue(void)
|
|
|
|
|
|
|
|
|
|
|
|
- if((server_sign == TRUE) && (ShmOCPP16Data->SpMsg.bits.AuthorizeReq == 1)&&(authorizeRetryTimes < 3))
|
|
|
+ if((server_sign == TRUE) && (ShmOCPP16Data->SpMsg.bits.AuthorizeReq == 1)&&(authorizeRetryTimes < 3))
|
|
|
{
|
|
|
sendAuthorizeRequest(0);
|
|
|
authorizeRetryTimes = authorizeRetryTimes + 1;
|
|
@@ -10336,7 +10330,7 @@ void *UpdateFirmwareProcess(void *data)
|
|
|
{
|
|
|
|
|
|
sendFirmwareStatusNotificationRequest(FirmwareStatusStr[FirmwareStatus_Downloaded]);
|
|
|
- isUpdateRequest = TRUE;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -10418,7 +10412,7 @@ void *UpdateFirmwareProcess(void *data)
|
|
|
{
|
|
|
|
|
|
sendFirmwareStatusNotificationRequest(FirmwareStatusStr[FirmwareStatus_Downloaded]);
|
|
|
- isUpdateRequest = TRUE;
|
|
|
+
|
|
|
}
|
|
|
ShmOCPP16Data->MsMsg.bits.UpdateFirmwareReq = 1;
|
|
|
|
|
@@ -11006,7 +11000,7 @@ void handleStartTransactionResponse(char *payload, int gun_index)
|
|
|
char sstr[28]={ 0 };
|
|
|
int c = 0;
|
|
|
char *loc;
|
|
|
- int transactionIdInt = 0;
|
|
|
+
|
|
|
FILE *outfile;
|
|
|
char data[100]={0};
|
|
|
|
|
@@ -11032,8 +11026,6 @@ void handleStartTransactionResponse(char *payload, int gun_index)
|
|
|
sprintf((char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ExpiryDate, "%s", sstr);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
loc = strstr(payload, "parentIdTag");
|
|
@@ -11087,7 +11079,7 @@ void handleStartTransactionResponse(char *payload, int gun_index)
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId = atoi(sstr);
|
|
|
- transactionIdInt = ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId;
|
|
|
+
|
|
|
|
|
|
ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionConf = 1;
|
|
|
ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq = 0;
|
|
@@ -11123,7 +11115,7 @@ void handleStartTransactionResponse(char *payload, int gun_index)
|
|
|
fclose (outfile);
|
|
|
|
|
|
|
|
|
- TransactionId[gun_index] = transactionIdInt;
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -11265,12 +11257,12 @@ int initialConfigurationTable(void)
|
|
|
|
|
|
|
|
|
|
|
|
- ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemAccessibility = 0;
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemAccessibility = 1;
|
|
|
printf("AllowoddlineTXForUnknownId type: %d \n", ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemAccessibility);
|
|
|
strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemName, "AllowOfflineTxForUnknownId");
|
|
|
strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemData, "FALSE" );
|
|
|
|
|
|
- fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AllowOfflineTxForUnknownId", "true", "FALSE");
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AllowOfflineTxForUnknownId", "false", "FALSE");
|
|
|
|
|
|
|
|
|
ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizationCacheEnabled].ItemAccessibility = 1;
|
|
@@ -12005,7 +11997,7 @@ void StoreConfigurationTable(void)
|
|
|
*/
|
|
|
|
|
|
|
|
|
- fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AllowOfflineTxForUnknownId", "true", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemData);
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AllowOfflineTxForUnknownId", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AllowOfflineTxForUnknownId].ItemData);
|
|
|
|
|
|
|
|
|
|
|
@@ -16941,6 +16933,92 @@ int GetInternetConn(void)
|
|
|
return ShmSysConfigAndInfo->SysInfo.InternetConn;
|
|
|
}
|
|
|
|
|
|
+void InitialSystemValue(void)
|
|
|
+{
|
|
|
+ server_cycle_Status = 120;
|
|
|
+ gunTotalNumber=0;
|
|
|
+ localversion=0;
|
|
|
+ BootNotificationInterval = 0;
|
|
|
+ authorizeRetryTimes = 0;
|
|
|
+ GunStatusInterval = 10;
|
|
|
+ TransactionMessageAttemptsValue = 0;
|
|
|
+ TransactionMessageRetryIntervalValue = 0;
|
|
|
+ HeartBeatWithNOResponse = 0;
|
|
|
+ HeartBeatCountPerHour = 0;
|
|
|
+
|
|
|
+ HeartBeatWaitTime = 10;
|
|
|
+ FirstHeartBeat = 0;
|
|
|
+ FirmwareStatusNotificationStatus = 3;
|
|
|
+ DiagnosticsStatusNotificationStatus = 0;
|
|
|
+
|
|
|
+ memset(CurrentChargingProfileScheduleStr, 0, sizeof(CurrentChargingProfileScheduleStr));
|
|
|
+ memset(statusModeChage, 0, sizeof(statusModeChage));
|
|
|
+ memset(ChademoPreviousSystemStatus, 0, sizeof(ChademoPreviousSystemStatus));
|
|
|
+ memset(CcsPreviousSystemStatus, 0, sizeof(CcsPreviousSystemStatus));
|
|
|
+ memset(GbPreviousSystemStatus, 0, sizeof(GbPreviousSystemStatus));
|
|
|
+ memset(AcPreviousSystemStatus, 0, sizeof(AcPreviousSystemStatus));
|
|
|
+ memset(ChademoPreviousConnectorPlugIn, 0, sizeof(ChademoPreviousConnectorPlugIn));
|
|
|
+ memset(CcsPreviousConnectorPlugIn, 0, sizeof(CcsPreviousConnectorPlugIn));
|
|
|
+ memset(GbPreviousConnectorPlugIn, 0, sizeof(GbPreviousConnectorPlugIn));
|
|
|
+ memset(AcPreviousConnectorPlugIn, 0, sizeof(AcPreviousConnectorPlugIn));
|
|
|
+
|
|
|
+ gunTotalNumber = (ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') ? (CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY): AC_QUANTITY;
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
|
|
|
+ {
|
|
|
+ SystemInitial = CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY;
|
|
|
+ DEBUG_INFO("DC ...\n");
|
|
|
+ }
|
|
|
+ else if (ShmSysConfigAndInfo->SysConfig.ModelName[0]=='A')
|
|
|
+ {
|
|
|
+ SystemInitial = AC_QUANTITY;
|
|
|
+ DEBUG_INFO("AC ...\n");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (int index = 0; index < CHAdeMO_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ ChademoPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PreviousSystemStatus;
|
|
|
+ ChademoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int index = 0; index < CCS_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ CcsPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PreviousSystemStatus;
|
|
|
+ CcsPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int index = 0; index < GB_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ GbPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PreviousSystemStatus;
|
|
|
+ GbPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int index = 0; index < AC_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ AcPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PreviousSystemStatus;
|
|
|
+ AcPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState;
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int gun_index=0; gun_index < gunTotalNumber; gun_index++ )
|
|
|
+ {
|
|
|
+ cpinitateMsg.bits[gun_index].StatusNotificationReq = 0;
|
|
|
+ cpinitateMsg.bits[gun_index].StatusNotificationConf = 0;
|
|
|
+ clientTime.MeterValues[gun_index] = time((time_t*)NULL);
|
|
|
+ clientTime.StatusNotification[gun_index] = time((time_t*)NULL);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ memset(PRE_SYS_MODE, 0, sizeof(PRE_SYS_MODE));
|
|
|
+
|
|
|
+ memset( (void *)unknownkey, 0, sizeof(unknownkey));
|
|
|
+
|
|
|
+ clientTime.Heartbeat=time((time_t*)NULL);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
void LWS_Send(char * str)
|
|
|
{
|
|
|
|