#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*標準輸入輸出定義*/ #include /*標準函數庫定義*/ #include /*Unix 標準函數定義*/ #include /*檔控制定義*/ #include /*PPSIX 終端控制定義*/ #include /*錯誤號定義*/ #include #include #include #include #include #include "../../define.h" #include #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args) #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args) #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args) #define Debug #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0])) #define PASS 1 #define FAIL -1 #define SystemLogMessage struct SysConfigAndInfo *ShmSysConfigAndInfo; struct StatusCodeData *ShmStatusCodeData; void trim(char *s); int mystrcmp(char *p1, char *p2); void substr(char *dest, const char* src, unsigned int start, unsigned int cnt); void split(char **arr, char *str, const char *del); #ifdef SystemLogMessage int StoreLogMsg(const char *fmt, ...) { char Buf[4096 + 256]; char buffer[4096]; time_t CurrentTime; struct tm *tm; va_list args; va_start(args, fmt); int rc = vsnprintf(buffer, sizeof(buffer), fmt, args); va_end(args); memset(Buf, 0, sizeof(Buf)); CurrentTime = time(NULL); tm = localtime(&CurrentTime); sprintf(Buf, "echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, buffer, tm->tm_year + 1900, tm->tm_mon + 1); system(Buf); #ifdef Debug printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, buffer); #endif return rc; } #endif int DiffTimeb(struct timeb ST, struct timeb ET) { //return milli-second unsigned int StartTime, StopTime; StartTime = (unsigned int) ST.time; StopTime = (unsigned int) ET.time; return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm; } //================================= // Common routine //================================= void trim(char *s) { int i = 0, j, k, l = 0; while ((s[i] == ' ') || (s[i] == '\t') || (s[i] == '\n')) i++; j = strlen(s) - 1; while ((s[j] == ' ') || (s[j] == '\t') || (s[j] == '\n')) j--; if (i == 0 && j == strlen(s) - 1) { } else if (i == 0) s[j + 1] = '\0'; else { for (k = i; k <= j; k++) s[l++] = s[k]; s[l] = '\0'; } } int mystrcmp(char *p1, char *p2) { while (*p1 == *p2) { if (*p1 == '\0' || *p2 == '\0') break; p1++; p2++; } if (*p1 == '\0' && *p2 == '\0') return (PASS); else return (FAIL); } void substr(char *dest, const char* src, unsigned int start, unsigned int cnt) { strncpy(dest, src + start, cnt); dest[cnt] = 0; } void split(char **arr, char *str, const char *del) { char *s = strtok(str, del); while (s != NULL) { *arr++ = s; s = strtok(NULL, del); } } int ConnectorType(char* connector){ int* result; if(strcmp(connector, "0") == 0){ result= 0; } else if(strcmp(connector, "1") == 0 || strcmp(connector, "2") == 0 || strcmp(connector, "3") == 0 || strcmp(connector, "4") == 0 || strcmp(connector, "U") == 0 || strcmp(connector, "E") == 0){ result= 1;//CCS } else if(strcmp(connector, "5") == 0 || strcmp(connector, "6") == 0 || strcmp(connector, "G") == 0){ result= 2;//GB } else if(strcmp(connector, "J") == 0){ result= 3;//CHAdeMO } else{ } return result; } int ModelType(char* type,char* network){ int result=0; if(strcmp(type, "A") == 0){ if(strcmp(network, "0") == 0 || strcmp(network, "R") == 0 || strcmp(network, "B") == 0){ result=0; } else if(strcmp(network, "E") == 0 || strcmp(network, "W") == 0 || strcmp(network, "T") == 0 || strcmp(network, "U") == 0){ result=1; } } else if(strcmp(type, "D") == 0){ result=2; } return result; } //========================================== // Init all share memory //========================================== int InitShareMemory() { int result = PASS; int MeterSMId; //creat ShmSysConfigAndInfo if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0) { #ifdef SystemLogMessage DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n"); #endif result = FAIL; } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1) { #ifdef SystemLogMessage DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n"); #endif result = FAIL; } else { } //creat ShmStatusCodeData if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0) { #ifdef SystemLogMessage DEBUG_ERROR("shmget ShmStatusCodeData NG\n"); #endif result = FAIL; } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1) { #ifdef SystemLogMessage DEBUG_ERROR("shmat ShmStatusCodeData NG\n"); #endif result = FAIL; } else { } return result; } //================================================ // Main process //================================================ int main(int argc, char *argv[]) { if (InitShareMemory() == FAIL) { #ifdef SystemLogMessage DEBUG_ERROR("InitShareMemory NG\n"); #endif if (ShmStatusCodeData != NULL) { ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1; } sleep(5); return 0; } if(strcmp(argv[1], "log") == 0){ unsigned char SerialNo[64];; strcpy(SerialNo,ShmSysConfigAndInfo->SysConfig.SerialNumber); printf(SerialNo); int year,month,i,ty,tm,cnt; char ym[7] ; char pwd[70]; char cmd[100]; time_t tt = time(0); //獲取當前時間 struct tm *pst = localtime(&tt); //把time_t類型轉換為struct tm類型 year = pst->tm_year + 1900; month = pst->tm_mon + 1; if(argc == 3 & isdigit(*argv[2])){ cnt=argv[2]; } else{ cnt=6; } // printf("The year is %d.\n", year ); //別忘了要加1900 // printf("The month is %d.\n", month ); //別忘了要加1 for(i=0;iAlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1; } sleep(5); return 0; } if (argc == 3) { struct SysConfigData SysConfig; int fd, wrd; unsigned int Chk; unsigned char *ptr; ptr=malloc(sizeof(struct SysConfigData)); if(ptr==NULL) { #ifdef SystemLogMessage DEBUG_ERROR("malloc for SysConfigData NG"); #endif return 0; } memset(ptr,0,sizeof(struct SysConfigData)); memset(&SysConfig,0,sizeof(struct SysConfigData)); if (strcmp(argv[1], "1") == 0) { struct json_object *jobj = json_tokener_parse(argv[2]); struct json_object *SystemId = json_object_object_get(jobj, "SystemId"); struct json_object *SystemDateTime = json_object_object_get(jobj,"SystemDateTime"); struct json_object *FactoryConfiguration = json_object_object_get(jobj, "FactoryConfiguration"); struct json_object *AuthorisationMode = json_object_object_get(jobj,"AuthorisationMode"); struct json_object *DefaultLanguage = json_object_object_get(jobj,"DefaultLanguage"); struct json_object *RfidCardNumEndian = json_object_object_get(jobj,"RfidCardNumEndian"); sprintf(ShmSysConfigAndInfo->SysConfig.SystemId,json_object_get_string(SystemId)); sprintf(ShmSysConfigAndInfo->SysConfig.SystemDateTime,json_object_get_string(SystemDateTime)); sprintf(&ShmSysConfigAndInfo->SysInfo.FactoryConfiguration,json_object_get_string(FactoryConfiguration)); sprintf(&ShmSysConfigAndInfo->SysConfig.AuthorisationMode,json_object_get_string(AuthorisationMode)); sprintf(&ShmSysConfigAndInfo->SysConfig.DefaultLanguage,json_object_get_string(DefaultLanguage)); sprintf(&ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian,json_object_get_string(RfidCardNumEndian)); //Set default configuration //strcpy(SysConfig.SystemId, "11111111111111"); //strcpy(SysConfig.SystemDateTime, "2020-01-01 00:00:00"); strcpy(SysConfig.SystemId, json_object_get_string(SystemId)); strcpy(SysConfig.SystemDateTime, json_object_get_string(SystemDateTime)); strcpy(&SysConfig.AuthorisationMode, json_object_get_string(AuthorisationMode)); strcpy(&SysConfig.DefaultLanguage, json_object_get_string(DefaultLanguage)); strcpy(&SysConfig.RfidCardNumEndian,json_object_get_string(RfidCardNumEndian)); } if (strcmp(argv[1], "2") == 0) { struct json_object *jobj = json_tokener_parse(argv[2]); struct json_object *MaxChargingEnergy = json_object_object_get(jobj,"MaxChargingEnergy"); struct json_object *MaxChargingPower = json_object_object_get(jobj,"MaxChargingPower"); struct json_object *MaxChargingCurrent = json_object_object_get(jobj, "MaxChargingCurrent"); struct json_object *MaxChargingDuration = json_object_object_get(jobj,"MaxChargingDuration"); struct json_object *PhaseLossPolicy = json_object_object_get(jobj,"PhaseLossPolicy"); struct json_object *LocalWhiteCard0 = json_object_object_get(jobj,"LocalWhiteCard0"); struct json_object *LocalWhiteCard1 = json_object_object_get(jobj,"LocalWhiteCard1"); struct json_object *LocalWhiteCard2 = json_object_object_get(jobj,"LocalWhiteCard2"); struct json_object *LocalWhiteCard3 = json_object_object_get(jobj,"LocalWhiteCard3"); struct json_object *LocalWhiteCard4 = json_object_object_get(jobj,"LocalWhiteCard4"); struct json_object *LocalWhiteCard5 = json_object_object_get(jobj,"LocalWhiteCard5"); struct json_object *LocalWhiteCard6 = json_object_object_get(jobj,"LocalWhiteCard6"); struct json_object *LocalWhiteCard7 = json_object_object_get(jobj,"LocalWhiteCard7"); struct json_object *LocalWhiteCard8 = json_object_object_get(jobj,"LocalWhiteCard8"); struct json_object *LocalWhiteCard9 = json_object_object_get(jobj,"LocalWhiteCard9"); struct json_object *UserId = json_object_object_get(jobj,"UserId"); ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy=json_object_get_int(MaxChargingEnergy); ShmSysConfigAndInfo->SysConfig.MaxChargingPower=json_object_get_int(MaxChargingPower); ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent=json_object_get_int(MaxChargingCurrent); ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=json_object_get_int(MaxChargingDuration); sprintf(&ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy,json_object_get_string(PhaseLossPolicy)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0],json_object_get_string(LocalWhiteCard0)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1],json_object_get_string(LocalWhiteCard1)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2],json_object_get_string(LocalWhiteCard2)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3],json_object_get_string(LocalWhiteCard3)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4],json_object_get_string(LocalWhiteCard4)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5],json_object_get_string(LocalWhiteCard5)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6],json_object_get_string(LocalWhiteCard6)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7],json_object_get_string(LocalWhiteCard7)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8],json_object_get_string(LocalWhiteCard8)); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9],json_object_get_string(LocalWhiteCard9)); sprintf(&ShmSysConfigAndInfo->SysConfig.UserId,json_object_get_string(UserId)); //Set default configuration SysConfig.MaxChargingEnergy=json_object_get_int(MaxChargingEnergy); SysConfig.MaxChargingPower=json_object_get_int(MaxChargingPower); SysConfig.MaxChargingCurrent=json_object_get_int(MaxChargingCurrent); SysConfig.MaxChargingDuration=json_object_get_int(MaxChargingDuration); strcpy(&SysConfig.PhaseLossPolicy, json_object_get_string(PhaseLossPolicy)); strcpy(SysConfig.LocalWhiteCard[0],json_object_get_string(LocalWhiteCard0)); strcpy(SysConfig.LocalWhiteCard[1],json_object_get_string(LocalWhiteCard1)); strcpy(SysConfig.LocalWhiteCard[2],json_object_get_string(LocalWhiteCard2)); strcpy(SysConfig.LocalWhiteCard[3],json_object_get_string(LocalWhiteCard3)); strcpy(SysConfig.LocalWhiteCard[4],json_object_get_string(LocalWhiteCard4)); strcpy(SysConfig.LocalWhiteCard[5],json_object_get_string(LocalWhiteCard5)); strcpy(SysConfig.LocalWhiteCard[6],json_object_get_string(LocalWhiteCard6)); strcpy(SysConfig.LocalWhiteCard[7],json_object_get_string(LocalWhiteCard7)); strcpy(SysConfig.LocalWhiteCard[8],json_object_get_string(LocalWhiteCard8)); strcpy(SysConfig.LocalWhiteCard[9],json_object_get_string(LocalWhiteCard9)); strcpy(SysConfig.UserId,json_object_get_string(UserId)); } if (strcmp(argv[1], "3") == 0) { struct json_object *jobj = json_tokener_parse(argv[2]); struct json_object *FtpServer = json_object_object_get(jobj,"FtpServer"); struct json_object *Eth0DhcpClient = json_object_object_get(jobj,"Eth0DhcpClient"); struct json_object *Eth0IpAddress = json_object_object_get(jobj, "Eth0IpAddress"); struct json_object *Eth0SubmaskAddress = json_object_object_get(jobj,"Eth0SubmaskAddress"); struct json_object *Eth0GatewayAddress = json_object_object_get(jobj,"Eth0GatewayAddress"); struct json_object *Eth1DhcpClient = json_object_object_get(jobj,"Eth1DhcpClient"); struct json_object *Eth1IpAddress = json_object_object_get(jobj, "Eth1IpAddress"); struct json_object *Eth1SubmaskAddress = json_object_object_get(jobj,"Eth1SubmaskAddress"); struct json_object *Eth1GatewayAddress = json_object_object_get(jobj,"Eth1GatewayAddress"); struct json_object *WifiMode = json_object_object_get(jobj,"WifiMode"); struct json_object *WifiSsid = json_object_object_get(jobj,"WifiSsid"); struct json_object *WifiPassword = json_object_object_get(jobj,"WifiPassword"); struct json_object *WifiDhcpServer = json_object_object_get(jobj,"WifiDhcpServer"); struct json_object *WifiDhcpClient = json_object_object_get(jobj,"WifiDhcpClient"); struct json_object *WifiIpAddress = json_object_object_get(jobj,"WifiIpAddress"); struct json_object *WifiSubmaskAddress = json_object_object_get(jobj,"WifiSubmaskAddress"); struct json_object *WifiGatewayAddress = json_object_object_get(jobj,"WifiGatewayAddress"); struct json_object *TelcomApn = json_object_object_get(jobj,"TelcomApn"); struct json_object *TelcomChapPapId = json_object_object_get(jobj,"TelcomChapPapId"); struct json_object *TelcomChapPapPwd = json_object_object_get(jobj,"TelcomChapPapPwd"); struct json_object *TelcomIpAddress = json_object_object_get(jobj,"TelcomIpAddress"); sprintf(&ShmSysConfigAndInfo->SysConfig.FtpServer,json_object_get_string(FtpServer)); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient,json_object_get_string(Eth0DhcpClient)); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,json_object_get_string(Eth0IpAddress)); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,json_object_get_string(Eth0SubmaskAddress)); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,json_object_get_string(Eth0GatewayAddress)); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient,json_object_get_string(Eth1DhcpClient)); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,json_object_get_string(Eth1IpAddress)); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,json_object_get_string(Eth1SubmaskAddress)); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,json_object_get_string(Eth1GatewayAddress)); sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient,json_object_get_string(WifiDhcpClient)); sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,json_object_get_string(WifiSsid)); sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,json_object_get_string(WifiPassword)); sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer,json_object_get_string(WifiDhcpServer)); sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,json_object_get_string(WifiIpAddress)); sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,json_object_get_string(WifiSubmaskAddress)); sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,json_object_get_string(WifiGatewayAddress)); sprintf(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,json_object_get_string(TelcomApn)); sprintf(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,json_object_get_string(TelcomChapPapId)); sprintf(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,json_object_get_string(TelcomChapPapPwd)); sprintf(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,json_object_get_string(TelcomIpAddress)); //Set default configuration strcpy(SysConfig.FtpServer, json_object_get_string(FtpServer)); strcpy(&SysConfig.Eth0Interface.EthDhcpClient, json_object_get_string(Eth0DhcpClient)); strcpy(SysConfig.Eth0Interface.EthIpAddress, json_object_get_string(Eth0IpAddress)); strcpy(SysConfig.Eth0Interface.EthSubmaskAddress, json_object_get_string(Eth0SubmaskAddress)); strcpy(SysConfig.Eth0Interface.EthGatewayAddress, json_object_get_string(Eth0GatewayAddress)); strcpy(&SysConfig.Eth1Interface.EthDhcpClient, json_object_get_string(Eth1DhcpClient)); strcpy(SysConfig.Eth1Interface.EthIpAddress, json_object_get_string(Eth1IpAddress)); strcpy(SysConfig.Eth1Interface.EthSubmaskAddress, json_object_get_string(Eth1SubmaskAddress)); strcpy(SysConfig.Eth1Interface.EthGatewayAddress, json_object_get_string(Eth1GatewayAddress)); strcpy(&SysConfig.AthInterface.WifiDhcpClient, json_object_get_string(WifiDhcpClient)); strcpy(SysConfig.AthInterface.WifiSsid, json_object_get_string(WifiSsid)); strcpy(SysConfig.AthInterface.WifiPassword, json_object_get_string(WifiPassword)); strcpy(&SysConfig.AthInterface.WifiDhcpServer, json_object_get_string(WifiDhcpServer)); strcpy(SysConfig.AthInterface.WifiIpAddress, json_object_get_string(WifiIpAddress)); strcpy(SysConfig.AthInterface.WifiSubmaskAddress, json_object_get_string(WifiSubmaskAddress)); strcpy(SysConfig.AthInterface.WifiGatewayAddress, json_object_get_string(WifiGatewayAddress)); strcpy(SysConfig.TelecomInterface.TelcomApn, json_object_get_string(TelcomApn)); strcpy(SysConfig.TelecomInterface.TelcomChapPapId, json_object_get_string(TelcomChapPapId)); strcpy(SysConfig.TelecomInterface.TelcomChapPapPwd, json_object_get_string(TelcomChapPapPwd)); strcpy(SysConfig.TelecomInterface.TelcomIpAddress, json_object_get_string(TelcomIpAddress)); } if (strcmp(argv[1], "4") == 0) { struct json_object *jobj = json_tokener_parse(argv[2]); struct json_object *BackendConnTimeout = json_object_object_get(jobj,"BackendConnTimeout"); struct json_object *OfflinePolicy = json_object_object_get(jobj,"OfflinePolicy"); struct json_object *OfflineMaxChargeEnergy = json_object_object_get(jobj, "OfflineMaxChargeEnergy"); struct json_object *OfflineMaxChargeDuration = json_object_object_get(jobj,"OfflineMaxChargeDuration"); struct json_object *OcppServerURL = json_object_object_get(jobj,"OcppServerURL"); struct json_object *ChargeBoxId = json_object_object_get(jobj,"ChargeBoxId"); ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=json_object_get_int(BackendConnTimeout); sprintf(&ShmSysConfigAndInfo->SysConfig.OfflinePolicy,json_object_get_string(OfflinePolicy)); ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy=json_object_get_int(OfflineMaxChargeEnergy); ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration=json_object_get_int(OfflineMaxChargeDuration); sprintf(&ShmSysConfigAndInfo->SysConfig.OcppServerURL,json_object_get_string(OcppServerURL)); sprintf(&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,json_object_get_string(ChargeBoxId)); //Set default configuration SysConfig.BackendConnTimeout=json_object_get_int(BackendConnTimeout); strcpy(&SysConfig.OfflinePolicy,json_object_get_string(OfflinePolicy)); SysConfig.OfflineMaxChargeEnergy=json_object_get_int(OfflineMaxChargeEnergy); SysConfig.OfflineMaxChargeDuration=json_object_get_int(OfflineMaxChargeDuration); strcpy(SysConfig.OcppServerURL,json_object_get_string(OcppServerURL)); strcpy(SysConfig.ChargeBoxId,json_object_get_string(ChargeBoxId)); } StoreUsrConfigData(&SysConfig); #ifdef SystemLogMessage DEBUG_INFO("WebServiceConfig OK"); #endif } if (argc == 2) { //init share memory struct SysConfigData SysConfig; //system sprintf(ShmSysConfigAndInfo->SysConfig.ModelName, "DWLU700111W1PH"); sprintf(ShmSysConfigAndInfo->SysConfig.SerialNumber, "SerialNumber"); sprintf(ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890"); sprintf(ShmSysConfigAndInfo->SysConfig.SystemDateTime, "SystemDateTime"); sprintf(&ShmSysConfigAndInfo->SysInfo.FactoryConfiguration, "1"); sprintf(&ShmSysConfigAndInfo->SysConfig.AuthorisationMode, "1"); sprintf(&ShmSysConfigAndInfo->SysConfig.DefaultLanguage, "a"); ShmSysConfigAndInfo->SysInfo.InputVoltageR=0; ShmSysConfigAndInfo->SysInfo.InputVoltageS=0; ShmSysConfigAndInfo->SysInfo.InputVoltageT=0; ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed=0; ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0; sprintf(&ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian, "0"); sprintf(&ShmSysConfigAndInfo->SysInfo.AuxPower5V, "0"); sprintf(&ShmSysConfigAndInfo->SysInfo.AuxPower12V, "0"); sprintf(&ShmSysConfigAndInfo->SysInfo.AuxPower24V, "0"); sprintf(&ShmSysConfigAndInfo->SysInfo.AuxPower48V, "0"); sprintf(ShmSysConfigAndInfo->SysInfo.CsuHwRev, "CsuHwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, "CsuBootLoadFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "CsuKernelFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "CsuRootFsFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, "CsuPrimFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.LcmHwRev, "LcmHwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.LcmFwRev, "LcmFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.PsuHwRev, "PsuHwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev, "PsuPrimFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.PsuSecFwRev, "PsuSecFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev, "AuxPwrHwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev, "AuxPwrFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.FanModuleHwRev, "FanModuleHwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, "FanModuleFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev, "RelayModuleHwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, "RelayModuleFwRev"); sprintf(ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev, "TelcomModemFwRev"); ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp=0; ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp=0; ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp=0; ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp=0; ShmSysConfigAndInfo->SysConfig.AcPlugInTimes=0; ShmSysConfigAndInfo->SysConfig.GbPlugInTimes=0; ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime=0; ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes=0; ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes=0; //Set default configuration //strcpy(SysConfig->ModelName) // strcpy(SysConfig->SystemId, ShmSysConfigAndInfo->SysConfig.SystemId); // strcpy(SysConfig->SystemDateTime, ShmSysConfigAndInfo->SysConfig.SystemDateTime); strcpy(SysConfig.SystemId, "0987654321"); strcpy(SysConfig.SystemDateTime, "2019-08-12 00:00:00"); //charging ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy=0; ShmSysConfigAndInfo->SysConfig.MaxChargingPower=0; ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0; ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0; sprintf(&ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy, "1"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3], "444"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4], "555"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5], "666"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6], "777"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7], "888"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8], "999"); sprintf(&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9], "aaa"); sprintf(ShmSysConfigAndInfo->SysConfig.UserId, "UserId"); ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage=(float) 64; ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent=(double) 6553.5; ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingPower=0; ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedEnergy=0; ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedDuration=0; ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].RemainChargingDuration=0; ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatteryMaxVoltage=0; ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetVoltage=0; ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterySoc=0; sprintf(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus, "1"); sprintf(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Index, "1"); sprintf(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Type, "0"); sprintf(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].type_index, "1"); sprintf(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetCurrent, "1"); //network sprintf(&ShmSysConfigAndInfo->SysInfo.InternetConn,"1"); sprintf(ShmSysConfigAndInfo->SysConfig.FtpServer,"FtpServer"); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient,"1"); sprintf(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress,"EthMacAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,"EthIpAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,"EthIpAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,"EthGatewayAddress"); sprintf(&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient,"1"); sprintf(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress,"EthMacAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,"EthIpAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,"EthSubmaskAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,"EthGatewayAddress"); sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode,"1"); sprintf(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,"WifiSsid"); sprintf(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,"WifiSsid"); ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi=0; sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer,"1"); sprintf(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient,"1"); sprintf(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress,"WifiMacAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,"WifiIpAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,"WifiSubmaskAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,"WifiGatewayAddress"); sprintf(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,"TelcomApn"); ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi=0; sprintf(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,"TelcomChapPapId"); sprintf(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,"TelcomChapPapPwd"); sprintf(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei,"TelcomModemImei"); sprintf(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi,"TelcomSimImsi"); sprintf(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid,"TelcomSimIccid"); sprintf(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus,"1"); sprintf(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode,"1"); sprintf(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,"TelcomIpAddress"); //backend ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=0; sprintf(&ShmSysConfigAndInfo->SysConfig.OfflinePolicy,"1"); ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy=0; ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration=0; sprintf(&ShmSysConfigAndInfo->SysInfo.OcppConnStatus,"1"); sprintf(ShmSysConfigAndInfo->SysConfig.OcppServerURL,"OcppServerURL"); sprintf(ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"ChargeBoxId"); StoreUsrConfigData(&SysConfig); #ifdef SystemLogMessage DEBUG_INFO("WebService OK"); #endif } if (argc == 1) { char *IsAcDc[2]; char *Connector1[2]; char *Connector2[2]; char *Connector3[2]; char *Network[2]; substr(IsAcDc,ShmSysConfigAndInfo->SysConfig.ModelName,0,1); substr(Connector1,ShmSysConfigAndInfo->SysConfig.ModelName,7,1); substr(Connector2,ShmSysConfigAndInfo->SysConfig.ModelName,8,1); substr(Connector3,ShmSysConfigAndInfo->SysConfig.ModelName,9,1); substr(Network,ShmSysConfigAndInfo->SysConfig.ModelName,10,1); int connectorType1,connectorType2,connectorType3,modelType; connectorType1=ConnectorType(Connector1); connectorType2=ConnectorType(Connector2); connectorType3=ConnectorType(Connector3); modelType=ModelType(IsAcDc,Network); // printf("connectorType1:%d\n",connectorType1); // printf("connectorType2:%d\n",connectorType2); // printf("connectorType3:%d\n",connectorType3); // printf("modelType:%d\n",modelType); struct json_object *jobj1; struct json_object *jobj2; struct json_object *jobj3; struct json_object *jobj4; struct json_object *array_obj; //system struct json_object *ModelName; struct json_object *SerialNumber; struct json_object *SystemId; struct json_object *SystemDateTime; struct json_object *FactoryConfiguration; struct json_object *AuthorisationMode; struct json_object *DefaultLanguage; struct json_object *InputVoltageR; struct json_object *InputVoltageS; struct json_object *InputVoltageT; struct json_object *SystemFanRotaSpeed; struct json_object *PsuFanRotaSpeed; struct json_object *RfidCardNumEndian; struct json_object *AuxPower5V; struct json_object *AuxPower12V; struct json_object *AuxPower24V; struct json_object *AuxPower48V; struct json_object *CsuHwRev; struct json_object *CsuBootLoadFwRev; struct json_object *CsuKernelFwRev; struct json_object *CsuRootFsFwRev; struct json_object *CsuPrimFwRev; struct json_object *LcmHwRev; struct json_object *LcmFwRev; struct json_object *PsuHwRev; struct json_object *PsuPrimFwRev; struct json_object *PsuSecFwRev; struct json_object *AuxPwrHwRev; struct json_object *AuxPwrFwRev; struct json_object *FanModuleHwRev; struct json_object *FanModuleFwRev; struct json_object *RelayModuleHwRev; struct json_object *RelayModuleFwRev; struct json_object *TelcomModemFwRev; struct json_object *SystemAmbientTemp; struct json_object *SystemCriticalTemp; struct json_object *CcsConnectorTemp; struct json_object *PsuAmbientTemp; struct json_object *AcPlugInTimes; struct json_object *GbPlugInTimes; struct json_object *Ccs1PlugInTime; struct json_object *Ccs2PlugInTimes; struct json_object *ChademoPlugInTimes; //charging struct json_object *MaxChargingEnergy; struct json_object *MaxChargingPower; struct json_object *MaxChargingCurrent; struct json_object *MaxChargingDuration; struct json_object *PhaseLossPolicy; struct json_object *LocalWhiteCard[10]; struct json_object *LocalWhiteCardArr= json_object_new_array(); struct json_object *CcsAuthentication; struct json_object *AcCcsChargingMode; struct json_object *UserId; struct json_object *ChargingInfo1; struct json_object *ChargingInfo2; struct json_object *ChargingInfo3; struct json_object *PresentChargingVoltage[3]; struct json_object *PresentChargingCurrent[3]; struct json_object *PresentChargingPower[3]; struct json_object *PresentChargedEnergy[3]; struct json_object *PresentChargedDuration[3]; struct json_object *RemainChargingDuration[3]; struct json_object *EvBatteryMaxVoltage[3]; struct json_object *EvBatterytargetVoltage[3]; struct json_object *EvBatterySoc[3]; struct json_object *SystemStatus[3]; struct json_object *Index[3]; struct json_object *Type[3]; struct json_object *type_index[3]; struct json_object *EvBatterytargetCurrent[3]; //network struct json_object *InternetConn; struct json_object *FtpServer; struct json_object *Eth0DhcpClient; struct json_object *Eth0MacAddress; struct json_object *Eth0IpAddress; struct json_object *Eth0SubmaskAddress; struct json_object *Eth0GatewayAddress; struct json_object *Eth1DhcpClient; struct json_object *Eth1MacAddress; struct json_object *Eth1IpAddress; struct json_object *Eth1SubmaskAddress; struct json_object *Eth1GatewayAddress; struct json_object *WifiMode; struct json_object *WifiSsid; struct json_object *WifiPassword; struct json_object *WifiRssi; struct json_object *WifiDhcpServer; struct json_object *WifiDhcpClient; struct json_object *WifiMacAddress; struct json_object *WifiIpAddress; struct json_object *WifiSubmaskAddress; struct json_object *WifiGatewayAddress; struct json_object *TelcomApn; struct json_object *TelcomRssi; struct json_object *TelcomChapPapId; struct json_object *TelcomChapPapPwd; struct json_object *TelcomModemImei; struct json_object *TelcomSimImsi; struct json_object *TelcomSimIccid; struct json_object *TelcomSimStatus; struct json_object *TelcomModemMode; struct json_object *TelcomIpAddress; //backend struct json_object *BackendConnTimeout; struct json_object *OfflinePolicy; struct json_object *OfflineMaxChargeEnergy; struct json_object *OfflineMaxChargeDuration; struct json_object *OcppConnStatus; struct json_object *OcppServerURL; struct json_object *ChargeBoxId; array_obj = json_object_new_array(); jobj1=json_object_new_object(); jobj2=json_object_new_object(); jobj3=json_object_new_object(); jobj4=json_object_new_object(); //system ModelName = json_object_new_string(&ShmSysConfigAndInfo->SysConfig.ModelName); SerialNumber = json_object_new_string(&ShmSysConfigAndInfo->SysConfig.SerialNumber); SystemId = json_object_new_string(&ShmSysConfigAndInfo->SysConfig.SystemId); SystemDateTime = json_object_new_string(ShmSysConfigAndInfo->SysConfig.SystemDateTime); FactoryConfiguration = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.FactoryConfiguration,1); AuthorisationMode = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.AuthorisationMode,1); DefaultLanguage = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.DefaultLanguage,1); InputVoltageR = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageR); InputVoltageS = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageS); InputVoltageT = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageT); SystemFanRotaSpeed = json_object_new_int((int)ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed); PsuFanRotaSpeed = json_object_new_int((int)ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed); RfidCardNumEndian = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian,1); AuxPower5V = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.AuxPower5V,1); AuxPower12V = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.AuxPower12V,1); AuxPower24V = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.AuxPower24V,1); AuxPower48V = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.AuxPower48V,1); CsuHwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.CsuHwRev); CsuBootLoadFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev); CsuKernelFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev); CsuRootFsFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev); CsuPrimFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev); LcmHwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.LcmHwRev); LcmFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.LcmFwRev); PsuHwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.PsuHwRev); PsuPrimFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev); PsuSecFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev); AuxPwrHwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev); AuxPwrFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev); FanModuleHwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev); FanModuleFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev); RelayModuleHwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev); RelayModuleFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev); TelcomModemFwRev = json_object_new_string(&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev); SystemAmbientTemp = json_object_new_int((int)ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp); SystemCriticalTemp = json_object_new_int((int)ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp); CcsConnectorTemp = json_object_new_int((int)ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp); PsuAmbientTemp = json_object_new_int((int)ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp); AcPlugInTimes = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.AcPlugInTimes); GbPlugInTimes = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.GbPlugInTimes); Ccs1PlugInTime = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime); Ccs2PlugInTimes = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes); ChademoPlugInTimes = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes); //charging int CcsGunQty=0; int GbGunQty=0; int CHAdeMOGunQty=0; ChargingInfo1=json_object_new_object(); ChargingInfo2=json_object_new_object(); ChargingInfo3=json_object_new_object(); MaxChargingEnergy = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy); MaxChargingPower = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.MaxChargingPower); MaxChargingCurrent = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent); MaxChargingDuration = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.MaxChargingDuration); PhaseLossPolicy = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy,1); LocalWhiteCard[0] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]); LocalWhiteCard[1] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]); LocalWhiteCard[2] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]); LocalWhiteCard[3] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3]); LocalWhiteCard[4] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4]); LocalWhiteCard[5] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5]); LocalWhiteCard[6] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6]); LocalWhiteCard[7] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7]); LocalWhiteCard[8] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8]); LocalWhiteCard[9] = json_object_new_string(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9]); UserId = json_object_new_string(&ShmSysConfigAndInfo->SysConfig.UserId); if(connectorType1 != 0){ if(connectorType1 == 1){//CCS PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage); PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent); PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower); PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy); PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration); RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration); EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage); EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage); EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc); SystemStatus[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus,1); Index[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index,1); Type[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type,1); type_index[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index,1); EvBatterytargetCurrent[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent,1); CcsGunQty++; } else if(connectorType1 == 2){//GB PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage); PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent); PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower); PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy); PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration); RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration); EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage); EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage); EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc); SystemStatus[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].SystemStatus,1); Index[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].Index,1); Type[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].Type,1); type_index[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].type_index,1); EvBatterytargetCurrent[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].EvBatterytargetCurrent,1); GbGunQty++; } else if(connectorType1 == 3){//CHAdeMO PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage); PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent); PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower); PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy); PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration); RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration); EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage); EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage); EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc); SystemStatus[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].SystemStatus,1); Index[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].Index,1); Type[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].Type,1); type_index[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].type_index,1); EvBatterytargetCurrent[0] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].EvBatterytargetCurrent,1); CHAdeMOGunQty++; } } if(connectorType2 != 0){ if(connectorType2 == 1){//CCS PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage); PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent); PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower); PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy); PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration); RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration); EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage); EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage); EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc); SystemStatus[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus,1); Index[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index,1); Type[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type,1); type_index[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index,1); EvBatterytargetCurrent[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent,1); CcsGunQty++; } else if(connectorType2 == 2){//GB PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage); PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent); PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower); PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy); PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration); RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration); EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage); EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage); EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc); SystemStatus[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].SystemStatus,1); Index[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].Index,1); Type[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].Type,1); type_index[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].type_index,1); EvBatterytargetCurrent[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].EvBatterytargetCurrent,1); GbGunQty++; } else if(connectorType2 == 3){//CHAdeMO PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage); PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent); PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower); PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy); PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration); RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration); EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage); EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage); EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc); SystemStatus[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].SystemStatus,1); Index[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].Index,1); Type[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].Type,1); type_index[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].type_index,1); EvBatterytargetCurrent[1] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].EvBatterytargetCurrent,1); CHAdeMOGunQty++; } } if(connectorType3 != 0){ if(connectorType3 == 1){//CCS PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage); PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent); PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower); PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy); PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration); RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration); EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage); EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage); EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc); SystemStatus[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus,1); Index[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index,1); Type[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type,1); type_index[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index,1); EvBatterytargetCurrent[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent,1); CcsGunQty++; } else if(connectorType3 == 2){//GB PresentChargingVoltage[2]= json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage); PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent); PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower); PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy); PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration); RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration); EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage); EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage); EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc); SystemStatus[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].SystemStatus,1); Index[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].Index,1); Type[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].Type,1); type_index[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].type_index,1); EvBatterytargetCurrent[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[GbGunQty].EvBatterytargetCurrent,1); GbGunQty++; } else if(connectorType3 == 3){//CHAdeMO PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage); PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent); PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower); PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy); PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration); RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration); EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage); EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage); EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc); SystemStatus[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].SystemStatus,1); Index[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].Index,1); Type[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].Type,1); type_index[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].type_index,1); EvBatterytargetCurrent[2] = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CHAdeMOGunQty].EvBatterytargetCurrent,1); CHAdeMOGunQty++; } } //network InternetConn = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.InternetConn,1); FtpServer = json_object_new_string(&ShmSysConfigAndInfo->SysConfig.FtpServer); Eth0DhcpClient = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient,1); Eth0MacAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress); Eth0IpAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress); Eth0SubmaskAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress); Eth0GatewayAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress); Eth1DhcpClient = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient,1); Eth1MacAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress); Eth1IpAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress); Eth1SubmaskAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress); Eth1GatewayAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress); WifiMode = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode,1); WifiSsid = json_object_new_string(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid); WifiPassword = json_object_new_string(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword); WifiRssi = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi); WifiDhcpServer = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer,1); WifiDhcpClient = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient,1); WifiMacAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress); WifiIpAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress); WifiSubmaskAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress); WifiGatewayAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress); TelcomApn = json_object_new_string(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn); TelcomRssi = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi); TelcomChapPapId = json_object_new_string(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId); TelcomChapPapPwd = json_object_new_string(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd); TelcomModemImei = json_object_new_string(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei); TelcomSimImsi = json_object_new_string(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi); TelcomSimIccid = json_object_new_string(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid); TelcomSimStatus = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus,1); TelcomModemMode = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode,1); TelcomIpAddress = json_object_new_string(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress); //backend BackendConnTimeout = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.BackendConnTimeout); OfflinePolicy = json_object_new_string_len(&ShmSysConfigAndInfo->SysConfig.OfflinePolicy,1); OfflineMaxChargeEnergy = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy); OfflineMaxChargeDuration = json_object_new_int((int)ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration); OcppConnStatus = json_object_new_string_len(&ShmSysConfigAndInfo->SysInfo.OcppConnStatus,1); OcppServerURL = json_object_new_string(ShmSysConfigAndInfo->SysConfig.OcppServerURL); ChargeBoxId = json_object_new_string(ShmSysConfigAndInfo->SysConfig.ChargeBoxId); //system json_object_object_add(jobj1,"ModelName",ModelName); json_object_object_add(jobj1,"SerialNumber",SerialNumber); json_object_object_add(jobj1,"SystemId",SystemId); json_object_object_add(jobj1,"SystemDateTime",SystemDateTime); json_object_object_add(jobj1,"FactoryConfiguration",FactoryConfiguration); json_object_object_add(jobj1,"AuthorisationMode",AuthorisationMode); json_object_object_add(jobj1,"DefaultLanguage",DefaultLanguage); json_object_object_add(jobj1,"InputVoltageR",InputVoltageR); json_object_object_add(jobj1,"InputVoltageS",InputVoltageS); json_object_object_add(jobj1,"InputVoltageT",InputVoltageT); json_object_object_add(jobj1,"SystemFanRotaSpeed",SystemFanRotaSpeed); json_object_object_add(jobj1,"PsuFanRotaSpeed",PsuFanRotaSpeed); json_object_object_add(jobj1,"RfidCardNumEndian",RfidCardNumEndian); json_object_object_add(jobj1,"AuxPower5V",AuxPower5V); json_object_object_add(jobj1,"AuxPower12V",AuxPower12V); json_object_object_add(jobj1,"AuxPower24V",AuxPower24V); json_object_object_add(jobj1,"AuxPower48V",AuxPower48V); json_object_object_add(jobj1,"CsuHwRev",CsuHwRev); json_object_object_add(jobj1,"CsuBootLoadFwRev",CsuBootLoadFwRev); json_object_object_add(jobj1,"CsuKernelFwRev",CsuKernelFwRev); json_object_object_add(jobj1,"CsuRootFsFwRev",CsuRootFsFwRev); json_object_object_add(jobj1,"CsuPrimFwRev",CsuPrimFwRev); json_object_object_add(jobj1,"LcmHwRev",LcmHwRev); json_object_object_add(jobj1,"LcmFwRev",LcmFwRev); json_object_object_add(jobj1,"PsuHwRev",PsuHwRev); json_object_object_add(jobj1,"PsuPrimFwRev",PsuPrimFwRev); json_object_object_add(jobj1,"PsuSecFwRev",PsuSecFwRev); json_object_object_add(jobj1,"AuxPwrHwRev",AuxPwrHwRev); json_object_object_add(jobj1,"AuxPwrFwRev",AuxPwrFwRev); json_object_object_add(jobj1,"FanModuleHwRev",FanModuleHwRev); json_object_object_add(jobj1,"FanModuleFwRev",FanModuleFwRev); json_object_object_add(jobj1,"RelayModuleHwRev",RelayModuleHwRev); json_object_object_add(jobj1,"RelayModuleFwRev",RelayModuleFwRev); json_object_object_add(jobj1,"TelcomModemFwRev",TelcomModemFwRev); json_object_object_add(jobj1,"SystemAmbientTemp",SystemAmbientTemp); json_object_object_add(jobj1,"SystemCriticalTemp",SystemCriticalTemp); json_object_object_add(jobj1,"CcsConnectorTemp",CcsConnectorTemp); json_object_object_add(jobj1,"PsuAmbientTemp",PsuAmbientTemp); json_object_object_add(jobj1,"AcPlugInTimes",AcPlugInTimes); json_object_object_add(jobj1,"GbPlugInTimes",GbPlugInTimes); json_object_object_add(jobj1,"Ccs1PlugInTimes",Ccs1PlugInTime); json_object_object_add(jobj1,"Ccs2PlugInTimes",Ccs2PlugInTimes); json_object_object_add(jobj1,"ChademoPlugInTimes",ChademoPlugInTimes); printf("%s\n", json_object_to_json_string(jobj1)); json_object_put(jobj1); //charging json_object_object_add(jobj2,"MaxChargingEnergy",MaxChargingEnergy); json_object_object_add(jobj2,"MaxChargingPower",MaxChargingPower); json_object_object_add(jobj2,"MaxChargingCurrent",MaxChargingCurrent); json_object_object_add(jobj2,"MaxChargingDuration",MaxChargingDuration); json_object_object_add(jobj2,"PhaseLossPolicy",PhaseLossPolicy); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[0]); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[1]); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[2]); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[3]); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[4]); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[5]); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[6]); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[7]); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[8]); json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[9]); json_object_object_add(jobj2,"LocalWhiteCard",LocalWhiteCardArr); // json_object_object_add(jobj2,"CcsAuthentication",CcsAuthentication); // json_object_object_add(jobj2,"AcCcsChargingMode",AcCcsChargingMode); json_object_object_add(jobj2,"UserId",UserId); if(connectorType1 != 0){ json_object_object_add(ChargingInfo1,"PresentChargingVoltage",PresentChargingVoltage[0]); json_object_object_add(ChargingInfo1,"PresentChargingCurrent",PresentChargingCurrent[0]); json_object_object_add(ChargingInfo1,"PresentChargingPower",PresentChargingPower[0]); json_object_object_add(ChargingInfo1,"PresentChargedEnergy",PresentChargedEnergy[0]); json_object_object_add(ChargingInfo1,"PresentChargedDuration",PresentChargedDuration[0]); json_object_object_add(ChargingInfo1,"RemainChargingDuration",RemainChargingDuration[0]); json_object_object_add(ChargingInfo1,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[0]); json_object_object_add(ChargingInfo1,"EvBatterytargetVoltage",EvBatterytargetVoltage[0]); json_object_object_add(ChargingInfo1,"EvBatterySoc",EvBatterySoc[0]); json_object_object_add(ChargingInfo1,"SystemStatus",SystemStatus[0]); json_object_object_add(ChargingInfo1,"Index",Index[0]); json_object_object_add(ChargingInfo1,"Type",Type[0]); json_object_object_add(ChargingInfo1,"type_index",type_index[0]); json_object_object_add(ChargingInfo1,"EvBatterytargetCurrent",EvBatterytargetCurrent[0]); json_object_object_add(jobj2,"ChargingInfo1",ChargingInfo1); } if(connectorType2 != 0){ json_object_object_add(ChargingInfo2,"PresentChargingVoltage",PresentChargingVoltage[1]); json_object_object_add(ChargingInfo2,"PresentChargingCurrent",PresentChargingCurrent[1]); json_object_object_add(ChargingInfo2,"PresentChargingPower",PresentChargingPower[1]); json_object_object_add(ChargingInfo2,"PresentChargedEnergy",PresentChargedEnergy[1]); json_object_object_add(ChargingInfo2,"PresentChargedDuration",PresentChargedDuration[1]); json_object_object_add(ChargingInfo2,"RemainChargingDuration",RemainChargingDuration[1]); json_object_object_add(ChargingInfo2,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[1]); json_object_object_add(ChargingInfo2,"EvBatterytargetVoltage",EvBatterytargetVoltage[1]); json_object_object_add(ChargingInfo2,"EvBatterySoc",EvBatterySoc[1]); json_object_object_add(ChargingInfo2,"SystemStatus",SystemStatus[1]); json_object_object_add(ChargingInfo2,"Index",Index[1]); json_object_object_add(ChargingInfo2,"Type",Type[1]); json_object_object_add(ChargingInfo2,"type_index",type_index[1]); json_object_object_add(ChargingInfo2,"EvBatterytargetCurrent",EvBatterytargetCurrent[1]); json_object_object_add(jobj2,"ChargingInfo2",ChargingInfo2); } if(connectorType3 != 0){ json_object_object_add(ChargingInfo3,"PresentChargingVoltage",PresentChargingVoltage[2]); json_object_object_add(ChargingInfo3,"PresentChargingCurrent",PresentChargingCurrent[2]); json_object_object_add(ChargingInfo3,"PresentChargingPower",PresentChargingPower[2]); json_object_object_add(ChargingInfo3,"PresentChargedEnergy",PresentChargedEnergy[2]); json_object_object_add(ChargingInfo3,"PresentChargedDuration",PresentChargedDuration[2]); json_object_object_add(ChargingInfo3,"RemainChargingDuration",RemainChargingDuration[2]); json_object_object_add(ChargingInfo3,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[2]); json_object_object_add(ChargingInfo3,"EvBatterytargetVoltage",EvBatterytargetVoltage[2]); json_object_object_add(ChargingInfo3,"EvBatterySoc",EvBatterySoc[2]); json_object_object_add(ChargingInfo3,"SystemStatus",SystemStatus[2]); json_object_object_add(ChargingInfo3,"Index",Index[2]); json_object_object_add(ChargingInfo3,"Type",Type[2]); json_object_object_add(ChargingInfo3,"type_index",type_index[2]); json_object_object_add(ChargingInfo3,"EvBatterytargetCurrent",EvBatterytargetCurrent[2]); json_object_object_add(jobj2,"ChargingInfo3",ChargingInfo3); } printf("%s\n", json_object_to_json_string(jobj2)); json_object_put(jobj2); //network json_object_object_add(jobj3,"InternetConn",InternetConn); json_object_object_add(jobj3,"FtpServer",FtpServer); json_object_object_add(jobj3,"Eth0DhcpClient",Eth0DhcpClient); json_object_object_add(jobj3,"Eth0MacAddress",Eth0MacAddress); json_object_object_add(jobj3,"Eth0IpAddress",Eth0IpAddress); json_object_object_add(jobj3,"Eth0SubmaskAddress",Eth0SubmaskAddress); json_object_object_add(jobj3,"Eth0GatewayAddress",Eth0GatewayAddress); json_object_object_add(jobj3,"Eth1DhcpClient",Eth1DhcpClient); json_object_object_add(jobj3,"Eth1MacAddress",Eth1MacAddress); json_object_object_add(jobj3,"Eth1IpAddress",Eth1IpAddress); json_object_object_add(jobj3,"Eth1SubmaskAddress",Eth1SubmaskAddress); json_object_object_add(jobj3,"Eth1GatewayAddress",Eth1GatewayAddress); json_object_object_add(jobj3,"WifiMode",WifiMode); json_object_object_add(jobj3,"WifiSsid",WifiSsid); json_object_object_add(jobj3,"WifiPassword",WifiPassword); json_object_object_add(jobj3,"WifiRssi",WifiRssi); json_object_object_add(jobj3,"WifiDhcpServer",WifiDhcpServer); json_object_object_add(jobj3,"WifiDhcpClient",WifiDhcpClient); json_object_object_add(jobj3,"WifiMacAddress",WifiMacAddress); json_object_object_add(jobj3,"WifiIpAddress",WifiIpAddress); json_object_object_add(jobj3,"WifiSubmaskAddress",WifiSubmaskAddress); json_object_object_add(jobj3,"WifiGatewayAddress",WifiGatewayAddress); json_object_object_add(jobj3,"TelcomApn",TelcomApn); json_object_object_add(jobj3,"TelcomRssi",TelcomRssi); json_object_object_add(jobj3,"TelcomChapPapId",TelcomChapPapId); json_object_object_add(jobj3,"TelcomChapPapPwd",TelcomChapPapPwd); json_object_object_add(jobj3,"TelcomModemImei",TelcomModemImei); json_object_object_add(jobj3,"TelcomSimImsi",TelcomSimImsi); json_object_object_add(jobj3,"TelcomSimStatus",TelcomSimStatus); json_object_object_add(jobj3,"TelcomModemMode",TelcomModemMode); json_object_object_add(jobj3,"TelcomIpAddress",TelcomIpAddress); printf("%s\n", json_object_to_json_string(jobj3)); json_object_put(jobj3); //backend json_object_object_add(jobj4,"BackendConnTimeout",BackendConnTimeout); json_object_object_add(jobj4,"OfflinePolicy",OfflinePolicy); json_object_object_add(jobj4,"OfflineMaxChargeEnergy",OfflineMaxChargeEnergy); json_object_object_add(jobj4,"OfflineMaxChargeDuration",OfflineMaxChargeDuration); json_object_object_add(jobj4,"OcppConnStatus",OcppConnStatus); json_object_object_add(jobj4,"OcppServerURL",OcppServerURL); json_object_object_add(jobj4,"ChargeBoxId",ChargeBoxId); printf("%s\n", json_object_to_json_string(jobj4)); json_object_put(jobj4); // jobj = json_object_new_object(); // json_object_object_add(jobj, "OBJECT", array_obj); // json_object_to_file("system.txt", jobj); /* char* filearr[4] = { "system.txt", "charging.txt", "network.txt", "backend.txt" }; for (int i = 0; i <= 3; i++) { FILE *outfile; char buffer[65536]; int arr[65536]; // open file for writing outfile = fopen(filearr[i], "r"); if (outfile == NULL) { // fprintf(stderr, "\nError open file\n"); exit(1); } char input[65536]; while (fscanf(outfile, "%s", input) != EOF) { // printf("%s",input); } fclose(outfile); // printf("\n"); }*/ // } // strcpy( x.SysConfig.ModelName,"1"); // for(;;) // { // } // return FAIL; //}