WebService.c 164 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949
  1. #include <sys/time.h>
  2. #include <sys/timeb.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6. #include <sys/ioctl.h>
  7. #include <sys/socket.h>
  8. #include <sys/ipc.h>
  9. #include <sys/shm.h>
  10. #include <sys/shm.h>
  11. #include <sys/mman.h>
  12. #include <linux/wireless.h>
  13. #include <arpa/inet.h>
  14. #include <netinet/in.h>
  15. #include <unistd.h>
  16. #include <stdarg.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <unistd.h>
  20. #include <fcntl.h>
  21. #include <termios.h>
  22. #include <errno.h>
  23. #include <errno.h>
  24. #include <string.h>
  25. #include <time.h>
  26. #include <ctype.h>
  27. #include <ifaddrs.h>
  28. #include <math.h>
  29. #include <netdb.h>
  30. #include <error.h>
  31. #include <signal.h>
  32. #include "define.h"
  33. #include "json.h"
  34. #include <curl/curl.h>
  35. #include <curl/easy.h>
  36. #include "DcMeter/curlApi.h"
  37. #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  38. #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  39. #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  40. #define Debug
  41. #define SystemLogMessage
  42. #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
  43. #define PASS 1
  44. #define FAIL -1
  45. #define MtdBlockSize 0x300000
  46. struct SysConfigAndInfo *ShmSysConfigAndInfo;
  47. struct BatteryInfoData *ShmBatteryInfo;
  48. struct EMSSInfoData *ShmEMSSInfo;
  49. void trim(char *s);
  50. int mystrcmp(char *p1, char *p2);
  51. void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
  52. void split(char **arr, char *str, const char *del);
  53. #ifdef SystemLogMessage
  54. int StoreLogMsg(const char *fmt, ...) {
  55. char Buf[4096 + 256];
  56. char buffer[4096];
  57. time_t CurrentTime;
  58. struct tm *tm;
  59. va_list args;
  60. va_start(args, fmt);
  61. int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
  62. va_end(args);
  63. memset(Buf, 0, sizeof(Buf));
  64. CurrentTime = time(NULL);
  65. tm = localtime(&CurrentTime);
  66. sprintf(Buf,
  67. "echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
  68. tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
  69. tm->tm_min, tm->tm_sec, buffer, tm->tm_year + 1900, tm->tm_mon + 1);
  70. system(Buf);
  71. #ifdef Debug
  72. printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year + 1900,
  73. tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
  74. buffer);
  75. #endif
  76. return rc;
  77. }
  78. int WriteLogMsg(const char *fmt, ...) {
  79. char Buf[4096 + 256];
  80. char buffer[4096];
  81. time_t CurrentTime;
  82. struct tm *tm;
  83. va_list args;
  84. va_start(args, fmt);
  85. int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
  86. va_end(args);
  87. memset(Buf, 0, sizeof(Buf));
  88. CurrentTime = time(NULL);
  89. tm = localtime(&CurrentTime);
  90. sprintf(Buf,
  91. "echo \"[%04d.%02d.%02d %02d:%02d:%02d WebService] - %s\" >> /Storage/SystemLog/[%04d.%02d]WebService_SystemLog",
  92. tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
  93. tm->tm_min, tm->tm_sec, buffer, tm->tm_year + 1900, tm->tm_mon + 1);
  94. system(Buf);
  95. return rc;
  96. }
  97. #endif
  98. int runShellCmd(const char*cmd)
  99. {
  100. int result = FAIL;
  101. char buf[256];
  102. FILE *fp;
  103. fp = popen(cmd, "r");
  104. if(fp != NULL)
  105. {
  106. while(fgets(buf, sizeof(buf), fp) != NULL)
  107. {
  108. DEBUG_INFO("%s\n", buf);
  109. }
  110. result = PASS;
  111. }
  112. pclose(fp);
  113. return result;
  114. }
  115. int DiffTimeb(struct timeb ST, struct timeb ET) {
  116. //return milli-second
  117. unsigned int StartTime, StopTime;
  118. StartTime = (unsigned int) ST.time;
  119. StopTime = (unsigned int) ET.time;
  120. return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
  121. }
  122. //=================================
  123. // Common routine
  124. //=================================
  125. void trim(char *s) {
  126. int i = 0, j, k, l = 0;
  127. while ((s[i] == ' ') || (s[i] == '\t') || (s[i] == '\n'))
  128. i++;
  129. j = strlen(s) - 1;
  130. while ((s[j] == ' ') || (s[j] == '\t') || (s[j] == '\n'))
  131. j--;
  132. if (i == 0 && j == strlen(s) - 1) {
  133. } else if (i == 0)
  134. s[j + 1] = '\0';
  135. else {
  136. for (k = i; k <= j; k++)
  137. s[l++] = s[k];
  138. s[l] = '\0';
  139. }
  140. }
  141. int mystrcmp(char *p1, char *p2) {
  142. while (*p1 == *p2) {
  143. if (*p1 == '\0' || *p2 == '\0')
  144. break;
  145. p1++;
  146. p2++;
  147. }
  148. if (*p1 == '\0' && *p2 == '\0')
  149. return (PASS);
  150. else
  151. return (FAIL);
  152. }
  153. void substr(char *dest, const char* src, unsigned int start, unsigned int cnt) {
  154. strncpy(dest, src + start, cnt);
  155. dest[cnt] = 0;
  156. }
  157. void split(char **arr, char *str, const char *del) {
  158. char *s = strtok(str, del);
  159. while (s != NULL) {
  160. *arr++ = s;
  161. s = strtok(NULL, del);
  162. }
  163. }
  164. int ConnectorType(char* connector){
  165. int result;
  166. if(strcmp(connector, "0") == 0){
  167. result= 0;
  168. }
  169. else if(strcmp(connector, "U") == 0 || strcmp(connector, "V") == 0 || strcmp(connector, "E") == 0 || strcmp(connector, "F") == 0 || strcmp(connector, "T") == 0 || strcmp(connector, "D") == 0 || strcmp(connector, "M") == 0 || strcmp(connector, "N") == 0 || strcmp(connector, "P") == 0 || strcmp(connector, "R") == 0){
  170. result= 1;//CCS
  171. }
  172. else if(strcmp(connector, "G") == 0 || strcmp(connector, "B") == 0){
  173. result= 2;//GB
  174. }
  175. else if(strcmp(connector, "J") == 0 || strcmp(connector, "K") == 0){
  176. result= 3;//CHAdeMO
  177. }
  178. 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 || strcmp(connector, "7") == 0 || strcmp(connector, "8") == 0){
  179. result= 4;//AC
  180. }
  181. else{
  182. result= 0;
  183. }
  184. return result;
  185. }
  186. int ModelType(char* type,char* network){
  187. int result=0;
  188. if(strcmp(type, "A") == 0){
  189. if(strcmp(network, "0") == 0 || strcmp(network, "R") == 0 || strcmp(network, "B") == 0){
  190. result=0;
  191. }
  192. else if(strcmp(network, "E") == 0 || strcmp(network, "W") == 0 || strcmp(network, "T") == 0 || strcmp(network, "U") == 0){
  193. result=1;
  194. }
  195. }
  196. else if(strcmp(type, "D") == 0){
  197. result=2;
  198. }
  199. return result;
  200. }
  201. // 四捨五入 取到 小數點第 2 位
  202. float rounding(float a)
  203. {
  204. return (int)(a*100+0.5)/100.0;
  205. }
  206. //==========================================
  207. // Init all share memory
  208. //==========================================
  209. int InitShareMemory() {
  210. int result = PASS;
  211. int MeterSMId;
  212. //creat ShmSysConfigAndInfo
  213. if ((MeterSMId = shmget(ShmSysConfigAndInfoKey,
  214. sizeof(struct SysConfigAndInfo), 0777)) < 0) {
  215. printf("%s\n","InitShareMemory Error");
  216. #ifdef SystemLogMessage
  217. DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
  218. #endif
  219. result = FAIL;
  220. } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0))
  221. == (void *) -1) {
  222. #ifdef SystemLogMessage
  223. DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
  224. #endif
  225. result = FAIL;
  226. } else {
  227. }
  228. //creat ShmBatteryInfo
  229. if ((MeterSMId = shmget(ShmBatteryInfoKey,
  230. sizeof(struct BatteryInfoData), 0777)) < 0) {
  231. printf("%s\n","InitShareMemory Error");
  232. #ifdef SystemLogMessage
  233. DEBUG_ERROR("shmget ShmBatteryInfo NG\n");
  234. #endif
  235. result = FAIL;
  236. } else if ((ShmBatteryInfo = shmat(MeterSMId, NULL, 0))
  237. == (void *) -1) {
  238. #ifdef SystemLogMessage
  239. DEBUG_ERROR("shmat ShmBatteryInfo NG\n");
  240. #endif
  241. result = FAIL;
  242. } else {
  243. }
  244. //creat ShmEMSSInfo
  245. if ((MeterSMId = shmget(ShmEMSSInfoKey,
  246. sizeof(struct EMSSInfoData), 0777)) < 0) {
  247. printf("%s\n","InitShareMemory Error");
  248. #ifdef SystemLogMessage
  249. DEBUG_ERROR("shmget ShmEMSSInfo NG\n");
  250. #endif
  251. result = FAIL;
  252. } else if ((ShmEMSSInfo = shmat(MeterSMId, NULL, 0))
  253. == (void *) -1) {
  254. #ifdef SystemLogMessage
  255. DEBUG_ERROR("shmat ShmEMSSInfo NG\n");
  256. #endif
  257. result = FAIL;
  258. } else {
  259. }
  260. return result;
  261. }
  262. int StoreUsrConfigData(struct SysConfigData *UsrData)
  263. {
  264. int result = PASS;
  265. int fd,wrd;
  266. unsigned int i,Chk;
  267. unsigned char *ptr, *BufTmp;
  268. Chk=0;
  269. ptr=(unsigned char *)UsrData;
  270. if((BufTmp=malloc(MtdBlockSize))!=NULL)
  271. {
  272. memset(BufTmp,0,MtdBlockSize);
  273. memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
  274. for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
  275. Chk+=*(BufTmp+i);
  276. memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
  277. // Output configuration to file.
  278. fd = open("/mnt/EvseConfig.bin", O_RDWR|O_CREAT);
  279. if (fd < 0)
  280. {
  281. DEBUG_ERROR("open /mnt/EvseConfig.bin NG\n");
  282. free(BufTmp);
  283. return 0;
  284. }
  285. wrd=write(fd, BufTmp, MtdBlockSize);
  286. close(fd);
  287. if(wrd<MtdBlockSize)
  288. {
  289. DEBUG_ERROR("write /mnt/EvseConfig.bin NG\n");
  290. free(BufTmp);
  291. return 0;
  292. }
  293. DEBUG_INFO("EvseConfig write to file in /mnt OK.\n");
  294. DEBUG_INFO("Erase /dev/mtd10.\n");
  295. runShellCmd("flash_erase /dev/mtd10 0 0");
  296. DEBUG_INFO("Write /dev/mtd10.\n");
  297. runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
  298. DEBUG_INFO("Erase /dev/mtd11.\n");
  299. runShellCmd("flash_erase /dev/mtd11 0 0");
  300. DEBUG_INFO("Write /dev/mtd11.\n");
  301. runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
  302. system("rm -f /mnt/EvseConfig.bin");
  303. DEBUG_INFO("EvseConfig write to flash OK\n");
  304. }
  305. else
  306. {
  307. DEBUG_ERROR("alloc BlockSize NG\r\n");
  308. result = FAIL;
  309. }
  310. if(BufTmp!=NULL)
  311. free(BufTmp);
  312. return result;
  313. }
  314. struct MemoryStruct
  315. {
  316. uint8_t memory[4096];
  317. size_t size;
  318. };
  319. struct MemoryStruct chunk;
  320. /**
  321. * HTTP get/post data response callback
  322. * @param contents
  323. * @param size
  324. * @param nmemb
  325. * @param userp
  326. */
  327. static size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
  328. {
  329. size_t realsize = size*nmemb;
  330. struct MemoryStruct *mem = (struct MemoryStruct *)userp;
  331. mem->size = realsize;;
  332. memset(mem->memory, 0x00, ARRAY_SIZE(mem->memory));
  333. chunk.size = realsize;
  334. memcpy(mem->memory, contents, realsize);
  335. return realsize;
  336. }
  337. //================================================
  338. // Main process
  339. //================================================
  340. int main(int argc, char *argv[]) {
  341. //int InitShMry = 1;
  342. if (InitShareMemory() == FAIL) {
  343. //InitShMry = 0;
  344. #ifdef SystemLogMessage
  345. DEBUG_ERROR("InitShareMemory NG\n");
  346. #endif
  347. // if (ShmStatusCodeData != NULL) {
  348. // ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
  349. // }
  350. sleep(5);
  351. return 0;
  352. }
  353. //web page submit
  354. if ((argc == 3) & (strlen(argv[1]) == 1)) {
  355. //web page submit system
  356. if (strcmp(argv[1], "1") == 0) {
  357. struct json_object *jobj = json_tokener_parse(argv[2]);
  358. json_object *val_obj = NULL;
  359. int isRelay1 = 0;
  360. int isRelay2 = 0;
  361. if( json_object_object_get_ex(jobj, "isRelay1", &val_obj) ) {
  362. isRelay1 = json_object_get_int(val_obj);
  363. if(isRelay1==1){
  364. ShmBatteryInfo->packActionCmd.packAction.bits.Relay1On = 1;
  365. }
  366. else{
  367. ShmBatteryInfo->packActionCmd.packAction.bits.Relay1Off = 1;
  368. }
  369. }
  370. if( json_object_object_get_ex(jobj, "isRelay2", &val_obj) ) {
  371. isRelay2 = json_object_get_int(val_obj);
  372. if(isRelay2==1){
  373. ShmBatteryInfo->packActionCmd.packAction.bits.Relay2On = 1;
  374. }
  375. else{
  376. ShmBatteryInfo->packActionCmd.packAction.bits.Relay2Off = 1;
  377. }
  378. }
  379. }
  380. if (strcmp(argv[1], "2") == 0) {
  381. struct json_object *jobj = json_tokener_parse(argv[2]);
  382. json_object *val_obj = NULL;
  383. int MaxChargingEnergy= 0;
  384. int MaxChargingPower = 0;
  385. int MaxChargingCurrent = 0;
  386. int AcMaxChargingCurrent = 0;
  387. int MaxChargingDuration = 0;
  388. int StopChargingByButton = 0;
  389. char *LocalWhiteCard0 = NULL;
  390. char *LocalWhiteCard1 = NULL;
  391. char *LocalWhiteCard2 = NULL;
  392. char *LocalWhiteCard3 = NULL;
  393. char *LocalWhiteCard4 = NULL;
  394. char *LocalWhiteCard5 = NULL;
  395. char *LocalWhiteCard6 = NULL;
  396. char *LocalWhiteCard7 = NULL;
  397. char *LocalWhiteCard8 = NULL;
  398. char *LocalWhiteCard9 = NULL;
  399. char isBilling = 0;
  400. char Currency = 0;
  401. float Fee0 = 0;
  402. float Fee1 = 0;
  403. float Fee2 = 0;
  404. float Fee3 = 0;
  405. float Fee4 = 0;
  406. float Fee5 = 0;
  407. float Fee6 = 0;
  408. float Fee7 = 0;
  409. float Fee8 = 0;
  410. float Fee9 = 0;
  411. float Fee10 = 0;
  412. float Fee11 = 0;
  413. float Fee12 = 0;
  414. float Fee13 = 0;
  415. float Fee14 = 0;
  416. float Fee15 = 0;
  417. float Fee16 = 0;
  418. float Fee17 = 0;
  419. float Fee18 = 0;
  420. float Fee19 = 0;
  421. float Fee20 = 0;
  422. float Fee21 = 0;
  423. float Fee22 = 0;
  424. float Fee23 = 0;
  425. if( json_object_object_get_ex(jobj, "MaxChargingEnergy", &val_obj) ) {
  426. MaxChargingEnergy = json_object_get_int(val_obj);
  427. ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy = MaxChargingEnergy;
  428. }
  429. if( json_object_object_get_ex(jobj, "MaxChargingPower", &val_obj) ) {
  430. MaxChargingPower = json_object_get_int(val_obj);
  431. ShmSysConfigAndInfo->SysConfig.MaxChargingPower = MaxChargingPower;
  432. }
  433. if( json_object_object_get_ex(jobj, "MaxChargingCurrent", &val_obj) ) {
  434. MaxChargingCurrent = json_object_get_int(val_obj);
  435. ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent = MaxChargingCurrent;
  436. }
  437. if( json_object_object_get_ex(jobj, "AcMaxChargingCurrent", &val_obj) ) {
  438. AcMaxChargingCurrent = json_object_get_int(val_obj);
  439. ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent = AcMaxChargingCurrent;
  440. }
  441. if( json_object_object_get_ex(jobj, "MaxChargingDuration", &val_obj) ) {
  442. MaxChargingDuration = json_object_get_int(val_obj);
  443. ShmSysConfigAndInfo->SysConfig.MaxChargingDuration = MaxChargingDuration;
  444. }
  445. if( json_object_object_get_ex(jobj, "StopChargingByButton", &val_obj) ) {
  446. StopChargingByButton = json_object_get_int(val_obj);
  447. ShmSysConfigAndInfo->SysConfig.StopChargingByButton = StopChargingByButton;
  448. }
  449. if( json_object_object_get_ex(jobj, "LocalWhiteCard0", &val_obj) ) {
  450. LocalWhiteCard0 = (char*)json_object_get_string(val_obj);
  451. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0],LocalWhiteCard0);
  452. }
  453. if( json_object_object_get_ex(jobj, "LocalWhiteCard1", &val_obj) ) {
  454. LocalWhiteCard1 = (char*)json_object_get_string(val_obj);
  455. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1],LocalWhiteCard1);
  456. }
  457. if( json_object_object_get_ex(jobj, "LocalWhiteCard2", &val_obj) ) {
  458. LocalWhiteCard2 = (char*)json_object_get_string(val_obj);
  459. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2],LocalWhiteCard2);
  460. }
  461. if( json_object_object_get_ex(jobj, "LocalWhiteCard3", &val_obj) ) {
  462. LocalWhiteCard3 = (char*)json_object_get_string(val_obj);
  463. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3],LocalWhiteCard3);
  464. }
  465. if( json_object_object_get_ex(jobj, "LocalWhiteCard4", &val_obj) ) {
  466. LocalWhiteCard4 = (char*)json_object_get_string(val_obj);
  467. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4],LocalWhiteCard4);
  468. }
  469. if( json_object_object_get_ex(jobj, "LocalWhiteCard5", &val_obj) ) {
  470. LocalWhiteCard5 = (char*)json_object_get_string(val_obj);
  471. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5],LocalWhiteCard5);
  472. }
  473. if( json_object_object_get_ex(jobj, "LocalWhiteCard6", &val_obj) ) {
  474. LocalWhiteCard6 = (char*)json_object_get_string(val_obj);
  475. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6],LocalWhiteCard6);
  476. }
  477. if( json_object_object_get_ex(jobj, "LocalWhiteCard7", &val_obj) ) {
  478. LocalWhiteCard7 = (char*)json_object_get_string(val_obj);
  479. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7],LocalWhiteCard7);
  480. }
  481. if( json_object_object_get_ex(jobj, "LocalWhiteCard8", &val_obj) ) {
  482. LocalWhiteCard8 = (char*)json_object_get_string(val_obj);
  483. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8],LocalWhiteCard8);
  484. }
  485. if( json_object_object_get_ex(jobj, "LocalWhiteCard9", &val_obj) ) {
  486. LocalWhiteCard9 = (char*)json_object_get_string(val_obj);
  487. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9],LocalWhiteCard9);
  488. }
  489. if( json_object_object_get_ex(jobj, "isBilling", &val_obj) ) {
  490. isBilling = json_object_get_int(val_obj);
  491. ShmSysConfigAndInfo->SysConfig.BillingData.isBilling = isBilling;
  492. }
  493. if( json_object_object_get_ex(jobj, "Currency", &val_obj) ) {
  494. Currency = json_object_get_int(val_obj);
  495. ShmSysConfigAndInfo->SysConfig.BillingData.Currency = Currency;
  496. }
  497. if( json_object_object_get_ex(jobj, "Fee0", &val_obj) ) {
  498. Fee0 = json_object_get_double(val_obj);
  499. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[0] = rounding(Fee0);
  500. }
  501. if( json_object_object_get_ex(jobj, "Fee1", &val_obj) ) {
  502. Fee1 = json_object_get_double(val_obj);
  503. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[1] = rounding(Fee1);
  504. }
  505. if( json_object_object_get_ex(jobj, "Fee2", &val_obj) ) {
  506. Fee2 = json_object_get_double(val_obj);
  507. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[2] = rounding(Fee2);
  508. }
  509. if( json_object_object_get_ex(jobj, "Fee3", &val_obj) ) {
  510. Fee3 = json_object_get_double(val_obj);
  511. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[3] = rounding(Fee3);
  512. }
  513. if( json_object_object_get_ex(jobj, "Fee4", &val_obj) ) {
  514. Fee4 = json_object_get_double(val_obj);
  515. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[4] = rounding(Fee4);
  516. }
  517. if( json_object_object_get_ex(jobj, "Fee5", &val_obj) ) {
  518. Fee5 = json_object_get_double(val_obj);
  519. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[5] = rounding(Fee5);
  520. }
  521. if( json_object_object_get_ex(jobj, "Fee6", &val_obj) ) {
  522. Fee6 = json_object_get_double(val_obj);
  523. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[6] = rounding(Fee6);
  524. }
  525. if( json_object_object_get_ex(jobj, "Fee7", &val_obj) ) {
  526. Fee7 = json_object_get_double(val_obj);
  527. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[7] = rounding(Fee7);
  528. }
  529. if( json_object_object_get_ex(jobj, "Fee8", &val_obj) ) {
  530. Fee8 = json_object_get_double(val_obj);
  531. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[8] = rounding(Fee8);
  532. }
  533. if( json_object_object_get_ex(jobj, "Fee9", &val_obj) ) {
  534. Fee9 = json_object_get_double(val_obj);
  535. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[9] = rounding(Fee9);
  536. }
  537. if( json_object_object_get_ex(jobj, "Fee10", &val_obj) ) {
  538. Fee10 = json_object_get_double(val_obj);
  539. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[10] = rounding(Fee10);
  540. }
  541. if( json_object_object_get_ex(jobj, "Fee11", &val_obj) ) {
  542. Fee11 = json_object_get_double(val_obj);
  543. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[11] = rounding(Fee11);
  544. }
  545. if( json_object_object_get_ex(jobj, "Fee12", &val_obj) ) {
  546. Fee12 = json_object_get_double(val_obj);
  547. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[12] = rounding(Fee12);
  548. }
  549. if( json_object_object_get_ex(jobj, "Fee13", &val_obj) ) {
  550. Fee13 = json_object_get_double(val_obj);
  551. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[13] = rounding(Fee13);
  552. }
  553. if( json_object_object_get_ex(jobj, "Fee14", &val_obj) ) {
  554. Fee14 = json_object_get_double(val_obj);
  555. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[14] = rounding(Fee14);
  556. }
  557. if( json_object_object_get_ex(jobj, "Fee15", &val_obj) ) {
  558. Fee15 = json_object_get_double(val_obj);
  559. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[15] = rounding(Fee15);
  560. }
  561. if( json_object_object_get_ex(jobj, "Fee16", &val_obj) ) {
  562. Fee16 = json_object_get_double(val_obj);
  563. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[16] = rounding(Fee16);
  564. }
  565. if( json_object_object_get_ex(jobj, "Fee17", &val_obj) ) {
  566. Fee17 = json_object_get_double(val_obj);
  567. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[17] = rounding(Fee17);
  568. }
  569. if( json_object_object_get_ex(jobj, "Fee18", &val_obj) ) {
  570. Fee18 = json_object_get_double(val_obj);
  571. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[18] = rounding(Fee18);
  572. }
  573. if( json_object_object_get_ex(jobj, "Fee19", &val_obj) ) {
  574. Fee19 = json_object_get_double(val_obj);
  575. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[19] = rounding(Fee19);
  576. }
  577. if( json_object_object_get_ex(jobj, "Fee20", &val_obj) ) {
  578. Fee20 = json_object_get_double(val_obj);
  579. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[20] = rounding(Fee20);
  580. }
  581. if( json_object_object_get_ex(jobj, "Fee21", &val_obj) ) {
  582. Fee21 = json_object_get_double(val_obj);
  583. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[21] = rounding(Fee21);
  584. }
  585. if( json_object_object_get_ex(jobj, "Fee22", &val_obj) ) {
  586. Fee22 = json_object_get_double(val_obj);
  587. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[22] = rounding(Fee22);
  588. }
  589. if( json_object_object_get_ex(jobj, "Fee23", &val_obj) ) {
  590. Fee23 = json_object_get_double(val_obj);
  591. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[23] = rounding(Fee23);
  592. }
  593. }
  594. if (strcmp(argv[1], "3") == 0) {
  595. struct json_object *jobj = json_tokener_parse(argv[2]);
  596. json_object *val_obj = NULL;
  597. int Eth0DhcpClient=0;
  598. char *Eth0IpAddress=NULL;
  599. char *Eth0SubmaskAddress=NULL;
  600. char *Eth0GatewayAddress=NULL;
  601. int WifiMode=0;
  602. char *WifiSsid=NULL;
  603. char *WifiPassword=NULL;
  604. int WifiDhcpServer=0;
  605. int WifiDhcpClient=0;
  606. char *WifiIpAddress=NULL;
  607. char *WifiSubmaskAddress=NULL;
  608. char *WifiGatewayAddress=NULL;
  609. char *TelcomApn=NULL;
  610. char *TelcomChapPapId=NULL;
  611. char *TelcomChapPapPwd=NULL;
  612. char *TelcomIpAddress=NULL;
  613. char TelcomEnabled=0;
  614. char Wcnt=0;
  615. char Tcnt=0;
  616. if( json_object_object_get_ex(jobj, "Eth0DhcpClient", &val_obj) ) {
  617. Eth0DhcpClient = json_object_get_int(val_obj);
  618. ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=Eth0DhcpClient;
  619. }
  620. if( json_object_object_get_ex(jobj, "Eth0IpAddress", &val_obj) ) {
  621. Eth0IpAddress = (char*)json_object_get_string(val_obj);
  622. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,Eth0IpAddress);
  623. }
  624. if( json_object_object_get_ex(jobj, "Eth0SubmaskAddress", &val_obj) ) {
  625. Eth0SubmaskAddress = (char*)json_object_get_string(val_obj);
  626. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,Eth0SubmaskAddress);
  627. }
  628. if( json_object_object_get_ex(jobj, "Eth0GatewayAddress", &val_obj) ) {
  629. Eth0GatewayAddress = (char*)json_object_get_string(val_obj);
  630. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,Eth0GatewayAddress);
  631. }
  632. if( json_object_object_get_ex(jobj, "WifiMode", &val_obj) ) {
  633. WifiMode = json_object_get_int(val_obj);
  634. if(WifiMode!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode) Wcnt++;
  635. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=WifiMode;
  636. }
  637. if( json_object_object_get_ex(jobj, "WifiSsid", &val_obj) ) {
  638. WifiSsid = (char*)json_object_get_string(val_obj);
  639. if (strcmp(WifiSsid, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid) != 0) Wcnt++;
  640. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,WifiSsid);
  641. }
  642. if( json_object_object_get_ex(jobj, "WifiPassword", &val_obj) ) {
  643. WifiPassword = (char*)json_object_get_string(val_obj);
  644. if (strcmp(WifiSsid, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid) != 0) Wcnt++;
  645. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,WifiPassword);
  646. }
  647. if( json_object_object_get_ex(jobj, "WifiDhcpServer", &val_obj) ) {
  648. WifiDhcpServer = json_object_get_int(val_obj);
  649. if(WifiDhcpServer!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer) Wcnt++;
  650. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=WifiDhcpServer;
  651. }
  652. if( json_object_object_get_ex(jobj, "WifiDhcpClient", &val_obj) ) {
  653. WifiDhcpClient = json_object_get_int(val_obj);
  654. if(WifiDhcpClient!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient) Wcnt++;
  655. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=WifiDhcpClient;
  656. }
  657. if( json_object_object_get_ex(jobj, "WifiIpAddress", &val_obj) ) {
  658. WifiIpAddress = (char*)json_object_get_string(val_obj);
  659. if (strcmp(WifiIpAddress, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress) != 0) Wcnt++;
  660. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,WifiIpAddress);
  661. }
  662. if( json_object_object_get_ex(jobj, "WifiSubmaskAddress", &val_obj) ) {
  663. WifiSubmaskAddress = (char*)json_object_get_string(val_obj);
  664. if (strcmp(WifiSubmaskAddress, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress) != 0) Wcnt++;
  665. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,WifiSubmaskAddress);
  666. }
  667. if( json_object_object_get_ex(jobj, "WifiGatewayAddress", &val_obj) ) {
  668. WifiGatewayAddress = (char*)json_object_get_string(val_obj);
  669. if (strcmp(WifiGatewayAddress, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress) != 0) Wcnt++;
  670. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,WifiGatewayAddress);
  671. }
  672. if( json_object_object_get_ex(jobj, "TelcomApn", &val_obj) ) {
  673. TelcomApn = (char*)json_object_get_string(val_obj);
  674. if (strcmp(TelcomApn, (char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn) != 0) Tcnt++;
  675. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,TelcomApn);
  676. }
  677. if( json_object_object_get_ex(jobj, "TelcomChapPapId", &val_obj) ) {
  678. TelcomChapPapId = (char*)json_object_get_string(val_obj);
  679. if (strcmp(TelcomChapPapId, (char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId) != 0) Tcnt++;
  680. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,TelcomChapPapId);
  681. }
  682. if( json_object_object_get_ex(jobj, "TelcomChapPapPwd", &val_obj) ) {
  683. TelcomChapPapPwd = (char*)json_object_get_string(val_obj);
  684. if (strcmp(TelcomChapPapPwd, (char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd) != 0) Tcnt++;
  685. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,TelcomChapPapPwd);
  686. }
  687. if( json_object_object_get_ex(jobj, "TelcomIpAddress", &val_obj) ) {
  688. TelcomIpAddress = (char*)json_object_get_string(val_obj);
  689. if (strcmp(TelcomIpAddress, (char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress) != 0) Tcnt++;
  690. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,TelcomIpAddress);
  691. }
  692. if( json_object_object_get_ex(jobj, "TelcomEnabled", &val_obj) ) {
  693. TelcomEnabled = json_object_get_int(val_obj);
  694. if(TelcomEnabled!=ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled) Tcnt++;
  695. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled=TelcomEnabled;
  696. }
  697. if(Wcnt>0){
  698. system ("pkill Module_Wifi");
  699. }
  700. if(Tcnt>0){
  701. system ("pkill Module_4g");
  702. }
  703. }
  704. if (strcmp(argv[1], "4") == 0) {
  705. struct json_object *jobj = json_tokener_parse(argv[2]);
  706. json_object *val_obj = NULL;
  707. int BackendConnTimeout=0;
  708. int OfflinePolicy=0;
  709. int OfflineMaxChargeEnergy=0;
  710. int OfflineMaxChargeDuration=0;
  711. char *OcppServerURL=NULL;
  712. char *ChargeBoxId=NULL;
  713. char *chargePointVendor=NULL;
  714. int OcppSecurityProfile=0;
  715. int MaintainServerSecurityProfile=0;
  716. char *OcppSecurityPassword=NULL;
  717. char *MaintainServerSecurityPassword=NULL;
  718. int isEnableLocalPowerSharging=0;
  719. char *OcppReceiptrURL=NULL;
  720. char *MaintainServerURL=NULL;
  721. /*for TTIA*/
  722. char isEnableTTIA=0;
  723. char *server_addr=NULL;
  724. int server_port=0;
  725. int busVenderId=0;
  726. char *EquipmentProvider=NULL;
  727. char TransportationCompanyNo=0;
  728. char TTIAChargeBoxId=0;
  729. char *evseStation=NULL;
  730. if( json_object_object_get_ex(jobj, "BackendConnTimeout", &val_obj) ) {
  731. BackendConnTimeout = json_object_get_int(val_obj);
  732. ShmSysConfigAndInfo->SysConfig.BackendConnTimeout = BackendConnTimeout;
  733. }
  734. if( json_object_object_get_ex(jobj, "OfflinePolicy", &val_obj) ) {
  735. OfflinePolicy = json_object_get_int(val_obj);
  736. ShmSysConfigAndInfo->SysConfig.OfflinePolicy = OfflinePolicy;
  737. }
  738. if( json_object_object_get_ex(jobj, "OfflineMaxChargeEnergy", &val_obj) ) {
  739. OfflineMaxChargeEnergy = json_object_get_int(val_obj);
  740. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy = OfflineMaxChargeEnergy;
  741. }
  742. if( json_object_object_get_ex(jobj, "OfflineMaxChargeDuration", &val_obj) ) {
  743. OfflineMaxChargeDuration = json_object_get_int(val_obj);
  744. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration = OfflineMaxChargeDuration;
  745. }
  746. if( json_object_object_get_ex(jobj, "OcppServerURL", &val_obj) ) {
  747. OcppServerURL = (char*)json_object_get_string(val_obj);
  748. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,OcppServerURL);
  749. }
  750. if( json_object_object_get_ex(jobj, "ChargeBoxId", &val_obj) ) {
  751. ChargeBoxId = (char*)json_object_get_string(val_obj);
  752. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,ChargeBoxId);
  753. }
  754. if( json_object_object_get_ex(jobj, "chargePointVendor", &val_obj) ) {
  755. chargePointVendor = (char*)json_object_get_string(val_obj);
  756. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor,chargePointVendor);
  757. }
  758. if( json_object_object_get_ex(jobj, "OcppSecurityProfile", &val_obj) ) {
  759. OcppSecurityProfile = json_object_get_int(val_obj);
  760. ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile = OcppSecurityProfile;
  761. }
  762. if( json_object_object_get_ex(jobj, "OcppSecurityPassword", &val_obj) ) {
  763. OcppSecurityPassword = (char*)json_object_get_string(val_obj);
  764. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword,OcppSecurityPassword);
  765. }
  766. if( json_object_object_get_ex(jobj, "MaintainServerSecurityProfile", &val_obj) ) {
  767. MaintainServerSecurityProfile = json_object_get_int(val_obj);
  768. ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile = MaintainServerSecurityProfile;
  769. }
  770. if( json_object_object_get_ex(jobj, "MaintainServerSecurityPassword", &val_obj) ) {
  771. MaintainServerSecurityPassword = (char*)json_object_get_string(val_obj);
  772. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityPassword,MaintainServerSecurityPassword);
  773. }
  774. if( json_object_object_get_ex(jobj, "isEnableLocalPowerSharging", &val_obj) ) {
  775. isEnableLocalPowerSharging = json_object_get_int(val_obj);
  776. ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging = isEnableLocalPowerSharging;
  777. }
  778. if( json_object_object_get_ex(jobj, "OcppReceiptrURL", &val_obj) ) {
  779. OcppReceiptrURL = (char*)json_object_get_string(val_obj);
  780. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL,OcppReceiptrURL);
  781. }
  782. if( json_object_object_get_ex(jobj, "MaintainServerURL", &val_obj) ) {
  783. MaintainServerURL = (char*)json_object_get_string(val_obj);
  784. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL,MaintainServerURL);
  785. }
  786. /*for TTIA*/
  787. if( json_object_object_get_ex(jobj, "isEnableTTIA", &val_obj) ) {
  788. isEnableTTIA = json_object_get_int(val_obj);
  789. ShmSysConfigAndInfo->SysConfig.TTIA_Info.isEnableTTIA = isEnableTTIA;
  790. }
  791. if( json_object_object_get_ex(jobj, "server_addr", &val_obj) ) {
  792. server_addr = (char*)json_object_get_string(val_obj);
  793. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_addr,server_addr);
  794. }
  795. if( json_object_object_get_ex(jobj, "server_port", &val_obj) ) {
  796. server_port = json_object_get_int(val_obj);
  797. ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_port = server_port;
  798. }
  799. if( json_object_object_get_ex(jobj, "busVenderId", &val_obj) ) {
  800. busVenderId = json_object_get_int(val_obj);
  801. ShmSysConfigAndInfo->SysConfig.TTIA_Info.busVenderId = busVenderId;
  802. }
  803. if( json_object_object_get_ex(jobj, "EquipmentProvider", &val_obj) ) {
  804. EquipmentProvider = (char*)json_object_get_string(val_obj);
  805. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TTIA_Info.EquipmentProvider,EquipmentProvider);
  806. }
  807. if( json_object_object_get_ex(jobj, "TransportationCompanyNo", &val_obj) ) {
  808. TransportationCompanyNo = json_object_get_int(val_obj);
  809. ShmSysConfigAndInfo->SysConfig.TTIA_Info.TransportationCompanyNo = TransportationCompanyNo;
  810. }
  811. if( json_object_object_get_ex(jobj, "TTIAChargeBoxId", &val_obj) ) {
  812. TTIAChargeBoxId = json_object_get_int(val_obj);
  813. ShmSysConfigAndInfo->SysConfig.TTIA_Info.ChargeBoxId = TTIAChargeBoxId;
  814. }
  815. if( json_object_object_get_ex(jobj, "evseStation", &val_obj) ) {
  816. evseStation = (char*)json_object_get_string(val_obj);
  817. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TTIA_Info.evseStation,evseStation);
  818. }
  819. }
  820. struct SysConfigData SysConfig;
  821. memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
  822. struct BatteryInfoData BatteryInfo;
  823. memcpy(&BatteryInfo, &ShmBatteryInfo, sizeof(struct BatteryInfoData));
  824. int result = StoreUsrConfigData(&SysConfig);
  825. int result2 = StoreUsrConfigData(&BatteryInfo);
  826. if(result != 1 && result2 != 1){
  827. #ifdef SystemLogMessage
  828. StoreLogMsg("[WebService]StoreUsrConfigData: normal NG");
  829. #endif
  830. }
  831. else{
  832. #ifdef SystemLogMessage
  833. StoreLogMsg("[WebService]StoreUsrConfigData: normal OK");
  834. #endif
  835. }
  836. #ifdef SystemLogMessage
  837. DEBUG_INFO("WebServiceConfig update OK");
  838. #endif
  839. }
  840. if (argc == 2)
  841. { //init share memory for test
  842. if (strcmp(argv[1], "aaa") == 0)
  843. {
  844. //struct SysConfigData SysConfig;
  845. //system
  846. ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity=1;
  847. ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=1;
  848. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ModelName, "DO0E362001D1P0D");
  849. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber, "SerialNumber");
  850. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
  851. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
  852. ShmSysConfigAndInfo->SysConfig.AcPhaseCount=1;
  853. ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
  854. ShmSysConfigAndInfo->SysInfo.FactoryConfiguration=0;
  855. ShmSysConfigAndInfo->SysConfig.AuthorisationMode=0;
  856. ShmSysConfigAndInfo->SysConfig.DefaultLanguage=0;
  857. ShmSysConfigAndInfo->SysInfo.InputVoltageR=0;
  858. ShmSysConfigAndInfo->SysInfo.InputVoltageS=0;
  859. ShmSysConfigAndInfo->SysInfo.InputVoltageT=0;
  860. ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed=0;
  861. ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0;
  862. ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian=0;
  863. ShmSysConfigAndInfo->SysConfig.RatingCurrent=100;
  864. ShmSysConfigAndInfo->SysConfig.PsuAcInputType=0;
  865. ShmSysConfigAndInfo->SysInfo.AuxPower5V=0;
  866. ShmSysConfigAndInfo->SysInfo.AuxPower12V=0;
  867. ShmSysConfigAndInfo->SysInfo.AuxPower24V=0;
  868. ShmSysConfigAndInfo->SysInfo.AuxPower48V=0;
  869. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev, "");
  870. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, "");
  871. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "");
  872. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "");
  873. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, "");
  874. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev, "");
  875. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev, "");
  876. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev, "");
  877. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev, "");
  878. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev, "");
  879. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev, "");
  880. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev, "");
  881. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev, "");
  882. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, "");
  883. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev, "");
  884. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, "");
  885. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev, "");
  886. ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp=0;
  887. ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp=0;
  888. ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp=0;
  889. ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp=0;
  890. ShmSysConfigAndInfo->SysConfig.AcPlugInTimes=0;
  891. ShmSysConfigAndInfo->SysConfig.GbPlugInTimes=0;
  892. ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime=0;
  893. ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes=0;
  894. ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes=0;
  895. //charging
  896. ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy=0;
  897. ShmSysConfigAndInfo->SysConfig.MaxChargingPower=0;
  898. ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0;
  899. ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent= 0;
  900. ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0;
  901. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111");
  902. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222");
  903. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333");
  904. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3], "444");
  905. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4], "555");
  906. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5], "666");
  907. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6], "777");
  908. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7], "888");
  909. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8], "999");
  910. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9], "aaa");
  911. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.UserId, "UserId");
  912. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage=0;
  913. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent=0;
  914. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingPower=0;
  915. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedEnergy=0;
  916. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedDuration=0;
  917. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].RemainChargingDuration=0;
  918. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatteryMaxVoltage=0;
  919. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetVoltage=0;
  920. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterySoc=0;
  921. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus=1;
  922. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetCurrent=1;
  923. //network
  924. ShmSysConfigAndInfo->SysInfo.InternetConn=0;
  925. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,"");
  926. ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=1;
  927. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress,"");
  928. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,"192.168.1.20");
  929. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,"255.255.255.0");
  930. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,"192.168.1.1");
  931. ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=1;
  932. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress,"");
  933. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,"192.168.0.10");
  934. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,"255.255.255.0");
  935. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,"192.168.0.1");
  936. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=1;
  937. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,"");
  938. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,"");
  939. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi=0;
  940. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=0;
  941. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=0;
  942. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress,"");
  943. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,"");
  944. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,"");
  945. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,"");
  946. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn=1;
  947. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,"");
  948. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi=0;
  949. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,"");
  950. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,"");
  951. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei,"");
  952. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi,"");
  953. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid,"");
  954. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus=0;
  955. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode=0;
  956. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,"");
  957. //backend
  958. ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=300;
  959. ShmSysConfigAndInfo->SysConfig.OfflinePolicy=0;
  960. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy=0;
  961. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration=0;
  962. ShmSysConfigAndInfo->SysInfo.OcppConnStatus=0;
  963. ShmSysConfigAndInfo->SysInfo.MaintainServerConnStatus=0;
  964. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"");
  965. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"");
  966. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor,"Phihong");
  967. ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=0;
  968. struct SysConfigData SysConfig;
  969. memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
  970. StoreUsrConfigData(&SysConfig);
  971. #ifdef SystemLogMessage
  972. DEBUG_INFO("WebService initial OK");
  973. #endif
  974. }
  975. if (strcmp(argv[1], "restart") == 0)
  976. {
  977. system("exec /usr/bin/run_evse_restart.sh");
  978. }
  979. }
  980. if(strcmp(argv[1], "log") == 0)
  981. {
  982. char cmd[512];
  983. if((argc == 3) && isdigit(*argv[2]))
  984. {
  985. sprintf(cmd, "exec /root/logPackTools 'log' %s", argv[2]);
  986. }
  987. else
  988. {
  989. sprintf(cmd, "exec /root/logPackTools 'log'");
  990. }
  991. if(system(cmd) == 0)
  992. {
  993. DEBUG_INFO("Log pack success.\n");
  994. }
  995. else
  996. {
  997. DEBUG_INFO("Log pack fail.\n");
  998. }
  999. }
  1000. //upgrade firmware
  1001. if ((argc == 3) & (strcmp(argv[1], "upgrade") == 0))
  1002. {
  1003. struct json_object *jobj;
  1004. struct json_object *Result;
  1005. struct json_object *Message;
  1006. //char cmd[100];
  1007. jobj=json_object_new_object();
  1008. //system
  1009. //if((char)ShmSysConfigAndInfo->SysInfo.FirmwareUpdate == '0'){
  1010. ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=1;
  1011. Result = json_object_new_string("success");
  1012. Message = json_object_new_string("File is uploaded, please wait a moment to upgrade");
  1013. //}
  1014. /*else{
  1015. sprintf(cmd,"rm /mnt/%s",argv[2]);
  1016. system(cmd);
  1017. Result = json_object_new_string("error");
  1018. Message = json_object_new_string("machine is busy");
  1019. }*/
  1020. json_object_object_add(jobj,"Result",Result);
  1021. json_object_object_add(jobj,"Message",Message);
  1022. printf("%s\n", json_object_to_json_string(jobj));
  1023. }
  1024. //read charging info
  1025. if ((strcmp(argv[1], "readCharging") == 0))
  1026. {
  1027. struct json_object *jobj;
  1028. struct json_object *Result;
  1029. struct json_object *Message;
  1030. //char cmd[100];
  1031. jobj=json_object_new_object();
  1032. char source[1024]="";
  1033. if(argc > 2){
  1034. sprintf(source,"%s",argv[2]);
  1035. }
  1036. //A2D
  1037. char *host0="https://192.168.1.22/get_query_action.php?opt=2";
  1038. //D2D
  1039. char *host1="https://192.168.1.23/get_query_action.php?opt=2";
  1040. // char *hosta=argv[2];
  1041. // int port=argv[3];
  1042. // char *method="GET";
  1043. // char *method=argv[4];
  1044. // char *path="/get_query_action.php?opt=2";
  1045. // char *path=argv[5];
  1046. // char *data="";
  1047. // char *data=argv[6];
  1048. uint8_t res[4096];
  1049. // read info of AC/DC
  1050. if(strcmp(source,"A2D") == 0 || (argc == 2)){
  1051. if(httpGet((uint8_t*)host0,res)!= FAIL){
  1052. struct json_object *jobj = json_tokener_parse((char*)res);
  1053. json_object *val_obj = NULL;
  1054. json_object *val_obj2 = NULL;
  1055. // struct json_object *DDChargingInfo1;
  1056. // struct json_object *DDChargingInfo2;
  1057. unsigned char SystemStatus; //0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
  1058. int BackendConnTimeout=0;
  1059. val_obj = NULL;
  1060. val_obj2 = NULL;
  1061. SystemStatus = 0;
  1062. if( json_object_object_get_ex(jobj, "DDChargingInfo1", &val_obj) ) {
  1063. //DEBUG_INFO("A2D gun1:%s\r\n",val_obj);
  1064. if( json_object_object_get_ex(val_obj, "SystemStatus", &val_obj2) ) {
  1065. //DEBUG_INFO("A2D gun1 SystemStatus0:%s\r\n",val_obj2);
  1066. SystemStatus = json_object_get_int(val_obj2);
  1067. //DEBUG_INFO("A2D gun1 SystemStatus1:%d\r\n",SystemStatus);
  1068. ShmSysConfigAndInfo->SysInfo.ConnectorInfo[0].GeneralChargingData.SystemStatus=SystemStatus;
  1069. }
  1070. }
  1071. val_obj = NULL;
  1072. val_obj2 = NULL;
  1073. SystemStatus = 0;
  1074. if( json_object_object_get_ex(jobj, "DDChargingInfo2", &val_obj) ) {
  1075. //DEBUG_INFO("A2D gun2:%s\r\n",val_obj);
  1076. if( json_object_object_get_ex(val_obj, "SystemStatus", &val_obj2) ) {
  1077. //DEBUG_INFO("A2D gun2 SystemStatus0:%s\r\n",val_obj2);
  1078. SystemStatus = json_object_get_int(val_obj2);
  1079. //DEBUG_INFO("A2D gun2 SystemStatus1:%d\r\n",SystemStatus);
  1080. ShmSysConfigAndInfo->SysInfo.ConnectorInfo[1].GeneralChargingData.SystemStatus=SystemStatus;
  1081. }
  1082. }
  1083. }
  1084. }
  1085. if(strcmp(source,"D2D") == 0 || (argc == 2)){
  1086. if(httpGet((uint8_t*)host1,res)!= FAIL){
  1087. struct json_object *jobj = json_tokener_parse((char*)res);
  1088. json_object *val_obj = NULL;
  1089. json_object *val_obj2 = NULL;
  1090. // struct json_object *DDChargingInfo1;
  1091. // struct json_object *DDChargingInfo2;
  1092. unsigned char SystemStatus; //0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
  1093. val_obj = NULL;
  1094. val_obj2 = NULL;
  1095. SystemStatus = 0;
  1096. if( json_object_object_get_ex(jobj, "DDChargingInfo1", &val_obj) ) {
  1097. //DEBUG_INFO("D2D gun1:%s\r\n",val_obj);
  1098. if( json_object_object_get_ex(val_obj, "SystemStatus", &val_obj2) ) {
  1099. //DEBUG_INFO("D2D gun1 SystemStatus0:%s\r\n",val_obj2);
  1100. SystemStatus = json_object_get_int(val_obj2);
  1101. //DEBUG_INFO("D2D gun2 SystemStatus1:%d\r\n",SystemStatus);
  1102. ShmSysConfigAndInfo->SysInfo.ConnectorInfo[2].GeneralChargingData.SystemStatus=SystemStatus;
  1103. }
  1104. }
  1105. val_obj = NULL;
  1106. val_obj2 = NULL;
  1107. SystemStatus = 0;
  1108. if( json_object_object_get_ex(jobj, "DDChargingInfo2", &val_obj) ) {
  1109. //DEBUG_INFO("D2D gun2:%s\r\n",val_obj);
  1110. if( json_object_object_get_ex(val_obj, "SystemStatus", &val_obj2) ) {
  1111. //DEBUG_INFO("D2D gun2 SystemStatus0:%s\r\n",val_obj2);
  1112. SystemStatus = json_object_get_int(val_obj2);
  1113. //DEBUG_INFO("D2D gun2 SystemStatus1:%d\r\n",SystemStatus);
  1114. ShmSysConfigAndInfo->SysInfo.ConnectorInfo[3].GeneralChargingData.SystemStatus=SystemStatus;
  1115. }
  1116. }
  1117. }
  1118. }
  1119. }
  1120. //start charging
  1121. if ((strcmp(argv[1], "startCharging") == 0))
  1122. {
  1123. struct json_object *jobj;
  1124. struct json_object *Result;
  1125. struct json_object *Message;
  1126. //char cmd[100];
  1127. jobj=json_object_new_object();
  1128. char Cmd=1;
  1129. char *p;
  1130. int FTargetVoltage=atoi(argv[2]); // target voltage, unit: 0.1V
  1131. int FTargetCurrent=atoi(argv[3]); // target current, unit: 0.1A
  1132. char host0[256];
  1133. sprintf(host0,"https://192.168.1.22/set_pcabinet_action.php?Cmd=1&Gun=0&FTargetVoltage=%d&FTargetCurrent=%d",FTargetVoltage,FTargetCurrent);
  1134. uint8_t data[4096];
  1135. uint8_t res[4096];
  1136. // forcing charging
  1137. if(Cmd == 1){
  1138. if(httpGet((uint8_t*)host0,res)!= FAIL){
  1139. Result = json_object_new_string("success");
  1140. Message = json_object_new_string("Start forcing charging");
  1141. }
  1142. else{
  1143. Result = json_object_new_string("error");
  1144. Message = json_object_new_string("something went wrong");
  1145. }
  1146. json_object_object_add(jobj,"Result",Result);
  1147. json_object_object_add(jobj,"Message",Message);
  1148. printf("%s\n", json_object_to_json_string(jobj));
  1149. }
  1150. }
  1151. //stop charging
  1152. if ((strcmp(argv[1], "stopCharging") == 0))
  1153. {
  1154. struct json_object *jobj;
  1155. struct json_object *Result;
  1156. struct json_object *Message;
  1157. //char cmd[100];
  1158. jobj=json_object_new_object();
  1159. char Cmd=2;
  1160. char host0[256]="https://192.168.1.22/set_pcabinet_action.php?Cmd=2&Gun=0";
  1161. uint8_t data[4096];
  1162. uint8_t res[4096];
  1163. // stop forcing charging
  1164. if(Cmd == 2){
  1165. if(httpGet((uint8_t*)host0,res)!= FAIL){
  1166. Result = json_object_new_string("success");
  1167. Message = json_object_new_string("Start forcing charging");
  1168. }
  1169. else{
  1170. Result = json_object_new_string("error");
  1171. Message = json_object_new_string("something went wrong");
  1172. }
  1173. json_object_object_add(jobj,"Result",Result);
  1174. json_object_object_add(jobj,"Message",Message);
  1175. printf("%s\n", json_object_to_json_string(jobj));
  1176. }
  1177. }
  1178. //change charging
  1179. if ((strcmp(argv[1], "changeCharging") == 0))
  1180. {
  1181. struct json_object *jobj;
  1182. struct json_object *Result;
  1183. struct json_object *Message;
  1184. //char cmd[100];
  1185. jobj=json_object_new_object();
  1186. char Cmd=1;
  1187. char *p;
  1188. char *changeItem =argv[2]; // want to change value
  1189. char *changeValue =argv[3]; // want to change value
  1190. char host0[256];
  1191. sprintf(host0,"https://192.168.1.22/set_charging_action.php");
  1192. uint8_t data[4096];
  1193. uint8_t res[4096];
  1194. sprintf(data,"%s=%s",changeItem,changeValue);
  1195. if(httpPost((uint8_t*)host0,data,res)!= FAIL){
  1196. Result = json_object_new_string("success");
  1197. Message = json_object_new_string(data);
  1198. ShmEMSSInfo->TransferStatus=1;
  1199. }
  1200. else{
  1201. Result = json_object_new_string("error");
  1202. Message = json_object_new_string("something went wrong");
  1203. ShmEMSSInfo->TransferStatus=2;
  1204. }
  1205. json_object_object_add(jobj,"Result",Result);
  1206. json_object_object_add(jobj,"Message",Message);
  1207. printf("%s\n", json_object_to_json_string(jobj));
  1208. }
  1209. //web page query all
  1210. if ((argc == 2) & (strcmp(argv[1], "query") == 0)) {
  1211. struct json_object *jobj1;
  1212. //system
  1213. struct json_object *SystemStatus;
  1214. struct json_object *PreviousSystemStatus;
  1215. struct json_object *SOC;
  1216. struct json_object *outputCurrent;
  1217. struct json_object *inputCurrent;
  1218. struct json_object *isRelay1;
  1219. struct json_object *isRelay2;
  1220. struct json_object *isUVP;
  1221. struct json_object *isOVP;
  1222. struct json_object *isOTP;
  1223. struct json_object *isChargingOCP;
  1224. struct json_object *isDischargingOCP;
  1225. struct json_object *isTransmissionFailure;
  1226. struct json_object *PackInfo;
  1227. struct json_object *TotalVoltage;
  1228. int intTotalVoltage=0;
  1229. //module
  1230. struct json_object *temperature;
  1231. // struct json_object *isModuleOVP;
  1232. // struct json_object *isModuleUVP;
  1233. // struct json_object *isModuleOTP;
  1234. struct json_object *ModuleInfo;
  1235. //cell
  1236. struct json_object *voltage;
  1237. // struct json_object *isCellOVP;
  1238. // struct json_object *isCellUVP;
  1239. struct json_object *CellInfo;
  1240. struct json_object *systemInfoArr= json_object_new_array();
  1241. struct json_object *packInfoArr= json_object_new_array();
  1242. struct json_object *moduleInfoArr= json_object_new_array();
  1243. jobj1=json_object_new_object();
  1244. ModuleInfo=json_object_new_object();
  1245. CellInfo=json_object_new_object();
  1246. //system
  1247. SystemStatus = json_object_new_int(ShmBatteryInfo->SystemStatus);
  1248. PreviousSystemStatus = json_object_new_int(ShmBatteryInfo->PreviousSystemStatus);
  1249. SOC = json_object_new_int(ShmBatteryInfo->SOC);
  1250. outputCurrent = json_object_new_int(ShmBatteryInfo->outputCurrent);
  1251. inputCurrent = json_object_new_int(ShmBatteryInfo->inputCurrent);
  1252. isRelay1 = json_object_new_int(ShmBatteryInfo->RelayInfo.bits.isRelay1);
  1253. isRelay2 = json_object_new_int(ShmBatteryInfo->RelayInfo.bits.isRelay2);
  1254. isUVP = json_object_new_int(ShmBatteryInfo->AlarmInfo.bits.isUVP);
  1255. isOVP = json_object_new_int(ShmBatteryInfo->AlarmInfo.bits.isOVP);
  1256. isOTP = json_object_new_int(ShmBatteryInfo->AlarmInfo.bits.isOTP);
  1257. isChargingOCP = json_object_new_int(ShmBatteryInfo->AlarmInfo.bits.isChargingOCP);
  1258. isDischargingOCP = json_object_new_int(ShmBatteryInfo->AlarmInfo.bits.isDischargingOCP);
  1259. isTransmissionFailure = json_object_new_int(ShmBatteryInfo->AlarmInfo.bits.isTransmissionFailure);
  1260. for(int i=0;i<5;i++){
  1261. for(int j=0;j<3;j++){
  1262. for(int k=0;k<16;k++){
  1263. CellInfo=json_object_new_object();
  1264. intTotalVoltage+=ShmBatteryInfo->packInfo[i].moduleInfo[j].cellVoltage[k];
  1265. voltage = json_object_new_int(ShmBatteryInfo->packInfo[i].moduleInfo[j].cellVoltage[k]);
  1266. // isCellOVP = json_object_new_int(ShmBatteryInfo->packInfo[i].moduleInfo[j].cellInfo[k].isOVP);
  1267. // isCellUVP = json_object_new_int(ShmBatteryInfo->packInfo[i].moduleInfo[j].cellInfo[k].isUVP);
  1268. json_object_object_add(CellInfo,"voltage",voltage);
  1269. // json_object_object_add(CellInfo,"isCellOVP",isCellOVP);
  1270. // json_object_object_add(CellInfo,"isCellUVP",isCellUVP);
  1271. json_object_array_add(moduleInfoArr,CellInfo);
  1272. }
  1273. ModuleInfo=json_object_new_object();
  1274. json_object_object_add(ModuleInfo,"ModuleInfo",moduleInfoArr);
  1275. moduleInfoArr= json_object_new_array();
  1276. temperature = json_object_new_int(ShmBatteryInfo->packInfo[i].moduleInfo[j].temperature);
  1277. // isModuleOVP = json_object_new_int(ShmBatteryInfo->packInfo[i].moduleInfo[j].isOVP);
  1278. // isModuleUVP = json_object_new_int(ShmBatteryInfo->packInfo[i].moduleInfo[j].isUVP);
  1279. // isModuleOTP = json_object_new_int(ShmBatteryInfo->packInfo[i].moduleInfo[j].isOTP);
  1280. json_object_object_add(ModuleInfo,"temperature",temperature);
  1281. // json_object_object_add(ModuleInfo,"isModuleOVP",isModuleOVP);
  1282. // json_object_object_add(ModuleInfo,"isModuleUVP",isModuleUVP);
  1283. // json_object_object_add(ModuleInfo,"isModuleOTP",isModuleOTP);
  1284. json_object_array_add(packInfoArr,ModuleInfo);
  1285. }
  1286. PackInfo=json_object_new_object();
  1287. json_object_object_add(PackInfo,"PackInfo",packInfoArr);
  1288. packInfoArr= json_object_new_array();
  1289. json_object_array_add(systemInfoArr,PackInfo);
  1290. }
  1291. TotalVoltage=json_object_new_int(intTotalVoltage);
  1292. //system
  1293. json_object_object_add(jobj1,"SystemStatus",SystemStatus);
  1294. json_object_object_add(jobj1,"PreviousSystemStatus",PreviousSystemStatus);
  1295. json_object_object_add(jobj1,"SystemInfo",systemInfoArr);
  1296. json_object_object_add(jobj1,"SOC",SOC);
  1297. json_object_object_add(jobj1,"outputCurrent",outputCurrent);
  1298. json_object_object_add(jobj1,"inputCurrent",inputCurrent);
  1299. json_object_object_add(jobj1,"isRelay1",isRelay1);
  1300. json_object_object_add(jobj1,"isRelay2",isRelay2);
  1301. json_object_object_add(jobj1,"isUVP",isUVP);
  1302. json_object_object_add(jobj1,"isOVP",isOVP);
  1303. json_object_object_add(jobj1,"isOTP",isOTP);
  1304. json_object_object_add(jobj1,"isChargingOCP",isChargingOCP);
  1305. json_object_object_add(jobj1,"isDischargingOCP",isDischargingOCP);
  1306. json_object_object_add(jobj1,"isTransmissionFailure",isTransmissionFailure);
  1307. json_object_object_add(jobj1,"TotalVoltage",TotalVoltage);
  1308. printf("%s\n", json_object_to_json_string(jobj1));
  1309. json_object_put(jobj1);
  1310. }
  1311. //web page query all
  1312. if ((argc == 2) & (strcmp(argv[1], "query2") == 0)) {
  1313. char *IsAcDc[2];
  1314. char *SafetyRegulation[2];
  1315. char *IsDO[3];
  1316. char *Connector1[2];
  1317. char *Connector2[2];
  1318. char *Connector3[2];
  1319. char *Network[2];
  1320. //unsigned char connector1FwVer[32];
  1321. //unsigned char connector2FwVer[32];
  1322. short gunQty;
  1323. char *RatedPower1[2];
  1324. char *RatedPower2[2];
  1325. char *RatedPower3[2];
  1326. short RatedPower;
  1327. short PsuQuantity = 0;
  1328. substr((char *)IsAcDc,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,1);
  1329. substr((char *)SafetyRegulation,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,3,1);
  1330. substr((char *)IsDO,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,2);
  1331. substr((char *)Connector1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,7,1);
  1332. substr((char *)Connector2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,9,1);
  1333. substr((char *)Connector3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,8,1);
  1334. substr((char *)Network,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,10,1);
  1335. int connectorType1,connectorType2,connectorType3;
  1336. connectorType1=ConnectorType((char *)Connector1);
  1337. connectorType2=ConnectorType((char *)Connector2);
  1338. connectorType3=ConnectorType((char *)Connector3);
  1339. if(connectorType1 == connectorType2){
  1340. gunQty = 1;
  1341. }
  1342. else{
  1343. gunQty = 0;
  1344. }
  1345. if(connectorType1 != 0){
  1346. if(connectorType1 == 1){
  1347. // strcpy((char *)&connector1FwVer,ShmCcsData->V2GMessage_DIN70121->version);
  1348. // memcpy(connector1FwVer,ShmCcsData->V2GMessage_DIN70121->version,ARRAY_SIZE(ShmCcsData->V2GMessage_DIN70121->version));
  1349. }
  1350. else if(connectorType1 == 2){
  1351. // strcpy((char *)&connector1FwVer,ShmGBTData->evse[0].version);
  1352. // memcpy(connector1FwVer,ShmGBTData->evse[0].version,ARRAY_SIZE(ShmGBTData->evse[0].version));
  1353. }
  1354. else if(connectorType1 == 3){
  1355. // strcpy((char *)&connector1FwVer,ShmCHAdeMOData->evse[0].version);
  1356. // memcpy(connector1FwVer,ShmCHAdeMOData->evse[0].version,ARRAY_SIZE(ShmCHAdeMOData->evse[0].version));
  1357. }
  1358. }
  1359. if(connectorType2 != 0){
  1360. if(connectorType2 == 1){
  1361. // strcpy((char *)&connector2FwVer,ShmCcsData->V2GMessage_DIN70121->version);
  1362. // memcpy(connector2FwVer,ShmCcsData->V2GMessage_DIN70121->version,ARRAY_SIZE(ShmCcsData->V2GMessage_DIN70121->version));
  1363. }
  1364. else if(connectorType2 == 2){
  1365. // strcpy((char *)&connector2FwVer,ShmGBTData->evse[gunQty].version);
  1366. // memcpy(connector2FwVer,ShmGBTData->evse[gunQty].version,ARRAY_SIZE(ShmGBTData->evse[gunQty].version));
  1367. }
  1368. else if(connectorType2 == 3){
  1369. // strcpy((char *)&connector2FwVer,ShmCHAdeMOData->evse[gunQty].version);
  1370. // memcpy(connector2FwVer,ShmCHAdeMOData->evse[gunQty].version,ARRAY_SIZE(ShmCHAdeMOData->evse[gunQty].version));
  1371. }
  1372. }
  1373. substr((char *)RatedPower1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,4,1);
  1374. substr((char *)RatedPower2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,5,1);
  1375. substr((char *)RatedPower3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,6,1);
  1376. int p1=atoi((char *)RatedPower1);
  1377. int p2=atoi((char *)RatedPower2);
  1378. int p3=atoi((char *)RatedPower3);
  1379. if(strcmp(IsAcDc, "D") == 0){
  1380. RatedPower=(p1*10+p2)*pow(10,p3-1);
  1381. if(RatedPower>=30){
  1382. PsuQuantity = RatedPower/30;
  1383. }
  1384. }
  1385. if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0){
  1386. }
  1387. struct json_object *jobj1;
  1388. struct json_object *jobj2;
  1389. struct json_object *jobj3;
  1390. struct json_object *jobj4;
  1391. //system
  1392. struct json_object *ModelName;
  1393. struct json_object *AcModelName;
  1394. struct json_object *SerialNumber;
  1395. struct json_object *SystemId;
  1396. struct json_object *AcPhaseCount;
  1397. struct json_object *PhaseLossPolicy;
  1398. struct json_object *FactoryConfiguration;
  1399. struct json_object *AuthorisationMode;
  1400. struct json_object *DefaultLanguage;
  1401. struct json_object *InputVoltageR;
  1402. struct json_object *InputVoltageS;
  1403. struct json_object *InputVoltageT;
  1404. struct json_object *InputVoltageDc;
  1405. struct json_object *SystemFanRotaSpeed;
  1406. struct json_object *PsuFanRotaSpeed;
  1407. struct json_object *RfidCardNumEndian;
  1408. struct json_object *PsuAcInputType;
  1409. struct json_object *RatingCurrent;
  1410. struct json_object *AcRatingCurrent;
  1411. struct json_object *isAPP;
  1412. struct json_object *isQRCode;
  1413. struct json_object *isRFID;
  1414. struct json_object *QRCodeMadeMode;
  1415. struct json_object *QRCodeContent;
  1416. struct json_object *Intensity;
  1417. struct json_object *isAuthrizeByEVCCID;
  1418. struct json_object *AuxPower5V;
  1419. struct json_object *AuxPower12V;
  1420. struct json_object *AuxPower24V;
  1421. struct json_object *AuxPower48V;
  1422. struct json_object *CsuHwRev;
  1423. struct json_object *CsuBootLoadFwRev;
  1424. struct json_object *CsuKernelFwRev;
  1425. struct json_object *CsuRootFsFwRev;
  1426. struct json_object *CsuPrimFwRev;
  1427. struct json_object *LcmHwRev;
  1428. struct json_object *LcmFwRev;
  1429. struct json_object *PsuHwRev;
  1430. struct json_object *PsuPrimFwRev;
  1431. struct json_object *PsuSecFwRev;
  1432. struct json_object *AuxPwrHwRev;
  1433. struct json_object *AuxPwrFwRev;
  1434. struct json_object *FanModuleHwRev;
  1435. struct json_object *FanModuleFwRev;
  1436. struct json_object *RelayModuleHwRev;
  1437. struct json_object *RelayModuleFwRev;
  1438. struct json_object *TelcomModemFwRev;
  1439. struct json_object *Connector1FwRev;
  1440. struct json_object *Connector2FwRev;
  1441. /* for DC+AC*/
  1442. struct json_object *Connector3FwRev;
  1443. struct json_object *LedModuleFwRev;
  1444. struct json_object *SystemAmbientTemp;
  1445. struct json_object *SystemCriticalTemp;
  1446. struct json_object *CcsConnectorTemp;
  1447. struct json_object *PsuAmbientTemp;
  1448. struct json_object *AcPlugInTimes;
  1449. struct json_object *GbPlugInTimes;
  1450. struct json_object *Ccs1PlugInTime;
  1451. struct json_object *Ccs2PlugInTimes;
  1452. struct json_object *ChademoPlugInTimes;
  1453. struct json_object *FirmwareUpdate;
  1454. struct json_object *FwPrimaryVersion[PsuQuantity];
  1455. struct json_object *FwPrimaryVersionArr= json_object_new_array();
  1456. struct json_object *FwSecondVersion[PsuQuantity];
  1457. struct json_object *FwSecondVersionArr= json_object_new_array();
  1458. /* for DO & DD*/
  1459. struct json_object *DispenserQuantity;
  1460. struct json_object *TotalConnectorQuantity;
  1461. struct json_object *DDModelName[4];
  1462. struct json_object *DDModelNameArr= json_object_new_array();
  1463. struct json_object *DDSerialNumber[4];
  1464. struct json_object *DDSerialNumberArr= json_object_new_array();
  1465. struct json_object *DDSystemId[4];
  1466. struct json_object *DDSystemIdArr= json_object_new_array();
  1467. struct json_object *DDAuthorisationMode[4];
  1468. struct json_object *DDAuthorisationModeArr= json_object_new_array();
  1469. struct json_object *DDRfidCardNumEndian[4];
  1470. struct json_object *DDRfidCardNumEndianArr= json_object_new_array();
  1471. struct json_object *DDisAPP[4];
  1472. struct json_object *DDisAPPArr= json_object_new_array();
  1473. struct json_object *DDisQRCode[4];
  1474. struct json_object *DDisQRCodeArr= json_object_new_array();
  1475. struct json_object *DDisRFID[4];
  1476. struct json_object *DDisRFIDArr= json_object_new_array();
  1477. struct json_object *DDQRCodeMadeMode[4];
  1478. struct json_object *DDQRCodeMadeModeArr= json_object_new_array();
  1479. struct json_object *DDQRCodeContent[4];
  1480. struct json_object *DDQRCodeContentArr= json_object_new_array();
  1481. struct json_object *DDFactoryConfiguration[4];
  1482. struct json_object *DDFactoryConfigurationArr= json_object_new_array();
  1483. struct json_object *DDCsuBootLoadFwRev[4];
  1484. struct json_object *DDCsuBootLoadFwRevArr= json_object_new_array();
  1485. struct json_object *DDCsuKernelFwRev[4];
  1486. struct json_object *DDCsuKernelFwRevArr= json_object_new_array();
  1487. struct json_object *DDCsuRootFsFwRev[4];
  1488. struct json_object *DDCsuRootFsFwRevArr= json_object_new_array();
  1489. struct json_object *DDCsuPrimFwRev[4];
  1490. struct json_object *DDCsuPrimFwRevArr= json_object_new_array();
  1491. struct json_object *DDLcmFwRev[4];
  1492. struct json_object *DDLcmFwRevArr= json_object_new_array();
  1493. struct json_object *DDPsuPrimFwRev[4];
  1494. struct json_object *DDPsuPrimFwRevArr= json_object_new_array();
  1495. struct json_object *DDPsuSecFwRev[4];
  1496. struct json_object *DDPsuSecFwRevArr= json_object_new_array();
  1497. struct json_object *DDFanModuleFwRev[4];
  1498. struct json_object *DDFanModuleFwRevArr= json_object_new_array();
  1499. struct json_object *DDRelayModuleFwRev[4];
  1500. struct json_object *DDRelayModuleFwRevArr= json_object_new_array();
  1501. struct json_object *DDTelcomModemFwRev[4];
  1502. struct json_object *DDTelcomModemFwRevArr= json_object_new_array();
  1503. struct json_object *DDLedModuleFwRev[4];
  1504. struct json_object *DDLedModuleFwRevArr= json_object_new_array();
  1505. struct json_object *DDConnector1FwRev[4];
  1506. struct json_object *DDConnector1FwRevArr= json_object_new_array();
  1507. struct json_object *DDConnector2FwRev[4];
  1508. struct json_object *DDConnector2FwRevArr= json_object_new_array();
  1509. struct json_object *DDIntensity[4];
  1510. struct json_object *DDIntensityArr= json_object_new_array();
  1511. struct json_object *Relay2ModuleFwRev;
  1512. //charging
  1513. struct json_object *MaxChargingEnergy;
  1514. struct json_object *MaxChargingPower;
  1515. struct json_object *MaxChargingCurrent;
  1516. struct json_object *AcMaxChargingCurrent;
  1517. struct json_object *MaxChargingDuration;
  1518. struct json_object *StopChargingByButton;
  1519. struct json_object *LocalWhiteCard[10];
  1520. struct json_object *LocalWhiteCardArr= json_object_new_array();
  1521. struct json_object *isBilling;
  1522. struct json_object *Currency;
  1523. struct json_object *Fee[24];
  1524. struct json_object *FeeArr= json_object_new_array();
  1525. struct json_object *ChargingInfo1;
  1526. struct json_object *ChargingInfo2;
  1527. struct json_object *ChargingInfo3;
  1528. struct json_object *StartUserId[3];
  1529. struct json_object *StartDateTime[3];
  1530. struct json_object *StopDateTime[3];
  1531. struct json_object *StartMethod[3];
  1532. struct json_object *ConnectorTemp[3];
  1533. struct json_object *ChillerTemp[3];
  1534. struct json_object *PresentChargingVoltage[3];
  1535. struct json_object *PresentChargingCurrent[3];
  1536. struct json_object *PresentChargingPower[3];
  1537. struct json_object *PresentChargedEnergy[3];
  1538. struct json_object *PresentChargedDuration[3];
  1539. struct json_object *RemainChargingDuration[3];
  1540. struct json_object *EvBatteryMaxVoltage[3];
  1541. struct json_object *EvBatterytargetVoltage[3];
  1542. struct json_object *EvBatterySoc[3];
  1543. struct json_object *SystemStatus[3];
  1544. struct json_object *EvBatterytargetCurrent[3];
  1545. struct json_object *PowerConsumption[3];
  1546. struct json_object *isCalibratedVaGain[3];
  1547. struct json_object *isCalibratedVbGain[3];
  1548. struct json_object *isCalibratedVcGain[3];
  1549. struct json_object *isCalibratedVaOffset[3];
  1550. struct json_object *isCalibratedVbOffset[3];
  1551. struct json_object *isCalibratedVcOffset[3];
  1552. struct json_object *isCalibratedCaGain[3];
  1553. struct json_object *isCalibratedCbGain[3];
  1554. struct json_object *isCalibratedCcGain[3];
  1555. struct json_object *isCalibratedCaOffset[3];
  1556. struct json_object *isCalibratedCbOffset[3];
  1557. struct json_object *isCalibratedCcOffset[3];
  1558. struct json_object *isCalibratedPa[3];
  1559. struct json_object *isCalibratedPb[3];
  1560. struct json_object *isCalibratedPc[3];
  1561. /* for DO & DD*/
  1562. struct json_object *DDChargingInfo1;
  1563. struct json_object *DDChargingInfo2;
  1564. struct json_object *DDChargingInfo3;
  1565. struct json_object *DDChargingInfo4;
  1566. struct json_object *DDStartUserId[4];
  1567. struct json_object *DDStartDateTime[4];
  1568. struct json_object *DDStopDateTime[4];
  1569. struct json_object *DDStartMethod[4];
  1570. struct json_object *DDConnectorTemp[4];
  1571. struct json_object *DDChillerTemp[4];
  1572. struct json_object *DDPresentChargingVoltage[4];
  1573. struct json_object *DDPresentChargingCurrent[4];
  1574. struct json_object *DDPresentChargingPower[4];
  1575. struct json_object *DDPresentChargedEnergy[4];
  1576. struct json_object *DDPresentChargedDuration[4];
  1577. struct json_object *DDRemainChargingDuration[4];
  1578. struct json_object *DDEvBatteryMaxVoltage[4];
  1579. struct json_object *DDEvBatterytargetVoltage[4];
  1580. struct json_object *DDEvBatterySoc[4];
  1581. struct json_object *DDSystemStatus[4];
  1582. struct json_object *DDEvBatterytargetCurrent[4];
  1583. struct json_object *DDPowerConsumption[4];
  1584. //network
  1585. struct json_object *InternetConn;
  1586. struct json_object *FtpServer;
  1587. struct json_object *Eth0DhcpClient;
  1588. struct json_object *Eth0MacAddress;
  1589. struct json_object *Eth0IpAddress;
  1590. struct json_object *Eth0SubmaskAddress;
  1591. struct json_object *Eth0GatewayAddress;
  1592. struct json_object *Eth1DhcpClient;
  1593. struct json_object *Eth1MacAddress;
  1594. struct json_object *Eth1IpAddress;
  1595. struct json_object *Eth1SubmaskAddress;
  1596. struct json_object *Eth1GatewayAddress;
  1597. struct json_object *WifiMode;
  1598. struct json_object *WifiSsid;
  1599. struct json_object *WifiPassword;
  1600. struct json_object *WifiRssi;
  1601. struct json_object *WifiDhcpServer;
  1602. struct json_object *WifiDhcpClient;
  1603. struct json_object *WifiMacAddress;
  1604. struct json_object *WifiIpAddress;
  1605. struct json_object *WifiSubmaskAddress;
  1606. struct json_object *WifiGatewayAddress;
  1607. struct json_object *WifiNetworkConn;
  1608. struct json_object *TelcomApn;
  1609. struct json_object *TelcomRssi;
  1610. struct json_object *TelcomChapPapId;
  1611. struct json_object *TelcomChapPapPwd;
  1612. struct json_object *TelcomModemImei;
  1613. struct json_object *TelcomSimImsi;
  1614. struct json_object *TelcomSimIccid;
  1615. struct json_object *TelcomSimStatus;
  1616. struct json_object *TelcomModemMode;
  1617. struct json_object *TelcomIpAddress;
  1618. struct json_object *TelcomNetworkConn;
  1619. struct json_object *TelcomEnabled;
  1620. //backend
  1621. struct json_object *BackendConnTimeout;
  1622. struct json_object *OfflinePolicy;
  1623. struct json_object *OfflineMaxChargeEnergy;
  1624. struct json_object *OfflineMaxChargeDuration;
  1625. struct json_object *OcppConnStatus;
  1626. struct json_object *MaintainServerConnStatus;
  1627. struct json_object *OcppServerURL;
  1628. struct json_object *ChargeBoxId;
  1629. struct json_object *chargePointVendor;
  1630. struct json_object *OcppSecurityProfile;
  1631. struct json_object *OcppSecurityPassword;
  1632. struct json_object *MaintainServerSecurityProfile;
  1633. struct json_object *MaintainServerSecurityPassword;
  1634. struct json_object *isEnableLocalPowerSharging;
  1635. struct json_object *PowerSharingServerIP;
  1636. struct json_object *OcppReceiptrURL;
  1637. struct json_object *MaintainServerURL;
  1638. /*for TTIA*/
  1639. struct json_object *isEnableTTIA;
  1640. struct json_object *server_addr;
  1641. struct json_object *server_port;
  1642. struct json_object *busVenderId;
  1643. struct json_object *EquipmentProvider;
  1644. struct json_object *TransportationCompanyNo;
  1645. struct json_object *TTIAChargeBoxId;
  1646. struct json_object *evseStation;
  1647. jobj1=json_object_new_object();
  1648. jobj2=json_object_new_object();
  1649. jobj3=json_object_new_object();
  1650. jobj4=json_object_new_object();
  1651. //system
  1652. ModelName = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ModelName);
  1653. AcModelName = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AcModelName);
  1654. SerialNumber = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber);
  1655. SystemId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SystemId);
  1656. AcPhaseCount = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPhaseCount);
  1657. PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
  1658. FactoryConfiguration = json_object_new_int(ShmSysConfigAndInfo->SysInfo.FactoryConfiguration);
  1659. AuthorisationMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
  1660. DefaultLanguage = json_object_new_int(ShmSysConfigAndInfo->SysConfig.DefaultLanguage);
  1661. InputVoltageR = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageR);
  1662. InputVoltageS = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageS);
  1663. InputVoltageT = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageT);
  1664. InputVoltageDc = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageDc);
  1665. SystemFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
  1666. PsuFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed);
  1667. RfidCardNumEndian = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
  1668. PsuAcInputType = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PsuAcInputType);
  1669. RatingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RatingCurrent);
  1670. AcRatingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcRatingCurrent);
  1671. isAPP = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isAPP);
  1672. isQRCode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isQRCode);
  1673. isRFID = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isRFID);
  1674. QRCodeMadeMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode);
  1675. QRCodeContent = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.QRCodeContent);
  1676. Intensity = json_object_new_int(ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity);
  1677. isAuthrizeByEVCCID = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isAuthrizeByEVCCID);
  1678. AuxPower5V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower5V);
  1679. AuxPower12V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower12V);
  1680. AuxPower24V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower24V);
  1681. AuxPower48V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower48V);
  1682. CsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev);
  1683. CsuBootLoadFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
  1684. CsuKernelFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
  1685. CsuRootFsFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
  1686. CsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev);
  1687. LcmHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev);
  1688. LcmFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev);
  1689. PsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev);
  1690. PsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev);
  1691. PsuSecFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev);
  1692. AuxPwrHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev);
  1693. AuxPwrFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev);
  1694. FanModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev);
  1695. FanModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev);
  1696. RelayModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev);
  1697. RelayModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev);
  1698. TelcomModemFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev);
  1699. Connector1FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
  1700. Connector2FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
  1701. /* for DC+AC*/
  1702. if(connectorType3==4){
  1703. Connector3FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[0].version);
  1704. }
  1705. LedModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LedModuleFwRev);
  1706. SystemAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp);
  1707. SystemCriticalTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp);
  1708. CcsConnectorTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp);
  1709. PsuAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp);
  1710. AcPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPlugInTimes);
  1711. GbPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.GbPlugInTimes);
  1712. Ccs1PlugInTime = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime);
  1713. Ccs2PlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes);
  1714. ChademoPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes);
  1715. FirmwareUpdate = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FirmwareUpdate);
  1716. if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0){
  1717. if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity>4 || ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity<0)ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity=0;
  1718. DispenserQuantity = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity);
  1719. TotalConnectorQuantity = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity);
  1720. int DDDispenserQuantity = ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity;
  1721. for(int i=0;i<DDDispenserQuantity;i++){
  1722. DDModelName[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].ModelName);
  1723. DDSerialNumber[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].SerialNumber);
  1724. DDSystemId[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].SystemId);
  1725. DDAuthorisationMode[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].AuthorisationMode);
  1726. DDRfidCardNumEndian[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].RfidCardNumEndian);
  1727. DDisAPP[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].isAPP);
  1728. DDisQRCode[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].isQRCode);
  1729. DDisRFID[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].isRFID);
  1730. DDQRCodeMadeMode[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].QRCodeMadeMode);
  1731. DDQRCodeContent[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].QRCodeContent);
  1732. DDFactoryConfiguration[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].FactoryConfiguration);
  1733. DDCsuBootLoadFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuBootLoadFwRev);
  1734. DDCsuKernelFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuKernelFwRev);
  1735. DDCsuRootFsFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuRootFsFwRev);
  1736. DDCsuPrimFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuPrimFwRev);
  1737. DDLcmFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LcmFwRev);
  1738. DDPsuPrimFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].PsuPrimFwRev);
  1739. DDPsuSecFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].PsuSecFwRev);
  1740. DDFanModuleFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].FanModuleFwRev);
  1741. DDRelayModuleFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].RelayModuleFwRev);
  1742. DDTelcomModemFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].TelcomModemFwRev);
  1743. DDLedModuleFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LedModuleFwRev);
  1744. DDConnector1FwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Connector1FwRev);
  1745. DDConnector2FwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Connector2FwRev);
  1746. DDIntensity[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LedInfo.Intensity);
  1747. json_object_array_add(DDModelNameArr,DDModelName[i]);
  1748. json_object_array_add(DDSerialNumberArr,DDSerialNumber[i]);
  1749. json_object_array_add(DDSystemIdArr,DDSystemId[i]);
  1750. json_object_array_add(DDAuthorisationModeArr,DDAuthorisationMode[i]);
  1751. json_object_array_add(DDRfidCardNumEndianArr,DDRfidCardNumEndian[i]);
  1752. json_object_array_add(DDisAPPArr,DDisAPP[i]);
  1753. json_object_array_add(DDisQRCodeArr,DDisQRCode[i]);
  1754. json_object_array_add(DDisRFIDArr,DDisRFID[i]);
  1755. json_object_array_add(DDQRCodeMadeModeArr,DDQRCodeMadeMode[i]);
  1756. json_object_array_add(DDQRCodeContentArr,DDQRCodeContent[i]);
  1757. json_object_array_add(DDFactoryConfigurationArr,DDFactoryConfiguration[i]);
  1758. json_object_array_add(DDCsuBootLoadFwRevArr,DDCsuBootLoadFwRev[i]);
  1759. json_object_array_add(DDCsuKernelFwRevArr,DDCsuKernelFwRev[i]);
  1760. json_object_array_add(DDCsuRootFsFwRevArr,DDCsuRootFsFwRev[i]);
  1761. json_object_array_add(DDCsuPrimFwRevArr,DDCsuPrimFwRev[i]);
  1762. json_object_array_add(DDLcmFwRevArr,DDLcmFwRev[i]);
  1763. json_object_array_add(DDPsuPrimFwRevArr,DDPsuPrimFwRev[i]);
  1764. json_object_array_add(DDPsuSecFwRevArr,DDPsuSecFwRev[i]);
  1765. json_object_array_add(DDFanModuleFwRevArr,DDFanModuleFwRev[i]);
  1766. json_object_array_add(DDRelayModuleFwRevArr,DDRelayModuleFwRev[i]);
  1767. json_object_array_add(DDTelcomModemFwRevArr,DDTelcomModemFwRev[i]);
  1768. json_object_array_add(DDLedModuleFwRevArr,DDLedModuleFwRev[i]);
  1769. json_object_array_add(DDConnector1FwRevArr,DDConnector1FwRev[i]);
  1770. json_object_array_add(DDConnector2FwRevArr,DDConnector2FwRev[i]);
  1771. json_object_array_add(DDIntensityArr,DDIntensity[i]);
  1772. }
  1773. Relay2ModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Relay2ModuleFwRev);
  1774. }
  1775. //charging
  1776. int CcsGunQty=0;
  1777. int GbGunQty=0;
  1778. int CHAdeMOGunQty=0;
  1779. int AcGunQty=0;
  1780. ChargingInfo1=json_object_new_object();
  1781. ChargingInfo2=json_object_new_object();
  1782. ChargingInfo3=json_object_new_object();
  1783. MaxChargingEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy);
  1784. MaxChargingPower = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingPower);
  1785. MaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
  1786. AcMaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent);
  1787. MaxChargingDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingDuration);
  1788. StopChargingByButton = json_object_new_int(ShmSysConfigAndInfo->SysConfig.StopChargingByButton);
  1789. LocalWhiteCard[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]);
  1790. LocalWhiteCard[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]);
  1791. LocalWhiteCard[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]);
  1792. LocalWhiteCard[3] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3]);
  1793. LocalWhiteCard[4] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4]);
  1794. LocalWhiteCard[5] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5]);
  1795. LocalWhiteCard[6] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6]);
  1796. LocalWhiteCard[7] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7]);
  1797. LocalWhiteCard[8] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8]);
  1798. LocalWhiteCard[9] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9]);
  1799. isBilling = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BillingData.isBilling);
  1800. Currency = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BillingData.Currency);
  1801. Fee[0] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[0]);
  1802. Fee[1] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[1]);
  1803. Fee[2] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[2]);
  1804. Fee[3] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[3]);
  1805. Fee[4] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[4]);
  1806. Fee[5] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[5]);
  1807. Fee[6] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[6]);
  1808. Fee[7] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[7]);
  1809. Fee[8] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[8]);
  1810. Fee[9] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[9]);
  1811. Fee[10] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[10]);
  1812. Fee[11] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[11]);
  1813. Fee[12] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[12]);
  1814. Fee[13] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[13]);
  1815. Fee[14] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[14]);
  1816. Fee[15] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[15]);
  1817. Fee[16] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[16]);
  1818. Fee[17] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[17]);
  1819. Fee[18] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[18]);
  1820. Fee[19] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[19]);
  1821. Fee[20] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[20]);
  1822. Fee[21] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[21]);
  1823. Fee[22] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[22]);
  1824. Fee[23] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[23]);
  1825. if(connectorType1 != 0){
  1826. if(connectorType1 == 1){//CCS
  1827. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1828. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1829. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1830. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1831. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1832. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1833. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1834. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1835. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1836. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1837. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1838. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1839. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1840. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1841. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1842. if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 255){
  1843. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1844. }
  1845. else{
  1846. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp-60);
  1847. }
  1848. if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 255){
  1849. ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp);
  1850. }
  1851. else{
  1852. ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp-60);
  1853. }
  1854. PowerConsumption[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PowerConsumption);
  1855. CcsGunQty++;
  1856. }
  1857. else if(connectorType1 == 2){//GB
  1858. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1859. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1860. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1861. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1862. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1863. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1864. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1865. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1866. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  1867. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  1868. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  1869. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  1870. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  1871. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  1872. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  1873. if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 255){
  1874. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  1875. }
  1876. else{
  1877. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp-60);
  1878. }
  1879. if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 255){
  1880. ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp);
  1881. }
  1882. else{
  1883. ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp-60);
  1884. }
  1885. PowerConsumption[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PowerConsumption);
  1886. GbGunQty++;
  1887. }
  1888. else if(connectorType1 == 3){//CHAdeMO
  1889. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  1890. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  1891. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  1892. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  1893. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  1894. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  1895. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  1896. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  1897. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  1898. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  1899. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  1900. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  1901. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  1902. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  1903. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1904. if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 255){
  1905. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1906. }
  1907. else{
  1908. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp-60);
  1909. }
  1910. if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 255){
  1911. ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp);
  1912. }
  1913. else{
  1914. ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp-60);
  1915. }
  1916. PowerConsumption[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PowerConsumption);
  1917. CHAdeMOGunQty++;
  1918. }
  1919. else if(connectorType1 == 4){//AC
  1920. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1921. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1922. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1923. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1924. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1925. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1926. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1927. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1928. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1929. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1930. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1931. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1932. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1933. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1934. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1935. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1936. ChillerTemp[0] = json_object_new_int(255);
  1937. PowerConsumption[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PowerConsumption);
  1938. if(strcmp(IsDO, "AX") == 0){
  1939. isCalibratedVaGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaGain);
  1940. isCalibratedVbGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbGain);
  1941. isCalibratedVcGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcGain);
  1942. isCalibratedVaOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaOffset);
  1943. isCalibratedVbOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbOffset);
  1944. isCalibratedVcOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcOffset);
  1945. isCalibratedCaGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaGain);
  1946. isCalibratedCbGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbGain);
  1947. isCalibratedCcGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcGain);
  1948. isCalibratedCaOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaOffset);
  1949. isCalibratedCbOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbOffset);
  1950. isCalibratedCcOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcOffset);
  1951. isCalibratedPa[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPa);
  1952. isCalibratedPb[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPb);
  1953. isCalibratedPc[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPc);
  1954. }
  1955. AcGunQty++;
  1956. }
  1957. }
  1958. if(connectorType2 != 0){
  1959. if(connectorType2 == 1){//CCS
  1960. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1961. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1962. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1963. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1964. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1965. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1966. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1967. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1968. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1969. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1970. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1971. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1972. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1973. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1974. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1975. if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 255){
  1976. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1977. }
  1978. else{
  1979. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp-60);
  1980. }
  1981. if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 255){
  1982. ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp);
  1983. }
  1984. else{
  1985. ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp-60);
  1986. }
  1987. PowerConsumption[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PowerConsumption);
  1988. CcsGunQty++;
  1989. }
  1990. else if(connectorType2 == 2){//GB
  1991. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1992. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1993. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1994. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1995. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1996. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1997. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1998. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1999. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  2000. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  2001. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  2002. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  2003. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  2004. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  2005. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  2006. if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 255){
  2007. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  2008. }
  2009. else{
  2010. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp-60);
  2011. }
  2012. if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 255){
  2013. ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp);
  2014. }
  2015. else{
  2016. ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp-60);
  2017. }
  2018. PowerConsumption[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PowerConsumption);
  2019. GbGunQty++;
  2020. }
  2021. else if(connectorType2 == 3){//CHAdeMO
  2022. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  2023. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  2024. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  2025. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  2026. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  2027. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  2028. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  2029. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  2030. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  2031. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  2032. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  2033. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  2034. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  2035. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  2036. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  2037. if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 255){
  2038. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  2039. }
  2040. else{
  2041. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp-60);
  2042. }
  2043. if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 255){
  2044. ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp);
  2045. }
  2046. else{
  2047. ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp-60);
  2048. }
  2049. PowerConsumption[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PowerConsumption);
  2050. CHAdeMOGunQty++;
  2051. }
  2052. else if(connectorType2 == 4){//AC
  2053. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  2054. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  2055. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  2056. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  2057. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  2058. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  2059. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  2060. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  2061. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  2062. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  2063. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  2064. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  2065. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  2066. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  2067. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  2068. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  2069. ChillerTemp[1] = json_object_new_int(255);
  2070. PowerConsumption[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PowerConsumption);
  2071. if(strcmp(IsDO, "AX") == 0){
  2072. isCalibratedVaGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaGain);
  2073. isCalibratedVbGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbGain);
  2074. isCalibratedVcGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcGain);
  2075. isCalibratedVaOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaOffset);
  2076. isCalibratedVbOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbOffset);
  2077. isCalibratedVcOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcOffset);
  2078. isCalibratedCaGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaGain);
  2079. isCalibratedCbGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbGain);
  2080. isCalibratedCcGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcGain);
  2081. isCalibratedCaOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaOffset);
  2082. isCalibratedCbOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbOffset);
  2083. isCalibratedCcOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcOffset);
  2084. isCalibratedPa[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPa);
  2085. isCalibratedPb[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPb);
  2086. isCalibratedPc[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPc);
  2087. }
  2088. AcGunQty++;
  2089. }
  2090. }
  2091. if(connectorType3 != 0){
  2092. if(connectorType3 == 1){//CCS
  2093. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  2094. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  2095. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  2096. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  2097. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  2098. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  2099. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  2100. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  2101. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  2102. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  2103. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  2104. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  2105. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  2106. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  2107. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  2108. if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 ||ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 255){
  2109. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  2110. }
  2111. else{
  2112. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp-60);
  2113. }
  2114. if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 0 ||ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 255){
  2115. ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp);
  2116. }
  2117. else{
  2118. ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp-60);
  2119. }
  2120. PowerConsumption[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PowerConsumption);
  2121. CcsGunQty++;
  2122. }
  2123. else if(connectorType3 == 2){//GB
  2124. PresentChargingVoltage[2]= json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  2125. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  2126. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  2127. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  2128. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  2129. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  2130. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  2131. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  2132. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  2133. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  2134. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  2135. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  2136. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  2137. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  2138. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  2139. if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 255){
  2140. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  2141. }
  2142. else{
  2143. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp-60);
  2144. }
  2145. if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 255){
  2146. ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp);
  2147. }
  2148. else{
  2149. ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp-60);
  2150. }
  2151. PowerConsumption[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PowerConsumption);
  2152. GbGunQty++;
  2153. }
  2154. else if(connectorType3 == 3){//CHAdeMO
  2155. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  2156. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  2157. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  2158. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  2159. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  2160. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  2161. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  2162. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  2163. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  2164. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  2165. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  2166. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  2167. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  2168. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  2169. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  2170. if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 255){
  2171. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  2172. }
  2173. else{
  2174. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp-60);
  2175. }
  2176. if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 255){
  2177. ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp);
  2178. }
  2179. else{
  2180. ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp-60);
  2181. }
  2182. PowerConsumption[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PowerConsumption);
  2183. CHAdeMOGunQty++;
  2184. }
  2185. else if(connectorType3 == 4){//AC
  2186. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  2187. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  2188. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  2189. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  2190. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  2191. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  2192. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  2193. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  2194. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  2195. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  2196. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  2197. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  2198. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  2199. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  2200. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  2201. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  2202. ChillerTemp[2] = json_object_new_int(255);
  2203. PowerConsumption[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PowerConsumption);
  2204. if(strcmp(IsDO, "AX") == 0){
  2205. isCalibratedVaGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaGain);
  2206. isCalibratedVbGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbGain);
  2207. isCalibratedVcGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcGain);
  2208. isCalibratedVaOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaOffset);
  2209. isCalibratedVbOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbOffset);
  2210. isCalibratedVcOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcOffset);
  2211. isCalibratedCaGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaGain);
  2212. isCalibratedCbGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbGain);
  2213. isCalibratedCcGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcGain);
  2214. isCalibratedCaOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaOffset);
  2215. isCalibratedCbOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbOffset);
  2216. isCalibratedCcOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcOffset);
  2217. isCalibratedPa[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPa);
  2218. isCalibratedPb[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPb);
  2219. isCalibratedPc[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPc);
  2220. }
  2221. AcGunQty++;
  2222. }
  2223. }
  2224. if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0){
  2225. if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity>4 || ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity<0)ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=0;
  2226. int DDTotalConnectorQuantity = ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity;
  2227. for(int i=0;i<DDTotalConnectorQuantity;i++){
  2228. DDPresentChargingVoltage[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargingVoltage);
  2229. DDPresentChargingCurrent[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargingCurrent);
  2230. DDPresentChargingPower[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargingPower);
  2231. DDPresentChargedEnergy[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargedEnergy);
  2232. DDPresentChargedDuration[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargedDuration);
  2233. DDRemainChargingDuration[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.RemainChargingDuration);
  2234. DDEvBatteryMaxVoltage[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatteryMaxVoltage);
  2235. DDEvBatterytargetVoltage[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatterytargetVoltage);
  2236. DDEvBatterySoc[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatterySoc);
  2237. DDSystemStatus[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.SystemStatus);
  2238. DDEvBatterytargetCurrent[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatterytargetCurrent);
  2239. DDStartUserId[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartUserId);
  2240. DDStartDateTime[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartDateTime);
  2241. DDStopDateTime[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StopDateTime);
  2242. DDStartMethod[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartMethod);
  2243. if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp == 255){
  2244. DDConnectorTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp);
  2245. }
  2246. else{
  2247. DDConnectorTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp-60);
  2248. }
  2249. if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ChillerTemp == 255){
  2250. DDChillerTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ChillerTemp);
  2251. }
  2252. else{
  2253. DDChillerTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ChillerTemp-60);
  2254. }
  2255. DDPowerConsumption[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PowerConsumption);
  2256. }
  2257. }
  2258. //network
  2259. InternetConn = json_object_new_int(ShmSysConfigAndInfo->SysInfo.InternetConn);
  2260. FtpServer = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer);
  2261. Eth0DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient);
  2262. Eth0MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress);
  2263. Eth0IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
  2264. Eth0SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
  2265. Eth0GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
  2266. Eth1DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient);
  2267. Eth1MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress);
  2268. Eth1IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress);
  2269. Eth1SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress);
  2270. Eth1GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress);
  2271. WifiMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
  2272. WifiSsid = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
  2273. WifiPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
  2274. WifiRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi);
  2275. WifiDhcpServer = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer);
  2276. WifiDhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient);
  2277. WifiMacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress);
  2278. WifiIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress);
  2279. WifiSubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress);
  2280. WifiGatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress);
  2281. WifiNetworkConn = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn);
  2282. TelcomApn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
  2283. TelcomRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi);
  2284. TelcomChapPapId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
  2285. TelcomChapPapPwd = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
  2286. TelcomModemImei = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei);
  2287. TelcomSimImsi = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi);
  2288. TelcomSimIccid = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
  2289. TelcomSimStatus = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus);
  2290. TelcomModemMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
  2291. TelcomIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress);
  2292. TelcomNetworkConn = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn);
  2293. TelcomEnabled = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled);
  2294. //backend
  2295. BackendConnTimeout = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BackendConnTimeout);
  2296. OfflinePolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
  2297. OfflineMaxChargeEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy);
  2298. OfflineMaxChargeDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration);
  2299. OcppConnStatus = json_object_new_int(ShmSysConfigAndInfo->SysInfo.OcppConnStatus);
  2300. MaintainServerConnStatus = json_object_new_int(ShmSysConfigAndInfo->SysInfo.MaintainServerConnStatus);
  2301. OcppServerURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL);
  2302. ChargeBoxId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
  2303. OcppSecurityProfile = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
  2304. OcppSecurityPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword);
  2305. MaintainServerSecurityProfile = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile);
  2306. MaintainServerSecurityPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityPassword);
  2307. chargePointVendor = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor);
  2308. MaintainServerURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
  2309. //system
  2310. json_object_object_add(jobj1,"ModelName",ModelName);
  2311. json_object_object_add(jobj1,"AcModelName",AcModelName);
  2312. json_object_object_add(jobj1,"SerialNumber",SerialNumber);
  2313. json_object_object_add(jobj1,"SystemId",SystemId);
  2314. json_object_object_add(jobj1,"AcPhaseCount",AcPhaseCount);
  2315. json_object_object_add(jobj1,"PhaseLossPolicy",PhaseLossPolicy);
  2316. json_object_object_add(jobj1,"FactoryConfiguration",FactoryConfiguration);
  2317. json_object_object_add(jobj1,"AuthorisationMode",AuthorisationMode);
  2318. json_object_object_add(jobj1,"DefaultLanguage",DefaultLanguage);
  2319. json_object_object_add(jobj1,"InputVoltageR",InputVoltageR);
  2320. json_object_object_add(jobj1,"InputVoltageS",InputVoltageS);
  2321. json_object_object_add(jobj1,"InputVoltageT",InputVoltageT);
  2322. json_object_object_add(jobj1,"InputVoltageDc",InputVoltageDc);
  2323. json_object_object_add(jobj1,"SystemFanRotaSpeed",SystemFanRotaSpeed);
  2324. json_object_object_add(jobj1,"PsuFanRotaSpeed",PsuFanRotaSpeed);
  2325. json_object_object_add(jobj1,"RfidCardNumEndian",RfidCardNumEndian);
  2326. json_object_object_add(jobj1,"PsuAcInputType",PsuAcInputType);
  2327. json_object_object_add(jobj1,"RatingCurrent",RatingCurrent);
  2328. json_object_object_add(jobj1,"AcRatingCurrent",AcRatingCurrent);
  2329. json_object_object_add(jobj1,"isAPP",isAPP);
  2330. json_object_object_add(jobj1,"isQRCode",isQRCode);
  2331. json_object_object_add(jobj1,"isRFID",isRFID);
  2332. json_object_object_add(jobj1,"QRCodeMadeMode",QRCodeMadeMode);
  2333. json_object_object_add(jobj1,"QRCodeContent",QRCodeContent);
  2334. json_object_object_add(jobj1,"Intensity",Intensity);
  2335. json_object_object_add(jobj1,"isAuthrizeByEVCCID",isAuthrizeByEVCCID);
  2336. json_object_object_add(jobj1,"AuxPower5V",AuxPower5V);
  2337. json_object_object_add(jobj1,"AuxPower12V",AuxPower12V);
  2338. json_object_object_add(jobj1,"AuxPower24V",AuxPower24V);
  2339. json_object_object_add(jobj1,"AuxPower48V",AuxPower48V);
  2340. json_object_object_add(jobj1,"CsuHwRev",CsuHwRev);
  2341. json_object_object_add(jobj1,"CsuBootLoadFwRev",CsuBootLoadFwRev);
  2342. json_object_object_add(jobj1,"CsuKernelFwRev",CsuKernelFwRev);
  2343. json_object_object_add(jobj1,"CsuRootFsFwRev",CsuRootFsFwRev);
  2344. json_object_object_add(jobj1,"CsuPrimFwRev",CsuPrimFwRev);
  2345. json_object_object_add(jobj1,"LcmHwRev",LcmHwRev);
  2346. json_object_object_add(jobj1,"LcmFwRev",LcmFwRev);
  2347. json_object_object_add(jobj1,"PsuHwRev",PsuHwRev);
  2348. json_object_object_add(jobj1,"PsuPrimFwRev",PsuPrimFwRev);
  2349. json_object_object_add(jobj1,"PsuSecFwRev",PsuSecFwRev);
  2350. json_object_object_add(jobj1,"AuxPwrHwRev",AuxPwrHwRev);
  2351. json_object_object_add(jobj1,"AuxPwrFwRev",AuxPwrFwRev);
  2352. json_object_object_add(jobj1,"FanModuleHwRev",FanModuleHwRev);
  2353. json_object_object_add(jobj1,"FanModuleFwRev",FanModuleFwRev);
  2354. json_object_object_add(jobj1,"RelayModuleHwRev",RelayModuleHwRev);
  2355. json_object_object_add(jobj1,"RelayModuleFwRev",RelayModuleFwRev);
  2356. json_object_object_add(jobj1,"TelcomModemFwRev",TelcomModemFwRev);
  2357. json_object_object_add(jobj1,"Connector1FwRev",Connector1FwRev);
  2358. json_object_object_add(jobj1,"Connector2FwRev",Connector2FwRev);
  2359. /* for DC+AC*/
  2360. if(connectorType3==4){
  2361. json_object_object_add(jobj1,"Connector3FwRev",Connector3FwRev);
  2362. }
  2363. json_object_object_add(jobj1,"LedModuleFwRev",LedModuleFwRev);
  2364. json_object_object_add(jobj1,"SystemAmbientTemp",SystemAmbientTemp);
  2365. json_object_object_add(jobj1,"SystemCriticalTemp",SystemCriticalTemp);
  2366. json_object_object_add(jobj1,"CcsConnectorTemp",CcsConnectorTemp);
  2367. json_object_object_add(jobj1,"PsuAmbientTemp",PsuAmbientTemp);
  2368. json_object_object_add(jobj1,"AcPlugInTimes",AcPlugInTimes);
  2369. json_object_object_add(jobj1,"GbPlugInTimes",GbPlugInTimes);
  2370. json_object_object_add(jobj1,"Ccs1PlugInTimes",Ccs1PlugInTime);
  2371. json_object_object_add(jobj1,"Ccs2PlugInTimes",Ccs2PlugInTimes);
  2372. json_object_object_add(jobj1,"ChademoPlugInTimes",ChademoPlugInTimes);
  2373. json_object_object_add(jobj1,"FirmwareUpdate",FirmwareUpdate);
  2374. if(strcmp(IsAcDc, "D") == 0){
  2375. json_object_object_add(jobj1,"FwPrimaryVersion",FwPrimaryVersionArr);
  2376. json_object_object_add(jobj1,"FwSecondVersion",FwSecondVersionArr);
  2377. }
  2378. if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0){
  2379. json_object_object_add(jobj1,"DispenserQuantity",DispenserQuantity);
  2380. json_object_object_add(jobj1,"TotalConnectorQuantity",TotalConnectorQuantity);
  2381. json_object_object_add(jobj1,"DDModelName",DDModelNameArr);
  2382. json_object_object_add(jobj1,"DDSerialNumber",DDSerialNumberArr);
  2383. json_object_object_add(jobj1,"DDSystemId",DDSystemIdArr);
  2384. json_object_object_add(jobj1,"DDAuthorisationMode",DDAuthorisationModeArr);
  2385. json_object_object_add(jobj1,"DDRfidCardNumEndian",DDRfidCardNumEndianArr);
  2386. json_object_object_add(jobj1,"DDisAPP",DDisAPPArr);
  2387. json_object_object_add(jobj1,"DDisQRCode",DDisQRCodeArr);
  2388. json_object_object_add(jobj1,"DDisRFID",DDisRFIDArr);
  2389. json_object_object_add(jobj1,"DDQRCodeMadeMode",DDQRCodeMadeModeArr);
  2390. json_object_object_add(jobj1,"DDQRCodeContent",DDQRCodeContentArr);
  2391. json_object_object_add(jobj1,"DDFactoryConfiguration",DDFactoryConfigurationArr);
  2392. json_object_object_add(jobj1,"DDCsuBootLoadFwRev",DDCsuBootLoadFwRevArr);
  2393. json_object_object_add(jobj1,"DDCsuKernelFwRev",DDCsuKernelFwRevArr);
  2394. json_object_object_add(jobj1,"DDCsuRootFsFwRev",DDCsuRootFsFwRevArr);
  2395. json_object_object_add(jobj1,"DDCsuPrimFwRev",DDCsuPrimFwRevArr);
  2396. json_object_object_add(jobj1,"DDLcmFwRev",DDLcmFwRevArr);
  2397. json_object_object_add(jobj1,"DDPsuPrimFwRev",DDPsuPrimFwRevArr);
  2398. json_object_object_add(jobj1,"DDPsuSecFwRev",DDPsuSecFwRevArr);
  2399. json_object_object_add(jobj1,"DDFanModuleFwRev",DDFanModuleFwRevArr);
  2400. json_object_object_add(jobj1,"DDRelayModuleFwRev",DDRelayModuleFwRevArr);
  2401. json_object_object_add(jobj1,"DDTelcomModemFwRev",DDTelcomModemFwRevArr);
  2402. json_object_object_add(jobj1,"DDLedModuleFwRev",DDLedModuleFwRevArr);
  2403. json_object_object_add(jobj1,"DDConnector1FwRev",DDConnector1FwRevArr);
  2404. json_object_object_add(jobj1,"DDConnector2FwRev",DDConnector2FwRevArr);
  2405. json_object_object_add(jobj1,"DDIntensity",DDIntensityArr);
  2406. json_object_object_add(jobj1,"Relay2ModuleFwRev",Relay2ModuleFwRev);
  2407. }
  2408. printf("%s\n", json_object_to_json_string(jobj1));
  2409. json_object_put(jobj1);
  2410. //charging
  2411. json_object_object_add(jobj2,"MaxChargingEnergy",MaxChargingEnergy);
  2412. json_object_object_add(jobj2,"MaxChargingPower",MaxChargingPower);
  2413. json_object_object_add(jobj2,"MaxChargingCurrent",MaxChargingCurrent);
  2414. json_object_object_add(jobj2,"AcMaxChargingCurrent",AcMaxChargingCurrent);
  2415. json_object_object_add(jobj2,"MaxChargingDuration",MaxChargingDuration);
  2416. json_object_object_add(jobj2,"StopChargingByButton",StopChargingByButton);
  2417. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[0]);
  2418. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[1]);
  2419. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[2]);
  2420. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[3]);
  2421. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[4]);
  2422. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[5]);
  2423. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[6]);
  2424. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[7]);
  2425. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[8]);
  2426. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[9]);
  2427. json_object_object_add(jobj2,"LocalWhiteCard",LocalWhiteCardArr);
  2428. json_object_object_add(jobj2,"isBilling",isBilling);
  2429. json_object_object_add(jobj2,"Currency",Currency);
  2430. json_object_array_add(FeeArr,Fee[0]);
  2431. json_object_array_add(FeeArr,Fee[1]);
  2432. json_object_array_add(FeeArr,Fee[2]);
  2433. json_object_array_add(FeeArr,Fee[3]);
  2434. json_object_array_add(FeeArr,Fee[4]);
  2435. json_object_array_add(FeeArr,Fee[5]);
  2436. json_object_array_add(FeeArr,Fee[6]);
  2437. json_object_array_add(FeeArr,Fee[7]);
  2438. json_object_array_add(FeeArr,Fee[8]);
  2439. json_object_array_add(FeeArr,Fee[9]);
  2440. json_object_array_add(FeeArr,Fee[10]);
  2441. json_object_array_add(FeeArr,Fee[11]);
  2442. json_object_array_add(FeeArr,Fee[12]);
  2443. json_object_array_add(FeeArr,Fee[13]);
  2444. json_object_array_add(FeeArr,Fee[14]);
  2445. json_object_array_add(FeeArr,Fee[15]);
  2446. json_object_array_add(FeeArr,Fee[16]);
  2447. json_object_array_add(FeeArr,Fee[17]);
  2448. json_object_array_add(FeeArr,Fee[18]);
  2449. json_object_array_add(FeeArr,Fee[19]);
  2450. json_object_array_add(FeeArr,Fee[20]);
  2451. json_object_array_add(FeeArr,Fee[21]);
  2452. json_object_array_add(FeeArr,Fee[22]);
  2453. json_object_array_add(FeeArr,Fee[23]);
  2454. json_object_object_add(jobj2,"Fee",FeeArr);
  2455. if(connectorType1 != 0){
  2456. json_object_object_add(ChargingInfo1,"StartUserId",StartUserId[0]);
  2457. json_object_object_add(ChargingInfo1,"StartDateTime",StartDateTime[0]);
  2458. json_object_object_add(ChargingInfo1,"StopDateTime",StopDateTime[0]);
  2459. json_object_object_add(ChargingInfo1,"StartMethod",StartMethod[0]);
  2460. json_object_object_add(ChargingInfo1,"ConnectorTemp",ConnectorTemp[0]);
  2461. json_object_object_add(ChargingInfo1,"ChillerTemp",ChillerTemp[0]);
  2462. json_object_object_add(ChargingInfo1,"PresentChargingVoltage",PresentChargingVoltage[0]);
  2463. json_object_object_add(ChargingInfo1,"PresentChargingCurrent",PresentChargingCurrent[0]);
  2464. json_object_object_add(ChargingInfo1,"PresentChargingPower",PresentChargingPower[0]);
  2465. json_object_object_add(ChargingInfo1,"PresentChargedEnergy",PresentChargedEnergy[0]);
  2466. json_object_object_add(ChargingInfo1,"PresentChargedDuration",PresentChargedDuration[0]);
  2467. json_object_object_add(ChargingInfo1,"RemainChargingDuration",RemainChargingDuration[0]);
  2468. json_object_object_add(ChargingInfo1,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[0]);
  2469. json_object_object_add(ChargingInfo1,"EvBatterytargetVoltage",EvBatterytargetVoltage[0]);
  2470. json_object_object_add(ChargingInfo1,"EvBatterySoc",EvBatterySoc[0]);
  2471. json_object_object_add(ChargingInfo1,"SystemStatus",SystemStatus[0]);
  2472. json_object_object_add(ChargingInfo1,"EvBatterytargetCurrent",EvBatterytargetCurrent[0]);
  2473. json_object_object_add(ChargingInfo1,"PowerConsumption",PowerConsumption[0]);
  2474. if(strcmp(IsDO, "AX") == 0){
  2475. json_object_object_add(ChargingInfo1,"isCalibratedVaGain",isCalibratedVaGain[0]);
  2476. json_object_object_add(ChargingInfo1,"isCalibratedVbGain",isCalibratedVbGain[0]);
  2477. json_object_object_add(ChargingInfo1,"isCalibratedVcGain",isCalibratedVcGain[0]);
  2478. json_object_object_add(ChargingInfo1,"isCalibratedVaOffset",isCalibratedVaOffset[0]);
  2479. json_object_object_add(ChargingInfo1,"isCalibratedVbOffset",isCalibratedVbOffset[0]);
  2480. json_object_object_add(ChargingInfo1,"isCalibratedVcOffset",isCalibratedVcOffset[0]);
  2481. json_object_object_add(ChargingInfo1,"isCalibratedCaGain",isCalibratedCaGain[0]);
  2482. json_object_object_add(ChargingInfo1,"isCalibratedCbGain",isCalibratedCbGain[0]);
  2483. json_object_object_add(ChargingInfo1,"isCalibratedCcGain",isCalibratedCcGain[0]);
  2484. json_object_object_add(ChargingInfo1,"isCalibratedCaOffset",isCalibratedCaOffset[0]);
  2485. json_object_object_add(ChargingInfo1,"isCalibratedCbOffset",isCalibratedCbOffset[0]);
  2486. json_object_object_add(ChargingInfo1,"isCalibratedCcOffset",isCalibratedCcOffset[0]);
  2487. json_object_object_add(ChargingInfo1,"isCalibratedPa",isCalibratedPa[0]);
  2488. json_object_object_add(ChargingInfo1,"isCalibratedPb",isCalibratedPb[0]);
  2489. json_object_object_add(ChargingInfo1,"isCalibratedPc",isCalibratedPc[0]);
  2490. }
  2491. json_object_object_add(jobj2,"ChargingInfo1",ChargingInfo1);
  2492. }
  2493. if(connectorType2 != 0){
  2494. json_object_object_add(ChargingInfo2,"StartUserId",StartUserId[1]);
  2495. json_object_object_add(ChargingInfo2,"StartDateTime",StartDateTime[1]);
  2496. json_object_object_add(ChargingInfo2,"StopDateTime",StopDateTime[1]);
  2497. json_object_object_add(ChargingInfo2,"StartMethod",StartMethod[1]);
  2498. json_object_object_add(ChargingInfo2,"ConnectorTemp",ConnectorTemp[1]);
  2499. json_object_object_add(ChargingInfo2,"ChillerTemp",ChillerTemp[1]);
  2500. json_object_object_add(ChargingInfo2,"PresentChargingVoltage",PresentChargingVoltage[1]);
  2501. json_object_object_add(ChargingInfo2,"PresentChargingCurrent",PresentChargingCurrent[1]);
  2502. json_object_object_add(ChargingInfo2,"PresentChargingPower",PresentChargingPower[1]);
  2503. json_object_object_add(ChargingInfo2,"PresentChargedEnergy",PresentChargedEnergy[1]);
  2504. json_object_object_add(ChargingInfo2,"PresentChargedDuration",PresentChargedDuration[1]);
  2505. json_object_object_add(ChargingInfo2,"RemainChargingDuration",RemainChargingDuration[1]);
  2506. json_object_object_add(ChargingInfo2,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[1]);
  2507. json_object_object_add(ChargingInfo2,"EvBatterytargetVoltage",EvBatterytargetVoltage[1]);
  2508. json_object_object_add(ChargingInfo2,"EvBatterySoc",EvBatterySoc[1]);
  2509. json_object_object_add(ChargingInfo2,"SystemStatus",SystemStatus[1]);
  2510. json_object_object_add(ChargingInfo2,"EvBatterytargetCurrent",EvBatterytargetCurrent[1]);
  2511. json_object_object_add(ChargingInfo2,"PowerConsumption",PowerConsumption[1]);
  2512. if(strcmp(IsDO, "AX") == 0){
  2513. json_object_object_add(ChargingInfo2,"isCalibratedVaGain",isCalibratedVaGain[1]);
  2514. json_object_object_add(ChargingInfo2,"isCalibratedVbGain",isCalibratedVbGain[1]);
  2515. json_object_object_add(ChargingInfo2,"isCalibratedVcGain",isCalibratedVcGain[1]);
  2516. json_object_object_add(ChargingInfo2,"isCalibratedVaOffset",isCalibratedVaOffset[1]);
  2517. json_object_object_add(ChargingInfo2,"isCalibratedVbOffset",isCalibratedVbOffset[1]);
  2518. json_object_object_add(ChargingInfo2,"isCalibratedVcOffset",isCalibratedVcOffset[1]);
  2519. json_object_object_add(ChargingInfo2,"isCalibratedCaGain",isCalibratedCaGain[1]);
  2520. json_object_object_add(ChargingInfo2,"isCalibratedCbGain",isCalibratedCbGain[1]);
  2521. json_object_object_add(ChargingInfo2,"isCalibratedCcGain",isCalibratedCcGain[1]);
  2522. json_object_object_add(ChargingInfo2,"isCalibratedCaOffset",isCalibratedCaOffset[1]);
  2523. json_object_object_add(ChargingInfo2,"isCalibratedCbOffset",isCalibratedCbOffset[1]);
  2524. json_object_object_add(ChargingInfo2,"isCalibratedCcOffset",isCalibratedCcOffset[1]);
  2525. json_object_object_add(ChargingInfo2,"isCalibratedPa",isCalibratedPa[1]);
  2526. json_object_object_add(ChargingInfo2,"isCalibratedPb",isCalibratedPb[1]);
  2527. json_object_object_add(ChargingInfo2,"isCalibratedPc",isCalibratedPc[1]);
  2528. }
  2529. json_object_object_add(jobj2,"ChargingInfo2",ChargingInfo2);
  2530. }
  2531. if(connectorType3 != 0){
  2532. json_object_object_add(ChargingInfo3,"StartUserId",StartUserId[2]);
  2533. json_object_object_add(ChargingInfo3,"StartDateTime",StartDateTime[2]);
  2534. json_object_object_add(ChargingInfo3,"StopDateTime",StopDateTime[2]);
  2535. json_object_object_add(ChargingInfo3,"StartMethod",StartMethod[2]);
  2536. json_object_object_add(ChargingInfo3,"ConnectorTemp",ConnectorTemp[2]);
  2537. json_object_object_add(ChargingInfo3,"ChillerTemp",ChillerTemp[2]);
  2538. json_object_object_add(ChargingInfo3,"PresentChargingVoltage",PresentChargingVoltage[2]);
  2539. json_object_object_add(ChargingInfo3,"PresentChargingCurrent",PresentChargingCurrent[2]);
  2540. json_object_object_add(ChargingInfo3,"PresentChargingPower",PresentChargingPower[2]);
  2541. json_object_object_add(ChargingInfo3,"PresentChargedEnergy",PresentChargedEnergy[2]);
  2542. json_object_object_add(ChargingInfo3,"PresentChargedDuration",PresentChargedDuration[2]);
  2543. json_object_object_add(ChargingInfo3,"RemainChargingDuration",RemainChargingDuration[2]);
  2544. json_object_object_add(ChargingInfo3,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[2]);
  2545. json_object_object_add(ChargingInfo3,"EvBatterytargetVoltage",EvBatterytargetVoltage[2]);
  2546. json_object_object_add(ChargingInfo3,"EvBatterySoc",EvBatterySoc[2]);
  2547. json_object_object_add(ChargingInfo3,"SystemStatus",SystemStatus[2]);
  2548. json_object_object_add(ChargingInfo3,"EvBatterytargetCurrent",EvBatterytargetCurrent[2]);
  2549. json_object_object_add(ChargingInfo3,"PowerConsumption",PowerConsumption[2]);
  2550. if(strcmp(IsDO, "AX") == 0){
  2551. json_object_object_add(ChargingInfo3,"isCalibratedVaGain",isCalibratedVaGain[2]);
  2552. json_object_object_add(ChargingInfo3,"isCalibratedVbGain",isCalibratedVbGain[2]);
  2553. json_object_object_add(ChargingInfo3,"isCalibratedVcGain",isCalibratedVcGain[2]);
  2554. json_object_object_add(ChargingInfo3,"isCalibratedVaOffset",isCalibratedVaOffset[2]);
  2555. json_object_object_add(ChargingInfo3,"isCalibratedVbOffset",isCalibratedVbOffset[2]);
  2556. json_object_object_add(ChargingInfo3,"isCalibratedVcOffset",isCalibratedVcOffset[2]);
  2557. json_object_object_add(ChargingInfo3,"isCalibratedCaGain",isCalibratedCaGain[2]);
  2558. json_object_object_add(ChargingInfo3,"isCalibratedCbGain",isCalibratedCbGain[2]);
  2559. json_object_object_add(ChargingInfo3,"isCalibratedCcGain",isCalibratedCcGain[2]);
  2560. json_object_object_add(ChargingInfo3,"isCalibratedCaOffset",isCalibratedCaOffset[2]);
  2561. json_object_object_add(ChargingInfo3,"isCalibratedCbOffset",isCalibratedCbOffset[2]);
  2562. json_object_object_add(ChargingInfo3,"isCalibratedCcOffset",isCalibratedCcOffset[2]);
  2563. json_object_object_add(ChargingInfo3,"isCalibratedPa",isCalibratedPa[2]);
  2564. json_object_object_add(ChargingInfo3,"isCalibratedPb",isCalibratedPb[2]);
  2565. json_object_object_add(ChargingInfo3,"isCalibratedPc",isCalibratedPc[2]);
  2566. }
  2567. json_object_object_add(jobj2,"ChargingInfo3",ChargingInfo3);
  2568. }
  2569. if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0){
  2570. if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity>4|| ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity<0)ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=0;
  2571. int DDTotalConnectorQuantity = ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity;
  2572. DDChargingInfo1=json_object_new_object();
  2573. DDChargingInfo2=json_object_new_object();
  2574. DDChargingInfo3=json_object_new_object();
  2575. DDChargingInfo4=json_object_new_object();
  2576. if(DDTotalConnectorQuantity>0){
  2577. json_object_object_add(DDChargingInfo1,"StartUserId",DDStartUserId[0]);
  2578. json_object_object_add(DDChargingInfo1,"StartDateTime",DDStartDateTime[0]);
  2579. json_object_object_add(DDChargingInfo1,"StopDateTime",DDStopDateTime[0]);
  2580. json_object_object_add(DDChargingInfo1,"StartMethod",DDStartMethod[0]);
  2581. json_object_object_add(DDChargingInfo1,"ConnectorTemp",DDConnectorTemp[0]);
  2582. json_object_object_add(DDChargingInfo1,"ChillerTemp",DDChillerTemp[0]);
  2583. json_object_object_add(DDChargingInfo1,"PresentChargingVoltage",DDPresentChargingVoltage[0]);
  2584. json_object_object_add(DDChargingInfo1,"PresentChargingCurrent",DDPresentChargingCurrent[0]);
  2585. json_object_object_add(DDChargingInfo1,"PresentChargingPower",DDPresentChargingPower[0]);
  2586. json_object_object_add(DDChargingInfo1,"PresentChargedEnergy",DDPresentChargedEnergy[0]);
  2587. json_object_object_add(DDChargingInfo1,"PresentChargedDuration",DDPresentChargedDuration[0]);
  2588. json_object_object_add(DDChargingInfo1,"RemainChargingDuration",DDRemainChargingDuration[0]);
  2589. json_object_object_add(DDChargingInfo1,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[0]);
  2590. json_object_object_add(DDChargingInfo1,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[0]);
  2591. json_object_object_add(DDChargingInfo1,"EvBatterySoc",DDEvBatterySoc[0]);
  2592. json_object_object_add(DDChargingInfo1,"SystemStatus",DDSystemStatus[0]);
  2593. json_object_object_add(DDChargingInfo1,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[0]);
  2594. json_object_object_add(DDChargingInfo1,"PowerConsumption",DDPowerConsumption[0]);
  2595. json_object_object_add(jobj2,"DDChargingInfo1",DDChargingInfo1);
  2596. }
  2597. if(DDTotalConnectorQuantity>1){
  2598. json_object_object_add(DDChargingInfo2,"StartUserId",DDStartUserId[1]);
  2599. json_object_object_add(DDChargingInfo2,"StartDateTime",DDStartDateTime[1]);
  2600. json_object_object_add(DDChargingInfo2,"StopDateTime",DDStopDateTime[1]);
  2601. json_object_object_add(DDChargingInfo2,"StartMethod",DDStartMethod[1]);
  2602. json_object_object_add(DDChargingInfo2,"ConnectorTemp",DDConnectorTemp[1]);
  2603. json_object_object_add(DDChargingInfo2,"ChillerTemp",DDChillerTemp[1]);
  2604. json_object_object_add(DDChargingInfo2,"PresentChargingVoltage",DDPresentChargingVoltage[1]);
  2605. json_object_object_add(DDChargingInfo2,"PresentChargingCurrent",DDPresentChargingCurrent[1]);
  2606. json_object_object_add(DDChargingInfo2,"PresentChargingPower",DDPresentChargingPower[1]);
  2607. json_object_object_add(DDChargingInfo2,"PresentChargedEnergy",DDPresentChargedEnergy[1]);
  2608. json_object_object_add(DDChargingInfo2,"PresentChargedDuration",DDPresentChargedDuration[1]);
  2609. json_object_object_add(DDChargingInfo2,"RemainChargingDuration",DDRemainChargingDuration[1]);
  2610. json_object_object_add(DDChargingInfo2,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[1]);
  2611. json_object_object_add(DDChargingInfo2,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[1]);
  2612. json_object_object_add(DDChargingInfo2,"EvBatterySoc",DDEvBatterySoc[1]);
  2613. json_object_object_add(DDChargingInfo2,"SystemStatus",DDSystemStatus[1]);
  2614. json_object_object_add(DDChargingInfo2,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[1]);
  2615. json_object_object_add(DDChargingInfo2,"PowerConsumption",DDPowerConsumption[1]);
  2616. json_object_object_add(jobj2,"DDChargingInfo2",DDChargingInfo2);
  2617. }
  2618. if(DDTotalConnectorQuantity>2){
  2619. json_object_object_add(DDChargingInfo3,"StartUserId",DDStartUserId[2]);
  2620. json_object_object_add(DDChargingInfo3,"StartDateTime",DDStartDateTime[2]);
  2621. json_object_object_add(DDChargingInfo3,"StopDateTime",DDStopDateTime[2]);
  2622. json_object_object_add(DDChargingInfo3,"StartMethod",DDStartMethod[2]);
  2623. json_object_object_add(DDChargingInfo3,"ConnectorTemp",DDConnectorTemp[2]);
  2624. json_object_object_add(DDChargingInfo3,"ChillerTemp",DDChillerTemp[2]);
  2625. json_object_object_add(DDChargingInfo3,"PresentChargingVoltage",DDPresentChargingVoltage[2]);
  2626. json_object_object_add(DDChargingInfo3,"PresentChargingCurrent",DDPresentChargingCurrent[2]);
  2627. json_object_object_add(DDChargingInfo3,"PresentChargingPower",DDPresentChargingPower[2]);
  2628. json_object_object_add(DDChargingInfo3,"PresentChargedEnergy",DDPresentChargedEnergy[2]);
  2629. json_object_object_add(DDChargingInfo3,"PresentChargedDuration",DDPresentChargedDuration[2]);
  2630. json_object_object_add(DDChargingInfo3,"RemainChargingDuration",DDRemainChargingDuration[2]);
  2631. json_object_object_add(DDChargingInfo3,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[2]);
  2632. json_object_object_add(DDChargingInfo3,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[2]);
  2633. json_object_object_add(DDChargingInfo3,"EvBatterySoc",DDEvBatterySoc[2]);
  2634. json_object_object_add(DDChargingInfo3,"SystemStatus",DDSystemStatus[2]);
  2635. json_object_object_add(DDChargingInfo3,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[2]);
  2636. json_object_object_add(DDChargingInfo3,"PowerConsumption",DDPowerConsumption[2]);
  2637. json_object_object_add(jobj2,"DDChargingInfo3",DDChargingInfo3);
  2638. }
  2639. if(DDTotalConnectorQuantity>3){
  2640. json_object_object_add(DDChargingInfo4,"StartUserId",DDStartUserId[3]);
  2641. json_object_object_add(DDChargingInfo4,"StartDateTime",DDStartDateTime[3]);
  2642. json_object_object_add(DDChargingInfo4,"StopDateTime",DDStopDateTime[3]);
  2643. json_object_object_add(DDChargingInfo4,"StartMethod",DDStartMethod[3]);
  2644. json_object_object_add(DDChargingInfo4,"ConnectorTemp",DDConnectorTemp[3]);
  2645. json_object_object_add(DDChargingInfo4,"ChillerTemp",DDChillerTemp[3]);
  2646. json_object_object_add(DDChargingInfo4,"PresentChargingVoltage",DDPresentChargingVoltage[3]);
  2647. json_object_object_add(DDChargingInfo4,"PresentChargingCurrent",DDPresentChargingCurrent[3]);
  2648. json_object_object_add(DDChargingInfo4,"PresentChargingPower",DDPresentChargingPower[3]);
  2649. json_object_object_add(DDChargingInfo4,"PresentChargedEnergy",DDPresentChargedEnergy[3]);
  2650. json_object_object_add(DDChargingInfo4,"PresentChargedDuration",DDPresentChargedDuration[3]);
  2651. json_object_object_add(DDChargingInfo4,"RemainChargingDuration",DDRemainChargingDuration[3]);
  2652. json_object_object_add(DDChargingInfo4,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[3]);
  2653. json_object_object_add(DDChargingInfo4,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[3]);
  2654. json_object_object_add(DDChargingInfo4,"EvBatterySoc",DDEvBatterySoc[3]);
  2655. json_object_object_add(DDChargingInfo4,"SystemStatus",DDSystemStatus[3]);
  2656. json_object_object_add(DDChargingInfo4,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[3]);
  2657. json_object_object_add(DDChargingInfo4,"PowerConsumption",DDPowerConsumption[3]);
  2658. json_object_object_add(jobj2,"DDChargingInfo4",DDChargingInfo4);
  2659. }
  2660. }
  2661. printf("%s\n", json_object_to_json_string(jobj2));
  2662. json_object_put(jobj2);
  2663. //network
  2664. json_object_object_add(jobj3,"InternetConn",InternetConn);
  2665. json_object_object_add(jobj3,"FtpServer",FtpServer);
  2666. json_object_object_add(jobj3,"Eth0DhcpClient",Eth0DhcpClient);
  2667. json_object_object_add(jobj3,"Eth0MacAddress",Eth0MacAddress);
  2668. json_object_object_add(jobj3,"Eth0IpAddress",Eth0IpAddress);
  2669. json_object_object_add(jobj3,"Eth0SubmaskAddress",Eth0SubmaskAddress);
  2670. json_object_object_add(jobj3,"Eth0GatewayAddress",Eth0GatewayAddress);
  2671. json_object_object_add(jobj3,"Eth1DhcpClient",Eth1DhcpClient);
  2672. json_object_object_add(jobj3,"Eth1MacAddress",Eth1MacAddress);
  2673. json_object_object_add(jobj3,"Eth1IpAddress",Eth1IpAddress);
  2674. json_object_object_add(jobj3,"Eth1SubmaskAddress",Eth1SubmaskAddress);
  2675. json_object_object_add(jobj3,"Eth1GatewayAddress",Eth1GatewayAddress);
  2676. json_object_object_add(jobj3,"WifiMode",WifiMode);
  2677. json_object_object_add(jobj3,"WifiSsid",WifiSsid);
  2678. json_object_object_add(jobj3,"WifiPassword",WifiPassword);
  2679. json_object_object_add(jobj3,"WifiRssi",WifiRssi);
  2680. json_object_object_add(jobj3,"WifiDhcpServer",WifiDhcpServer);
  2681. json_object_object_add(jobj3,"WifiDhcpClient",WifiDhcpClient);
  2682. json_object_object_add(jobj3,"WifiMacAddress",WifiMacAddress);
  2683. json_object_object_add(jobj3,"WifiIpAddress",WifiIpAddress);
  2684. json_object_object_add(jobj3,"WifiSubmaskAddress",WifiSubmaskAddress);
  2685. json_object_object_add(jobj3,"WifiGatewayAddress",WifiGatewayAddress);
  2686. json_object_object_add(jobj3,"WifiNetworkConn",WifiNetworkConn);
  2687. json_object_object_add(jobj3,"TelcomApn",TelcomApn);
  2688. json_object_object_add(jobj3,"TelcomRssi",TelcomRssi);
  2689. json_object_object_add(jobj3,"TelcomChapPapId",TelcomChapPapId);
  2690. json_object_object_add(jobj3,"TelcomChapPapPwd",TelcomChapPapPwd);
  2691. json_object_object_add(jobj3,"TelcomModemImei",TelcomModemImei);
  2692. json_object_object_add(jobj3,"TelcomSimImsi",TelcomSimImsi);
  2693. json_object_object_add(jobj3,"TelcomSimIccid",TelcomSimIccid);
  2694. json_object_object_add(jobj3,"TelcomSimStatus",TelcomSimStatus);
  2695. json_object_object_add(jobj3,"TelcomModemMode",TelcomModemMode);
  2696. json_object_object_add(jobj3,"TelcomIpAddress",TelcomIpAddress);
  2697. json_object_object_add(jobj3,"TelcomNetworkConn",TelcomNetworkConn);
  2698. json_object_object_add(jobj3,"TelcomEnabled",TelcomEnabled);
  2699. printf("%s\n", json_object_to_json_string(jobj3));
  2700. json_object_put(jobj3);
  2701. //backend
  2702. json_object_object_add(jobj4,"BackendConnTimeout",BackendConnTimeout);
  2703. json_object_object_add(jobj4,"OfflinePolicy",OfflinePolicy);
  2704. json_object_object_add(jobj4,"OfflineMaxChargeEnergy",OfflineMaxChargeEnergy);
  2705. json_object_object_add(jobj4,"OfflineMaxChargeDuration",OfflineMaxChargeDuration);
  2706. json_object_object_add(jobj4,"OcppConnStatus",OcppConnStatus);
  2707. json_object_object_add(jobj4,"MaintainServerConnStatus",MaintainServerConnStatus);
  2708. json_object_object_add(jobj4,"OcppServerURL",OcppServerURL);
  2709. json_object_object_add(jobj4,"ChargeBoxId",ChargeBoxId);
  2710. json_object_object_add(jobj4,"chargePointVendor",chargePointVendor);
  2711. json_object_object_add(jobj4,"OcppSecurityProfile",OcppSecurityProfile);
  2712. json_object_object_add(jobj4,"OcppSecurityPassword",OcppSecurityPassword);
  2713. json_object_object_add(jobj4,"MaintainServerSecurityProfile",MaintainServerSecurityProfile);
  2714. json_object_object_add(jobj4,"MaintainServerSecurityPassword",MaintainServerSecurityPassword);
  2715. json_object_object_add(jobj4,"MaintainServerURL",MaintainServerURL);
  2716. if(strcmp(IsDO, "AX") == 0){
  2717. json_object_object_add(jobj4,"isEnableLocalPowerSharging",isEnableLocalPowerSharging);
  2718. json_object_object_add(jobj4,"PowerSharingServerIP",PowerSharingServerIP);
  2719. }
  2720. if(strcmp(IsDO, "AX") == 0 || strcmp(IsAcDc, "D") == 0){
  2721. json_object_object_add(jobj4,"OcppReceiptrURL",OcppReceiptrURL);
  2722. }
  2723. /*for TTIA*/
  2724. if(strcmp(IsAcDc, "D") == 0 && strcmp(SafetyRegulation, "C") == 0){
  2725. json_object_object_add(jobj4,"isEnableTTIA",isEnableTTIA);
  2726. json_object_object_add(jobj4,"server_addr",server_addr);
  2727. json_object_object_add(jobj4,"server_port",server_port);
  2728. json_object_object_add(jobj4,"busVenderId",busVenderId);
  2729. json_object_object_add(jobj4,"EquipmentProvider",EquipmentProvider);
  2730. json_object_object_add(jobj4,"TransportationCompanyNo",TransportationCompanyNo);
  2731. json_object_object_add(jobj4,"TTIAChargeBoxId",TTIAChargeBoxId);
  2732. json_object_object_add(jobj4,"evseStation",evseStation);
  2733. }
  2734. printf("%s\n", json_object_to_json_string(jobj4));
  2735. json_object_put(jobj4);
  2736. }
  2737. // for(;;)
  2738. // {
  2739. // }
  2740. return FAIL;
  2741. }
  2742. /**
  2743. * HTTP get request/response
  2744. * @param url
  2745. * @param responseData
  2746. * @return
  2747. */
  2748. int httpGet(uint8_t *url, uint8_t *responseData)
  2749. {
  2750. int result = FAIL;
  2751. CURL *curl;
  2752. CURLcode res;
  2753. curl_global_init(CURL_GLOBAL_ALL);
  2754. curl = curl_easy_init();
  2755. if(curl)
  2756. {
  2757. curl_easy_setopt(curl, CURLOPT_URL, (char*)url);
  2758. curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
  2759. curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
  2760. //curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
  2761. //curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen((char*)postData));
  2762. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
  2763. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
  2764. //curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
  2765. //curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
  2766. curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 2500L);
  2767. res = curl_easy_perform(curl);
  2768. if(res != CURLE_OK)
  2769. {
  2770. DEBUG_ERROR("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
  2771. }
  2772. else
  2773. {
  2774. if(chunk.size > 0)
  2775. {
  2776. // DEBUG_INFO("Response content: %s\n", chunk.memory);
  2777. // DEBUG_INFO("Response content: %s\n", responseData);
  2778. memcpy(responseData, chunk.memory, ARRAY_SIZE(chunk.memory));
  2779. }
  2780. result = PASS;
  2781. }
  2782. curl_easy_cleanup(curl);
  2783. }
  2784. curl_global_cleanup();
  2785. return result;
  2786. }
  2787. /**
  2788. * HTTP post request/response
  2789. * @param url
  2790. * @param postData
  2791. * @return
  2792. */
  2793. int httpPost(uint8_t *url, uint8_t *postData, uint8_t *responseData)
  2794. {
  2795. int result = FAIL;
  2796. CURL *curl;
  2797. CURLcode res;
  2798. curl_global_init(CURL_GLOBAL_ALL);
  2799. curl = curl_easy_init();
  2800. if(curl)
  2801. {
  2802. curl_easy_setopt(curl, CURLOPT_URL, (char*)url);
  2803. curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
  2804. curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
  2805. //curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
  2806. curl_easy_setopt(curl, CURLOPT_POSTFIELDS, (char*)postData);
  2807. //curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen((char*)postData));
  2808. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
  2809. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
  2810. //curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
  2811. //curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
  2812. // curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 2500L);
  2813. curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L);
  2814. res = curl_easy_perform(curl);
  2815. if(res != CURLE_OK)
  2816. {
  2817. DEBUG_ERROR("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
  2818. }
  2819. else
  2820. {
  2821. if(chunk.size > 0)
  2822. {
  2823. //DEBUG_INFO("Response content: %s\n", chunk.memory);
  2824. memcpy(responseData, chunk.memory, ARRAY_SIZE(chunk.memory));
  2825. }
  2826. result = PASS;
  2827. }
  2828. curl_easy_cleanup(curl);
  2829. }
  2830. curl_global_cleanup();
  2831. return result;
  2832. }