WebService.c 129 KB

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