WebService.c 102 KB

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