WebService.c 88 KB

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