|
@@ -1081,19 +1081,219 @@ int OCPP_insert_transaction_msg(uint8_t isStartTransaction, char *transactionMsg
|
|
|
if (sqlite3_exec(db, sqlStr, 0, 0, &errMsg) != SQLITE_OK)
|
|
|
{
|
|
|
result = FAIL;
|
|
|
- DEBUG_INFO( "Insert local transaction record error message: %s\n", errMsg);
|
|
|
+ DEBUG_WARN( "Insert local transaction record error message: %s\n", errMsg);
|
|
|
}
|
|
|
|
|
|
sprintf(sqlStr, "delete from ocpp_transaction_record where (idx < (select idx from ocpp_transaction_record order by idx desc limit 1)-2000) and (occurDatetime < '%04d-01-01 00:00:00');", (getCurrentYear()-3));
|
|
|
if (sqlite3_exec(db, sqlStr, 0, 0, &errMsg) != SQLITE_OK)
|
|
|
{
|
|
|
result = FAIL;
|
|
|
- DEBUG_INFO( "delete local transaction record error message: %s\n", errMsg);
|
|
|
+ DEBUG_WARN( "delete local transaction record error message: %s\n", errMsg);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+int OCPP_updatePeriodEnergy(uint8_t gun_index)
|
|
|
+{
|
|
|
+ int isSuccess = TRUE;
|
|
|
+ int tempIndex;
|
|
|
+ json_object *EnergyDataTransfer = json_object_new_object();
|
|
|
+ json_object *periodEnergys = json_object_new_object();
|
|
|
+ char sql[1024];
|
|
|
+ char zErrMsg[200];
|
|
|
+
|
|
|
+ memset(sql, 0, ARRAY_SIZE(sql));
|
|
|
+ memset(zErrMsg, 0, ARRAY_SIZE(zErrMsg));
|
|
|
+
|
|
|
+ if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
|
|
|
+ {
|
|
|
+ tempIndex = ((gun_index==2) ? 1: 0);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempIndex = gun_index;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int index = 0; index < CHAdeMO_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex))
|
|
|
+ {
|
|
|
+ json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId));
|
|
|
+ for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].presentChargedEnergyPeriod);idxPeriod++)
|
|
|
+ {
|
|
|
+ uint8_t period[3];
|
|
|
+ sprintf((char*)period, "%d", idxPeriod);
|
|
|
+
|
|
|
+ json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].presentChargedEnergyPeriod[idxPeriod]));
|
|
|
+ }
|
|
|
+
|
|
|
+ json_object_object_add(EnergyDataTransfer, "periodEnergy", json_object_new_string(json_object_to_json_string_ext(periodEnergys, JSON_C_TO_STRING_PLAIN)));
|
|
|
+ } //end of the same index
|
|
|
+ }//end of for CHAdeMO_QUANTITY
|
|
|
+ }
|
|
|
+ else if(gunType[gun_index] == GUN_TYPE_CCS)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
|
|
|
+ {
|
|
|
+ tempIndex = ((gun_index==2) ? 1: 0);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempIndex = gun_index;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int index = 0; index < CCS_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
|
|
|
+ {
|
|
|
+ json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId));
|
|
|
+ for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].presentChargedEnergyPeriod);idxPeriod++)
|
|
|
+ {
|
|
|
+ uint8_t period[3];
|
|
|
+ sprintf((char*)period, "%d", idxPeriod);
|
|
|
+
|
|
|
+ json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].presentChargedEnergyPeriod[idxPeriod]));
|
|
|
+ }
|
|
|
+
|
|
|
+ json_object_object_add(EnergyDataTransfer, "periodEnergy", json_object_new_string(json_object_to_json_string_ext(periodEnergys, JSON_C_TO_STRING_PLAIN)));
|
|
|
+ } //end of the same index
|
|
|
+ } // end of for CCS_QUANTITY
|
|
|
+ }
|
|
|
+ else if(gunType[gun_index] == GUN_TYPE_GBT)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
|
|
|
+ {
|
|
|
+ tempIndex = ((gun_index==2) ? 1: 0);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempIndex = gun_index;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int index = 0; index < GB_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
|
|
|
+ {
|
|
|
+ json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId));
|
|
|
+ for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].presentChargedEnergyPeriod);idxPeriod++)
|
|
|
+ {
|
|
|
+ uint8_t period[3];
|
|
|
+ sprintf((char*)period, "%d", idxPeriod);
|
|
|
+
|
|
|
+ json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].presentChargedEnergyPeriod[idxPeriod]));
|
|
|
+ }
|
|
|
+
|
|
|
+ json_object_object_add(EnergyDataTransfer, "periodEnergy", json_object_new_string(json_object_to_json_string_ext(periodEnergys, JSON_C_TO_STRING_PLAIN)));
|
|
|
+ } //end of the same index
|
|
|
+ } // end of for GB_QUANTITY
|
|
|
+ }
|
|
|
+ else if(gunType[gun_index] == GUN_TYPE_DO)
|
|
|
+ {
|
|
|
+ tempIndex = gun_index;
|
|
|
+
|
|
|
+ for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
|
|
|
+ {
|
|
|
+ json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId));
|
|
|
+
|
|
|
+ for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.presentChargedEnergyPeriod);idxPeriod++)
|
|
|
+ {
|
|
|
+ uint8_t period[3];
|
|
|
+ sprintf((char*)period, "%d", idxPeriod);
|
|
|
+
|
|
|
+ json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.presentChargedEnergyPeriod[idxPeriod]));
|
|
|
+ }
|
|
|
+
|
|
|
+ json_object_object_add(EnergyDataTransfer, "periodEnergy", json_object_new_string(json_object_to_json_string_ext(periodEnergys, JSON_C_TO_STRING_PLAIN)));
|
|
|
+ } //end of the same index
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
|
|
|
+ {
|
|
|
+ tempIndex = 2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempIndex = gun_index;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int index = 0; index < AC_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
|
|
|
+ {
|
|
|
+ json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId));
|
|
|
+
|
|
|
+ for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].presentChargedEnergyPeriod);idxPeriod++)
|
|
|
+ {
|
|
|
+ uint8_t period[3];
|
|
|
+ sprintf((char*)period, "%d", idxPeriod);
|
|
|
+
|
|
|
+ json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].presentChargedEnergyPeriod[idxPeriod]));
|
|
|
+ }
|
|
|
+
|
|
|
+ json_object_object_add(EnergyDataTransfer, "periodEnergy", periodEnergys);
|
|
|
+ }//end of the same index
|
|
|
+ }//end of for AC_QUANTITY
|
|
|
+ }
|
|
|
+
|
|
|
+ sprintf(sql, "insert or replace into ocpp_period_energy (transactionId, connectorId, occurDatetime, periodEnergy) VALUES ('%d', '%d', CURRENT_TIMESTAMP, '%s');", ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId, (gun_index+1), json_object_to_json_string_ext(EnergyDataTransfer, JSON_C_TO_STRING_PLAIN));
|
|
|
+ json_object_put(EnergyDataTransfer);
|
|
|
+
|
|
|
+ //* Execute SQL statement */
|
|
|
+ if( sqlite3_exec(db, sql, callback, 0, (char **)&zErrMsg) != SQLITE_OK )
|
|
|
+ {
|
|
|
+ DEBUG_WARN("SQL error: %s\n", zErrMsg);
|
|
|
+ isSuccess = FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ sprintf(sql, "delete from ocpp_period_energy where (occurDatetime < '%04d-01-01 00:00:00');", (getCurrentYear()-3));
|
|
|
+ if (sqlite3_exec(db, sql, 0, 0, (char **)&zErrMsg) != SQLITE_OK)
|
|
|
+ {
|
|
|
+ DEBUG_WARN( "delete period energy record error message: %s\n", zErrMsg);
|
|
|
+ isSuccess = FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ return isSuccess;
|
|
|
+}
|
|
|
+
|
|
|
+int OCPP_getPeriodEnergyToDataTransfer(int32_t transactionId)
|
|
|
+{
|
|
|
+ int isSuccess = TRUE;
|
|
|
+ char sql[512];
|
|
|
+ char zErrMsg[200];
|
|
|
+ int rows, cols;
|
|
|
+ char **resultData;
|
|
|
+
|
|
|
+ sprintf(sql, "select * from ocpp_period_energy where transactionId=%d;", transactionId);
|
|
|
+
|
|
|
+ /* Execute SQL statement */
|
|
|
+ if( sqlite3_get_table(db, sql, &resultData, &rows, &cols, (char **)&zErrMsg) != SQLITE_OK)
|
|
|
+ {
|
|
|
+ DEBUG_WARN("SQL error: %s\n", zErrMsg);
|
|
|
+ isSuccess = FALSE;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if((rows > 0) && (atoi(resultData[4]) > 0))
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->DataTransfer[0].ResponseData, "%s", resultData[7]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DEBUG_WARN("There is not match transaction data.\n");
|
|
|
+ isSuccess = FALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return isSuccess;
|
|
|
+}
|
|
|
+
|
|
|
//==========================================
|
|
|
// Check time passed since today
|
|
|
//==========================================
|
|
@@ -4302,6 +4502,7 @@ void CheckSystemValue(void)
|
|
|
{
|
|
|
ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = 0;
|
|
|
sendStopTransactionRequest(gun_index);
|
|
|
+ OCPP_updatePeriodEnergy(gun_index);
|
|
|
if(ShmSysConfigAndInfo->SysConfig.TTIA_Info.isEnableTTIA && (gunType[gun_index] != GUN_TYPE_AC) )sendTTIAInfo(gun_index);
|
|
|
refreshStartTimer(&clientTime.StopTransaction);
|
|
|
memset(&ShmOCPP16Data->SessionTarget[gun_index], 0x00, sizeof(struct StructSessionTarget));
|
|
@@ -10026,183 +10227,6 @@ void createFirmwareVersionByDataTransfer(void)
|
|
|
json_object_put(FirmwareDataTransfer);
|
|
|
}
|
|
|
|
|
|
-int createPresetChargingedEnergyByDataTransfer(uint8_t gun_index, int transactionId)
|
|
|
-{
|
|
|
- int result = FAIL;
|
|
|
- int tempIndex;
|
|
|
- json_object *EnergyDataTransfer = json_object_new_object();
|
|
|
- json_object *periodEnergys = json_object_new_object();
|
|
|
-
|
|
|
- if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
|
|
|
- {
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
|
|
|
- {
|
|
|
- tempIndex = ((gun_index==2) ? 1: 0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- tempIndex = gun_index;
|
|
|
- }
|
|
|
-
|
|
|
- for (int index = 0; index < CHAdeMO_QUANTITY; index++)
|
|
|
- {
|
|
|
- if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex))
|
|
|
- {
|
|
|
- if(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId == transactionId)
|
|
|
- {
|
|
|
- json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(transactionId));
|
|
|
-
|
|
|
- for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].presentChargedEnergyPeriod);idxPeriod++)
|
|
|
- {
|
|
|
- uint8_t period[3];
|
|
|
- sprintf((char*)period, "%d", idxPeriod);
|
|
|
-
|
|
|
- json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].presentChargedEnergyPeriod[idxPeriod]));
|
|
|
- }
|
|
|
-
|
|
|
- json_object_object_add(EnergyDataTransfer, "periodEnergy", json_object_new_string(json_object_to_json_string_ext(periodEnergys, JSON_C_TO_STRING_PLAIN)));
|
|
|
-
|
|
|
- result = PASS;
|
|
|
- }
|
|
|
- } //end of the same index
|
|
|
- }//end of for CHAdeMO_QUANTITY
|
|
|
- }
|
|
|
- else if(gunType[gun_index] == GUN_TYPE_CCS)
|
|
|
- {
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
|
|
|
- {
|
|
|
- tempIndex = ((gun_index==2) ? 1: 0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- tempIndex = gun_index;
|
|
|
- }
|
|
|
-
|
|
|
- for (int index = 0; index < CCS_QUANTITY; index++)
|
|
|
- {
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
|
|
|
- {
|
|
|
- if(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId == transactionId)
|
|
|
- {
|
|
|
- json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(transactionId));
|
|
|
-
|
|
|
- for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].presentChargedEnergyPeriod);idxPeriod++)
|
|
|
- {
|
|
|
- uint8_t period[3];
|
|
|
- sprintf((char*)period, "%d", idxPeriod);
|
|
|
-
|
|
|
- json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].presentChargedEnergyPeriod[idxPeriod]));
|
|
|
- }
|
|
|
-
|
|
|
- json_object_object_add(EnergyDataTransfer, "periodEnergy", json_object_new_string(json_object_to_json_string_ext(periodEnergys, JSON_C_TO_STRING_PLAIN)));
|
|
|
-
|
|
|
- result = PASS;
|
|
|
- }
|
|
|
- } //end of the same index
|
|
|
- } // end of for CCS_QUANTITY
|
|
|
- }
|
|
|
- else if(gunType[gun_index] == GUN_TYPE_GBT)
|
|
|
- {
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
|
|
|
- {
|
|
|
- tempIndex = ((gun_index==2) ? 1: 0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- tempIndex = gun_index;
|
|
|
- }
|
|
|
-
|
|
|
- for (int index = 0; index < GB_QUANTITY; index++)
|
|
|
- {
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
|
|
|
- {
|
|
|
- if(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId == transactionId)
|
|
|
- {
|
|
|
- json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(transactionId));
|
|
|
-
|
|
|
- for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].presentChargedEnergyPeriod);idxPeriod++)
|
|
|
- {
|
|
|
- uint8_t period[3];
|
|
|
- sprintf((char*)period, "%d", idxPeriod);
|
|
|
-
|
|
|
- json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].presentChargedEnergyPeriod[idxPeriod]));
|
|
|
- }
|
|
|
-
|
|
|
- json_object_object_add(EnergyDataTransfer, "periodEnergy", json_object_new_string(json_object_to_json_string_ext(periodEnergys, JSON_C_TO_STRING_PLAIN)));
|
|
|
-
|
|
|
- result = PASS;
|
|
|
- }
|
|
|
- } //end of the same index
|
|
|
- } // end of for GB_QUANTITY
|
|
|
- }
|
|
|
- else if(gunType[gun_index] == GUN_TYPE_DO)
|
|
|
- {
|
|
|
- tempIndex = gun_index;
|
|
|
-
|
|
|
- for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
|
|
|
- {
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
|
|
|
- {
|
|
|
- if(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId == transactionId)
|
|
|
- {
|
|
|
- json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(transactionId));
|
|
|
-
|
|
|
- for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.presentChargedEnergyPeriod);idxPeriod++)
|
|
|
- {
|
|
|
- uint8_t period[3];
|
|
|
- sprintf((char*)period, "%d", idxPeriod);
|
|
|
-
|
|
|
- json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.presentChargedEnergyPeriod[idxPeriod]));
|
|
|
- }
|
|
|
-
|
|
|
- json_object_object_add(EnergyDataTransfer, "periodEnergy", json_object_new_string(json_object_to_json_string_ext(periodEnergys, JSON_C_TO_STRING_PLAIN)));
|
|
|
-
|
|
|
- result = PASS;
|
|
|
- }
|
|
|
- } //end of the same index
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
|
|
|
- {
|
|
|
- tempIndex = 2;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- tempIndex = gun_index;
|
|
|
- }
|
|
|
-
|
|
|
- for (int index = 0; index < AC_QUANTITY; index++)
|
|
|
- {
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
|
|
|
- {
|
|
|
- if(ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId == transactionId)
|
|
|
- {
|
|
|
- json_object_object_add(EnergyDataTransfer, "txId", json_object_new_int(transactionId));
|
|
|
-
|
|
|
- for(uint8_t idxPeriod=0;idxPeriod<ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].presentChargedEnergyPeriod);idxPeriod++)
|
|
|
- {
|
|
|
- uint8_t period[3];
|
|
|
- sprintf((char*)period, "%d", idxPeriod);
|
|
|
-
|
|
|
- json_object_object_add(periodEnergys, (const char *)period, json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].presentChargedEnergyPeriod[idxPeriod]));
|
|
|
- }
|
|
|
-
|
|
|
- json_object_object_add(EnergyDataTransfer, "periodEnergy", json_object_new_string(json_object_to_json_string_ext(periodEnergys, JSON_C_TO_STRING_PLAIN)));
|
|
|
-
|
|
|
- result = PASS;
|
|
|
- }
|
|
|
- }//end of the same index
|
|
|
- }//end of for AC_QUANTITY
|
|
|
- }
|
|
|
-
|
|
|
- sprintf((char*)ShmOCPP16Data->DataTransfer[0].ResponseData, json_object_to_json_string_ext(EnergyDataTransfer, JSON_C_TO_STRING_PLAIN));
|
|
|
- json_object_put(EnergyDataTransfer);
|
|
|
-
|
|
|
- return result;
|
|
|
-}
|
|
|
-
|
|
|
int handleDataTransferRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
mtrace();
|
|
@@ -10747,7 +10771,7 @@ int handleDataTransferRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if((json_object_object_get(data, "ConnectorId") != NULL) && (json_object_object_get(data, "txId") != NULL))
|
|
|
{
|
|
|
- if(createPresetChargingedEnergyByDataTransfer((json_object_get_int(json_object_object_get(data, "ConnectorId"))-1), json_object_get_int(json_object_object_get(data, "txId"))) == PASS)
|
|
|
+ if(OCPP_getPeriodEnergyToDataTransfer(json_object_get_int(json_object_object_get(data, "txId"))) == PASS)
|
|
|
{
|
|
|
json_object_object_add(response, "status", json_object_new_string("Accepted"));
|
|
|
json_object_object_add(response, "data", json_object_new_string((char*)ShmOCPP16Data->DataTransfer[0].ResponseData));
|
|
@@ -14818,7 +14842,6 @@ void handleBootNotificationResponse(char *payload, int gun_index)
|
|
|
|
|
|
ShmOCPP16Data->BootNotification.ResponseHeartbeatInterval = intervalInt;
|
|
|
BootNotificationInterval = intervalInt;
|
|
|
- HeartBeatWaitTime = intervalInt;
|
|
|
|
|
|
//write back to ShmOCPP16Data->BootNotification
|
|
|
strcpy((char *)ShmOCPP16Data->BootNotification.ResponseCurrentTime, currentTimeStr);
|
|
@@ -14827,9 +14850,16 @@ void handleBootNotificationResponse(char *payload, int gun_index)
|
|
|
|
|
|
if((strcmp(statusStr, RegistrationStatusStr[RegistrationStatus_Accepted]) == 0 ))
|
|
|
{
|
|
|
+
|
|
|
+ if((intervalInt == 0) || (intervalInt >= 10))
|
|
|
+ {
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[HeartbeatInterval].ItemData, "%d", intervalInt);
|
|
|
+ HeartBeatWaitTime = intervalInt;
|
|
|
+ DEBUG_INFO("BootNotificationResponse setting interval to %d...\n",intervalInt);
|
|
|
+ }
|
|
|
+
|
|
|
server_sign = TRUE;
|
|
|
server_pending =FALSE;
|
|
|
-
|
|
|
}
|
|
|
else if(strcmp(statusStr, RegistrationStatusStr[RegistrationStatus_Pending]) == 0)
|
|
|
{
|
|
@@ -20228,6 +20258,8 @@ void storeTempStopTransaction(int gun_index)
|
|
|
fputs("\n", outfile);
|
|
|
fclose (outfile);
|
|
|
system("/bin/fsync -d /dev/mtdblock13;/bin/sync &");
|
|
|
+
|
|
|
+ OCPP_updatePeriodEnergy(gun_index);
|
|
|
}
|
|
|
|
|
|
void checkTempStopTransaction(int gun_index)
|