WebService.c 104 KB

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