WebService.c 103 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911
  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> /*Unix 標準函數定義*/
  20. #include <fcntl.h> /*檔控制定義*/
  21. #include <termios.h> /*PPSIX 終端控制定義*/
  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 "define.h"
  30. #include "json.h"
  31. #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  32. #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  33. #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  34. #define Debug
  35. #define SystemLogMessage
  36. #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
  37. #define PASS 1
  38. #define FAIL -1
  39. #define MtdBlockSize 0x600000
  40. struct SysConfigAndInfo *ShmSysConfigAndInfo;
  41. struct StatusCodeData *ShmStatusCodeData;
  42. struct CHAdeMOData *ShmCHAdeMOData;
  43. struct GBTData *ShmGBTData;
  44. struct CcsData *ShmCcsData;
  45. struct PsuData *ShmPsuData;
  46. struct PrimaryMcuData *ShmPrimaryMcuData;
  47. void trim(char *s);
  48. int mystrcmp(char *p1, char *p2);
  49. void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
  50. void split(char **arr, char *str, const char *del);
  51. #ifdef SystemLogMessage
  52. int StoreLogMsg(const char *fmt, ...) {
  53. char Buf[4096 + 256];
  54. char buffer[4096];
  55. time_t CurrentTime;
  56. struct tm *tm;
  57. va_list args;
  58. va_start(args, fmt);
  59. int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
  60. va_end(args);
  61. memset(Buf, 0, sizeof(Buf));
  62. CurrentTime = time(NULL);
  63. tm = localtime(&CurrentTime);
  64. sprintf(Buf,
  65. "echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
  66. tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
  67. tm->tm_min, tm->tm_sec, buffer, tm->tm_year + 1900, tm->tm_mon + 1);
  68. system(Buf);
  69. #ifdef Debug
  70. printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year + 1900,
  71. tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
  72. buffer);
  73. #endif
  74. return rc;
  75. }
  76. int WriteLogMsg(const char *fmt, ...) {
  77. char Buf[4096 + 256];
  78. char buffer[4096];
  79. time_t CurrentTime;
  80. struct tm *tm;
  81. va_list args;
  82. va_start(args, fmt);
  83. int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
  84. va_end(args);
  85. memset(Buf, 0, sizeof(Buf));
  86. CurrentTime = time(NULL);
  87. tm = localtime(&CurrentTime);
  88. sprintf(Buf,
  89. "echo \"[%04d.%02d.%02d %02d:%02d:%02d WebService] - %s\" >> /Storage/SystemLog/[%04d.%02d]WebService_SystemLog",
  90. tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
  91. tm->tm_min, tm->tm_sec, buffer, tm->tm_year + 1900, tm->tm_mon + 1);
  92. system(Buf);
  93. return rc;
  94. }
  95. #endif
  96. int DiffTimeb(struct timeb ST, struct timeb ET) {
  97. //return milli-second
  98. unsigned int StartTime, StopTime;
  99. StartTime = (unsigned int) ST.time;
  100. StopTime = (unsigned int) ET.time;
  101. return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
  102. }
  103. //=================================
  104. // Common routine
  105. //=================================
  106. void trim(char *s) {
  107. int i = 0, j, k, l = 0;
  108. while ((s[i] == ' ') || (s[i] == '\t') || (s[i] == '\n'))
  109. i++;
  110. j = strlen(s) - 1;
  111. while ((s[j] == ' ') || (s[j] == '\t') || (s[j] == '\n'))
  112. j--;
  113. if (i == 0 && j == strlen(s) - 1) {
  114. } else if (i == 0)
  115. s[j + 1] = '\0';
  116. else {
  117. for (k = i; k <= j; k++)
  118. s[l++] = s[k];
  119. s[l] = '\0';
  120. }
  121. }
  122. int mystrcmp(char *p1, char *p2) {
  123. while (*p1 == *p2) {
  124. if (*p1 == '\0' || *p2 == '\0')
  125. break;
  126. p1++;
  127. p2++;
  128. }
  129. if (*p1 == '\0' && *p2 == '\0')
  130. return (PASS);
  131. else
  132. return (FAIL);
  133. }
  134. void substr(char *dest, const char* src, unsigned int start, unsigned int cnt) {
  135. strncpy(dest, src + start, cnt);
  136. dest[cnt] = 0;
  137. }
  138. void split(char **arr, char *str, const char *del) {
  139. char *s = strtok(str, del);
  140. while (s != NULL) {
  141. *arr++ = s;
  142. s = strtok(NULL, del);
  143. }
  144. }
  145. int ConnectorType(char* connector){
  146. int result;
  147. if(strcmp(connector, "0") == 0){
  148. result= 0;
  149. }
  150. else if(strcmp(connector, "U") == 0 || strcmp(connector, "E") == 0){
  151. result= 1;//CCS
  152. }
  153. else if(strcmp(connector, "G") == 0 || strcmp(connector, "D") == 0){
  154. result= 2;//GB
  155. }
  156. else if(strcmp(connector, "J") == 0){
  157. result= 3;//CHAdeMO
  158. }
  159. 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){
  160. result= 4;//AC
  161. }
  162. else{
  163. result= 0;
  164. }
  165. return result;
  166. }
  167. int ModelType(char* type,char* network){
  168. int result=0;
  169. if(strcmp(type, "A") == 0){
  170. if(strcmp(network, "0") == 0 || strcmp(network, "R") == 0 || strcmp(network, "B") == 0){
  171. result=0;
  172. }
  173. else if(strcmp(network, "E") == 0 || strcmp(network, "W") == 0 || strcmp(network, "T") == 0 || strcmp(network, "U") == 0){
  174. result=1;
  175. }
  176. }
  177. else if(strcmp(type, "D") == 0){
  178. result=2;
  179. }
  180. return result;
  181. }
  182. // 四捨五入 取到 小數點第 2 位
  183. float rounding(float a)
  184. {
  185. return (int)(a*100+0.5)/100.0;
  186. }
  187. //==========================================
  188. // Init all share memory
  189. //==========================================
  190. int InitShareMemory() {
  191. int result = PASS;
  192. int MeterSMId;
  193. //creat ShmSysConfigAndInfo
  194. if ((MeterSMId = shmget(ShmSysConfigAndInfoKey,
  195. sizeof(struct SysConfigAndInfo), 0777)) < 0) {
  196. printf("%s\n","InitShareMemory Error");
  197. #ifdef SystemLogMessage
  198. DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
  199. #endif
  200. result = FAIL;
  201. } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0))
  202. == (void *) -1) {
  203. #ifdef SystemLogMessage
  204. DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
  205. #endif
  206. result = FAIL;
  207. } else {
  208. }
  209. //creat ShmStatusCodeData
  210. if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),
  211. 0777)) < 0) {
  212. #ifdef SystemLogMessage
  213. DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
  214. #endif
  215. result = FAIL;
  216. } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
  217. #ifdef SystemLogMessage
  218. DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
  219. #endif
  220. result = FAIL;
  221. } else {
  222. }
  223. //creat ShmPsuData
  224. if ((MeterSMId = shmget(ShmPsuKey, sizeof(struct PsuData),
  225. 0777)) < 0) {
  226. #ifdef SystemLogMessage
  227. DEBUG_ERROR("shmget ShmPsuData NG\n");
  228. #endif
  229. result = FAIL;
  230. } else if ((ShmPsuData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
  231. #ifdef SystemLogMessage
  232. DEBUG_ERROR("shmat ShmPsuData NG\n");
  233. #endif
  234. result = FAIL;
  235. } else {
  236. }
  237. //creat ShmPrimaryMcuData
  238. if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData),
  239. 0777)) < 0) {
  240. #ifdef SystemLogMessage
  241. DEBUG_ERROR("shmget ShmPrimaryMcuData NG\n");
  242. #endif
  243. result = FAIL;
  244. } else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
  245. #ifdef SystemLogMessage
  246. DEBUG_ERROR("shmat ShmPrimaryMcuData NG\n");
  247. #endif
  248. result = FAIL;
  249. } else {
  250. }
  251. return result;
  252. }
  253. int StoreUsrConfigData(struct SysConfigData *UsrData)
  254. {
  255. int result = PASS;
  256. int fd,wrd;
  257. unsigned int i,Chk;
  258. unsigned char *ptr, *BufTmp;
  259. Chk=0;
  260. ptr=(unsigned char *)UsrData;
  261. if((BufTmp=malloc(MtdBlockSize))!=NULL)
  262. {
  263. memset(BufTmp,0,MtdBlockSize);
  264. memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
  265. for(i=0;i<MtdBlockSize-4;i++)
  266. Chk+=*(BufTmp+i);
  267. memcpy( BufTmp+MtdBlockSize-4,&Chk,4);
  268. fd = open("/dev/mtdblock10", O_RDWR);
  269. if (fd>0)
  270. {
  271. wrd=write(fd, BufTmp, MtdBlockSize);
  272. close(fd);
  273. if(wrd>=MtdBlockSize)
  274. {
  275. fd = open("/dev/mtdblock11", O_RDWR);
  276. if (fd>0)
  277. {
  278. wrd=write(fd, BufTmp, MtdBlockSize);
  279. close(fd);
  280. if(wrd<MtdBlockSize)
  281. {
  282. DEBUG_ERROR("write /dev/mtdblock11(backup) NG\r\n");
  283. result = FAIL;
  284. }
  285. }
  286. else
  287. {
  288. DEBUG_ERROR("open /dev/mtdblock11(backup) NG\r\n");
  289. result = FAIL;
  290. }
  291. }
  292. else
  293. {
  294. DEBUG_ERROR("write /dev/mtdblock10 NG\r\n");
  295. result = FAIL;
  296. }
  297. }
  298. else
  299. {
  300. DEBUG_ERROR("open /dev/mtdblock10 NG\r\n");
  301. result = FAIL;
  302. }
  303. }
  304. else
  305. {
  306. DEBUG_ERROR("alloc BlockSize NG\r\n");
  307. result = FAIL;
  308. }
  309. if(BufTmp!=NULL)
  310. free(BufTmp);
  311. return result;
  312. }
  313. //================================================
  314. // Main process
  315. //================================================
  316. int main(int argc, char *argv[]) {
  317. //int InitShMry = 1;
  318. if (InitShareMemory() == FAIL) {
  319. //InitShMry = 0;
  320. #ifdef SystemLogMessage
  321. DEBUG_ERROR("InitShareMemory NG\n");
  322. #endif
  323. if (ShmStatusCodeData != NULL) {
  324. ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
  325. }
  326. sleep(5);
  327. return 0;
  328. }
  329. //web page submit
  330. if ((argc == 3) & (strlen(argv[1]) == 1)) {
  331. //web page submit system
  332. if (strcmp(argv[1], "1") == 0) {
  333. struct json_object *jobj = json_tokener_parse(argv[2]);
  334. json_object *val_obj = NULL;
  335. char *SystemId=NULL;
  336. char *SystemDateTime = NULL;
  337. int PhaseLossPolicy = 0;
  338. int FactoryConfiguration = 0;
  339. int AuthorisationMode = 0;
  340. int RfidCardNumEndian = 0;
  341. int PsuAcInputType = 0;
  342. char isAPP = 0;
  343. char isQRCode = 0;
  344. char isRFID = 0;
  345. char QRCodeMadeMode = 0;
  346. char *QRCodeContent = NULL;
  347. char Intensity = 0;
  348. if( json_object_object_get_ex(jobj, "SystemId", &val_obj) ) {
  349. SystemId = (char*)json_object_get_string(val_obj);
  350. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId,SystemId);
  351. }
  352. if( json_object_object_get_ex(jobj, "SystemDateTime", &val_obj) ) {
  353. SystemDateTime = (char*)json_object_get_string(val_obj);
  354. if(strlen(SystemDateTime)>0){
  355. char cmd[100];
  356. sprintf(cmd,"date -s '%s'",SystemDateTime);
  357. if(system(cmd)==0){
  358. system("hwclock -w");
  359. }
  360. }
  361. }
  362. if( json_object_object_get_ex(jobj, "PhaseLossPolicy", &val_obj) ) {
  363. PhaseLossPolicy = json_object_get_int(val_obj);
  364. ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy = PhaseLossPolicy;
  365. }
  366. if( json_object_object_get_ex(jobj, "FactoryConfiguration", &val_obj) ) {
  367. FactoryConfiguration = json_object_get_int(val_obj);
  368. ShmSysConfigAndInfo->SysInfo.FactoryConfiguration = FactoryConfiguration;
  369. }
  370. if( json_object_object_get_ex(jobj, "AuthorisationMode", &val_obj) ) {
  371. AuthorisationMode = json_object_get_int(val_obj);
  372. ShmSysConfigAndInfo->SysConfig.AuthorisationMode = AuthorisationMode;
  373. }
  374. if( json_object_object_get_ex(jobj, "RfidCardNumEndian", &val_obj) ) {
  375. RfidCardNumEndian = json_object_get_int(val_obj);
  376. ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = RfidCardNumEndian;
  377. }
  378. if( json_object_object_get_ex(jobj, "PsuAcInputType", &val_obj) ) {
  379. PsuAcInputType = json_object_get_int(val_obj);
  380. ShmSysConfigAndInfo->SysConfig.PsuAcInputType = PsuAcInputType;
  381. }
  382. if( json_object_object_get_ex(jobj, "isAPP", &val_obj) ) {
  383. isAPP = json_object_get_int(val_obj);
  384. ShmSysConfigAndInfo->SysConfig.isAPP = isAPP;
  385. }
  386. if( json_object_object_get_ex(jobj, "isQRCode", &val_obj) ) {
  387. isQRCode = json_object_get_int(val_obj);
  388. ShmSysConfigAndInfo->SysConfig.isQRCode = isQRCode;
  389. }
  390. if( json_object_object_get_ex(jobj, "isRFID", &val_obj) ) {
  391. isRFID = json_object_get_int(val_obj);
  392. ShmSysConfigAndInfo->SysConfig.isRFID = isRFID;
  393. }
  394. if( json_object_object_get_ex(jobj, "QRCodeMadeMode", &val_obj) ) {
  395. QRCodeMadeMode = json_object_get_int(val_obj);
  396. ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode = QRCodeMadeMode;
  397. }
  398. if( json_object_object_get_ex(jobj, "QRCodeContent", &val_obj) ) {
  399. QRCodeContent = json_object_get_string(val_obj);
  400. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.QRCodeContent,QRCodeContent);
  401. }
  402. if( json_object_object_get_ex(jobj, "Intensity", &val_obj) ) {
  403. Intensity = json_object_get_int(val_obj);
  404. ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity = Intensity;
  405. }
  406. }
  407. if (strcmp(argv[1], "2") == 0) {
  408. struct json_object *jobj = json_tokener_parse(argv[2]);
  409. json_object *val_obj = NULL;
  410. int MaxChargingEnergy= 0;
  411. int MaxChargingPower = 0;
  412. int MaxChargingCurrent = 0;
  413. int AcMaxChargingCurrent = 0;
  414. int MaxChargingDuration = 0;
  415. char *LocalWhiteCard0 = NULL;
  416. char *LocalWhiteCard1 = NULL;
  417. char *LocalWhiteCard2 = NULL;
  418. char *LocalWhiteCard3 = NULL;
  419. char *LocalWhiteCard4 = NULL;
  420. char *LocalWhiteCard5 = NULL;
  421. char *LocalWhiteCard6 = NULL;
  422. char *LocalWhiteCard7 = NULL;
  423. char *LocalWhiteCard8 = NULL;
  424. char *LocalWhiteCard9 = NULL;
  425. char isBilling = 0;
  426. char Currency = 0;
  427. float Fee0 = 0;
  428. float Fee1 = 0;
  429. float Fee2 = 0;
  430. float Fee3 = 0;
  431. float Fee4 = 0;
  432. float Fee5 = 0;
  433. float Fee6 = 0;
  434. float Fee7 = 0;
  435. float Fee8 = 0;
  436. float Fee9 = 0;
  437. float Fee10 = 0;
  438. float Fee11 = 0;
  439. float Fee12 = 0;
  440. float Fee13 = 0;
  441. float Fee14 = 0;
  442. float Fee15 = 0;
  443. float Fee16 = 0;
  444. float Fee17 = 0;
  445. float Fee18 = 0;
  446. float Fee19 = 0;
  447. float Fee20 = 0;
  448. float Fee21 = 0;
  449. float Fee22 = 0;
  450. float Fee23 = 0;
  451. if( json_object_object_get_ex(jobj, "MaxChargingEnergy", &val_obj) ) {
  452. MaxChargingEnergy = json_object_get_int(val_obj);
  453. ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy = MaxChargingEnergy;
  454. }
  455. if( json_object_object_get_ex(jobj, "MaxChargingPower", &val_obj) ) {
  456. MaxChargingPower = json_object_get_int(val_obj);
  457. ShmSysConfigAndInfo->SysConfig.MaxChargingPower = MaxChargingPower;
  458. }
  459. if( json_object_object_get_ex(jobj, "MaxChargingCurrent", &val_obj) ) {
  460. MaxChargingCurrent = json_object_get_int(val_obj);
  461. ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent = MaxChargingCurrent;
  462. }
  463. if( json_object_object_get_ex(jobj, "AcMaxChargingCurrent", &val_obj) ) {
  464. AcMaxChargingCurrent = json_object_get_int(val_obj);
  465. ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent = AcMaxChargingCurrent;
  466. }
  467. if( json_object_object_get_ex(jobj, "MaxChargingDuration", &val_obj) ) {
  468. MaxChargingDuration = json_object_get_int(val_obj);
  469. ShmSysConfigAndInfo->SysConfig.MaxChargingDuration = MaxChargingDuration;
  470. }
  471. if( json_object_object_get_ex(jobj, "LocalWhiteCard0", &val_obj) ) {
  472. LocalWhiteCard0 = (char*)json_object_get_string(val_obj);
  473. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0],LocalWhiteCard0);
  474. }
  475. if( json_object_object_get_ex(jobj, "LocalWhiteCard1", &val_obj) ) {
  476. LocalWhiteCard1 = (char*)json_object_get_string(val_obj);
  477. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1],LocalWhiteCard1);
  478. }
  479. if( json_object_object_get_ex(jobj, "LocalWhiteCard2", &val_obj) ) {
  480. LocalWhiteCard2 = (char*)json_object_get_string(val_obj);
  481. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2],LocalWhiteCard2);
  482. }
  483. if( json_object_object_get_ex(jobj, "LocalWhiteCard3", &val_obj) ) {
  484. LocalWhiteCard3 = (char*)json_object_get_string(val_obj);
  485. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3],LocalWhiteCard3);
  486. }
  487. if( json_object_object_get_ex(jobj, "LocalWhiteCard4", &val_obj) ) {
  488. LocalWhiteCard4 = (char*)json_object_get_string(val_obj);
  489. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4],LocalWhiteCard4);
  490. }
  491. if( json_object_object_get_ex(jobj, "LocalWhiteCard5", &val_obj) ) {
  492. LocalWhiteCard5 = (char*)json_object_get_string(val_obj);
  493. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5],LocalWhiteCard5);
  494. }
  495. if( json_object_object_get_ex(jobj, "LocalWhiteCard6", &val_obj) ) {
  496. LocalWhiteCard6 = (char*)json_object_get_string(val_obj);
  497. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6],LocalWhiteCard6);
  498. }
  499. if( json_object_object_get_ex(jobj, "LocalWhiteCard7", &val_obj) ) {
  500. LocalWhiteCard7 = (char*)json_object_get_string(val_obj);
  501. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7],LocalWhiteCard7);
  502. }
  503. if( json_object_object_get_ex(jobj, "LocalWhiteCard8", &val_obj) ) {
  504. LocalWhiteCard8 = (char*)json_object_get_string(val_obj);
  505. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8],LocalWhiteCard8);
  506. }
  507. if( json_object_object_get_ex(jobj, "LocalWhiteCard9", &val_obj) ) {
  508. LocalWhiteCard9 = (char*)json_object_get_string(val_obj);
  509. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9],LocalWhiteCard9);
  510. }
  511. if( json_object_object_get_ex(jobj, "isBilling", &val_obj) ) {
  512. isBilling = json_object_get_int(val_obj);
  513. ShmSysConfigAndInfo->SysConfig.BillingData.isBilling = isBilling;
  514. }
  515. if( json_object_object_get_ex(jobj, "Currency", &val_obj) ) {
  516. Currency = json_object_get_int(val_obj);
  517. ShmSysConfigAndInfo->SysConfig.BillingData.Currency = Currency;
  518. }
  519. if( json_object_object_get_ex(jobj, "Fee0", &val_obj) ) {
  520. Fee0 = json_object_get_double(val_obj);
  521. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[0] = rounding(Fee0);
  522. }
  523. if( json_object_object_get_ex(jobj, "Fee1", &val_obj) ) {
  524. Fee1 = json_object_get_double(val_obj);
  525. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[1] = rounding(Fee1);
  526. }
  527. if( json_object_object_get_ex(jobj, "Fee2", &val_obj) ) {
  528. Fee2 = json_object_get_double(val_obj);
  529. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[2] = rounding(Fee2);
  530. }
  531. if( json_object_object_get_ex(jobj, "Fee3", &val_obj) ) {
  532. Fee3 = json_object_get_double(val_obj);
  533. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[3] = rounding(Fee3);
  534. }
  535. if( json_object_object_get_ex(jobj, "Fee4", &val_obj) ) {
  536. Fee4 = json_object_get_double(val_obj);
  537. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[4] = rounding(Fee4);
  538. }
  539. if( json_object_object_get_ex(jobj, "Fee5", &val_obj) ) {
  540. Fee5 = json_object_get_double(val_obj);
  541. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[5] = rounding(Fee5);
  542. }
  543. if( json_object_object_get_ex(jobj, "Fee6", &val_obj) ) {
  544. Fee6 = json_object_get_double(val_obj);
  545. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[6] = rounding(Fee6);
  546. }
  547. if( json_object_object_get_ex(jobj, "Fee7", &val_obj) ) {
  548. Fee7 = json_object_get_double(val_obj);
  549. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[7] = rounding(Fee7);
  550. }
  551. if( json_object_object_get_ex(jobj, "Fee8", &val_obj) ) {
  552. Fee8 = json_object_get_double(val_obj);
  553. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[8] = rounding(Fee8);
  554. }
  555. if( json_object_object_get_ex(jobj, "Fee9", &val_obj) ) {
  556. Fee9 = json_object_get_double(val_obj);
  557. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[9] = rounding(Fee9);
  558. }
  559. if( json_object_object_get_ex(jobj, "Fee10", &val_obj) ) {
  560. Fee10 = json_object_get_double(val_obj);
  561. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[10] = rounding(Fee10);
  562. }
  563. if( json_object_object_get_ex(jobj, "Fee11", &val_obj) ) {
  564. Fee11 = json_object_get_double(val_obj);
  565. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[11] = rounding(Fee11);
  566. }
  567. if( json_object_object_get_ex(jobj, "Fee12", &val_obj) ) {
  568. Fee12 = json_object_get_double(val_obj);
  569. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[12] = rounding(Fee12);
  570. }
  571. if( json_object_object_get_ex(jobj, "Fee13", &val_obj) ) {
  572. Fee13 = json_object_get_double(val_obj);
  573. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[13] = rounding(Fee13);
  574. }
  575. if( json_object_object_get_ex(jobj, "Fee14", &val_obj) ) {
  576. Fee14 = json_object_get_double(val_obj);
  577. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[14] = rounding(Fee14);
  578. }
  579. if( json_object_object_get_ex(jobj, "Fee15", &val_obj) ) {
  580. Fee15 = json_object_get_double(val_obj);
  581. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[15] = rounding(Fee15);
  582. }
  583. if( json_object_object_get_ex(jobj, "Fee16", &val_obj) ) {
  584. Fee16 = json_object_get_double(val_obj);
  585. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[16] = rounding(Fee16);
  586. }
  587. if( json_object_object_get_ex(jobj, "Fee17", &val_obj) ) {
  588. Fee17 = json_object_get_double(val_obj);
  589. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[17] = rounding(Fee17);
  590. }
  591. if( json_object_object_get_ex(jobj, "Fee18", &val_obj) ) {
  592. Fee18 = json_object_get_double(val_obj);
  593. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[18] = rounding(Fee18);
  594. }
  595. if( json_object_object_get_ex(jobj, "Fee19", &val_obj) ) {
  596. Fee19 = json_object_get_double(val_obj);
  597. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[19] = rounding(Fee19);
  598. }
  599. if( json_object_object_get_ex(jobj, "Fee20", &val_obj) ) {
  600. Fee20 = json_object_get_double(val_obj);
  601. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[20] = rounding(Fee20);
  602. }
  603. if( json_object_object_get_ex(jobj, "Fee21", &val_obj) ) {
  604. Fee21 = json_object_get_double(val_obj);
  605. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[21] = rounding(Fee21);
  606. }
  607. if( json_object_object_get_ex(jobj, "Fee22", &val_obj) ) {
  608. Fee22 = json_object_get_double(val_obj);
  609. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[22] = rounding(Fee22);
  610. }
  611. if( json_object_object_get_ex(jobj, "Fee23", &val_obj) ) {
  612. Fee23 = json_object_get_double(val_obj);
  613. ShmSysConfigAndInfo->SysConfig.BillingData.Fee[23] = rounding(Fee23);
  614. }
  615. }
  616. if (strcmp(argv[1], "3") == 0) {
  617. struct json_object *jobj = json_tokener_parse(argv[2]);
  618. json_object *val_obj = NULL;
  619. int Eth0DhcpClient=0;
  620. char *Eth0IpAddress=NULL;
  621. char *Eth0SubmaskAddress=NULL;
  622. char *Eth0GatewayAddress=NULL;
  623. int WifiMode=0;
  624. char *WifiSsid=NULL;
  625. char *WifiPassword=NULL;
  626. int WifiDhcpServer=0;
  627. int WifiDhcpClient=0;
  628. char *WifiIpAddress=NULL;
  629. char *WifiSubmaskAddress=NULL;
  630. char *WifiGatewayAddress=NULL;
  631. char *TelcomApn=NULL;
  632. char *TelcomChapPapId=NULL;
  633. char *TelcomChapPapPwd=NULL;
  634. char *TelcomIpAddress=NULL;
  635. char TelcomEnabled=0;
  636. if( json_object_object_get_ex(jobj, "Eth0DhcpClient", &val_obj) ) {
  637. Eth0DhcpClient = json_object_get_int(val_obj);
  638. ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=Eth0DhcpClient;
  639. }
  640. if( json_object_object_get_ex(jobj, "Eth0IpAddress", &val_obj) ) {
  641. Eth0IpAddress = (char*)json_object_get_string(val_obj);
  642. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,Eth0IpAddress);
  643. }
  644. if( json_object_object_get_ex(jobj, "Eth0SubmaskAddress", &val_obj) ) {
  645. Eth0SubmaskAddress = (char*)json_object_get_string(val_obj);
  646. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,Eth0SubmaskAddress);
  647. }
  648. if( json_object_object_get_ex(jobj, "Eth0GatewayAddress", &val_obj) ) {
  649. Eth0GatewayAddress = (char*)json_object_get_string(val_obj);
  650. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,Eth0GatewayAddress);
  651. }
  652. if( json_object_object_get_ex(jobj, "WifiMode", &val_obj) ) {
  653. WifiMode = json_object_get_int(val_obj);
  654. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=WifiMode;
  655. }
  656. if( json_object_object_get_ex(jobj, "WifiSsid", &val_obj) ) {
  657. WifiSsid = (char*)json_object_get_string(val_obj);
  658. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,WifiSsid);
  659. }
  660. if( json_object_object_get_ex(jobj, "WifiPassword", &val_obj) ) {
  661. WifiPassword = (char*)json_object_get_string(val_obj);
  662. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,WifiPassword);
  663. }
  664. if( json_object_object_get_ex(jobj, "WifiDhcpServer", &val_obj) ) {
  665. WifiDhcpServer = json_object_get_int(val_obj);
  666. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=WifiDhcpServer;
  667. }
  668. if( json_object_object_get_ex(jobj, "WifiDhcpClient", &val_obj) ) {
  669. WifiDhcpClient = json_object_get_int(val_obj);
  670. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=WifiDhcpClient;
  671. }
  672. if( json_object_object_get_ex(jobj, "WifiIpAddress", &val_obj) ) {
  673. WifiIpAddress = (char*)json_object_get_string(val_obj);
  674. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,WifiIpAddress);
  675. }
  676. if( json_object_object_get_ex(jobj, "WifiSubmaskAddress", &val_obj) ) {
  677. WifiSubmaskAddress = (char*)json_object_get_string(val_obj);
  678. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,WifiSubmaskAddress);
  679. }
  680. if( json_object_object_get_ex(jobj, "WifiGatewayAddress", &val_obj) ) {
  681. WifiGatewayAddress = (char*)json_object_get_string(val_obj);
  682. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,WifiGatewayAddress);
  683. }
  684. if( json_object_object_get_ex(jobj, "TelcomApn", &val_obj) ) {
  685. TelcomApn = (char*)json_object_get_string(val_obj);
  686. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,TelcomApn);
  687. }
  688. if( json_object_object_get_ex(jobj, "TelcomChapPapId", &val_obj) ) {
  689. TelcomChapPapId = (char*)json_object_get_string(val_obj);
  690. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,TelcomChapPapId);
  691. }
  692. if( json_object_object_get_ex(jobj, "TelcomChapPapPwd", &val_obj) ) {
  693. TelcomChapPapPwd = (char*)json_object_get_string(val_obj);
  694. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,TelcomChapPapPwd);
  695. }
  696. if( json_object_object_get_ex(jobj, "TelcomIpAddress", &val_obj) ) {
  697. TelcomIpAddress = (char*)json_object_get_string(val_obj);
  698. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,TelcomIpAddress);
  699. }
  700. if( json_object_object_get_ex(jobj, "TelcomEnabled", &val_obj) ) {
  701. TelcomEnabled = json_object_get_int(val_obj);
  702. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled=TelcomEnabled;
  703. }
  704. }
  705. if (strcmp(argv[1], "4") == 0) {
  706. struct json_object *jobj = json_tokener_parse(argv[2]);
  707. json_object *val_obj = NULL;
  708. int BackendConnTimeout=0;
  709. int OfflinePolicy=0;
  710. int OfflineMaxChargeEnergy=0;
  711. int OfflineMaxChargeDuration=0;
  712. char *OcppServerURL=NULL;
  713. char *ChargeBoxId=NULL;
  714. char *chargePointVendor=NULL;
  715. if( json_object_object_get_ex(jobj, "BackendConnTimeout", &val_obj) ) {
  716. BackendConnTimeout = json_object_get_int(val_obj);
  717. ShmSysConfigAndInfo->SysConfig.BackendConnTimeout = BackendConnTimeout;
  718. }
  719. if( json_object_object_get_ex(jobj, "OfflinePolicy", &val_obj) ) {
  720. OfflinePolicy = json_object_get_int(val_obj);
  721. ShmSysConfigAndInfo->SysConfig.OfflinePolicy = OfflinePolicy;
  722. }
  723. if( json_object_object_get_ex(jobj, "OfflineMaxChargeEnergy", &val_obj) ) {
  724. OfflineMaxChargeEnergy = json_object_get_int(val_obj);
  725. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy = OfflineMaxChargeEnergy;
  726. }
  727. if( json_object_object_get_ex(jobj, "OfflineMaxChargeDuration", &val_obj) ) {
  728. OfflineMaxChargeDuration = json_object_get_int(val_obj);
  729. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration = OfflineMaxChargeDuration;
  730. }
  731. if( json_object_object_get_ex(jobj, "OcppServerURL", &val_obj) ) {
  732. OcppServerURL = (char*)json_object_get_string(val_obj);
  733. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,OcppServerURL);
  734. }
  735. if( json_object_object_get_ex(jobj, "ChargeBoxId", &val_obj) ) {
  736. ChargeBoxId = (char*)json_object_get_string(val_obj);
  737. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,ChargeBoxId);
  738. }
  739. if( json_object_object_get_ex(jobj, "chargePointVendor", &val_obj) ) {
  740. chargePointVendor = (char*)json_object_get_string(val_obj);
  741. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor,chargePointVendor);
  742. }
  743. }
  744. struct SysConfigData SysConfig;
  745. memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
  746. int result = StoreUsrConfigData(&SysConfig);
  747. if(result != 1){
  748. #ifdef SystemLogMessage
  749. StoreLogMsg("[WebService]StoreUsrConfigData: normal NG");
  750. #endif
  751. }
  752. else{
  753. #ifdef SystemLogMessage
  754. StoreLogMsg("[WebService]StoreUsrConfigData: normal OK");
  755. #endif
  756. }
  757. #ifdef SystemLogMessage
  758. DEBUG_INFO("WebServiceConfig update OK");
  759. #endif
  760. }
  761. if (argc == 2) { //init share memory for test
  762. if (strcmp(argv[1], "aaa") == 0) {
  763. //struct SysConfigData SysConfig;
  764. //system
  765. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ModelName, "AW0E770001W1P0D");
  766. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber, "SerialNumber");
  767. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
  768. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
  769. ShmSysConfigAndInfo->SysConfig.AcPhaseCount=1;
  770. ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
  771. ShmSysConfigAndInfo->SysInfo.FactoryConfiguration=0;
  772. ShmSysConfigAndInfo->SysConfig.AuthorisationMode=0;
  773. ShmSysConfigAndInfo->SysConfig.DefaultLanguage=0;
  774. ShmSysConfigAndInfo->SysInfo.InputVoltageR=0;
  775. ShmSysConfigAndInfo->SysInfo.InputVoltageS=0;
  776. ShmSysConfigAndInfo->SysInfo.InputVoltageT=0;
  777. ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed=0;
  778. ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0;
  779. ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian=0;
  780. ShmSysConfigAndInfo->SysConfig.RatingCurrent=100;
  781. ShmSysConfigAndInfo->SysConfig.PsuAcInputType=0;
  782. ShmSysConfigAndInfo->SysInfo.AuxPower5V=0;
  783. ShmSysConfigAndInfo->SysInfo.AuxPower12V=0;
  784. ShmSysConfigAndInfo->SysInfo.AuxPower24V=0;
  785. ShmSysConfigAndInfo->SysInfo.AuxPower48V=0;
  786. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev, "");
  787. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, "");
  788. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "");
  789. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "");
  790. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, "");
  791. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev, "");
  792. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev, "");
  793. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev, "");
  794. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev, "");
  795. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev, "");
  796. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev, "");
  797. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev, "");
  798. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev, "");
  799. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, "");
  800. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev, "");
  801. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, "");
  802. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev, "");
  803. ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp=0;
  804. ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp=0;
  805. ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp=0;
  806. ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp=0;
  807. ShmSysConfigAndInfo->SysConfig.AcPlugInTimes=0;
  808. ShmSysConfigAndInfo->SysConfig.GbPlugInTimes=0;
  809. ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime=0;
  810. ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes=0;
  811. ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes=0;
  812. // strcpy((char *)&ShmPsuData->PsuVersion[0].FwPrimaryVersion, "DC 9.01");
  813. // strcpy((char *)&ShmPsuData->PsuVersion[1].FwPrimaryVersion, "DC 9.02");
  814. // strcpy((char *)&ShmPsuData->PsuVersion[0].FwSecondVersion, "PFC 9.02");
  815. // strcpy((char *)&ShmPsuData->PsuVersion[1].FwSecondVersion, "PFC 9.03");
  816. //charging
  817. ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy=0;
  818. ShmSysConfigAndInfo->SysConfig.MaxChargingPower=0;
  819. ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0;
  820. ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent= 0;
  821. ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0;
  822. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111");
  823. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222");
  824. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333");
  825. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3], "444");
  826. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4], "555");
  827. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5], "666");
  828. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6], "777");
  829. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7], "888");
  830. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8], "999");
  831. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9], "aaa");
  832. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.UserId, "UserId");
  833. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage=0;
  834. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent=0;
  835. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingPower=0;
  836. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedEnergy=0;
  837. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedDuration=0;
  838. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].RemainChargingDuration=0;
  839. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatteryMaxVoltage=0;
  840. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetVoltage=0;
  841. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterySoc=0;
  842. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus=1;
  843. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Index=0;
  844. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Type=0;
  845. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].type_index=0;
  846. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetCurrent=1;
  847. //network
  848. ShmSysConfigAndInfo->SysInfo.InternetConn=0;
  849. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,"");
  850. ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=1;
  851. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress,"");
  852. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,"192.168.1.10");
  853. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,"255.255.255.0");
  854. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,"192.168.1.1");
  855. ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=1;
  856. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress,"");
  857. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,"192.168.0.10");
  858. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,"255.255.255.0");
  859. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,"192.168.0.1");
  860. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=1;
  861. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,"");
  862. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,"");
  863. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi=0;
  864. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=0;
  865. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=0;
  866. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress,"");
  867. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,"");
  868. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,"");
  869. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,"");
  870. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn=1;
  871. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,"");
  872. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi=0;
  873. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,"");
  874. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,"");
  875. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei,"");
  876. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi,"");
  877. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid,"");
  878. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus=0;
  879. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode=0;
  880. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,"");
  881. //backend
  882. ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=300;
  883. ShmSysConfigAndInfo->SysConfig.OfflinePolicy=0;
  884. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy=0;
  885. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration=0;
  886. ShmSysConfigAndInfo->SysInfo.OcppConnStatus=0;
  887. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"");
  888. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"");
  889. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor,"Phihong");
  890. ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=0;
  891. struct SysConfigData SysConfig;
  892. memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
  893. StoreUsrConfigData(&SysConfig);
  894. // struct PsuModuleVer PsuData;
  895. // memcpy(&PsuData, &ShmPsuData->PsuVersion, sizeof(struct PsuModuleVer));
  896. // StoreUsrConfigData(&PsuData);
  897. #ifdef SystemLogMessage
  898. DEBUG_INFO("WebService initial OK");
  899. #endif
  900. }
  901. if (strcmp(argv[1], "log") == 0) {
  902. unsigned char ModelName[64];;
  903. unsigned char SerialNo[64];;
  904. memcpy(ModelName,ShmSysConfigAndInfo->SysConfig.ModelName,ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
  905. printf("%s", ModelName);
  906. memcpy(SerialNo,ShmSysConfigAndInfo->SysConfig.SerialNumber,ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
  907. printf("%s", SerialNo);
  908. time_t tt = time(0); //獲取當前時間
  909. int year,month;
  910. char cmd[512];
  911. struct tm *pst = localtime(&tt); //把time_t類型轉換為struct tm類型
  912. year = pst->tm_year + 1900;
  913. month = pst->tm_mon + 1;
  914. // sprintf(cmd,"cp /mnt/*%s*%s*.zip /var/www/log.zip",ModelName,SerialNo);
  915. if(system("exec /root/logPackTools 'log'")==0){
  916. system(cmd);
  917. }
  918. }
  919. if (strcmp(argv[1], "button") == 0) {
  920. unsigned char Button1;
  921. unsigned char Button2;
  922. unsigned char EmergencyButton;
  923. Button1=ShmPrimaryMcuData->InputDet.bits.Button1;
  924. Button2=ShmPrimaryMcuData->InputDet.bits.Button2;
  925. EmergencyButton=ShmPrimaryMcuData->InputDet.bits.EmergencyButton;
  926. struct json_object *jobj;
  927. struct json_object *sButton1;
  928. struct json_object *sButton2;
  929. struct json_object *sEmergencyButton;
  930. sButton1 = json_object_new_int(Button1);
  931. sButton2 = json_object_new_int(Button2);
  932. sEmergencyButton = json_object_new_int(EmergencyButton);
  933. jobj=json_object_new_object();
  934. json_object_object_add(jobj,"Button1",sButton1);
  935. json_object_object_add(jobj,"Button2",sButton2);
  936. json_object_object_add(jobj,"EmergencyButton",sEmergencyButton);
  937. printf("%s\n", json_object_to_json_string(jobj));
  938. }
  939. if (strcmp(argv[1], "restart") == 0) {
  940. system("exec /usr/bin/run_evse_restart.sh");
  941. }
  942. }
  943. //upgrade firmware
  944. if ((argc == 3) & (strcmp(argv[1], "upgrade") == 0)) {
  945. struct json_object *jobj;
  946. struct json_object *Result;
  947. struct json_object *Message;
  948. //char cmd[100];
  949. jobj=json_object_new_object();
  950. //system
  951. //if((char)ShmSysConfigAndInfo->SysInfo.FirmwareUpdate == '0'){
  952. ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=1;
  953. Result = json_object_new_string("success");
  954. Message = json_object_new_string("File is uploaded, please wait a moment to upgrade");
  955. //}
  956. /*else{
  957. sprintf(cmd,"rm /mnt/%s",argv[2]);
  958. system(cmd);
  959. Result = json_object_new_string("error");
  960. Message = json_object_new_string("machine is busy");
  961. }*/
  962. json_object_object_add(jobj,"Result",Result);
  963. json_object_object_add(jobj,"Message",Message);
  964. printf("%s\n", json_object_to_json_string(jobj));
  965. }
  966. //web page query all
  967. if ((argc == 2) & (strcmp(argv[1], "query") == 0)) {
  968. char *IsAcDc[2];
  969. char *Connector1[2];
  970. char *Connector2[2];
  971. char *Connector3[2];
  972. char *Network[2];
  973. unsigned char connector1FwVer[32];
  974. unsigned char connector2FwVer[32];
  975. short gunQty;
  976. char *RatedPower1[2];
  977. char *RatedPower2[2];
  978. char *RatedPower3[2];
  979. short RatedPower;
  980. short PsuQuantity = 0;
  981. substr((char *)IsAcDc,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,1);
  982. substr((char *)Connector1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,7,1);
  983. substr((char *)Connector2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,9,1);
  984. substr((char *)Connector3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,8,1);
  985. substr((char *)Network,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,10,1);
  986. int connectorType1,connectorType2,connectorType3;
  987. connectorType1=ConnectorType((char *)Connector1);
  988. connectorType2=ConnectorType((char *)Connector2);
  989. connectorType3=ConnectorType((char *)Connector3);
  990. if(connectorType1 == connectorType2){
  991. gunQty = 1;
  992. }
  993. else{
  994. gunQty = 0;
  995. }
  996. if(connectorType1 != 0){
  997. if(connectorType1 == 1){
  998. // strcpy((char *)&connector1FwVer,ShmCcsData->V2GMessage_DIN70121->version);
  999. // memcpy(connector1FwVer,ShmCcsData->V2GMessage_DIN70121->version,ARRAY_SIZE(ShmCcsData->V2GMessage_DIN70121->version));
  1000. }
  1001. else if(connectorType1 == 2){
  1002. // strcpy((char *)&connector1FwVer,ShmGBTData->evse[0].version);
  1003. // memcpy(connector1FwVer,ShmGBTData->evse[0].version,ARRAY_SIZE(ShmGBTData->evse[0].version));
  1004. }
  1005. else if(connectorType1 == 3){
  1006. // strcpy((char *)&connector1FwVer,ShmCHAdeMOData->evse[0].version);
  1007. // memcpy(connector1FwVer,ShmCHAdeMOData->evse[0].version,ARRAY_SIZE(ShmCHAdeMOData->evse[0].version));
  1008. }
  1009. }
  1010. if(connectorType2 != 0){
  1011. if(connectorType2 == 1){
  1012. // strcpy((char *)&connector2FwVer,ShmCcsData->V2GMessage_DIN70121->version);
  1013. // memcpy(connector2FwVer,ShmCcsData->V2GMessage_DIN70121->version,ARRAY_SIZE(ShmCcsData->V2GMessage_DIN70121->version));
  1014. }
  1015. else if(connectorType2 == 2){
  1016. // strcpy((char *)&connector2FwVer,ShmGBTData->evse[gunQty].version);
  1017. // memcpy(connector2FwVer,ShmGBTData->evse[gunQty].version,ARRAY_SIZE(ShmGBTData->evse[gunQty].version));
  1018. }
  1019. else if(connectorType2 == 3){
  1020. // strcpy((char *)&connector2FwVer,ShmCHAdeMOData->evse[gunQty].version);
  1021. // memcpy(connector2FwVer,ShmCHAdeMOData->evse[gunQty].version,ARRAY_SIZE(ShmCHAdeMOData->evse[gunQty].version));
  1022. }
  1023. }
  1024. substr((char *)RatedPower1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,4,1);
  1025. substr((char *)RatedPower2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,5,1);
  1026. substr((char *)RatedPower3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,6,1);
  1027. int p1=atoi(RatedPower1);
  1028. int p2=atoi(RatedPower2);
  1029. int p3=atoi(RatedPower3);
  1030. if(strcmp(IsAcDc, "D") == 0){
  1031. RatedPower=(p1*10+p2)*pow(10,p3-1);
  1032. if(RatedPower>=30){
  1033. PsuQuantity = RatedPower/30;
  1034. }
  1035. }
  1036. struct json_object *jobj1;
  1037. struct json_object *jobj2;
  1038. struct json_object *jobj3;
  1039. struct json_object *jobj4;
  1040. //system
  1041. struct json_object *ModelName;
  1042. struct json_object *AcModelName;
  1043. struct json_object *SerialNumber;
  1044. struct json_object *SystemId;
  1045. struct json_object *AcPhaseCount;
  1046. struct json_object *PhaseLossPolicy;
  1047. struct json_object *FactoryConfiguration;
  1048. struct json_object *AuthorisationMode;
  1049. struct json_object *DefaultLanguage;
  1050. struct json_object *InputVoltageR;
  1051. struct json_object *InputVoltageS;
  1052. struct json_object *InputVoltageT;
  1053. struct json_object *SystemFanRotaSpeed;
  1054. struct json_object *PsuFanRotaSpeed;
  1055. struct json_object *RfidCardNumEndian;
  1056. struct json_object *PsuAcInputType;
  1057. struct json_object *RatingCurrent;
  1058. struct json_object *AcRatingCurrent;
  1059. struct json_object *isAPP;
  1060. struct json_object *isQRCode;
  1061. struct json_object *isRFID;
  1062. struct json_object *QRCodeMadeMode;
  1063. struct json_object *QRCodeContent;
  1064. struct json_object *Intensity;
  1065. struct json_object *AuxPower5V;
  1066. struct json_object *AuxPower12V;
  1067. struct json_object *AuxPower24V;
  1068. struct json_object *AuxPower48V;
  1069. struct json_object *CsuHwRev;
  1070. struct json_object *CsuBootLoadFwRev;
  1071. struct json_object *CsuKernelFwRev;
  1072. struct json_object *CsuRootFsFwRev;
  1073. struct json_object *CsuPrimFwRev;
  1074. struct json_object *LcmHwRev;
  1075. struct json_object *LcmFwRev;
  1076. struct json_object *PsuHwRev;
  1077. struct json_object *PsuPrimFwRev;
  1078. struct json_object *PsuSecFwRev;
  1079. struct json_object *AuxPwrHwRev;
  1080. struct json_object *AuxPwrFwRev;
  1081. struct json_object *FanModuleHwRev;
  1082. struct json_object *FanModuleFwRev;
  1083. struct json_object *RelayModuleHwRev;
  1084. struct json_object *RelayModuleFwRev;
  1085. struct json_object *TelcomModemFwRev;
  1086. struct json_object *Connector1FwRev;
  1087. struct json_object *Connector2FwRev;
  1088. struct json_object *LedModuleFwRev;
  1089. struct json_object *SystemAmbientTemp;
  1090. struct json_object *SystemCriticalTemp;
  1091. struct json_object *CcsConnectorTemp;
  1092. struct json_object *PsuAmbientTemp;
  1093. struct json_object *AcPlugInTimes;
  1094. struct json_object *GbPlugInTimes;
  1095. struct json_object *Ccs1PlugInTime;
  1096. struct json_object *Ccs2PlugInTimes;
  1097. struct json_object *ChademoPlugInTimes;
  1098. struct json_object *FirmwareUpdate;
  1099. struct json_object *FwPrimaryVersion[PsuQuantity];
  1100. struct json_object *FwPrimaryVersionArr= json_object_new_array();
  1101. struct json_object *FwSecondVersion[PsuQuantity];
  1102. struct json_object *FwSecondVersionArr= json_object_new_array();
  1103. //charging
  1104. struct json_object *MaxChargingEnergy;
  1105. struct json_object *MaxChargingPower;
  1106. struct json_object *MaxChargingCurrent;
  1107. struct json_object *AcMaxChargingCurrent;
  1108. struct json_object *MaxChargingDuration;
  1109. struct json_object *LocalWhiteCard[10];
  1110. struct json_object *LocalWhiteCardArr= json_object_new_array();
  1111. struct json_object *isBilling;
  1112. struct json_object *Currency;
  1113. struct json_object *Fee[24];
  1114. struct json_object *FeeArr= json_object_new_array();
  1115. struct json_object *ChargingInfo1;
  1116. struct json_object *ChargingInfo2;
  1117. struct json_object *ChargingInfo3;
  1118. struct json_object *StartUserId[3];
  1119. struct json_object *StartDateTime[3];
  1120. struct json_object *StopDateTime[3];
  1121. struct json_object *StartMethod[3];
  1122. struct json_object *ConnectorTemp[3];
  1123. struct json_object *PresentChargingVoltage[3];
  1124. struct json_object *PresentChargingCurrent[3];
  1125. struct json_object *PresentChargingPower[3];
  1126. struct json_object *PresentChargedEnergy[3];
  1127. struct json_object *PresentChargedDuration[3];
  1128. struct json_object *RemainChargingDuration[3];
  1129. struct json_object *EvBatteryMaxVoltage[3];
  1130. struct json_object *EvBatterytargetVoltage[3];
  1131. struct json_object *EvBatterySoc[3];
  1132. struct json_object *SystemStatus[3];
  1133. struct json_object *Index[3];
  1134. struct json_object *Type[3];
  1135. struct json_object *type_index[3];
  1136. struct json_object *EvBatterytargetCurrent[3];
  1137. //network
  1138. struct json_object *InternetConn;
  1139. struct json_object *FtpServer;
  1140. struct json_object *Eth0DhcpClient;
  1141. struct json_object *Eth0MacAddress;
  1142. struct json_object *Eth0IpAddress;
  1143. struct json_object *Eth0SubmaskAddress;
  1144. struct json_object *Eth0GatewayAddress;
  1145. struct json_object *Eth1DhcpClient;
  1146. struct json_object *Eth1MacAddress;
  1147. struct json_object *Eth1IpAddress;
  1148. struct json_object *Eth1SubmaskAddress;
  1149. struct json_object *Eth1GatewayAddress;
  1150. struct json_object *WifiMode;
  1151. struct json_object *WifiSsid;
  1152. struct json_object *WifiPassword;
  1153. struct json_object *WifiRssi;
  1154. struct json_object *WifiDhcpServer;
  1155. struct json_object *WifiDhcpClient;
  1156. struct json_object *WifiMacAddress;
  1157. struct json_object *WifiIpAddress;
  1158. struct json_object *WifiSubmaskAddress;
  1159. struct json_object *WifiGatewayAddress;
  1160. struct json_object *WifiNetworkConn;
  1161. struct json_object *TelcomApn;
  1162. struct json_object *TelcomRssi;
  1163. struct json_object *TelcomChapPapId;
  1164. struct json_object *TelcomChapPapPwd;
  1165. struct json_object *TelcomModemImei;
  1166. struct json_object *TelcomSimImsi;
  1167. struct json_object *TelcomSimIccid;
  1168. struct json_object *TelcomSimStatus;
  1169. struct json_object *TelcomModemMode;
  1170. struct json_object *TelcomIpAddress;
  1171. struct json_object *TelcomNetworkConn;
  1172. struct json_object *TelcomEnabled;
  1173. //backend
  1174. struct json_object *BackendConnTimeout;
  1175. struct json_object *OfflinePolicy;
  1176. struct json_object *OfflineMaxChargeEnergy;
  1177. struct json_object *OfflineMaxChargeDuration;
  1178. struct json_object *OcppConnStatus;
  1179. struct json_object *OcppServerURL;
  1180. struct json_object *ChargeBoxId;
  1181. struct json_object *chargePointVendor;
  1182. jobj1=json_object_new_object();
  1183. jobj2=json_object_new_object();
  1184. jobj3=json_object_new_object();
  1185. jobj4=json_object_new_object();
  1186. //system
  1187. ModelName = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ModelName);
  1188. AcModelName = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AcModelName);
  1189. SerialNumber = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber);
  1190. SystemId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SystemId);
  1191. AcPhaseCount = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPhaseCount);
  1192. PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
  1193. FactoryConfiguration = json_object_new_int(ShmSysConfigAndInfo->SysInfo.FactoryConfiguration);
  1194. AuthorisationMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
  1195. DefaultLanguage = json_object_new_int(ShmSysConfigAndInfo->SysConfig.DefaultLanguage);
  1196. InputVoltageR = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageR);
  1197. InputVoltageS = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageS);
  1198. InputVoltageT = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageT);
  1199. SystemFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
  1200. PsuFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed);
  1201. RfidCardNumEndian = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
  1202. PsuAcInputType = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PsuAcInputType);
  1203. RatingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RatingCurrent);
  1204. AcRatingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcRatingCurrent);
  1205. isAPP = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isAPP);
  1206. isQRCode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isQRCode);
  1207. isRFID = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isRFID);
  1208. QRCodeMadeMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode);
  1209. QRCodeContent = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.QRCodeContent);
  1210. Intensity = json_object_new_int(ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity);
  1211. AuxPower5V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower5V);
  1212. AuxPower12V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower12V);
  1213. AuxPower24V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower24V);
  1214. AuxPower48V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower48V);
  1215. CsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev);
  1216. CsuBootLoadFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
  1217. CsuKernelFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
  1218. CsuRootFsFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
  1219. CsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev);
  1220. LcmHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev);
  1221. LcmFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev);
  1222. PsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev);
  1223. PsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev);
  1224. PsuSecFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev);
  1225. AuxPwrHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev);
  1226. AuxPwrFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev);
  1227. FanModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev);
  1228. FanModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev);
  1229. RelayModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev);
  1230. RelayModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev);
  1231. TelcomModemFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev);
  1232. Connector1FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
  1233. Connector2FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
  1234. LedModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LedModuleFwRev);
  1235. SystemAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp);
  1236. SystemCriticalTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp);
  1237. CcsConnectorTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp);
  1238. PsuAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp);
  1239. AcPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPlugInTimes);
  1240. GbPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.GbPlugInTimes);
  1241. Ccs1PlugInTime = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime);
  1242. Ccs2PlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes);
  1243. ChademoPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes);
  1244. FirmwareUpdate = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FirmwareUpdate);
  1245. if(strcmp(IsAcDc, "D") == 0){
  1246. for(int i=0;i<PsuQuantity;i++){
  1247. FwPrimaryVersion[i] = json_object_new_string((char *)&ShmPsuData->PsuVersion[i].FwPrimaryVersion);
  1248. FwSecondVersion[i] = json_object_new_string((char *)&ShmPsuData->PsuVersion[i].FwSecondVersion);
  1249. json_object_array_add(FwPrimaryVersionArr,FwPrimaryVersion[i]);
  1250. json_object_array_add(FwSecondVersionArr,FwSecondVersion[i]);
  1251. }
  1252. }
  1253. //charging
  1254. int CcsGunQty=0;
  1255. int GbGunQty=0;
  1256. int CHAdeMOGunQty=0;
  1257. int AcGunQty=0;
  1258. ChargingInfo1=json_object_new_object();
  1259. ChargingInfo2=json_object_new_object();
  1260. ChargingInfo3=json_object_new_object();
  1261. MaxChargingEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy);
  1262. MaxChargingPower = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingPower);
  1263. MaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
  1264. AcMaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent);
  1265. MaxChargingDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingDuration);
  1266. LocalWhiteCard[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]);
  1267. LocalWhiteCard[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]);
  1268. LocalWhiteCard[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]);
  1269. LocalWhiteCard[3] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3]);
  1270. LocalWhiteCard[4] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4]);
  1271. LocalWhiteCard[5] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5]);
  1272. LocalWhiteCard[6] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6]);
  1273. LocalWhiteCard[7] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7]);
  1274. LocalWhiteCard[8] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8]);
  1275. LocalWhiteCard[9] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9]);
  1276. isBilling = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BillingData.isBilling);
  1277. Currency = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BillingData.Currency);
  1278. Fee[0] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[0]);
  1279. Fee[1] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[1]);
  1280. Fee[2] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[2]);
  1281. Fee[3] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[3]);
  1282. Fee[4] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[4]);
  1283. Fee[5] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[5]);
  1284. Fee[6] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[6]);
  1285. Fee[7] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[7]);
  1286. Fee[8] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[8]);
  1287. Fee[9] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[9]);
  1288. Fee[10] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[10]);
  1289. Fee[11] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[11]);
  1290. Fee[12] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[12]);
  1291. Fee[13] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[13]);
  1292. Fee[14] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[14]);
  1293. Fee[15] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[15]);
  1294. Fee[16] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[16]);
  1295. Fee[17] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[17]);
  1296. Fee[18] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[18]);
  1297. Fee[19] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[19]);
  1298. Fee[20] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[20]);
  1299. Fee[21] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[21]);
  1300. Fee[22] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[22]);
  1301. Fee[23] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[23]);
  1302. if(connectorType1 != 0){
  1303. if(connectorType1 == 1){//CCS
  1304. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1305. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1306. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1307. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1308. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1309. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1310. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1311. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1312. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1313. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1314. Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index);
  1315. Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type);
  1316. type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index);
  1317. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1318. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1319. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1320. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1321. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1322. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1323. CcsGunQty++;
  1324. }
  1325. else if(connectorType1 == 2){//GB
  1326. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1327. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1328. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1329. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1330. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1331. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1332. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1333. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1334. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  1335. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  1336. Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index);
  1337. Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type);
  1338. type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index);
  1339. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  1340. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  1341. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  1342. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  1343. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  1344. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  1345. GbGunQty++;
  1346. }
  1347. else if(connectorType1 == 3){//CHAdeMO
  1348. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  1349. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  1350. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  1351. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  1352. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  1353. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  1354. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  1355. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  1356. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  1357. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  1358. Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index);
  1359. Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type);
  1360. type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index);
  1361. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  1362. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  1363. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  1364. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  1365. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1366. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1367. CHAdeMOGunQty++;
  1368. }
  1369. else if(connectorType1 == 4){//AC
  1370. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1371. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1372. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1373. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1374. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1375. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1376. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1377. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1378. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1379. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1380. Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
  1381. Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
  1382. type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
  1383. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1384. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1385. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1386. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1387. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1388. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1389. AcGunQty++;
  1390. }
  1391. }
  1392. if(connectorType2 != 0){
  1393. if(connectorType2 == 1){//CCS
  1394. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1395. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1396. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1397. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1398. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1399. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1400. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1401. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1402. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1403. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1404. Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index);
  1405. Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type);
  1406. type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index);
  1407. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1408. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1409. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1410. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1411. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1412. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1413. CcsGunQty++;
  1414. }
  1415. else if(connectorType2 == 2){//GB
  1416. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1417. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1418. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1419. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1420. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1421. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1422. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1423. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1424. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  1425. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  1426. Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index);
  1427. Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type);
  1428. type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index);
  1429. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  1430. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  1431. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  1432. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  1433. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  1434. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  1435. GbGunQty++;
  1436. }
  1437. else if(connectorType2 == 3){//CHAdeMO
  1438. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  1439. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  1440. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  1441. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  1442. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  1443. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  1444. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  1445. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  1446. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  1447. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  1448. Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index);
  1449. Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type);
  1450. type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index);
  1451. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  1452. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  1453. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  1454. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  1455. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1456. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1457. CHAdeMOGunQty++;
  1458. }
  1459. else if(connectorType2 == 4){//AC
  1460. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1461. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1462. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1463. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1464. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1465. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1466. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1467. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1468. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1469. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1470. Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
  1471. Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
  1472. type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
  1473. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1474. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1475. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1476. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1477. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1478. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1479. AcGunQty++;
  1480. }
  1481. }
  1482. if(connectorType3 != 0){
  1483. if(connectorType3 == 1){//CCS
  1484. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1485. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1486. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1487. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1488. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1489. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1490. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1491. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1492. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1493. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1494. Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index);
  1495. Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type);
  1496. type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index);
  1497. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1498. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1499. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1500. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1501. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1502. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1503. CcsGunQty++;
  1504. }
  1505. else if(connectorType3 == 2){//GB
  1506. PresentChargingVoltage[2]= json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1507. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1508. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1509. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1510. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1511. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1512. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1513. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1514. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  1515. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  1516. Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index);
  1517. Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type);
  1518. type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index);
  1519. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  1520. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  1521. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  1522. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  1523. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  1524. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  1525. GbGunQty++;
  1526. }
  1527. else if(connectorType3 == 3){//CHAdeMO
  1528. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  1529. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  1530. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  1531. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  1532. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  1533. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  1534. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  1535. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  1536. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  1537. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  1538. Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index);
  1539. Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type);
  1540. type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index);
  1541. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  1542. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  1543. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  1544. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  1545. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1546. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1547. CHAdeMOGunQty++;
  1548. }
  1549. else if(connectorType3 == 4){//AC
  1550. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1551. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1552. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1553. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1554. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1555. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1556. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1557. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1558. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1559. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1560. Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
  1561. Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
  1562. type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
  1563. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1564. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1565. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1566. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1567. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1568. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1569. AcGunQty++;
  1570. }
  1571. }
  1572. //network
  1573. InternetConn = json_object_new_int(ShmSysConfigAndInfo->SysInfo.InternetConn);
  1574. FtpServer = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer);
  1575. Eth0DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient);
  1576. Eth0MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress);
  1577. Eth0IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
  1578. Eth0SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
  1579. Eth0GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
  1580. Eth1DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient);
  1581. Eth1MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress);
  1582. Eth1IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress);
  1583. Eth1SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress);
  1584. Eth1GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress);
  1585. WifiMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
  1586. WifiSsid = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
  1587. WifiPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
  1588. WifiRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi);
  1589. WifiDhcpServer = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer);
  1590. WifiDhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient);
  1591. WifiMacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress);
  1592. WifiIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress);
  1593. WifiSubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress);
  1594. WifiGatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress);
  1595. WifiNetworkConn = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn);
  1596. TelcomApn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
  1597. TelcomRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi);
  1598. TelcomChapPapId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
  1599. TelcomChapPapPwd = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
  1600. TelcomModemImei = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei);
  1601. TelcomSimImsi = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi);
  1602. TelcomSimIccid = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
  1603. TelcomSimStatus = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus);
  1604. TelcomModemMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
  1605. TelcomIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress);
  1606. TelcomNetworkConn = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn);
  1607. TelcomEnabled = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled);
  1608. //backend
  1609. BackendConnTimeout = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BackendConnTimeout);
  1610. OfflinePolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
  1611. OfflineMaxChargeEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy);
  1612. OfflineMaxChargeDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration);
  1613. OcppConnStatus = json_object_new_int(ShmSysConfigAndInfo->SysInfo.OcppConnStatus);
  1614. OcppServerURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL);
  1615. ChargeBoxId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
  1616. chargePointVendor = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor);
  1617. //system
  1618. json_object_object_add(jobj1,"ModelName",ModelName);
  1619. json_object_object_add(jobj1,"AcModelName",AcModelName);
  1620. json_object_object_add(jobj1,"SerialNumber",SerialNumber);
  1621. json_object_object_add(jobj1,"SystemId",SystemId);
  1622. json_object_object_add(jobj1,"AcPhaseCount",AcPhaseCount);
  1623. json_object_object_add(jobj1,"PhaseLossPolicy",PhaseLossPolicy);
  1624. json_object_object_add(jobj1,"FactoryConfiguration",FactoryConfiguration);
  1625. json_object_object_add(jobj1,"AuthorisationMode",AuthorisationMode);
  1626. json_object_object_add(jobj1,"DefaultLanguage",DefaultLanguage);
  1627. json_object_object_add(jobj1,"InputVoltageR",InputVoltageR);
  1628. json_object_object_add(jobj1,"InputVoltageS",InputVoltageS);
  1629. json_object_object_add(jobj1,"InputVoltageT",InputVoltageT);
  1630. json_object_object_add(jobj1,"SystemFanRotaSpeed",SystemFanRotaSpeed);
  1631. json_object_object_add(jobj1,"PsuFanRotaSpeed",PsuFanRotaSpeed);
  1632. json_object_object_add(jobj1,"RfidCardNumEndian",RfidCardNumEndian);
  1633. json_object_object_add(jobj1,"PsuAcInputType",PsuAcInputType);
  1634. json_object_object_add(jobj1,"RatingCurrent",RatingCurrent);
  1635. json_object_object_add(jobj1,"AcRatingCurrent",AcRatingCurrent);
  1636. json_object_object_add(jobj1,"isAPP",isAPP);
  1637. json_object_object_add(jobj1,"isQRCode",isQRCode);
  1638. json_object_object_add(jobj1,"isRFID",isRFID);
  1639. json_object_object_add(jobj1,"QRCodeMadeMode",QRCodeMadeMode);
  1640. json_object_object_add(jobj1,"QRCodeContent",QRCodeContent);
  1641. json_object_object_add(jobj1,"Intensity",Intensity);
  1642. json_object_object_add(jobj1,"AuxPower5V",AuxPower5V);
  1643. json_object_object_add(jobj1,"AuxPower12V",AuxPower12V);
  1644. json_object_object_add(jobj1,"AuxPower24V",AuxPower24V);
  1645. json_object_object_add(jobj1,"AuxPower48V",AuxPower48V);
  1646. json_object_object_add(jobj1,"CsuHwRev",CsuHwRev);
  1647. json_object_object_add(jobj1,"CsuBootLoadFwRev",CsuBootLoadFwRev);
  1648. json_object_object_add(jobj1,"CsuKernelFwRev",CsuKernelFwRev);
  1649. json_object_object_add(jobj1,"CsuRootFsFwRev",CsuRootFsFwRev);
  1650. json_object_object_add(jobj1,"CsuPrimFwRev",CsuPrimFwRev);
  1651. json_object_object_add(jobj1,"LcmHwRev",LcmHwRev);
  1652. json_object_object_add(jobj1,"LcmFwRev",LcmFwRev);
  1653. json_object_object_add(jobj1,"PsuHwRev",PsuHwRev);
  1654. json_object_object_add(jobj1,"PsuPrimFwRev",PsuPrimFwRev);
  1655. json_object_object_add(jobj1,"PsuSecFwRev",PsuSecFwRev);
  1656. json_object_object_add(jobj1,"AuxPwrHwRev",AuxPwrHwRev);
  1657. json_object_object_add(jobj1,"AuxPwrFwRev",AuxPwrFwRev);
  1658. json_object_object_add(jobj1,"FanModuleHwRev",FanModuleHwRev);
  1659. json_object_object_add(jobj1,"FanModuleFwRev",FanModuleFwRev);
  1660. json_object_object_add(jobj1,"RelayModuleHwRev",RelayModuleHwRev);
  1661. json_object_object_add(jobj1,"RelayModuleFwRev",RelayModuleFwRev);
  1662. json_object_object_add(jobj1,"TelcomModemFwRev",TelcomModemFwRev);
  1663. json_object_object_add(jobj1,"Connector1FwRev",Connector1FwRev);
  1664. json_object_object_add(jobj1,"Connector2FwRev",Connector2FwRev);
  1665. json_object_object_add(jobj1,"LedModuleFwRev",LedModuleFwRev);
  1666. json_object_object_add(jobj1,"SystemAmbientTemp",SystemAmbientTemp);
  1667. json_object_object_add(jobj1,"SystemCriticalTemp",SystemCriticalTemp);
  1668. json_object_object_add(jobj1,"CcsConnectorTemp",CcsConnectorTemp);
  1669. json_object_object_add(jobj1,"PsuAmbientTemp",PsuAmbientTemp);
  1670. json_object_object_add(jobj1,"AcPlugInTimes",AcPlugInTimes);
  1671. json_object_object_add(jobj1,"GbPlugInTimes",GbPlugInTimes);
  1672. json_object_object_add(jobj1,"Ccs1PlugInTimes",Ccs1PlugInTime);
  1673. json_object_object_add(jobj1,"Ccs2PlugInTimes",Ccs2PlugInTimes);
  1674. json_object_object_add(jobj1,"ChademoPlugInTimes",ChademoPlugInTimes);
  1675. json_object_object_add(jobj1,"FirmwareUpdate",FirmwareUpdate);
  1676. if(strcmp(IsAcDc, "D") == 0){
  1677. json_object_object_add(jobj1,"FwPrimaryVersion",FwPrimaryVersionArr);
  1678. json_object_object_add(jobj1,"FwSecondVersion",FwSecondVersionArr);
  1679. }
  1680. printf("%s\n", json_object_to_json_string(jobj1));
  1681. json_object_put(jobj1);
  1682. //charging
  1683. json_object_object_add(jobj2,"MaxChargingEnergy",MaxChargingEnergy);
  1684. json_object_object_add(jobj2,"MaxChargingPower",MaxChargingPower);
  1685. json_object_object_add(jobj2,"MaxChargingCurrent",MaxChargingCurrent);
  1686. json_object_object_add(jobj2,"AcMaxChargingCurrent",AcMaxChargingCurrent);
  1687. json_object_object_add(jobj2,"MaxChargingDuration",MaxChargingDuration);
  1688. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[0]);
  1689. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[1]);
  1690. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[2]);
  1691. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[3]);
  1692. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[4]);
  1693. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[5]);
  1694. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[6]);
  1695. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[7]);
  1696. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[8]);
  1697. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[9]);
  1698. json_object_object_add(jobj2,"LocalWhiteCard",LocalWhiteCardArr);
  1699. json_object_object_add(jobj2,"isBilling",isBilling);
  1700. json_object_object_add(jobj2,"Currency",Currency);
  1701. json_object_array_add(FeeArr,Fee[0]);
  1702. json_object_array_add(FeeArr,Fee[1]);
  1703. json_object_array_add(FeeArr,Fee[2]);
  1704. json_object_array_add(FeeArr,Fee[3]);
  1705. json_object_array_add(FeeArr,Fee[4]);
  1706. json_object_array_add(FeeArr,Fee[5]);
  1707. json_object_array_add(FeeArr,Fee[6]);
  1708. json_object_array_add(FeeArr,Fee[7]);
  1709. json_object_array_add(FeeArr,Fee[8]);
  1710. json_object_array_add(FeeArr,Fee[9]);
  1711. json_object_array_add(FeeArr,Fee[10]);
  1712. json_object_array_add(FeeArr,Fee[11]);
  1713. json_object_array_add(FeeArr,Fee[12]);
  1714. json_object_array_add(FeeArr,Fee[13]);
  1715. json_object_array_add(FeeArr,Fee[14]);
  1716. json_object_array_add(FeeArr,Fee[15]);
  1717. json_object_array_add(FeeArr,Fee[16]);
  1718. json_object_array_add(FeeArr,Fee[17]);
  1719. json_object_array_add(FeeArr,Fee[18]);
  1720. json_object_array_add(FeeArr,Fee[19]);
  1721. json_object_array_add(FeeArr,Fee[20]);
  1722. json_object_array_add(FeeArr,Fee[21]);
  1723. json_object_array_add(FeeArr,Fee[22]);
  1724. json_object_array_add(FeeArr,Fee[23]);
  1725. json_object_object_add(jobj2,"Fee",FeeArr);
  1726. if(connectorType1 != 0){
  1727. json_object_object_add(ChargingInfo1,"StartUserId",StartUserId[0]);
  1728. json_object_object_add(ChargingInfo1,"StartDateTime",StartDateTime[0]);
  1729. json_object_object_add(ChargingInfo1,"StopDateTime",StopDateTime[0]);
  1730. json_object_object_add(ChargingInfo1,"StartMethod",StartMethod[0]);
  1731. json_object_object_add(ChargingInfo1,"ConnectorTemp",ConnectorTemp[0]);
  1732. json_object_object_add(ChargingInfo1,"PresentChargingVoltage",PresentChargingVoltage[0]);
  1733. json_object_object_add(ChargingInfo1,"PresentChargingCurrent",PresentChargingCurrent[0]);
  1734. json_object_object_add(ChargingInfo1,"PresentChargingPower",PresentChargingPower[0]);
  1735. json_object_object_add(ChargingInfo1,"PresentChargedEnergy",PresentChargedEnergy[0]);
  1736. json_object_object_add(ChargingInfo1,"PresentChargedDuration",PresentChargedDuration[0]);
  1737. json_object_object_add(ChargingInfo1,"RemainChargingDuration",RemainChargingDuration[0]);
  1738. json_object_object_add(ChargingInfo1,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[0]);
  1739. json_object_object_add(ChargingInfo1,"EvBatterytargetVoltage",EvBatterytargetVoltage[0]);
  1740. json_object_object_add(ChargingInfo1,"EvBatterySoc",EvBatterySoc[0]);
  1741. json_object_object_add(ChargingInfo1,"SystemStatus",SystemStatus[0]);
  1742. json_object_object_add(ChargingInfo1,"Index",Index[0]);
  1743. json_object_object_add(ChargingInfo1,"Type",Type[0]);
  1744. json_object_object_add(ChargingInfo1,"type_index",type_index[0]);
  1745. json_object_object_add(ChargingInfo1,"EvBatterytargetCurrent",EvBatterytargetCurrent[0]);
  1746. json_object_object_add(jobj2,"ChargingInfo1",ChargingInfo1);
  1747. }
  1748. if(connectorType2 != 0){
  1749. json_object_object_add(ChargingInfo2,"StartUserId",StartUserId[1]);
  1750. json_object_object_add(ChargingInfo2,"StartDateTime",StartDateTime[1]);
  1751. json_object_object_add(ChargingInfo2,"StopDateTime",StopDateTime[1]);
  1752. json_object_object_add(ChargingInfo2,"StartMethod",StartMethod[1]);
  1753. json_object_object_add(ChargingInfo2,"ConnectorTemp",ConnectorTemp[1]);
  1754. json_object_object_add(ChargingInfo2,"PresentChargingVoltage",PresentChargingVoltage[1]);
  1755. json_object_object_add(ChargingInfo2,"PresentChargingCurrent",PresentChargingCurrent[1]);
  1756. json_object_object_add(ChargingInfo2,"PresentChargingPower",PresentChargingPower[1]);
  1757. json_object_object_add(ChargingInfo2,"PresentChargedEnergy",PresentChargedEnergy[1]);
  1758. json_object_object_add(ChargingInfo2,"PresentChargedDuration",PresentChargedDuration[1]);
  1759. json_object_object_add(ChargingInfo2,"RemainChargingDuration",RemainChargingDuration[1]);
  1760. json_object_object_add(ChargingInfo2,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[1]);
  1761. json_object_object_add(ChargingInfo2,"EvBatterytargetVoltage",EvBatterytargetVoltage[1]);
  1762. json_object_object_add(ChargingInfo2,"EvBatterySoc",EvBatterySoc[1]);
  1763. json_object_object_add(ChargingInfo2,"SystemStatus",SystemStatus[1]);
  1764. json_object_object_add(ChargingInfo2,"Index",Index[1]);
  1765. json_object_object_add(ChargingInfo2,"Type",Type[1]);
  1766. json_object_object_add(ChargingInfo2,"type_index",type_index[1]);
  1767. json_object_object_add(ChargingInfo2,"EvBatterytargetCurrent",EvBatterytargetCurrent[1]);
  1768. json_object_object_add(jobj2,"ChargingInfo2",ChargingInfo2);
  1769. }
  1770. if(connectorType3 != 0){
  1771. json_object_object_add(ChargingInfo3,"StartUserId",StartUserId[2]);
  1772. json_object_object_add(ChargingInfo3,"StartDateTime",StartDateTime[2]);
  1773. json_object_object_add(ChargingInfo3,"StopDateTime",StopDateTime[2]);
  1774. json_object_object_add(ChargingInfo3,"StartMethod",StartMethod[2]);
  1775. json_object_object_add(ChargingInfo3,"ConnectorTemp",ConnectorTemp[2]);
  1776. json_object_object_add(ChargingInfo3,"PresentChargingVoltage",PresentChargingVoltage[2]);
  1777. json_object_object_add(ChargingInfo3,"PresentChargingCurrent",PresentChargingCurrent[2]);
  1778. json_object_object_add(ChargingInfo3,"PresentChargingPower",PresentChargingPower[2]);
  1779. json_object_object_add(ChargingInfo3,"PresentChargedEnergy",PresentChargedEnergy[2]);
  1780. json_object_object_add(ChargingInfo3,"PresentChargedDuration",PresentChargedDuration[2]);
  1781. json_object_object_add(ChargingInfo3,"RemainChargingDuration",RemainChargingDuration[2]);
  1782. json_object_object_add(ChargingInfo3,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[2]);
  1783. json_object_object_add(ChargingInfo3,"EvBatterytargetVoltage",EvBatterytargetVoltage[2]);
  1784. json_object_object_add(ChargingInfo3,"EvBatterySoc",EvBatterySoc[2]);
  1785. json_object_object_add(ChargingInfo3,"SystemStatus",SystemStatus[2]);
  1786. json_object_object_add(ChargingInfo3,"Index",Index[2]);
  1787. json_object_object_add(ChargingInfo3,"Type",Type[2]);
  1788. json_object_object_add(ChargingInfo3,"type_index",type_index[2]);
  1789. json_object_object_add(ChargingInfo3,"EvBatterytargetCurrent",EvBatterytargetCurrent[2]);
  1790. json_object_object_add(jobj2,"ChargingInfo3",ChargingInfo3);
  1791. }
  1792. printf("%s\n", json_object_to_json_string(jobj2));
  1793. json_object_put(jobj2);
  1794. //network
  1795. json_object_object_add(jobj3,"InternetConn",InternetConn);
  1796. json_object_object_add(jobj3,"FtpServer",FtpServer);
  1797. json_object_object_add(jobj3,"Eth0DhcpClient",Eth0DhcpClient);
  1798. json_object_object_add(jobj3,"Eth0MacAddress",Eth0MacAddress);
  1799. json_object_object_add(jobj3,"Eth0IpAddress",Eth0IpAddress);
  1800. json_object_object_add(jobj3,"Eth0SubmaskAddress",Eth0SubmaskAddress);
  1801. json_object_object_add(jobj3,"Eth0GatewayAddress",Eth0GatewayAddress);
  1802. json_object_object_add(jobj3,"Eth1DhcpClient",Eth1DhcpClient);
  1803. json_object_object_add(jobj3,"Eth1MacAddress",Eth1MacAddress);
  1804. json_object_object_add(jobj3,"Eth1IpAddress",Eth1IpAddress);
  1805. json_object_object_add(jobj3,"Eth1SubmaskAddress",Eth1SubmaskAddress);
  1806. json_object_object_add(jobj3,"Eth1GatewayAddress",Eth1GatewayAddress);
  1807. json_object_object_add(jobj3,"WifiMode",WifiMode);
  1808. json_object_object_add(jobj3,"WifiSsid",WifiSsid);
  1809. json_object_object_add(jobj3,"WifiPassword",WifiPassword);
  1810. json_object_object_add(jobj3,"WifiRssi",WifiRssi);
  1811. json_object_object_add(jobj3,"WifiDhcpServer",WifiDhcpServer);
  1812. json_object_object_add(jobj3,"WifiDhcpClient",WifiDhcpClient);
  1813. json_object_object_add(jobj3,"WifiMacAddress",WifiMacAddress);
  1814. json_object_object_add(jobj3,"WifiIpAddress",WifiIpAddress);
  1815. json_object_object_add(jobj3,"WifiSubmaskAddress",WifiSubmaskAddress);
  1816. json_object_object_add(jobj3,"WifiGatewayAddress",WifiGatewayAddress);
  1817. json_object_object_add(jobj3,"WifiNetworkConn",WifiNetworkConn);
  1818. json_object_object_add(jobj3,"TelcomApn",TelcomApn);
  1819. json_object_object_add(jobj3,"TelcomRssi",TelcomRssi);
  1820. json_object_object_add(jobj3,"TelcomChapPapId",TelcomChapPapId);
  1821. json_object_object_add(jobj3,"TelcomChapPapPwd",TelcomChapPapPwd);
  1822. json_object_object_add(jobj3,"TelcomModemImei",TelcomModemImei);
  1823. json_object_object_add(jobj3,"TelcomSimImsi",TelcomSimImsi);
  1824. json_object_object_add(jobj3,"TelcomSimIccid",TelcomSimIccid);
  1825. json_object_object_add(jobj3,"TelcomSimStatus",TelcomSimStatus);
  1826. json_object_object_add(jobj3,"TelcomModemMode",TelcomModemMode);
  1827. json_object_object_add(jobj3,"TelcomIpAddress",TelcomIpAddress);
  1828. json_object_object_add(jobj3,"TelcomNetworkConn",TelcomNetworkConn);
  1829. json_object_object_add(jobj3,"TelcomEnabled",TelcomEnabled);
  1830. printf("%s\n", json_object_to_json_string(jobj3));
  1831. json_object_put(jobj3);
  1832. //backend
  1833. json_object_object_add(jobj4,"BackendConnTimeout",BackendConnTimeout);
  1834. json_object_object_add(jobj4,"OfflinePolicy",OfflinePolicy);
  1835. json_object_object_add(jobj4,"OfflineMaxChargeEnergy",OfflineMaxChargeEnergy);
  1836. json_object_object_add(jobj4,"OfflineMaxChargeDuration",OfflineMaxChargeDuration);
  1837. json_object_object_add(jobj4,"OcppConnStatus",OcppConnStatus);
  1838. json_object_object_add(jobj4,"OcppServerURL",OcppServerURL);
  1839. json_object_object_add(jobj4,"ChargeBoxId",ChargeBoxId);
  1840. json_object_object_add(jobj4,"chargePointVendor",chargePointVendor);
  1841. printf("%s\n", json_object_to_json_string(jobj4));
  1842. json_object_put(jobj4);
  1843. }
  1844. // for(;;)
  1845. // {
  1846. // }
  1847. return FAIL;
  1848. }