WebService.c 88 KB

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