|
@@ -38,6 +38,7 @@
|
|
|
#include "TransactionQueue.h"
|
|
|
|
|
|
|
|
|
+
|
|
|
#define PASS 1
|
|
|
#define FAIL -1
|
|
|
|
|
@@ -3145,7 +3146,7 @@ int sendStopTransactionRequest(int gun_index)
|
|
|
|
|
|
}
|
|
|
|
|
|
-#if 0 // for TempStopTransaction
|
|
|
+#if 1 // for TempStopTransaction
|
|
|
//Delete TempStopTransaction
|
|
|
if((access("/Storage/OCPP/TempStopTransaction",F_OK))!=-1)
|
|
|
{
|
|
@@ -5636,54 +5637,54 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
memset(&TxDefaultProfile,0,sizeof(struct StructProfile));
|
|
|
memset(&TxProfile,0,sizeof(struct StructProfile));
|
|
|
|
|
|
- c=0;
|
|
|
- loc = strstr(sstrtemp, "connectorId");
|
|
|
- memset(sstr ,0, sizeof(sstr) );
|
|
|
- while ((loc[strlen("connectorId")+2+c] != '}') && (loc[strlen("connectorId")+2+c] != ','))
|
|
|
- {
|
|
|
- sstr[c] = loc[strlen("connectorId")+2+c];
|
|
|
- //printf("i=%d sstr=%c\n",c, sstr[c]);
|
|
|
- c++;
|
|
|
- }
|
|
|
- sstr[c] = '\0';
|
|
|
- connectorIdInt = atoi(sstr);
|
|
|
-
|
|
|
- c=0;
|
|
|
- loc = strstr(sstrtemp, "duration");
|
|
|
- memset(sstr ,0, sizeof(sstr) );
|
|
|
- while ((loc[strlen("duration")+2+c] != '}') && (loc[strlen("duration")+2+c] != ','))
|
|
|
- {
|
|
|
- sstr[c] = loc[strlen("duration")+2+c];
|
|
|
- //printf("i=%d sstr=%c\n",c, sstr[c]);
|
|
|
- c++;
|
|
|
- }
|
|
|
- sstr[c] = '\0';
|
|
|
- durationInt = atoi(sstr);
|
|
|
+ c=0;
|
|
|
+ loc = strstr(sstrtemp, "connectorId");
|
|
|
+ memset(sstr ,0, sizeof(sstr) );
|
|
|
+ while ((loc[strlen("connectorId")+2+c] != '}') && (loc[strlen("connectorId")+2+c] != ','))
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("connectorId")+2+c];
|
|
|
+ //printf("i=%d sstr=%c\n",c, sstr[c]);
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ connectorIdInt = atoi(sstr);
|
|
|
|
|
|
- c = 0;
|
|
|
- loc = strstr(sstrtemp, "chargingRateUnit");
|
|
|
- memset(sstr ,0, sizeof(sstr) );
|
|
|
- if(loc == NULL)
|
|
|
- {
|
|
|
+ c=0;
|
|
|
+ loc = strstr(sstrtemp, "duration");
|
|
|
+ memset(sstr ,0, sizeof(sstr) );
|
|
|
+ while ((loc[strlen("duration")+2+c] != '}') && (loc[strlen("duration")+2+c] != ','))
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("duration")+2+c];
|
|
|
+ //printf("i=%d sstr=%c\n",c, sstr[c]);
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ durationInt = atoi(sstr);
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
+ c = 0;
|
|
|
+ loc = strstr(sstrtemp, "chargingRateUnit");
|
|
|
+ memset(sstr ,0, sizeof(sstr) );
|
|
|
+ if(loc == NULL)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ while (loc[3+strlen("chargingRateUnit")+c] != '\"')
|
|
|
{
|
|
|
- while (loc[3+strlen("chargingRateUnit")+c] != '\"')
|
|
|
- {
|
|
|
- sstr[c] = loc[3+strlen("chargingRateUnit")+c];
|
|
|
- c++;
|
|
|
- }
|
|
|
- sstr[c] = '\0';
|
|
|
- strcpy(chargingRateUnitStr, sstr);
|
|
|
+ sstr[c] = loc[3+strlen("chargingRateUnit")+c];
|
|
|
+ c++;
|
|
|
}
|
|
|
+ sstr[c] = '\0';
|
|
|
+ strcpy(chargingRateUnitStr, sstr);
|
|
|
+ }
|
|
|
|
|
|
CompositeSceduleIndex = (connectorIdInt > 0) ?(connectorIdInt -1) :0;
|
|
|
|
|
|
- memset(ShmOCPP16Data->GetCompositeSchedule, 0, sizeof(struct StructChargingSchedulePeriod)*gunTotalNumber/*(CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY)*/ );
|
|
|
+ memset(ShmOCPP16Data->GetCompositeSchedule, 0, sizeof(struct StructChargingSchedulePeriod)*gunTotalNumber/*(CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY)*/ );
|
|
|
|
|
|
- if(connectorIdInt==0) // connectorId is 0
|
|
|
- {
|
|
|
+ if(connectorIdInt==0) // connectorId is 0
|
|
|
+ {
|
|
|
//******************************ChargePointMaxProfile*****************************************************/
|
|
|
strcpy(fname, ChargePointMaxProfile_JSON );
|
|
|
|
|
@@ -6255,9 +6256,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
|
|
|
|
|
|
- }
|
|
|
- else if ((connectorIdInt > 0)&&((connectorIdInt -1) < gunTotalNumber/*(CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY)*/) )
|
|
|
- {
|
|
|
+ }
|
|
|
+ else if ((connectorIdInt > 0)&&((connectorIdInt -1) < gunTotalNumber/*(CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY)*/) )
|
|
|
+ {
|
|
|
//*****************************ChargePointMaxProfile******************************************/
|
|
|
strcpy(fname, ChargePointMaxProfile_JSON);
|
|
|
ChargePointMaxProfileIsNull=TRUE;
|
|
@@ -7234,12 +7235,11 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
|
|
|
ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
//end:
|
|
|
|
|
@@ -18467,26 +18467,26 @@ void checkTempStopTransaction(int gun_index)
|
|
|
str[strlen(str) - 1] = '\0'; // eat the newline fgets() stores
|
|
|
|
|
|
if(str[0]=='\0')
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- random_uuid(guid);
|
|
|
- sprintf(tempdata, "StopTransaction,%d", (gun_index));
|
|
|
- if(hashmap_operation(0, guid, tempdata) == 1)
|
|
|
- {
|
|
|
- DEBUG_INFO("StopTransaction mapitem pass\n");
|
|
|
- }
|
|
|
- queue_operation(4, guid, str );//addq(guid, queuedata); ---> remove temporally
|
|
|
+ random_uuid(guid);
|
|
|
+ sprintf(tempdata, "StopTransaction,%d", (gun_index));
|
|
|
+ if(hashmap_operation(0, guid, tempdata) == 1)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("StopTransaction mapitem pass\n");
|
|
|
+ }
|
|
|
+ queue_operation(4, guid, str );//addq(guid, queuedata); ---> remove temporally
|
|
|
|
|
|
- memset(str,0,sizeof str);
|
|
|
+ memset(str,0,sizeof str);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// fptr1=freopen(NULL,"w",fptr1); // reset the fptr1 again
|
|
|
- fclose(fptr1);
|
|
|
- remove("/Storage/OCPP/TempStopTransaction"); // remove the original file
|
|
|
+ fclose(fptr1);
|
|
|
+ remove("/Storage/OCPP/TempStopTransaction"); // remove the original file
|
|
|
}
|
|
|
|
|
|
void FillStartTransaction(int ConnectorId, unsigned char IdTag[], int MeterStart,int ReservationId,unsigned char Timestamp[])
|