WebService.c 98 KB

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