WebService.c 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501
  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 "../Projects/define.h"
  29. #include "json.h"
  30. //#include <json-c/json.h>
  31. #include <math.h>
  32. #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  33. #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  34. #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  35. #define Debug
  36. #define SystemLogMessage
  37. #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
  38. #define PASS 1
  39. #define FAIL -1
  40. struct SysConfigAndInfo *ShmSysConfigAndInfo;
  41. struct StatusCodeData *ShmStatusCodeData;
  42. void trim(char *s);
  43. int mystrcmp(char *p1, char *p2);
  44. void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
  45. void split(char **arr, char *str, const char *del);
  46. #ifdef SystemLogMessage
  47. int StoreLogMsg(const char *fmt, ...) {
  48. char Buf[4096 + 256];
  49. char buffer[4096];
  50. time_t CurrentTime;
  51. struct tm *tm;
  52. va_list args;
  53. va_start(args, fmt);
  54. int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
  55. va_end(args);
  56. memset(Buf, 0, sizeof(Buf));
  57. CurrentTime = time(NULL);
  58. tm = localtime(&CurrentTime);
  59. sprintf(Buf,
  60. "echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
  61. tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
  62. tm->tm_min, tm->tm_sec, buffer, tm->tm_year + 1900, tm->tm_mon + 1);
  63. system(Buf);
  64. #ifdef Debug
  65. printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year + 1900,
  66. tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
  67. buffer);
  68. #endif
  69. return rc;
  70. }
  71. #endif
  72. int DiffTimeb(struct timeb ST, struct timeb ET) {
  73. //return milli-second
  74. unsigned int StartTime, StopTime;
  75. StartTime = (unsigned int) ST.time;
  76. StopTime = (unsigned int) ET.time;
  77. return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
  78. }
  79. //=================================
  80. // Common routine
  81. //=================================
  82. void trim(char *s) {
  83. int i = 0, j, k, l = 0;
  84. while ((s[i] == ' ') || (s[i] == '\t') || (s[i] == '\n'))
  85. i++;
  86. j = strlen(s) - 1;
  87. while ((s[j] == ' ') || (s[j] == '\t') || (s[j] == '\n'))
  88. j--;
  89. if (i == 0 && j == strlen(s) - 1) {
  90. } else if (i == 0)
  91. s[j + 1] = '\0';
  92. else {
  93. for (k = i; k <= j; k++)
  94. s[l++] = s[k];
  95. s[l] = '\0';
  96. }
  97. }
  98. int mystrcmp(char *p1, char *p2) {
  99. while (*p1 == *p2) {
  100. if (*p1 == '\0' || *p2 == '\0')
  101. break;
  102. p1++;
  103. p2++;
  104. }
  105. if (*p1 == '\0' && *p2 == '\0')
  106. return (PASS);
  107. else
  108. return (FAIL);
  109. }
  110. void substr(char *dest, const char* src, unsigned int start, unsigned int cnt) {
  111. strncpy(dest, src + start, cnt);
  112. dest[cnt] = 0;
  113. }
  114. void split(char **arr, char *str, const char *del) {
  115. char *s = strtok(str, del);
  116. while (s != NULL) {
  117. *arr++ = s;
  118. s = strtok(NULL, del);
  119. }
  120. }
  121. int ConnectorType(char* connector){
  122. int result;
  123. if(strcmp(connector, "0") == 0){
  124. result= 0;
  125. }
  126. else if(strcmp(connector, "U") == 0 || strcmp(connector, "E") == 0){
  127. result= 1;//CCS
  128. }
  129. else if(strcmp(connector, "G") == 0 || strcmp(connector, "D") == 0){
  130. result= 2;//GB
  131. }
  132. else if(strcmp(connector, "J") == 0){
  133. result= 3;//CHAdeMO
  134. }
  135. 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){
  136. result= 4;//AC
  137. }
  138. else{
  139. result= 0;
  140. }
  141. return result;
  142. }
  143. int ModelType(char* type,char* network){
  144. int result=0;
  145. if(strcmp(type, "A") == 0){
  146. if(strcmp(network, "0") == 0 || strcmp(network, "R") == 0 || strcmp(network, "B") == 0){
  147. result=0;
  148. }
  149. else if(strcmp(network, "E") == 0 || strcmp(network, "W") == 0 || strcmp(network, "T") == 0 || strcmp(network, "U") == 0){
  150. result=1;
  151. }
  152. }
  153. else if(strcmp(type, "D") == 0){
  154. result=2;
  155. }
  156. return result;
  157. }
  158. //==========================================
  159. // Init all share memory
  160. //==========================================
  161. int InitShareMemory() {
  162. int result = PASS;
  163. int MeterSMId;
  164. //creat ShmSysConfigAndInfo
  165. if ((MeterSMId = shmget(ShmSysConfigAndInfoKey,
  166. sizeof(struct SysConfigAndInfo), 0777)) < 0) {
  167. #ifdef SystemLogMessage
  168. DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
  169. #endif
  170. result = FAIL;
  171. } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0))
  172. == (void *) -1) {
  173. #ifdef SystemLogMessage
  174. DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
  175. #endif
  176. result = FAIL;
  177. } else {
  178. }
  179. //creat ShmStatusCodeData
  180. if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),
  181. 0777)) < 0) {
  182. #ifdef SystemLogMessage
  183. DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
  184. #endif
  185. result = FAIL;
  186. } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
  187. #ifdef SystemLogMessage
  188. DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
  189. #endif
  190. result = FAIL;
  191. } else {
  192. }
  193. return result;
  194. }
  195. int StoreUsrConfigData(struct SysConfigData *UsrData)
  196. {
  197. int fd,wrd;
  198. unsigned int i,Chk;
  199. unsigned char *ptr;
  200. Chk=0;
  201. ptr=(unsigned char *)UsrData;
  202. for(i=0;i<sizeof(struct SysConfigData)-4;i++)
  203. {
  204. Chk+=*(ptr+i);
  205. }
  206. UsrData->Checksum=Chk;
  207. fd = open("/dev/mtdblock10", O_RDWR);
  208. if (fd < 0)
  209. {
  210. #ifdef SystemLogMessage
  211. StoreLogMsg("[WebService]StoreUsrConfigData: open /dev/mtdblock10 NG");
  212. #endif
  213. return 0;
  214. }
  215. wrd=write(fd, UsrData, sizeof(struct SysConfigData));
  216. close(fd);
  217. if(wrd!=(sizeof(struct SysConfigData)))
  218. {
  219. #ifdef SystemLogMessage
  220. StoreLogMsg("[WebService]StoreUsrConfigData: write /dev/mtdblock10 NG");
  221. #endif
  222. return 0;
  223. }
  224. fd = open("/dev/mtdblock11", O_RDWR);
  225. if (fd < 0)
  226. {
  227. #ifdef SystemLogMessage
  228. StoreLogMsg("[WebService]StoreUsrConfigData: open /dev/mtdblock11(backup) NG");
  229. #endif
  230. return 0;
  231. }
  232. wrd=write(fd, UsrData, sizeof(struct SysConfigData));
  233. close(fd);
  234. if(wrd!=(sizeof(struct SysConfigData)))
  235. {
  236. #ifdef SystemLogMessage
  237. StoreLogMsg("[WebService]StoreUsrConfigData: write /dev/mtdblock11(backup) NG");
  238. #endif
  239. return 0;
  240. }
  241. return 1;
  242. }
  243. //================================================
  244. // Main process
  245. //================================================
  246. int main(int argc, char *argv[]) {
  247. if (InitShareMemory() == FAIL) {
  248. #ifdef SystemLogMessage
  249. DEBUG_ERROR("InitShareMemory NG\n");
  250. #endif
  251. if (ShmStatusCodeData != NULL) {
  252. ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
  253. }
  254. sleep(5);
  255. return 0;
  256. }
  257. //web page submit
  258. if ((argc == 3) & (strlen(argv[1]) == 1)) {
  259. //web page submit system
  260. if (strcmp(argv[1], "1") == 0) {
  261. struct json_object *jobj = json_tokener_parse(argv[2]);
  262. json_object *val_obj = NULL;
  263. char *SystemId=NULL;
  264. char *SystemDateTime = NULL;
  265. int AcPhaseCount = 0;
  266. int FactoryConfiguration = 0;
  267. int AuthorisationMode = 0;
  268. int DefaultLanguage = 0;
  269. int RfidCardNumEndian = 0;
  270. int PsuAcInputType = 0;
  271. if( json_object_object_get_ex(jobj, "SystemId", &val_obj) ) {
  272. SystemId = json_object_get_string(val_obj);
  273. }
  274. if( json_object_object_get_ex(jobj, "SystemDateTime", &val_obj) ) {
  275. SystemDateTime = json_object_get_string(val_obj);
  276. }
  277. if( json_object_object_get_ex(jobj, "AcPhaseCount", &val_obj) ) {
  278. AcPhaseCount = json_object_get_int(val_obj);
  279. }
  280. if( json_object_object_get_ex(jobj, "FactoryConfiguration", &val_obj) ) {
  281. FactoryConfiguration = json_object_get_int(val_obj);
  282. }
  283. if( json_object_object_get_ex(jobj, "AuthorisationMode", &val_obj) ) {
  284. AuthorisationMode = json_object_get_int(val_obj);
  285. }
  286. if( json_object_object_get_ex(jobj, "DefaultLanguage", &val_obj) ) {
  287. DefaultLanguage = json_object_get_int(val_obj);
  288. }
  289. if( json_object_object_get_ex(jobj, "RfidCardNumEndian", &val_obj) ) {
  290. RfidCardNumEndian = json_object_get_int(val_obj);
  291. }
  292. if( json_object_object_get_ex(jobj, "PsuAcInputType", &val_obj) ) {
  293. PsuAcInputType = json_object_get_int(val_obj);
  294. }
  295. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId,SystemId);
  296. ShmSysConfigAndInfo->SysConfig.AcPhaseCount = AcPhaseCount;
  297. ShmSysConfigAndInfo->SysInfo.FactoryConfiguration = FactoryConfiguration;
  298. ShmSysConfigAndInfo->SysConfig.AuthorisationMode = AuthorisationMode;
  299. ShmSysConfigAndInfo->SysConfig.DefaultLanguage = DefaultLanguage;
  300. ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = RfidCardNumEndian;
  301. ShmSysConfigAndInfo->SysConfig.PsuAcInputType = PsuAcInputType;
  302. if(strlen(SystemDateTime)>0){
  303. char cmd[100];
  304. sprintf(cmd,"date -s '%s'",SystemDateTime);
  305. if(system(cmd)==0){
  306. system("hwclock -w");
  307. }
  308. }
  309. }
  310. if (strcmp(argv[1], "2") == 0) {
  311. struct json_object *jobj = json_tokener_parse(argv[2]);
  312. json_object *val_obj = NULL;
  313. int MaxChargingEnergy= 0;
  314. int MaxChargingPower = 0;
  315. int MaxChargingCurrent = 0;
  316. int MaxChargingDuration = 0;
  317. int PhaseLossPolicy = 0;
  318. char *LocalWhiteCard0 = NULL;
  319. char *LocalWhiteCard1 = NULL;
  320. char *LocalWhiteCard2 = NULL;
  321. char *LocalWhiteCard3 = NULL;
  322. char *LocalWhiteCard4 = NULL;
  323. char *LocalWhiteCard5 = NULL;
  324. char *LocalWhiteCard6 = NULL;
  325. char *LocalWhiteCard7 = NULL;
  326. char *LocalWhiteCard8 = NULL;
  327. char *LocalWhiteCard9 = NULL;
  328. if( json_object_object_get_ex(jobj, "MaxChargingEnergy", &val_obj) ) {
  329. MaxChargingEnergy = json_object_get_int(val_obj);
  330. }
  331. if( json_object_object_get_ex(jobj, "MaxChargingPower", &val_obj) ) {
  332. MaxChargingPower = json_object_get_int(val_obj);
  333. }
  334. if( json_object_object_get_ex(jobj, "MaxChargingCurrent", &val_obj) ) {
  335. MaxChargingCurrent = json_object_get_int(val_obj);
  336. }
  337. if( json_object_object_get_ex(jobj, "MaxChargingDuration", &val_obj) ) {
  338. MaxChargingDuration = json_object_get_int(val_obj);
  339. }
  340. if( json_object_object_get_ex(jobj, "PhaseLossPolicy", &val_obj) ) {
  341. PhaseLossPolicy = json_object_get_int(val_obj);
  342. }
  343. if( json_object_object_get_ex(jobj, "LocalWhiteCard0", &val_obj) ) {
  344. LocalWhiteCard0 = json_object_get_string(val_obj);
  345. }
  346. if( json_object_object_get_ex(jobj, "LocalWhiteCard1", &val_obj) ) {
  347. LocalWhiteCard1 = json_object_get_string(val_obj);
  348. }
  349. if( json_object_object_get_ex(jobj, "LocalWhiteCard2", &val_obj) ) {
  350. LocalWhiteCard2 = json_object_get_string(val_obj);
  351. }
  352. if( json_object_object_get_ex(jobj, "LocalWhiteCard3", &val_obj) ) {
  353. LocalWhiteCard3 = json_object_get_string(val_obj);
  354. }
  355. if( json_object_object_get_ex(jobj, "LocalWhiteCard4", &val_obj) ) {
  356. LocalWhiteCard4 = json_object_get_string(val_obj);
  357. }
  358. if( json_object_object_get_ex(jobj, "LocalWhiteCard5", &val_obj) ) {
  359. LocalWhiteCard5 = json_object_get_string(val_obj);
  360. }
  361. if( json_object_object_get_ex(jobj, "LocalWhiteCard6", &val_obj) ) {
  362. LocalWhiteCard6 = json_object_get_string(val_obj);
  363. }
  364. if( json_object_object_get_ex(jobj, "LocalWhiteCard7", &val_obj) ) {
  365. LocalWhiteCard7 = json_object_get_string(val_obj);
  366. }
  367. if( json_object_object_get_ex(jobj, "LocalWhiteCard8", &val_obj) ) {
  368. LocalWhiteCard8 = json_object_get_string(val_obj);
  369. }
  370. if( json_object_object_get_ex(jobj, "LocalWhiteCard9", &val_obj) ) {
  371. LocalWhiteCard9 = json_object_get_string(val_obj);
  372. }
  373. ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy = MaxChargingEnergy;
  374. ShmSysConfigAndInfo->SysConfig.MaxChargingPower = MaxChargingPower;
  375. ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent = MaxChargingCurrent;
  376. ShmSysConfigAndInfo->SysConfig.MaxChargingDuration = MaxChargingDuration;
  377. ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy = PhaseLossPolicy;
  378. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0],LocalWhiteCard0);
  379. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1],LocalWhiteCard1);
  380. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2],LocalWhiteCard2);
  381. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3],LocalWhiteCard3);
  382. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4],LocalWhiteCard4);
  383. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5],LocalWhiteCard5);
  384. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6],LocalWhiteCard6);
  385. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7],LocalWhiteCard7);
  386. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8],LocalWhiteCard8);
  387. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9],LocalWhiteCard9);
  388. }
  389. if (strcmp(argv[1], "3") == 0) {
  390. struct json_object *jobj = json_tokener_parse(argv[2]);
  391. json_object *val_obj = NULL;
  392. char *FtpServer=NULL;
  393. int Eth0DhcpClient=0;
  394. char *Eth0IpAddress=NULL;
  395. char *Eth0SubmaskAddress=NULL;
  396. char *Eth0GatewayAddress=NULL;
  397. int Eth1DhcpClient=0;
  398. char *Eth1IpAddress=NULL;
  399. char *Eth1SubmaskAddress=NULL;
  400. char *Eth1GatewayAddress=NULL;
  401. int WifiMode=0;
  402. char *WifiSsid=NULL;
  403. char *WifiPassword=NULL;
  404. int WifiDhcpServer=0;
  405. int WifiDhcpClient=0;
  406. char *WifiIpAddress=NULL;
  407. char *WifiSubmaskAddress=NULL;
  408. char *WifiGatewayAddress=NULL;
  409. char *TelcomApn=NULL;
  410. char *TelcomChapPapId=NULL;
  411. char *TelcomChapPapPwd=NULL;
  412. char *TelcomIpAddress=NULL;
  413. if( json_object_object_get_ex(jobj, "FtpServer", &val_obj) ) {
  414. FtpServer = json_object_get_string(val_obj);
  415. }
  416. if( json_object_object_get_ex(jobj, "Eth0DhcpClient", &val_obj) ) {
  417. Eth0DhcpClient = json_object_get_int(val_obj);
  418. }
  419. if( json_object_object_get_ex(jobj, "Eth0IpAddress", &val_obj) ) {
  420. Eth0IpAddress = json_object_get_string(val_obj);
  421. }
  422. if( json_object_object_get_ex(jobj, "Eth0SubmaskAddress", &val_obj) ) {
  423. Eth0SubmaskAddress = json_object_get_string(val_obj);
  424. }
  425. if( json_object_object_get_ex(jobj, "Eth0GatewayAddress", &val_obj) ) {
  426. Eth0GatewayAddress = json_object_get_string(val_obj);
  427. }
  428. if( json_object_object_get_ex(jobj, "Eth1DhcpClient", &val_obj) ) {
  429. Eth1DhcpClient = json_object_get_int(val_obj);
  430. }
  431. if( json_object_object_get_ex(jobj, "Eth1IpAddress", &val_obj) ) {
  432. Eth1IpAddress = json_object_get_string(val_obj);
  433. }
  434. if( json_object_object_get_ex(jobj, "Eth1SubmaskAddress", &val_obj) ) {
  435. Eth1SubmaskAddress = json_object_get_string(val_obj);
  436. }
  437. if( json_object_object_get_ex(jobj, "Eth1GatewayAddress", &val_obj) ) {
  438. Eth1GatewayAddress = json_object_get_string(val_obj);
  439. }
  440. if( json_object_object_get_ex(jobj, "WifiMode", &val_obj) ) {
  441. WifiMode = json_object_get_int(val_obj);
  442. }
  443. if( json_object_object_get_ex(jobj, "WifiSsid", &val_obj) ) {
  444. WifiSsid = json_object_get_string(val_obj);
  445. }
  446. if( json_object_object_get_ex(jobj, "WifiPassword", &val_obj) ) {
  447. WifiPassword = json_object_get_string(val_obj);
  448. }
  449. if( json_object_object_get_ex(jobj, "WifiDhcpServer", &val_obj) ) {
  450. WifiDhcpServer = json_object_get_int(val_obj);
  451. }
  452. if( json_object_object_get_ex(jobj, "WifiDhcpClient", &val_obj) ) {
  453. WifiDhcpClient = json_object_get_int(val_obj);
  454. }
  455. if( json_object_object_get_ex(jobj, "WifiIpAddress", &val_obj) ) {
  456. WifiIpAddress = json_object_get_string(val_obj);
  457. }
  458. if( json_object_object_get_ex(jobj, "WifiSubmaskAddress", &val_obj) ) {
  459. WifiSubmaskAddress = json_object_get_string(val_obj);
  460. }
  461. if( json_object_object_get_ex(jobj, "WifiGatewayAddress", &val_obj) ) {
  462. WifiGatewayAddress = json_object_get_string(val_obj);
  463. }
  464. if( json_object_object_get_ex(jobj, "TelcomApn", &val_obj) ) {
  465. TelcomApn = json_object_get_string(val_obj);
  466. }
  467. if( json_object_object_get_ex(jobj, "TelcomChapPapId", &val_obj) ) {
  468. TelcomChapPapId = json_object_get_string(val_obj);
  469. }
  470. if( json_object_object_get_ex(jobj, "TelcomChapPapPwd", &val_obj) ) {
  471. TelcomChapPapPwd = json_object_get_string(val_obj);
  472. }
  473. if( json_object_object_get_ex(jobj, "TelcomIpAddress", &val_obj) ) {
  474. TelcomIpAddress = json_object_get_string(val_obj);
  475. }
  476. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,FtpServer);
  477. ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=Eth0DhcpClient;
  478. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,Eth0IpAddress);
  479. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,Eth0SubmaskAddress);
  480. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,Eth0GatewayAddress);
  481. ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=Eth1DhcpClient;
  482. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,Eth1IpAddress);
  483. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,Eth1SubmaskAddress);
  484. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,Eth1GatewayAddress);
  485. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=WifiMode;
  486. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,WifiSsid);
  487. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,WifiPassword);
  488. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=WifiDhcpServer;
  489. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=WifiDhcpClient;
  490. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,WifiIpAddress);
  491. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,WifiSubmaskAddress);
  492. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,WifiGatewayAddress);
  493. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,TelcomApn);
  494. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,TelcomChapPapId);
  495. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,TelcomChapPapPwd);
  496. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,TelcomIpAddress);
  497. }
  498. if (strcmp(argv[1], "4") == 0) {
  499. struct json_object *jobj = json_tokener_parse(argv[2]);
  500. json_object *val_obj = NULL;
  501. int BackendConnTimeout=0;
  502. int OfflinePolicy=0;
  503. int OfflineMaxChargeEnergy=0;
  504. int OfflineMaxChargeDuration=0;
  505. char *OcppServerURL=NULL;
  506. char *ChargeBoxId=NULL;
  507. if( json_object_object_get_ex(jobj, "BackendConnTimeout", &val_obj) ) {
  508. BackendConnTimeout = json_object_get_int(val_obj);
  509. }
  510. if( json_object_object_get_ex(jobj, "OfflinePolicy", &val_obj) ) {
  511. OfflinePolicy = json_object_get_int(val_obj);
  512. }
  513. if( json_object_object_get_ex(jobj, "OfflineMaxChargeEnergy", &val_obj) ) {
  514. OfflineMaxChargeEnergy = json_object_get_int(val_obj);
  515. }
  516. if( json_object_object_get_ex(jobj, "OfflineMaxChargeDuration", &val_obj) ) {
  517. OfflineMaxChargeDuration = json_object_get_int(val_obj);
  518. }
  519. if( json_object_object_get_ex(jobj, "OcppServerURL", &val_obj) ) {
  520. OcppServerURL = json_object_get_string(val_obj);
  521. }
  522. if( json_object_object_get_ex(jobj, "ChargeBoxId", &val_obj) ) {
  523. ChargeBoxId = json_object_get_string(val_obj);
  524. }
  525. ShmSysConfigAndInfo->SysConfig.BackendConnTimeout = BackendConnTimeout;
  526. ShmSysConfigAndInfo->SysConfig.OfflinePolicy = OfflinePolicy;
  527. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy = OfflineMaxChargeEnergy;
  528. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration = OfflineMaxChargeDuration;
  529. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,OcppServerURL);
  530. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,ChargeBoxId);
  531. }
  532. int result = StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
  533. if(result != 1){
  534. #ifdef SystemLogMessage
  535. StoreLogMsg("[WebService]StoreUsrConfigData: normal NG");
  536. #endif
  537. }
  538. else{
  539. #ifdef SystemLogMessage
  540. StoreLogMsg("[WebService]StoreUsrConfigData: normal OK");
  541. #endif
  542. }
  543. #ifdef SystemLogMessage
  544. DEBUG_INFO("WebServiceConfig update OK");
  545. #endif
  546. }
  547. if (argc == 2) { //init share memory for test
  548. if (strcmp(argv[1], "aaa") == 0) {
  549. struct SysConfigData SysConfig;
  550. //system
  551. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ModelName, "DSLU122110T1P0");
  552. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber, "SerialNumber");
  553. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
  554. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
  555. ShmSysConfigAndInfo->SysConfig.AcPhaseCount=1;
  556. ShmSysConfigAndInfo->SysInfo.FactoryConfiguration=0;
  557. ShmSysConfigAndInfo->SysConfig.AuthorisationMode=0;
  558. ShmSysConfigAndInfo->SysConfig.DefaultLanguage=0;
  559. ShmSysConfigAndInfo->SysInfo.InputVoltageR=0;
  560. ShmSysConfigAndInfo->SysInfo.InputVoltageS=0;
  561. ShmSysConfigAndInfo->SysInfo.InputVoltageT=0;
  562. ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed=0;
  563. ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0;
  564. ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian=0;
  565. ShmSysConfigAndInfo->SysConfig.PsuAcInputType=0;
  566. ShmSysConfigAndInfo->SysInfo.AuxPower5V=0;
  567. ShmSysConfigAndInfo->SysInfo.AuxPower12V=0;
  568. ShmSysConfigAndInfo->SysInfo.AuxPower24V=0;
  569. ShmSysConfigAndInfo->SysInfo.AuxPower48V=0;
  570. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev, "");
  571. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, "");
  572. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "");
  573. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "");
  574. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, "");
  575. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev, "");
  576. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev, "");
  577. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev, "");
  578. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev, "");
  579. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev, "");
  580. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev, "");
  581. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev, "");
  582. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev, "");
  583. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, "");
  584. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev, "");
  585. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, "");
  586. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev, "");
  587. ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp=0;
  588. ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp=0;
  589. ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp=0;
  590. ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp=0;
  591. ShmSysConfigAndInfo->SysConfig.AcPlugInTimes=0;
  592. ShmSysConfigAndInfo->SysConfig.GbPlugInTimes=0;
  593. ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime=0;
  594. ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes=0;
  595. ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes=0;
  596. //charging
  597. ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy=0;
  598. ShmSysConfigAndInfo->SysConfig.MaxChargingPower=0;
  599. ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0;
  600. ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0;
  601. ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
  602. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111");
  603. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222");
  604. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333");
  605. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3], "444");
  606. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4], "555");
  607. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5], "666");
  608. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6], "777");
  609. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7], "888");
  610. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8], "999");
  611. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9], "aaa");
  612. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.UserId, "UserId");
  613. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage=0;
  614. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent=0;
  615. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingPower=0;
  616. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedEnergy=0;
  617. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedDuration=0;
  618. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].RemainChargingDuration=0;
  619. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatteryMaxVoltage=0;
  620. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetVoltage=0;
  621. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterySoc=0;
  622. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus=1;
  623. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Index=0;
  624. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].Type=0;
  625. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].type_index=0;
  626. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetCurrent=1;
  627. //network
  628. ShmSysConfigAndInfo->SysInfo.InternetConn=0;
  629. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,"");
  630. ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=1;
  631. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress,"");
  632. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,"192.168.1.10");
  633. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,"255.255.255.0");
  634. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,"192.168.1.1");
  635. ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=1;
  636. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress,"");
  637. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,"192.168.0.10");
  638. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,"255.255.255.0");
  639. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,"192.168.0.1");
  640. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=1;
  641. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,"");
  642. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,"");
  643. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi=0;
  644. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=0;
  645. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=0;
  646. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress,"");
  647. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,"");
  648. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,"");
  649. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,"");
  650. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,"");
  651. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi=0;
  652. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,"");
  653. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,"");
  654. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei,"");
  655. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi,"");
  656. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid,"");
  657. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus=0;
  658. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode=0;
  659. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,"");
  660. //backend
  661. ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=300;
  662. ShmSysConfigAndInfo->SysConfig.OfflinePolicy=0;
  663. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy=0;
  664. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration=0;
  665. ShmSysConfigAndInfo->SysInfo.OcppConnStatus=0;
  666. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"");
  667. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"");
  668. ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=0;
  669. StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
  670. #ifdef SystemLogMessage
  671. DEBUG_INFO("WebService initial OK");
  672. #endif
  673. }
  674. if (strcmp(argv[1], "log") == 0) {
  675. time_t tt = time(0); //獲取當前時間
  676. int year,month;
  677. char cmd[100];
  678. struct tm *pst = localtime(&tt); //把time_t類型轉換為struct tm類型
  679. year = pst->tm_year + 1900;
  680. month = pst->tm_mon + 1;
  681. sprintf(cmd,"cp /mnt/%04d-%02d.zip /var/www/log.zip",year,month);
  682. if(system("exec /root/logPackTools 'log'")==0){
  683. system(cmd);
  684. }
  685. }
  686. }
  687. //upgrade firmware
  688. if ((argc == 3) & (strcmp(argv[1], "upgrade") == 0)) {
  689. struct json_object *jobj;
  690. struct json_object *Result;
  691. struct json_object *Message;
  692. char cmd[100];
  693. jobj=json_object_new_object();
  694. //system
  695. //if((char)ShmSysConfigAndInfo->SysInfo.FirmwareUpdate == '0'){
  696. ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=1;
  697. Result = json_object_new_string("success");
  698. Message = json_object_new_string("file is uploaded");
  699. //}
  700. /*else{
  701. sprintf(cmd,"rm /mnt/%s",argv[2]);
  702. system(cmd);
  703. Result = json_object_new_string("error");
  704. Message = json_object_new_string("machine is busy");
  705. }*/
  706. json_object_object_add(jobj,"Result",Result);
  707. json_object_object_add(jobj,"Message",Message);
  708. printf("%s\n", json_object_to_json_string(jobj));
  709. }
  710. //web page query all
  711. if ((argc == 2) & (strcmp(argv[1], "query") == 0)) {
  712. char *IsAcDc[2];
  713. char *Connector1[2];
  714. char *Connector2[2];
  715. char *Connector3[2];
  716. char *Network[2];
  717. substr((char *)IsAcDc,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,1);
  718. substr((char *)Connector1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,7,1);
  719. substr((char *)Connector2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,8,1);
  720. substr((char *)Connector3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,9,1);
  721. substr((char *)Network,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,10,1);
  722. int connectorType1,connectorType2,connectorType3;
  723. connectorType1=ConnectorType((char *)Connector1);
  724. connectorType2=ConnectorType((char *)Connector2);
  725. connectorType3=ConnectorType((char *)Connector3);
  726. // modelType=ModelType((char *)IsAcDc,(char *)Network);
  727. // printf("modelType:%d\n",modelType);
  728. struct json_object *jobj1;
  729. struct json_object *jobj2;
  730. struct json_object *jobj3;
  731. struct json_object *jobj4;
  732. // struct json_object *array_obj;
  733. //system
  734. struct json_object *ModelName;
  735. struct json_object *SerialNumber;
  736. struct json_object *SystemId;
  737. // struct json_object *SystemDateTime;
  738. struct json_object *AcPhaseCount;
  739. struct json_object *FactoryConfiguration;
  740. struct json_object *AuthorisationMode;
  741. struct json_object *DefaultLanguage;
  742. struct json_object *InputVoltageR;
  743. struct json_object *InputVoltageS;
  744. struct json_object *InputVoltageT;
  745. struct json_object *SystemFanRotaSpeed;
  746. struct json_object *PsuFanRotaSpeed;
  747. struct json_object *RfidCardNumEndian;
  748. struct json_object *PsuAcInputType;
  749. struct json_object *AuxPower5V;
  750. struct json_object *AuxPower12V;
  751. struct json_object *AuxPower24V;
  752. struct json_object *AuxPower48V;
  753. struct json_object *CsuHwRev;
  754. struct json_object *CsuBootLoadFwRev;
  755. struct json_object *CsuKernelFwRev;
  756. struct json_object *CsuRootFsFwRev;
  757. struct json_object *CsuPrimFwRev;
  758. struct json_object *LcmHwRev;
  759. struct json_object *LcmFwRev;
  760. struct json_object *PsuHwRev;
  761. struct json_object *PsuPrimFwRev;
  762. struct json_object *PsuSecFwRev;
  763. struct json_object *AuxPwrHwRev;
  764. struct json_object *AuxPwrFwRev;
  765. struct json_object *FanModuleHwRev;
  766. struct json_object *FanModuleFwRev;
  767. struct json_object *RelayModuleHwRev;
  768. struct json_object *RelayModuleFwRev;
  769. struct json_object *TelcomModemFwRev;
  770. struct json_object *SystemAmbientTemp;
  771. struct json_object *SystemCriticalTemp;
  772. struct json_object *CcsConnectorTemp;
  773. struct json_object *PsuAmbientTemp;
  774. struct json_object *AcPlugInTimes;
  775. struct json_object *GbPlugInTimes;
  776. struct json_object *Ccs1PlugInTime;
  777. struct json_object *Ccs2PlugInTimes;
  778. struct json_object *ChademoPlugInTimes;
  779. struct json_object *FirmwareUpdate;
  780. //charging
  781. struct json_object *MaxChargingEnergy;
  782. struct json_object *MaxChargingPower;
  783. struct json_object *MaxChargingCurrent;
  784. struct json_object *MaxChargingDuration;
  785. struct json_object *PhaseLossPolicy;
  786. struct json_object *LocalWhiteCard[10];
  787. struct json_object *LocalWhiteCardArr= json_object_new_array();
  788. // struct json_object *CcsAuthentication;
  789. // struct json_object *AcCcsChargingMode;
  790. struct json_object *UserId;
  791. struct json_object *ChargingInfo1;
  792. struct json_object *ChargingInfo2;
  793. struct json_object *ChargingInfo3;
  794. struct json_object *CardNumber[3];
  795. struct json_object *StartUserId[3];
  796. struct json_object *StartDateTime[3];
  797. struct json_object *StopDateTime[3];
  798. struct json_object *StartMethod[3];
  799. struct json_object *ConnectorTemp[3];
  800. struct json_object *PresentChargingVoltage[3];
  801. struct json_object *PresentChargingCurrent[3];
  802. struct json_object *PresentChargingPower[3];
  803. struct json_object *PresentChargedEnergy[3];
  804. struct json_object *PresentChargedDuration[3];
  805. struct json_object *RemainChargingDuration[3];
  806. struct json_object *EvBatteryMaxVoltage[3];
  807. struct json_object *EvBatterytargetVoltage[3];
  808. struct json_object *EvBatterySoc[3];
  809. struct json_object *SystemStatus[3];
  810. struct json_object *Index[3];
  811. struct json_object *Type[3];
  812. struct json_object *type_index[3];
  813. struct json_object *EvBatterytargetCurrent[3];
  814. //network
  815. struct json_object *InternetConn;
  816. struct json_object *FtpServer;
  817. struct json_object *Eth0DhcpClient;
  818. struct json_object *Eth0MacAddress;
  819. struct json_object *Eth0IpAddress;
  820. struct json_object *Eth0SubmaskAddress;
  821. struct json_object *Eth0GatewayAddress;
  822. struct json_object *Eth1DhcpClient;
  823. struct json_object *Eth1MacAddress;
  824. struct json_object *Eth1IpAddress;
  825. struct json_object *Eth1SubmaskAddress;
  826. struct json_object *Eth1GatewayAddress;
  827. struct json_object *WifiMode;
  828. struct json_object *WifiSsid;
  829. struct json_object *WifiPassword;
  830. struct json_object *WifiRssi;
  831. struct json_object *WifiDhcpServer;
  832. struct json_object *WifiDhcpClient;
  833. struct json_object *WifiMacAddress;
  834. struct json_object *WifiIpAddress;
  835. struct json_object *WifiSubmaskAddress;
  836. struct json_object *WifiGatewayAddress;
  837. struct json_object *WifiNetworkConn;
  838. struct json_object *TelcomApn;
  839. struct json_object *TelcomRssi;
  840. struct json_object *TelcomChapPapId;
  841. struct json_object *TelcomChapPapPwd;
  842. struct json_object *TelcomModemImei;
  843. struct json_object *TelcomSimImsi;
  844. struct json_object *TelcomSimIccid;
  845. struct json_object *TelcomSimStatus;
  846. struct json_object *TelcomModemMode;
  847. struct json_object *TelcomIpAddress;
  848. struct json_object *TelcomNetworkConn;
  849. //backend
  850. struct json_object *BackendConnTimeout;
  851. struct json_object *OfflinePolicy;
  852. struct json_object *OfflineMaxChargeEnergy;
  853. struct json_object *OfflineMaxChargeDuration;
  854. struct json_object *OcppConnStatus;
  855. struct json_object *OcppServerURL;
  856. struct json_object *ChargeBoxId;
  857. // array_obj = json_object_new_array();
  858. jobj1=json_object_new_object();
  859. jobj2=json_object_new_object();
  860. jobj3=json_object_new_object();
  861. jobj4=json_object_new_object();
  862. //system
  863. ModelName = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ModelName);
  864. SerialNumber = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber);
  865. SystemId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SystemId);
  866. // SystemDateTime = json_object_new_string(ShmSysConfigAndInfo->SysConfig.SystemDateTime);
  867. AcPhaseCount = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPhaseCount);
  868. FactoryConfiguration = json_object_new_int(ShmSysConfigAndInfo->SysInfo.FactoryConfiguration);
  869. AuthorisationMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
  870. DefaultLanguage = json_object_new_int(ShmSysConfigAndInfo->SysConfig.DefaultLanguage);
  871. InputVoltageR = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageR);
  872. InputVoltageS = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageS);
  873. InputVoltageT = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageT);
  874. SystemFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
  875. PsuFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed);
  876. RfidCardNumEndian = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
  877. PsuAcInputType = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PsuAcInputType);
  878. AuxPower5V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower5V);
  879. AuxPower12V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower12V);
  880. AuxPower24V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower24V);
  881. AuxPower48V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower48V);
  882. CsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev);
  883. CsuBootLoadFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
  884. CsuKernelFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
  885. CsuRootFsFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
  886. CsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev);
  887. LcmHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev);
  888. LcmFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev);
  889. PsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev);
  890. PsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev);
  891. PsuSecFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev);
  892. AuxPwrHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev);
  893. AuxPwrFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev);
  894. FanModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev);
  895. FanModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev);
  896. RelayModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev);
  897. RelayModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev);
  898. TelcomModemFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev);
  899. SystemAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp);
  900. SystemCriticalTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp);
  901. CcsConnectorTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp);
  902. PsuAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp);
  903. AcPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPlugInTimes);
  904. GbPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.GbPlugInTimes);
  905. Ccs1PlugInTime = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime);
  906. Ccs2PlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes);
  907. ChademoPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes);
  908. FirmwareUpdate = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FirmwareUpdate);
  909. //charging
  910. int CcsGunQty=0;
  911. int GbGunQty=0;
  912. int CHAdeMOGunQty=0;
  913. int AcGunQty=0;
  914. ChargingInfo1=json_object_new_object();
  915. ChargingInfo2=json_object_new_object();
  916. ChargingInfo3=json_object_new_object();
  917. MaxChargingEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy);
  918. MaxChargingPower = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingPower);
  919. MaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
  920. MaxChargingDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingDuration);
  921. PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
  922. LocalWhiteCard[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]);
  923. LocalWhiteCard[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]);
  924. LocalWhiteCard[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]);
  925. LocalWhiteCard[3] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3]);
  926. LocalWhiteCard[4] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4]);
  927. LocalWhiteCard[5] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5]);
  928. LocalWhiteCard[6] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6]);
  929. LocalWhiteCard[7] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7]);
  930. LocalWhiteCard[8] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8]);
  931. LocalWhiteCard[9] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9]);
  932. UserId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.UserId);
  933. if(connectorType1 != 0){
  934. if(connectorType1 == 1){//CCS
  935. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  936. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  937. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  938. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  939. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  940. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  941. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  942. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  943. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  944. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  945. Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index);
  946. Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type);
  947. type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index);
  948. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  949. CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].CardNumber);
  950. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  951. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  952. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  953. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  954. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  955. CcsGunQty++;
  956. }
  957. else if(connectorType1 == 2){//GB
  958. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  959. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  960. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  961. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  962. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  963. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  964. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  965. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  966. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  967. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  968. Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index);
  969. Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type);
  970. type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index);
  971. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  972. CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].CardNumber);
  973. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  974. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  975. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  976. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  977. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  978. GbGunQty++;
  979. }
  980. else if(connectorType1 == 3){//CHAdeMO
  981. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  982. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  983. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  984. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  985. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  986. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  987. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  988. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  989. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  990. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  991. Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index);
  992. Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type);
  993. type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index);
  994. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  995. CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].CardNumber);
  996. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  997. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  998. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  999. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1000. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1001. CHAdeMOGunQty++;
  1002. }
  1003. else if(connectorType1 == 4){//AC
  1004. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1005. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1006. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1007. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1008. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1009. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1010. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1011. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1012. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1013. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1014. Index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
  1015. Type[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
  1016. type_index[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
  1017. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1018. CardNumber[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
  1019. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1020. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1021. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1022. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1023. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1024. AcGunQty++;
  1025. }
  1026. }
  1027. if(connectorType2 != 0){
  1028. if(connectorType2 == 1){//CCS
  1029. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1030. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1031. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1032. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1033. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1034. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1035. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1036. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1037. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1038. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1039. Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index);
  1040. Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type);
  1041. type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index);
  1042. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1043. CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].CardNumber);
  1044. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1045. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1046. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1047. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1048. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1049. CcsGunQty++;
  1050. }
  1051. else if(connectorType2 == 2){//GB
  1052. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1053. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1054. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1055. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1056. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1057. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1058. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1059. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1060. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  1061. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  1062. Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index);
  1063. Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type);
  1064. type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index);
  1065. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  1066. CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].CardNumber);
  1067. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  1068. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  1069. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  1070. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  1071. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  1072. GbGunQty++;
  1073. }
  1074. else if(connectorType2 == 3){//CHAdeMO
  1075. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  1076. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  1077. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  1078. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  1079. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  1080. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  1081. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  1082. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  1083. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  1084. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  1085. Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index);
  1086. Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type);
  1087. type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index);
  1088. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  1089. CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].CardNumber);
  1090. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  1091. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  1092. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  1093. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1094. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1095. CHAdeMOGunQty++;
  1096. }
  1097. else if(connectorType2 == 4){//AC
  1098. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1099. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1100. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1101. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1102. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1103. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1104. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1105. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1106. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1107. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1108. Index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
  1109. Type[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
  1110. type_index[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
  1111. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1112. CardNumber[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
  1113. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1114. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1115. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1116. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1117. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1118. AcGunQty++;
  1119. }
  1120. }
  1121. if(connectorType3 != 0){
  1122. if(connectorType3 == 1){//CCS
  1123. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1124. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1125. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1126. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1127. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1128. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1129. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1130. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1131. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1132. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1133. Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Index);
  1134. Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].Type);
  1135. type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].type_index);
  1136. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1137. CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].CardNumber);
  1138. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1139. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1140. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1141. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1142. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1143. CcsGunQty++;
  1144. }
  1145. else if(connectorType3 == 2){//GB
  1146. PresentChargingVoltage[2]= json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1147. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1148. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1149. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1150. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1151. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1152. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1153. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1154. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  1155. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  1156. Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Index);
  1157. Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].Type);
  1158. type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].type_index);
  1159. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  1160. CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].CardNumber);
  1161. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  1162. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  1163. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  1164. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  1165. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  1166. GbGunQty++;
  1167. }
  1168. else if(connectorType3 == 3){//CHAdeMO
  1169. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  1170. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  1171. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  1172. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  1173. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  1174. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  1175. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  1176. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  1177. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  1178. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  1179. Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Index);
  1180. Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].Type);
  1181. type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].type_index);
  1182. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  1183. CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].CardNumber);
  1184. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  1185. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  1186. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  1187. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1188. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1189. CHAdeMOGunQty++;
  1190. }
  1191. else if(connectorType3 == 4){//AC
  1192. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1193. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1194. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1195. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1196. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1197. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1198. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1199. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1200. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1201. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1202. Index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
  1203. Type[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
  1204. type_index[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
  1205. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1206. CardNumber[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
  1207. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1208. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1209. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1210. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1211. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1212. AcGunQty++;
  1213. }
  1214. }
  1215. //network
  1216. InternetConn = json_object_new_int(ShmSysConfigAndInfo->SysInfo.InternetConn);
  1217. FtpServer = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer);
  1218. Eth0DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient);
  1219. Eth0MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress);
  1220. Eth0IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
  1221. Eth0SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
  1222. Eth0GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
  1223. Eth1DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient);
  1224. Eth1MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress);
  1225. Eth1IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress);
  1226. Eth1SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress);
  1227. Eth1GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress);
  1228. WifiMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
  1229. WifiSsid = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
  1230. WifiPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
  1231. WifiRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi);
  1232. WifiDhcpServer = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer);
  1233. WifiDhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient);
  1234. WifiMacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress);
  1235. WifiIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress);
  1236. WifiSubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress);
  1237. WifiGatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress);
  1238. WifiNetworkConn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn);
  1239. TelcomApn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
  1240. TelcomRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi);
  1241. TelcomChapPapId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
  1242. TelcomChapPapPwd = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
  1243. TelcomModemImei = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei);
  1244. TelcomSimImsi = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi);
  1245. TelcomSimIccid = json_object_new_string(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
  1246. TelcomSimStatus = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus);
  1247. TelcomModemMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
  1248. TelcomIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress);
  1249. TelcomNetworkConn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn);
  1250. //backend
  1251. BackendConnTimeout = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BackendConnTimeout);
  1252. OfflinePolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
  1253. OfflineMaxChargeEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy);
  1254. OfflineMaxChargeDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration);
  1255. OcppConnStatus = json_object_new_string_len((char *)&ShmSysConfigAndInfo->SysInfo.OcppConnStatus,1);
  1256. OcppServerURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL);
  1257. ChargeBoxId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
  1258. //system
  1259. json_object_object_add(jobj1,"ModelName",ModelName);
  1260. json_object_object_add(jobj1,"SerialNumber",SerialNumber);
  1261. json_object_object_add(jobj1,"SystemId",SystemId);
  1262. // json_object_object_add(jobj1,"SystemDateTime",SystemDateTime);
  1263. json_object_object_add(jobj1,"AcPhaseCount",AcPhaseCount);
  1264. json_object_object_add(jobj1,"FactoryConfiguration",FactoryConfiguration);
  1265. json_object_object_add(jobj1,"AuthorisationMode",AuthorisationMode);
  1266. json_object_object_add(jobj1,"DefaultLanguage",DefaultLanguage);
  1267. json_object_object_add(jobj1,"InputVoltageR",InputVoltageR);
  1268. json_object_object_add(jobj1,"InputVoltageS",InputVoltageS);
  1269. json_object_object_add(jobj1,"InputVoltageT",InputVoltageT);
  1270. json_object_object_add(jobj1,"SystemFanRotaSpeed",SystemFanRotaSpeed);
  1271. json_object_object_add(jobj1,"PsuFanRotaSpeed",PsuFanRotaSpeed);
  1272. json_object_object_add(jobj1,"RfidCardNumEndian",RfidCardNumEndian);
  1273. json_object_object_add(jobj1,"PsuAcInputType",PsuAcInputType);
  1274. json_object_object_add(jobj1,"AuxPower5V",AuxPower5V);
  1275. json_object_object_add(jobj1,"AuxPower12V",AuxPower12V);
  1276. json_object_object_add(jobj1,"AuxPower24V",AuxPower24V);
  1277. json_object_object_add(jobj1,"AuxPower48V",AuxPower48V);
  1278. json_object_object_add(jobj1,"CsuHwRev",CsuHwRev);
  1279. json_object_object_add(jobj1,"CsuBootLoadFwRev",CsuBootLoadFwRev);
  1280. json_object_object_add(jobj1,"CsuKernelFwRev",CsuKernelFwRev);
  1281. json_object_object_add(jobj1,"CsuRootFsFwRev",CsuRootFsFwRev);
  1282. json_object_object_add(jobj1,"CsuPrimFwRev",CsuPrimFwRev);
  1283. json_object_object_add(jobj1,"LcmHwRev",LcmHwRev);
  1284. json_object_object_add(jobj1,"LcmFwRev",LcmFwRev);
  1285. json_object_object_add(jobj1,"PsuHwRev",PsuHwRev);
  1286. json_object_object_add(jobj1,"PsuPrimFwRev",PsuPrimFwRev);
  1287. json_object_object_add(jobj1,"PsuSecFwRev",PsuSecFwRev);
  1288. json_object_object_add(jobj1,"AuxPwrHwRev",AuxPwrHwRev);
  1289. json_object_object_add(jobj1,"AuxPwrFwRev",AuxPwrFwRev);
  1290. json_object_object_add(jobj1,"FanModuleHwRev",FanModuleHwRev);
  1291. json_object_object_add(jobj1,"FanModuleFwRev",FanModuleFwRev);
  1292. json_object_object_add(jobj1,"RelayModuleHwRev",RelayModuleHwRev);
  1293. json_object_object_add(jobj1,"RelayModuleFwRev",RelayModuleFwRev);
  1294. json_object_object_add(jobj1,"TelcomModemFwRev",TelcomModemFwRev);
  1295. json_object_object_add(jobj1,"SystemAmbientTemp",SystemAmbientTemp);
  1296. json_object_object_add(jobj1,"SystemCriticalTemp",SystemCriticalTemp);
  1297. json_object_object_add(jobj1,"CcsConnectorTemp",CcsConnectorTemp);
  1298. json_object_object_add(jobj1,"PsuAmbientTemp",PsuAmbientTemp);
  1299. json_object_object_add(jobj1,"AcPlugInTimes",AcPlugInTimes);
  1300. json_object_object_add(jobj1,"GbPlugInTimes",GbPlugInTimes);
  1301. json_object_object_add(jobj1,"Ccs1PlugInTimes",Ccs1PlugInTime);
  1302. json_object_object_add(jobj1,"Ccs2PlugInTimes",Ccs2PlugInTimes);
  1303. json_object_object_add(jobj1,"ChademoPlugInTimes",ChademoPlugInTimes);
  1304. json_object_object_add(jobj1,"FirmwareUpdate",FirmwareUpdate);
  1305. printf("%s\n", json_object_to_json_string(jobj1));
  1306. json_object_put(jobj1);
  1307. //charging
  1308. json_object_object_add(jobj2,"MaxChargingEnergy",MaxChargingEnergy);
  1309. json_object_object_add(jobj2,"MaxChargingPower",MaxChargingPower);
  1310. json_object_object_add(jobj2,"MaxChargingCurrent",MaxChargingCurrent);
  1311. json_object_object_add(jobj2,"MaxChargingDuration",MaxChargingDuration);
  1312. json_object_object_add(jobj2,"PhaseLossPolicy",PhaseLossPolicy);
  1313. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[0]);
  1314. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[1]);
  1315. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[2]);
  1316. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[3]);
  1317. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[4]);
  1318. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[5]);
  1319. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[6]);
  1320. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[7]);
  1321. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[8]);
  1322. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[9]);
  1323. json_object_object_add(jobj2,"LocalWhiteCard",LocalWhiteCardArr);
  1324. // json_object_object_add(jobj2,"CcsAuthentication",CcsAuthentication);
  1325. // json_object_object_add(jobj2,"AcCcsChargingMode",AcCcsChargingMode);
  1326. if(connectorType1 != 0){
  1327. json_object_object_add(ChargingInfo1,"CardNumber",CardNumber[0]);
  1328. json_object_object_add(ChargingInfo1,"StartUserId",StartUserId[0]);
  1329. json_object_object_add(ChargingInfo1,"StartDateTime",StartDateTime[0]);
  1330. json_object_object_add(ChargingInfo1,"StopDateTime",StopDateTime[0]);
  1331. json_object_object_add(ChargingInfo1,"StartMethod",StartMethod[0]);
  1332. json_object_object_add(ChargingInfo1,"ConnectorTemp",ConnectorTemp[0]);
  1333. json_object_object_add(ChargingInfo1,"PresentChargingVoltage",PresentChargingVoltage[0]);
  1334. json_object_object_add(ChargingInfo1,"PresentChargingCurrent",PresentChargingCurrent[0]);
  1335. json_object_object_add(ChargingInfo1,"PresentChargingPower",PresentChargingPower[0]);
  1336. json_object_object_add(ChargingInfo1,"PresentChargedEnergy",PresentChargedEnergy[0]);
  1337. json_object_object_add(ChargingInfo1,"PresentChargedDuration",PresentChargedDuration[0]);
  1338. json_object_object_add(ChargingInfo1,"RemainChargingDuration",RemainChargingDuration[0]);
  1339. json_object_object_add(ChargingInfo1,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[0]);
  1340. json_object_object_add(ChargingInfo1,"EvBatterytargetVoltage",EvBatterytargetVoltage[0]);
  1341. json_object_object_add(ChargingInfo1,"EvBatterySoc",EvBatterySoc[0]);
  1342. json_object_object_add(ChargingInfo1,"SystemStatus",SystemStatus[0]);
  1343. json_object_object_add(ChargingInfo1,"Index",Index[0]);
  1344. json_object_object_add(ChargingInfo1,"Type",Type[0]);
  1345. json_object_object_add(ChargingInfo1,"type_index",type_index[0]);
  1346. json_object_object_add(ChargingInfo1,"EvBatterytargetCurrent",EvBatterytargetCurrent[0]);
  1347. json_object_object_add(jobj2,"ChargingInfo1",ChargingInfo1);
  1348. }
  1349. if(connectorType2 != 0){
  1350. json_object_object_add(ChargingInfo2,"CardNumber",CardNumber[1]);
  1351. json_object_object_add(ChargingInfo2,"StartUserId",StartUserId[1]);
  1352. json_object_object_add(ChargingInfo2,"StartDateTime",StartDateTime[1]);
  1353. json_object_object_add(ChargingInfo2,"StopDateTime",StopDateTime[1]);
  1354. json_object_object_add(ChargingInfo2,"StartMethod",StartMethod[1]);
  1355. json_object_object_add(ChargingInfo2,"ConnectorTemp",ConnectorTemp[1]);
  1356. json_object_object_add(ChargingInfo2,"PresentChargingVoltage",PresentChargingVoltage[1]);
  1357. json_object_object_add(ChargingInfo2,"PresentChargingCurrent",PresentChargingCurrent[1]);
  1358. json_object_object_add(ChargingInfo2,"PresentChargingPower",PresentChargingPower[1]);
  1359. json_object_object_add(ChargingInfo2,"PresentChargedEnergy",PresentChargedEnergy[1]);
  1360. json_object_object_add(ChargingInfo2,"PresentChargedDuration",PresentChargedDuration[1]);
  1361. json_object_object_add(ChargingInfo2,"RemainChargingDuration",RemainChargingDuration[1]);
  1362. json_object_object_add(ChargingInfo2,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[1]);
  1363. json_object_object_add(ChargingInfo2,"EvBatterytargetVoltage",EvBatterytargetVoltage[1]);
  1364. json_object_object_add(ChargingInfo2,"EvBatterySoc",EvBatterySoc[1]);
  1365. json_object_object_add(ChargingInfo2,"SystemStatus",SystemStatus[1]);
  1366. json_object_object_add(ChargingInfo2,"Index",Index[1]);
  1367. json_object_object_add(ChargingInfo2,"Type",Type[1]);
  1368. json_object_object_add(ChargingInfo2,"type_index",type_index[1]);
  1369. json_object_object_add(ChargingInfo2,"EvBatterytargetCurrent",EvBatterytargetCurrent[1]);
  1370. json_object_object_add(jobj2,"ChargingInfo2",ChargingInfo2);
  1371. }
  1372. if(connectorType3 != 0){
  1373. json_object_object_add(ChargingInfo3,"CardNumber",CardNumber[2]);
  1374. json_object_object_add(ChargingInfo3,"StartUserId",StartUserId[2]);
  1375. json_object_object_add(ChargingInfo3,"StartDateTime",StartDateTime[2]);
  1376. json_object_object_add(ChargingInfo3,"StopDateTime",StopDateTime[2]);
  1377. json_object_object_add(ChargingInfo3,"StartMethod",StartMethod[2]);
  1378. json_object_object_add(ChargingInfo3,"ConnectorTemp",ConnectorTemp[2]);
  1379. json_object_object_add(ChargingInfo3,"PresentChargingVoltage",PresentChargingVoltage[2]);
  1380. json_object_object_add(ChargingInfo3,"PresentChargingCurrent",PresentChargingCurrent[2]);
  1381. json_object_object_add(ChargingInfo3,"PresentChargingPower",PresentChargingPower[2]);
  1382. json_object_object_add(ChargingInfo3,"PresentChargedEnergy",PresentChargedEnergy[2]);
  1383. json_object_object_add(ChargingInfo3,"PresentChargedDuration",PresentChargedDuration[2]);
  1384. json_object_object_add(ChargingInfo3,"RemainChargingDuration",RemainChargingDuration[2]);
  1385. json_object_object_add(ChargingInfo3,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[2]);
  1386. json_object_object_add(ChargingInfo3,"EvBatterytargetVoltage",EvBatterytargetVoltage[2]);
  1387. json_object_object_add(ChargingInfo3,"EvBatterySoc",EvBatterySoc[2]);
  1388. json_object_object_add(ChargingInfo3,"SystemStatus",SystemStatus[2]);
  1389. json_object_object_add(ChargingInfo3,"Index",Index[2]);
  1390. json_object_object_add(ChargingInfo3,"Type",Type[2]);
  1391. json_object_object_add(ChargingInfo3,"type_index",type_index[2]);
  1392. json_object_object_add(ChargingInfo3,"EvBatterytargetCurrent",EvBatterytargetCurrent[2]);
  1393. json_object_object_add(jobj2,"ChargingInfo3",ChargingInfo3);
  1394. }
  1395. printf("%s\n", json_object_to_json_string(jobj2));
  1396. json_object_put(jobj2);
  1397. //network
  1398. json_object_object_add(jobj3,"InternetConn",InternetConn);
  1399. json_object_object_add(jobj3,"FtpServer",FtpServer);
  1400. json_object_object_add(jobj3,"Eth0DhcpClient",Eth0DhcpClient);
  1401. json_object_object_add(jobj3,"Eth0MacAddress",Eth0MacAddress);
  1402. json_object_object_add(jobj3,"Eth0IpAddress",Eth0IpAddress);
  1403. json_object_object_add(jobj3,"Eth0SubmaskAddress",Eth0SubmaskAddress);
  1404. json_object_object_add(jobj3,"Eth0GatewayAddress",Eth0GatewayAddress);
  1405. json_object_object_add(jobj3,"Eth1DhcpClient",Eth1DhcpClient);
  1406. json_object_object_add(jobj3,"Eth1MacAddress",Eth1MacAddress);
  1407. json_object_object_add(jobj3,"Eth1IpAddress",Eth1IpAddress);
  1408. json_object_object_add(jobj3,"Eth1SubmaskAddress",Eth1SubmaskAddress);
  1409. json_object_object_add(jobj3,"Eth1GatewayAddress",Eth1GatewayAddress);
  1410. json_object_object_add(jobj3,"WifiMode",WifiMode);
  1411. json_object_object_add(jobj3,"WifiSsid",WifiSsid);
  1412. json_object_object_add(jobj3,"WifiPassword",WifiPassword);
  1413. json_object_object_add(jobj3,"WifiRssi",WifiRssi);
  1414. json_object_object_add(jobj3,"WifiDhcpServer",WifiDhcpServer);
  1415. json_object_object_add(jobj3,"WifiDhcpClient",WifiDhcpClient);
  1416. json_object_object_add(jobj3,"WifiMacAddress",WifiMacAddress);
  1417. json_object_object_add(jobj3,"WifiIpAddress",WifiIpAddress);
  1418. json_object_object_add(jobj3,"WifiSubmaskAddress",WifiSubmaskAddress);
  1419. json_object_object_add(jobj3,"WifiGatewayAddress",WifiGatewayAddress);
  1420. json_object_object_add(jobj3,"WifiNetworkConn",WifiNetworkConn);
  1421. json_object_object_add(jobj3,"TelcomApn",TelcomApn);
  1422. json_object_object_add(jobj3,"TelcomRssi",TelcomRssi);
  1423. json_object_object_add(jobj3,"TelcomChapPapId",TelcomChapPapId);
  1424. json_object_object_add(jobj3,"TelcomChapPapPwd",TelcomChapPapPwd);
  1425. json_object_object_add(jobj3,"TelcomModemImei",TelcomModemImei);
  1426. json_object_object_add(jobj3,"TelcomSimImsi",TelcomSimImsi);
  1427. json_object_object_add(jobj3,"TelcomSimIccid",TelcomSimIccid);
  1428. json_object_object_add(jobj3,"TelcomSimStatus",TelcomSimStatus);
  1429. json_object_object_add(jobj3,"TelcomModemMode",TelcomModemMode);
  1430. json_object_object_add(jobj3,"TelcomIpAddress",TelcomIpAddress);
  1431. json_object_object_add(jobj3,"TelcomNetworkConn",TelcomNetworkConn);
  1432. printf("%s\n", json_object_to_json_string(jobj3));
  1433. json_object_put(jobj3);
  1434. //backend
  1435. json_object_object_add(jobj4,"BackendConnTimeout",BackendConnTimeout);
  1436. json_object_object_add(jobj4,"OfflinePolicy",OfflinePolicy);
  1437. json_object_object_add(jobj4,"OfflineMaxChargeEnergy",OfflineMaxChargeEnergy);
  1438. json_object_object_add(jobj4,"OfflineMaxChargeDuration",OfflineMaxChargeDuration);
  1439. json_object_object_add(jobj4,"OcppConnStatus",OcppConnStatus);
  1440. json_object_object_add(jobj4,"OcppServerURL",OcppServerURL);
  1441. json_object_object_add(jobj4,"ChargeBoxId",ChargeBoxId);
  1442. printf("%s\n", json_object_to_json_string(jobj4));
  1443. json_object_put(jobj4);
  1444. }
  1445. // for(;;)
  1446. // {
  1447. // }
  1448. return FAIL;
  1449. }