1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501 |
- #include <sys/time.h>
- #include <sys/timeb.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <sys/socket.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <sys/shm.h>
- #include <sys/mman.h>
- #include <linux/wireless.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <stdio.h> /*標準輸入輸出定義*/
- #include <stdlib.h> /*標準函數庫定義*/
- #include <unistd.h> /*Unix 標準函數定義*/
- #include <fcntl.h> /*檔控制定義*/
- #include <termios.h> /*PPSIX 終端控制定義*/
- #include <errno.h> /*錯誤號定義*/
- #include <errno.h>
- #include <string.h>
- #include <time.h>
- #include <ctype.h>
- #include <ifaddrs.h>
- #include "../Projects/define.h"
- #include "json.h"
- //#include <json-c/json.h>
- #include <math.h>
- #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 SystemLogMessage
- #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
- #define PASS 1
- #define FAIL -1
- 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, "U") == 0 || strcmp(connector, "E") == 0){
- result= 1;//CCS
- }
- else if(strcmp(connector, "G") == 0 || strcmp(connector, "D") == 0){
- result= 2;//GB
- }
- else if(strcmp(connector, "J") == 0){
- result= 3;//CHAdeMO
- }
- else if(strcmp(connector, "1") == 0 || strcmp(connector, "2") == 0 || strcmp(connector, "3") == 0 || strcmp(connector, "4") == 0 || strcmp(connector, "5") == 0 || strcmp(connector, "6") == 0){
- result= 4;//AC
- }
- else{
- result= 0;
- }
- 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;
- }
- int StoreUsrConfigData(struct SysConfigData *UsrData)
- {
- int fd,wrd;
- unsigned int i,Chk;
- unsigned char *ptr;
- Chk=0;
- ptr=(unsigned char *)UsrData;
- for(i=0;i<sizeof(struct SysConfigData)-4;i++)
- {
- Chk+=*(ptr+i);
- }
- UsrData->Checksum=Chk;
- fd = open("/dev/mtdblock10", O_RDWR);
- if (fd < 0)
- {
- #ifdef SystemLogMessage
- StoreLogMsg("[WebService]StoreUsrConfigData: open /dev/mtdblock10 NG");
- #endif
- return 0;
- }
- wrd=write(fd, UsrData, sizeof(struct SysConfigData));
- close(fd);
- if(wrd!=(sizeof(struct SysConfigData)))
- {
- #ifdef SystemLogMessage
- StoreLogMsg("[WebService]StoreUsrConfigData: write /dev/mtdblock10 NG");
- #endif
- return 0;
- }
- fd = open("/dev/mtdblock11", O_RDWR);
- if (fd < 0)
- {
- #ifdef SystemLogMessage
- StoreLogMsg("[WebService]StoreUsrConfigData: open /dev/mtdblock11(backup) NG");
- #endif
- return 0;
- }
- wrd=write(fd, UsrData, sizeof(struct SysConfigData));
- close(fd);
- if(wrd!=(sizeof(struct SysConfigData)))
- {
- #ifdef SystemLogMessage
- StoreLogMsg("[WebService]StoreUsrConfigData: write /dev/mtdblock11(backup) NG");
- #endif
- return 0;
- }
- return 1;
- }
- //================================================
- // 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;
- }
- //web page submit
- if ((argc == 3) & (strlen(argv[1]) == 1)) {
- //web page submit system
- if (strcmp(argv[1], "1") == 0) {
- struct json_object *jobj = json_tokener_parse(argv[2]);
- json_object *val_obj = NULL;
- char *SystemId=NULL;
- char *SystemDateTime = NULL;
- int AcPhaseCount = 0;
- int FactoryConfiguration = 0;
- int AuthorisationMode = 0;
- int DefaultLanguage = 0;
- int RfidCardNumEndian = 0;
- int PsuAcInputType = 0;
- if( json_object_object_get_ex(jobj, "SystemId", &val_obj) ) {
- SystemId = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "SystemDateTime", &val_obj) ) {
- SystemDateTime = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "AcPhaseCount", &val_obj) ) {
- AcPhaseCount = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "FactoryConfiguration", &val_obj) ) {
- FactoryConfiguration = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "AuthorisationMode", &val_obj) ) {
- AuthorisationMode = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "DefaultLanguage", &val_obj) ) {
- DefaultLanguage = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "RfidCardNumEndian", &val_obj) ) {
- RfidCardNumEndian = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "PsuAcInputType", &val_obj) ) {
- PsuAcInputType = json_object_get_int(val_obj);
- }
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId,SystemId);
- ShmSysConfigAndInfo->SysConfig.AcPhaseCount = AcPhaseCount;
- ShmSysConfigAndInfo->SysInfo.FactoryConfiguration = FactoryConfiguration;
- ShmSysConfigAndInfo->SysConfig.AuthorisationMode = AuthorisationMode;
- ShmSysConfigAndInfo->SysConfig.DefaultLanguage = DefaultLanguage;
- ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = RfidCardNumEndian;
- ShmSysConfigAndInfo->SysConfig.PsuAcInputType = PsuAcInputType;
- if(strlen(SystemDateTime)>0){
- char cmd[100];
- sprintf(cmd,"date -s '%s'",SystemDateTime);
- if(system(cmd)==0){
- system("hwclock -w");
- }
- }
- }
- if (strcmp(argv[1], "2") == 0) {
- struct json_object *jobj = json_tokener_parse(argv[2]);
- json_object *val_obj = NULL;
- int MaxChargingEnergy= 0;
- int MaxChargingPower = 0;
- int MaxChargingCurrent = 0;
- int MaxChargingDuration = 0;
- int PhaseLossPolicy = 0;
- char *LocalWhiteCard0 = NULL;
- char *LocalWhiteCard1 = NULL;
- char *LocalWhiteCard2 = NULL;
- char *LocalWhiteCard3 = NULL;
- char *LocalWhiteCard4 = NULL;
- char *LocalWhiteCard5 = NULL;
- char *LocalWhiteCard6 = NULL;
- char *LocalWhiteCard7 = NULL;
- char *LocalWhiteCard8 = NULL;
- char *LocalWhiteCard9 = NULL;
- if( json_object_object_get_ex(jobj, "MaxChargingEnergy", &val_obj) ) {
- MaxChargingEnergy = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "MaxChargingPower", &val_obj) ) {
- MaxChargingPower = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "MaxChargingCurrent", &val_obj) ) {
- MaxChargingCurrent = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "MaxChargingDuration", &val_obj) ) {
- MaxChargingDuration = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "PhaseLossPolicy", &val_obj) ) {
- PhaseLossPolicy = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard0", &val_obj) ) {
- LocalWhiteCard0 = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard1", &val_obj) ) {
- LocalWhiteCard1 = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard2", &val_obj) ) {
- LocalWhiteCard2 = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard3", &val_obj) ) {
- LocalWhiteCard3 = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard4", &val_obj) ) {
- LocalWhiteCard4 = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard5", &val_obj) ) {
- LocalWhiteCard5 = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard6", &val_obj) ) {
- LocalWhiteCard6 = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard7", &val_obj) ) {
- LocalWhiteCard7 = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard8", &val_obj) ) {
- LocalWhiteCard8 = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard9", &val_obj) ) {
- LocalWhiteCard9 = json_object_get_string(val_obj);
- }
- ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy = MaxChargingEnergy;
- ShmSysConfigAndInfo->SysConfig.MaxChargingPower = MaxChargingPower;
- ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent = MaxChargingCurrent;
- ShmSysConfigAndInfo->SysConfig.MaxChargingDuration = MaxChargingDuration;
- ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy = PhaseLossPolicy;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0],LocalWhiteCard0);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1],LocalWhiteCard1);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2],LocalWhiteCard2);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3],LocalWhiteCard3);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4],LocalWhiteCard4);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5],LocalWhiteCard5);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6],LocalWhiteCard6);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7],LocalWhiteCard7);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8],LocalWhiteCard8);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9],LocalWhiteCard9);
- }
- if (strcmp(argv[1], "3") == 0) {
- struct json_object *jobj = json_tokener_parse(argv[2]);
- json_object *val_obj = NULL;
- char *FtpServer=NULL;
- int Eth0DhcpClient=0;
- char *Eth0IpAddress=NULL;
- char *Eth0SubmaskAddress=NULL;
- char *Eth0GatewayAddress=NULL;
- int Eth1DhcpClient=0;
- char *Eth1IpAddress=NULL;
- char *Eth1SubmaskAddress=NULL;
- char *Eth1GatewayAddress=NULL;
- int WifiMode=0;
- char *WifiSsid=NULL;
- char *WifiPassword=NULL;
- int WifiDhcpServer=0;
- int WifiDhcpClient=0;
- char *WifiIpAddress=NULL;
- char *WifiSubmaskAddress=NULL;
- char *WifiGatewayAddress=NULL;
- char *TelcomApn=NULL;
- char *TelcomChapPapId=NULL;
- char *TelcomChapPapPwd=NULL;
- char *TelcomIpAddress=NULL;
- if( json_object_object_get_ex(jobj, "FtpServer", &val_obj) ) {
- FtpServer = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "Eth0DhcpClient", &val_obj) ) {
- Eth0DhcpClient = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "Eth0IpAddress", &val_obj) ) {
- Eth0IpAddress = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "Eth0SubmaskAddress", &val_obj) ) {
- Eth0SubmaskAddress = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "Eth0GatewayAddress", &val_obj) ) {
- Eth0GatewayAddress = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "Eth1DhcpClient", &val_obj) ) {
- Eth1DhcpClient = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "Eth1IpAddress", &val_obj) ) {
- Eth1IpAddress = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "Eth1SubmaskAddress", &val_obj) ) {
- Eth1SubmaskAddress = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "Eth1GatewayAddress", &val_obj) ) {
- Eth1GatewayAddress = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "WifiMode", &val_obj) ) {
- WifiMode = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "WifiSsid", &val_obj) ) {
- WifiSsid = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "WifiPassword", &val_obj) ) {
- WifiPassword = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "WifiDhcpServer", &val_obj) ) {
- WifiDhcpServer = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "WifiDhcpClient", &val_obj) ) {
- WifiDhcpClient = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "WifiIpAddress", &val_obj) ) {
- WifiIpAddress = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "WifiSubmaskAddress", &val_obj) ) {
- WifiSubmaskAddress = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "WifiGatewayAddress", &val_obj) ) {
- WifiGatewayAddress = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "TelcomApn", &val_obj) ) {
- TelcomApn = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "TelcomChapPapId", &val_obj) ) {
- TelcomChapPapId = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "TelcomChapPapPwd", &val_obj) ) {
- TelcomChapPapPwd = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "TelcomIpAddress", &val_obj) ) {
- TelcomIpAddress = json_object_get_string(val_obj);
- }
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,FtpServer);
- ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=Eth0DhcpClient;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,Eth0IpAddress);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,Eth0SubmaskAddress);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,Eth0GatewayAddress);
- ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=Eth1DhcpClient;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,Eth1IpAddress);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,Eth1SubmaskAddress);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,Eth1GatewayAddress);
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=WifiMode;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,WifiSsid);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,WifiPassword);
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=WifiDhcpServer;
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=WifiDhcpClient;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,WifiIpAddress);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,WifiSubmaskAddress);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,WifiGatewayAddress);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,TelcomApn);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,TelcomChapPapId);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,TelcomChapPapPwd);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,TelcomIpAddress);
- }
- if (strcmp(argv[1], "4") == 0) {
- struct json_object *jobj = json_tokener_parse(argv[2]);
- json_object *val_obj = NULL;
- int BackendConnTimeout=0;
- int OfflinePolicy=0;
- int OfflineMaxChargeEnergy=0;
- int OfflineMaxChargeDuration=0;
- char *OcppServerURL=NULL;
- char *ChargeBoxId=NULL;
- if( json_object_object_get_ex(jobj, "BackendConnTimeout", &val_obj) ) {
- BackendConnTimeout = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "OfflinePolicy", &val_obj) ) {
- OfflinePolicy = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "OfflineMaxChargeEnergy", &val_obj) ) {
- OfflineMaxChargeEnergy = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "OfflineMaxChargeDuration", &val_obj) ) {
- OfflineMaxChargeDuration = json_object_get_int(val_obj);
- }
- if( json_object_object_get_ex(jobj, "OcppServerURL", &val_obj) ) {
- OcppServerURL = json_object_get_string(val_obj);
- }
- if( json_object_object_get_ex(jobj, "ChargeBoxId", &val_obj) ) {
- ChargeBoxId = json_object_get_string(val_obj);
- }
- ShmSysConfigAndInfo->SysConfig.BackendConnTimeout = BackendConnTimeout;
- ShmSysConfigAndInfo->SysConfig.OfflinePolicy = OfflinePolicy;
- ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy = OfflineMaxChargeEnergy;
- ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration = OfflineMaxChargeDuration;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,OcppServerURL);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,ChargeBoxId);
- }
- int result = StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
- if(result != 1){
- #ifdef SystemLogMessage
- StoreLogMsg("[WebService]StoreUsrConfigData: normal NG");
- #endif
- }
- else{
- #ifdef SystemLogMessage
- StoreLogMsg("[WebService]StoreUsrConfigData: normal OK");
- #endif
- }
- #ifdef SystemLogMessage
- DEBUG_INFO("WebServiceConfig update OK");
- #endif
- }
- if (argc == 2) { //init share memory for test
- if (strcmp(argv[1], "aaa") == 0) {
- struct SysConfigData SysConfig;
- //system
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ModelName, "DSLU122110T1P0");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber, "SerialNumber");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
- ShmSysConfigAndInfo->SysConfig.AcPhaseCount=1;
- ShmSysConfigAndInfo->SysInfo.FactoryConfiguration=0;
- ShmSysConfigAndInfo->SysConfig.AuthorisationMode=0;
- ShmSysConfigAndInfo->SysConfig.DefaultLanguage=0;
- ShmSysConfigAndInfo->SysInfo.InputVoltageR=0;
- ShmSysConfigAndInfo->SysInfo.InputVoltageS=0;
- ShmSysConfigAndInfo->SysInfo.InputVoltageT=0;
- ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed=0;
- ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0;
- ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian=0;
- ShmSysConfigAndInfo->SysConfig.PsuAcInputType=0;
- ShmSysConfigAndInfo->SysInfo.AuxPower5V=0;
- ShmSysConfigAndInfo->SysInfo.AuxPower12V=0;
- ShmSysConfigAndInfo->SysInfo.AuxPower24V=0;
- ShmSysConfigAndInfo->SysInfo.AuxPower48V=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.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;
- //charging
- ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy=0;
- ShmSysConfigAndInfo->SysConfig.MaxChargingPower=0;
- ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0;
- ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0;
- ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3], "444");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4], "555");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5], "666");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6], "777");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7], "888");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8], "999");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9], "aaa");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.UserId, "UserId");
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent=0;
- 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;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus=1;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Index=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Type=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].type_index=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetCurrent=1;
- //network
- ShmSysConfigAndInfo->SysInfo.InternetConn=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,"");
- ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=1;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,"192.168.1.10");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,"255.255.255.0");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,"192.168.1.1");
- ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=1;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,"192.168.0.10");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,"255.255.255.0");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,"192.168.0.1");
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=1;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,"");
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi=0;
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=0;
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,"");
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid,"");
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus=0;
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,"");
- //backend
- ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=300;
- ShmSysConfigAndInfo->SysConfig.OfflinePolicy=0;
- ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy=0;
- ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration=0;
- ShmSysConfigAndInfo->SysInfo.OcppConnStatus=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"");
- ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=0;
- StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
- #ifdef SystemLogMessage
- DEBUG_INFO("WebService initial OK");
- #endif
- }
- if (strcmp(argv[1], "log") == 0) {
- time_t tt = time(0); //獲取當前時間
- int year,month;
- char cmd[100];
- struct tm *pst = localtime(&tt); //把time_t類型轉換為struct tm類型
- year = pst->tm_year + 1900;
- month = pst->tm_mon + 1;
- sprintf(cmd,"cp /mnt/%04d-%02d.zip /var/www/log.zip",year,month);
- if(system("exec /root/logPackTools 'log'")==0){
- system(cmd);
- }
- }
- }
- //upgrade firmware
- if ((argc == 3) & (strcmp(argv[1], "upgrade") == 0)) {
- struct json_object *jobj;
- struct json_object *Result;
- struct json_object *Message;
- char cmd[100];
- jobj=json_object_new_object();
- //system
- //if((char)ShmSysConfigAndInfo->SysInfo.FirmwareUpdate == '0'){
- ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=1;
- Result = json_object_new_string("success");
- Message = json_object_new_string("file is uploaded");
- //}
- /*else{
- sprintf(cmd,"rm /mnt/%s",argv[2]);
- system(cmd);
- Result = json_object_new_string("error");
- Message = json_object_new_string("machine is busy");
- }*/
- json_object_object_add(jobj,"Result",Result);
- json_object_object_add(jobj,"Message",Message);
- printf("%s\n", json_object_to_json_string(jobj));
- }
- //web page query all
- if ((argc == 2) & (strcmp(argv[1], "query") == 0)) {
- char *IsAcDc[2];
- char *Connector1[2];
- char *Connector2[2];
- char *Connector3[2];
- char *Network[2];
- substr((char *)IsAcDc,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,1);
- substr((char *)Connector1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,7,1);
- substr((char *)Connector2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,8,1);
- substr((char *)Connector3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,9,1);
- substr((char *)Network,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,10,1);
- int connectorType1,connectorType2,connectorType3;
- connectorType1=ConnectorType((char *)Connector1);
- connectorType2=ConnectorType((char *)Connector2);
- connectorType3=ConnectorType((char *)Connector3);
- // modelType=ModelType((char *)IsAcDc,(char *)Network);
- // 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 *AcPhaseCount;
- 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 *PsuAcInputType;
- 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;
- struct json_object *FirmwareUpdate;
- //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 *CardNumber[3];
- struct json_object *StartUserId[3];
- struct json_object *StartDateTime[3];
- struct json_object *StopDateTime[3];
- struct json_object *StartMethod[3];
- struct json_object *ConnectorTemp[3];
- 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 *WifiNetworkConn;
- 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;
- struct json_object *TelcomNetworkConn;
- //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((char *)&ShmSysConfigAndInfo->SysConfig.ModelName);
- SerialNumber = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber);
- SystemId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SystemId);
- // SystemDateTime = json_object_new_string(ShmSysConfigAndInfo->SysConfig.SystemDateTime);
- AcPhaseCount = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPhaseCount);
- FactoryConfiguration = json_object_new_int(ShmSysConfigAndInfo->SysInfo.FactoryConfiguration);
- AuthorisationMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
- DefaultLanguage = json_object_new_int(ShmSysConfigAndInfo->SysConfig.DefaultLanguage);
- 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(ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
- PsuFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed);
- RfidCardNumEndian = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
- PsuAcInputType = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PsuAcInputType);
- AuxPower5V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower5V);
- AuxPower12V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower12V);
- AuxPower24V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower24V);
- AuxPower48V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower48V);
- CsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev);
- CsuBootLoadFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
- CsuKernelFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
- CsuRootFsFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
- CsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev);
- LcmHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev);
- LcmFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev);
- PsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev);
- PsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev);
- PsuSecFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev);
- AuxPwrHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev);
- AuxPwrFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev);
- FanModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev);
- FanModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev);
- RelayModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev);
- RelayModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev);
- TelcomModemFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev);
- SystemAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp);
- SystemCriticalTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp);
- CcsConnectorTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp);
- PsuAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp);
- AcPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPlugInTimes);
- GbPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.GbPlugInTimes);
- Ccs1PlugInTime = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime);
- Ccs2PlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes);
- ChademoPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes);
- FirmwareUpdate = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FirmwareUpdate);
- //charging
- int CcsGunQty=0;
- int GbGunQty=0;
- int CHAdeMOGunQty=0;
- int AcGunQty=0;
- ChargingInfo1=json_object_new_object();
- ChargingInfo2=json_object_new_object();
- ChargingInfo3=json_object_new_object();
- MaxChargingEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy);
- MaxChargingPower = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingPower);
- MaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
- MaxChargingDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingDuration);
- PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
- LocalWhiteCard[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]);
- LocalWhiteCard[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]);
- LocalWhiteCard[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]);
- LocalWhiteCard[3] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3]);
- LocalWhiteCard[4] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4]);
- LocalWhiteCard[5] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5]);
- LocalWhiteCard[6] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6]);
- LocalWhiteCard[7] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7]);
- LocalWhiteCard[8] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8]);
- LocalWhiteCard[9] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9]);
- UserId = json_object_new_string((char *)&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_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
- Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index);
- Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type);
- type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index);
- EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
- CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].CardNumber);
- StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
- StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
- StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
- StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
- 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_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
- Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index);
- Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type);
- type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index);
- EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
- CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].CardNumber);
- StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
- StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
- StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
- StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
- 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_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
- Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index);
- Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type);
- type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index);
- EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
- CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].CardNumber);
- StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
- StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
- StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
- StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
- CHAdeMOGunQty++;
- }
- else if(connectorType1 == 4){//AC
- PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
- PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
- PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
- PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
- PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
- RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
- EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
- SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
- Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
- Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
- type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
- EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
- CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
- StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
- StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
- StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
- StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
- AcGunQty++;
- }
- }
- 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_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
- Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index);
- Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type);
- type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index);
- EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
- CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].CardNumber);
- StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
- StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
- StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
- StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
- 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_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
- Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index);
- Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type);
- type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index);
- EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
- CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].CardNumber);
- StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
- StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
- StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
- StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
- 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_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
- Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index);
- Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type);
- type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index);
- EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
- CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].CardNumber);
- StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
- StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
- StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
- StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
- CHAdeMOGunQty++;
- }
- else if(connectorType2 == 4){//AC
- PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
- PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
- PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
- PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
- PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
- RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
- EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
- SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
- Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
- Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
- type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
- EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
- CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
- StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
- StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
- StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
- StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
- AcGunQty++;
- }
- }
- 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_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
- Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index);
- Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type);
- type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index);
- EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
- CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].CardNumber);
- StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
- StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
- StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
- StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
- 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_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
- Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index);
- Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type);
- type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index);
- EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
- CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].CardNumber);
- StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
- StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
- StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
- StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
- 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_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
- Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index);
- Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type);
- type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index);
- EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
- CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].CardNumber);
- StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
- StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
- StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
- StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
- CHAdeMOGunQty++;
- }
- else if(connectorType3 == 4){//AC
- PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
- PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
- PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
- PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
- PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
- RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
- EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
- SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
- Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
- Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
- type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
- EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
- CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
- StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
- StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
- StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
- StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
- AcGunQty++;
- }
- }
- //network
- InternetConn = json_object_new_int(ShmSysConfigAndInfo->SysInfo.InternetConn);
- FtpServer = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer);
- Eth0DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient);
- Eth0MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress);
- Eth0IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
- Eth0SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
- Eth0GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
- Eth1DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient);
- Eth1MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress);
- Eth1IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress);
- Eth1SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress);
- Eth1GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress);
- WifiMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
- WifiSsid = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
- WifiPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
- WifiRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi);
- WifiDhcpServer = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer);
- WifiDhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient);
- WifiMacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress);
- WifiIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress);
- WifiSubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress);
- WifiGatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress);
- WifiNetworkConn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn);
- TelcomApn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
- TelcomRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi);
- TelcomChapPapId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
- TelcomChapPapPwd = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
- TelcomModemImei = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei);
- TelcomSimImsi = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi);
- TelcomSimIccid = json_object_new_string(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
- TelcomSimStatus = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus);
- TelcomModemMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
- TelcomIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress);
- TelcomNetworkConn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn);
- //backend
- BackendConnTimeout = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BackendConnTimeout);
- OfflinePolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
- OfflineMaxChargeEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy);
- OfflineMaxChargeDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration);
- OcppConnStatus = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.OcppConnStatus,1);
- OcppServerURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL);
- ChargeBoxId = json_object_new_string((char *)&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,"AcPhaseCount",AcPhaseCount);
- 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,"PsuAcInputType",PsuAcInputType);
- 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);
- json_object_object_add(jobj1,"FirmwareUpdate",FirmwareUpdate);
- 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);
- if(connectorType1 != 0){
- json_object_object_add(ChargingInfo1,"CardNumber",CardNumber[0]);
- json_object_object_add(ChargingInfo1,"StartUserId",StartUserId[0]);
- json_object_object_add(ChargingInfo1,"StartDateTime",StartDateTime[0]);
- json_object_object_add(ChargingInfo1,"StopDateTime",StopDateTime[0]);
- json_object_object_add(ChargingInfo1,"StartMethod",StartMethod[0]);
- json_object_object_add(ChargingInfo1,"ConnectorTemp",ConnectorTemp[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,"CardNumber",CardNumber[1]);
- json_object_object_add(ChargingInfo2,"StartUserId",StartUserId[1]);
- json_object_object_add(ChargingInfo2,"StartDateTime",StartDateTime[1]);
- json_object_object_add(ChargingInfo2,"StopDateTime",StopDateTime[1]);
- json_object_object_add(ChargingInfo2,"StartMethod",StartMethod[1]);
- json_object_object_add(ChargingInfo2,"ConnectorTemp",ConnectorTemp[1]);
- 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,"CardNumber",CardNumber[2]);
- json_object_object_add(ChargingInfo3,"StartUserId",StartUserId[2]);
- json_object_object_add(ChargingInfo3,"StartDateTime",StartDateTime[2]);
- json_object_object_add(ChargingInfo3,"StopDateTime",StopDateTime[2]);
- json_object_object_add(ChargingInfo3,"StartMethod",StartMethod[2]);
- json_object_object_add(ChargingInfo3,"ConnectorTemp",ConnectorTemp[2]);
- 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,"WifiNetworkConn",WifiNetworkConn);
- 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,"TelcomSimIccid",TelcomSimIccid);
- json_object_object_add(jobj3,"TelcomSimStatus",TelcomSimStatus);
- json_object_object_add(jobj3,"TelcomModemMode",TelcomModemMode);
- json_object_object_add(jobj3,"TelcomIpAddress",TelcomIpAddress);
- json_object_object_add(jobj3,"TelcomNetworkConn",TelcomNetworkConn);
- 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);
- }
- // for(;;)
- // {
- // }
- return FAIL;
- }
|