WebService.c 76 KB

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