|
@@ -45,7 +45,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
#define PASS 1
|
|
|
#define FAIL -1
|
|
|
|
|
@@ -2962,13 +2961,13 @@ int sendMeterValuesRequest(int gun_index)
|
|
|
char tempdata[65]={0};
|
|
|
|
|
|
DEBUG_ERROR("sendMeterValuesRequest ...\n");
|
|
|
- DEBUG_ERROR("gun_index =%d\n",gun_index);
|
|
|
+ //DEBUG_ERROR("gun_index =%d\n",gun_index);
|
|
|
|
|
|
if((ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId == 0)&&(ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq == 0)) // no TransactionId
|
|
|
{
|
|
|
DEBUG_INFO("NOT SENT METER Vlaue\n");
|
|
|
- DEBUG_ERROR("ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId =%d\n",ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId);
|
|
|
- DEBUG_ERROR("ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq =%d\n",ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq);
|
|
|
+ //DEBUG_ERROR("ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId =%d\n",ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId);
|
|
|
+ //DEBUG_ERROR("ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq =%d\n",ShmOCPP16Data->CsMsg.bits[gun_index].TriggerMessageReq);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@@ -3572,7 +3571,7 @@ int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connector
|
|
|
|
|
|
for(int idx_sample=0;idx_sample< len;idx_sample++)
|
|
|
{
|
|
|
- if((ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].StartPeriod < diffSeconds) || (ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample + 1].StartPeriod > diffSeconds))//if (idx_sample == 0)
|
|
|
+ if((ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].StartPeriod < diffSeconds) && (ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample + 1].StartPeriod > diffSeconds))//if (idx_sample == 0)
|
|
|
{
|
|
|
sprintf(message + strlen(message), "{\"startPeriod\":%d,\"limit\":%.1f,\"numberPhases\":%d}"
|
|
|
, 0 /*ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].StartPeriod*/
|
|
@@ -5726,6 +5725,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
int i = 0;
|
|
|
int j = 0;
|
|
|
while ( fgets( sLineWord, sizeof sLineWord, fptr1 ) != NULL ) {
|
|
|
+ DEBUG_INFO(" 1-1\n");
|
|
|
#if 0
|
|
|
/***********connectorId****************/
|
|
|
c = 0;
|
|
@@ -5916,6 +5916,8 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
confirmPeriods = n_SchedulePeriods;
|
|
|
|
|
|
j = j + 1;
|
|
|
+
|
|
|
+ DEBUG_INFO(" 1-2\n");
|
|
|
}
|
|
|
|
|
|
fclose(fptr1);
|
|
@@ -8839,44 +8841,6 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
|
|
|
}
|
|
|
|
|
|
- DEBUG_INFO("\n\n Replace a specific line in a text file with a new text :\n");
|
|
|
- DEBUG_INFO("-------------------------------------------------------------\n");
|
|
|
- DEBUG_INFO(" Input the file name to be opened : ");
|
|
|
- //fgets(fname, MAX, stdin);
|
|
|
- //fname[strlen(fname) - 1] = '\0';
|
|
|
-#if 0
|
|
|
- switch(connectorIdInt)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- strcpy(filename, ChargingProfile_0_JSON );
|
|
|
- break;
|
|
|
-
|
|
|
- case 1:
|
|
|
- strcpy(filename, ChargingProfile_1_JSON );
|
|
|
- break;
|
|
|
-
|
|
|
- case 2:
|
|
|
- strcpy(filename, ChargingProfile_2_JSON );
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- strcpy(filename, ChargingProfile_0_JSON );
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- fptr1 = fopen(filename, "r");
|
|
|
- if (!fptr1)
|
|
|
- {
|
|
|
- //file not exist
|
|
|
- DEBUG_INFO("Unable to open the input file!!\n");
|
|
|
- fptr1 = fopen(filename, "w+");
|
|
|
-
|
|
|
- }
|
|
|
- fclose(fptr1);
|
|
|
-#endif
|
|
|
-
|
|
|
- //DEBUG_INFO("chargingProfilePurposeStr=%s\n",chargingProfilePurposeStr);
|
|
|
- //DEBUG_INFO(" ChargingProfilePurposeTypeStr[TxProfile]=%s\n", ChargingProfilePurposeTypeStr[TxProfile]);
|
|
|
|
|
|
if(strcmp(chargingProfilePurposeStr, ChargingProfilePurposeTypeStr[ChargePointMaxProfile]) == 0)
|
|
|
{
|
|
@@ -9047,7 +9011,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
|
|
|
int d =0;
|
|
|
d = fgetc(infile);
|
|
|
- DEBUG_INFO("d:%d\n",d);
|
|
|
+ //DEBUG_INFO("d:%d\n",d);
|
|
|
rewind(infile);
|
|
|
|
|
|
//*检测到文件结束标识返回1,否则返回0。*/
|
|
@@ -9083,6 +9047,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
else
|
|
|
{
|
|
|
char buf[1000]={0};
|
|
|
+ int ChargingProfileAdded = FALSE;
|
|
|
|
|
|
while (fgets(buf, sizeof(buf), infile) != NULL)
|
|
|
{
|
|
@@ -9145,48 +9110,94 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
if((tempstackLevelInt == stackLevelInt) && (strcmp(tempchargingProfilePurposeStr, chargingProfilePurposeStr) == 0))
|
|
|
{
|
|
|
//DEBUG_INFO("update set chargingProfile to file -0\n");
|
|
|
- fprintf(outfile,"[%s]\n",payload);
|
|
|
+ if(ChargingProfileAdded == FALSE)
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",payload);
|
|
|
+ ChargingProfileAdded = TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //DEBUG_INFO("update set chargingProfile to file -1\n");
|
|
|
if(tempstackLevelInt < stackLevelInt)
|
|
|
{
|
|
|
- //DEBUG_INFO("update set chargingProfile to file -2\n");
|
|
|
- fprintf(outfile,"[%s]\n",payload);
|
|
|
- fprintf(outfile,"[%s]\n",buf);
|
|
|
+ if(ChargingProfileAdded == FALSE)
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",payload);
|
|
|
+ ChargingProfileAdded = TRUE;
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- fprintf(outfile,"[%s]\n",buf);
|
|
|
- fprintf(outfile,"[%s]\n",payload);
|
|
|
+ if(ChargingProfileAdded == FALSE)
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ fprintf(outfile,"%s\n",payload);
|
|
|
+ ChargingProfileAdded = TRUE;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- DEBUG_INFO("update set chargingProfile to file\n");
|
|
|
-
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if(tempchargingProfileIdInt < chargingProfileIdInt)
|
|
|
{
|
|
|
- fprintf(outfile,"[%s]\n",payload);
|
|
|
- fprintf(outfile,"[%s]\n",buf);
|
|
|
- }
|
|
|
+ if(ChargingProfileAdded == FALSE)
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",payload);
|
|
|
+ ChargingProfileAdded = TRUE;
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
else if(tempstackLevelInt < stackLevelInt)
|
|
|
{
|
|
|
- fprintf(outfile,"[%s]\n",payload);
|
|
|
- fprintf(outfile,"[%s]\n",buf);
|
|
|
+ if(ChargingProfileAdded == FALSE)
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",payload);
|
|
|
+ ChargingProfileAdded = TRUE;
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- fprintf(outfile,"[%s]\n",buf);
|
|
|
- fprintf(outfile,"[%s]\n",payload);
|
|
|
+ if(ChargingProfileAdded == FALSE)
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ fprintf(outfile,"%s\n",payload);
|
|
|
+ ChargingProfileAdded = TRUE;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ fprintf(outfile,"%s\n",buf);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- fprintf(outfile,"[%s]\n",buf);
|
|
|
- DEBUG_INFO("add set chargingProfile to file\n");
|
|
|
}
|
|
|
|
|
|
} // end of while loop
|
|
@@ -13061,7 +13072,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("chargingProfileId=%s\n",sstr);
|
|
|
tempchargingProfileId = atoi(sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13085,8 +13095,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("stackLevel=%s\n",sstr);
|
|
|
- tempstackLevel = atoi(sstr);
|
|
|
+ tempstackLevel = atoi(sstr);
|
|
|
|
|
|
}
|
|
|
else
|
|
@@ -13109,7 +13118,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("chargingProfilePurpose =%s\n",sstr);
|
|
|
strcpy(tempchargingProfilePurposeStr,sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13133,7 +13141,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("chargingProfileKind =%s\n",sstr);
|
|
|
strcpy(tempchargingProfileKindStr,sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13157,7 +13164,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("recurrencyKind =%s\n",sstr);
|
|
|
strcpy(temprecurrencyKindStr,sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13181,7 +13187,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("validFrom=%s\n",sstr);
|
|
|
strcpy(tempvalidFromStr,sstr);
|
|
|
|
|
|
}
|
|
@@ -13205,7 +13210,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("validTo =%s\n",sstr);
|
|
|
strcpy(tempvalidToStr,sstr);
|
|
|
|
|
|
}
|
|
@@ -13305,8 +13309,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
time_t t = time(NULL);
|
|
|
diff_t = difftime(t, utc);
|
|
|
|
|
|
- DEBUG_INFO("diff_t=%f\n",diff_t);
|
|
|
- DEBUG_INFO(" debug 5 -1\n");
|
|
|
+ //DEBUG_INFO("diff_t=%f\n",diff_t);
|
|
|
//parsing strings to words
|
|
|
i = 0;
|
|
|
loc = strstr(sLineWord, "chargingSchedulePeriod");
|
|
@@ -13388,6 +13391,8 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
MinChargingRate = tempminChargingRateFloat;
|
|
|
}
|
|
|
|
|
|
+ ChargePointMaxProfile_TEMP.ChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
+
|
|
|
if(confirmPeriods < n_SchedulePeriods)
|
|
|
{
|
|
|
confirmPeriods = n_SchedulePeriods;
|
|
@@ -13487,7 +13492,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("chargingProfileId=%s\n",sstr);
|
|
|
tempchargingProfileId = atoi(sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13511,7 +13515,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("stackLevel=%s\n",sstr);
|
|
|
tempstackLevel = atoi(sstr);
|
|
|
|
|
|
}
|
|
@@ -13535,7 +13538,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("chargingProfilePurpose =%s\n",sstr);
|
|
|
strcpy(tempchargingProfilePurposeStr,sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13559,7 +13561,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("chargingProfileKind =%s\n",sstr);
|
|
|
strcpy(tempchargingProfileKindStr,sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13583,7 +13584,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("recurrencyKind =%s\n",sstr);
|
|
|
strcpy(temprecurrencyKindStr,sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13649,8 +13649,8 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
while (loc[3+strlen("chargingRateUnit")+c] != '\"')
|
|
|
{
|
|
|
- sstr[c] = loc[3+strlen("chargingRateUnit")+c];
|
|
|
- c++;
|
|
|
+ sstr[c] = loc[3+strlen("chargingRateUnit")+c];
|
|
|
+ c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
strcpy(tempchargingRateUnitStr, sstr);
|
|
@@ -13681,7 +13681,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
time_t t = time(NULL);
|
|
|
diff_t = difftime(t, utc);
|
|
|
|
|
|
- DEBUG_INFO("diff_t=%f\n",diff_t);
|
|
|
+ printf("diff between startScheduleStr and now =%f\n",diff_t);
|
|
|
|
|
|
//parsing strings to words
|
|
|
i = 0;
|
|
@@ -13748,6 +13748,8 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
TxDefaultProfile_TEMP.ChargingProfileId = tempchargingProfileId;
|
|
|
TxDefaultProfile_TEMP.StackLevel = tempstackLevel;
|
|
|
TxDefaultProfile_TEMP.TransactionId = 0;
|
|
|
+ TxDefaultProfile_TEMP.ChargingSchedule.Duration = tempdurationInt;
|
|
|
+ strcpy((char *)TxDefaultProfile_TEMP.ChargingSchedule.ChargingRateUnit, (const char *)tempchargingRateUnitStr);
|
|
|
strcpy((char *)TxDefaultProfile_TEMP.ChargingProfileKind, (const char *)tempchargingProfileKindStr);
|
|
|
strcpy((char *)TxDefaultProfile_TEMP.ChargingProfilePurpose, (const char *)tempchargingProfilePurposeStr);
|
|
|
strcpy((char *)TxDefaultProfile_TEMP.RecurrencyKind, (const char *)temprecurrencyKindStr);
|
|
@@ -13768,14 +13770,17 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(MinChargingRate < tempminChargingRateFloat)
|
|
|
- MinChargingRate = tempminChargingRateFloat;
|
|
|
+ if(MinChargingRate < tempminChargingRateFloat)
|
|
|
+ {
|
|
|
+ MinChargingRate = tempminChargingRateFloat;
|
|
|
+ }
|
|
|
|
|
|
+ TxDefaultProfile_TEMP.ChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
|
|
|
- if(confirmPeriods < n_SchedulePeriods)
|
|
|
- confirmPeriods = n_SchedulePeriods;
|
|
|
+ if(confirmPeriods < n_SchedulePeriods)
|
|
|
+ confirmPeriods = n_SchedulePeriods;
|
|
|
|
|
|
- j = j + 1;
|
|
|
+ j = j + 1;
|
|
|
}
|
|
|
|
|
|
fclose(fptr1);
|
|
@@ -13801,7 +13806,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
TxDefaultProfile.TotalPeriod = TxDefaultProfile.TotalPeriod + 1;
|
|
|
TxDefaultProfile.Duration = TxDefaultProfiletemp[l].Duration;
|
|
|
|
|
|
-
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -13812,15 +13816,10 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
TxDefaultProfile.Duration = TxDefaultProfiletemp[l].Duration;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
//end of Stacking Charging Profiles
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}// the end of ACCESS TxDefaultProfile
|
|
@@ -13896,7 +13895,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
//***********chargingProfileId**************/
|
|
|
c = 0;
|
|
|
loc = strstr(sLineWord, "chargingProfileId");
|
|
|
- //DEBUG_INFO("loc=%s\n",loc);
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
|
|
|
if(loc != NULL)
|
|
@@ -13908,7 +13906,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("chargingProfileId=%s\n",sstr);
|
|
|
tempchargingProfileId = atoi(sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13932,7 +13929,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("transactionId=%s\n",sstr);
|
|
|
temptransactionId = atoi(sstr);
|
|
|
}
|
|
|
else
|
|
@@ -13956,7 +13952,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("stackLevel=%s\n",sstr);
|
|
|
tempstackLevel = atoi(sstr);
|
|
|
|
|
|
}
|
|
@@ -13980,7 +13975,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("chargingProfilePurpose =%s\n",sstr);
|
|
|
strcpy(tempchargingProfilePurposeStr,sstr);
|
|
|
}
|
|
|
else
|
|
@@ -14004,7 +13998,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("chargingProfileKind =%s\n",sstr);
|
|
|
strcpy(tempchargingProfileKindStr,sstr);
|
|
|
}
|
|
|
else
|
|
@@ -14028,7 +14021,6 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
|
- DEBUG_INFO("recurrencyKind =%s\n",sstr);
|
|
|
strcpy(temprecurrencyKindStr,sstr);
|
|
|
}
|
|
|
else
|
|
@@ -14056,6 +14048,28 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
strcpy(tempvalidFromStr,"");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //***********duration**************/
|
|
|
+ c = 0;
|
|
|
+ loc = strstr(sLineWord, "duration");
|
|
|
+ //DEBUG_INFO("loc=%s\n",loc);
|
|
|
+ memset(sstr ,0, sizeof(sstr) );
|
|
|
+
|
|
|
+ if(loc != NULL)
|
|
|
+ {
|
|
|
+ while (loc[2+strlen("duration")+c] != '\"')
|
|
|
+ {
|
|
|
+ sstr[c] = loc[2+strlen("duration")+c];
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ tempdurationInt = atoi(sstr);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempdurationInt = 0;
|
|
|
+ }
|
|
|
+
|
|
|
//**********startSchedule**********/
|
|
|
c = 0;
|
|
|
loc = strstr(sLineWord, "startSchedule");
|
|
@@ -14107,7 +14121,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
time_t t = time(NULL);
|
|
|
diff_t = difftime(t, utc);
|
|
|
|
|
|
- DEBUG_INFO("diff_t=%f\n",diff_t);
|
|
|
+ //DEBUG_INFO("diff_t=%f\n",diff_t);
|
|
|
//parsing strings to words
|
|
|
i = 0;
|
|
|
loc = strstr(sLineWord, "chargingSchedulePeriod");
|
|
@@ -14171,7 +14185,11 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
}
|
|
|
|
|
|
if(MinChargingRate < tempminChargingRateFloat)
|
|
|
- MinChargingRate = tempminChargingRateFloat;
|
|
|
+ {
|
|
|
+ MinChargingRate = tempminChargingRateFloat;
|
|
|
+ }
|
|
|
+
|
|
|
+ TxProfile_TEMP.ChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
|
|
|
if(confirmPeriods < n_SchedulePeriods)
|
|
|
confirmPeriods = n_SchedulePeriods;
|
|
@@ -14181,6 +14199,8 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
TxProfile_TEMP.ChargingProfileId = tempchargingProfileId;
|
|
|
TxProfile_TEMP.StackLevel = tempstackLevel;
|
|
|
TxProfile_TEMP.TransactionId = 0;
|
|
|
+ TxProfile_TEMP.ChargingSchedule.Duration = tempdurationInt;
|
|
|
+ strcpy((char *)TxProfile_TEMP.ChargingSchedule.ChargingRateUnit, (const char *)tempchargingRateUnitStr);
|
|
|
strcpy((char *)TxProfile_TEMP.ChargingProfileKind, (const char *)tempchargingProfileKindStr);
|
|
|
strcpy((char *)TxProfile_TEMP.ChargingProfilePurpose, (const char *)tempchargingProfilePurposeStr);
|
|
|
strcpy((char *)TxProfile_TEMP.RecurrencyKind, (const char *)temprecurrencyKindStr);
|
|
@@ -14205,6 +14225,9 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfileId = TxProfile_TEMP.ChargingProfileId;
|
|
|
ShmOCPP16Data->SmartChargingProfile[gunindex].TransactionId = temptransactionId;
|
|
|
ShmOCPP16Data->SmartChargingProfile[gunindex].StackLevel = TxProfile_TEMP.StackLevel;
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.Duration = TxProfile_TEMP.ChargingSchedule.Duration ;
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.MinChargingRate = TxProfile_TEMP.ChargingSchedule.MinChargingRate;
|
|
|
+ strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingRateUnit, (const char *)TxProfile_TEMP.ChargingSchedule.ChargingRateUnit);
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfileKind, (const char *)TxProfile_TEMP.ChargingProfileKind );
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfilePurpose, (const char *)TxProfile_TEMP.ChargingProfilePurpose );
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.StartSchedule,(const char *)TxProfile_TEMP.ChargingSchedule.StartSchedule);
|
|
@@ -14213,6 +14236,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ValidTo, (const char *)TxProfile_TEMP.ValidTo);
|
|
|
|
|
|
|
|
|
+
|
|
|
for(int k=0; k < TxProfile.TotalPeriod;k++)
|
|
|
{
|
|
|
if(TxProfile.Period[k].Limit < ChargePointMaxProfile.Period[0].Limit)
|
|
@@ -14281,6 +14305,9 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfileId = TxDefaultProfile_TEMP.ChargingProfileId;
|
|
|
ShmOCPP16Data->SmartChargingProfile[gunindex].TransactionId = 0;
|
|
|
ShmOCPP16Data->SmartChargingProfile[gunindex].StackLevel = TxDefaultProfile_TEMP.StackLevel;
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.Duration = TxDefaultProfile_TEMP.ChargingSchedule.Duration ;
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.MinChargingRate = TxDefaultProfile_TEMP.ChargingSchedule.MinChargingRate;
|
|
|
+ strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingRateUnit, (const char *)TxDefaultProfile_TEMP.ChargingSchedule.ChargingRateUnit );
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfileKind, (const char *)TxDefaultProfile_TEMP.ChargingProfileKind );
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfilePurpose, (const char *)TxDefaultProfile_TEMP.ChargingProfilePurpose );
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.StartSchedule,(const char *)TxDefaultProfile_TEMP.ChargingSchedule.StartSchedule);
|
|
@@ -14321,6 +14348,8 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfileId = TxDefaultProfile_TEMP.ChargingProfileId;
|
|
|
ShmOCPP16Data->SmartChargingProfile[gunindex].TransactionId = 0;
|
|
|
ShmOCPP16Data->SmartChargingProfile[gunindex].StackLevel = TxDefaultProfile_TEMP.StackLevel;
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.Duration = 86400 ;
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.MinChargingRate = TxDefaultProfile_TEMP.ChargingSchedule.MinChargingRate;
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfileKind, (const char *)TxDefaultProfile_TEMP.ChargingProfileKind );
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfilePurpose, (const char *)TxDefaultProfile_TEMP.ChargingProfilePurpose );
|
|
|
strcpy((char *)ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.StartSchedule, (const char *)TxDefaultProfile_TEMP.ChargingSchedule.StartSchedule);
|
|
@@ -14337,54 +14366,72 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
//ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].Limit = TxDefaultProfile.Period[l].Limit;
|
|
|
//ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].NumberPhases = TxDefaultProfile.Period[l].NumberPhases;
|
|
|
//ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].StartPeriod = TxDefaultProfile.Period[l].StartPeriod;
|
|
|
- period = period + 1;
|
|
|
+
|
|
|
+ period = period + 1;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
confirmPeriods = period;
|
|
|
- //DEBUG_INFO("confirmPeriods=%d\n",confirmPeriods);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-#if 0
|
|
|
- //* Define temporary variables */
|
|
|
- struct tm *gtime;
|
|
|
- time_t now;
|
|
|
- char buf[28];
|
|
|
- //* Read the current system time */
|
|
|
- time(&now);
|
|
|
- //* Convert the system time to GMT (now UTC) */
|
|
|
- gtime = gmtime(&now);
|
|
|
- strftime(buf, 28, "%Y-%m-%dT%H:%M:%SZ", gtime);
|
|
|
-
|
|
|
- // make .conf
|
|
|
- strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.StartSchedule,buf);
|
|
|
- //ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.Duration = durationInt;
|
|
|
- //DEBUG_INFO(" debug 11\n");
|
|
|
-
|
|
|
- strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingRateUnit, tempchargingRateUnitStr );
|
|
|
-
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
- sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
+ DEBUG_INFO("confirmPeriods=%d\n",confirmPeriods);
|
|
|
+ DEBUG_INFO("\nchargingProfileId =%d, transactionId =%d\n, stackLevel =%d, chargingProfilePurpose=%s, chargingProfileKind=%s, recurrencyKind =%s, validFrom =%s, validTo =%s, duration=%d , startSchedule =%s, chargingRateUnit=%s, minChargingRate=%f,"
|
|
|
+ "startPeriod0 =%d, limit0=%f, numberPhases0=%d\n"
|
|
|
+ "startPeriod1 =%d, limit1=%f, numberPhases1=%d\n"
|
|
|
+ "startPeriod2 =%d, limit2=%f, numberPhases2=%d\n"
|
|
|
+ "startPeriod3 =%d, limit3=%f, numberPhases3=%d\n"
|
|
|
+ "startPeriod4 =%d, limit4=%f, numberPhases4=%d\n"
|
|
|
+ "startPeriod5 =%d, limit5=%f, numberPhases5=%d\n"
|
|
|
+ "startPeriod6 =%d, limit6=%f, numberPhases6=%d\n"
|
|
|
+ "startPeriod7 =%d, limit7=%f, numberPhases7=%d\n"
|
|
|
+ "startPeriod8 =%d, limit8=%f, numberPhases8=%d\n"
|
|
|
+ "startPeriod9 =%d, limit9=%f, numberPhases9=%d\n",
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfileId,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].TransactionId,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].StackLevel,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfilePurpose,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingProfileKind,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].RecurrencyKind,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ValidFrom,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ValidTo,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.Duration,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.StartSchedule,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingRateUnit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.MinChargingRate,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[0].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[0].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[0].NumberPhases,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[1].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[1].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[1].NumberPhases,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[2].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[2].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[2].NumberPhases,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[3].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[3].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[3].NumberPhases,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[4].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[4].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[4].NumberPhases,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[5].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[5].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[5].NumberPhases,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[6].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[6].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[6].NumberPhases,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[7].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[7].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[7].NumberPhases,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[8].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[8].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[8].NumberPhases,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[9].StartPeriod,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[9].Limit,
|
|
|
+ ShmOCPP16Data->SmartChargingProfile[gunindex].ChargingSchedule.ChargingSchedulePeriod[9].NumberPhases);
|
|
|
}
|
|
|
|
|
|
-#if 0
|
|
|
-void Send(struct json_object *message)
|
|
|
-{
|
|
|
- printf("Send -1 \n");
|
|
|
- printf("message=%s\n",json_object_to_json_string(message));
|
|
|
- LWS_Send(json_object_to_json_string(message));
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
void LWS_Send(char * str)
|
|
|
{
|
|
|
-#if 1
|
|
|
+
|
|
|
//=====================================================
|
|
|
// Check InternetConn 0: disconnected, 1: connected
|
|
|
//====================================================
|
|
@@ -14393,7 +14440,7 @@ void LWS_Send(char * str)
|
|
|
DEBUG_INFO("\n offline now !!!\n");
|
|
|
return;
|
|
|
}
|
|
|
-#endif
|
|
|
+
|
|
|
pthread_mutex_lock(&lock);
|
|
|
memset(SendBuffer,0,SendBufLen);
|
|
|
sprintf((char *)SendBuffer, "%s", str);
|