1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439 |
- #include <sys/time.h>
- #include <sys/timeb.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <sys/socket.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <sys/shm.h>
- #include <sys/mman.h>
- #include <linux/wireless.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <termios.h>
- #include <errno.h>
- #include <errno.h>
- #include <string.h>
- #include <time.h>
- #include <ctype.h>
- #include <ifaddrs.h>
- #include <math.h>
- #include "define.h"
- #include "json.h"
- #ifdef DO360
- #include "../Projects/DO360/Apps/Config.h"
- #endif
- #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
- #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
- #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
- #define Debug
- #define SystemLogMessage
- #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
- #define PASS 1
- #define FAIL -1
- #define MtdBlockSize 0x300000
- struct SysConfigAndInfo *ShmSysConfigAndInfo;
- struct StatusCodeData *ShmStatusCodeData;
- struct CHAdeMOData *ShmCHAdeMOData;
- struct GBTData *ShmGBTData;
- struct CcsData *ShmCcsData;
- struct PsuData *ShmPsuData;
- struct PrimaryMcuData *ShmPrimaryMcuData;
- struct OCPP16Data *ShmOCPP16Data;
- struct OCPP20Data *ShmOCPP20Data;
- #ifdef DO360
- ChargerInfoData *ShmChargerInfo;
- struct ChargingInfoData *_chargingData[4];
- #endif
- void trim(char *s);
- int mystrcmp(char *p1, char *p2);
- void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
- void split(char **arr, char *str, const char *del);
- #ifdef SystemLogMessage
- int StoreLogMsg(const char *fmt, ...) {
- char Buf[4096 + 256];
- char buffer[4096];
- time_t CurrentTime;
- struct tm *tm;
- va_list args;
- va_start(args, fmt);
- int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
- va_end(args);
- memset(Buf, 0, sizeof(Buf));
- CurrentTime = time(NULL);
- tm = localtime(&CurrentTime);
- sprintf(Buf,
- "echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
- tm->tm_min, tm->tm_sec, buffer, tm->tm_year + 1900, tm->tm_mon + 1);
- system(Buf);
- #ifdef Debug
- printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year + 1900,
- tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
- buffer);
- #endif
- return rc;
- }
- int WriteLogMsg(const char *fmt, ...) {
- char Buf[4096 + 256];
- char buffer[4096];
- time_t CurrentTime;
- struct tm *tm;
- va_list args;
- va_start(args, fmt);
- int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
- va_end(args);
- memset(Buf, 0, sizeof(Buf));
- CurrentTime = time(NULL);
- tm = localtime(&CurrentTime);
- sprintf(Buf,
- "echo \"[%04d.%02d.%02d %02d:%02d:%02d WebService] - %s\" >> /Storage/SystemLog/[%04d.%02d]WebService_SystemLog",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
- tm->tm_min, tm->tm_sec, buffer, tm->tm_year + 1900, tm->tm_mon + 1);
- system(Buf);
- return rc;
- }
- #endif
- int runShellCmd(const char*cmd)
- {
- int result = FAIL;
- char buf[256];
- FILE *fp;
- fp = popen(cmd, "r");
- if(fp != NULL)
- {
- while(fgets(buf, sizeof(buf), fp) != NULL)
- {
- DEBUG_INFO("%s\n", buf);
- }
- result = PASS;
- }
- pclose(fp);
- return result;
- }
- int DiffTimeb(struct timeb ST, struct timeb ET) {
- //return milli-second
- unsigned int StartTime, StopTime;
- StartTime = (unsigned int) ST.time;
- StopTime = (unsigned int) ET.time;
- return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
- }
- //=================================
- // Common routine
- //=================================
- void trim(char *s) {
- int i = 0, j, k, l = 0;
- while ((s[i] == ' ') || (s[i] == '\t') || (s[i] == '\n'))
- i++;
- j = strlen(s) - 1;
- while ((s[j] == ' ') || (s[j] == '\t') || (s[j] == '\n'))
- j--;
- if (i == 0 && j == strlen(s) - 1) {
- } else if (i == 0)
- s[j + 1] = '\0';
- else {
- for (k = i; k <= j; k++)
- s[l++] = s[k];
- s[l] = '\0';
- }
- }
- int mystrcmp(char *p1, char *p2) {
- while (*p1 == *p2) {
- if (*p1 == '\0' || *p2 == '\0')
- break;
- p1++;
- p2++;
- }
- if (*p1 == '\0' && *p2 == '\0')
- return (PASS);
- else
- return (FAIL);
- }
- void substr(char *dest, const char* src, unsigned int start, unsigned int cnt) {
- strncpy(dest, src + start, cnt);
- dest[cnt] = 0;
- }
- void split(char **arr, char *str, const char *del) {
- char *s = strtok(str, del);
- while (s != NULL) {
- *arr++ = s;
- s = strtok(NULL, del);
- }
- }
- int ConnectorType(char* connector){
- int result;
- if(strcmp(connector, "0") == 0){
- result= 0;
- }
- else if(strcmp(connector, "U") == 0 || strcmp(connector, "V") == 0 || strcmp(connector, "E") == 0 || strcmp(connector, "F") == 0 || strcmp(connector, "T") == 0 || strcmp(connector, "D") == 0 || strcmp(connector, "M") == 0 || strcmp(connector, "N") == 0 || strcmp(connector, "P") == 0 || strcmp(connector, "R") == 0 || strcmp(connector, "Y") == 0 || strcmp(connector, "Z") == 0 || strcmp(connector, "I") == 0 || strcmp(connector, "Q") == 0){
- result= 1;//CCS
- }
- else if(strcmp(connector, "G") == 0 || strcmp(connector, "B") == 0){
- result= 2;//GB
- }
- else if(strcmp(connector, "J") == 0 || strcmp(connector, "K") == 0 || strcmp(connector, "L") == 0 || strcmp(connector, "S") == 0 || strcmp(connector, "O") == 0){
- result= 3;//CHAdeMO
- }
- 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 || strcmp(connector, "7") == 0 || strcmp(connector, "8") == 0){
- result= 4;//AC
- }
- else{
- result= 0;
- }
- return result;
- }
- int ModelType(char* type,char* network){
- int result=0;
- if(strcmp(type, "A") == 0){
- if(strcmp(network, "0") == 0 || strcmp(network, "R") == 0 || strcmp(network, "B") == 0){
- result=0;
- }
- else if(strcmp(network, "E") == 0 || strcmp(network, "W") == 0 || strcmp(network, "T") == 0 || strcmp(network, "U") == 0){
- result=1;
- }
- }
- else if(strcmp(type, "D") == 0){
- result=2;
- }
- return result;
- }
- // 四捨五入 取到 小數點第 2 位
- float rounding(float a)
- {
- return (int)(a*100+0.5)/100.0;
- }
- //==========================================
- // Init all share memory
- //==========================================
- int InitShareMemory() {
- int result = PASS;
- int MeterSMId;
- //creat ShmSysConfigAndInfo
- if ((MeterSMId = shmget(ShmSysConfigAndInfoKey,
- sizeof(struct SysConfigAndInfo), 0777)) < 0) {
- printf("%s\n","InitShareMemory Error");
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
- #endif
- result = FAIL;
- } else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0))
- == (void *) -1) {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
- #endif
- result = FAIL;
- } else {
- }
- //creat ShmStatusCodeData
- if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),
- 0777)) < 0) {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
- #endif
- result = FAIL;
- } else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
- #endif
- result = FAIL;
- } else {
- }
- //creat ShmPsuData
- if ((MeterSMId = shmget(ShmPsuKey, sizeof(struct PsuData),
- 0777)) < 0) {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmget ShmPsuData NG\n");
- #endif
- result = FAIL;
- } else if ((ShmPsuData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmat ShmPsuData NG\n");
- #endif
- result = FAIL;
- } else {
- }
- //creat ShmPrimaryMcuData
- if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData),
- 0777)) < 0) {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmget ShmPrimaryMcuData NG\n");
- #endif
- result = FAIL;
- } else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
- #ifdef SystemLogMessage
- DEBUG_ERROR("shmat ShmPrimaryMcuData NG\n");
- #endif
- result = FAIL;
- } else {
- }
- //creat ShmOCPP16Data
- if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
- {
- DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
- result = FAIL;
- }
- else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
- result = FAIL;
- }
- //creat ShmOCPP20Data
- if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), 0777)) < 0)
- {
- DEBUG_ERROR("shmget OCPP20Data NG\n");
- result = FAIL;
- }
- else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- DEBUG_ERROR("shmat OCPP20Data NG\n");
- result = FAIL;
- }
- #ifdef DO360
- //creat ShmChargerInfo
- if ((MeterSMId = shmget(SM_ChargerInfoKey, sizeof(ChargerInfoData), IPC_CREAT | 0777)) < 0)
- {
- #ifdef SystemLogMessage
- DEBUG_ERROR("[main]CreatShareMemory:shmget ChargerInfoData NG");
- #endif
- return 0;
- }
- else if ((ShmChargerInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
- {
- #ifdef SystemLogMessage
- DEBUG_ERROR("[WebService]CreatShareMemory:shmat ChargerInfoData NG");
- #endif
- return 0;
- } else {
- }
- // memset(ShmChargerInfo, 0, sizeof(ChargerInfoData));
- #endif
- return result;
- }
- int StoreUsrConfigData(struct SysConfigData *UsrData)
- {
- int result = PASS;
- int fd,wrd;
- unsigned int i,Chk;
- unsigned char *ptr, *BufTmp;
- Chk=0;
- ptr=(unsigned char *)UsrData;
- if((BufTmp=malloc(MtdBlockSize))!=NULL)
- {
- memset(BufTmp,0,MtdBlockSize);
- memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
- for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
- Chk+=*(BufTmp+i);
- memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
- // Output configuration to file.
- fd = open("/mnt/EvseConfig.bin", O_RDWR|O_CREAT);
- if (fd < 0)
- {
- DEBUG_ERROR("open /mnt/EvseConfig.bin NG\n");
- free(BufTmp);
- return 0;
- }
- wrd=write(fd, BufTmp, MtdBlockSize);
- close(fd);
- if(wrd<MtdBlockSize)
- {
- DEBUG_ERROR("write /mnt/EvseConfig.bin NG\n");
- free(BufTmp);
- return 0;
- }
- DEBUG_INFO("EvseConfig write to file in /mnt OK.\n");
- DEBUG_INFO("Erase /dev/mtd10.\n");
- runShellCmd("flash_erase /dev/mtd10 0 0");
- DEBUG_INFO("Write /dev/mtd10.\n");
- runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
- DEBUG_INFO("Erase /dev/mtd11.\n");
- runShellCmd("flash_erase /dev/mtd11 0 0");
- DEBUG_INFO("Write /dev/mtd11.\n");
- runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
- system("rm -f /mnt/EvseConfig.bin");
- DEBUG_INFO("EvseConfig write to flash OK\n");
- }
- else
- {
- DEBUG_ERROR("alloc BlockSize NG\r\n");
- result = FAIL;
- }
- if(BufTmp!=NULL)
- free(BufTmp);
- return result;
- }
- //================================================
- // Main process
- //================================================
- int main(int argc, char *argv[]) {
- //int InitShMry = 1;
- if (InitShareMemory() == FAIL) {
- //InitShMry = 0;
- #ifdef SystemLogMessage
- DEBUG_ERROR("InitShareMemory NG\n");
- #endif
- if (ShmStatusCodeData != NULL) {
- ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
- }
- sleep(5);
- return 0;
- }
- //web page submit
- if ((argc == 3) & (strlen(argv[1]) == 1)) {
- //web page submit system
- if (strcmp(argv[1], "1") == 0) {
- struct json_object *jobj = json_tokener_parse(argv[2]);
- json_object *val_obj = NULL;
- char *SystemId=NULL;
- char *SystemDateTime = NULL;
- int PhaseLossPolicy = 0;
- int FactoryConfiguration = 0;
- int AuthorisationMode = 0;
- int RfidCardNumEndian = 0;
- int PsuAcInputType = 0;
- char isAPP = 0;
- char isQRCode = 0;
- char isRFID = 0;
- char QRCodeMadeMode = 0;
- char *QRCodeContent = NULL;
- char Intensity = 0;
- char isAuthrizeByEVCCID = 0;
- char *DDSystemId1=NULL;
- int DDFactoryConfiguration1 = 0;
- int DDAuthorisationMode1 = 0;
- int DDRfidCardNumEndian1 = 0;
- char DDisAPP1 = 0;
- char DDisQRCode1 = 0;
- char DDisRFID1 = 0;
- char DDQRCodeMadeMode1 = 0;
- char *DDQRCodeContent1 = NULL;
- char DDIntensity1 = 0;
- char *DDSystemId2=NULL;
- int DDFactoryConfiguration2 = 0;
- int DDAuthorisationMode2 = 0;
- int DDRfidCardNumEndian2 = 0;
- char DDisAPP2 = 0;
- char DDisQRCode2 = 0;
- char DDisRFID2 = 0;
- char DDQRCodeMadeMode2 = 0;
- char *DDQRCodeContent2 = NULL;
- char DDIntensity2 = 0;
- char *DDSystemId3=NULL;
- int DDFactoryConfiguration3 = 0;
- int DDAuthorisationMode3 = 0;
- int DDRfidCardNumEndian3 = 0;
- char DDisAPP3 = 0;
- char DDisQRCode3 = 0;
- char DDisRFID3 = 0;
- char DDQRCodeMadeMode3 = 0;
- char *DDQRCodeContent3 = NULL;
- char DDIntensity3 = 0;
- char *DDSystemId4=NULL;
- int DDFactoryConfiguration4 = 0;
- int DDAuthorisationMode4 = 0;
- int DDRfidCardNumEndian4 = 0;
- char DDisAPP4 = 0;
- char DDisQRCode4 = 0;
- char DDisRFID4 = 0;
- char DDQRCodeMadeMode4 = 0;
- char *DDQRCodeContent4 = NULL;
- char DDIntensity4 = 0;
- if( json_object_object_get_ex(jobj, "SystemId", &val_obj) ) {
- SystemId = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId,SystemId);
- }
- if( json_object_object_get_ex(jobj, "SystemDateTime", &val_obj) ) {
- SystemDateTime = (char*)json_object_get_string(val_obj);
- if(strlen(SystemDateTime)>0){
- char cmd[100];
- sprintf(cmd,"date -s '%s'",SystemDateTime);
- if(system(cmd)==0){
- system("hwclock -w");
- }
- }
- }
- if( json_object_object_get_ex(jobj, "PhaseLossPolicy", &val_obj) ) {
- PhaseLossPolicy = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy = PhaseLossPolicy;
- }
- if( json_object_object_get_ex(jobj, "FactoryConfiguration", &val_obj) ) {
- FactoryConfiguration = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.FactoryConfiguration = FactoryConfiguration;
- }
- if( json_object_object_get_ex(jobj, "AuthorisationMode", &val_obj) ) {
- AuthorisationMode = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.AuthorisationMode = AuthorisationMode;
- }
- if( json_object_object_get_ex(jobj, "RfidCardNumEndian", &val_obj) ) {
- RfidCardNumEndian = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = RfidCardNumEndian;
- }
- if( json_object_object_get_ex(jobj, "PsuAcInputType", &val_obj) ) {
- PsuAcInputType = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.PsuAcInputType = PsuAcInputType;
- }
- if( json_object_object_get_ex(jobj, "isAPP", &val_obj) ) {
- isAPP = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.isAPP = isAPP;
- }
- if( json_object_object_get_ex(jobj, "isQRCode", &val_obj) ) {
- isQRCode = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.isQRCode = isQRCode;
- }
- if( json_object_object_get_ex(jobj, "isRFID", &val_obj) ) {
- isRFID = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.isRFID = isRFID;
- }
- if( json_object_object_get_ex(jobj, "QRCodeMadeMode", &val_obj) ) {
- QRCodeMadeMode = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode = QRCodeMadeMode;
- }
- if( json_object_object_get_ex(jobj, "QRCodeContent", &val_obj) ) {
- QRCodeContent = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.QRCodeContent,QRCodeContent);
- }
- if( json_object_object_get_ex(jobj, "Intensity", &val_obj) ) {
- Intensity = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity = Intensity;
- }
- if( json_object_object_get_ex(jobj, "isAuthrizeByEVCCID", &val_obj) ) {
- isAuthrizeByEVCCID = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.isAuthrizeByEVCCID = isAuthrizeByEVCCID;
- }
- if( json_object_object_get_ex(jobj, "DDSystemId1", &val_obj) ) {
- DDSystemId1 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].SystemId,DDSystemId1);
- }
- if( json_object_object_get_ex(jobj, "DDFactoryConfiguration1", &val_obj) ) {
- DDFactoryConfiguration1 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].FactoryConfiguration = DDFactoryConfiguration1;
- }
- if( json_object_object_get_ex(jobj, "DDAuthorisationMode1", &val_obj) ) {
- DDAuthorisationMode1 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].AuthorisationMode = DDAuthorisationMode1;
- }
- if( json_object_object_get_ex(jobj, "DDRfidCardNumEndian1", &val_obj) ) {
- DDRfidCardNumEndian1 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].RfidCardNumEndian = DDRfidCardNumEndian1;
- }
- if( json_object_object_get_ex(jobj, "DDisAPP1", &val_obj) ) {
- DDisAPP1 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].isAPP = DDisAPP1;
- }
- if( json_object_object_get_ex(jobj, "DDisQRCode1", &val_obj) ) {
- DDisQRCode1 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].isQRCode = DDisQRCode1;
- }
- if( json_object_object_get_ex(jobj, "DDisRFID1", &val_obj) ) {
- DDisRFID1 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].isRFID = DDisRFID1;
- }
- if( json_object_object_get_ex(jobj, "DDQRCodeMadeMode1", &val_obj) ) {
- DDQRCodeMadeMode1 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].QRCodeMadeMode = DDQRCodeMadeMode1;
- }
- if( json_object_object_get_ex(jobj, "DDQRCodeContent1", &val_obj) ) {
- DDQRCodeContent1 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].QRCodeContent,DDQRCodeContent1);
- }
- if( json_object_object_get_ex(jobj, "DDIntensity1", &val_obj) ) {
- DDIntensity1 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].LedInfo.Intensity = DDIntensity1;
- }
- if( json_object_object_get_ex(jobj, "DDSystemId2", &val_obj) ) {
- DDSystemId2 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].SystemId,DDSystemId2);
- }
- if( json_object_object_get_ex(jobj, "DDFactoryConfiguration2", &val_obj) ) {
- DDFactoryConfiguration2 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].FactoryConfiguration = DDFactoryConfiguration2;
- }
- if( json_object_object_get_ex(jobj, "DDAuthorisationMode2", &val_obj) ) {
- DDAuthorisationMode2 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].AuthorisationMode = DDAuthorisationMode2;
- }
- if( json_object_object_get_ex(jobj, "DDRfidCardNumEndian2", &val_obj) ) {
- DDRfidCardNumEndian2 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].RfidCardNumEndian = DDRfidCardNumEndian2;
- }
- if( json_object_object_get_ex(jobj, "DDisAPP2", &val_obj) ) {
- DDisAPP2 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].isAPP = DDisAPP2;
- }
- if( json_object_object_get_ex(jobj, "DDisQRCode2", &val_obj) ) {
- DDisQRCode2 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].isQRCode = DDisQRCode2;
- }
- if( json_object_object_get_ex(jobj, "DDisRFID2", &val_obj) ) {
- DDisRFID2 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].isRFID = DDisRFID2;
- }
- if( json_object_object_get_ex(jobj, "DDQRCodeMadeMode2", &val_obj) ) {
- DDQRCodeMadeMode2 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].QRCodeMadeMode = DDQRCodeMadeMode2;
- }
- if( json_object_object_get_ex(jobj, "DDQRCodeContent2", &val_obj) ) {
- DDQRCodeContent2 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].QRCodeContent,DDQRCodeContent2);
- }
- if( json_object_object_get_ex(jobj, "DDIntensity2", &val_obj) ) {
- DDIntensity2 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].LedInfo.Intensity = DDIntensity2;
- }
- if( json_object_object_get_ex(jobj, "DDSystemId3", &val_obj) ) {
- DDSystemId3 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].SystemId,DDSystemId3);
- }
- if( json_object_object_get_ex(jobj, "DDFactoryConfiguration3", &val_obj) ) {
- DDFactoryConfiguration3 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].FactoryConfiguration = DDFactoryConfiguration3;
- }
- if( json_object_object_get_ex(jobj, "DDAuthorisationMode3", &val_obj) ) {
- DDAuthorisationMode3 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].AuthorisationMode = DDAuthorisationMode3;
- }
- if( json_object_object_get_ex(jobj, "DDRfidCardNumEndian3", &val_obj) ) {
- DDRfidCardNumEndian3 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].RfidCardNumEndian = DDRfidCardNumEndian3;
- }
- if( json_object_object_get_ex(jobj, "DDisAPP3", &val_obj) ) {
- DDisAPP3 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].isAPP = DDisAPP3;
- }
- if( json_object_object_get_ex(jobj, "DDisQRCode3", &val_obj) ) {
- DDisQRCode3 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].isQRCode = DDisQRCode3;
- }
- if( json_object_object_get_ex(jobj, "DDisRFID3", &val_obj) ) {
- DDisRFID3 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].isRFID = DDisRFID3;
- }
- if( json_object_object_get_ex(jobj, "DDQRCodeMadeMode3", &val_obj) ) {
- DDQRCodeMadeMode3 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].QRCodeMadeMode = DDQRCodeMadeMode3;
- }
- if( json_object_object_get_ex(jobj, "DDQRCodeContent3", &val_obj) ) {
- DDQRCodeContent3 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].QRCodeContent,DDQRCodeContent3);
- }
- if( json_object_object_get_ex(jobj, "DDIntensity3", &val_obj) ) {
- DDIntensity3 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[2].LedInfo.Intensity = DDIntensity3;
- }
- if( json_object_object_get_ex(jobj, "DDSystemId4", &val_obj) ) {
- DDSystemId4 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].SystemId,DDSystemId4);
- }
- if( json_object_object_get_ex(jobj, "DDFactoryConfiguration4", &val_obj) ) {
- DDFactoryConfiguration4 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].FactoryConfiguration = DDFactoryConfiguration4;
- }
- if( json_object_object_get_ex(jobj, "DDAuthorisationMode4", &val_obj) ) {
- DDAuthorisationMode4 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].AuthorisationMode = DDAuthorisationMode4;
- }
- if( json_object_object_get_ex(jobj, "DDRfidCardNumEndian4", &val_obj) ) {
- DDRfidCardNumEndian4 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].RfidCardNumEndian = DDRfidCardNumEndian4;
- }
- if( json_object_object_get_ex(jobj, "DDisAPP4", &val_obj) ) {
- DDisAPP4 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].isAPP = DDisAPP4;
- }
- if( json_object_object_get_ex(jobj, "DDisQRCode4", &val_obj) ) {
- DDisQRCode4 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].isQRCode = DDisQRCode4;
- }
- if( json_object_object_get_ex(jobj, "DDisRFID4", &val_obj) ) {
- DDisRFID4 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].isRFID = DDisRFID4;
- }
- if( json_object_object_get_ex(jobj, "DDQRCodeMadeMode4", &val_obj) ) {
- DDQRCodeMadeMode4 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].QRCodeMadeMode = DDQRCodeMadeMode4;
- }
- if( json_object_object_get_ex(jobj, "DDQRCodeContent4", &val_obj) ) {
- DDQRCodeContent4 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].QRCodeContent,DDQRCodeContent4);
- }
- if( json_object_object_get_ex(jobj, "DDIntensity4", &val_obj) ) {
- DDIntensity4 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[3].LedInfo.Intensity = DDIntensity4;
- }
- }
- if (strcmp(argv[1], "2") == 0) {
- struct json_object *jobj = json_tokener_parse(argv[2]);
- json_object *val_obj = NULL;
- int MaxChargingEnergy= 0;
- int MaxChargingPower = 0;
- int MaxChargingCurrent = 0;
- int MaxChargingVoltage = 0;
- int AcMaxChargingCurrent = 0;
- int MaxChargingDuration = 0;
- int MaxChargingSoc = 0;
- int StopChargingByButton = 0;
- int FanControlPolicy = 0;
- int isEnable15118 = 0;
- int isEnableR2R = 0;
- char *LocalWhiteCard0 = NULL;
- char *LocalWhiteCard1 = NULL;
- char *LocalWhiteCard2 = NULL;
- char *LocalWhiteCard3 = NULL;
- char *LocalWhiteCard4 = NULL;
- char *LocalWhiteCard5 = NULL;
- char *LocalWhiteCard6 = NULL;
- char *LocalWhiteCard7 = NULL;
- char *LocalWhiteCard8 = NULL;
- char *LocalWhiteCard9 = NULL;
- char isBilling = 0;
- char Currency = 0;
- float Fee0 = 0;
- float Fee1 = 0;
- float Fee2 = 0;
- float Fee3 = 0;
- float Fee4 = 0;
- float Fee5 = 0;
- float Fee6 = 0;
- float Fee7 = 0;
- float Fee8 = 0;
- float Fee9 = 0;
- float Fee10 = 0;
- float Fee11 = 0;
- float Fee12 = 0;
- float Fee13 = 0;
- float Fee14 = 0;
- float Fee15 = 0;
- float Fee16 = 0;
- float Fee17 = 0;
- float Fee18 = 0;
- float Fee19 = 0;
- float Fee20 = 0;
- float Fee21 = 0;
- float Fee22 = 0;
- float Fee23 = 0;
- if( json_object_object_get_ex(jobj, "MaxChargingEnergy", &val_obj) ) {
- MaxChargingEnergy = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy = MaxChargingEnergy;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingPower", &val_obj) ) {
- MaxChargingPower = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingPower = MaxChargingPower;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingCurrent", &val_obj) ) {
- MaxChargingCurrent = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent = MaxChargingCurrent;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingVoltage", &val_obj) ) {
- MaxChargingVoltage = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingVoltage = MaxChargingVoltage;
- }
- if( json_object_object_get_ex(jobj, "AcMaxChargingCurrent", &val_obj) ) {
- AcMaxChargingCurrent = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent = AcMaxChargingCurrent;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingDuration", &val_obj) ) {
- MaxChargingDuration = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingDuration = MaxChargingDuration;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingSoc", &val_obj) ) {
- MaxChargingSoc = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingSoc = MaxChargingSoc;
- }
- if( json_object_object_get_ex(jobj, "StopChargingByButton", &val_obj) ) {
- StopChargingByButton = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.StopChargingByButton = StopChargingByButton;
- }
- if( json_object_object_get_ex(jobj, "FanControlPolicy", &val_obj) ) {
- FanControlPolicy = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.FanControlPolicy = FanControlPolicy;
- }
- if( json_object_object_get_ex(jobj, "isEnable15118", &val_obj) ) {
- isEnable15118 = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.isEnable15118 = isEnable15118;
- }
- if( json_object_object_get_ex(jobj, "isEnableR2R", &val_obj) ) {
- isEnableR2R = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.isEnableR2R = isEnableR2R;
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard0", &val_obj) ) {
- LocalWhiteCard0 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0],LocalWhiteCard0);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard1", &val_obj) ) {
- LocalWhiteCard1 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1],LocalWhiteCard1);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard2", &val_obj) ) {
- LocalWhiteCard2 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2],LocalWhiteCard2);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard3", &val_obj) ) {
- LocalWhiteCard3 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3],LocalWhiteCard3);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard4", &val_obj) ) {
- LocalWhiteCard4 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4],LocalWhiteCard4);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard5", &val_obj) ) {
- LocalWhiteCard5 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5],LocalWhiteCard5);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard6", &val_obj) ) {
- LocalWhiteCard6 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6],LocalWhiteCard6);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard7", &val_obj) ) {
- LocalWhiteCard7 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7],LocalWhiteCard7);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard8", &val_obj) ) {
- LocalWhiteCard8 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8],LocalWhiteCard8);
- }
- if( json_object_object_get_ex(jobj, "LocalWhiteCard9", &val_obj) ) {
- LocalWhiteCard9 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9],LocalWhiteCard9);
- }
- if( json_object_object_get_ex(jobj, "isBilling", &val_obj) ) {
- isBilling = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.isBilling = isBilling;
- }
- if( json_object_object_get_ex(jobj, "Currency", &val_obj) ) {
- Currency = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Currency = Currency;
- }
- if( json_object_object_get_ex(jobj, "Fee0", &val_obj) ) {
- Fee0 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[0] = rounding(Fee0);
- }
- if( json_object_object_get_ex(jobj, "Fee1", &val_obj) ) {
- Fee1 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[1] = rounding(Fee1);
- }
- if( json_object_object_get_ex(jobj, "Fee2", &val_obj) ) {
- Fee2 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[2] = rounding(Fee2);
- }
- if( json_object_object_get_ex(jobj, "Fee3", &val_obj) ) {
- Fee3 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[3] = rounding(Fee3);
- }
- if( json_object_object_get_ex(jobj, "Fee4", &val_obj) ) {
- Fee4 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[4] = rounding(Fee4);
- }
- if( json_object_object_get_ex(jobj, "Fee5", &val_obj) ) {
- Fee5 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[5] = rounding(Fee5);
- }
- if( json_object_object_get_ex(jobj, "Fee6", &val_obj) ) {
- Fee6 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[6] = rounding(Fee6);
- }
- if( json_object_object_get_ex(jobj, "Fee7", &val_obj) ) {
- Fee7 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[7] = rounding(Fee7);
- }
- if( json_object_object_get_ex(jobj, "Fee8", &val_obj) ) {
- Fee8 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[8] = rounding(Fee8);
- }
- if( json_object_object_get_ex(jobj, "Fee9", &val_obj) ) {
- Fee9 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[9] = rounding(Fee9);
- }
- if( json_object_object_get_ex(jobj, "Fee10", &val_obj) ) {
- Fee10 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[10] = rounding(Fee10);
- }
- if( json_object_object_get_ex(jobj, "Fee11", &val_obj) ) {
- Fee11 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[11] = rounding(Fee11);
- }
- if( json_object_object_get_ex(jobj, "Fee12", &val_obj) ) {
- Fee12 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[12] = rounding(Fee12);
- }
- if( json_object_object_get_ex(jobj, "Fee13", &val_obj) ) {
- Fee13 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[13] = rounding(Fee13);
- }
- if( json_object_object_get_ex(jobj, "Fee14", &val_obj) ) {
- Fee14 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[14] = rounding(Fee14);
- }
- if( json_object_object_get_ex(jobj, "Fee15", &val_obj) ) {
- Fee15 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[15] = rounding(Fee15);
- }
- if( json_object_object_get_ex(jobj, "Fee16", &val_obj) ) {
- Fee16 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[16] = rounding(Fee16);
- }
- if( json_object_object_get_ex(jobj, "Fee17", &val_obj) ) {
- Fee17 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[17] = rounding(Fee17);
- }
- if( json_object_object_get_ex(jobj, "Fee18", &val_obj) ) {
- Fee18 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[18] = rounding(Fee18);
- }
- if( json_object_object_get_ex(jobj, "Fee19", &val_obj) ) {
- Fee19 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[19] = rounding(Fee19);
- }
- if( json_object_object_get_ex(jobj, "Fee20", &val_obj) ) {
- Fee20 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[20] = rounding(Fee20);
- }
- if( json_object_object_get_ex(jobj, "Fee21", &val_obj) ) {
- Fee21 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[21] = rounding(Fee21);
- }
- if( json_object_object_get_ex(jobj, "Fee22", &val_obj) ) {
- Fee22 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[22] = rounding(Fee22);
- }
- if( json_object_object_get_ex(jobj, "Fee23", &val_obj) ) {
- Fee23 = json_object_get_double(val_obj);
- ShmSysConfigAndInfo->SysConfig.BillingData.Fee[23] = rounding(Fee23);
- }
- }
- if (strcmp(argv[1], "3") == 0) {
- struct json_object *jobj = json_tokener_parse(argv[2]);
- json_object *val_obj = NULL;
- int Eth0DhcpClient=0;
- char *Eth0IpAddress=NULL;
- char *Eth0SubmaskAddress=NULL;
- char *Eth0GatewayAddress=NULL;
- int WifiMode=0;
- char *WifiSsid=NULL;
- char *WifiPassword=NULL;
- int WifiBroadcastSsid=0;
- char *WifiTargetBssidMac=NULL;
- int WifiDhcpServer=0;
- int WifiDhcpClient=0;
- char *WifiIpAddress=NULL;
- char *WifiSubmaskAddress=NULL;
- char *WifiGatewayAddress=NULL;
- char *TelcomApn=NULL;
- char *TelcomChapPapId=NULL;
- char *TelcomChapPapPwd=NULL;
- char *TelcomIpAddress=NULL;
- char TelcomEnabled=0;
- char TelcomNetworkType=0;
- char Wcnt=0;
- char Tcnt=0;
- char isEnalbleFirewall=0;
- char *FirewallAcceptAddr0=NULL;
- char *FirewallAcceptAddr1=NULL;
- char *FirewallAcceptAddr2=NULL;
- char *FirewallAcceptAddr3=NULL;
- char *FirewallAcceptAddr4=NULL;
- char *FirewallAcceptAddr5=NULL;
- char *FirewallAcceptAddr6=NULL;
- char *FirewallAcceptAddr7=NULL;
- char *FirewallAcceptAddr8=NULL;
- char *FirewallAcceptAddr9=NULL;
- if( json_object_object_get_ex(jobj, "Eth0DhcpClient", &val_obj) ) {
- Eth0DhcpClient = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=Eth0DhcpClient;
- }
- if( json_object_object_get_ex(jobj, "Eth0IpAddress", &val_obj) ) {
- Eth0IpAddress = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,Eth0IpAddress);
- }
- if( json_object_object_get_ex(jobj, "Eth0SubmaskAddress", &val_obj) ) {
- Eth0SubmaskAddress = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,Eth0SubmaskAddress);
- }
- if( json_object_object_get_ex(jobj, "Eth0GatewayAddress", &val_obj) ) {
- Eth0GatewayAddress = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,Eth0GatewayAddress);
- }
- if( json_object_object_get_ex(jobj, "WifiMode", &val_obj) ) {
- WifiMode = json_object_get_int(val_obj);
- if(WifiMode!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode) Wcnt++;
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=WifiMode;
- }
- if( json_object_object_get_ex(jobj, "WifiSsid", &val_obj) ) {
- WifiSsid = (char*)json_object_get_string(val_obj);
- if (strcmp(WifiSsid, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid) != 0) Wcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,WifiSsid);
- }
- if( json_object_object_get_ex(jobj, "WifiPassword", &val_obj) ) {
- WifiPassword = (char*)json_object_get_string(val_obj);
- if (strcmp(WifiSsid, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid) != 0) Wcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,WifiPassword);
- }
- if( json_object_object_get_ex(jobj, "WifiBroadcastSsid", &val_obj) ) {
- WifiBroadcastSsid = json_object_get_int(val_obj);
- if(WifiBroadcastSsid!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiBroadcastSsid) Wcnt++;
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiBroadcastSsid=WifiBroadcastSsid;
- }
- if( json_object_object_get_ex(jobj, "WifiTargetBssidMac", &val_obj) ) {
- WifiTargetBssidMac = (char*)json_object_get_string(val_obj);
- if (strcmp(WifiTargetBssidMac, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiTargetBssidMac) != 0) Wcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiTargetBssidMac,WifiTargetBssidMac);
- }
- if( json_object_object_get_ex(jobj, "WifiDhcpServer", &val_obj) ) {
- WifiDhcpServer = json_object_get_int(val_obj);
- if(WifiDhcpServer!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer) Wcnt++;
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=WifiDhcpServer;
- }
- if( json_object_object_get_ex(jobj, "WifiDhcpClient", &val_obj) ) {
- WifiDhcpClient = json_object_get_int(val_obj);
- if(WifiDhcpClient!=ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient) Wcnt++;
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=WifiDhcpClient;
- }
- if( json_object_object_get_ex(jobj, "WifiIpAddress", &val_obj) ) {
- WifiIpAddress = (char*)json_object_get_string(val_obj);
- if (strcmp(WifiIpAddress, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress) != 0) Wcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,WifiIpAddress);
- }
- if( json_object_object_get_ex(jobj, "WifiSubmaskAddress", &val_obj) ) {
- WifiSubmaskAddress = (char*)json_object_get_string(val_obj);
- if (strcmp(WifiSubmaskAddress, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress) != 0) Wcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,WifiSubmaskAddress);
- }
- if( json_object_object_get_ex(jobj, "WifiGatewayAddress", &val_obj) ) {
- WifiGatewayAddress = (char*)json_object_get_string(val_obj);
- if (strcmp(WifiGatewayAddress, (char*)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress) != 0) Wcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,WifiGatewayAddress);
- }
- if( json_object_object_get_ex(jobj, "TelcomApn", &val_obj) ) {
- TelcomApn = (char*)json_object_get_string(val_obj);
- if (strcmp(TelcomApn, (char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn) != 0) Tcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,TelcomApn);
- }
- if( json_object_object_get_ex(jobj, "TelcomChapPapId", &val_obj) ) {
- TelcomChapPapId = (char*)json_object_get_string(val_obj);
- if (strcmp(TelcomChapPapId, (char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId) != 0) Tcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,TelcomChapPapId);
- }
- if( json_object_object_get_ex(jobj, "TelcomChapPapPwd", &val_obj) ) {
- TelcomChapPapPwd = (char*)json_object_get_string(val_obj);
- if (strcmp(TelcomChapPapPwd, (char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd) != 0) Tcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,TelcomChapPapPwd);
- }
- if( json_object_object_get_ex(jobj, "TelcomIpAddress", &val_obj) ) {
- TelcomIpAddress = (char*)json_object_get_string(val_obj);
- if (strcmp(TelcomIpAddress, (char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress) != 0) Tcnt++;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,TelcomIpAddress);
- }
- if( json_object_object_get_ex(jobj, "TelcomEnabled", &val_obj) ) {
- TelcomEnabled = json_object_get_int(val_obj);
- if(TelcomEnabled!=ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled) Tcnt++;
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled=TelcomEnabled;
- }
- if( json_object_object_get_ex(jobj, "TelcomNetworkType", &val_obj) ) {
- TelcomNetworkType = json_object_get_int(val_obj);
- if(TelcomNetworkType!=ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkType) Tcnt++;
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkType=TelcomNetworkType;
- }
- if( json_object_object_get_ex(jobj, "isEnalbleFirewall", &val_obj) ) {
- isEnalbleFirewall = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.isEnalbleFirewall=isEnalbleFirewall;
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr0", &val_obj) ) {
- FirewallAcceptAddr0 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[0],FirewallAcceptAddr0);
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr1", &val_obj) ) {
- FirewallAcceptAddr1 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[1],FirewallAcceptAddr1);
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr2", &val_obj) ) {
- FirewallAcceptAddr2 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[2],FirewallAcceptAddr2);
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr3", &val_obj) ) {
- FirewallAcceptAddr3 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[3],FirewallAcceptAddr3);
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr4", &val_obj) ) {
- FirewallAcceptAddr4 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[4],FirewallAcceptAddr4);
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr5", &val_obj) ) {
- FirewallAcceptAddr5 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[5],FirewallAcceptAddr5);
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr6", &val_obj) ) {
- FirewallAcceptAddr6 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[6],FirewallAcceptAddr6);
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr7", &val_obj) ) {
- FirewallAcceptAddr7 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[7],FirewallAcceptAddr7);
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr8", &val_obj) ) {
- FirewallAcceptAddr8 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[8],FirewallAcceptAddr8);
- }
- if( json_object_object_get_ex(jobj, "FirewallAcceptAddr9", &val_obj) ) {
- FirewallAcceptAddr9 = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[9],FirewallAcceptAddr9);
- }
- if(Wcnt>0){
- system ("pkill Module_Wifi");
- }
- if(Tcnt>0){
- system ("pkill Module_4g");
- system ("killall 4GDetection");
- system ("killall pppd");
- }
- }
- if (strcmp(argv[1], "4") == 0) {
- struct json_object *jobj = json_tokener_parse(argv[2]);
- json_object *val_obj = NULL;
- int BackendConnTimeout=0;
- int OfflinePolicy=0;
- int OfflineMaxChargeEnergy=0;
- int OfflineMaxChargeDuration=0;
- char *OcppServerURL=NULL;
- char *ChargeBoxId=NULL;
- char *chargePointVendor=NULL;
- int OcppSecurityProfile=0;
- int MaintainServerSecurityProfile=0;
- char *OcppSecurityPassword=NULL;
- char *MaintainServerSecurityPassword=NULL;
- int isEnableLocalPowerSharging=0;
- int PowerSharingCapacity=0;
- char *PowerSharingServerIP=NULL;
- char *OcppReceiptrURL=NULL;
- char *MaintainServerURL=NULL;
- /*for TTIA*/
- char isEnableTTIA=0;
- char *server_addr=NULL;
- int server_port=0;
- int busVenderId=0;
- char *EquipmentProvider=NULL;
- char TransportationCompanyNo=0;
- char TTIAChargeBoxId=0;
- char *evseStation=NULL;
- if( json_object_object_get_ex(jobj, "BackendConnTimeout", &val_obj) ) {
- BackendConnTimeout = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.BackendConnTimeout = BackendConnTimeout;
- }
- if( json_object_object_get_ex(jobj, "OfflinePolicy", &val_obj) ) {
- OfflinePolicy = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.OfflinePolicy = OfflinePolicy;
- }
- if( json_object_object_get_ex(jobj, "OfflineMaxChargeEnergy", &val_obj) ) {
- OfflineMaxChargeEnergy = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy = OfflineMaxChargeEnergy;
- }
- if( json_object_object_get_ex(jobj, "OfflineMaxChargeDuration", &val_obj) ) {
- OfflineMaxChargeDuration = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration = OfflineMaxChargeDuration;
- }
- if( json_object_object_get_ex(jobj, "OcppServerURL", &val_obj) ) {
- OcppServerURL = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,OcppServerURL);
- }
- if( json_object_object_get_ex(jobj, "ChargeBoxId", &val_obj) ) {
- ChargeBoxId = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,ChargeBoxId);
- }
- if( json_object_object_get_ex(jobj, "chargePointVendor", &val_obj) ) {
- chargePointVendor = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor,chargePointVendor);
- }
- if( json_object_object_get_ex(jobj, "OcppSecurityProfile", &val_obj) ) {
- OcppSecurityProfile = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile = OcppSecurityProfile;
- }
- if( json_object_object_get_ex(jobj, "OcppSecurityPassword", &val_obj) ) {
- OcppSecurityPassword = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword,OcppSecurityPassword);
- }
- if( json_object_object_get_ex(jobj, "MaintainServerSecurityProfile", &val_obj) ) {
- MaintainServerSecurityProfile = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile = MaintainServerSecurityProfile;
- }
- if( json_object_object_get_ex(jobj, "MaintainServerSecurityPassword", &val_obj) ) {
- MaintainServerSecurityPassword = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityPassword,MaintainServerSecurityPassword);
- }
- if( json_object_object_get_ex(jobj, "isEnableLocalPowerSharging", &val_obj) ) {
- isEnableLocalPowerSharging = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing = isEnableLocalPowerSharging;
- }
- if( json_object_object_get_ex(jobj, "PowerSharingCapacity", &val_obj) ) {
- PowerSharingCapacity = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.PowerSharingCapacityPower = PowerSharingCapacity;
- }
- if( json_object_object_get_ex(jobj, "PowerSharingServerIP", &val_obj) ) {
- PowerSharingServerIP = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP,PowerSharingServerIP);
- }
- if( json_object_object_get_ex(jobj, "OcppReceiptrURL", &val_obj) ) {
- OcppReceiptrURL = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL,OcppReceiptrURL);
- }
- if( json_object_object_get_ex(jobj, "MaintainServerURL", &val_obj) ) {
- MaintainServerURL = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL,MaintainServerURL);
- }
- /*for TTIA*/
- if( json_object_object_get_ex(jobj, "isEnableTTIA", &val_obj) ) {
- isEnableTTIA = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.TTIA_Info.isEnableTTIA = isEnableTTIA;
- }
- if( json_object_object_get_ex(jobj, "server_addr", &val_obj) ) {
- server_addr = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_addr,server_addr);
- }
- if( json_object_object_get_ex(jobj, "server_port", &val_obj) ) {
- server_port = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_port = server_port;
- }
- if( json_object_object_get_ex(jobj, "busVenderId", &val_obj) ) {
- busVenderId = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.TTIA_Info.busVenderId = busVenderId;
- }
- if( json_object_object_get_ex(jobj, "EquipmentProvider", &val_obj) ) {
- EquipmentProvider = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TTIA_Info.EquipmentProvider,EquipmentProvider);
- }
- if( json_object_object_get_ex(jobj, "TransportationCompanyNo", &val_obj) ) {
- TransportationCompanyNo = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.TTIA_Info.TransportationCompanyNo = TransportationCompanyNo;
- }
- if( json_object_object_get_ex(jobj, "TTIAChargeBoxId", &val_obj) ) {
- TTIAChargeBoxId = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.TTIA_Info.ChargeBoxId = TTIAChargeBoxId;
- }
- if( json_object_object_get_ex(jobj, "evseStation", &val_obj) ) {
- evseStation = (char*)json_object_get_string(val_obj);
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TTIA_Info.evseStation,evseStation);
- }
- }
- struct SysConfigData SysConfig;
- memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
- int result = StoreUsrConfigData(&SysConfig);
- if(result != 1){
- #ifdef SystemLogMessage
- StoreLogMsg("[WebService]StoreUsrConfigData: normal NG");
- #endif
- }
- else{
- #ifdef SystemLogMessage
- StoreLogMsg("[WebService]StoreUsrConfigData: normal OK");
- #endif
- }
- #ifdef SystemLogMessage
- DEBUG_INFO("WebServiceConfig update OK");
- #endif
- }
- //web api
- if ((argc == 3) & (strlen(argv[1]) == 2)) {
- if (strcmp(argv[1], "21") == 0) {
- struct json_object *jobj = json_tokener_parse(argv[2]);
- json_object *val_obj = NULL;
- int MaxChargingEnergy= 0;
- int MaxChargingPower = 0;
- int MaxChargingCurrent = 0;
- int MaxChargingVoltage = 0;
- int AcMaxChargingCurrent = 0;
- int MaxChargingDuration = 0;
- int MaxChargingSoc = 0;
- if( json_object_object_get_ex(jobj, "MaxChargingEnergy", &val_obj) ) {
- MaxChargingEnergy = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy = MaxChargingEnergy;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingPower", &val_obj) ) {
- MaxChargingPower = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingPower = MaxChargingPower;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingCurrent", &val_obj) ) {
- MaxChargingCurrent = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent = MaxChargingCurrent;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingVoltage", &val_obj) ) {
- MaxChargingVoltage = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingVoltage = MaxChargingVoltage;
- }
- if( json_object_object_get_ex(jobj, "AcMaxChargingCurrent", &val_obj) ) {
- AcMaxChargingCurrent = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent = AcMaxChargingCurrent;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingDuration", &val_obj) ) {
- MaxChargingDuration = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingDuration = MaxChargingDuration;
- }
- if( json_object_object_get_ex(jobj, "MaxChargingSoc", &val_obj) ) {
- MaxChargingSoc = json_object_get_int(val_obj);
- ShmSysConfigAndInfo->SysConfig.MaxChargingSoc = MaxChargingSoc;
- }
- DEBUG_INFO("WebService Remote Api update OK");
- }
- }
- if (argc == 2)
- { //init share memory for test
- if (strcmp(argv[1], "aaa") == 0)
- {
- //struct SysConfigData SysConfig;
- //system
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity=1;
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=1;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ModelName, "DO0E362001D1P0D");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber, "SerialNumber");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemId, "1234567890");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.SystemDateTime, "2019-12-31 23:59:59");
- ShmSysConfigAndInfo->SysConfig.AcPhaseCount=1;
- ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy=0;
- ShmSysConfigAndInfo->SysInfo.FactoryConfiguration=0;
- ShmSysConfigAndInfo->SysConfig.AuthorisationMode=0;
- ShmSysConfigAndInfo->SysConfig.DefaultLanguage=0;
- ShmSysConfigAndInfo->SysInfo.InputVoltageR=0;
- ShmSysConfigAndInfo->SysInfo.InputVoltageS=0;
- ShmSysConfigAndInfo->SysInfo.InputVoltageT=0;
- ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed=0;
- ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0;
- ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian=0;
- ShmSysConfigAndInfo->SysConfig.RatingCurrent=100;
- ShmSysConfigAndInfo->SysConfig.PsuAcInputType=0;
- ShmSysConfigAndInfo->SysInfo.AuxPower5V=0;
- ShmSysConfigAndInfo->SysInfo.AuxPower12V=0;
- ShmSysConfigAndInfo->SysInfo.AuxPower24V=0;
- ShmSysConfigAndInfo->SysInfo.AuxPower48V=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev, "");
- strcpy((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev, "");
- ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp=0;
- ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp=0;
- ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp=0;
- ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp=0;
- ShmSysConfigAndInfo->SysConfig.AcPlugInTimes=0;
- ShmSysConfigAndInfo->SysConfig.GbPlugInTimes=0;
- ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime=0;
- ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes=0;
- ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes=0;
- // strcpy((char *)&ShmPsuData->PsuVersion[0].FwPrimaryVersion, "DC 9.01");
- // strcpy((char *)&ShmPsuData->PsuVersion[1].FwPrimaryVersion, "DC 9.02");
- // strcpy((char *)&ShmPsuData->PsuVersion[0].FwSecondVersion, "PFC 9.02");
- // strcpy((char *)&ShmPsuData->PsuVersion[1].FwSecondVersion, "PFC 9.03");
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=4;
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity=2;
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].ConnectorQuantity=2;
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].ConnectorQuantity=2;
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[0].LocalStatus=0;
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[1].LocalStatus=0;
- //charging
- ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy=0;
- ShmSysConfigAndInfo->SysConfig.MaxChargingPower=0;
- ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent= 0;
- ShmSysConfigAndInfo->SysConfig.MaxChargingVoltage= 0;
- ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent= 0;
- ShmSysConfigAndInfo->SysConfig.MaxChargingDuration=0;
- ShmSysConfigAndInfo->SysConfig.MaxChargingSoc=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0], "111");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1], "222");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2], "333");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3], "444");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4], "555");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5], "666");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6], "777");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7], "888");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8], "999");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9], "aaa");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.UserId, "UserId");
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingPower=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedEnergy=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargedDuration=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].RemainChargingDuration=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatteryMaxVoltage=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetVoltage=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterySoc=0;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].SystemStatus=1;
- ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].EvBatterytargetCurrent=1;
- //network
- ShmSysConfigAndInfo->SysInfo.InternetConn=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer,"");
- ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient=1;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,"192.168.1.10");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress,"255.255.255.0");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress,"192.168.1.1");
- ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient=1;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress,"192.168.0.10");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress,"255.255.255.0");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress,"192.168.0.1");
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode=1;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword,"");
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi=0;
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer=0;
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress,"");
- ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn=1;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn,"");
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid,"");
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus=0;
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress,"");
- //backend
- ShmSysConfigAndInfo->SysConfig.BackendConnTimeout=300;
- ShmSysConfigAndInfo->SysConfig.OfflinePolicy=0;
- ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy=0;
- ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration=0;
- ShmSysConfigAndInfo->SysInfo.OcppConnStatus=0;
- ShmSysConfigAndInfo->SysInfo.MaintainServerConnStatus=0;
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"");
- strcpy((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor,"Phihong");
- ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=0;
- struct SysConfigData SysConfig;
- memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
- StoreUsrConfigData(&SysConfig);
- // struct PsuModuleVer PsuData;
- // memcpy(&PsuData, &ShmPsuData->PsuVersion, sizeof(struct PsuModuleVer));
- // StoreUsrConfigData(&PsuData);
- #ifdef SystemLogMessage
- DEBUG_INFO("WebService initial OK");
- #endif
- }
- if (strcmp(argv[1], "button") == 0)
- {
- unsigned char Button1;
- unsigned char Button2;
- unsigned char EmergencyButton;
- Button1=ShmPrimaryMcuData->InputDet.bits.Button1;
- Button2=ShmPrimaryMcuData->InputDet.bits.Button2;
- EmergencyButton=ShmPrimaryMcuData->InputDet.bits.EmergencyButton;
- struct json_object *jobj;
- struct json_object *sButton1;
- struct json_object *sButton2;
- struct json_object *sEmergencyButton;
- sButton1 = json_object_new_int(Button1);
- sButton2 = json_object_new_int(Button2);
- sEmergencyButton = json_object_new_int(EmergencyButton);
- jobj=json_object_new_object();
- json_object_object_add(jobj,"Button1",sButton1);
- json_object_object_add(jobj,"Button2",sButton2);
- json_object_object_add(jobj,"EmergencyButton",sEmergencyButton);
- printf("%s\n", json_object_to_json_string(jobj));
- }
- if (strcmp(argv[1], "restart") == 0)
- {
- if((ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16) && (system("pidof -s OcppBackend > /dev/null") == 0))
- {
- sprintf((char*)ShmOCPP16Data->Reset.Type, "Hard");
- ShmOCPP16Data->MsMsg.bits.ResetReq = 1;
- DEBUG_INFO("Hard reset by OCPP1.6 form web page.\n");
- }
- else if((ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20) && (system("pidof -s OcppBackend20 > /dev/null") == 0))
- {
- sprintf((char*)ShmOCPP20Data->Reset.type, "Immediate");
- ShmOCPP20Data->MsMsg.bits.ResetReq = 1;
- DEBUG_INFO("Hard reset by OCPP2.0.1 form web page.\n");
- }
- else
- {
- //system("exec /usr/bin/run_evse_restart.sh");
- system("exec /sbin/reboot");
- DEBUG_INFO("Hard reset directly form web page.\n");
- }
- }
- }
- if(strcmp(argv[1], "log") == 0)
- {
- char cmd[512];
- char *IsDO[3];
- uint16_t Heartbeat=0;
- substr((char *)IsDO,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,2);
- if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0 || strcmp(IsDO, "DL") == 0){
- ShmSysConfigAndInfo->SysInfo.isDispenserLog=1;
- for(;;){
- if(ShmSysConfigAndInfo->SysInfo.isDispenserLog==0){
- break;
- }
- if(Heartbeat==0xb4){
- break;
- }
- else{
- Heartbeat++;
- sleep(1);
- }
- }
- }
- if((argc == 3) && isdigit(*argv[2]))
- {
- sprintf(cmd, "exec /root/logPackTools 'log' %s", argv[2]);
- }
- else
- {
- sprintf(cmd, "exec /root/logPackTools 'log'");
- }
- if(system(cmd) == 0)
- {
- DEBUG_INFO("Log pack success.\n");
- }
- else
- {
- DEBUG_INFO("Log pack fail.\n");
- }
- }
- //upgrade firmware
- if ((argc == 3) & (strcmp(argv[1], "upgrade") == 0))
- {
- struct json_object *jobj;
- struct json_object *Result;
- struct json_object *Message;
- //char cmd[100];
- jobj=json_object_new_object();
- //system
- //if((char)ShmSysConfigAndInfo->SysInfo.FirmwareUpdate == '0'){
- ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=1;
- Result = json_object_new_string("success");
- Message = json_object_new_string("File is uploaded, please wait a moment to upgrade");
- //}
- /*else{
- sprintf(cmd,"rm /mnt/%s",argv[2]);
- system(cmd);
- Result = json_object_new_string("error");
- Message = json_object_new_string("machine is busy");
- }*/
- json_object_object_add(jobj,"Result",Result);
- json_object_object_add(jobj,"Message",Message);
- printf("%s\n", json_object_to_json_string(jobj));
- }
- #ifdef DO360
- //set power cabinet
- // ./WebService "PowerCabinet" Cmd "{'FTargetVoltage': val,'FTargetCurrent': val, 'Gun': val}"
- if ((strcmp(argv[1], "PowerCabinet") == 0)) {
- char *IsDO[3];
- substr((char *)IsDO,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,2);
- if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0 || strcmp(IsDO, "DL") == 0){
- struct json_object *jobj2;
- jobj2=json_object_new_object();
- int Gun = 0;
- //force charging
- if (strcmp(argv[2], "1") == 0) {
- json_object_object_add(jobj2,"Cmd",json_object_new_string("1"));
- int FTargetVoltage = 0;
- int FTargetCurrent = 0;
- if(strlen(argv[3]) >0){
- struct json_object *jobj = json_tokener_parse(argv[3]);
- json_object *val_obj = NULL;
- if( json_object_object_get_ex(jobj, "Gun", &val_obj) ) {
- Gun = json_object_get_int(val_obj);
- if( json_object_object_get_ex(jobj, "FTargetVoltage", &val_obj) ) {
- FTargetVoltage = json_object_get_int(val_obj);
- ShmChargerInfo->Control.FCharging[Gun].FTargetVoltage = FTargetVoltage * 10;
- json_object_object_add(jobj2,"FTargetVoltage",json_object_new_int(FTargetVoltage));
- }
- if( json_object_object_get_ex(jobj, "FTargetCurrent", &val_obj) ) {
- FTargetCurrent = json_object_get_int(val_obj);
- ShmChargerInfo->Control.FCharging[Gun].FTargetCurrent = FTargetCurrent * 10;
- json_object_object_add(jobj2,"FTargetCurrent",json_object_new_int(FTargetCurrent));
- }
- ShmChargerInfo->Control.FCharging[Gun].FCtrl.bits.EnableForceCharging=1;
- ShmChargerInfo->Control.FCharging[Gun].FCtrl.bits.StartForceCharging=1;
- ShmChargerInfo->Control.FCharging[Gun].FCtrl.bits.WebApiTrigger=1;
- }
- }
- printf("%s\n", json_object_to_json_string(jobj2));
- }
- //remote stop
- if (strcmp(argv[2], "2") == 0) {
- if(strlen(argv[3]) >0){
- struct json_object *jobj = json_tokener_parse(argv[3]);
- json_object *val_obj = NULL;
- if( json_object_object_get_ex(jobj, "Gun", &val_obj) ) {
- Gun = json_object_get_int(val_obj);
- json_object_object_add(jobj2,"Cmd",json_object_new_string("2"));
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[Gun].GeneralChargingData.ChargingStopFlag.bits.ManualStop=1;
- printf("%s\n", json_object_to_json_string(jobj2));
- }
- }
- }
- if (strcmp(argv[2], "0") == 0) {
- struct json_object *jobj;
- jobj=json_object_new_object();
- struct json_object *FTargetVoltage;
- struct json_object *FTargetCurrent;
- struct json_object *EnableForceCharging;
- struct json_object *StartForceCharging;
- struct json_object *WebApiTrigger;
- struct json_object *ManualStop;
- FTargetVoltage = json_object_new_int(ShmChargerInfo->Control.FCharging[0].FTargetVoltage);
- FTargetCurrent = json_object_new_int(ShmChargerInfo->Control.FCharging[0].FTargetCurrent);
- EnableForceCharging = json_object_new_int(ShmChargerInfo->Control.FCharging[0].FCtrl.bits.EnableForceCharging);
- StartForceCharging = json_object_new_int(ShmChargerInfo->Control.FCharging[0].FCtrl.bits.StartForceCharging);
- WebApiTrigger = json_object_new_int(ShmChargerInfo->Control.FCharging[0].FCtrl.bits.WebApiTrigger);
- ManualStop = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[0].GeneralChargingData.ChargingStopFlag.bits.ManualStop);
- json_object_object_add(jobj,"FTargetVoltage0",FTargetVoltage);
- json_object_object_add(jobj,"FTargetCurrent0",FTargetCurrent);
- json_object_object_add(jobj,"EnableForceCharging0",EnableForceCharging);
- json_object_object_add(jobj,"StartForceCharging0",StartForceCharging);
- json_object_object_add(jobj,"WebApiTrigger0",WebApiTrigger);
- json_object_object_add(jobj,"ManualStop0",ManualStop);
- FTargetVoltage = json_object_new_int(ShmChargerInfo->Control.FCharging[1].FTargetVoltage);
- FTargetCurrent = json_object_new_int(ShmChargerInfo->Control.FCharging[1].FTargetCurrent);
- EnableForceCharging = json_object_new_int(ShmChargerInfo->Control.FCharging[1].FCtrl.bits.EnableForceCharging);
- StartForceCharging = json_object_new_int(ShmChargerInfo->Control.FCharging[1].FCtrl.bits.StartForceCharging);
- WebApiTrigger = json_object_new_int(ShmChargerInfo->Control.FCharging[1].FCtrl.bits.WebApiTrigger);
- ManualStop = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[1].GeneralChargingData.ChargingStopFlag.bits.ManualStop);
- json_object_object_add(jobj,"FTargetVoltage1",FTargetVoltage);
- json_object_object_add(jobj,"FTargetCurrent1",FTargetCurrent);
- json_object_object_add(jobj,"EnableForceCharging1",EnableForceCharging);
- json_object_object_add(jobj,"StartForceCharging1",StartForceCharging);
- json_object_object_add(jobj,"WebApiTrigger1",WebApiTrigger);
- json_object_object_add(jobj,"ManualStop1",ManualStop);
- FTargetVoltage = json_object_new_int(ShmChargerInfo->Control.FCharging[2].FTargetVoltage);
- FTargetCurrent = json_object_new_int(ShmChargerInfo->Control.FCharging[2].FTargetCurrent);
- EnableForceCharging = json_object_new_int(ShmChargerInfo->Control.FCharging[2].FCtrl.bits.EnableForceCharging);
- StartForceCharging = json_object_new_int(ShmChargerInfo->Control.FCharging[2].FCtrl.bits.StartForceCharging);
- WebApiTrigger = json_object_new_int(ShmChargerInfo->Control.FCharging[2].FCtrl.bits.WebApiTrigger);
- ManualStop = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[2].GeneralChargingData.ChargingStopFlag.bits.ManualStop);
- json_object_object_add(jobj,"FTargetVoltage2",FTargetVoltage);
- json_object_object_add(jobj,"FTargetCurrent2",FTargetCurrent);
- json_object_object_add(jobj,"EnableForceCharging2",EnableForceCharging);
- json_object_object_add(jobj,"StartForceCharging2",StartForceCharging);
- json_object_object_add(jobj,"WebApiTrigger2",WebApiTrigger);
- json_object_object_add(jobj,"ManualStop2",ManualStop);
- FTargetVoltage = json_object_new_int(ShmChargerInfo->Control.FCharging[3].FTargetVoltage);
- FTargetCurrent = json_object_new_int(ShmChargerInfo->Control.FCharging[3].FTargetCurrent);
- EnableForceCharging = json_object_new_int(ShmChargerInfo->Control.FCharging[3].FCtrl.bits.EnableForceCharging);
- StartForceCharging = json_object_new_int(ShmChargerInfo->Control.FCharging[3].FCtrl.bits.StartForceCharging);
- WebApiTrigger = json_object_new_int(ShmChargerInfo->Control.FCharging[3].FCtrl.bits.WebApiTrigger);
- ManualStop = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[3].GeneralChargingData.ChargingStopFlag.bits.ManualStop);
- json_object_object_add(jobj,"FTargetVoltage3",FTargetVoltage);
- json_object_object_add(jobj,"FTargetCurrent3",FTargetCurrent);
- json_object_object_add(jobj,"EnableForceCharging3",EnableForceCharging);
- json_object_object_add(jobj,"StartForceCharging3",StartForceCharging);
- json_object_object_add(jobj,"WebApiTrigger3",WebApiTrigger);
- json_object_object_add(jobj,"ManualStop3",ManualStop);
- printf("%s\n", json_object_to_json_string(jobj));
- json_object_put(jobj);
- }
- }
- }
- #endif
- //web page query all
- if ((argc == 2) & (strcmp(argv[1], "query") == 0)) {
- char *IsAcDc[2];
- char *SafetyRegulation[2];
- char *IsDO[3];
- char *Connector1[2];
- char *Connector2[2];
- char *Connector3[2];
- char *Network[2];
- //unsigned char connector1FwVer[32];
- //unsigned char connector2FwVer[32];
- short gunQty;
- char *RatedPower1[2];
- char *RatedPower2[2];
- char *RatedPower3[2];
- short RatedPower;
- short PsuQuantity = 0;
- substr((char *)IsAcDc,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,1);
- substr((char *)SafetyRegulation,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,3,1);
- substr((char *)IsDO,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,0,2);
- substr((char *)Connector1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,7,1);
- substr((char *)Connector2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,9,1);
- substr((char *)Connector3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,8,1);
- substr((char *)Network,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,10,1);
- int connectorType1,connectorType2,connectorType3;
- connectorType1=ConnectorType((char *)Connector1);
- connectorType2=ConnectorType((char *)Connector2);
- connectorType3=ConnectorType((char *)Connector3);
- if(connectorType1 == connectorType2){
- gunQty = 1;
- }
- else{
- gunQty = 0;
- }
- if(connectorType1 != 0){
- if(connectorType1 == 1){
- // strcpy((char *)&connector1FwVer,ShmCcsData->V2GMessage_DIN70121->version);
- // memcpy(connector1FwVer,ShmCcsData->V2GMessage_DIN70121->version,ARRAY_SIZE(ShmCcsData->V2GMessage_DIN70121->version));
- }
- else if(connectorType1 == 2){
- // strcpy((char *)&connector1FwVer,ShmGBTData->evse[0].version);
- // memcpy(connector1FwVer,ShmGBTData->evse[0].version,ARRAY_SIZE(ShmGBTData->evse[0].version));
- }
- else if(connectorType1 == 3){
- // strcpy((char *)&connector1FwVer,ShmCHAdeMOData->evse[0].version);
- // memcpy(connector1FwVer,ShmCHAdeMOData->evse[0].version,ARRAY_SIZE(ShmCHAdeMOData->evse[0].version));
- }
- }
- if(connectorType2 != 0){
- if(connectorType2 == 1){
- // strcpy((char *)&connector2FwVer,ShmCcsData->V2GMessage_DIN70121->version);
- // memcpy(connector2FwVer,ShmCcsData->V2GMessage_DIN70121->version,ARRAY_SIZE(ShmCcsData->V2GMessage_DIN70121->version));
- }
- else if(connectorType2 == 2){
- // strcpy((char *)&connector2FwVer,ShmGBTData->evse[gunQty].version);
- // memcpy(connector2FwVer,ShmGBTData->evse[gunQty].version,ARRAY_SIZE(ShmGBTData->evse[gunQty].version));
- }
- else if(connectorType2 == 3){
- // strcpy((char *)&connector2FwVer,ShmCHAdeMOData->evse[gunQty].version);
- // memcpy(connector2FwVer,ShmCHAdeMOData->evse[gunQty].version,ARRAY_SIZE(ShmCHAdeMOData->evse[gunQty].version));
- }
- }
- substr((char *)RatedPower1,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,4,1);
- substr((char *)RatedPower2,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,5,1);
- substr((char *)RatedPower3,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName,6,1);
- int p1=atoi((char *)RatedPower1);
- int p2=atoi((char *)RatedPower2);
- int p3=atoi((char *)RatedPower3);
- if(strcmp(IsAcDc, "D") == 0){
- RatedPower=(p1*10+p2)*pow(10,p3-1);
- if(RatedPower==50){
- PsuQuantity = 3;
- }
- else{
- // if(RatedPower>=30){
- PsuQuantity = RatedPower/30;
- // }
- }
- }
- if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0 || strcmp(IsDO, "DL") == 0){
- }
-
- struct json_object *jobj1;
- struct json_object *jobj2;
- struct json_object *jobj3;
- struct json_object *jobj4;
- //system
- struct json_object *ModelName;
- struct json_object *AcModelName;
- struct json_object *SerialNumber;
- struct json_object *SystemId;
- struct json_object *AcPhaseCount;
- struct json_object *PhaseLossPolicy;
- struct json_object *FactoryConfiguration;
- struct json_object *AuthorisationMode;
- struct json_object *DefaultLanguage;
- struct json_object *InputVoltageR;
- struct json_object *InputVoltageS;
- struct json_object *InputVoltageT;
- struct json_object *InputVoltageDc;
- struct json_object *SystemFanRotaSpeed;
- struct json_object *PsuFanRotaSpeed;
- struct json_object *RfidCardNumEndian;
- struct json_object *PsuAcInputType;
- struct json_object *RatingCurrent;
- struct json_object *AcRatingCurrent;
- struct json_object *isAPP;
- struct json_object *isQRCode;
- struct json_object *isRFID;
- struct json_object *QRCodeMadeMode;
- struct json_object *QRCodeContent;
- struct json_object *Intensity;
- struct json_object *isAuthrizeByEVCCID;
- struct json_object *AuxPower5V;
- struct json_object *AuxPower12V;
- struct json_object *AuxPower24V;
- struct json_object *AuxPower48V;
- struct json_object *CsuHwRev;
- struct json_object *CsuBootLoadFwRev;
- struct json_object *CsuKernelFwRev;
- struct json_object *CsuRootFsFwRev;
- struct json_object *CsuPrimFwRev;
- struct json_object *LcmHwRev;
- struct json_object *LcmFwRev;
- struct json_object *PsuHwRev;
- struct json_object *PsuPrimFwRev;
- struct json_object *PsuSecFwRev;
- struct json_object *AuxPwrHwRev;
- struct json_object *AuxPwrFwRev;
- struct json_object *FanModuleHwRev;
- struct json_object *FanModuleFwRev;
- struct json_object *RelayModuleHwRev;
- struct json_object *RelayModuleFwRev;
- struct json_object *TelcomModemFwRev;
- struct json_object *Connector1FwRev;
- struct json_object *Connector2FwRev;
- struct json_object *PsuLostQuantity;
- /* for DC+AC*/
- struct json_object *Connector3FwRev;
- struct json_object *LedModuleFwRev;
- struct json_object *SystemAmbientTemp;
- struct json_object *SystemCriticalTemp;
- struct json_object *CcsConnectorTemp;
- struct json_object *PsuAmbientTemp;
- struct json_object *AcPlugInTimes;
- struct json_object *GbPlugInTimes;
- struct json_object *Ccs1PlugInTime;
- struct json_object *Ccs2PlugInTimes;
- struct json_object *ChademoPlugInTimes;
- struct json_object *FirmwareUpdate;
- struct json_object *FwPrimaryVersion[PsuQuantity];
- struct json_object *FwPrimaryVersionArr= json_object_new_array();
- struct json_object *FwSecondVersion[PsuQuantity];
- struct json_object *FwSecondVersionArr= json_object_new_array();
- /* for DO & DD*/
- struct json_object *DispenserQuantity;
- struct json_object *TotalConnectorQuantity;
- struct json_object *DDLocalStatus[4];
- struct json_object *DDLocalStatusArr= json_object_new_array();
- struct json_object *DDModelName[4];
- struct json_object *DDModelNameArr= json_object_new_array();
- struct json_object *DDSerialNumber[4];
- struct json_object *DDSerialNumberArr= json_object_new_array();
- struct json_object *DDSystemId[4];
- struct json_object *DDSystemIdArr= json_object_new_array();
- struct json_object *DDAuthorisationMode[4];
- struct json_object *DDAuthorisationModeArr= json_object_new_array();
- struct json_object *DDRfidCardNumEndian[4];
- struct json_object *DDRfidCardNumEndianArr= json_object_new_array();
- struct json_object *DDisAPP[4];
- struct json_object *DDisAPPArr= json_object_new_array();
- struct json_object *DDisQRCode[4];
- struct json_object *DDisQRCodeArr= json_object_new_array();
- struct json_object *DDisRFID[4];
- struct json_object *DDisRFIDArr= json_object_new_array();
- struct json_object *DDQRCodeMadeMode[4];
- struct json_object *DDQRCodeMadeModeArr= json_object_new_array();
- struct json_object *DDQRCodeContent[4];
- struct json_object *DDQRCodeContentArr= json_object_new_array();
- struct json_object *DDFactoryConfiguration[4];
- struct json_object *DDFactoryConfigurationArr= json_object_new_array();
- struct json_object *DDCsuBootLoadFwRev[4];
- struct json_object *DDCsuBootLoadFwRevArr= json_object_new_array();
- struct json_object *DDCsuKernelFwRev[4];
- struct json_object *DDCsuKernelFwRevArr= json_object_new_array();
- struct json_object *DDCsuRootFsFwRev[4];
- struct json_object *DDCsuRootFsFwRevArr= json_object_new_array();
- struct json_object *DDCsuPrimFwRev[4];
- struct json_object *DDCsuPrimFwRevArr= json_object_new_array();
- struct json_object *DDLcmFwRev[4];
- struct json_object *DDLcmFwRevArr= json_object_new_array();
- struct json_object *DDPsuPrimFwRev[4];
- struct json_object *DDPsuPrimFwRevArr= json_object_new_array();
- struct json_object *DDPsuSecFwRev[4];
- struct json_object *DDPsuSecFwRevArr= json_object_new_array();
- struct json_object *DDFanModuleFwRev[4];
- struct json_object *DDFanModuleFwRevArr= json_object_new_array();
- struct json_object *DDRelayModuleFwRev[4];
- struct json_object *DDRelayModuleFwRevArr= json_object_new_array();
- struct json_object *DDTelcomModemFwRev[4];
- struct json_object *DDTelcomModemFwRevArr= json_object_new_array();
- struct json_object *DDLedModuleFwRev[4];
- struct json_object *DDLedModuleFwRevArr= json_object_new_array();
- struct json_object *DDConnector1FwRev[4];
- struct json_object *DDConnector1FwRevArr= json_object_new_array();
- struct json_object *DDConnector2FwRev[4];
- struct json_object *DDConnector2FwRevArr= json_object_new_array();
- struct json_object *DDIntensity[4];
- struct json_object *DDIntensityArr= json_object_new_array();
- struct json_object *Relay2ModuleFwRev;
- //charging
- struct json_object *MaxChargingEnergy;
- struct json_object *MaxChargingPower;
- struct json_object *MaxChargingCurrent;
- struct json_object *MaxChargingVoltage;
- struct json_object *AcMaxChargingCurrent;
- struct json_object *MaxChargingDuration;
- struct json_object *MaxChargingSoc;
- struct json_object *StopChargingByButton;
- struct json_object *FanControlPolicy;
- struct json_object *LocalWhiteCard[10];
- struct json_object *LocalWhiteCardArr= json_object_new_array();
- struct json_object *isBilling;
- struct json_object *Currency;
- struct json_object *Fee[24];
- struct json_object *FeeArr= json_object_new_array();
- struct json_object *ChargingInfo1;
- struct json_object *ChargingInfo2;
- struct json_object *ChargingInfo3;
- struct json_object *StartUserId[3];
- struct json_object *StartDateTime[3];
- struct json_object *StopDateTime[3];
- struct json_object *StartMethod[3];
- struct json_object *ConnectorTemp[3];
- struct json_object *ChillerTemp[3];
- struct json_object *PresentChargingVoltage[3];
- struct json_object *PresentChargingCurrent[3];
- struct json_object *PresentChargingPower[3];
- struct json_object *PresentChargedEnergy[3];
- struct json_object *PresentChargedDuration[3];
- struct json_object *RemainChargingDuration[3];
- struct json_object *EvBatteryMaxVoltage[3];
- struct json_object *EvBatterytargetVoltage[3];
- struct json_object *EvBatterySoc[3];
- struct json_object *PilotVoltage[3];
- struct json_object *SystemStatus[3];
- struct json_object *EvBatterytargetCurrent[3];
- struct json_object *PowerConsumption[3];
- struct json_object *isCalibratedVaGain[3];
- struct json_object *isCalibratedVbGain[3];
- struct json_object *isCalibratedVcGain[3];
- struct json_object *isCalibratedVaOffset[3];
- struct json_object *isCalibratedVbOffset[3];
- struct json_object *isCalibratedVcOffset[3];
- struct json_object *isCalibratedCaGain[3];
- struct json_object *isCalibratedCbGain[3];
- struct json_object *isCalibratedCcGain[3];
- struct json_object *isCalibratedCaOffset[3];
- struct json_object *isCalibratedCbOffset[3];
- struct json_object *isCalibratedCcOffset[3];
- struct json_object *isCalibratedPa[3];
- struct json_object *isCalibratedPb[3];
- struct json_object *isCalibratedPc[3];
- struct json_object *V2GPrivateKey;
- struct json_object *V2GRootCertificate;
- struct json_object *V2GCertificateChain;
- struct json_object *isEnable15118;
- struct json_object *isEnableR2R;
- /* for DO & DD*/
- struct json_object *DDChargingInfo1;
- struct json_object *DDChargingInfo2;
- struct json_object *DDChargingInfo3;
- struct json_object *DDChargingInfo4;
- struct json_object *DDStartUserId[4];
- struct json_object *DDStartDateTime[4];
- struct json_object *DDStopDateTime[4];
- struct json_object *DDStartMethod[4];
- struct json_object *DDConnectorTemp[4];
- struct json_object *DDChillerTemp[4];
- struct json_object *DDPresentChargingVoltage[4];
- struct json_object *DDPresentChargingCurrent[4];
- struct json_object *DDPresentChargingPower[4];
- struct json_object *DDPresentChargedEnergy[4];
- struct json_object *DDPresentChargedDuration[4];
- struct json_object *DDRemainChargingDuration[4];
- struct json_object *DDEvBatteryMaxVoltage[4];
- struct json_object *DDEvBatterytargetVoltage[4];
- struct json_object *DDEvBatterySoc[4];
- struct json_object *DDSystemStatus[4];
- struct json_object *DDEvBatterytargetCurrent[4];
- struct json_object *DDPowerConsumption[4];
- //network
- struct json_object *InternetConn;
- struct json_object *FtpServer;
- struct json_object *Eth0DhcpClient;
- struct json_object *Eth0MacAddress;
- struct json_object *Eth0IpAddress;
- struct json_object *Eth0SubmaskAddress;
- struct json_object *Eth0GatewayAddress;
- struct json_object *Eth1DhcpClient;
- struct json_object *Eth1MacAddress;
- struct json_object *Eth1IpAddress;
- struct json_object *Eth1SubmaskAddress;
- struct json_object *Eth1GatewayAddress;
- struct json_object *WifiMode;
- struct json_object *WifiSsid;
- struct json_object *WifiPassword;
- struct json_object *WifiBroadcastSsid;
- struct json_object *WifiTargetBssidMac;
- struct json_object *WifiRssi;
- struct json_object *WifiDhcpServer;
- struct json_object *WifiDhcpClient;
- struct json_object *WifiMacAddress;
- struct json_object *WifiIpAddress;
- struct json_object *WifiSubmaskAddress;
- struct json_object *WifiGatewayAddress;
- struct json_object *WifiNetworkConn;
- struct json_object *TelcomApn;
- struct json_object *TelcomRssi;
- struct json_object *TelcomChapPapId;
- struct json_object *TelcomChapPapPwd;
- struct json_object *TelcomModemImei;
- struct json_object *TelcomSimImsi;
- struct json_object *TelcomSimIccid;
- struct json_object *TelcomSimStatus;
- struct json_object *TelcomModemMode;
- struct json_object *TelcomIpAddress;
- struct json_object *TelcomNetworkConn;
- struct json_object *TelcomEnabled;
- struct json_object *TelcomNetworkType;
- struct json_object *isEnalbleFirewall;
- struct json_object *FirewallAcceptAddr[10];
- struct json_object *FirewallAcceptAddrArr= json_object_new_array();
- //backend
- struct json_object *BackendConnTimeout;
- struct json_object *OfflinePolicy;
- struct json_object *OfflineMaxChargeEnergy;
- struct json_object *OfflineMaxChargeDuration;
- struct json_object *OcppConnStatus;
- struct json_object *MaintainServerConnStatus;
- struct json_object *OcppServerURL;
- struct json_object *ChargeBoxId;
- struct json_object *chargePointVendor;
- struct json_object *OcppSecurityProfile;
- struct json_object *OcppSecurityPassword;
- struct json_object *MaintainServerSecurityProfile;
- struct json_object *MaintainServerSecurityPassword;
- struct json_object *isEnableLocalPowerSharging;
- struct json_object *PowerSharingCapacity;
- struct json_object *PowerSharingServerIP;
- struct json_object *OcppReceiptrURL;
- struct json_object *MaintainServerURL;
- struct json_object *ChargePointPrivateKey;
- struct json_object *ChargePointCertificate;
- struct json_object *MORootCertificate;
- struct json_object *CSRootCertificate;
- struct json_object *ManufacturerRootCertificate;
- /*for TTIA*/
- struct json_object *isEnableTTIA;
- struct json_object *server_addr;
- struct json_object *server_port;
- struct json_object *busVenderId;
- struct json_object *EquipmentProvider;
- struct json_object *TransportationCompanyNo;
- struct json_object *TTIAChargeBoxId;
- struct json_object *evseStation;
- jobj1=json_object_new_object();
- jobj2=json_object_new_object();
- jobj3=json_object_new_object();
- jobj4=json_object_new_object();
- //system
- ModelName = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ModelName);
- AcModelName = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AcModelName);
- SerialNumber = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SerialNumber);
- SystemId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.SystemId);
- AcPhaseCount = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPhaseCount);
- PhaseLossPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PhaseLossPolicy);
- FactoryConfiguration = json_object_new_int(ShmSysConfigAndInfo->SysInfo.FactoryConfiguration);
- AuthorisationMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
- DefaultLanguage = json_object_new_int(ShmSysConfigAndInfo->SysConfig.DefaultLanguage);
- InputVoltageR = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageR);
- InputVoltageS = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageS);
- InputVoltageT = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageT);
- InputVoltageDc = json_object_new_double(ShmSysConfigAndInfo->SysInfo.InputVoltageDc);
- SystemFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
- PsuFanRotaSpeed = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed);
- RfidCardNumEndian = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
- PsuAcInputType = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PsuAcInputType);
- RatingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.RatingCurrent);
- AcRatingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcRatingCurrent);
- isAPP = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isAPP);
- isQRCode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isQRCode);
- isRFID = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isRFID);
- QRCodeMadeMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode);
- QRCodeContent = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.QRCodeContent);
- Intensity = json_object_new_int(ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity);
- isAuthrizeByEVCCID = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isAuthrizeByEVCCID);
- AuxPower5V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower5V);
- AuxPower12V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower12V);
- AuxPower24V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower24V);
- AuxPower48V = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AuxPower48V);
- CsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuHwRev);
- CsuBootLoadFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
- CsuKernelFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
- CsuRootFsFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
- CsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev);
- LcmHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmHwRev);
- LcmFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LcmFwRev);
- PsuHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuHwRev);
- PsuPrimFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuPrimFwRev);
- PsuSecFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.PsuSecFwRev);
- AuxPwrHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrHwRev);
- AuxPwrFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AuxPwrFwRev);
- FanModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleHwRev);
- FanModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FanModuleFwRev);
- RelayModuleHwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleHwRev);
- RelayModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev);
- TelcomModemFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.TelcomModemFwRev);
- Connector1FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
- Connector2FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
- PsuLostQuantity = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuLostQuantity);
- /* for DC+AC*/
- if(connectorType3==4){
- Connector3FwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[0].version);
- }
- LedModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.LedModuleFwRev);
- SystemAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp);
- SystemCriticalTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp);
- CcsConnectorTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp);
- PsuAmbientTemp = json_object_new_int(ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp);
- AcPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcPlugInTimes);
- GbPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.GbPlugInTimes);
- Ccs1PlugInTime = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs1PlugInTime);
- Ccs2PlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Ccs2PlugInTimes);
- ChademoPlugInTimes = json_object_new_int(ShmSysConfigAndInfo->SysConfig.ChademoPlugInTimes);
- FirmwareUpdate = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.FirmwareUpdate);
- if(strcmp(IsAcDc, "D") == 0){
- for(int i=0;i<PsuQuantity;i++){
- FwPrimaryVersion[i] = json_object_new_string((char *)&ShmPsuData->PsuVersion[i].FwPrimaryVersion);
- FwSecondVersion[i] = json_object_new_string((char *)&ShmPsuData->PsuVersion[i].FwSecondVersion);
- json_object_array_add(FwPrimaryVersionArr,FwPrimaryVersion[i]);
- json_object_array_add(FwSecondVersionArr,FwSecondVersion[i]);
- }
- }
- if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0 || strcmp(IsDO, "DL") == 0){
- if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity>4 || ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity<0)ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity=0;
- DispenserQuantity = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity);
- TotalConnectorQuantity = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity);
- int DDDispenserQuantity = ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity;
- for(int i=0;i<DDDispenserQuantity;i++){
- DDLocalStatus[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LocalStatus);
- DDModelName[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].ModelName);
- DDSerialNumber[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].SerialNumber);
- DDSystemId[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].SystemId);
- DDAuthorisationMode[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].AuthorisationMode);
- DDRfidCardNumEndian[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].RfidCardNumEndian);
- DDisAPP[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].isAPP);
- DDisQRCode[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].isQRCode);
- DDisRFID[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].isRFID);
- DDQRCodeMadeMode[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].QRCodeMadeMode);
- DDQRCodeContent[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].QRCodeContent);
- DDFactoryConfiguration[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].FactoryConfiguration);
- DDCsuBootLoadFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuBootLoadFwRev);
- DDCsuKernelFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuKernelFwRev);
- DDCsuRootFsFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuRootFsFwRev);
- DDCsuPrimFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].CsuPrimFwRev);
- DDLcmFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LcmFwRev);
- DDPsuPrimFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].PsuPrimFwRev);
- DDPsuSecFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].PsuSecFwRev);
- DDFanModuleFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].FanModuleFwRev);
- DDRelayModuleFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].RelayModuleFwRev);
- DDTelcomModemFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].TelcomModemFwRev);
- DDLedModuleFwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LedModuleFwRev);
- DDConnector1FwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Connector1FwRev);
- DDConnector2FwRev[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Connector2FwRev);
- DDIntensity[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LedInfo.Intensity);
- json_object_array_add(DDLocalStatusArr,DDLocalStatus[i]);
- json_object_array_add(DDModelNameArr,DDModelName[i]);
- json_object_array_add(DDSerialNumberArr,DDSerialNumber[i]);
- json_object_array_add(DDSystemIdArr,DDSystemId[i]);
- json_object_array_add(DDAuthorisationModeArr,DDAuthorisationMode[i]);
- json_object_array_add(DDRfidCardNumEndianArr,DDRfidCardNumEndian[i]);
- json_object_array_add(DDisAPPArr,DDisAPP[i]);
- json_object_array_add(DDisQRCodeArr,DDisQRCode[i]);
- json_object_array_add(DDisRFIDArr,DDisRFID[i]);
- json_object_array_add(DDQRCodeMadeModeArr,DDQRCodeMadeMode[i]);
- json_object_array_add(DDQRCodeContentArr,DDQRCodeContent[i]);
- json_object_array_add(DDFactoryConfigurationArr,DDFactoryConfiguration[i]);
- json_object_array_add(DDCsuBootLoadFwRevArr,DDCsuBootLoadFwRev[i]);
- json_object_array_add(DDCsuKernelFwRevArr,DDCsuKernelFwRev[i]);
- json_object_array_add(DDCsuRootFsFwRevArr,DDCsuRootFsFwRev[i]);
- json_object_array_add(DDCsuPrimFwRevArr,DDCsuPrimFwRev[i]);
- json_object_array_add(DDLcmFwRevArr,DDLcmFwRev[i]);
- json_object_array_add(DDPsuPrimFwRevArr,DDPsuPrimFwRev[i]);
- json_object_array_add(DDPsuSecFwRevArr,DDPsuSecFwRev[i]);
- json_object_array_add(DDFanModuleFwRevArr,DDFanModuleFwRev[i]);
- json_object_array_add(DDRelayModuleFwRevArr,DDRelayModuleFwRev[i]);
- json_object_array_add(DDTelcomModemFwRevArr,DDTelcomModemFwRev[i]);
- json_object_array_add(DDLedModuleFwRevArr,DDLedModuleFwRev[i]);
- json_object_array_add(DDConnector1FwRevArr,DDConnector1FwRev[i]);
- json_object_array_add(DDConnector2FwRevArr,DDConnector2FwRev[i]);
- json_object_array_add(DDIntensityArr,DDIntensity[i]);
- }
- Relay2ModuleFwRev = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.Relay2ModuleFwRev);
- }
- //charging
- int CcsGunQty=0;
- int GbGunQty=0;
- int CHAdeMOGunQty=0;
- int AcGunQty=0;
- ChargingInfo1=json_object_new_object();
- ChargingInfo2=json_object_new_object();
- ChargingInfo3=json_object_new_object();
- MaxChargingEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy);
- MaxChargingPower = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingPower);
- MaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
- MaxChargingVoltage = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingVoltage);
- AcMaxChargingCurrent = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AcMaxChargingCurrent);
- MaxChargingDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingDuration);
- MaxChargingSoc = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaxChargingSoc);
- StopChargingByButton = json_object_new_int(ShmSysConfigAndInfo->SysConfig.StopChargingByButton);
- FanControlPolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.FanControlPolicy);
- isEnable15118 = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isEnable15118);
- isEnableR2R = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isEnableR2R);
- LocalWhiteCard[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[0]);
- LocalWhiteCard[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[1]);
- LocalWhiteCard[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[2]);
- LocalWhiteCard[3] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[3]);
- LocalWhiteCard[4] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[4]);
- LocalWhiteCard[5] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[5]);
- LocalWhiteCard[6] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[6]);
- LocalWhiteCard[7] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[7]);
- LocalWhiteCard[8] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[8]);
- LocalWhiteCard[9] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[9]);
- isBilling = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BillingData.isBilling);
- Currency = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BillingData.Currency);
- Fee[0] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[0]);
- Fee[1] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[1]);
- Fee[2] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[2]);
- Fee[3] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[3]);
- Fee[4] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[4]);
- Fee[5] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[5]);
- Fee[6] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[6]);
- Fee[7] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[7]);
- Fee[8] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[8]);
- Fee[9] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[9]);
- Fee[10] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[10]);
- Fee[11] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[11]);
- Fee[12] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[12]);
- Fee[13] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[13]);
- Fee[14] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[14]);
- Fee[15] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[15]);
- Fee[16] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[16]);
- Fee[17] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[17]);
- Fee[18] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[18]);
- Fee[19] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[19]);
- Fee[20] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[20]);
- Fee[21] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[21]);
- Fee[22] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[22]);
- Fee[23] = json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[23]);
- if(connectorType1 != 0){
- if(connectorType1 == 1){//CCS
- PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
- PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
- PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
- PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
- PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
- RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
- EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
- PilotVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PilotVoltage);
- SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
- EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
- StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
- StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
- StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
- StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 255){
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
- }
- else{
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 255){
- ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp);
- }
- else{
- ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp-60);
- }
- PowerConsumption[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PowerConsumption);
- CcsGunQty++;
- }
- else if(connectorType1 == 2){//GB
- PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
- PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
- PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
- PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
- PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
- RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
- EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
- PilotVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PilotVoltage);
- SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
- EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
- StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
- StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
- StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
- StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 255){
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
- }
- else{
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 255){
- ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp);
- }
- else{
- ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp-60);
- }
- PowerConsumption[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PowerConsumption);
- GbGunQty++;
- }
- else if(connectorType1 == 3){//CHAdeMO
- PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
- PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
- PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
- PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
- PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
- RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
- EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
- PilotVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PilotVoltage);
- SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
- EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
- StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
- StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
- StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
- StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 255){
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
- }
- else{
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 255){
- ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp);
- }
- else{
- ChillerTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp-60);
- }
- PowerConsumption[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PowerConsumption);
- CHAdeMOGunQty++;
- }
- else if(connectorType1 == 4){//AC
- PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
- PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
- PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
- PresentChargedEnergy[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
- PresentChargedDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
- RemainChargingDuration[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
- EvBatterySoc[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
- PilotVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PilotVoltage);
- SystemStatus[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
- EvBatterytargetCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
- StartUserId[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
- StartDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
- StopDateTime[0] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
- StartMethod[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
- ConnectorTemp[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
- ChillerTemp[0] = json_object_new_int(255);
- PowerConsumption[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PowerConsumption);
- if(strcmp(IsDO, "AX") == 0){
- isCalibratedVaGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaGain);
- isCalibratedVbGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbGain);
- isCalibratedVcGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcGain);
- isCalibratedVaOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaOffset);
- isCalibratedVbOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbOffset);
- isCalibratedVcOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcOffset);
- isCalibratedCaGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaGain);
- isCalibratedCbGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbGain);
- isCalibratedCcGain[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcGain);
- isCalibratedCaOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaOffset);
- isCalibratedCbOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbOffset);
- isCalibratedCcOffset[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcOffset);
- isCalibratedPa[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPa);
- isCalibratedPb[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPb);
- isCalibratedPc[0] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPc);
- }
- AcGunQty++;
- }
- }
- if(connectorType2 != 0){
- if(connectorType2 == 1){//CCS
- PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
- PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
- PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
- PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
- PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
- RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
- EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
- PilotVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PilotVoltage);
- SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
- EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
- StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
- StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
- StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
- StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 255){
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
- }
- else{
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 255){
- ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp);
- }
- else{
- ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp-60);
- }
- PowerConsumption[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PowerConsumption);
- CcsGunQty++;
- }
- else if(connectorType2 == 2){//GB
- PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
- PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
- PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
- PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
- PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
- RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
- EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
- PilotVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PilotVoltage);
- SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
- EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
- StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
- StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
- StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
- StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 255){
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
- }
- else{
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 255){
- ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp);
- }
- else{
- ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp-60);
- }
- PowerConsumption[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PowerConsumption);
- GbGunQty++;
- }
- else if(connectorType2 == 3){//CHAdeMO
- PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
- PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
- PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
- PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
- PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
- RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
- EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
- PilotVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PilotVoltage);
- SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
- EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
- StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
- StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
- StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
- StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 255){
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
- }
- else{
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 255){
- ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp);
- }
- else{
- ChillerTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp-60);
- }
- PowerConsumption[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PowerConsumption);
- CHAdeMOGunQty++;
- }
- else if(connectorType2 == 4){//AC
- PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
- PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
- PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
- PresentChargedEnergy[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
- PresentChargedDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
- RemainChargingDuration[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
- EvBatterySoc[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
- PilotVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PilotVoltage);
- SystemStatus[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
- EvBatterytargetCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
- StartUserId[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
- StartDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
- StopDateTime[1] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
- StartMethod[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
- ConnectorTemp[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
- ChillerTemp[1] = json_object_new_int(255);
- PowerConsumption[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PowerConsumption);
- if(strcmp(IsDO, "AX") == 0){
- isCalibratedVaGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaGain);
- isCalibratedVbGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbGain);
- isCalibratedVcGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcGain);
- isCalibratedVaOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaOffset);
- isCalibratedVbOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbOffset);
- isCalibratedVcOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcOffset);
- isCalibratedCaGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaGain);
- isCalibratedCbGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbGain);
- isCalibratedCcGain[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcGain);
- isCalibratedCaOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaOffset);
- isCalibratedCbOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbOffset);
- isCalibratedCcOffset[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcOffset);
- isCalibratedPa[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPa);
- isCalibratedPb[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPb);
- isCalibratedPc[1] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPc);
- }
- AcGunQty++;
- }
- }
- if(connectorType3 != 0){
- if(connectorType3 == 1){//CCS
- PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingVoltage);
- PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingCurrent);
- PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargingPower);
- PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedEnergy);
- PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PresentChargedDuration);
- RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetVoltage);
- EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterySoc);
- PilotVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PilotVoltage);
- SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].SystemStatus);
- EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].EvBatterytargetCurrent);
- StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartUserId);
- StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartDateTime);
- StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StopDateTime);
- StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 0 ||ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp == 255){
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp);
- }
- else{
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 0 ||ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp == 255){
- ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp);
- }
- else{
- ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].ChillerTemp-60);
- }
- PowerConsumption[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.CcsChargingData[CcsGunQty].PowerConsumption);
- CcsGunQty++;
- }
- else if(connectorType3 == 2){//GB
- PresentChargingVoltage[2]= json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingVoltage);
- PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingCurrent);
- PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargingPower);
- PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedEnergy);
- PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PresentChargedDuration);
- RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetVoltage);
- EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterySoc);
- PilotVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PilotVoltage);
- SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].SystemStatus);
- EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].EvBatterytargetCurrent);
- StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartUserId);
- StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartDateTime);
- StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StopDateTime);
- StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp == 255){
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp);
- }
- else{
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp == 255){
- ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp);
- }
- else{
- ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].ChillerTemp-60);
- }
- PowerConsumption[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.GbChargingData[GbGunQty].PowerConsumption);
- GbGunQty++;
- }
- else if(connectorType3 == 3){//CHAdeMO
- PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingVoltage);
- PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingCurrent);
- PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargingPower);
- PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedEnergy);
- PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PresentChargedDuration);
- RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetVoltage);
- EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterySoc);
- PilotVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PilotVoltage);
- SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].SystemStatus);
- EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].EvBatterytargetCurrent);
- StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartUserId);
- StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartDateTime);
- StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StopDateTime);
- StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp == 255){
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp);
- }
- else{
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp == 255){
- ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp);
- }
- else{
- ChillerTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].ChillerTemp-60);
- }
- PowerConsumption[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[CHAdeMOGunQty].PowerConsumption);
- CHAdeMOGunQty++;
- }
- else if(connectorType3 == 4){//AC
- PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
- PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
- PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
- PresentChargedEnergy[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
- PresentChargedDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
- RemainChargingDuration[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
- EvBatteryMaxVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
- EvBatterytargetVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
- EvBatterySoc[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
- PilotVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PilotVoltage);
- SystemStatus[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
- EvBatterytargetCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
- StartUserId[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
- StartDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
- StopDateTime[2] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
- StartMethod[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
- ConnectorTemp[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
- ChillerTemp[2] = json_object_new_int(255);
- PowerConsumption[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PowerConsumption);
- if(strcmp(IsDO, "AX") == 0){
- isCalibratedVaGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaGain);
- isCalibratedVbGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbGain);
- isCalibratedVcGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcGain);
- isCalibratedVaOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVaOffset);
- isCalibratedVbOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVbOffset);
- isCalibratedVcOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedVcOffset);
- isCalibratedCaGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaGain);
- isCalibratedCbGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbGain);
- isCalibratedCcGain[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcGain);
- isCalibratedCaOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCaOffset);
- isCalibratedCbOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCbOffset);
- isCalibratedCcOffset[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedCcOffset);
- isCalibratedPa[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPa);
- isCalibratedPb[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPb);
- isCalibratedPc[2] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].meterIcCalInfo.isCalibratedPc);
- }
- AcGunQty++;
- }
- }
- if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0 || strcmp(IsDO, "DL") == 0){
- if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity>4 || ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity<0)ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=0;
- int DDTotalConnectorQuantity = ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity;
- for(int i=0;i<DDTotalConnectorQuantity;i++){
- DDPresentChargingVoltage[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargingVoltage);
- DDPresentChargingCurrent[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargingCurrent);
- DDPresentChargingPower[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargingPower);
- DDPresentChargedEnergy[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargedEnergy);
- DDPresentChargedDuration[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PresentChargedDuration);
- DDRemainChargingDuration[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.RemainChargingDuration);
- DDEvBatteryMaxVoltage[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatteryMaxVoltage);
- DDEvBatterytargetVoltage[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatterytargetVoltage);
- DDEvBatterySoc[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatterySoc);
- DDSystemStatus[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.SystemStatus);
- DDEvBatterytargetCurrent[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.EvBatterytargetCurrent);
- DDStartUserId[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartUserId);
- DDStartDateTime[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartDateTime);
- DDStopDateTime[i] = json_object_new_string((char *)&ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StopDateTime);
- DDStartMethod[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.StartMethod);
- if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp == 0 || ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp == 255){
- DDConnectorTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp);
- }
- else{
- DDConnectorTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ConnectorTemp-60);
- }
- if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ChillerTemp == 0 || ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ChillerTemp == 255){
- DDChillerTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ChillerTemp);
- }
- else{
- DDChillerTemp[i] = json_object_new_int(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.ChillerTemp-60);
- }
- DDPowerConsumption[i] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].GeneralChargingData.PowerConsumption);
- }
- }
- //V2G certificate
- FILE *file;
- char line[0];
- V2GPrivateKey = json_object_new_string("");
- file = popen("sha256sum /Storage/certV2G.key", "r");
- if (NULL != file)
- {
- int i=0;
- while (fgets(line, 65, file) != NULL)
- {
- if(i==0){
- V2GPrivateKey = json_object_new_string(line);
- }
- i++;
- }
- }
- pclose(file);
- V2GRootCertificate = json_object_new_string("");
- file = popen("sha256sum /Storage/rootCaV2g.pem", "r");
- if (NULL != file)
- {
- int i=0;
- while (fgets(line, 65, file) != NULL)
- {
- if(i==0){
- V2GRootCertificate = json_object_new_string(line);
- }
- i++;
- }
- }
- pclose(file);
- V2GCertificateChain = json_object_new_string("");
- file = popen("sha256sum /Storage/certV2g.pem", "r");
- if (NULL != file)
- {
- int i=0;
- while (fgets(line, 65, file) != NULL)
- {
- if(i==0){
- V2GCertificateChain = json_object_new_string(line);
- }
- i++;
- }
- }
- pclose(file);
- //network
- InternetConn = json_object_new_int(ShmSysConfigAndInfo->SysInfo.InternetConn);
- FtpServer = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.FtpServer);
- Eth0DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient);
- Eth0MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress);
- Eth0IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
- Eth0SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
- Eth0GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
- Eth1DhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient);
- Eth1MacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthMacAddress);
- Eth1IpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthIpAddress);
- Eth1SubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthSubmaskAddress);
- Eth1GatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthGatewayAddress);
- WifiMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
- WifiSsid = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
- WifiPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
- WifiBroadcastSsid = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiBroadcastSsid);
- WifiTargetBssidMac = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiTargetBssidMac);
- WifiRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi);
- WifiDhcpServer = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpServer);
- WifiDhcpClient = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient);
- WifiMacAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMacAddress);
- WifiIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress);
- WifiSubmaskAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSubmaskAddress);
- WifiGatewayAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiGatewayAddress);
- WifiNetworkConn = json_object_new_int(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn);
- TelcomApn = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
- TelcomRssi = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi);
- TelcomChapPapId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
- TelcomChapPapPwd = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
- TelcomModemImei = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei);
- TelcomSimImsi = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi);
- TelcomSimIccid = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
- TelcomSimStatus = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus);
- TelcomModemMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
- TelcomIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress);
- TelcomNetworkConn = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn);
- TelcomEnabled = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled);
- TelcomNetworkType = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkType);
- isEnalbleFirewall = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isEnalbleFirewall);
- FirewallAcceptAddr[0] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[0]);
- FirewallAcceptAddr[1] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[1]);
- FirewallAcceptAddr[2] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[2]);
- FirewallAcceptAddr[3] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[3]);
- FirewallAcceptAddr[4] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[4]);
- FirewallAcceptAddr[5] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[5]);
- FirewallAcceptAddr[6] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[6]);
- FirewallAcceptAddr[7] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[7]);
- FirewallAcceptAddr[8] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[8]);
- FirewallAcceptAddr[9] = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.FirewallAcceptAddr[9]);
- //backend
- BackendConnTimeout = json_object_new_int(ShmSysConfigAndInfo->SysConfig.BackendConnTimeout);
- OfflinePolicy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
- OfflineMaxChargeEnergy = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy);
- OfflineMaxChargeDuration = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration);
- OcppConnStatus = json_object_new_int(ShmSysConfigAndInfo->SysInfo.OcppConnStatus);
- MaintainServerConnStatus = json_object_new_int(ShmSysConfigAndInfo->SysInfo.MaintainServerConnStatus);
- OcppServerURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL);
- ChargeBoxId = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
- OcppSecurityProfile = json_object_new_int(ShmSysConfigAndInfo->SysConfig.OcppSecurityProfile);
- OcppSecurityPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword);
- MaintainServerSecurityProfile = json_object_new_int(ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityProfile);
- MaintainServerSecurityPassword = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityPassword);
- chargePointVendor = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.chargePointVendor);
- MaintainServerURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL);
- if(strcmp(IsDO, "AX") == 0 || strcmp(IsDO, "AW") == 0 || strcmp(IsAcDc, "D") == 0){
- isEnableLocalPowerSharging = json_object_new_int(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing);
- PowerSharingCapacity = json_object_new_int(ShmSysConfigAndInfo->SysConfig.PowerSharingCapacityPower);
- PowerSharingServerIP = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.PowerSharingServerIP);
- OcppReceiptrURL = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL);
- }
- /*for TTIA*/
- if(strcmp(IsAcDc, "D") == 0 && strcmp(SafetyRegulation, "C") == 0){
- isEnableTTIA = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TTIA_Info.isEnableTTIA);
- server_addr = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_addr);
- server_port = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TTIA_Info.server_port);
- busVenderId = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TTIA_Info.busVenderId);
- EquipmentProvider = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TTIA_Info.EquipmentProvider);
- TransportationCompanyNo = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TTIA_Info.TransportationCompanyNo);
- TTIAChargeBoxId = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TTIA_Info.ChargeBoxId);
- evseStation = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TTIA_Info.evseStation);
- }
- //PnC certificate
- ChargePointPrivateKey = json_object_new_string("");
- file = popen("sha256sum /Storage/OCPP/certCP.key", "r");
- if (NULL != file)
- {
- int i=0;
- while (fgets(line, 65, file) != NULL)
- {
- if(i==0){
- ChargePointPrivateKey = json_object_new_string(line);
- }
- i++;
- }
- }
- pclose(file);
- ChargePointCertificate = json_object_new_string("");
- file = popen("sha256sum /Storage/OCPP/certCP.pem", "r");
- if (NULL != file)
- {
- int i=0;
- while (fgets(line, 65, file) != NULL)
- {
- if(i==0){
- ChargePointCertificate = json_object_new_string(line);
- }
- i++;
- }
- }
- pclose(file);
- MORootCertificate = json_object_new_string("");
- file = popen("sha256sum /Storage/rootCaMo.pem", "r");
- if (NULL != file)
- {
- int i=0;
- while (fgets(line, 65, file) != NULL)
- {
- if(i==0){
- MORootCertificate = json_object_new_string(line);
- }
- i++;
- }
- }
- pclose(file);
- CSRootCertificate = json_object_new_string("");
- file = popen("sha256sum /Storage/OCPP/rootCaCs.pem", "r");
- if (NULL != file)
- {
- int i=0;
- while (fgets(line, 65, file) != NULL)
- {
- if(i==0){
- CSRootCertificate = json_object_new_string(line);
- }
- i++;
- }
- }
- pclose(file);
- ManufacturerRootCertificate = json_object_new_string("");
- file = popen("sha256sum /Storage/OCPP/rootCaMf.pem", "r");
- if (NULL != file)
- {
- int i=0;
- while (fgets(line, 65, file) != NULL)
- {
- if(i==0){
- ManufacturerRootCertificate = json_object_new_string(line);
- }
- i++;
- }
- }
- pclose(file);
- //system
- json_object_object_add(jobj1,"ModelName",ModelName);
- json_object_object_add(jobj1,"AcModelName",AcModelName);
- json_object_object_add(jobj1,"SerialNumber",SerialNumber);
- json_object_object_add(jobj1,"SystemId",SystemId);
- json_object_object_add(jobj1,"AcPhaseCount",AcPhaseCount);
- json_object_object_add(jobj1,"PhaseLossPolicy",PhaseLossPolicy);
- json_object_object_add(jobj1,"FactoryConfiguration",FactoryConfiguration);
- json_object_object_add(jobj1,"AuthorisationMode",AuthorisationMode);
- json_object_object_add(jobj1,"DefaultLanguage",DefaultLanguage);
- json_object_object_add(jobj1,"InputVoltageR",InputVoltageR);
- json_object_object_add(jobj1,"InputVoltageS",InputVoltageS);
- json_object_object_add(jobj1,"InputVoltageT",InputVoltageT);
- json_object_object_add(jobj1,"InputVoltageDc",InputVoltageDc);
- json_object_object_add(jobj1,"SystemFanRotaSpeed",SystemFanRotaSpeed);
- json_object_object_add(jobj1,"PsuFanRotaSpeed",PsuFanRotaSpeed);
- json_object_object_add(jobj1,"RfidCardNumEndian",RfidCardNumEndian);
- json_object_object_add(jobj1,"PsuAcInputType",PsuAcInputType);
- json_object_object_add(jobj1,"RatingCurrent",RatingCurrent);
- json_object_object_add(jobj1,"AcRatingCurrent",AcRatingCurrent);
- json_object_object_add(jobj1,"isAPP",isAPP);
- json_object_object_add(jobj1,"isQRCode",isQRCode);
- json_object_object_add(jobj1,"isRFID",isRFID);
- json_object_object_add(jobj1,"QRCodeMadeMode",QRCodeMadeMode);
- json_object_object_add(jobj1,"QRCodeContent",QRCodeContent);
- json_object_object_add(jobj1,"Intensity",Intensity);
- json_object_object_add(jobj1,"isAuthrizeByEVCCID",isAuthrizeByEVCCID);
- json_object_object_add(jobj1,"AuxPower5V",AuxPower5V);
- json_object_object_add(jobj1,"AuxPower12V",AuxPower12V);
- json_object_object_add(jobj1,"AuxPower24V",AuxPower24V);
- json_object_object_add(jobj1,"AuxPower48V",AuxPower48V);
- json_object_object_add(jobj1,"CsuHwRev",CsuHwRev);
- json_object_object_add(jobj1,"CsuBootLoadFwRev",CsuBootLoadFwRev);
- json_object_object_add(jobj1,"CsuKernelFwRev",CsuKernelFwRev);
- json_object_object_add(jobj1,"CsuRootFsFwRev",CsuRootFsFwRev);
- json_object_object_add(jobj1,"CsuPrimFwRev",CsuPrimFwRev);
- json_object_object_add(jobj1,"LcmHwRev",LcmHwRev);
- json_object_object_add(jobj1,"LcmFwRev",LcmFwRev);
- json_object_object_add(jobj1,"PsuHwRev",PsuHwRev);
- json_object_object_add(jobj1,"PsuPrimFwRev",PsuPrimFwRev);
- json_object_object_add(jobj1,"PsuSecFwRev",PsuSecFwRev);
- json_object_object_add(jobj1,"AuxPwrHwRev",AuxPwrHwRev);
- json_object_object_add(jobj1,"AuxPwrFwRev",AuxPwrFwRev);
- json_object_object_add(jobj1,"FanModuleHwRev",FanModuleHwRev);
- json_object_object_add(jobj1,"FanModuleFwRev",FanModuleFwRev);
- json_object_object_add(jobj1,"RelayModuleHwRev",RelayModuleHwRev);
- json_object_object_add(jobj1,"RelayModuleFwRev",RelayModuleFwRev);
- json_object_object_add(jobj1,"TelcomModemFwRev",TelcomModemFwRev);
- json_object_object_add(jobj1,"Connector1FwRev",Connector1FwRev);
- json_object_object_add(jobj1,"Connector2FwRev",Connector2FwRev);
- json_object_object_add(jobj1,"PsuLostQuantity",PsuLostQuantity);
- /* for DC+AC*/
- if(connectorType3==4){
- json_object_object_add(jobj1,"Connector3FwRev",Connector3FwRev);
- }
- json_object_object_add(jobj1,"LedModuleFwRev",LedModuleFwRev);
- json_object_object_add(jobj1,"SystemAmbientTemp",SystemAmbientTemp);
- json_object_object_add(jobj1,"SystemCriticalTemp",SystemCriticalTemp);
- json_object_object_add(jobj1,"CcsConnectorTemp",CcsConnectorTemp);
- json_object_object_add(jobj1,"PsuAmbientTemp",PsuAmbientTemp);
- json_object_object_add(jobj1,"AcPlugInTimes",AcPlugInTimes);
- json_object_object_add(jobj1,"GbPlugInTimes",GbPlugInTimes);
- json_object_object_add(jobj1,"Ccs1PlugInTimes",Ccs1PlugInTime);
- json_object_object_add(jobj1,"Ccs2PlugInTimes",Ccs2PlugInTimes);
- json_object_object_add(jobj1,"ChademoPlugInTimes",ChademoPlugInTimes);
- json_object_object_add(jobj1,"FirmwareUpdate",FirmwareUpdate);
- if(strcmp(IsAcDc, "D") == 0){
- json_object_object_add(jobj1,"FwPrimaryVersion",FwPrimaryVersionArr);
- json_object_object_add(jobj1,"FwSecondVersion",FwSecondVersionArr);
- }
- if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0|| strcmp(IsDO, "DB") == 0|| strcmp(IsDO, "DL") == 0){
- json_object_object_add(jobj1,"DispenserQuantity",DispenserQuantity);
- json_object_object_add(jobj1,"TotalConnectorQuantity",TotalConnectorQuantity);
- json_object_object_add(jobj1,"DDLocalStatus",DDLocalStatusArr);
- json_object_object_add(jobj1,"DDModelName",DDModelNameArr);
- json_object_object_add(jobj1,"DDSerialNumber",DDSerialNumberArr);
- json_object_object_add(jobj1,"DDSystemId",DDSystemIdArr);
- json_object_object_add(jobj1,"DDAuthorisationMode",DDAuthorisationModeArr);
- json_object_object_add(jobj1,"DDRfidCardNumEndian",DDRfidCardNumEndianArr);
- json_object_object_add(jobj1,"DDisAPP",DDisAPPArr);
- json_object_object_add(jobj1,"DDisQRCode",DDisQRCodeArr);
- json_object_object_add(jobj1,"DDisRFID",DDisRFIDArr);
- json_object_object_add(jobj1,"DDQRCodeMadeMode",DDQRCodeMadeModeArr);
- json_object_object_add(jobj1,"DDQRCodeContent",DDQRCodeContentArr);
- json_object_object_add(jobj1,"DDFactoryConfiguration",DDFactoryConfigurationArr);
- json_object_object_add(jobj1,"DDCsuBootLoadFwRev",DDCsuBootLoadFwRevArr);
- json_object_object_add(jobj1,"DDCsuKernelFwRev",DDCsuKernelFwRevArr);
- json_object_object_add(jobj1,"DDCsuRootFsFwRev",DDCsuRootFsFwRevArr);
- json_object_object_add(jobj1,"DDCsuPrimFwRev",DDCsuPrimFwRevArr);
- json_object_object_add(jobj1,"DDLcmFwRev",DDLcmFwRevArr);
- json_object_object_add(jobj1,"DDPsuPrimFwRev",DDPsuPrimFwRevArr);
- json_object_object_add(jobj1,"DDPsuSecFwRev",DDPsuSecFwRevArr);
- json_object_object_add(jobj1,"DDFanModuleFwRev",DDFanModuleFwRevArr);
- json_object_object_add(jobj1,"DDRelayModuleFwRev",DDRelayModuleFwRevArr);
- json_object_object_add(jobj1,"DDTelcomModemFwRev",DDTelcomModemFwRevArr);
- json_object_object_add(jobj1,"DDLedModuleFwRev",DDLedModuleFwRevArr);
- json_object_object_add(jobj1,"DDConnector1FwRev",DDConnector1FwRevArr);
- json_object_object_add(jobj1,"DDConnector2FwRev",DDConnector2FwRevArr);
- json_object_object_add(jobj1,"DDIntensity",DDIntensityArr);
- json_object_object_add(jobj1,"Relay2ModuleFwRev",Relay2ModuleFwRev);
- }
- printf("%s\n", json_object_to_json_string(jobj1));
- json_object_put(jobj1);
- //charging
- json_object_object_add(jobj2,"MaxChargingEnergy",MaxChargingEnergy);
- json_object_object_add(jobj2,"MaxChargingPower",MaxChargingPower);
- json_object_object_add(jobj2,"MaxChargingCurrent",MaxChargingCurrent);
- json_object_object_add(jobj2,"MaxChargingVoltage",MaxChargingVoltage);
- json_object_object_add(jobj2,"AcMaxChargingCurrent",AcMaxChargingCurrent);
- json_object_object_add(jobj2,"MaxChargingDuration",MaxChargingDuration);
- json_object_object_add(jobj2,"MaxChargingSoc",MaxChargingSoc);
- json_object_object_add(jobj2,"StopChargingByButton",StopChargingByButton);
- json_object_object_add(jobj2,"FanControlPolicy",FanControlPolicy);
- json_object_object_add(jobj2,"isEnable15118",isEnable15118);
- json_object_object_add(jobj2,"isEnableR2R",isEnableR2R);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[0]);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[1]);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[2]);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[3]);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[4]);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[5]);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[6]);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[7]);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[8]);
- json_object_array_add(LocalWhiteCardArr,LocalWhiteCard[9]);
- json_object_object_add(jobj2,"LocalWhiteCard",LocalWhiteCardArr);
- json_object_object_add(jobj2,"isBilling",isBilling);
- json_object_object_add(jobj2,"Currency",Currency);
- json_object_array_add(FeeArr,Fee[0]);
- json_object_array_add(FeeArr,Fee[1]);
- json_object_array_add(FeeArr,Fee[2]);
- json_object_array_add(FeeArr,Fee[3]);
- json_object_array_add(FeeArr,Fee[4]);
- json_object_array_add(FeeArr,Fee[5]);
- json_object_array_add(FeeArr,Fee[6]);
- json_object_array_add(FeeArr,Fee[7]);
- json_object_array_add(FeeArr,Fee[8]);
- json_object_array_add(FeeArr,Fee[9]);
- json_object_array_add(FeeArr,Fee[10]);
- json_object_array_add(FeeArr,Fee[11]);
- json_object_array_add(FeeArr,Fee[12]);
- json_object_array_add(FeeArr,Fee[13]);
- json_object_array_add(FeeArr,Fee[14]);
- json_object_array_add(FeeArr,Fee[15]);
- json_object_array_add(FeeArr,Fee[16]);
- json_object_array_add(FeeArr,Fee[17]);
- json_object_array_add(FeeArr,Fee[18]);
- json_object_array_add(FeeArr,Fee[19]);
- json_object_array_add(FeeArr,Fee[20]);
- json_object_array_add(FeeArr,Fee[21]);
- json_object_array_add(FeeArr,Fee[22]);
- json_object_array_add(FeeArr,Fee[23]);
- json_object_object_add(jobj2,"Fee",FeeArr);
- if(connectorType1 != 0){
- json_object_object_add(ChargingInfo1,"StartUserId",StartUserId[0]);
- json_object_object_add(ChargingInfo1,"StartDateTime",StartDateTime[0]);
- json_object_object_add(ChargingInfo1,"StopDateTime",StopDateTime[0]);
- json_object_object_add(ChargingInfo1,"StartMethod",StartMethod[0]);
- json_object_object_add(ChargingInfo1,"ConnectorTemp",ConnectorTemp[0]);
- json_object_object_add(ChargingInfo1,"ChillerTemp",ChillerTemp[0]);
- json_object_object_add(ChargingInfo1,"PresentChargingVoltage",PresentChargingVoltage[0]);
- json_object_object_add(ChargingInfo1,"PresentChargingCurrent",PresentChargingCurrent[0]);
- json_object_object_add(ChargingInfo1,"PresentChargingPower",PresentChargingPower[0]);
- json_object_object_add(ChargingInfo1,"PresentChargedEnergy",PresentChargedEnergy[0]);
- json_object_object_add(ChargingInfo1,"PresentChargedDuration",PresentChargedDuration[0]);
- json_object_object_add(ChargingInfo1,"RemainChargingDuration",RemainChargingDuration[0]);
- json_object_object_add(ChargingInfo1,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[0]);
- json_object_object_add(ChargingInfo1,"EvBatterytargetVoltage",EvBatterytargetVoltage[0]);
- json_object_object_add(ChargingInfo1,"EvBatterySoc",EvBatterySoc[0]);
- json_object_object_add(ChargingInfo1,"PilotVoltage",PilotVoltage[0]);
- json_object_object_add(ChargingInfo1,"SystemStatus",SystemStatus[0]);
- json_object_object_add(ChargingInfo1,"EvBatterytargetCurrent",EvBatterytargetCurrent[0]);
- json_object_object_add(ChargingInfo1,"PowerConsumption",PowerConsumption[0]);
- if(strcmp(IsDO, "AX") == 0){
- json_object_object_add(ChargingInfo1,"isCalibratedVaGain",isCalibratedVaGain[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedVbGain",isCalibratedVbGain[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedVcGain",isCalibratedVcGain[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedVaOffset",isCalibratedVaOffset[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedVbOffset",isCalibratedVbOffset[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedVcOffset",isCalibratedVcOffset[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedCaGain",isCalibratedCaGain[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedCbGain",isCalibratedCbGain[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedCcGain",isCalibratedCcGain[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedCaOffset",isCalibratedCaOffset[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedCbOffset",isCalibratedCbOffset[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedCcOffset",isCalibratedCcOffset[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedPa",isCalibratedPa[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedPb",isCalibratedPb[0]);
- json_object_object_add(ChargingInfo1,"isCalibratedPc",isCalibratedPc[0]);
- }
- json_object_object_add(jobj2,"ChargingInfo1",ChargingInfo1);
- }
- if(connectorType2 != 0){
- json_object_object_add(ChargingInfo2,"StartUserId",StartUserId[1]);
- json_object_object_add(ChargingInfo2,"StartDateTime",StartDateTime[1]);
- json_object_object_add(ChargingInfo2,"StopDateTime",StopDateTime[1]);
- json_object_object_add(ChargingInfo2,"StartMethod",StartMethod[1]);
- json_object_object_add(ChargingInfo2,"ConnectorTemp",ConnectorTemp[1]);
- json_object_object_add(ChargingInfo2,"ChillerTemp",ChillerTemp[1]);
- json_object_object_add(ChargingInfo2,"PresentChargingVoltage",PresentChargingVoltage[1]);
- json_object_object_add(ChargingInfo2,"PresentChargingCurrent",PresentChargingCurrent[1]);
- json_object_object_add(ChargingInfo2,"PresentChargingPower",PresentChargingPower[1]);
- json_object_object_add(ChargingInfo2,"PresentChargedEnergy",PresentChargedEnergy[1]);
- json_object_object_add(ChargingInfo2,"PresentChargedDuration",PresentChargedDuration[1]);
- json_object_object_add(ChargingInfo2,"RemainChargingDuration",RemainChargingDuration[1]);
- json_object_object_add(ChargingInfo2,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[1]);
- json_object_object_add(ChargingInfo2,"EvBatterytargetVoltage",EvBatterytargetVoltage[1]);
- json_object_object_add(ChargingInfo2,"EvBatterySoc",EvBatterySoc[1]);
- json_object_object_add(ChargingInfo2,"PilotVoltage",PilotVoltage[1]);
- json_object_object_add(ChargingInfo2,"SystemStatus",SystemStatus[1]);
- json_object_object_add(ChargingInfo2,"EvBatterytargetCurrent",EvBatterytargetCurrent[1]);
- json_object_object_add(ChargingInfo2,"PowerConsumption",PowerConsumption[1]);
- if(strcmp(IsDO, "AX") == 0){
- json_object_object_add(ChargingInfo2,"isCalibratedVaGain",isCalibratedVaGain[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedVbGain",isCalibratedVbGain[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedVcGain",isCalibratedVcGain[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedVaOffset",isCalibratedVaOffset[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedVbOffset",isCalibratedVbOffset[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedVcOffset",isCalibratedVcOffset[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedCaGain",isCalibratedCaGain[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedCbGain",isCalibratedCbGain[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedCcGain",isCalibratedCcGain[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedCaOffset",isCalibratedCaOffset[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedCbOffset",isCalibratedCbOffset[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedCcOffset",isCalibratedCcOffset[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedPa",isCalibratedPa[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedPb",isCalibratedPb[1]);
- json_object_object_add(ChargingInfo2,"isCalibratedPc",isCalibratedPc[1]);
- }
- json_object_object_add(jobj2,"ChargingInfo2",ChargingInfo2);
- }
- if(connectorType3 != 0){
- json_object_object_add(ChargingInfo3,"StartUserId",StartUserId[2]);
- json_object_object_add(ChargingInfo3,"StartDateTime",StartDateTime[2]);
- json_object_object_add(ChargingInfo3,"StopDateTime",StopDateTime[2]);
- json_object_object_add(ChargingInfo3,"StartMethod",StartMethod[2]);
- json_object_object_add(ChargingInfo3,"ConnectorTemp",ConnectorTemp[2]);
- json_object_object_add(ChargingInfo3,"ChillerTemp",ChillerTemp[2]);
- json_object_object_add(ChargingInfo3,"PresentChargingVoltage",PresentChargingVoltage[2]);
- json_object_object_add(ChargingInfo3,"PresentChargingCurrent",PresentChargingCurrent[2]);
- json_object_object_add(ChargingInfo3,"PresentChargingPower",PresentChargingPower[2]);
- json_object_object_add(ChargingInfo3,"PresentChargedEnergy",PresentChargedEnergy[2]);
- json_object_object_add(ChargingInfo3,"PresentChargedDuration",PresentChargedDuration[2]);
- json_object_object_add(ChargingInfo3,"RemainChargingDuration",RemainChargingDuration[2]);
- json_object_object_add(ChargingInfo3,"EvBatteryMaxVoltage",EvBatteryMaxVoltage[2]);
- json_object_object_add(ChargingInfo3,"EvBatterytargetVoltage",EvBatterytargetVoltage[2]);
- json_object_object_add(ChargingInfo3,"EvBatterySoc",EvBatterySoc[2]);
- json_object_object_add(ChargingInfo3,"PilotVoltage",PilotVoltage[2]);
- json_object_object_add(ChargingInfo3,"SystemStatus",SystemStatus[2]);
- json_object_object_add(ChargingInfo3,"EvBatterytargetCurrent",EvBatterytargetCurrent[2]);
- json_object_object_add(ChargingInfo3,"PowerConsumption",PowerConsumption[2]);
- if(strcmp(IsDO, "AX") == 0){
- json_object_object_add(ChargingInfo3,"isCalibratedVaGain",isCalibratedVaGain[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedVbGain",isCalibratedVbGain[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedVcGain",isCalibratedVcGain[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedVaOffset",isCalibratedVaOffset[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedVbOffset",isCalibratedVbOffset[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedVcOffset",isCalibratedVcOffset[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedCaGain",isCalibratedCaGain[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedCbGain",isCalibratedCbGain[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedCcGain",isCalibratedCcGain[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedCaOffset",isCalibratedCaOffset[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedCbOffset",isCalibratedCbOffset[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedCcOffset",isCalibratedCcOffset[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedPa",isCalibratedPa[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedPb",isCalibratedPb[2]);
- json_object_object_add(ChargingInfo3,"isCalibratedPc",isCalibratedPc[2]);
- }
- json_object_object_add(jobj2,"ChargingInfo3",ChargingInfo3);
- }
- if(strcmp(IsDO, "DO") == 0 || strcmp(IsDO, "DK") == 0 || strcmp(IsDO, "DB") == 0 || strcmp(IsDO, "DL") == 0){
- if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity>4|| ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity<0)ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity=0;
- int DDTotalConnectorQuantity = ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity;
- DDChargingInfo1=json_object_new_object();
- DDChargingInfo2=json_object_new_object();
- DDChargingInfo3=json_object_new_object();
- DDChargingInfo4=json_object_new_object();
- if(DDTotalConnectorQuantity>0){
- json_object_object_add(DDChargingInfo1,"StartUserId",DDStartUserId[0]);
- json_object_object_add(DDChargingInfo1,"StartDateTime",DDStartDateTime[0]);
- json_object_object_add(DDChargingInfo1,"StopDateTime",DDStopDateTime[0]);
- json_object_object_add(DDChargingInfo1,"StartMethod",DDStartMethod[0]);
- json_object_object_add(DDChargingInfo1,"ConnectorTemp",DDConnectorTemp[0]);
- json_object_object_add(DDChargingInfo1,"ChillerTemp",DDChillerTemp[0]);
- json_object_object_add(DDChargingInfo1,"PresentChargingVoltage",DDPresentChargingVoltage[0]);
- json_object_object_add(DDChargingInfo1,"PresentChargingCurrent",DDPresentChargingCurrent[0]);
- json_object_object_add(DDChargingInfo1,"PresentChargingPower",DDPresentChargingPower[0]);
- json_object_object_add(DDChargingInfo1,"PresentChargedEnergy",DDPresentChargedEnergy[0]);
- json_object_object_add(DDChargingInfo1,"PresentChargedDuration",DDPresentChargedDuration[0]);
- json_object_object_add(DDChargingInfo1,"RemainChargingDuration",DDRemainChargingDuration[0]);
- json_object_object_add(DDChargingInfo1,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[0]);
- json_object_object_add(DDChargingInfo1,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[0]);
- json_object_object_add(DDChargingInfo1,"EvBatterySoc",DDEvBatterySoc[0]);
- json_object_object_add(DDChargingInfo1,"SystemStatus",DDSystemStatus[0]);
- json_object_object_add(DDChargingInfo1,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[0]);
- json_object_object_add(DDChargingInfo1,"PowerConsumption",DDPowerConsumption[0]);
- json_object_object_add(jobj2,"DDChargingInfo1",DDChargingInfo1);
- }
- if(DDTotalConnectorQuantity>1){
- json_object_object_add(DDChargingInfo2,"StartUserId",DDStartUserId[1]);
- json_object_object_add(DDChargingInfo2,"StartDateTime",DDStartDateTime[1]);
- json_object_object_add(DDChargingInfo2,"StopDateTime",DDStopDateTime[1]);
- json_object_object_add(DDChargingInfo2,"StartMethod",DDStartMethod[1]);
- json_object_object_add(DDChargingInfo2,"ConnectorTemp",DDConnectorTemp[1]);
- json_object_object_add(DDChargingInfo2,"ChillerTemp",DDChillerTemp[1]);
- json_object_object_add(DDChargingInfo2,"PresentChargingVoltage",DDPresentChargingVoltage[1]);
- json_object_object_add(DDChargingInfo2,"PresentChargingCurrent",DDPresentChargingCurrent[1]);
- json_object_object_add(DDChargingInfo2,"PresentChargingPower",DDPresentChargingPower[1]);
- json_object_object_add(DDChargingInfo2,"PresentChargedEnergy",DDPresentChargedEnergy[1]);
- json_object_object_add(DDChargingInfo2,"PresentChargedDuration",DDPresentChargedDuration[1]);
- json_object_object_add(DDChargingInfo2,"RemainChargingDuration",DDRemainChargingDuration[1]);
- json_object_object_add(DDChargingInfo2,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[1]);
- json_object_object_add(DDChargingInfo2,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[1]);
- json_object_object_add(DDChargingInfo2,"EvBatterySoc",DDEvBatterySoc[1]);
- json_object_object_add(DDChargingInfo2,"SystemStatus",DDSystemStatus[1]);
- json_object_object_add(DDChargingInfo2,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[1]);
- json_object_object_add(DDChargingInfo2,"PowerConsumption",DDPowerConsumption[1]);
- json_object_object_add(jobj2,"DDChargingInfo2",DDChargingInfo2);
- }
- if(DDTotalConnectorQuantity>2){
- json_object_object_add(DDChargingInfo3,"StartUserId",DDStartUserId[2]);
- json_object_object_add(DDChargingInfo3,"StartDateTime",DDStartDateTime[2]);
- json_object_object_add(DDChargingInfo3,"StopDateTime",DDStopDateTime[2]);
- json_object_object_add(DDChargingInfo3,"StartMethod",DDStartMethod[2]);
- json_object_object_add(DDChargingInfo3,"ConnectorTemp",DDConnectorTemp[2]);
- json_object_object_add(DDChargingInfo3,"ChillerTemp",DDChillerTemp[2]);
- json_object_object_add(DDChargingInfo3,"PresentChargingVoltage",DDPresentChargingVoltage[2]);
- json_object_object_add(DDChargingInfo3,"PresentChargingCurrent",DDPresentChargingCurrent[2]);
- json_object_object_add(DDChargingInfo3,"PresentChargingPower",DDPresentChargingPower[2]);
- json_object_object_add(DDChargingInfo3,"PresentChargedEnergy",DDPresentChargedEnergy[2]);
- json_object_object_add(DDChargingInfo3,"PresentChargedDuration",DDPresentChargedDuration[2]);
- json_object_object_add(DDChargingInfo3,"RemainChargingDuration",DDRemainChargingDuration[2]);
- json_object_object_add(DDChargingInfo3,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[2]);
- json_object_object_add(DDChargingInfo3,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[2]);
- json_object_object_add(DDChargingInfo3,"EvBatterySoc",DDEvBatterySoc[2]);
- json_object_object_add(DDChargingInfo3,"SystemStatus",DDSystemStatus[2]);
- json_object_object_add(DDChargingInfo3,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[2]);
- json_object_object_add(DDChargingInfo3,"PowerConsumption",DDPowerConsumption[2]);
- json_object_object_add(jobj2,"DDChargingInfo3",DDChargingInfo3);
- }
- if(DDTotalConnectorQuantity>3){
- json_object_object_add(DDChargingInfo4,"StartUserId",DDStartUserId[3]);
- json_object_object_add(DDChargingInfo4,"StartDateTime",DDStartDateTime[3]);
- json_object_object_add(DDChargingInfo4,"StopDateTime",DDStopDateTime[3]);
- json_object_object_add(DDChargingInfo4,"StartMethod",DDStartMethod[3]);
- json_object_object_add(DDChargingInfo4,"ConnectorTemp",DDConnectorTemp[3]);
- json_object_object_add(DDChargingInfo4,"ChillerTemp",DDChillerTemp[3]);
- json_object_object_add(DDChargingInfo4,"PresentChargingVoltage",DDPresentChargingVoltage[3]);
- json_object_object_add(DDChargingInfo4,"PresentChargingCurrent",DDPresentChargingCurrent[3]);
- json_object_object_add(DDChargingInfo4,"PresentChargingPower",DDPresentChargingPower[3]);
- json_object_object_add(DDChargingInfo4,"PresentChargedEnergy",DDPresentChargedEnergy[3]);
- json_object_object_add(DDChargingInfo4,"PresentChargedDuration",DDPresentChargedDuration[3]);
- json_object_object_add(DDChargingInfo4,"RemainChargingDuration",DDRemainChargingDuration[3]);
- json_object_object_add(DDChargingInfo4,"EvBatteryMaxVoltage",DDEvBatteryMaxVoltage[3]);
- json_object_object_add(DDChargingInfo4,"EvBatterytargetVoltage",DDEvBatterytargetVoltage[3]);
- json_object_object_add(DDChargingInfo4,"EvBatterySoc",DDEvBatterySoc[3]);
- json_object_object_add(DDChargingInfo4,"SystemStatus",DDSystemStatus[3]);
- json_object_object_add(DDChargingInfo4,"EvBatterytargetCurrent",DDEvBatterytargetCurrent[3]);
- json_object_object_add(DDChargingInfo4,"PowerConsumption",DDPowerConsumption[3]);
- json_object_object_add(jobj2,"DDChargingInfo4",DDChargingInfo4);
- }
- }
- json_object_object_add(jobj2,"V2GPrivateKey",V2GPrivateKey);
- json_object_object_add(jobj2,"V2GRootCertificate",V2GRootCertificate);
- json_object_object_add(jobj2,"V2GCertificateChain",V2GCertificateChain);
- printf("%s\n", json_object_to_json_string(jobj2));
- json_object_put(jobj2);
- //network
- json_object_object_add(jobj3,"InternetConn",InternetConn);
- json_object_object_add(jobj3,"FtpServer",FtpServer);
- json_object_object_add(jobj3,"Eth0DhcpClient",Eth0DhcpClient);
- json_object_object_add(jobj3,"Eth0MacAddress",Eth0MacAddress);
- json_object_object_add(jobj3,"Eth0IpAddress",Eth0IpAddress);
- json_object_object_add(jobj3,"Eth0SubmaskAddress",Eth0SubmaskAddress);
- json_object_object_add(jobj3,"Eth0GatewayAddress",Eth0GatewayAddress);
- json_object_object_add(jobj3,"Eth1DhcpClient",Eth1DhcpClient);
- json_object_object_add(jobj3,"Eth1MacAddress",Eth1MacAddress);
- json_object_object_add(jobj3,"Eth1IpAddress",Eth1IpAddress);
- json_object_object_add(jobj3,"Eth1SubmaskAddress",Eth1SubmaskAddress);
- json_object_object_add(jobj3,"Eth1GatewayAddress",Eth1GatewayAddress);
- json_object_object_add(jobj3,"WifiMode",WifiMode);
- json_object_object_add(jobj3,"WifiSsid",WifiSsid);
- json_object_object_add(jobj3,"WifiPassword",WifiPassword);
- json_object_object_add(jobj3,"WifiBroadcastSsid",WifiBroadcastSsid);
- json_object_object_add(jobj3,"WifiTargetBssidMac",WifiTargetBssidMac);
- json_object_object_add(jobj3,"WifiRssi",WifiRssi);
- json_object_object_add(jobj3,"WifiDhcpServer",WifiDhcpServer);
- json_object_object_add(jobj3,"WifiDhcpClient",WifiDhcpClient);
- json_object_object_add(jobj3,"WifiMacAddress",WifiMacAddress);
- json_object_object_add(jobj3,"WifiIpAddress",WifiIpAddress);
- json_object_object_add(jobj3,"WifiSubmaskAddress",WifiSubmaskAddress);
- json_object_object_add(jobj3,"WifiGatewayAddress",WifiGatewayAddress);
- json_object_object_add(jobj3,"WifiNetworkConn",WifiNetworkConn);
- json_object_object_add(jobj3,"TelcomApn",TelcomApn);
- json_object_object_add(jobj3,"TelcomRssi",TelcomRssi);
- json_object_object_add(jobj3,"TelcomChapPapId",TelcomChapPapId);
- json_object_object_add(jobj3,"TelcomChapPapPwd",TelcomChapPapPwd);
- json_object_object_add(jobj3,"TelcomModemImei",TelcomModemImei);
- json_object_object_add(jobj3,"TelcomSimImsi",TelcomSimImsi);
- json_object_object_add(jobj3,"TelcomSimIccid",TelcomSimIccid);
- json_object_object_add(jobj3,"TelcomSimStatus",TelcomSimStatus);
- json_object_object_add(jobj3,"TelcomModemMode",TelcomModemMode);
- json_object_object_add(jobj3,"TelcomIpAddress",TelcomIpAddress);
- json_object_object_add(jobj3,"TelcomNetworkConn",TelcomNetworkConn);
- json_object_object_add(jobj3,"TelcomEnabled",TelcomEnabled);
- json_object_object_add(jobj3,"TelcomNetworkType",TelcomNetworkType);
- json_object_object_add(jobj3,"isEnalbleFirewall",isEnalbleFirewall);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[0]);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[1]);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[2]);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[3]);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[4]);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[5]);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[6]);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[7]);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[8]);
- json_object_array_add(FirewallAcceptAddrArr,FirewallAcceptAddr[9]);
- json_object_object_add(jobj3,"FirewallAcceptAddr",FirewallAcceptAddrArr);
- printf("%s\n", json_object_to_json_string(jobj3));
- json_object_put(jobj3);
- //backend
- json_object_object_add(jobj4,"BackendConnTimeout",BackendConnTimeout);
- json_object_object_add(jobj4,"OfflinePolicy",OfflinePolicy);
- json_object_object_add(jobj4,"OfflineMaxChargeEnergy",OfflineMaxChargeEnergy);
- json_object_object_add(jobj4,"OfflineMaxChargeDuration",OfflineMaxChargeDuration);
- json_object_object_add(jobj4,"OcppConnStatus",OcppConnStatus);
- json_object_object_add(jobj4,"MaintainServerConnStatus",MaintainServerConnStatus);
- json_object_object_add(jobj4,"OcppServerURL",OcppServerURL);
- json_object_object_add(jobj4,"ChargeBoxId",ChargeBoxId);
- json_object_object_add(jobj4,"chargePointVendor",chargePointVendor);
- json_object_object_add(jobj4,"OcppSecurityProfile",OcppSecurityProfile);
- json_object_object_add(jobj4,"OcppSecurityPassword",OcppSecurityPassword);
- json_object_object_add(jobj4,"MaintainServerSecurityProfile",MaintainServerSecurityProfile);
- json_object_object_add(jobj4,"MaintainServerSecurityPassword",MaintainServerSecurityPassword);
- json_object_object_add(jobj4,"MaintainServerURL",MaintainServerURL);
- if(strcmp(IsDO, "AX") == 0 || strcmp(IsDO, "AW") == 0 || strcmp(IsAcDc, "D") == 0){
- json_object_object_add(jobj4,"isEnableLocalPowerSharging",isEnableLocalPowerSharging);
- json_object_object_add(jobj4,"PowerSharingCapacity",PowerSharingCapacity);
- json_object_object_add(jobj4,"PowerSharingServerIP",PowerSharingServerIP);
- json_object_object_add(jobj4,"OcppReceiptrURL",OcppReceiptrURL);
- }
- /*for TTIA*/
- if(strcmp(IsAcDc, "D") == 0 && strcmp(SafetyRegulation, "C") == 0){
- json_object_object_add(jobj4,"isEnableTTIA",isEnableTTIA);
- json_object_object_add(jobj4,"server_addr",server_addr);
- json_object_object_add(jobj4,"server_port",server_port);
- json_object_object_add(jobj4,"busVenderId",busVenderId);
- json_object_object_add(jobj4,"EquipmentProvider",EquipmentProvider);
- json_object_object_add(jobj4,"TransportationCompanyNo",TransportationCompanyNo);
- json_object_object_add(jobj4,"TTIAChargeBoxId",TTIAChargeBoxId);
- json_object_object_add(jobj4,"evseStation",evseStation);
- }
- json_object_object_add(jobj4,"ChargePointPrivateKey",ChargePointPrivateKey);
- json_object_object_add(jobj4,"ChargePointCertificate",ChargePointCertificate);
- json_object_object_add(jobj4,"MORootCertificate",MORootCertificate);
- json_object_object_add(jobj4,"CSRootCertificate",CSRootCertificate);
- json_object_object_add(jobj4,"ManufacturerRootCertificate",ManufacturerRootCertificate);
- printf("%s\n", json_object_to_json_string(jobj4));
- json_object_put(jobj4);
- }
- // get status code
- if(strcmp(argv[1], "StatusCode") == 0)
- {
- int type = atoi(argv[2]);
- int bytes = atoi(argv[3]);
- int bits = atoi(argv[4]);
- struct json_object *jobj1;
- //FaultCode
- struct json_object *FaultCode;
- //AlarmCode
- struct json_object *AlarmCode;
- //InfoCode
- struct json_object *InfoCode;
- jobj1=json_object_new_object();
- //FaultCode
- if(type==1){
- FaultCode = json_object_new_int(((ShmStatusCodeData->FaultCode.FaultEvents.FaultVal[bytes]) >> bits) & 1);//(num >> n) & 1
- json_object_object_add(jobj1,"FaultCode",FaultCode);
- }
- //AlarmCode
- if(type==2){
- AlarmCode = json_object_new_int(((ShmStatusCodeData->AlarmCode.AlarmEvents.AlarmVal[bytes]) >> bits) & 1);//(num >> n) & 1
- json_object_object_add(jobj1,"AlarmCode",AlarmCode);
- }
- //InfoCode
- if(type==3){
- InfoCode = json_object_new_int(((ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[bytes]) >> bits) & 1);//(num >> n) & 1
- json_object_object_add(jobj1,"InfoCode",InfoCode);
- }
- printf("%s\n", json_object_to_json_string(jobj1));
- json_object_put(jobj1);
- }
- // for(;;)
- // {
- // }
- return FAIL;
- }
|