|
@@ -8161,7 +8161,7 @@ int handleSendLocalListRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
sstr[j] = '\0';
|
|
|
strcpy(idTagstr, sstr);
|
|
|
- //DEBUG_INFO("idTagstr=%s\n", idTagstr);
|
|
|
+ DEBUG_INFO("idTagstr=%s\n", idTagstr);
|
|
|
|
|
|
//Search "expiryDate"
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
@@ -8184,7 +8184,7 @@ int handleSendLocalListRequest(char *uuid, char *payload)
|
|
|
strcpy(expiryDate, "");
|
|
|
}
|
|
|
|
|
|
- //DEBUG_INFO("expiryDate=%s\n", expiryDate);
|
|
|
+ DEBUG_INFO("expiryDate=%s\n", expiryDate);
|
|
|
|
|
|
|
|
|
//Search "parentIdTag"
|
|
@@ -8207,7 +8207,7 @@ int handleSendLocalListRequest(char *uuid, char *payload)
|
|
|
strcpy(parentIdTag, "");
|
|
|
}
|
|
|
|
|
|
- //DEBUG_INFO("parentIdTag=%s\n", parentIdTag);
|
|
|
+ DEBUG_INFO("parentIdTag=%s\n", parentIdTag);
|
|
|
|
|
|
|
|
|
//Search "status"
|
|
@@ -8223,12 +8223,13 @@ int handleSendLocalListRequest(char *uuid, char *payload)
|
|
|
sstr[j] = '\0';
|
|
|
strcpy(idTagstatus, sstr);
|
|
|
|
|
|
- //DEBUG_INFO("idTagstatus=%s\n", idTagstatus);
|
|
|
+ DEBUG_INFO("idTagstatus=%s\n", idTagstatus);
|
|
|
|
|
|
|
|
|
OCPP_getIdTag(idTagstr);
|
|
|
//OCPP_getIdTag("test"); For Test
|
|
|
//DEBUG_INFO("idTagAuthorization=%s\n",idTagAuthorization);
|
|
|
+ //DEBUG_INFO("updateTypestr=%s\n",updateTypestr);
|
|
|
|
|
|
if(strcmp(updateTypestr, UpdateTypeStr[Full]) == 0)
|
|
|
{
|
|
@@ -8236,22 +8237,26 @@ int handleSendLocalListRequest(char *uuid, char *payload)
|
|
|
DEBUG_INFO("Local list full update.\n");
|
|
|
// update list
|
|
|
OCPP_addLocalList_1(listVersionInt, idTagstr, parentIdTag, expiryDate, idTagstatus);
|
|
|
- OCPP_get_TableAuthlocalAllData();
|
|
|
+ //DEBUG_INFO("Local list full update. 1\n");
|
|
|
+ //OCPP_get_TableAuthlocalAllData();
|
|
|
+ //DEBUG_INFO("Local list full update. 2\n");
|
|
|
}
|
|
|
else if(strcmp(updateTypestr, UpdateTypeStr[Differential]) == 0)
|
|
|
{
|
|
|
if((strcmp(idTagstr, idTagAuthorization) == 0) && (parentIdTag[0] != '\0'))
|
|
|
{
|
|
|
- OCPP_addLocalList_1(listVersionInt, idTagstr, parentIdTag, expiryDate, idTagstatus);
|
|
|
+ OCPP_addLocalList_1(listVersionInt, idTagstr, parentIdTag, expiryDate, idTagstatus); // update
|
|
|
|
|
|
}
|
|
|
else if((strcmp(idTagstr, idTagAuthorization) == 0) && (parentIdTag[0] == '\0'))
|
|
|
{
|
|
|
OCPP_deleteIdTag(idTagstr);
|
|
|
+ OCPP_addLocalList_1(listVersionInt, idTagstr, parentIdTag, expiryDate, idTagstatus); // update
|
|
|
+ //OCPP_deleteIdTag(idTagstr);
|
|
|
}
|
|
|
else if((strcmp(idTagstr, idTagAuthorization) != 0) && (parentIdTag[0] != '\0'))
|
|
|
{
|
|
|
- OCPP_addLocalList_1(listVersionInt, idTagstr, parentIdTag, expiryDate, idTagstatus);
|
|
|
+ OCPP_addLocalList_1(listVersionInt, idTagstr, parentIdTag, expiryDate, idTagstatus); // add
|
|
|
|
|
|
}
|
|
|
|
|
@@ -8688,6 +8693,13 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
sstr[c] = '\0';
|
|
|
strcpy(chargingRateUnitStr,sstr);
|
|
|
|
|
|
+ if((strcmp(chargingRateUnitStr,"A")!=0)&& strcmp((char *)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ChargingScheduleAllowedChargingRateUnit].ItemData, "Current")==0)
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected] );
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if(connectorIdInt == 0) // an overall limit for the Charge Point.
|
|
|
{
|
|
|
strcpy((char *)ShmOCPP16Data->SetChargingProfile[0].ChargingProfile.ChargingSchedule.ChargingRateUnit,chargingRateUnitStr);
|
|
@@ -8716,6 +8728,13 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if( chargingSchedulePeriodCount > atoi((const char *)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ChargingScheduleMaxPeriods].ItemData))
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected] );
|
|
|
+ goto end;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//DEBUG_INFO("chargingSchedulePeriodCount=%d\n",chargingSchedulePeriodCount);
|
|
|
//DEBUG_INFO("handleSetChargingProfileRequest -13 -1\n");
|
|
@@ -14031,7 +14050,7 @@ void OCPP_getListVerion()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void OCPP_getIdTag(char *idTag)
|
|
|
+void OCPP_getIdTag(char idTag[])
|
|
|
{
|
|
|
int rc = 0;
|
|
|
// const char* data = "Callback function called";
|
|
@@ -14072,6 +14091,7 @@ void OCPP_get_TableAuthlocalAllData(void)
|
|
|
memset(sql, 0, 100);
|
|
|
memset(zErrMsg, 0, 100);
|
|
|
|
|
|
+
|
|
|
sprintf(sql,"select * from ocpp_auth_local ");
|
|
|
|
|
|
/* Execute SQL statement */
|
|
@@ -14114,11 +14134,11 @@ int OCPP_addLocalList_1(int version, char *idTag, char *parentTage, char *expiry
|
|
|
int isSuccess = FALSE;
|
|
|
int ret = 0;
|
|
|
//const char* data = "Callback function called";
|
|
|
- char sql[200];
|
|
|
- char zErrMsg[100];
|
|
|
+ char sql[300];
|
|
|
+ char zErrMsg[200];
|
|
|
|
|
|
- memset(sql, 0, 200);
|
|
|
- memset(zErrMsg, 0, 100);
|
|
|
+ memset(sql, 0, 300);
|
|
|
+ memset(zErrMsg, 0, 200);
|
|
|
|
|
|
sprintf(sql,"insert or replace into ocpp_auth_local (idtag, parent_idtag, expir_date, status, version) " "VALUES ('%s', '%s', '%s', '%s', %d ); ""SELECT * from ocpp_auth_local", idTag, parentTage, expiryDate, status, version);
|
|
|
|
|
@@ -14137,7 +14157,7 @@ int OCPP_addLocalList_1(int version, char *idTag, char *parentTage, char *expiry
|
|
|
return isSuccess;
|
|
|
}
|
|
|
|
|
|
-void OCPP_deleteIdTag(char *idTag)
|
|
|
+void OCPP_deleteIdTag(char idTag[])
|
|
|
{
|
|
|
//int ver = 0;
|
|
|
//int isSuccess = FALSE;
|