WebService.c 131 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370
  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. char Wcnt=0;
  846. char Tcnt=0;
  847. if( json_object_object_get_ex(jobj, "Eth0DhcpClient", &val_obj) ) {
  848. Eth0DhcpClient = json_object_get_int(val_obj);
  849. ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=Eth0DhcpClient;
  850. }
  851. if( json_object_object_get_ex(jobj, "Eth0IpAddress", &val_obj) ) {
  852. Eth0IpAddress = (char*)json_object_get_string(val_obj);
  853. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,Eth0IpAddress);
  854. }
  855. if( json_object_object_get_ex(jobj, "Eth0SubmaskAddress", &val_obj) ) {
  856. Eth0SubmaskAddress = (char*)json_object_get_string(val_obj);
  857. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,Eth0SubmaskAddress);
  858. }
  859. if( json_object_object_get_ex(jobj, "Eth0GatewayAddress", &val_obj) ) {
  860. Eth0GatewayAddress = (char*)json_object_get_string(val_obj);
  861. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,Eth0GatewayAddress);
  862. }
  863. if( json_object_object_get_ex(jobj, "WifiMode", &val_obj) ) {
  864. WifiMode = json_object_get_int(val_obj);
  865. if(WifiMode!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode) Wcnt++;
  866. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=WifiMode;
  867. }
  868. if( json_object_object_get_ex(jobj, "WifiSsid", &val_obj) ) {
  869. WifiSsid = (char*)json_object_get_string(val_obj);
  870. if (strcmp(WifiSsid, ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid) != 0) Wcnt++;
  871. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,WifiSsid);
  872. }
  873. if( json_object_object_get_ex(jobj, "WifiPassword", &val_obj) ) {
  874. WifiPassword = (char*)json_object_get_string(val_obj);
  875. if (strcmp(WifiSsid, ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid) != 0) Wcnt++;
  876. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,WifiPassword);
  877. }
  878. if( json_object_object_get_ex(jobj, "WifiDhcpServer", &val_obj) ) {
  879. WifiDhcpServer = json_object_get_int(val_obj);
  880. if(WifiDhcpServer!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer) Wcnt++;
  881. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=WifiDhcpServer;
  882. }
  883. if( json_object_object_get_ex(jobj, "WifiDhcpClient", &val_obj) ) {
  884. WifiDhcpClient = json_object_get_int(val_obj);
  885. if(WifiDhcpClient!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient) Wcnt++;
  886. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=WifiDhcpClient;
  887. }
  888. if( json_object_object_get_ex(jobj, "WifiIpAddress", &val_obj) ) {
  889. WifiIpAddress = (char*)json_object_get_string(val_obj);
  890. if (strcmp(WifiIpAddress, ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress) != 0) Wcnt++;
  891. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,WifiIpAddress);
  892. }
  893. if( json_object_object_get_ex(jobj, "WifiSubmaskAddress", &val_obj) ) {
  894. WifiSubmaskAddress = (char*)json_object_get_string(val_obj);
  895. if (strcmp(WifiSubmaskAddress, ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress) != 0) Wcnt++;
  896. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,WifiSubmaskAddress);
  897. }
  898. if( json_object_object_get_ex(jobj, "WifiGatewayAddress", &val_obj) ) {
  899. WifiGatewayAddress = (char*)json_object_get_string(val_obj);
  900. if (strcmp(WifiGatewayAddress, ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress) != 0) Wcnt++;
  901. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,WifiGatewayAddress);
  902. }
  903. if( json_object_object_get_ex(jobj, "TelcomApn", &val_obj) ) {
  904. TelcomApn = (char*)json_object_get_string(val_obj);
  905. if (strcmp(TelcomApn, ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn) != 0) Tcnt++;
  906. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,TelcomApn);
  907. }
  908. if( json_object_object_get_ex(jobj, "TelcomChapPapId", &val_obj) ) {
  909. TelcomChapPapId = (char*)json_object_get_string(val_obj);
  910. if (strcmp(TelcomChapPapId, ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId) != 0) Tcnt++;
  911. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,TelcomChapPapId);
  912. }
  913. if( json_object_object_get_ex(jobj, "TelcomChapPapPwd", &val_obj) ) {
  914. TelcomChapPapPwd = (char*)json_object_get_string(val_obj);
  915. if (strcmp(TelcomChapPapPwd, ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd) != 0) Tcnt++;
  916. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,TelcomChapPapPwd);
  917. }
  918. if( json_object_object_get_ex(jobj, "TelcomIpAddress", &val_obj) ) {
  919. TelcomIpAddress = (char*)json_object_get_string(val_obj);
  920. if (strcmp(TelcomIpAddress, ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress) != 0) Tcnt++;
  921. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,TelcomIpAddress);
  922. }
  923. if( json_object_object_get_ex(jobj, "TelcomEnabled", &val_obj) ) {
  924. TelcomEnabled = json_object_get_int(val_obj);
  925. if(TelcomEnabled!=ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled) Tcnt++;
  926. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled=TelcomEnabled;
  927. }
  928. if(Wcnt>0){
  929. system ("pkill Module_Wifi");
  930. }
  931. if(Tcnt>0){
  932. system ("pkill Module_4g");
  933. }
  934. }
  935. if (strcmp(argv[1], "4") == 0) {
  936. struct json_object *jobj = json_tokener_parse(argv[2]);
  937. json_object *val_obj = NULL;
  938. int BackendConnTimeout=0;
  939. int OfflinePolicy=0;
  940. int OfflineMaxChargeEnergy=0;
  941. int OfflineMaxChargeDuration=0;
  942. char *OcppServerURL=NULL;
  943. char *ChargeBoxId=NULL;
  944. char *chargePointVendor=NULL;
  945. if( json_object_object_get_ex(jobj, "BackendConnTimeout", &val_obj) ) {
  946. BackendConnTimeout = json_object_get_int(val_obj);
  947. ShmSysConfigAndInfo->SysConfig.BackendConnTimeout = BackendConnTimeout;
  948. }
  949. if( json_object_object_get_ex(jobj, "OfflinePolicy", &val_obj) ) {
  950. OfflinePolicy = json_object_get_int(val_obj);
  951. ShmSysConfigAndInfo->SysConfig.OfflinePolicy = OfflinePolicy;
  952. }
  953. if( json_object_object_get_ex(jobj, "OfflineMaxChargeEnergy", &val_obj) ) {
  954. OfflineMaxChargeEnergy = json_object_get_int(val_obj);
  955. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy = OfflineMaxChargeEnergy;
  956. }
  957. if( json_object_object_get_ex(jobj, "OfflineMaxChargeDuration", &val_obj) ) {
  958. OfflineMaxChargeDuration = json_object_get_int(val_obj);
  959. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration = OfflineMaxChargeDuration;
  960. }
  961. if( json_object_object_get_ex(jobj, "OcppServerURL", &val_obj) ) {
  962. OcppServerURL = (char*)json_object_get_string(val_obj);
  963. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,OcppServerURL);
  964. }
  965. if( json_object_object_get_ex(jobj, "ChargeBoxId", &val_obj) ) {
  966. ChargeBoxId = (char*)json_object_get_string(val_obj);
  967. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,ChargeBoxId);
  968. }
  969. if( json_object_object_get_ex(jobj, "chargePointVendor", &val_obj) ) {
  970. chargePointVendor = (char*)json_object_get_string(val_obj);
  971. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor,chargePointVendor);
  972. }
  973. }
  974. struct SysConfigData SysConfig;
  975. memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
  976. int result = StoreUsrConfigData(&SysConfig);
  977. if(result != 1){
  978. #ifdef SystemLogMessage
  979. StoreLogMsg("[WebService]StoreUsrConfigData: normal NG");
  980. #endif
  981. }
  982. else{
  983. #ifdef SystemLogMessage
  984. StoreLogMsg("[WebService]StoreUsrConfigData: normal OK");
  985. #endif
  986. }
  987. #ifdef SystemLogMessage
  988. DEBUG_INFO("WebServiceConfig update OK");
  989. #endif
  990. }
  991. if (argc == 2) { //init share memory for test
  992. if (strcmp(argv[1], "aaa") == 0) {
  993. //struct SysConfigData SysConfig;
  994. //system
  995. ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity=1;
  996. ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=1;
  997. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ModelName, "DO0E362001D1P0D");
  998. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber, "SerialNumber");
  999. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
  1000. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
  1001. ShmSysConfigAndInfo->SysConfig.AcPhaseCount=1;
  1002. ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
  1003. ShmSysConfigAndInfo->SysInfo.FactoryConfiguration=0;
  1004. ShmSysConfigAndInfo->SysConfig.AuthorisationMode=0;
  1005. ShmSysConfigAndInfo->SysConfig.DefaultLanguage=0;
  1006. ShmSysConfigAndInfo->SysInfo.InputVoltageR=0;
  1007. ShmSysConfigAndInfo->SysInfo.InputVoltageS=0;
  1008. ShmSysConfigAndInfo->SysInfo.InputVoltageT=0;
  1009. ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed=0;
  1010. ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0;
  1011. ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian=0;
  1012. ShmSysConfigAndInfo->SysConfig.RatingCurrent=100;
  1013. ShmSysConfigAndInfo->SysConfig.PsuAcInputType=0;
  1014. ShmSysConfigAndInfo->SysInfo.AuxPower5V=0;
  1015. ShmSysConfigAndInfo->SysInfo.AuxPower12V=0;
  1016. ShmSysConfigAndInfo->SysInfo.AuxPower24V=0;
  1017. ShmSysConfigAndInfo->SysInfo.AuxPower48V=0;
  1018. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev, "");
  1019. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, "");
  1020. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "");
  1021. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "");
  1022. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, "");
  1023. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev, "");
  1024. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev, "");
  1025. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev, "");
  1026. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev, "");
  1027. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev, "");
  1028. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev, "");
  1029. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev, "");
  1030. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev, "");
  1031. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, "");
  1032. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev, "");
  1033. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, "");
  1034. strcpy((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev, "");
  1035. ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp=0;
  1036. ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp=0;
  1037. ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp=0;
  1038. ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp=0;
  1039. ShmSysConfigAndInfo->SysConfig.AcPlugInTimes=0;
  1040. ShmSysConfigAndInfo->SysConfig.GbPlugInTimes=0;
  1041. ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime=0;
  1042. ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes=0;
  1043. ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes=0;
  1044. // strcpy((char *)&ShmPsuData->PsuVersion[0].FwPrimaryVersion, "DC 9.01");
  1045. // strcpy((char *)&ShmPsuData->PsuVersion[1].FwPrimaryVersion, "DC 9.02");
  1046. // strcpy((char *)&ShmPsuData->PsuVersion[0].FwSecondVersion, "PFC 9.02");
  1047. // strcpy((char *)&ShmPsuData->PsuVersion[1].FwSecondVersion, "PFC 9.03");
  1048. //charging
  1049. ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy=0;
  1050. ShmSysConfigAndInfo->SysConfig.MaxChargingPower=0;
  1051. ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0;
  1052. ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent= 0;
  1053. ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0;
  1054. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111");
  1055. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222");
  1056. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333");
  1057. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3], "444");
  1058. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4], "555");
  1059. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5], "666");
  1060. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6], "777");
  1061. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7], "888");
  1062. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8], "999");
  1063. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9], "aaa");
  1064. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.UserId, "UserId");
  1065. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage=0;
  1066. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent=0;
  1067. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingPower=0;
  1068. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedEnergy=0;
  1069. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedDuration=0;
  1070. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].RemainChargingDuration=0;
  1071. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatteryMaxVoltage=0;
  1072. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetVoltage=0;
  1073. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterySoc=0;
  1074. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus=1;
  1075. ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetCurrent=1;
  1076. //network
  1077. ShmSysConfigAndInfo->SysInfo.InternetConn=0;
  1078. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,"");
  1079. ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=1;
  1080. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress,"");
  1081. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,"192.168.1.10");
  1082. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,"255.255.255.0");
  1083. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,"192.168.1.1");
  1084. ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=1;
  1085. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress,"");
  1086. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,"192.168.0.10");
  1087. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,"255.255.255.0");
  1088. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,"192.168.0.1");
  1089. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=1;
  1090. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,"");
  1091. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,"");
  1092. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi=0;
  1093. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=0;
  1094. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=0;
  1095. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress,"");
  1096. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,"");
  1097. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,"");
  1098. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,"");
  1099. ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn=1;
  1100. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,"");
  1101. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi=0;
  1102. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,"");
  1103. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,"");
  1104. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei,"");
  1105. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi,"");
  1106. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid,"");
  1107. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus=0;
  1108. ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode=0;
  1109. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,"");
  1110. //backend
  1111. ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=300;
  1112. ShmSysConfigAndInfo->SysConfig.OfflinePolicy=0;
  1113. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy=0;
  1114. ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration=0;
  1115. ShmSysConfigAndInfo->SysInfo.OcppConnStatus=0;
  1116. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"");
  1117. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"");
  1118. strcpy((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor,"Phihong");
  1119. ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=0;
  1120. struct SysConfigData SysConfig;
  1121. memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
  1122. StoreUsrConfigData(&SysConfig);
  1123. // struct PsuModuleVer PsuData;
  1124. // memcpy(&PsuData, &ShmPsuData->PsuVersion, sizeof(struct PsuModuleVer));
  1125. // StoreUsrConfigData(&PsuData);
  1126. #ifdef SystemLogMessage
  1127. DEBUG_INFO("WebService initial OK");
  1128. #endif
  1129. }
  1130. if (strcmp(argv[1], "log") == 0) {
  1131. unsigned char ModelName[64];;
  1132. unsigned char SerialNo[64];;
  1133. memcpy(ModelName,ShmSysConfigAndInfo->SysConfig.ModelName,ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
  1134. printf("%s", ModelName);
  1135. memcpy(SerialNo,ShmSysConfigAndInfo->SysConfig.SerialNumber,ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
  1136. printf("%s", SerialNo);
  1137. time_t tt = time(0); //獲取當前時間
  1138. int year,month;
  1139. char cmd[512];
  1140. struct tm *pst = localtime(&tt); //把time_t類型轉換為struct tm類型
  1141. year = pst->tm_year + 1900;
  1142. month = pst->tm_mon + 1;
  1143. // sprintf(cmd,"cp /mnt/*%s*%s*.zip /var/www/log.zip",ModelName,SerialNo);
  1144. if(system("exec /root/logPackTools 'log'")==0){
  1145. system(cmd);
  1146. }
  1147. }
  1148. if (strcmp(argv[1], "button") == 0) {
  1149. unsigned char Button1;
  1150. unsigned char Button2;
  1151. unsigned char EmergencyButton;
  1152. Button1=ShmPrimaryMcuData->InputDet.bits.Button1;
  1153. Button2=ShmPrimaryMcuData->InputDet.bits.Button2;
  1154. EmergencyButton=ShmPrimaryMcuData->InputDet.bits.EmergencyButton;
  1155. struct json_object *jobj;
  1156. struct json_object *sButton1;
  1157. struct json_object *sButton2;
  1158. struct json_object *sEmergencyButton;
  1159. sButton1 = json_object_new_int(Button1);
  1160. sButton2 = json_object_new_int(Button2);
  1161. sEmergencyButton = json_object_new_int(EmergencyButton);
  1162. jobj=json_object_new_object();
  1163. json_object_object_add(jobj,"Button1",sButton1);
  1164. json_object_object_add(jobj,"Button2",sButton2);
  1165. json_object_object_add(jobj,"EmergencyButton",sEmergencyButton);
  1166. printf("%s\n", json_object_to_json_string(jobj));
  1167. }
  1168. if (strcmp(argv[1], "restart") == 0) {
  1169. system("exec /usr/bin/run_evse_restart.sh");
  1170. }
  1171. }
  1172. //upgrade firmware
  1173. if ((argc == 3) & (strcmp(argv[1], "upgrade") == 0)) {
  1174. struct json_object *jobj;
  1175. struct json_object *Result;
  1176. struct json_object *Message;
  1177. //char cmd[100];
  1178. jobj=json_object_new_object();
  1179. //system
  1180. //if((char)ShmSysConfigAndInfo->SysInfo.FirmwareUpdate == '0'){
  1181. ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=1;
  1182. Result = json_object_new_string("success");
  1183. Message = json_object_new_string("File is uploaded, please wait a moment to upgrade");
  1184. //}
  1185. /*else{
  1186. sprintf(cmd,"rm /mnt/%s",argv[2]);
  1187. system(cmd);
  1188. Result = json_object_new_string("error");
  1189. Message = json_object_new_string("machine is busy");
  1190. }*/
  1191. json_object_object_add(jobj,"Result",Result);
  1192. json_object_object_add(jobj,"Message",Message);
  1193. printf("%s\n", json_object_to_json_string(jobj));
  1194. }
  1195. //web page query all
  1196. if ((argc == 2) & (strcmp(argv[1], "query") == 0)) {
  1197. char *IsAcDc[2];
  1198. char *IsDO[3];
  1199. char *Connector1[2];
  1200. char *Connector2[2];
  1201. char *Connector3[2];
  1202. char *Network[2];
  1203. unsigned char connector1FwVer[32];
  1204. unsigned char connector2FwVer[32];
  1205. short gunQty;
  1206. char *RatedPower1[2];
  1207. char *RatedPower2[2];
  1208. char *RatedPower3[2];
  1209. short RatedPower;
  1210. short PsuQuantity = 0;
  1211. substr((char *)IsAcDc,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,1);
  1212. substr((char *)IsDO,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,2);
  1213. substr((char *)Connector1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,7,1);
  1214. substr((char *)Connector2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,9,1);
  1215. substr((char *)Connector3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,8,1);
  1216. substr((char *)Network,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,10,1);
  1217. int connectorType1,connectorType2,connectorType3;
  1218. connectorType1=ConnectorType((char *)Connector1);
  1219. connectorType2=ConnectorType((char *)Connector2);
  1220. connectorType3=ConnectorType((char *)Connector3);
  1221. if(connectorType1 == connectorType2){
  1222. gunQty = 1;
  1223. }
  1224. else{
  1225. gunQty = 0;
  1226. }
  1227. if(connectorType1 != 0){
  1228. if(connectorType1 == 1){
  1229. // strcpy((char *)&connector1FwVer,ShmCcsData->V2GMessage_DIN70121->version);
  1230. // memcpy(connector1FwVer,ShmCcsData->V2GMessage_DIN70121->version,ARRAY_SIZE(ShmCcsData->V2GMessage_DIN70121->version));
  1231. }
  1232. else if(connectorType1 == 2){
  1233. // strcpy((char *)&connector1FwVer,ShmGBTData->evse[0].version);
  1234. // memcpy(connector1FwVer,ShmGBTData->evse[0].version,ARRAY_SIZE(ShmGBTData->evse[0].version));
  1235. }
  1236. else if(connectorType1 == 3){
  1237. // strcpy((char *)&connector1FwVer,ShmCHAdeMOData->evse[0].version);
  1238. // memcpy(connector1FwVer,ShmCHAdeMOData->evse[0].version,ARRAY_SIZE(ShmCHAdeMOData->evse[0].version));
  1239. }
  1240. }
  1241. if(connectorType2 != 0){
  1242. if(connectorType2 == 1){
  1243. // strcpy((char *)&connector2FwVer,ShmCcsData->V2GMessage_DIN70121->version);
  1244. // memcpy(connector2FwVer,ShmCcsData->V2GMessage_DIN70121->version,ARRAY_SIZE(ShmCcsData->V2GMessage_DIN70121->version));
  1245. }
  1246. else if(connectorType2 == 2){
  1247. // strcpy((char *)&connector2FwVer,ShmGBTData->evse[gunQty].version);
  1248. // memcpy(connector2FwVer,ShmGBTData->evse[gunQty].version,ARRAY_SIZE(ShmGBTData->evse[gunQty].version));
  1249. }
  1250. else if(connectorType2 == 3){
  1251. // strcpy((char *)&connector2FwVer,ShmCHAdeMOData->evse[gunQty].version);
  1252. // memcpy(connector2FwVer,ShmCHAdeMOData->evse[gunQty].version,ARRAY_SIZE(ShmCHAdeMOData->evse[gunQty].version));
  1253. }
  1254. }
  1255. substr((char *)RatedPower1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,4,1);
  1256. substr((char *)RatedPower2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,5,1);
  1257. substr((char *)RatedPower3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,6,1);
  1258. int p1=atoi(RatedPower1);
  1259. int p2=atoi(RatedPower2);
  1260. int p3=atoi(RatedPower3);
  1261. if(strcmp(IsAcDc, "D") == 0){
  1262. RatedPower=(p1*10+p2)*pow(10,p3-1);
  1263. if(RatedPower>=30){
  1264. PsuQuantity = RatedPower/30;
  1265. }
  1266. }
  1267. if(strcmp(IsDO, "DO") == 0){
  1268. }
  1269. struct json_object *jobj1;
  1270. struct json_object *jobj2;
  1271. struct json_object *jobj3;
  1272. struct json_object *jobj4;
  1273. //system
  1274. struct json_object *ModelName;
  1275. struct json_object *AcModelName;
  1276. struct json_object *SerialNumber;
  1277. struct json_object *SystemId;
  1278. struct json_object *AcPhaseCount;
  1279. struct json_object *PhaseLossPolicy;
  1280. struct json_object *FactoryConfiguration;
  1281. struct json_object *AuthorisationMode;
  1282. struct json_object *DefaultLanguage;
  1283. struct json_object *InputVoltageR;
  1284. struct json_object *InputVoltageS;
  1285. struct json_object *InputVoltageT;
  1286. struct json_object *SystemFanRotaSpeed;
  1287. struct json_object *PsuFanRotaSpeed;
  1288. struct json_object *RfidCardNumEndian;
  1289. struct json_object *PsuAcInputType;
  1290. struct json_object *RatingCurrent;
  1291. struct json_object *AcRatingCurrent;
  1292. struct json_object *isAPP;
  1293. struct json_object *isQRCode;
  1294. struct json_object *isRFID;
  1295. struct json_object *QRCodeMadeMode;
  1296. struct json_object *QRCodeContent;
  1297. struct json_object *Intensity;
  1298. struct json_object *AuxPower5V;
  1299. struct json_object *AuxPower12V;
  1300. struct json_object *AuxPower24V;
  1301. struct json_object *AuxPower48V;
  1302. struct json_object *CsuHwRev;
  1303. struct json_object *CsuBootLoadFwRev;
  1304. struct json_object *CsuKernelFwRev;
  1305. struct json_object *CsuRootFsFwRev;
  1306. struct json_object *CsuPrimFwRev;
  1307. struct json_object *LcmHwRev;
  1308. struct json_object *LcmFwRev;
  1309. struct json_object *PsuHwRev;
  1310. struct json_object *PsuPrimFwRev;
  1311. struct json_object *PsuSecFwRev;
  1312. struct json_object *AuxPwrHwRev;
  1313. struct json_object *AuxPwrFwRev;
  1314. struct json_object *FanModuleHwRev;
  1315. struct json_object *FanModuleFwRev;
  1316. struct json_object *RelayModuleHwRev;
  1317. struct json_object *RelayModuleFwRev;
  1318. struct json_object *TelcomModemFwRev;
  1319. struct json_object *Connector1FwRev;
  1320. struct json_object *Connector2FwRev;
  1321. struct json_object *LedModuleFwRev;
  1322. struct json_object *SystemAmbientTemp;
  1323. struct json_object *SystemCriticalTemp;
  1324. struct json_object *CcsConnectorTemp;
  1325. struct json_object *PsuAmbientTemp;
  1326. struct json_object *AcPlugInTimes;
  1327. struct json_object *GbPlugInTimes;
  1328. struct json_object *Ccs1PlugInTime;
  1329. struct json_object *Ccs2PlugInTimes;
  1330. struct json_object *ChademoPlugInTimes;
  1331. struct json_object *FirmwareUpdate;
  1332. struct json_object *FwPrimaryVersion[PsuQuantity];
  1333. struct json_object *FwPrimaryVersionArr= json_object_new_array();
  1334. struct json_object *FwSecondVersion[PsuQuantity];
  1335. struct json_object *FwSecondVersionArr= json_object_new_array();
  1336. /* for DO & DD*/
  1337. struct json_object *DispenserQuantity;
  1338. struct json_object *TotalConnectorQuantity;
  1339. struct json_object *DDModelName[4];
  1340. struct json_object *DDModelNameArr= json_object_new_array();
  1341. struct json_object *DDSerialNumber[4];
  1342. struct json_object *DDSerialNumberArr= json_object_new_array();
  1343. struct json_object *DDSystemId[4];
  1344. struct json_object *DDSystemIdArr= json_object_new_array();
  1345. struct json_object *DDAuthorisationMode[4];
  1346. struct json_object *DDAuthorisationModeArr= json_object_new_array();
  1347. struct json_object *DDRfidCardNumEndian[4];
  1348. struct json_object *DDRfidCardNumEndianArr= json_object_new_array();
  1349. struct json_object *DDisAPP[4];
  1350. struct json_object *DDisAPPArr= json_object_new_array();
  1351. struct json_object *DDisQRCode[4];
  1352. struct json_object *DDisQRCodeArr= json_object_new_array();
  1353. struct json_object *DDisRFID[4];
  1354. struct json_object *DDisRFIDArr= json_object_new_array();
  1355. struct json_object *DDQRCodeMadeMode[4];
  1356. struct json_object *DDQRCodeMadeModeArr= json_object_new_array();
  1357. struct json_object *DDQRCodeContent[4];
  1358. struct json_object *DDQRCodeContentArr= json_object_new_array();
  1359. struct json_object *DDFactoryConfiguration[4];
  1360. struct json_object *DDFactoryConfigurationArr= json_object_new_array();
  1361. struct json_object *DDCsuBootLoadFwRev[4];
  1362. struct json_object *DDCsuBootLoadFwRevArr= json_object_new_array();
  1363. struct json_object *DDCsuKernelFwRev[4];
  1364. struct json_object *DDCsuKernelFwRevArr= json_object_new_array();
  1365. struct json_object *DDCsuRootFsFwRev[4];
  1366. struct json_object *DDCsuRootFsFwRevArr= json_object_new_array();
  1367. struct json_object *DDCsuPrimFwRev[4];
  1368. struct json_object *DDCsuPrimFwRevArr= json_object_new_array();
  1369. struct json_object *DDLcmFwRev[4];
  1370. struct json_object *DDLcmFwRevArr= json_object_new_array();
  1371. struct json_object *DDPsuPrimFwRev[4];
  1372. struct json_object *DDPsuPrimFwRevArr= json_object_new_array();
  1373. struct json_object *DDPsuSecFwRev[4];
  1374. struct json_object *DDPsuSecFwRevArr= json_object_new_array();
  1375. struct json_object *DDFanModuleFwRev[4];
  1376. struct json_object *DDFanModuleFwRevArr= json_object_new_array();
  1377. struct json_object *DDRelayModuleFwRev[4];
  1378. struct json_object *DDRelayModuleFwRevArr= json_object_new_array();
  1379. struct json_object *DDTelcomModemFwRev[4];
  1380. struct json_object *DDTelcomModemFwRevArr= json_object_new_array();
  1381. struct json_object *DDLedModuleFwRev[4];
  1382. struct json_object *DDLedModuleFwRevArr= json_object_new_array();
  1383. struct json_object *DDConnector1FwRev[4];
  1384. struct json_object *DDConnector1FwRevArr= json_object_new_array();
  1385. struct json_object *DDConnector2FwRev[4];
  1386. struct json_object *DDConnector2FwRevArr= json_object_new_array();
  1387. struct json_object *DDIntensity[4];
  1388. struct json_object *DDIntensityArr= json_object_new_array();
  1389. //charging
  1390. struct json_object *MaxChargingEnergy;
  1391. struct json_object *MaxChargingPower;
  1392. struct json_object *MaxChargingCurrent;
  1393. struct json_object *AcMaxChargingCurrent;
  1394. struct json_object *MaxChargingDuration;
  1395. struct json_object *LocalWhiteCard[10];
  1396. struct json_object *LocalWhiteCardArr= json_object_new_array();
  1397. struct json_object *isBilling;
  1398. struct json_object *Currency;
  1399. struct json_object *Fee[24];
  1400. struct json_object *FeeArr= json_object_new_array();
  1401. struct json_object *ChargingInfo1;
  1402. struct json_object *ChargingInfo2;
  1403. struct json_object *ChargingInfo3;
  1404. struct json_object *StartUserId[3];
  1405. struct json_object *StartDateTime[3];
  1406. struct json_object *StopDateTime[3];
  1407. struct json_object *StartMethod[3];
  1408. struct json_object *ConnectorTemp[3];
  1409. struct json_object *PresentChargingVoltage[3];
  1410. struct json_object *PresentChargingCurrent[3];
  1411. struct json_object *PresentChargingPower[3];
  1412. struct json_object *PresentChargedEnergy[3];
  1413. struct json_object *PresentChargedDuration[3];
  1414. struct json_object *RemainChargingDuration[3];
  1415. struct json_object *EvBatteryMaxVoltage[3];
  1416. struct json_object *EvBatterytargetVoltage[3];
  1417. struct json_object *EvBatterySoc[3];
  1418. struct json_object *SystemStatus[3];
  1419. struct json_object *EvBatterytargetCurrent[3];
  1420. /* for DO & DD*/
  1421. struct json_object *DDChargingInfo1;
  1422. struct json_object *DDChargingInfo2;
  1423. struct json_object *DDChargingInfo3;
  1424. struct json_object *DDChargingInfo4;
  1425. struct json_object *DDStartUserId[4];
  1426. struct json_object *DDStartDateTime[4];
  1427. struct json_object *DDStopDateTime[4];
  1428. struct json_object *DDStartMethod[4];
  1429. struct json_object *DDConnectorTemp[4];
  1430. struct json_object *DDPresentChargingVoltage[4];
  1431. struct json_object *DDPresentChargingCurrent[4];
  1432. struct json_object *DDPresentChargingPower[4];
  1433. struct json_object *DDPresentChargedEnergy[4];
  1434. struct json_object *DDPresentChargedDuration[4];
  1435. struct json_object *DDRemainChargingDuration[4];
  1436. struct json_object *DDEvBatteryMaxVoltage[4];
  1437. struct json_object *DDEvBatterytargetVoltage[4];
  1438. struct json_object *DDEvBatterySoc[4];
  1439. struct json_object *DDSystemStatus[4];
  1440. struct json_object *DDEvBatterytargetCurrent[4];
  1441. //network
  1442. struct json_object *InternetConn;
  1443. struct json_object *FtpServer;
  1444. struct json_object *Eth0DhcpClient;
  1445. struct json_object *Eth0MacAddress;
  1446. struct json_object *Eth0IpAddress;
  1447. struct json_object *Eth0SubmaskAddress;
  1448. struct json_object *Eth0GatewayAddress;
  1449. struct json_object *Eth1DhcpClient;
  1450. struct json_object *Eth1MacAddress;
  1451. struct json_object *Eth1IpAddress;
  1452. struct json_object *Eth1SubmaskAddress;
  1453. struct json_object *Eth1GatewayAddress;
  1454. struct json_object *WifiMode;
  1455. struct json_object *WifiSsid;
  1456. struct json_object *WifiPassword;
  1457. struct json_object *WifiRssi;
  1458. struct json_object *WifiDhcpServer;
  1459. struct json_object *WifiDhcpClient;
  1460. struct json_object *WifiMacAddress;
  1461. struct json_object *WifiIpAddress;
  1462. struct json_object *WifiSubmaskAddress;
  1463. struct json_object *WifiGatewayAddress;
  1464. struct json_object *WifiNetworkConn;
  1465. struct json_object *TelcomApn;
  1466. struct json_object *TelcomRssi;
  1467. struct json_object *TelcomChapPapId;
  1468. struct json_object *TelcomChapPapPwd;
  1469. struct json_object *TelcomModemImei;
  1470. struct json_object *TelcomSimImsi;
  1471. struct json_object *TelcomSimIccid;
  1472. struct json_object *TelcomSimStatus;
  1473. struct json_object *TelcomModemMode;
  1474. struct json_object *TelcomIpAddress;
  1475. struct json_object *TelcomNetworkConn;
  1476. struct json_object *TelcomEnabled;
  1477. //backend
  1478. struct json_object *BackendConnTimeout;
  1479. struct json_object *OfflinePolicy;
  1480. struct json_object *OfflineMaxChargeEnergy;
  1481. struct json_object *OfflineMaxChargeDuration;
  1482. struct json_object *OcppConnStatus;
  1483. struct json_object *OcppServerURL;
  1484. struct json_object *ChargeBoxId;
  1485. struct json_object *chargePointVendor;
  1486. jobj1=json_object_new_object();
  1487. jobj2=json_object_new_object();
  1488. jobj3=json_object_new_object();
  1489. jobj4=json_object_new_object();
  1490. //system
  1491. ModelName = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ModelName);
  1492. AcModelName = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AcModelName);
  1493. SerialNumber = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber);
  1494. SystemId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SystemId);
  1495. AcPhaseCount = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPhaseCount);
  1496. PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
  1497. FactoryConfiguration = json_object_new_int(ShmSysConfigAndInfo->SysInfo.FactoryConfiguration);
  1498. AuthorisationMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
  1499. DefaultLanguage = json_object_new_int(ShmSysConfigAndInfo->SysConfig.DefaultLanguage);
  1500. InputVoltageR = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageR);
  1501. InputVoltageS = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageS);
  1502. InputVoltageT = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageT);
  1503. SystemFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
  1504. PsuFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed);
  1505. RfidCardNumEndian = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
  1506. PsuAcInputType = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PsuAcInputType);
  1507. RatingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RatingCurrent);
  1508. AcRatingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcRatingCurrent);
  1509. isAPP = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isAPP);
  1510. isQRCode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isQRCode);
  1511. isRFID = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isRFID);
  1512. QRCodeMadeMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode);
  1513. QRCodeContent = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.QRCodeContent);
  1514. Intensity = json_object_new_int(ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity);
  1515. AuxPower5V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower5V);
  1516. AuxPower12V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower12V);
  1517. AuxPower24V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower24V);
  1518. AuxPower48V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower48V);
  1519. CsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev);
  1520. CsuBootLoadFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
  1521. CsuKernelFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
  1522. CsuRootFsFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
  1523. CsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev);
  1524. LcmHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev);
  1525. LcmFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev);
  1526. PsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev);
  1527. PsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev);
  1528. PsuSecFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev);
  1529. AuxPwrHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev);
  1530. AuxPwrFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev);
  1531. FanModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev);
  1532. FanModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev);
  1533. RelayModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev);
  1534. RelayModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev);
  1535. TelcomModemFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev);
  1536. Connector1FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
  1537. Connector2FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
  1538. LedModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LedModuleFwRev);
  1539. SystemAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp);
  1540. SystemCriticalTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp);
  1541. CcsConnectorTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp);
  1542. PsuAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp);
  1543. AcPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPlugInTimes);
  1544. GbPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.GbPlugInTimes);
  1545. Ccs1PlugInTime = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime);
  1546. Ccs2PlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes);
  1547. ChademoPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes);
  1548. FirmwareUpdate = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FirmwareUpdate);
  1549. if(strcmp(IsAcDc, "D") == 0){
  1550. for(int i=0;i<PsuQuantity;i++){
  1551. FwPrimaryVersion[i] = json_object_new_string((char *)&ShmPsuData->PsuVersion[i].FwPrimaryVersion);
  1552. FwSecondVersion[i] = json_object_new_string((char *)&ShmPsuData->PsuVersion[i].FwSecondVersion);
  1553. json_object_array_add(FwPrimaryVersionArr,FwPrimaryVersion[i]);
  1554. json_object_array_add(FwSecondVersionArr,FwSecondVersion[i]);
  1555. }
  1556. }
  1557. if(strcmp(IsDO, "DO") == 0){
  1558. if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity>4 || ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity<0)ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity=0;
  1559. DispenserQuantity = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity);
  1560. TotalConnectorQuantity = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity);
  1561. int DDDispenserQuantity = ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity;
  1562. for(int i=0;i<DDDispenserQuantity;i++){
  1563. DDModelName[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].ModelName);
  1564. DDSerialNumber[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].SerialNumber);
  1565. DDSystemId[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].SystemId);
  1566. DDAuthorisationMode[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].AuthorisationMode);
  1567. DDRfidCardNumEndian[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].RfidCardNumEndian);
  1568. DDisAPP[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].isAPP);
  1569. DDisQRCode[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].isQRCode);
  1570. DDisRFID[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].isRFID);
  1571. DDQRCodeMadeMode[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].QRCodeMadeMode);
  1572. DDQRCodeContent[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].QRCodeContent);
  1573. DDFactoryConfiguration[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].FactoryConfiguration);
  1574. DDCsuBootLoadFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuBootLoadFwRev);
  1575. DDCsuKernelFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuKernelFwRev);
  1576. DDCsuRootFsFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuRootFsFwRev);
  1577. DDCsuPrimFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuPrimFwRev);
  1578. DDLcmFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LcmFwRev);
  1579. DDPsuPrimFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].PsuPrimFwRev);
  1580. DDPsuSecFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].PsuSecFwRev);
  1581. DDFanModuleFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].FanModuleFwRev);
  1582. DDRelayModuleFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].RelayModuleFwRev);
  1583. DDTelcomModemFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].TelcomModemFwRev);
  1584. DDLedModuleFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LedModuleFwRev);
  1585. DDConnector1FwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Connector1FwRev);
  1586. DDConnector2FwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Connector2FwRev);
  1587. DDIntensity[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LedInfo.Intensity);
  1588. json_object_array_add(DDModelNameArr,DDModelName[i]);
  1589. json_object_array_add(DDSerialNumberArr,DDSerialNumber[i]);
  1590. json_object_array_add(DDSystemIdArr,DDSystemId[i]);
  1591. json_object_array_add(DDAuthorisationModeArr,DDAuthorisationMode[i]);
  1592. json_object_array_add(DDRfidCardNumEndianArr,DDRfidCardNumEndian[i]);
  1593. json_object_array_add(DDisAPPArr,DDisAPP[i]);
  1594. json_object_array_add(DDisQRCodeArr,DDisQRCode[i]);
  1595. json_object_array_add(DDisRFIDArr,DDisRFID[i]);
  1596. json_object_array_add(DDQRCodeMadeModeArr,DDQRCodeMadeMode[i]);
  1597. json_object_array_add(DDQRCodeContentArr,DDQRCodeContent[i]);
  1598. json_object_array_add(DDFactoryConfigurationArr,DDFactoryConfiguration[i]);
  1599. json_object_array_add(DDCsuBootLoadFwRevArr,DDCsuBootLoadFwRev[i]);
  1600. json_object_array_add(DDCsuKernelFwRevArr,DDCsuKernelFwRev[i]);
  1601. json_object_array_add(DDCsuRootFsFwRevArr,DDCsuRootFsFwRev[i]);
  1602. json_object_array_add(DDCsuPrimFwRevArr,DDCsuPrimFwRev[i]);
  1603. json_object_array_add(DDLcmFwRevArr,DDLcmFwRev[i]);
  1604. json_object_array_add(DDPsuPrimFwRevArr,DDPsuPrimFwRev[i]);
  1605. json_object_array_add(DDPsuSecFwRevArr,DDPsuSecFwRev[i]);
  1606. json_object_array_add(DDFanModuleFwRevArr,DDFanModuleFwRev[i]);
  1607. json_object_array_add(DDRelayModuleFwRevArr,DDRelayModuleFwRev[i]);
  1608. json_object_array_add(DDTelcomModemFwRevArr,DDTelcomModemFwRev[i]);
  1609. json_object_array_add(DDLedModuleFwRevArr,DDLedModuleFwRev[i]);
  1610. json_object_array_add(DDConnector1FwRevArr,DDConnector1FwRev[i]);
  1611. json_object_array_add(DDConnector2FwRevArr,DDConnector2FwRev[i]);
  1612. json_object_array_add(DDIntensityArr,DDIntensity[i]);
  1613. }
  1614. }
  1615. //charging
  1616. int CcsGunQty=0;
  1617. int GbGunQty=0;
  1618. int CHAdeMOGunQty=0;
  1619. int AcGunQty=0;
  1620. ChargingInfo1=json_object_new_object();
  1621. ChargingInfo2=json_object_new_object();
  1622. ChargingInfo3=json_object_new_object();
  1623. MaxChargingEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy);
  1624. MaxChargingPower = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingPower);
  1625. MaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
  1626. AcMaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent);
  1627. MaxChargingDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingDuration);
  1628. LocalWhiteCard[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]);
  1629. LocalWhiteCard[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]);
  1630. LocalWhiteCard[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]);
  1631. LocalWhiteCard[3] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3]);
  1632. LocalWhiteCard[4] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4]);
  1633. LocalWhiteCard[5] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5]);
  1634. LocalWhiteCard[6] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6]);
  1635. LocalWhiteCard[7] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7]);
  1636. LocalWhiteCard[8] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8]);
  1637. LocalWhiteCard[9] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9]);
  1638. isBilling = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BillingData.isBilling);
  1639. Currency = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BillingData.Currency);
  1640. Fee[0] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[0]);
  1641. Fee[1] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[1]);
  1642. Fee[2] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[2]);
  1643. Fee[3] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[3]);
  1644. Fee[4] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[4]);
  1645. Fee[5] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[5]);
  1646. Fee[6] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[6]);
  1647. Fee[7] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[7]);
  1648. Fee[8] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[8]);
  1649. Fee[9] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[9]);
  1650. Fee[10] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[10]);
  1651. Fee[11] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[11]);
  1652. Fee[12] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[12]);
  1653. Fee[13] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[13]);
  1654. Fee[14] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[14]);
  1655. Fee[15] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[15]);
  1656. Fee[16] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[16]);
  1657. Fee[17] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[17]);
  1658. Fee[18] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[18]);
  1659. Fee[19] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[19]);
  1660. Fee[20] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[20]);
  1661. Fee[21] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[21]);
  1662. Fee[22] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[22]);
  1663. Fee[23] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[23]);
  1664. if(connectorType1 != 0){
  1665. if(connectorType1 == 1){//CCS
  1666. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1667. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1668. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1669. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1670. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1671. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1672. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1673. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1674. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1675. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1676. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1677. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1678. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1679. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1680. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1681. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1682. CcsGunQty++;
  1683. }
  1684. else if(connectorType1 == 2){//GB
  1685. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1686. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1687. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1688. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1689. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1690. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1691. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1692. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1693. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  1694. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  1695. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  1696. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  1697. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  1698. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  1699. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  1700. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  1701. GbGunQty++;
  1702. }
  1703. else if(connectorType1 == 3){//CHAdeMO
  1704. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  1705. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  1706. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  1707. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  1708. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  1709. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  1710. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  1711. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  1712. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  1713. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  1714. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  1715. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  1716. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  1717. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  1718. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1719. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1720. CHAdeMOGunQty++;
  1721. }
  1722. else if(connectorType1 == 4){//AC
  1723. PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1724. PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1725. PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1726. PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1727. PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1728. RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1729. EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1730. EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1731. EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1732. SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1733. EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1734. StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1735. StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1736. StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1737. StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1738. ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1739. AcGunQty++;
  1740. }
  1741. }
  1742. if(connectorType2 != 0){
  1743. if(connectorType2 == 1){//CCS
  1744. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1745. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1746. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1747. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1748. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1749. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1750. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1751. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1752. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1753. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1754. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1755. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1756. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1757. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1758. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1759. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1760. CcsGunQty++;
  1761. }
  1762. else if(connectorType2 == 2){//GB
  1763. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1764. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1765. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1766. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1767. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1768. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1769. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1770. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1771. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  1772. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  1773. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  1774. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  1775. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  1776. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  1777. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  1778. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  1779. GbGunQty++;
  1780. }
  1781. else if(connectorType2 == 3){//CHAdeMO
  1782. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  1783. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  1784. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  1785. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  1786. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  1787. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  1788. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  1789. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  1790. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  1791. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  1792. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  1793. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  1794. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  1795. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  1796. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1797. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1798. CHAdeMOGunQty++;
  1799. }
  1800. else if(connectorType2 == 4){//AC
  1801. PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1802. PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1803. PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1804. PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1805. PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1806. RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1807. EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1808. EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1809. EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1810. SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1811. EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1812. StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1813. StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1814. StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1815. StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1816. ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1817. AcGunQty++;
  1818. }
  1819. }
  1820. if(connectorType3 != 0){
  1821. if(connectorType3 == 1){//CCS
  1822. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
  1823. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
  1824. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
  1825. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
  1826. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
  1827. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
  1828. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
  1829. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
  1830. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
  1831. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
  1832. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
  1833. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
  1834. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
  1835. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
  1836. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
  1837. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
  1838. CcsGunQty++;
  1839. }
  1840. else if(connectorType3 == 2){//GB
  1841. PresentChargingVoltage[2]= json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
  1842. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
  1843. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
  1844. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
  1845. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
  1846. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
  1847. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
  1848. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
  1849. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
  1850. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
  1851. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
  1852. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
  1853. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
  1854. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
  1855. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
  1856. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
  1857. GbGunQty++;
  1858. }
  1859. else if(connectorType3 == 3){//CHAdeMO
  1860. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
  1861. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
  1862. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
  1863. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
  1864. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
  1865. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
  1866. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
  1867. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
  1868. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
  1869. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
  1870. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
  1871. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
  1872. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
  1873. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
  1874. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
  1875. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
  1876. CHAdeMOGunQty++;
  1877. }
  1878. else if(connectorType3 == 4){//AC
  1879. PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
  1880. PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
  1881. PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
  1882. PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
  1883. PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
  1884. RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
  1885. EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
  1886. EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
  1887. EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
  1888. SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
  1889. EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
  1890. StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
  1891. StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
  1892. StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
  1893. StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
  1894. ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
  1895. AcGunQty++;
  1896. }
  1897. }
  1898. if(strcmp(IsDO, "DO") == 0){
  1899. if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity>4 || ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity<0)ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=0;
  1900. int DDTotalConnectorQuantity = ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity;
  1901. for(int i=0;i<DDTotalConnectorQuantity;i++){
  1902. DDPresentChargingVoltage[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargingVoltage);
  1903. DDPresentChargingCurrent[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargingCurrent);
  1904. DDPresentChargingPower[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargingPower);
  1905. DDPresentChargedEnergy[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargedEnergy);
  1906. DDPresentChargedDuration[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargedDuration);
  1907. DDRemainChargingDuration[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.RemainChargingDuration);
  1908. DDEvBatteryMaxVoltage[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatteryMaxVoltage);
  1909. DDEvBatterytargetVoltage[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatterytargetVoltage);
  1910. DDEvBatterySoc[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatterySoc);
  1911. DDSystemStatus[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.SystemStatus);
  1912. DDEvBatterytargetCurrent[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatterytargetCurrent);
  1913. DDStartUserId[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartUserId);
  1914. DDStartDateTime[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartDateTime);
  1915. DDStopDateTime[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StopDateTime);
  1916. DDStartMethod[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartMethod);
  1917. DDConnectorTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp);
  1918. }
  1919. }
  1920. //network
  1921. InternetConn = json_object_new_int(ShmSysConfigAndInfo->SysInfo.InternetConn);
  1922. FtpServer = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer);
  1923. Eth0DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient);
  1924. Eth0MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress);
  1925. Eth0IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
  1926. Eth0SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
  1927. Eth0GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
  1928. Eth1DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient);
  1929. Eth1MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress);
  1930. Eth1IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress);
  1931. Eth1SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress);
  1932. Eth1GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress);
  1933. WifiMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
  1934. WifiSsid = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
  1935. WifiPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
  1936. WifiRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi);
  1937. WifiDhcpServer = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer);
  1938. WifiDhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient);
  1939. WifiMacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress);
  1940. WifiIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress);
  1941. WifiSubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress);
  1942. WifiGatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress);
  1943. WifiNetworkConn = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn);
  1944. TelcomApn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
  1945. TelcomRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi);
  1946. TelcomChapPapId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
  1947. TelcomChapPapPwd = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
  1948. TelcomModemImei = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei);
  1949. TelcomSimImsi = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi);
  1950. TelcomSimIccid = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
  1951. TelcomSimStatus = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus);
  1952. TelcomModemMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
  1953. TelcomIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress);
  1954. TelcomNetworkConn = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn);
  1955. TelcomEnabled = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled);
  1956. //backend
  1957. BackendConnTimeout = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BackendConnTimeout);
  1958. OfflinePolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
  1959. OfflineMaxChargeEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy);
  1960. OfflineMaxChargeDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration);
  1961. OcppConnStatus = json_object_new_int(ShmSysConfigAndInfo->SysInfo.OcppConnStatus);
  1962. OcppServerURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL);
  1963. ChargeBoxId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
  1964. chargePointVendor = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor);
  1965. //system
  1966. json_object_object_add(jobj1,"ModelName",ModelName);
  1967. json_object_object_add(jobj1,"AcModelName",AcModelName);
  1968. json_object_object_add(jobj1,"SerialNumber",SerialNumber);
  1969. json_object_object_add(jobj1,"SystemId",SystemId);
  1970. json_object_object_add(jobj1,"AcPhaseCount",AcPhaseCount);
  1971. json_object_object_add(jobj1,"PhaseLossPolicy",PhaseLossPolicy);
  1972. json_object_object_add(jobj1,"FactoryConfiguration",FactoryConfiguration);
  1973. json_object_object_add(jobj1,"AuthorisationMode",AuthorisationMode);
  1974. json_object_object_add(jobj1,"DefaultLanguage",DefaultLanguage);
  1975. json_object_object_add(jobj1,"InputVoltageR",InputVoltageR);
  1976. json_object_object_add(jobj1,"InputVoltageS",InputVoltageS);
  1977. json_object_object_add(jobj1,"InputVoltageT",InputVoltageT);
  1978. json_object_object_add(jobj1,"SystemFanRotaSpeed",SystemFanRotaSpeed);
  1979. json_object_object_add(jobj1,"PsuFanRotaSpeed",PsuFanRotaSpeed);
  1980. json_object_object_add(jobj1,"RfidCardNumEndian",RfidCardNumEndian);
  1981. json_object_object_add(jobj1,"PsuAcInputType",PsuAcInputType);
  1982. json_object_object_add(jobj1,"RatingCurrent",RatingCurrent);
  1983. json_object_object_add(jobj1,"AcRatingCurrent",AcRatingCurrent);
  1984. json_object_object_add(jobj1,"isAPP",isAPP);
  1985. json_object_object_add(jobj1,"isQRCode",isQRCode);
  1986. json_object_object_add(jobj1,"isRFID",isRFID);
  1987. json_object_object_add(jobj1,"QRCodeMadeMode",QRCodeMadeMode);
  1988. json_object_object_add(jobj1,"QRCodeContent",QRCodeContent);
  1989. json_object_object_add(jobj1,"Intensity",Intensity);
  1990. json_object_object_add(jobj1,"AuxPower5V",AuxPower5V);
  1991. json_object_object_add(jobj1,"AuxPower12V",AuxPower12V);
  1992. json_object_object_add(jobj1,"AuxPower24V",AuxPower24V);
  1993. json_object_object_add(jobj1,"AuxPower48V",AuxPower48V);
  1994. json_object_object_add(jobj1,"CsuHwRev",CsuHwRev);
  1995. json_object_object_add(jobj1,"CsuBootLoadFwRev",CsuBootLoadFwRev);
  1996. json_object_object_add(jobj1,"CsuKernelFwRev",CsuKernelFwRev);
  1997. json_object_object_add(jobj1,"CsuRootFsFwRev",CsuRootFsFwRev);
  1998. json_object_object_add(jobj1,"CsuPrimFwRev",CsuPrimFwRev);
  1999. json_object_object_add(jobj1,"LcmHwRev",LcmHwRev);
  2000. json_object_object_add(jobj1,"LcmFwRev",LcmFwRev);
  2001. json_object_object_add(jobj1,"PsuHwRev",PsuHwRev);
  2002. json_object_object_add(jobj1,"PsuPrimFwRev",PsuPrimFwRev);
  2003. json_object_object_add(jobj1,"PsuSecFwRev",PsuSecFwRev);
  2004. json_object_object_add(jobj1,"AuxPwrHwRev",AuxPwrHwRev);
  2005. json_object_object_add(jobj1,"AuxPwrFwRev",AuxPwrFwRev);
  2006. json_object_object_add(jobj1,"FanModuleHwRev",FanModuleHwRev);
  2007. json_object_object_add(jobj1,"FanModuleFwRev",FanModuleFwRev);
  2008. json_object_object_add(jobj1,"RelayModuleHwRev",RelayModuleHwRev);
  2009. json_object_object_add(jobj1,"RelayModuleFwRev",RelayModuleFwRev);
  2010. json_object_object_add(jobj1,"TelcomModemFwRev",TelcomModemFwRev);
  2011. json_object_object_add(jobj1,"Connector1FwRev",Connector1FwRev);
  2012. json_object_object_add(jobj1,"Connector2FwRev",Connector2FwRev);
  2013. json_object_object_add(jobj1,"LedModuleFwRev",LedModuleFwRev);
  2014. json_object_object_add(jobj1,"SystemAmbientTemp",SystemAmbientTemp);
  2015. json_object_object_add(jobj1,"SystemCriticalTemp",SystemCriticalTemp);
  2016. json_object_object_add(jobj1,"CcsConnectorTemp",CcsConnectorTemp);
  2017. json_object_object_add(jobj1,"PsuAmbientTemp",PsuAmbientTemp);
  2018. json_object_object_add(jobj1,"AcPlugInTimes",AcPlugInTimes);
  2019. json_object_object_add(jobj1,"GbPlugInTimes",GbPlugInTimes);
  2020. json_object_object_add(jobj1,"Ccs1PlugInTimes",Ccs1PlugInTime);
  2021. json_object_object_add(jobj1,"Ccs2PlugInTimes",Ccs2PlugInTimes);
  2022. json_object_object_add(jobj1,"ChademoPlugInTimes",ChademoPlugInTimes);
  2023. json_object_object_add(jobj1,"FirmwareUpdate",FirmwareUpdate);
  2024. if(strcmp(IsAcDc, "D") == 0){
  2025. json_object_object_add(jobj1,"FwPrimaryVersion",FwPrimaryVersionArr);
  2026. json_object_object_add(jobj1,"FwSecondVersion",FwSecondVersionArr);
  2027. }
  2028. if(strcmp(IsDO, "DO") == 0){
  2029. json_object_object_add(jobj1,"DispenserQuantity",DispenserQuantity);
  2030. json_object_object_add(jobj1,"TotalConnectorQuantity",TotalConnectorQuantity);
  2031. json_object_object_add(jobj1,"DDModelName",DDModelNameArr);
  2032. json_object_object_add(jobj1,"DDSerialNumber",DDSerialNumberArr);
  2033. json_object_object_add(jobj1,"DDSystemId",DDSystemIdArr);
  2034. json_object_object_add(jobj1,"DDAuthorisationMode",DDAuthorisationModeArr);
  2035. json_object_object_add(jobj1,"DDRfidCardNumEndian",DDRfidCardNumEndianArr);
  2036. json_object_object_add(jobj1,"DDisAPP",DDisAPPArr);
  2037. json_object_object_add(jobj1,"DDisQRCode",DDisQRCodeArr);
  2038. json_object_object_add(jobj1,"DDisRFID",DDisRFIDArr);
  2039. json_object_object_add(jobj1,"DDQRCodeMadeMode",DDQRCodeMadeModeArr);
  2040. json_object_object_add(jobj1,"DDQRCodeContent",DDQRCodeContentArr);
  2041. json_object_object_add(jobj1,"DDFactoryConfiguration",DDFactoryConfigurationArr);
  2042. json_object_object_add(jobj1,"DDCsuBootLoadFwRev",DDCsuBootLoadFwRevArr);
  2043. json_object_object_add(jobj1,"DDCsuKernelFwRev",DDCsuKernelFwRevArr);
  2044. json_object_object_add(jobj1,"DDCsuRootFsFwRev",DDCsuRootFsFwRevArr);
  2045. json_object_object_add(jobj1,"DDCsuPrimFwRev",DDCsuPrimFwRevArr);
  2046. json_object_object_add(jobj1,"DDLcmFwRev",DDLcmFwRevArr);
  2047. json_object_object_add(jobj1,"DDPsuPrimFwRev",DDPsuPrimFwRevArr);
  2048. json_object_object_add(jobj1,"DDPsuSecFwRev",DDPsuSecFwRevArr);
  2049. json_object_object_add(jobj1,"DDFanModuleFwRev",DDFanModuleFwRevArr);
  2050. json_object_object_add(jobj1,"DDRelayModuleFwRev",DDRelayModuleFwRevArr);
  2051. json_object_object_add(jobj1,"DDTelcomModemFwRev",DDTelcomModemFwRevArr);
  2052. json_object_object_add(jobj1,"DDLedModuleFwRev",DDLedModuleFwRevArr);
  2053. json_object_object_add(jobj1,"DDConnector1FwRev",DDConnector1FwRevArr);
  2054. json_object_object_add(jobj1,"DDConnector2FwRev",DDConnector2FwRevArr);
  2055. json_object_object_add(jobj1,"DDIntensity",DDIntensityArr);
  2056. }
  2057. printf("%s\n", json_object_to_json_string(jobj1));
  2058. json_object_put(jobj1);
  2059. //charging
  2060. json_object_object_add(jobj2,"MaxChargingEnergy",MaxChargingEnergy);
  2061. json_object_object_add(jobj2,"MaxChargingPower",MaxChargingPower);
  2062. json_object_object_add(jobj2,"MaxChargingCurrent",MaxChargingCurrent);
  2063. json_object_object_add(jobj2,"AcMaxChargingCurrent",AcMaxChargingCurrent);
  2064. json_object_object_add(jobj2,"MaxChargingDuration",MaxChargingDuration);
  2065. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[0]);
  2066. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[1]);
  2067. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[2]);
  2068. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[3]);
  2069. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[4]);
  2070. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[5]);
  2071. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[6]);
  2072. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[7]);
  2073. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[8]);
  2074. json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[9]);
  2075. json_object_object_add(jobj2,"LocalWhiteCard",LocalWhiteCardArr);
  2076. json_object_object_add(jobj2,"isBilling",isBilling);
  2077. json_object_object_add(jobj2,"Currency",Currency);
  2078. json_object_array_add(FeeArr,Fee[0]);
  2079. json_object_array_add(FeeArr,Fee[1]);
  2080. json_object_array_add(FeeArr,Fee[2]);
  2081. json_object_array_add(FeeArr,Fee[3]);
  2082. json_object_array_add(FeeArr,Fee[4]);
  2083. json_object_array_add(FeeArr,Fee[5]);
  2084. json_object_array_add(FeeArr,Fee[6]);
  2085. json_object_array_add(FeeArr,Fee[7]);
  2086. json_object_array_add(FeeArr,Fee[8]);
  2087. json_object_array_add(FeeArr,Fee[9]);
  2088. json_object_array_add(FeeArr,Fee[10]);
  2089. json_object_array_add(FeeArr,Fee[11]);
  2090. json_object_array_add(FeeArr,Fee[12]);
  2091. json_object_array_add(FeeArr,Fee[13]);
  2092. json_object_array_add(FeeArr,Fee[14]);
  2093. json_object_array_add(FeeArr,Fee[15]);
  2094. json_object_array_add(FeeArr,Fee[16]);
  2095. json_object_array_add(FeeArr,Fee[17]);
  2096. json_object_array_add(FeeArr,Fee[18]);
  2097. json_object_array_add(FeeArr,Fee[19]);
  2098. json_object_array_add(FeeArr,Fee[20]);
  2099. json_object_array_add(FeeArr,Fee[21]);
  2100. json_object_array_add(FeeArr,Fee[22]);
  2101. json_object_array_add(FeeArr,Fee[23]);
  2102. json_object_object_add(jobj2,"Fee",FeeArr);
  2103. if(connectorType1 != 0){
  2104. json_object_object_add(ChargingInfo1,"StartUserId",StartUserId[0]);
  2105. json_object_object_add(ChargingInfo1,"StartDateTime",StartDateTime[0]);
  2106. json_object_object_add(ChargingInfo1,"StopDateTime",StopDateTime[0]);
  2107. json_object_object_add(ChargingInfo1,"StartMethod",StartMethod[0]);
  2108. json_object_object_add(ChargingInfo1,"ConnectorTemp",ConnectorTemp[0]);
  2109. json_object_object_add(ChargingInfo1,"PresentChargingVoltage",PresentChargingVoltage[0]);
  2110. json_object_object_add(ChargingInfo1,"PresentChargingCurrent",PresentChargingCurrent[0]);
  2111. json_object_object_add(ChargingInfo1,"PresentChargingPower",PresentChargingPower[0]);
  2112. json_object_object_add(ChargingInfo1,"PresentChargedEnergy",PresentChargedEnergy[0]);
  2113. json_object_object_add(ChargingInfo1,"PresentChargedDuration",PresentChargedDuration[0]);
  2114. json_object_object_add(ChargingInfo1,"RemainChargingDuration",RemainChargingDuration[0]);
  2115. json_object_object_add(ChargingInfo1,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[0]);
  2116. json_object_object_add(ChargingInfo1,"EvBatterytargetVoltage",EvBatterytargetVoltage[0]);
  2117. json_object_object_add(ChargingInfo1,"EvBatterySoc",EvBatterySoc[0]);
  2118. json_object_object_add(ChargingInfo1,"SystemStatus",SystemStatus[0]);
  2119. json_object_object_add(ChargingInfo1,"EvBatterytargetCurrent",EvBatterytargetCurrent[0]);
  2120. json_object_object_add(jobj2,"ChargingInfo1",ChargingInfo1);
  2121. }
  2122. if(connectorType2 != 0){
  2123. json_object_object_add(ChargingInfo2,"StartUserId",StartUserId[1]);
  2124. json_object_object_add(ChargingInfo2,"StartDateTime",StartDateTime[1]);
  2125. json_object_object_add(ChargingInfo2,"StopDateTime",StopDateTime[1]);
  2126. json_object_object_add(ChargingInfo2,"StartMethod",StartMethod[1]);
  2127. json_object_object_add(ChargingInfo2,"ConnectorTemp",ConnectorTemp[1]);
  2128. json_object_object_add(ChargingInfo2,"PresentChargingVoltage",PresentChargingVoltage[1]);
  2129. json_object_object_add(ChargingInfo2,"PresentChargingCurrent",PresentChargingCurrent[1]);
  2130. json_object_object_add(ChargingInfo2,"PresentChargingPower",PresentChargingPower[1]);
  2131. json_object_object_add(ChargingInfo2,"PresentChargedEnergy",PresentChargedEnergy[1]);
  2132. json_object_object_add(ChargingInfo2,"PresentChargedDuration",PresentChargedDuration[1]);
  2133. json_object_object_add(ChargingInfo2,"RemainChargingDuration",RemainChargingDuration[1]);
  2134. json_object_object_add(ChargingInfo2,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[1]);
  2135. json_object_object_add(ChargingInfo2,"EvBatterytargetVoltage",EvBatterytargetVoltage[1]);
  2136. json_object_object_add(ChargingInfo2,"EvBatterySoc",EvBatterySoc[1]);
  2137. json_object_object_add(ChargingInfo2,"SystemStatus",SystemStatus[1]);
  2138. json_object_object_add(ChargingInfo2,"EvBatterytargetCurrent",EvBatterytargetCurrent[1]);
  2139. json_object_object_add(jobj2,"ChargingInfo2",ChargingInfo2);
  2140. }
  2141. if(connectorType3 != 0){
  2142. json_object_object_add(ChargingInfo3,"StartUserId",StartUserId[2]);
  2143. json_object_object_add(ChargingInfo3,"StartDateTime",StartDateTime[2]);
  2144. json_object_object_add(ChargingInfo3,"StopDateTime",StopDateTime[2]);
  2145. json_object_object_add(ChargingInfo3,"StartMethod",StartMethod[2]);
  2146. json_object_object_add(ChargingInfo3,"ConnectorTemp",ConnectorTemp[2]);
  2147. json_object_object_add(ChargingInfo3,"PresentChargingVoltage",PresentChargingVoltage[2]);
  2148. json_object_object_add(ChargingInfo3,"PresentChargingCurrent",PresentChargingCurrent[2]);
  2149. json_object_object_add(ChargingInfo3,"PresentChargingPower",PresentChargingPower[2]);
  2150. json_object_object_add(ChargingInfo3,"PresentChargedEnergy",PresentChargedEnergy[2]);
  2151. json_object_object_add(ChargingInfo3,"PresentChargedDuration",PresentChargedDuration[2]);
  2152. json_object_object_add(ChargingInfo3,"RemainChargingDuration",RemainChargingDuration[2]);
  2153. json_object_object_add(ChargingInfo3,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[2]);
  2154. json_object_object_add(ChargingInfo3,"EvBatterytargetVoltage",EvBatterytargetVoltage[2]);
  2155. json_object_object_add(ChargingInfo3,"EvBatterySoc",EvBatterySoc[2]);
  2156. json_object_object_add(ChargingInfo3,"SystemStatus",SystemStatus[2]);
  2157. json_object_object_add(ChargingInfo3,"EvBatterytargetCurrent",EvBatterytargetCurrent[2]);
  2158. json_object_object_add(jobj2,"ChargingInfo3",ChargingInfo3);
  2159. }
  2160. if(strcmp(IsDO, "DO") == 0){
  2161. if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity>4|| ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity<0)ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=0;
  2162. int DDTotalConnectorQuantity = ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity;
  2163. DDChargingInfo1=json_object_new_object();
  2164. DDChargingInfo2=json_object_new_object();
  2165. DDChargingInfo3=json_object_new_object();
  2166. DDChargingInfo4=json_object_new_object();
  2167. if(DDTotalConnectorQuantity>0){
  2168. json_object_object_add(DDChargingInfo1,"StartUserId",DDStartUserId[0]);
  2169. json_object_object_add(DDChargingInfo1,"StartDateTime",DDStartDateTime[0]);
  2170. json_object_object_add(DDChargingInfo1,"StopDateTime",DDStopDateTime[0]);
  2171. json_object_object_add(DDChargingInfo1,"StartMethod",DDStartMethod[0]);
  2172. json_object_object_add(DDChargingInfo1,"ConnectorTemp",DDConnectorTemp[0]);
  2173. json_object_object_add(DDChargingInfo1,"PresentChargingVoltage",DDPresentChargingVoltage[0]);
  2174. json_object_object_add(DDChargingInfo1,"PresentChargingCurrent",DDPresentChargingCurrent[0]);
  2175. json_object_object_add(DDChargingInfo1,"PresentChargingPower",DDPresentChargingPower[0]);
  2176. json_object_object_add(DDChargingInfo1,"PresentChargedEnergy",DDPresentChargedEnergy[0]);
  2177. json_object_object_add(DDChargingInfo1,"PresentChargedDuration",DDPresentChargedDuration[0]);
  2178. json_object_object_add(DDChargingInfo1,"RemainChargingDuration",DDRemainChargingDuration[0]);
  2179. json_object_object_add(DDChargingInfo1,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[0]);
  2180. json_object_object_add(DDChargingInfo1,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[0]);
  2181. json_object_object_add(DDChargingInfo1,"EvBatterySoc",DDEvBatterySoc[0]);
  2182. json_object_object_add(DDChargingInfo1,"SystemStatus",DDSystemStatus[0]);
  2183. json_object_object_add(DDChargingInfo1,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[0]);
  2184. json_object_object_add(jobj2,"DDChargingInfo1",DDChargingInfo1);
  2185. }
  2186. if(DDTotalConnectorQuantity>1){
  2187. json_object_object_add(DDChargingInfo2,"StartUserId",DDStartUserId[1]);
  2188. json_object_object_add(DDChargingInfo2,"StartDateTime",DDStartDateTime[1]);
  2189. json_object_object_add(DDChargingInfo2,"StopDateTime",DDStopDateTime[1]);
  2190. json_object_object_add(DDChargingInfo2,"StartMethod",DDStartMethod[1]);
  2191. json_object_object_add(DDChargingInfo2,"ConnectorTemp",DDConnectorTemp[1]);
  2192. json_object_object_add(DDChargingInfo2,"PresentChargingVoltage",DDPresentChargingVoltage[1]);
  2193. json_object_object_add(DDChargingInfo2,"PresentChargingCurrent",DDPresentChargingCurrent[1]);
  2194. json_object_object_add(DDChargingInfo2,"PresentChargingPower",DDPresentChargingPower[1]);
  2195. json_object_object_add(DDChargingInfo2,"PresentChargedEnergy",DDPresentChargedEnergy[1]);
  2196. json_object_object_add(DDChargingInfo2,"PresentChargedDuration",DDPresentChargedDuration[1]);
  2197. json_object_object_add(DDChargingInfo2,"RemainChargingDuration",DDRemainChargingDuration[1]);
  2198. json_object_object_add(DDChargingInfo2,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[1]);
  2199. json_object_object_add(DDChargingInfo2,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[1]);
  2200. json_object_object_add(DDChargingInfo2,"EvBatterySoc",DDEvBatterySoc[1]);
  2201. json_object_object_add(DDChargingInfo2,"SystemStatus",DDSystemStatus[1]);
  2202. json_object_object_add(DDChargingInfo2,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[1]);
  2203. json_object_object_add(jobj2,"DDChargingInfo2",DDChargingInfo2);
  2204. }
  2205. if(DDTotalConnectorQuantity>2){
  2206. json_object_object_add(DDChargingInfo3,"StartUserId",DDStartUserId[2]);
  2207. json_object_object_add(DDChargingInfo3,"StartDateTime",DDStartDateTime[2]);
  2208. json_object_object_add(DDChargingInfo3,"StopDateTime",DDStopDateTime[2]);
  2209. json_object_object_add(DDChargingInfo3,"StartMethod",DDStartMethod[2]);
  2210. json_object_object_add(DDChargingInfo3,"ConnectorTemp",DDConnectorTemp[2]);
  2211. json_object_object_add(DDChargingInfo3,"PresentChargingVoltage",DDPresentChargingVoltage[2]);
  2212. json_object_object_add(DDChargingInfo3,"PresentChargingCurrent",DDPresentChargingCurrent[2]);
  2213. json_object_object_add(DDChargingInfo3,"PresentChargingPower",DDPresentChargingPower[2]);
  2214. json_object_object_add(DDChargingInfo3,"PresentChargedEnergy",DDPresentChargedEnergy[2]);
  2215. json_object_object_add(DDChargingInfo3,"PresentChargedDuration",DDPresentChargedDuration[2]);
  2216. json_object_object_add(DDChargingInfo3,"RemainChargingDuration",DDRemainChargingDuration[2]);
  2217. json_object_object_add(DDChargingInfo3,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[2]);
  2218. json_object_object_add(DDChargingInfo3,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[2]);
  2219. json_object_object_add(DDChargingInfo3,"EvBatterySoc",DDEvBatterySoc[2]);
  2220. json_object_object_add(DDChargingInfo3,"SystemStatus",DDSystemStatus[2]);
  2221. json_object_object_add(DDChargingInfo3,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[2]);
  2222. json_object_object_add(jobj2,"DDChargingInfo3",DDChargingInfo3);
  2223. }
  2224. if(DDTotalConnectorQuantity>3){
  2225. json_object_object_add(DDChargingInfo4,"StartUserId",DDStartUserId[3]);
  2226. json_object_object_add(DDChargingInfo4,"StartDateTime",DDStartDateTime[3]);
  2227. json_object_object_add(DDChargingInfo4,"StopDateTime",DDStopDateTime[3]);
  2228. json_object_object_add(DDChargingInfo4,"StartMethod",DDStartMethod[3]);
  2229. json_object_object_add(DDChargingInfo4,"ConnectorTemp",DDConnectorTemp[3]);
  2230. json_object_object_add(DDChargingInfo4,"PresentChargingVoltage",DDPresentChargingVoltage[3]);
  2231. json_object_object_add(DDChargingInfo4,"PresentChargingCurrent",DDPresentChargingCurrent[3]);
  2232. json_object_object_add(DDChargingInfo4,"PresentChargingPower",DDPresentChargingPower[3]);
  2233. json_object_object_add(DDChargingInfo4,"PresentChargedEnergy",DDPresentChargedEnergy[3]);
  2234. json_object_object_add(DDChargingInfo4,"PresentChargedDuration",DDPresentChargedDuration[3]);
  2235. json_object_object_add(DDChargingInfo4,"RemainChargingDuration",DDRemainChargingDuration[3]);
  2236. json_object_object_add(DDChargingInfo4,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[3]);
  2237. json_object_object_add(DDChargingInfo4,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[3]);
  2238. json_object_object_add(DDChargingInfo4,"EvBatterySoc",DDEvBatterySoc[3]);
  2239. json_object_object_add(DDChargingInfo4,"SystemStatus",DDSystemStatus[3]);
  2240. json_object_object_add(DDChargingInfo4,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[3]);
  2241. json_object_object_add(jobj2,"DDChargingInfo4",DDChargingInfo4);
  2242. }
  2243. }
  2244. printf("%s\n", json_object_to_json_string(jobj2));
  2245. json_object_put(jobj2);
  2246. //network
  2247. json_object_object_add(jobj3,"InternetConn",InternetConn);
  2248. json_object_object_add(jobj3,"FtpServer",FtpServer);
  2249. json_object_object_add(jobj3,"Eth0DhcpClient",Eth0DhcpClient);
  2250. json_object_object_add(jobj3,"Eth0MacAddress",Eth0MacAddress);
  2251. json_object_object_add(jobj3,"Eth0IpAddress",Eth0IpAddress);
  2252. json_object_object_add(jobj3,"Eth0SubmaskAddress",Eth0SubmaskAddress);
  2253. json_object_object_add(jobj3,"Eth0GatewayAddress",Eth0GatewayAddress);
  2254. json_object_object_add(jobj3,"Eth1DhcpClient",Eth1DhcpClient);
  2255. json_object_object_add(jobj3,"Eth1MacAddress",Eth1MacAddress);
  2256. json_object_object_add(jobj3,"Eth1IpAddress",Eth1IpAddress);
  2257. json_object_object_add(jobj3,"Eth1SubmaskAddress",Eth1SubmaskAddress);
  2258. json_object_object_add(jobj3,"Eth1GatewayAddress",Eth1GatewayAddress);
  2259. json_object_object_add(jobj3,"WifiMode",WifiMode);
  2260. json_object_object_add(jobj3,"WifiSsid",WifiSsid);
  2261. json_object_object_add(jobj3,"WifiPassword",WifiPassword);
  2262. json_object_object_add(jobj3,"WifiRssi",WifiRssi);
  2263. json_object_object_add(jobj3,"WifiDhcpServer",WifiDhcpServer);
  2264. json_object_object_add(jobj3,"WifiDhcpClient",WifiDhcpClient);
  2265. json_object_object_add(jobj3,"WifiMacAddress",WifiMacAddress);
  2266. json_object_object_add(jobj3,"WifiIpAddress",WifiIpAddress);
  2267. json_object_object_add(jobj3,"WifiSubmaskAddress",WifiSubmaskAddress);
  2268. json_object_object_add(jobj3,"WifiGatewayAddress",WifiGatewayAddress);
  2269. json_object_object_add(jobj3,"WifiNetworkConn",WifiNetworkConn);
  2270. json_object_object_add(jobj3,"TelcomApn",TelcomApn);
  2271. json_object_object_add(jobj3,"TelcomRssi",TelcomRssi);
  2272. json_object_object_add(jobj3,"TelcomChapPapId",TelcomChapPapId);
  2273. json_object_object_add(jobj3,"TelcomChapPapPwd",TelcomChapPapPwd);
  2274. json_object_object_add(jobj3,"TelcomModemImei",TelcomModemImei);
  2275. json_object_object_add(jobj3,"TelcomSimImsi",TelcomSimImsi);
  2276. json_object_object_add(jobj3,"TelcomSimIccid",TelcomSimIccid);
  2277. json_object_object_add(jobj3,"TelcomSimStatus",TelcomSimStatus);
  2278. json_object_object_add(jobj3,"TelcomModemMode",TelcomModemMode);
  2279. json_object_object_add(jobj3,"TelcomIpAddress",TelcomIpAddress);
  2280. json_object_object_add(jobj3,"TelcomNetworkConn",TelcomNetworkConn);
  2281. json_object_object_add(jobj3,"TelcomEnabled",TelcomEnabled);
  2282. printf("%s\n", json_object_to_json_string(jobj3));
  2283. json_object_put(jobj3);
  2284. //backend
  2285. json_object_object_add(jobj4,"BackendConnTimeout",BackendConnTimeout);
  2286. json_object_object_add(jobj4,"OfflinePolicy",OfflinePolicy);
  2287. json_object_object_add(jobj4,"OfflineMaxChargeEnergy",OfflineMaxChargeEnergy);
  2288. json_object_object_add(jobj4,"OfflineMaxChargeDuration",OfflineMaxChargeDuration);
  2289. json_object_object_add(jobj4,"OcppConnStatus",OcppConnStatus);
  2290. json_object_object_add(jobj4,"OcppServerURL",OcppServerURL);
  2291. json_object_object_add(jobj4,"ChargeBoxId",ChargeBoxId);
  2292. json_object_object_add(jobj4,"chargePointVendor",chargePointVendor);
  2293. printf("%s\n", json_object_to_json_string(jobj4));
  2294. json_object_put(jobj4);
  2295. }
  2296. // for(;;)
  2297. // {
  2298. // }
  2299. return FAIL;
  2300. }