Module_EvComm.c 178 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882
  1. #include <sys/time.h>
  2. #include <sys/timeb.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6. #include <sys/ioctl.h>
  7. #include <sys/socket.h>
  8. #include <sys/ipc.h>
  9. #include <sys/shm.h>
  10. #include <sys/shm.h>
  11. #include <sys/mman.h>
  12. #include <linux/can.h>
  13. #include <linux/can/raw.h>
  14. #include <linux/wireless.h>
  15. #include <arpa/inet.h>
  16. #include <netinet/in.h>
  17. #include <unistd.h>
  18. #include <stdarg.h>
  19. #include <stdio.h> /*標準輸入輸出定義*/
  20. #include <stdlib.h> /*標準函數庫定義*/
  21. #include <unistd.h> /*Unix 標準函數定義*/
  22. #include <fcntl.h> /*檔控制定義*/
  23. #include <termios.h> /*PPSIX 終端控制定義*/
  24. #include <errno.h> /*錯誤號定義*/
  25. #include <errno.h>
  26. #include <string.h>
  27. #include <time.h>
  28. #include <ctype.h>
  29. #include <ifaddrs.h>
  30. #include "../../define.h"
  31. #include "Module_EvComm.h"
  32. #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
  33. #define PASS 1
  34. #define FAIL -1
  35. #define START 1
  36. #define STOP 0
  37. #define COMMUNICATION 2
  38. #define YES 1
  39. #define NO 0
  40. #define EQUAL 0
  41. #define CHK_VOL_RANGE 50
  42. #define CHK_CUR_RANGE 20
  43. struct SysConfigAndInfo *ShmSysConfigAndInfo;
  44. struct StatusCodeData *ShmStatusCodeData;
  45. struct FanModuleData *ShmFanModuleData;
  46. struct CHAdeMOData *ShmCHAdeMOData;
  47. struct GBTData *ShmGBTData;
  48. struct CcsData *ShmCcsData;
  49. struct PsuData *ShmPsuData;
  50. byte gun_count;
  51. int chargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  52. float LogInfo[2][10];
  53. // 限制最大充電電壓,因應不同 type 槍線來限制
  54. // Chademo : 500V, 125A,
  55. // GB : 750, 120A
  56. // CCS : 950V, 120A
  57. double chademoVol = 5000;
  58. double ccsVol = 9500;
  59. double gbVol = 7500;
  60. float maxChargingVol[2] = { 0, 0 }; // 限制最大充電電壓,如依照模塊則填上 0
  61. // 限制最大充電電流與能量透過 Web
  62. float maxChargingCur[2] = { 0, 0 }; // 限制最大充電電流,如依照模塊則填上 0
  63. float maxChargingPow = 0; // 限制最大充電能量,如依照模塊則填上 0
  64. // 槍資訊
  65. struct ChargingInfoData *_chargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  66. struct timeval _chk_ratingPower_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  67. struct timeval _chk_chademo_permission_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  68. bool chkChademoPermission[2] = { false, false };
  69. byte SendErrorCount[2] = { 0, 0};
  70. struct Ev_Board_Cmd Ev_Cmd={
  71. 0,
  72. 0x00000200,
  73. 0x00000400,
  74. 0x00000500,
  75. 0x00000600,
  76. 0x00000700,
  77. 0x00000800,
  78. 0x00000900,
  79. 0x00000A00,
  80. 0x00000C00,
  81. 0x00000D00,
  82. 0x00000E00,
  83. 0x00000F00,
  84. 0x00001000,
  85. 0x00001100,
  86. 0x00001200,
  87. 0x00001400,
  88. 0x00001500,
  89. };
  90. unsigned char mask_table[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
  91. void PRINTF_FUNC(char *string, ...);
  92. void GetMaxVolAndCurMethod(byte index, float *vol, float *cur);
  93. void GetMaxPowerMethod(byte index, float *pow);
  94. unsigned long GetTimeoutValue(struct timeval _sour_time);
  95. #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  96. #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  97. #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  98. unsigned long GetTimeoutValue(struct timeval _sour_time)
  99. {
  100. struct timeval _end_time;
  101. gettimeofday(&_end_time, NULL);
  102. return 1000000 * (_end_time.tv_sec - _sour_time.tv_sec) + _end_time.tv_usec - _sour_time.tv_usec;
  103. }
  104. int StoreLogMsg(const char *fmt, ...)
  105. {
  106. char Buf[4096+256];
  107. char buffer[4096];
  108. va_list args;
  109. struct timeb SeqEndTime;
  110. struct tm *tm;
  111. va_start(args, fmt);
  112. int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
  113. va_end(args);
  114. memset(Buf,0,sizeof(Buf));
  115. ftime(&SeqEndTime);
  116. SeqEndTime.time = time(NULL);
  117. tm=localtime(&SeqEndTime.time);
  118. if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES)
  119. {
  120. sprintf(Buf,"%02d:%02d:%02d:%03d - %s",
  121. tm->tm_hour,tm->tm_min,tm->tm_sec,SeqEndTime.millitm, buffer);
  122. printf("%s \n", Buf);
  123. }
  124. else
  125. {
  126. sprintf(Buf,"echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
  127. tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,SeqEndTime.millitm,
  128. buffer,
  129. tm->tm_year+1900,tm->tm_mon+1);
  130. system(Buf);
  131. }
  132. return rc;
  133. }
  134. int DiffTimeb(struct timeb ST, struct timeb ET)
  135. {
  136. //return milli-second
  137. unsigned int StartTime,StopTime;
  138. StartTime=(unsigned int)ST.time;
  139. StopTime=(unsigned int)ET.time;
  140. return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
  141. }
  142. void PRINTF_FUNC(char *string, ...)
  143. {
  144. va_list args;
  145. char buffer[4096];
  146. va_start(args, string);
  147. vsnprintf(buffer, sizeof(buffer), string, args);
  148. va_end(args);
  149. DEBUG_INFO("%s \n", buffer);
  150. }
  151. //=================================
  152. // Common routine
  153. //=================================
  154. void getTimeString(char *buff)
  155. {
  156. time_t timep;
  157. struct tm *p;
  158. time(&timep);
  159. p=gmtime(&timep);
  160. sprintf(buff, "[%04d-%02d-%02d %02d:%02d:%02d]", (1900+p->tm_year), (1+p->tm_mon), p->tm_mday, p->tm_hour, p->tm_hour, p->tm_sec);
  161. }
  162. bool CheckUniqNumber(byte value)
  163. {
  164. for (byte index = 0; index < gun_count; index++)
  165. {
  166. if (_chargingData[index]->Evboard_id == value)
  167. {
  168. struct timeval _end_time;
  169. gettimeofday(&_end_time, NULL);
  170. unsigned long diff = 1000000 * (_end_time.tv_sec - _id_assign_time.tv_sec) + _end_time.tv_usec - _id_assign_time.tv_usec;
  171. if (diff >= 3000000)
  172. {
  173. gettimeofday(&_id_assign_time, NULL);
  174. return true;
  175. }
  176. else
  177. {
  178. return false;
  179. }
  180. }
  181. }
  182. gettimeofday(&_id_assign_time, NULL);
  183. return true;
  184. }
  185. //==========================================
  186. // Init all share memory
  187. //==========================================
  188. int InitShareMemory()
  189. {
  190. int result = PASS;
  191. int MeterSMId;
  192. //initial ShmSysConfigAndInfo
  193. if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
  194. {
  195. #ifdef SystemLogMessage
  196. DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
  197. #endif
  198. result = FAIL;
  199. }
  200. else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
  201. {
  202. #ifdef SystemLogMessage
  203. DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
  204. #endif
  205. result = FAIL;
  206. }
  207. else
  208. {}
  209. //initial ShmStatusCodeData
  210. if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
  211. {
  212. #ifdef SystemLogMessage
  213. DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
  214. #endif
  215. result = FAIL;
  216. }
  217. else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
  218. {
  219. #ifdef SystemLogMessage
  220. DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
  221. #endif
  222. result = FAIL;
  223. }
  224. else
  225. {}
  226. //creat ShmPsuData
  227. if ((MeterSMId = shmget(ShmPsuKey, sizeof(struct PsuData), 0777)) < 0)
  228. {
  229. #ifdef SystemLogMessage
  230. DEBUG_ERROR("shmget ShmPsuData NG \n");
  231. #endif
  232. result = FAIL;
  233. }
  234. else if ((ShmPsuData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
  235. {
  236. #ifdef SystemLogMessage
  237. DEBUG_ERROR("shmat ShmPsuData NG \n");
  238. #endif
  239. result = FAIL;
  240. }
  241. if(CHAdeMO_QUANTITY > 0)
  242. {
  243. if ((MeterSMId = shmget(ShmCHAdeMOCommKey, sizeof(struct CHAdeMOData), IPC_CREAT | 0777)) < 0)
  244. {
  245. #ifdef SystemLogMessage
  246. DEBUG_ERROR("[shmget ShmCHAdeMOData NG \n");
  247. #endif
  248. return FAIL;
  249. }
  250. else if ((ShmCHAdeMOData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
  251. {
  252. #ifdef SystemLogMessage
  253. DEBUG_ERROR("shmat ShmCHAdeMOData NG \n");
  254. #endif
  255. return FAIL;
  256. }
  257. else
  258. {}
  259. }
  260. if(GB_QUANTITY > 0)
  261. {
  262. if ((MeterSMId = shmget(ShmGBTCommKey, sizeof(struct GBTData), IPC_CREAT | 0777)) < 0)
  263. {
  264. #ifdef SystemLogMessage
  265. DEBUG_ERROR("[shmget ShmGBTData NG \n");
  266. #endif
  267. return FAIL;
  268. }
  269. else if ((ShmGBTData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
  270. {
  271. #ifdef SystemLogMessage
  272. DEBUG_ERROR("shmat ShmGBTData NG \n");
  273. #endif
  274. return FAIL;
  275. }
  276. else
  277. {}
  278. }
  279. if(CCS_QUANTITY > 0)
  280. {
  281. if ((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData), IPC_CREAT | 0777)) < 0)
  282. {
  283. #ifdef SystemLogMessage
  284. DEBUG_ERROR("shmget ShmCcsData NG \n");
  285. #endif
  286. return FAIL;
  287. }
  288. else if ((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *) -1) {
  289. #ifdef SystemLogMessage
  290. DEBUG_ERROR("shmat ShmCcsData NG \n");
  291. #endif
  292. return FAIL;
  293. }
  294. else
  295. {}
  296. }
  297. return result;
  298. }
  299. //================================================
  300. // initial can-bus
  301. //================================================
  302. int InitCanBus()
  303. {
  304. int s0,nbytes;
  305. struct timeval tv;
  306. struct ifreq ifr0;
  307. struct sockaddr_can addr0;
  308. system("/sbin/ip link set can0 down");
  309. system("/sbin/ip link set can0 type can bitrate 500000 restart-ms 100");
  310. system("/sbin/ip link set can0 up");
  311. s0 = socket(PF_CAN, SOCK_RAW, CAN_RAW);
  312. tv.tv_sec = 0;
  313. tv.tv_usec = 10000;
  314. if (setsockopt(s0, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval)) < 0)
  315. {
  316. #ifdef SystemLogMessage
  317. DEBUG_ERROR("Set SO_RCVTIMEO NG");
  318. #endif
  319. }
  320. nbytes=40960;
  321. if (setsockopt(s0, SOL_SOCKET, SO_RCVBUF, &nbytes, sizeof(int)) < 0)
  322. {
  323. #ifdef SystemLogMessage
  324. DEBUG_ERROR("Set SO_RCVBUF NG");
  325. #endif
  326. }
  327. nbytes=40960;
  328. if (setsockopt(s0, SOL_SOCKET, SO_SNDBUF, &nbytes, sizeof(int)) < 0)
  329. {
  330. #ifdef SystemLogMessage
  331. DEBUG_ERROR("Set SO_SNDBUF NG");
  332. #endif
  333. }
  334. strcpy(ifr0.ifr_name, "can0" );
  335. ioctl(s0, SIOCGIFINDEX, &ifr0); /* ifr.ifr_ifindex gets filled with that device's index */
  336. addr0.can_family = AF_CAN;
  337. addr0.can_ifindex = ifr0.ifr_ifindex;
  338. bind(s0, (struct sockaddr *)&addr0, sizeof(addr0));
  339. return s0;
  340. }
  341. //================================================
  342. //================================================
  343. // CANBUS receive task
  344. //================================================
  345. //================================================
  346. bool FindChargingInfoData(byte target, struct ChargingInfoData **chargingData)
  347. {
  348. for (byte index = 0; index < CHAdeMO_QUANTITY; index++)
  349. {
  350. if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == target)
  351. {
  352. chargingData[target] = &ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index];
  353. return true;
  354. }
  355. }
  356. for (byte index = 0; index < CCS_QUANTITY; index++)
  357. {
  358. if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == target)
  359. {
  360. chargingData[target] = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[index];
  361. return true;
  362. }
  363. }
  364. for (byte index = 0; index < GB_QUANTITY; index++)
  365. {
  366. if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == target)
  367. {
  368. chargingData[target] = &ShmSysConfigAndInfo->SysInfo.GbChargingData[index];
  369. return true;
  370. }
  371. }
  372. return false;
  373. }
  374. void AddrAssignment(byte *data)
  375. {
  376. byte target_number[8];
  377. byte index = 0x00;
  378. memcpy(target_number, data, sizeof(target_number));
  379. index = *(data + 4);
  380. if (gun_count == 1)
  381. index = 0x01;
  382. // if (CheckUniqNumber(index))
  383. {
  384. if (_chargingData[index - 1]->Type == _Type_Chademo)
  385. PRINTF_FUNC("Set EV board info : (Chademo) TargetAddr = %d \n", index);
  386. else if (_chargingData[index - 1]->Type == _Type_CCS_2)
  387. PRINTF_FUNC("Set EV board info : (CCS) TargetAddr = %d \n", index);
  388. else if (_chargingData[index - 1]->Type == _Type_GB)
  389. PRINTF_FUNC("Set EV board info : (GB) TargetAddr = %d \n", index);
  390. SetTargetAddr(target_number, index);
  391. }
  392. }
  393. void ClearAbnormalStatus_Chademo(byte gun_index)
  394. {
  395. bool isCleanCheck = false;
  396. char code[7];
  397. if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) == EQUAL)
  398. return;
  399. if (true)
  400. {
  401. if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023700", 6) == EQUAL &&
  402. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvCommFail == YES)
  403. {
  404. memcpy(code, "023700", 6);
  405. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  406. isCleanCheck = true;
  407. }
  408. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023704", 6) == EQUAL &&
  409. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryMalfun == YES)
  410. {
  411. memcpy(code, "023704", 6);
  412. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  413. isCleanCheck = true;
  414. }
  415. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023705", 6) == EQUAL &&
  416. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoNoPermission == YES)
  417. {
  418. memcpy(code, "023705", 6);
  419. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  420. isCleanCheck = true;
  421. }
  422. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023706", 6) == EQUAL &&
  423. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryIncompatibility == YES)
  424. {
  425. memcpy(code, "023706", 6);
  426. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  427. isCleanCheck = true;
  428. }
  429. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023707", 6) == EQUAL &&
  430. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOVP == YES)
  431. {
  432. memcpy(code, "023707", 6);
  433. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  434. isCleanCheck = true;
  435. }
  436. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023708", 6) == EQUAL &&
  437. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryUVP == YES)
  438. {
  439. memcpy(code, "023708", 6);
  440. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  441. isCleanCheck = true;
  442. }
  443. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023709", 6) == EQUAL &&
  444. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOTP == YES)
  445. {
  446. memcpy(code, "023709", 6);
  447. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  448. isCleanCheck = true;
  449. }
  450. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023710", 6) == EQUAL &&
  451. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryCurrentDiff == YES)
  452. {
  453. memcpy(code, "023710", 6);
  454. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  455. isCleanCheck = true;
  456. }
  457. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023711", 6) == EQUAL &&
  458. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryVoltageDiff == YES)
  459. {
  460. memcpy(code, "023711", 6);
  461. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  462. isCleanCheck = true;
  463. }
  464. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023712", 6) == EQUAL &&
  465. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoShiftPosition == YES)
  466. {
  467. memcpy(code, "023712", 6);
  468. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  469. isCleanCheck = true;
  470. }
  471. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023713", 6) == EQUAL &&
  472. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOtherFault == YES)
  473. {
  474. memcpy(code, "023713", 6);
  475. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  476. isCleanCheck = true;
  477. }
  478. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023714", 6) == EQUAL &&
  479. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargingSystemError == YES)
  480. {
  481. memcpy(code, "023714", 6);
  482. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  483. isCleanCheck = true;
  484. }
  485. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023715", 6) == EQUAL &&
  486. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvNormalStop == YES)
  487. {
  488. memcpy(code, "023715", 6);
  489. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  490. isCleanCheck = true;
  491. }
  492. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023716", 6) == EQUAL &&
  493. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoTempSensorBroken == YES)
  494. {
  495. memcpy(code, "023716", 6);
  496. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  497. isCleanCheck = true;
  498. }
  499. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023717", 6) == EQUAL &&
  500. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoConnectorLockFail == YES)
  501. {
  502. memcpy(code, "023717", 6);
  503. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  504. isCleanCheck = true;
  505. }
  506. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023718", 6) == EQUAL &&
  507. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoD1OnNoReceive == YES)
  508. {
  509. memcpy(code, "023718", 6);
  510. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  511. isCleanCheck = true;
  512. }
  513. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023719", 6) == EQUAL &&
  514. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJTimeout == YES)
  515. {
  516. memcpy(code, "023719", 6);
  517. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  518. isCleanCheck = true;
  519. }
  520. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023720", 6) == EQUAL &&
  521. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeAllowTimeout == YES)
  522. {
  523. memcpy(code, "023720", 6);
  524. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  525. isCleanCheck = true;
  526. }
  527. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023721", 6) == EQUAL &&
  528. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoWaitGfdTimeout == YES)
  529. {
  530. memcpy(code, "023721", 6);
  531. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  532. isCleanCheck = true;
  533. }
  534. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023722", 6) == EQUAL &&
  535. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayTimeout == YES)
  536. {
  537. memcpy(code, "023722", 6);
  538. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  539. isCleanCheck = true;
  540. }
  541. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023723", 6) == EQUAL &&
  542. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsReqCurrentTimeout == YES)
  543. {
  544. memcpy(code, "023723", 6);
  545. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  546. isCleanCheck = true;
  547. }
  548. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023724", 6) == EQUAL &&
  549. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJOffTimeout == YES)
  550. {
  551. memcpy(code, "023724", 6);
  552. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  553. isCleanCheck = true;
  554. }
  555. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023725", 6) == EQUAL &&
  556. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayOffTimeout == YES)
  557. {
  558. memcpy(code, "023725", 6);
  559. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  560. isCleanCheck = true;
  561. }
  562. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023726", 6) == EQUAL &&
  563. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan10V == YES)
  564. {
  565. memcpy(code, "023726", 6);
  566. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  567. isCleanCheck = true;
  568. }
  569. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023727", 6) == EQUAL &&
  570. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan20V == YES)
  571. {
  572. memcpy(code, "023727", 6);
  573. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  574. isCleanCheck = true;
  575. }
  576. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023728", 6) == EQUAL &&
  577. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeBeforeStop == YES)
  578. {
  579. memcpy(code, "023728", 6);
  580. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  581. isCleanCheck = true;
  582. }
  583. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023729", 6) == EQUAL &&
  584. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetNormalStop == YES)
  585. {
  586. memcpy(code, "023729", 6);
  587. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  588. isCleanCheck = true;
  589. }
  590. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023730", 6) == EQUAL &&
  591. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetEmergencyStop == YES)
  592. {
  593. memcpy(code, "023730", 6);
  594. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  595. isCleanCheck = true;
  596. }
  597. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023731", 6) == EQUAL &&
  598. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoIsolationResultFail == YES)
  599. {
  600. memcpy(code, "023731", 6);
  601. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  602. isCleanCheck = true;
  603. }
  604. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023732", 6) == EQUAL &&
  605. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoMissLinkWithMotherBoard == YES)
  606. {
  607. memcpy(code, "023732", 6);
  608. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  609. isCleanCheck = true;
  610. }
  611. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023733", 6) == EQUAL &&
  612. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoOutputVolMoreThanLimit == YES)
  613. {
  614. memcpy(code, "023733", 6);
  615. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  616. isCleanCheck = true;
  617. }
  618. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023734", 6) == EQUAL &&
  619. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReqCurrentMoreThanLimit == YES)
  620. {
  621. memcpy(code, "023734", 6);
  622. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  623. isCleanCheck = true;
  624. }
  625. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023735", 6) == EQUAL &&
  626. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed == YES)
  627. {
  628. memcpy(code, "023735", 6);
  629. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  630. isCleanCheck = true;
  631. }
  632. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023736", 6) == EQUAL &&
  633. ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown == YES)
  634. {
  635. memcpy(code, "023736", 6);
  636. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  637. isCleanCheck = true;
  638. }
  639. }
  640. if (isCleanCheck)
  641. {
  642. for (byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++)
  643. {
  644. if (index != gun_index || ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
  645. {
  646. PRINTF_FUNC("CHA clean error : index = %d, EvConnAlarmCode = %s, code = %s \n", index, _chargingData[index]->EvConnAlarmCode, code);
  647. if (strncmp((char *)_chargingData[index]->EvConnAlarmCode, code, 6) != EQUAL)
  648. {
  649. if (strncmp(code, "023700", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvCommFail = NO;
  650. if (strncmp(code, "023704", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryMalfun = NO;
  651. if (strncmp(code, "023705", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoNoPermission = NO;
  652. if (strncmp(code, "023706", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryIncompatibility = NO;
  653. if (strncmp(code, "023707", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOVP = NO;
  654. if (strncmp(code, "023708", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryUVP = NO;
  655. if (strncmp(code, "023709", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOTP = NO;
  656. if (strncmp(code, "023710", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryCurrentDiff = NO;
  657. if (strncmp(code, "023711", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryVoltageDiff = NO;
  658. if (strncmp(code, "023712", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoShiftPosition = NO;
  659. if (strncmp(code, "023713", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOtherFault = NO;
  660. if (strncmp(code, "023714", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargingSystemError = NO;
  661. if (strncmp(code, "023715", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvNormalStop = NO;
  662. if (strncmp(code, "023716", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoTempSensorBroken = NO;
  663. if (strncmp(code, "023717", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoConnectorLockFail = NO;
  664. if (strncmp(code, "023718", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoD1OnNoReceive = NO;
  665. if (strncmp(code, "023719", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJTimeout = NO;
  666. if (strncmp(code, "023720", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeAllowTimeout = NO;
  667. if (strncmp(code, "023721", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoWaitGfdTimeout = NO;
  668. if (strncmp(code, "023722", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayTimeout = NO;
  669. if (strncmp(code, "023723", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsReqCurrentTimeout = NO;
  670. if (strncmp(code, "023724", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJOffTimeout = NO;
  671. if (strncmp(code, "023725", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayOffTimeout = NO;
  672. if (strncmp(code, "023726", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan10V = NO;
  673. if (strncmp(code, "023727", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan20V = NO;
  674. if (strncmp(code, "023728", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeBeforeStop = NO;
  675. if (strncmp(code, "023729", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetNormalStop = NO;
  676. if (strncmp(code, "023730", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetEmergencyStop = NO;
  677. if (strncmp(code, "023731", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoIsolationResultFail = NO;
  678. if (strncmp(code, "023732", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoMissLinkWithMotherBoard = NO;
  679. if (strncmp(code, "023733", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoOutputVolMoreThanLimit = NO;
  680. if (strncmp(code, "023734", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReqCurrentMoreThanLimit = NO;
  681. if (strncmp(code, "023735", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed = NO;
  682. if (strncmp(code, "023736", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown = NO;
  683. }
  684. }
  685. }
  686. }
  687. }
  688. void ClearAbnormalStatus_GB(byte gun_index)
  689. {
  690. bool isCleanCheck = false;
  691. char code[7];
  692. if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) == EQUAL)
  693. return;
  694. if (true)
  695. {
  696. if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023702", 6) == EQUAL &&
  697. ShmStatusCodeData->InfoCode.InfoEvents.bits.GbEvCommFail == YES)
  698. {
  699. memcpy(code, "023702", 6);
  700. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  701. isCleanCheck = true;
  702. }
  703. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023900", 6) == EQUAL &&
  704. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_LOS_CC1 == YES)
  705. {
  706. memcpy(code, "023900", 6);
  707. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  708. isCleanCheck = true;
  709. }
  710. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023901", 6) == EQUAL &&
  711. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CONNECTOR_LOCK_FAIL == YES)
  712. {
  713. memcpy(code, "023901", 6);
  714. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  715. isCleanCheck = true;
  716. }
  717. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023902", 6) == EQUAL &&
  718. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BATTERY_INCOMPATIBLE == YES)
  719. {
  720. memcpy(code, "023902", 6);
  721. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  722. isCleanCheck = true;
  723. }
  724. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023903", 6) == EQUAL &&
  725. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_BROAA_TIMEOUT == YES)
  726. {
  727. memcpy(code, "023903", 6);
  728. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  729. isCleanCheck = true;
  730. }
  731. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023904", 6) == EQUAL &&
  732. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CSU_PRECHARGE_TIMEOUT == YES)
  733. {
  734. memcpy(code, "023904", 6);
  735. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  736. isCleanCheck = true;
  737. }
  738. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023905", 6) == EQUAL &&
  739. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_PRESENT_VOLTAGE_FAULT == YES)
  740. {
  741. memcpy(code, "023905", 6);
  742. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  743. isCleanCheck = true;
  744. }
  745. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023906", 6) == EQUAL &&
  746. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_VOLTAGE_OVER_RANGE == YES)
  747. {
  748. memcpy(code, "023906", 6);
  749. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  750. isCleanCheck = true;
  751. }
  752. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023907", 6) == EQUAL &&
  753. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BSM_CHARGE_ALLOW_00_10MIN_COUUNTDONE == YES)
  754. {
  755. memcpy(code, "023907", 6);
  756. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  757. isCleanCheck = true;
  758. }
  759. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023908", 6) == EQUAL &&
  760. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_WAIT_GROUNDFAULT_TIMEOUT == YES)
  761. {
  762. memcpy(code, "023908", 6);
  763. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  764. isCleanCheck = true;
  765. }
  766. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023909", 6) == EQUAL &&
  767. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_10V == YES)
  768. {
  769. memcpy(code, "023909", 6);
  770. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  771. isCleanCheck = true;
  772. }
  773. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023910", 6) == EQUAL &&
  774. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_60V == YES)
  775. {
  776. memcpy(code, "023910", 6);
  777. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  778. isCleanCheck = true;
  779. }
  780. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023911", 6) == EQUAL &&
  781. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_NORMAL_STOP_CMD == YES)
  782. {
  783. memcpy(code, "023911", 6);
  784. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  785. isCleanCheck = true;
  786. }
  787. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023912", 6) == EQUAL &&
  788. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_EMERGENCY_STOP_CMD == YES)
  789. {
  790. memcpy(code, "023912", 6);
  791. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  792. isCleanCheck = true;
  793. }
  794. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023913", 6) == EQUAL &&
  795. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ISOLATION_RESULT_FAIL == YES)
  796. {
  797. memcpy(code, "023913", 6);
  798. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  799. isCleanCheck = true;
  800. }
  801. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023914", 6) == EQUAL &&
  802. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_MOTHER_BOARD_MISS_LINK == YES)
  803. {
  804. memcpy(code, "023914", 6);
  805. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  806. isCleanCheck = true;
  807. }
  808. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023915", 6) == EQUAL &&
  809. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_LIMIT == YES)
  810. {
  811. memcpy(code, "023915", 6);
  812. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  813. isCleanCheck = true;
  814. }
  815. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023916", 6) == EQUAL &&
  816. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_REQ_CURRENT_MORE_THAN_LIMIT == YES)
  817. {
  818. memcpy(code, "023916", 6);
  819. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  820. isCleanCheck = true;
  821. }
  822. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023917", 6) == EQUAL &&
  823. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_10_PERCENT == YES)
  824. {
  825. memcpy(code, "023917", 6);
  826. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  827. isCleanCheck = true;
  828. }
  829. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023918", 6) == EQUAL &&
  830. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_DIFF_BCS_5_PERCENT == YES)
  831. {
  832. memcpy(code, "023918", 6);
  833. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  834. isCleanCheck = true;
  835. }
  836. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023919", 6) == EQUAL &&
  837. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_STOP_ADC_MORE_THAN_10V == YES)
  838. {
  839. memcpy(code, "023919", 6);
  840. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  841. isCleanCheck = true;
  842. }
  843. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023930", 6) == EQUAL &&
  844. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BHM_TIMEOUT == YES)
  845. {
  846. memcpy(code, "023930", 6);
  847. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  848. isCleanCheck = true;
  849. }
  850. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023931", 6) == EQUAL &&
  851. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRM_TIMEOUT == YES)
  852. {
  853. memcpy(code, "023931", 6);
  854. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  855. isCleanCheck = true;
  856. }
  857. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023932", 6) == EQUAL &&
  858. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCP_TIMEOUT == YES)
  859. {
  860. memcpy(code, "023932", 6);
  861. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  862. isCleanCheck = true;
  863. }
  864. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023933", 6) == EQUAL &&
  865. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRO_TIMEOUT == YES)
  866. {
  867. memcpy(code, "023933", 6);
  868. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  869. isCleanCheck = true;
  870. }
  871. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023934", 6) == EQUAL &&
  872. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCL_TIMEOUT == YES)
  873. {
  874. memcpy(code, "023934", 6);
  875. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  876. isCleanCheck = true;
  877. }
  878. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023935", 6) == EQUAL &&
  879. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCS_TIMEOUT == YES)
  880. {
  881. memcpy(code, "023935", 6);
  882. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  883. isCleanCheck = true;
  884. }
  885. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023936", 6) == EQUAL &&
  886. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSM_TIMEOUT == YES)
  887. {
  888. memcpy(code, "023936", 6);
  889. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  890. isCleanCheck = true;
  891. }
  892. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023937", 6) == EQUAL &&
  893. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BST_TIMEOUT == YES)
  894. {
  895. memcpy(code, "023937", 6);
  896. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  897. isCleanCheck = true;
  898. }
  899. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023938", 6) == EQUAL &&
  900. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSD_TIMEOUT == YES)
  901. {
  902. memcpy(code, "023938", 6);
  903. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  904. isCleanCheck = true;
  905. }
  906. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023939", 6) == EQUAL &&
  907. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BEM_OTHER_TIMEOUT == YES)
  908. {
  909. memcpy(code, "023939", 6);
  910. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  911. isCleanCheck = true;
  912. }
  913. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023940", 6) == EQUAL &&
  914. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRM_TIMEOUT == YES)
  915. {
  916. memcpy(code, "023940", 6);
  917. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  918. isCleanCheck = true;
  919. }
  920. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023941", 6) == EQUAL &&
  921. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRMAA_TIMEOUT == YES)
  922. {
  923. memcpy(code, "023941", 6);
  924. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  925. isCleanCheck = true;
  926. }
  927. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023942", 6) == EQUAL &&
  928. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CTS_CML_TIMEOUT == YES)
  929. {
  930. memcpy(code, "023942", 6);
  931. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  932. isCleanCheck = true;
  933. }
  934. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023943", 6) == EQUAL &&
  935. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRO_TIMEOUT == YES)
  936. {
  937. memcpy(code, "023943", 6);
  938. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  939. isCleanCheck = true;
  940. }
  941. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023944", 6) == EQUAL &&
  942. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CCS_TIMEOUT == YES)
  943. {
  944. memcpy(code, "023944", 6);
  945. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  946. isCleanCheck = true;
  947. }
  948. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023945", 6) == EQUAL &&
  949. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CST_TIMEOUT == YES)
  950. {
  951. memcpy(code, "023945", 6);
  952. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  953. isCleanCheck = true;
  954. }
  955. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023946", 6) == EQUAL &&
  956. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CSD_TIMEOUT == YES)
  957. {
  958. memcpy(code, "023946", 6);
  959. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  960. isCleanCheck = true;
  961. }
  962. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023947", 6) == EQUAL &&
  963. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_BEM_OTHER_TIMEOUT == YES)
  964. {
  965. memcpy(code, "023947", 6);
  966. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  967. isCleanCheck = true;
  968. }
  969. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023950", 6) == EQUAL &&
  970. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_SOC_GOAL == YES)
  971. {
  972. memcpy(code, "023950", 6);
  973. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  974. isCleanCheck = true;
  975. }
  976. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023951", 6) == EQUAL &&
  977. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_TOTAL_VOLTAGE_GOAL == YES)
  978. {
  979. memcpy(code, "023951", 6);
  980. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  981. isCleanCheck = true;
  982. }
  983. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023952", 6) == EQUAL &&
  984. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CELL_VOLTAGE_GOAL == YES)
  985. {
  986. memcpy(code, "023952", 6);
  987. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  988. isCleanCheck = true;
  989. }
  990. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023953", 6) == EQUAL &&
  991. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_GET_CST == YES)
  992. {
  993. memcpy(code, "023953", 6);
  994. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  995. isCleanCheck = true;
  996. }
  997. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023954", 6) == EQUAL &&
  998. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_ISOLATION == YES)
  999. {
  1000. memcpy(code, "023954", 6);
  1001. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1002. isCleanCheck = true;
  1003. }
  1004. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023955", 6) == EQUAL &&
  1005. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OUTPUT_CONNECTOR_OTP == YES)
  1006. {
  1007. memcpy(code, "023955", 6);
  1008. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1009. isCleanCheck = true;
  1010. }
  1011. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023956", 6) == EQUAL &&
  1012. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_COMPONENT == YES)
  1013. {
  1014. memcpy(code, "023956", 6);
  1015. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1016. isCleanCheck = true;
  1017. }
  1018. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023957", 6) == EQUAL &&
  1019. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CHARGE_CONNECTOR == YES)
  1020. {
  1021. memcpy(code, "023957", 6);
  1022. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1023. isCleanCheck = true;
  1024. }
  1025. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023958", 6) == EQUAL &&
  1026. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTP == YES)
  1027. {
  1028. memcpy(code, "023958", 6);
  1029. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1030. isCleanCheck = true;
  1031. }
  1032. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023959", 6) == EQUAL &&
  1033. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTHER == YES)
  1034. {
  1035. memcpy(code, "023959", 6);
  1036. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1037. isCleanCheck = true;
  1038. }
  1039. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023960", 6) == EQUAL &&
  1040. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_HIGH_V == YES)
  1041. {
  1042. memcpy(code, "023960", 6);
  1043. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1044. isCleanCheck = true;
  1045. }
  1046. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023961", 6) == EQUAL &&
  1047. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CC2 == YES)
  1048. {
  1049. memcpy(code, "023961", 6);
  1050. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1051. isCleanCheck = true;
  1052. }
  1053. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023962", 6) == EQUAL &&
  1054. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CURRENT == YES)
  1055. {
  1056. memcpy(code, "023962", 6);
  1057. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1058. isCleanCheck = true;
  1059. }
  1060. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023963", 6) == EQUAL &&
  1061. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_VOLTAGE == YES)
  1062. {
  1063. memcpy(code, "023963", 6);
  1064. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1065. isCleanCheck = true;
  1066. }
  1067. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023964", 6) == EQUAL &&
  1068. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GET_BST_NO_REASON == YES)
  1069. {
  1070. memcpy(code, "023964", 6);
  1071. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1072. isCleanCheck = true;
  1073. }
  1074. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023970", 6) == EQUAL &&
  1075. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_OVER_VOLTAGE == YES)
  1076. {
  1077. memcpy(code, "023970", 6);
  1078. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1079. isCleanCheck = true;
  1080. }
  1081. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023971", 6) == EQUAL &&
  1082. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_UNDER_VOLTAGE == YES)
  1083. {
  1084. memcpy(code, "023971", 6);
  1085. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1086. isCleanCheck = true;
  1087. }
  1088. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023972", 6) == EQUAL &&
  1089. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OVER_SOC == YES)
  1090. {
  1091. memcpy(code, "023972", 6);
  1092. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1093. isCleanCheck = true;
  1094. }
  1095. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023973", 6) == EQUAL &&
  1096. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_UNDER_SOC == YES)
  1097. {
  1098. memcpy(code, "023973", 6);
  1099. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1100. isCleanCheck = true;
  1101. }
  1102. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023974", 6) == EQUAL &&
  1103. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CURRENT == YES)
  1104. {
  1105. memcpy(code, "023974", 6);
  1106. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1107. isCleanCheck = true;
  1108. }
  1109. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023975", 6) == EQUAL &&
  1110. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_TEMPERATURE == YES)
  1111. {
  1112. memcpy(code, "023975", 6);
  1113. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1114. isCleanCheck = true;
  1115. }
  1116. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023976", 6) == EQUAL &&
  1117. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_ISOLATE == YES)
  1118. {
  1119. memcpy(code, "023976", 6);
  1120. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1121. isCleanCheck = true;
  1122. }
  1123. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023977", 6) == EQUAL &&
  1124. ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OUTPUT_CONNECTOR == YES)
  1125. {
  1126. memcpy(code, "023977", 6);
  1127. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1128. isCleanCheck = true;
  1129. }
  1130. }
  1131. if (isCleanCheck)
  1132. {
  1133. for (byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++)
  1134. {
  1135. if (index != gun_index || ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
  1136. {
  1137. PRINTF_FUNC("GBT clean error : index = %d, EvConnAlarmCode = %s, code = %s \n", index, _chargingData[index]->EvConnAlarmCode, code);
  1138. if (strncmp((char *)_chargingData[index]->EvConnAlarmCode, code, 6) != EQUAL)
  1139. {
  1140. if (strncmp(code, "023702", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.GbEvCommFail = NO;
  1141. if (strncmp(code, "023900", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_LOS_CC1 = NO;
  1142. if (strncmp(code, "023901", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CONNECTOR_LOCK_FAIL = NO;
  1143. if (strncmp(code, "023902", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BATTERY_INCOMPATIBLE = NO;
  1144. if (strncmp(code, "023903", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_BROAA_TIMEOUT = NO;
  1145. if (strncmp(code, "023904", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CSU_PRECHARGE_TIMEOUT = NO;
  1146. if (strncmp(code, "023905", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_PRESENT_VOLTAGE_FAULT = NO;
  1147. if (strncmp(code, "023906", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_VOLTAGE_OVER_RANGE = NO;
  1148. if (strncmp(code, "023907", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BSM_CHARGE_ALLOW_00_10MIN_COUUNTDONE = NO;
  1149. if (strncmp(code, "023908", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_WAIT_GROUNDFAULT_TIMEOUT = NO;
  1150. if (strncmp(code, "023909", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_10V = NO;
  1151. if (strncmp(code, "023910", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_60V = NO;
  1152. if (strncmp(code, "023911", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_NORMAL_STOP_CMD = NO;
  1153. if (strncmp(code, "023912", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_EMERGENCY_STOP_CMD = NO;
  1154. if (strncmp(code, "023913", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ISOLATION_RESULT_FAIL = NO;
  1155. if (strncmp(code, "023914", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_MOTHER_BOARD_MISS_LINK = NO;
  1156. if (strncmp(code, "023915", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_LIMIT = NO;
  1157. if (strncmp(code, "023916", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_REQ_CURRENT_MORE_THAN_LIMIT = NO;
  1158. if (strncmp(code, "023917", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_10_PERCENT = NO;
  1159. if (strncmp(code, "023918", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_DIFF_BCS_5_PERCENT = NO;
  1160. if (strncmp(code, "023919", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_STOP_ADC_MORE_THAN_10V = NO;
  1161. if (strncmp(code, "023930", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BHM_TIMEOUT = NO;
  1162. if (strncmp(code, "023931", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRM_TIMEOUT = NO;
  1163. if (strncmp(code, "023932", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCP_TIMEOUT = NO;
  1164. if (strncmp(code, "023933", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRO_TIMEOUT = NO;
  1165. if (strncmp(code, "023934", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCL_TIMEOUT = NO;
  1166. if (strncmp(code, "023935", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCS_TIMEOUT = NO;
  1167. if (strncmp(code, "023936", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSM_TIMEOUT = NO;
  1168. if (strncmp(code, "023937", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BST_TIMEOUT = NO;
  1169. if (strncmp(code, "023938", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSD_TIMEOUT = NO;
  1170. if (strncmp(code, "023939", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BEM_OTHER_TIMEOUT = NO;
  1171. if (strncmp(code, "023940", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRM_TIMEOUT = NO;
  1172. if (strncmp(code, "023941", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRMAA_TIMEOUT = NO;
  1173. if (strncmp(code, "023942", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CTS_CML_TIMEOUT = NO;
  1174. if (strncmp(code, "023943", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRO_TIMEOUT = NO;
  1175. if (strncmp(code, "023944", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CCS_TIMEOUT = NO;
  1176. if (strncmp(code, "023945", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CST_TIMEOUT = NO;
  1177. if (strncmp(code, "023946", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CSD_TIMEOUT = NO;
  1178. if (strncmp(code, "023947", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_BEM_OTHER_TIMEOUT = NO;
  1179. if (strncmp(code, "023950", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_SOC_GOAL = NO;
  1180. if (strncmp(code, "023951", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_TOTAL_VOLTAGE_GOAL = NO;
  1181. if (strncmp(code, "023952", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CELL_VOLTAGE_GOAL = NO;
  1182. if (strncmp(code, "023953", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_GET_CST = NO;
  1183. if (strncmp(code, "023954", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_ISOLATION = NO;
  1184. if (strncmp(code, "023955", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OUTPUT_CONNECTOR_OTP = NO;
  1185. if (strncmp(code, "023956", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_COMPONENT = NO;
  1186. if (strncmp(code, "023957", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CHARGE_CONNECTOR = NO;
  1187. if (strncmp(code, "023958", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTP = NO;
  1188. if (strncmp(code, "023959", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTHER = NO;
  1189. if (strncmp(code, "023960", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_HIGH_V = NO;
  1190. if (strncmp(code, "023961", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CC2 = NO;
  1191. if (strncmp(code, "023962", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CURRENT = NO;
  1192. if (strncmp(code, "023963", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_VOLTAGE = NO;
  1193. if (strncmp(code, "023964", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GET_BST_NO_REASON = NO;
  1194. if (strncmp(code, "023970", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_OVER_VOLTAGE = NO;
  1195. if (strncmp(code, "023971", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_UNDER_VOLTAGE = NO;
  1196. if (strncmp(code, "023972", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OVER_SOC = NO;
  1197. if (strncmp(code, "023973", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_UNDER_SOC = NO;
  1198. if (strncmp(code, "023974", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CURRENT = NO;
  1199. if (strncmp(code, "023975", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_TEMPERATURE = NO;
  1200. if (strncmp(code, "023976", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_ISOLATE = NO;
  1201. if (strncmp(code, "023977", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OUTPUT_CONNECTOR = NO;
  1202. }
  1203. }
  1204. }
  1205. }
  1206. }
  1207. void ClearAbnormalStatus_CCS(byte gun_index)
  1208. {
  1209. bool isCleanCheck = false;
  1210. char code[7];
  1211. if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) == EQUAL)
  1212. return;
  1213. if (true)
  1214. {
  1215. if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023701", 6) == EQUAL &&
  1216. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail == YES)
  1217. {
  1218. memcpy(code, "023701", 6);
  1219. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1220. isCleanCheck = true;
  1221. }
  1222. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023737", 6) == EQUAL &&
  1223. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit == YES)
  1224. {
  1225. memcpy(code, "023737", 6);
  1226. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1227. isCleanCheck = true;
  1228. }
  1229. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023738", 6) == EQUAL &&
  1230. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition == YES)
  1231. {
  1232. memcpy(code, "023738", 6);
  1233. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1234. isCleanCheck = true;
  1235. }
  1236. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023739", 6) == EQUAL &&
  1237. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargerConnectorLockFault == YES)
  1238. {
  1239. memcpy(code, "023739", 6);
  1240. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1241. isCleanCheck = true;
  1242. }
  1243. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023740", 6) == EQUAL &&
  1244. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVRESSMalfunction == YES)
  1245. {
  1246. memcpy(code, "023740", 6);
  1247. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1248. isCleanCheck = true;
  1249. }
  1250. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023741", 6) == EQUAL &&
  1251. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingCurrentdifferential == YES)
  1252. {
  1253. memcpy(code, "023741", 6);
  1254. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1255. isCleanCheck = true;
  1256. }
  1257. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023742", 6) == EQUAL &&
  1258. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingVoltageOutOfRange == YES)
  1259. {
  1260. memcpy(code, "023742", 6);
  1261. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1262. isCleanCheck = true;
  1263. }
  1264. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023743", 6) == EQUAL &&
  1265. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingSystemIncompatibility == YES)
  1266. {
  1267. memcpy(code, "023743", 6);
  1268. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1269. isCleanCheck = true;
  1270. }
  1271. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023744", 6) == EQUAL &&
  1272. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEmergencyEvent == YES)
  1273. {
  1274. memcpy(code, "023744", 6);
  1275. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1276. isCleanCheck = true;
  1277. }
  1278. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023745", 6) == EQUAL &&
  1279. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsBreaker == YES)
  1280. {
  1281. memcpy(code, "023745", 6);
  1282. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1283. isCleanCheck = true;
  1284. }
  1285. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023746", 6) == EQUAL &&
  1286. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoData == YES)
  1287. {
  1288. memcpy(code, "023746", 6);
  1289. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1290. isCleanCheck = true;
  1291. }
  1292. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023747", 6) == EQUAL &&
  1293. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_A == YES)
  1294. {
  1295. memcpy(code, "023747", 6);
  1296. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1297. isCleanCheck = true;
  1298. }
  1299. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023748", 6) == EQUAL &&
  1300. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_B == YES)
  1301. {
  1302. memcpy(code, "023748", 6);
  1303. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1304. isCleanCheck = true;
  1305. }
  1306. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023749", 6) == EQUAL &&
  1307. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_C == YES)
  1308. {
  1309. memcpy(code, "023749", 6);
  1310. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1311. isCleanCheck = true;
  1312. }
  1313. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023750", 6) == EQUAL &&
  1314. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_1 == YES)
  1315. {
  1316. memcpy(code, "023750", 6);
  1317. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1318. isCleanCheck = true;
  1319. }
  1320. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023751", 6) == EQUAL &&
  1321. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_2 == YES)
  1322. {
  1323. memcpy(code, "023751", 6);
  1324. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1325. isCleanCheck = true;
  1326. }
  1327. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023752", 6) == EQUAL &&
  1328. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_3 == YES)
  1329. {
  1330. memcpy(code, "023752", 6);
  1331. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1332. isCleanCheck = true;
  1333. }
  1334. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023753", 6) == EQUAL &&
  1335. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_1 == YES)
  1336. {
  1337. memcpy(code, "023753", 6);
  1338. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1339. isCleanCheck = true;
  1340. }
  1341. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023754", 6) == EQUAL &&
  1342. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_2 == YES)
  1343. {
  1344. memcpy(code, "023754", 6);
  1345. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1346. isCleanCheck = true;
  1347. }
  1348. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023755", 6) == EQUAL &&
  1349. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_3 == YES)
  1350. {
  1351. memcpy(code, "023755", 6);
  1352. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1353. isCleanCheck = true;
  1354. }
  1355. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023756", 6) == EQUAL &&
  1356. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_4 == YES)
  1357. {
  1358. memcpy(code, "023756", 6);
  1359. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1360. isCleanCheck = true;
  1361. }
  1362. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023757", 6) == EQUAL &&
  1363. ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_5 == YES)
  1364. {
  1365. memcpy(code, "023757", 6);
  1366. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1367. isCleanCheck = true;
  1368. }
  1369. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023758", 6) == EQUAL &&
  1370. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequenceError == YES)
  1371. {
  1372. memcpy(code, "023758", 6);
  1373. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1374. isCleanCheck = true;
  1375. }
  1376. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023759", 6) == EQUAL &&
  1377. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSignatureError == YES)
  1378. {
  1379. memcpy(code, "023759", 6);
  1380. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1381. isCleanCheck = true;
  1382. }
  1383. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023760", 6) == EQUAL &&
  1384. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnknownSession == YES)
  1385. {
  1386. memcpy(code, "023760", 6);
  1387. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1388. isCleanCheck = true;
  1389. }
  1390. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023761", 6) == EQUAL &&
  1391. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceIDInvalid == YES)
  1392. {
  1393. memcpy(code, "023761", 6);
  1394. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1395. isCleanCheck = true;
  1396. }
  1397. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023762", 6) == EQUAL &&
  1398. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPaymentSelectionInvalid == YES)
  1399. {
  1400. memcpy(code, "023762", 6);
  1401. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1402. isCleanCheck = true;
  1403. }
  1404. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023763", 6) == EQUAL &&
  1405. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsIdentificationSelectionInvalid == YES)
  1406. {
  1407. memcpy(code, "023763", 6);
  1408. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1409. isCleanCheck = true;
  1410. }
  1411. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023764", 6) == EQUAL &&
  1412. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceSelectionInvalid == YES)
  1413. {
  1414. memcpy(code, "023764", 6);
  1415. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1416. isCleanCheck = true;
  1417. }
  1418. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023765", 6) == EQUAL &&
  1419. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateExpired == YES)
  1420. {
  1421. memcpy(code, "023765", 6);
  1422. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1423. isCleanCheck = true;
  1424. }
  1425. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023766", 6) == EQUAL &&
  1426. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotYetValid == YES)
  1427. {
  1428. memcpy(code, "023766", 6);
  1429. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1430. isCleanCheck = true;
  1431. }
  1432. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023767", 6) == EQUAL &&
  1433. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateRevoked == YES)
  1434. {
  1435. memcpy(code, "023767", 6);
  1436. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1437. isCleanCheck = true;
  1438. }
  1439. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023768", 6) == EQUAL &&
  1440. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoCertificateAvailable == YES)
  1441. {
  1442. memcpy(code, "023768", 6);
  1443. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1444. isCleanCheck = true;
  1445. }
  1446. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023769", 6) == EQUAL &&
  1447. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertChainError == YES)
  1448. {
  1449. memcpy(code, "023769", 6);
  1450. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1451. isCleanCheck = true;
  1452. }
  1453. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023770", 6) == EQUAL &&
  1454. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertValidationError == YES)
  1455. {
  1456. memcpy(code, "023770", 6);
  1457. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1458. isCleanCheck = true;
  1459. }
  1460. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023771", 6) == EQUAL &&
  1461. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertVerificationError == YES)
  1462. {
  1463. memcpy(code, "023771", 6);
  1464. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1465. isCleanCheck = true;
  1466. }
  1467. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023772", 6) == EQUAL &&
  1468. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractCanceled == YES)
  1469. {
  1470. memcpy(code, "023772", 6);
  1471. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1472. isCleanCheck = true;
  1473. }
  1474. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023773", 6) == EQUAL &&
  1475. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChallengeInvalid == YES)
  1476. {
  1477. memcpy(code, "023773", 6);
  1478. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1479. isCleanCheck = true;
  1480. }
  1481. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023774", 6) == EQUAL &&
  1482. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongEnergyTransferMode == YES)
  1483. {
  1484. memcpy(code, "023774", 6);
  1485. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1486. isCleanCheck = true;
  1487. }
  1488. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023775", 6) == EQUAL &&
  1489. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongChargeParameter == YES)
  1490. {
  1491. memcpy(code, "023775", 6);
  1492. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1493. isCleanCheck = true;
  1494. }
  1495. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023776", 6) == EQUAL &&
  1496. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingProfileInvalid == YES)
  1497. {
  1498. memcpy(code, "023776", 6);
  1499. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1500. isCleanCheck = true;
  1501. }
  1502. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023777", 6) == EQUAL &&
  1503. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTariffSelectionInvalid == YES)
  1504. {
  1505. memcpy(code, "023777", 6);
  1506. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1507. isCleanCheck = true;
  1508. }
  1509. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023778", 6) == EQUAL &&
  1510. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEPresentVoltageToLow == YES)
  1511. {
  1512. memcpy(code, "023778", 6);
  1513. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1514. isCleanCheck = true;
  1515. }
  1516. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023779", 6) == EQUAL &&
  1517. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryNotApplied == YES)
  1518. {
  1519. memcpy(code, "023779", 6);
  1520. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1521. isCleanCheck = true;
  1522. }
  1523. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023780", 6) == EQUAL &&
  1524. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMeteringSignatureNotValid == YES)
  1525. {
  1526. memcpy(code, "023780", 6);
  1527. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1528. isCleanCheck = true;
  1529. }
  1530. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023781", 6) == EQUAL &&
  1531. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoChargeServiceSelected == YES)
  1532. {
  1533. memcpy(code, "023781", 6);
  1534. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1535. isCleanCheck = true;
  1536. }
  1537. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023782", 6) == EQUAL &&
  1538. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContactorError == YES)
  1539. {
  1540. memcpy(code, "023782", 6);
  1541. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1542. isCleanCheck = true;
  1543. }
  1544. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023783", 6) == EQUAL &&
  1545. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotAllowedAtThisEVSE == YES)
  1546. {
  1547. memcpy(code, "023783", 6);
  1548. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1549. isCleanCheck = true;
  1550. }
  1551. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023784", 6) == EQUAL &&
  1552. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsGAChargeStop == YES)
  1553. {
  1554. memcpy(code, "023784", 6);
  1555. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1556. isCleanCheck = true;
  1557. }
  1558. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023785", 6) == EQUAL &&
  1559. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAlignmentError == YES)
  1560. {
  1561. memcpy(code, "023785", 6);
  1562. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1563. isCleanCheck = true;
  1564. }
  1565. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023786", 6) == EQUAL &&
  1566. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsACDError == YES)
  1567. {
  1568. memcpy(code, "023786", 6);
  1569. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1570. isCleanCheck = true;
  1571. }
  1572. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023787", 6) == EQUAL &&
  1573. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAssociationError == YES)
  1574. {
  1575. memcpy(code, "023787", 6);
  1576. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1577. isCleanCheck = true;
  1578. }
  1579. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023788", 6) == EQUAL &&
  1580. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEChargeAbort == YES)
  1581. {
  1582. memcpy(code, "023788", 6);
  1583. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1584. isCleanCheck = true;
  1585. }
  1586. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023789", 6) == EQUAL &&
  1587. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoSupportedAppProtocol == YES)
  1588. {
  1589. memcpy(code, "023789", 6);
  1590. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1591. isCleanCheck = true;
  1592. }
  1593. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023790", 6) == EQUAL &&
  1594. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractNotAccepted == YES)
  1595. {
  1596. memcpy(code, "023790", 6);
  1597. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1598. isCleanCheck = true;
  1599. }
  1600. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023791", 6) == EQUAL &&
  1601. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMOUnknown == YES)
  1602. {
  1603. memcpy(code, "023791", 6);
  1604. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1605. isCleanCheck = true;
  1606. }
  1607. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023792", 6) == EQUAL &&
  1608. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_Prov_CertificateRevoke == YES)
  1609. {
  1610. memcpy(code, "023792", 6);
  1611. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1612. isCleanCheck = true;
  1613. }
  1614. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023793", 6) == EQUAL &&
  1615. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA1_CertificateRevoked == YES)
  1616. {
  1617. memcpy(code, "023793", 6);
  1618. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1619. isCleanCheck = true;
  1620. }
  1621. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023794", 6) == EQUAL &&
  1622. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA2_CertificateRevoked == YES)
  1623. {
  1624. memcpy(code, "023794", 6);
  1625. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1626. isCleanCheck = true;
  1627. }
  1628. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023795", 6) == EQUAL &&
  1629. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_RootCA_CertificateRevoked == YES)
  1630. {
  1631. memcpy(code, "023795", 6);
  1632. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1633. isCleanCheck = true;
  1634. }
  1635. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023796", 6) == EQUAL &&
  1636. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_Prov_CertificateRevoked == YES)
  1637. {
  1638. memcpy(code, "023796", 6);
  1639. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1640. isCleanCheck = true;
  1641. }
  1642. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023797", 6) == EQUAL &&
  1643. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA1_CertificateRevoked == YES)
  1644. {
  1645. memcpy(code, "023797", 6);
  1646. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1647. isCleanCheck = true;
  1648. }
  1649. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023798", 6) == EQUAL &&
  1650. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA2_CertificateRevoked == YES)
  1651. {
  1652. memcpy(code, "023798", 6);
  1653. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1654. isCleanCheck = true;
  1655. }
  1656. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023799", 6) == EQUAL &&
  1657. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_RootCA_CertificateRevoked == YES)
  1658. {
  1659. memcpy(code, "023799", 6);
  1660. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1661. isCleanCheck = true;
  1662. }
  1663. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023800", 6) == EQUAL &&
  1664. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_Prov_CertificateRevoked == YES)
  1665. {
  1666. memcpy(code, "023800", 6);
  1667. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1668. isCleanCheck = true;
  1669. }
  1670. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023801", 6) == EQUAL &&
  1671. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA1_CertificateRevoked == YES)
  1672. {
  1673. memcpy(code, "023801", 6);
  1674. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1675. isCleanCheck = true;
  1676. }
  1677. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023802", 6) == EQUAL &&
  1678. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA2_CertificateRevoked == YES)
  1679. {
  1680. memcpy(code, "023802", 6);
  1681. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1682. isCleanCheck = true;
  1683. }
  1684. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023803", 6) == EQUAL &&
  1685. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_RootCA_CertificateRevoked == YES)
  1686. {
  1687. memcpy(code, "023803", 6);
  1688. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1689. isCleanCheck = true;
  1690. }
  1691. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023809", 6) == EQUAL &&
  1692. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_SLAC_init == YES)
  1693. {
  1694. memcpy(code, "023809", 6);
  1695. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1696. isCleanCheck = true;
  1697. }
  1698. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023810", 6) == EQUAL &&
  1699. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_match_response == YES)
  1700. {
  1701. memcpy(code, "023810", 6);
  1702. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1703. isCleanCheck = true;
  1704. }
  1705. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023811", 6) == EQUAL &&
  1706. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_sequence == YES)
  1707. {
  1708. memcpy(code, "023811", 6);
  1709. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1710. isCleanCheck = true;
  1711. }
  1712. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023812", 6) == EQUAL &&
  1713. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_match_MNBC == YES)
  1714. {
  1715. memcpy(code, "023812", 6);
  1716. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1717. isCleanCheck = true;
  1718. }
  1719. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023813", 6) == EQUAL &&
  1720. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_avg_atten_calc == YES)
  1721. {
  1722. memcpy(code, "023813", 6);
  1723. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1724. isCleanCheck = true;
  1725. }
  1726. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023814", 6) == EQUAL &&
  1727. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_response == YES)
  1728. {
  1729. memcpy(code, "023814", 6);
  1730. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1731. isCleanCheck = true;
  1732. }
  1733. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023815", 6) == EQUAL &&
  1734. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_match_session == YES)
  1735. {
  1736. memcpy(code, "023815", 6);
  1737. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1738. isCleanCheck = true;
  1739. }
  1740. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023816", 6) == EQUAL &&
  1741. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_assoc_session == YES)
  1742. {
  1743. memcpy(code, "023816", 6);
  1744. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1745. isCleanCheck = true;
  1746. }
  1747. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023817", 6) == EQUAL &&
  1748. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_vald_toggle == YES)
  1749. {
  1750. memcpy(code, "023817", 6);
  1751. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1752. isCleanCheck = true;
  1753. }
  1754. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023818", 6) == EQUAL &&
  1755. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmMnbcSound == YES)
  1756. {
  1757. memcpy(code, "023818", 6);
  1758. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1759. isCleanCheck = true;
  1760. }
  1761. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023819", 6) == EQUAL &&
  1762. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmValidateReq == YES)
  1763. {
  1764. memcpy(code, "023819", 6);
  1765. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1766. isCleanCheck = true;
  1767. }
  1768. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023823", 6) == EQUAL &&
  1769. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUDP_TT_match_join == YES)
  1770. {
  1771. memcpy(code, "023823", 6);
  1772. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1773. isCleanCheck = true;
  1774. }
  1775. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023824", 6) == EQUAL &&
  1776. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTCP_TT_match_join == YES)
  1777. {
  1778. memcpy(code, "023824", 6);
  1779. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1780. isCleanCheck = true;
  1781. }
  1782. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023825", 6) == EQUAL &&
  1783. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_amp_map_exchange == YES)
  1784. {
  1785. memcpy(code, "023825", 6);
  1786. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1787. isCleanCheck = true;
  1788. }
  1789. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023826", 6) == EQUAL &&
  1790. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_link_ready_notification == YES)
  1791. {
  1792. memcpy(code, "023826", 6);
  1793. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1794. isCleanCheck = true;
  1795. }
  1796. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023832", 6) == EQUAL &&
  1797. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSupportedAppProtocolRes == YES)
  1798. {
  1799. memcpy(code, "023832", 6);
  1800. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1801. isCleanCheck = true;
  1802. }
  1803. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023833", 6) == EQUAL &&
  1804. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionSetupRes == YES)
  1805. {
  1806. memcpy(code, "023833", 6);
  1807. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1808. isCleanCheck = true;
  1809. }
  1810. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023834", 6) == EQUAL &&
  1811. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceDiscoveryRes == YES)
  1812. {
  1813. memcpy(code, "023834", 6);
  1814. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1815. isCleanCheck = true;
  1816. }
  1817. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023835", 6) == EQUAL &&
  1818. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServicePaymentSelectionRes == YES)
  1819. {
  1820. memcpy(code, "023835", 6);
  1821. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1822. isCleanCheck = true;
  1823. }
  1824. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023836", 6) == EQUAL &&
  1825. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractAuthenticationRes == YES)
  1826. {
  1827. memcpy(code, "023836", 6);
  1828. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1829. isCleanCheck = true;
  1830. }
  1831. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023837", 6) == EQUAL &&
  1832. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargeParameterDiscoveryRes == YES)
  1833. {
  1834. memcpy(code, "023837", 6);
  1835. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1836. isCleanCheck = true;
  1837. }
  1838. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023838", 6) == EQUAL &&
  1839. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryRes == YES)
  1840. {
  1841. memcpy(code, "023838", 6);
  1842. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1843. isCleanCheck = true;
  1844. }
  1845. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023839", 6) == EQUAL &&
  1846. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheckRes == YES)
  1847. {
  1848. memcpy(code, "023839", 6);
  1849. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1850. isCleanCheck = true;
  1851. }
  1852. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023840", 6) == EQUAL &&
  1853. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPreChargeRes == YES)
  1854. {
  1855. memcpy(code, "023840", 6);
  1856. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1857. isCleanCheck = true;
  1858. }
  1859. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023841", 6) == EQUAL &&
  1860. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCurrentDemandRes == YES)
  1861. {
  1862. memcpy(code, "023841", 6);
  1863. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1864. isCleanCheck = true;
  1865. }
  1866. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023842", 6) == EQUAL &&
  1867. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWeldingDetectionRes == YES)
  1868. {
  1869. memcpy(code, "023842", 6);
  1870. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1871. isCleanCheck = true;
  1872. }
  1873. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023843", 6) == EQUAL &&
  1874. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionStopRes == YES)
  1875. {
  1876. memcpy(code, "023843", 6);
  1877. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1878. isCleanCheck = true;
  1879. }
  1880. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023844", 6) == EQUAL &&
  1881. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequence_Time == YES)
  1882. {
  1883. memcpy(code, "023844", 6);
  1884. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1885. isCleanCheck = true;
  1886. }
  1887. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023845", 6) == EQUAL &&
  1888. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsReadyToCharge_Performance_Time == YES)
  1889. {
  1890. memcpy(code, "023845", 6);
  1891. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1892. isCleanCheck = true;
  1893. }
  1894. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023846", 6) == EQUAL &&
  1895. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCommunicationSetup_Performance_Time == YES)
  1896. {
  1897. memcpy(code, "023846", 6);
  1898. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1899. isCleanCheck = true;
  1900. }
  1901. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023847", 6) == EQUAL &&
  1902. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheck_Performance_Time == YES)
  1903. {
  1904. memcpy(code, "023847", 6);
  1905. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1906. isCleanCheck = true;
  1907. }
  1908. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023848", 6) == EQUAL &&
  1909. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPState_Detection_Time == YES)
  1910. {
  1911. memcpy(code, "023848", 6);
  1912. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1913. isCleanCheck = true;
  1914. }
  1915. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023849", 6) == EQUAL &&
  1916. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPOscillator_Retain_Time == YES)
  1917. {
  1918. memcpy(code, "023849", 6);
  1919. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1920. isCleanCheck = true;
  1921. }
  1922. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023850", 6) == EQUAL &&
  1923. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutV2GPreChargePerformaceTime == YES)
  1924. {
  1925. memcpy(code, "023850", 6);
  1926. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1927. isCleanCheck = true;
  1928. }
  1929. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023855", 6) == EQUAL &&
  1930. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_TARGET_INFO == YES)
  1931. {
  1932. memcpy(code, "023855", 6);
  1933. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1934. isCleanCheck = true;
  1935. }
  1936. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023856", 6) == EQUAL &&
  1937. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_TARGET_INFO == YES)
  1938. {
  1939. memcpy(code, "023856", 6);
  1940. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1941. isCleanCheck = true;
  1942. }
  1943. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023857", 6) == EQUAL &&
  1944. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_BATTERY_INFO == YES)
  1945. {
  1946. memcpy(code, "023857", 6);
  1947. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1948. isCleanCheck = true;
  1949. }
  1950. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023858", 6) == EQUAL &&
  1951. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_BATTERY_INFO == YES)
  1952. {
  1953. memcpy(code, "023858", 6);
  1954. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1955. isCleanCheck = true;
  1956. }
  1957. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023859", 6) == EQUAL &&
  1958. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EV_STOP_EVENT == YES)
  1959. {
  1960. memcpy(code, "023859", 6);
  1961. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1962. isCleanCheck = true;
  1963. }
  1964. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023860", 6) == EQUAL &&
  1965. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EV_STOP_EVENT == YES)
  1966. {
  1967. memcpy(code, "023860", 6);
  1968. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1969. isCleanCheck = true;
  1970. }
  1971. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023861", 6) == EQUAL &&
  1972. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_STOP_EVENT == YES)
  1973. {
  1974. memcpy(code, "023861", 6);
  1975. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1976. isCleanCheck = true;
  1977. }
  1978. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023862", 6) == EQUAL &&
  1979. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_STOP_EVENT == YES)
  1980. {
  1981. memcpy(code, "023862", 6);
  1982. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1983. isCleanCheck = true;
  1984. }
  1985. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023863", 6) == EQUAL &&
  1986. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_MISC_INFO == YES)
  1987. {
  1988. memcpy(code, "023863", 6);
  1989. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1990. isCleanCheck = true;
  1991. }
  1992. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023864", 6) == EQUAL &&
  1993. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_MISC_INFO == YES)
  1994. {
  1995. memcpy(code, "023864", 6);
  1996. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  1997. isCleanCheck = true;
  1998. }
  1999. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023865", 6) == EQUAL &&
  2000. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_REQUEST == YES)
  2001. {
  2002. memcpy(code, "023865", 6);
  2003. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2004. isCleanCheck = true;
  2005. }
  2006. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023866", 6) == EQUAL &&
  2007. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_REQUEST == YES)
  2008. {
  2009. memcpy(code, "023866", 6);
  2010. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2011. isCleanCheck = true;
  2012. }
  2013. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023867", 6) == EQUAL &&
  2014. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_START_BLOCK_TRANSFER == YES)
  2015. {
  2016. memcpy(code, "023867", 6);
  2017. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2018. isCleanCheck = true;
  2019. }
  2020. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023868", 6) == EQUAL &&
  2021. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_START_BLOCK_TRANSFER == YES)
  2022. {
  2023. memcpy(code, "023868", 6);
  2024. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2025. isCleanCheck = true;
  2026. }
  2027. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023869", 6) == EQUAL &&
  2028. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DATA_TRANSFER == YES)
  2029. {
  2030. memcpy(code, "023869", 6);
  2031. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2032. isCleanCheck = true;
  2033. }
  2034. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023870", 6) == EQUAL &&
  2035. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DATA_TRANSFER == YES)
  2036. {
  2037. memcpy(code, "023870", 6);
  2038. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2039. isCleanCheck = true;
  2040. }
  2041. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023871", 6) == EQUAL &&
  2042. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_FINISH == YES)
  2043. {
  2044. memcpy(code, "023871", 6);
  2045. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2046. isCleanCheck = true;
  2047. }
  2048. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023872", 6) == EQUAL &&
  2049. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_FINISH == YES)
  2050. {
  2051. memcpy(code, "023872", 6);
  2052. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2053. isCleanCheck = true;
  2054. }
  2055. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023873", 6) == EQUAL &&
  2056. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_ISOLATION_STATUS == YES)
  2057. {
  2058. memcpy(code, "023873", 6);
  2059. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2060. isCleanCheck = true;
  2061. }
  2062. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023874", 6) == EQUAL &&
  2063. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_ISOLATION_STATUS == YES)
  2064. {
  2065. memcpy(code, "023874", 6);
  2066. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2067. isCleanCheck = true;
  2068. }
  2069. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023875", 6) == EQUAL &&
  2070. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_CONNECTOR_INFO == YES)
  2071. {
  2072. memcpy(code, "023875", 6);
  2073. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2074. isCleanCheck = true;
  2075. }
  2076. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023876", 6) == EQUAL &&
  2077. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_CONNECTOR_INFO == YES)
  2078. {
  2079. memcpy(code, "023876", 6);
  2080. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2081. isCleanCheck = true;
  2082. }
  2083. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023877", 6) == EQUAL &&
  2084. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_RTC_INFO == YES)
  2085. {
  2086. memcpy(code, "023877", 6);
  2087. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2088. isCleanCheck = true;
  2089. }
  2090. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023878", 6) == EQUAL &&
  2091. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_RTC_INFO == YES)
  2092. {
  2093. memcpy(code, "023878", 6);
  2094. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2095. isCleanCheck = true;
  2096. }
  2097. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023879", 6) == EQUAL &&
  2098. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_PRECHARGE_INFO == YES)
  2099. {
  2100. memcpy(code, "023879", 6);
  2101. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2102. isCleanCheck = true;
  2103. }
  2104. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023880", 6) == EQUAL &&
  2105. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_PRECHARGE_INFO == YES)
  2106. {
  2107. memcpy(code, "023880", 6);
  2108. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2109. isCleanCheck = true;
  2110. }
  2111. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023881", 6) == EQUAL &&
  2112. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMSG_Sequence == YES)
  2113. {
  2114. memcpy(code, "023881", 6);
  2115. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2116. isCleanCheck = true;
  2117. }
  2118. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023882", 6) == EQUAL &&
  2119. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCAN_MSG_Unrecognized_CMD_ID == YES)
  2120. {
  2121. memcpy(code, "023882", 6);
  2122. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2123. isCleanCheck = true;
  2124. }
  2125. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023883", 6) == EQUAL &&
  2126. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Decode_Error == YES)
  2127. {
  2128. memcpy(code, "023883", 6);
  2129. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2130. isCleanCheck = true;
  2131. }
  2132. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023884", 6) == EQUAL &&
  2133. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Encode_Error == YES)
  2134. {
  2135. memcpy(code, "023884", 6);
  2136. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2137. isCleanCheck = true;
  2138. }
  2139. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023885", 6) == EQUAL &&
  2140. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Decode_Error == YES)
  2141. {
  2142. memcpy(code, "023885", 6);
  2143. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2144. isCleanCheck = true;
  2145. }
  2146. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023886", 6) == EQUAL &&
  2147. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Encode_Error == YES)
  2148. {
  2149. memcpy(code, "023886", 6);
  2150. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2151. isCleanCheck = true;
  2152. }
  2153. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023887", 6) == EQUAL &&
  2154. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Decode_Error == YES)
  2155. {
  2156. memcpy(code, "023887", 6);
  2157. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2158. isCleanCheck = true;
  2159. }
  2160. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023888", 6) == EQUAL &&
  2161. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Encode_Error == YES)
  2162. {
  2163. memcpy(code, "023888", 6);
  2164. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2165. isCleanCheck = true;
  2166. }
  2167. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023889", 6) == EQUAL &&
  2168. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCpStatus_Error == YES)
  2169. {
  2170. memcpy(code, "023889", 6);
  2171. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2172. isCleanCheck = true;
  2173. }
  2174. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023890", 6) == EQUAL &&
  2175. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnexpectVolBeforeCharing_Error == YES)
  2176. {
  2177. memcpy(code, "023890", 6);
  2178. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2179. isCleanCheck = true;
  2180. }
  2181. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023891", 6) == EQUAL &&
  2182. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccNotReadyForCharging == YES)
  2183. {
  2184. memcpy(code, "023891", 6);
  2185. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2186. isCleanCheck = true;
  2187. }
  2188. // else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023892", 6) == EQUAL &&
  2189. // ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutQCA7000Comm == YES)
  2190. // {
  2191. // memcpy(code, "023892", 6);
  2192. // memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2193. // isCleanCheck = true;
  2194. // }
  2195. else if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "023893", 6) == EQUAL &&
  2196. ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccFailForQCA7000SetKey == YES)
  2197. {
  2198. memcpy(code, "023893", 6);
  2199. memcpy(_chargingData[gun_index]->EvConnAlarmCode, "", 6);
  2200. isCleanCheck = true;
  2201. }
  2202. }
  2203. if (isCleanCheck)
  2204. {
  2205. for (byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++)
  2206. {
  2207. if (index != gun_index || ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1)
  2208. {
  2209. PRINTF_FUNC("CCS clean error : index = %d, EvConnAlarmCode = %s, code = %s \n", index, _chargingData[index]->EvConnAlarmCode, code);
  2210. if (strncmp((char *)_chargingData[index]->EvConnAlarmCode, code, 6) != EQUAL)
  2211. {
  2212. if (strncmp(code, "023701", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail = NO;
  2213. if (strncmp(code, "023737", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit = NO;
  2214. if (strncmp(code, "023738", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition = NO;
  2215. if (strncmp(code, "023739", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargerConnectorLockFault = NO;
  2216. if (strncmp(code, "023740", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVRESSMalfunction = NO;
  2217. if (strncmp(code, "023741", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingCurrentdifferential = NO;
  2218. if (strncmp(code, "023742", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingVoltageOutOfRange = NO;
  2219. if (strncmp(code, "023743", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingSystemIncompatibility = NO;
  2220. if (strncmp(code, "023744", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEmergencyEvent = NO;
  2221. if (strncmp(code, "023745", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsBreaker = NO;
  2222. if (strncmp(code, "023746", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoData = NO;
  2223. if (strncmp(code, "023747", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_A = NO;
  2224. if (strncmp(code, "023748", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_B = NO;
  2225. if (strncmp(code, "023749", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_C = NO;
  2226. if (strncmp(code, "023750", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_1 = NO;
  2227. if (strncmp(code, "023751", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_2 = NO;
  2228. if (strncmp(code, "023752", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_3 = NO;
  2229. if (strncmp(code, "023753", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_1 = NO;
  2230. if (strncmp(code, "023754", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_2 = NO;
  2231. if (strncmp(code, "023755", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_3 = NO;
  2232. if (strncmp(code, "023756", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_4 = NO;
  2233. if (strncmp(code, "023757", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_5 = NO;
  2234. if (strncmp(code, "023758", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequenceError = NO;
  2235. if (strncmp(code, "023759", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSignatureError = NO;
  2236. if (strncmp(code, "023760", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnknownSession = NO;
  2237. if (strncmp(code, "023761", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceIDInvalid = NO;
  2238. if (strncmp(code, "023762", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPaymentSelectionInvalid = NO;
  2239. if (strncmp(code, "023763", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsIdentificationSelectionInvalid = NO;
  2240. if (strncmp(code, "023764", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceSelectionInvalid = NO;
  2241. if (strncmp(code, "023765", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateExpired = NO;
  2242. if (strncmp(code, "023766", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotYetValid = NO;
  2243. if (strncmp(code, "023767", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateRevoked = NO;
  2244. if (strncmp(code, "023768", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoCertificateAvailable = NO;
  2245. if (strncmp(code, "023769", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertChainError = NO;
  2246. if (strncmp(code, "023770", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertValidationError = NO;
  2247. if (strncmp(code, "023771", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertVerificationError = NO;
  2248. if (strncmp(code, "023772", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractCanceled = NO;
  2249. if (strncmp(code, "023773", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChallengeInvalid = NO;
  2250. if (strncmp(code, "023774", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongEnergyTransferMode = NO;
  2251. if (strncmp(code, "023775", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongChargeParameter = NO;
  2252. if (strncmp(code, "023776", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingProfileInvalid = NO;
  2253. if (strncmp(code, "023777", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTariffSelectionInvalid = NO;
  2254. if (strncmp(code, "023778", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEPresentVoltageToLow = NO;
  2255. if (strncmp(code, "023779", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryNotApplied = NO;
  2256. if (strncmp(code, "023780", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMeteringSignatureNotValid = NO;
  2257. if (strncmp(code, "023781", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoChargeServiceSelected = NO;
  2258. if (strncmp(code, "023782", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContactorError = NO;
  2259. if (strncmp(code, "023783", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotAllowedAtThisEVSE = NO;
  2260. if (strncmp(code, "023784", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsGAChargeStop = NO;
  2261. if (strncmp(code, "023785", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAlignmentError = NO;
  2262. if (strncmp(code, "023786", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsACDError = NO;
  2263. if (strncmp(code, "023787", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAssociationError = NO;
  2264. if (strncmp(code, "023788", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEChargeAbort = NO;
  2265. if (strncmp(code, "023789", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoSupportedAppProtocol = NO;
  2266. if (strncmp(code, "023790", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractNotAccepted = NO;
  2267. if (strncmp(code, "023791", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMOUnknown = NO;
  2268. if (strncmp(code, "023792", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_Prov_CertificateRevoke = NO;
  2269. if (strncmp(code, "023793", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA1_CertificateRevoked = NO;
  2270. if (strncmp(code, "023794", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA2_CertificateRevoked = NO;
  2271. if (strncmp(code, "023795", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_RootCA_CertificateRevoked = NO;
  2272. if (strncmp(code, "023796", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_Prov_CertificateRevoked = NO;
  2273. if (strncmp(code, "023797", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA1_CertificateRevoked = NO;
  2274. if (strncmp(code, "023798", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA2_CertificateRevoked = NO;
  2275. if (strncmp(code, "023799", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_RootCA_CertificateRevoked = NO;
  2276. if (strncmp(code, "023800", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_Prov_CertificateRevoked = NO;
  2277. if (strncmp(code, "023801", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA1_CertificateRevoked = NO;
  2278. if (strncmp(code, "023802", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA2_CertificateRevoked = NO;
  2279. if (strncmp(code, "023803", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_RootCA_CertificateRevoked = NO;
  2280. if (strncmp(code, "023809", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_SLAC_init = NO;
  2281. if (strncmp(code, "023810", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_match_response = NO;
  2282. if (strncmp(code, "023811", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_sequence = NO;
  2283. if (strncmp(code, "023812", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_match_MNBC = NO;
  2284. if (strncmp(code, "023813", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_avg_atten_calc = NO;
  2285. if (strncmp(code, "023814", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_response = NO;
  2286. if (strncmp(code, "023815", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_match_session = NO;
  2287. if (strncmp(code, "023816", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_assoc_session = NO;
  2288. if (strncmp(code, "023817", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_vald_toggle = NO;
  2289. if (strncmp(code, "023818", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmMnbcSound = NO;
  2290. if (strncmp(code, "023819", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmValidateReq = NO;
  2291. if (strncmp(code, "023823", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUDP_TT_match_join = NO;
  2292. if (strncmp(code, "023824", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTCP_TT_match_join = NO;
  2293. if (strncmp(code, "023825", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_amp_map_exchange = NO;
  2294. if (strncmp(code, "023826", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_link_ready_notification = NO;
  2295. if (strncmp(code, "023832", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSupportedAppProtocolRes = NO;
  2296. if (strncmp(code, "023833", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionSetupRes = NO;
  2297. if (strncmp(code, "023834", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceDiscoveryRes = NO;
  2298. if (strncmp(code, "023835", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServicePaymentSelectionRes = NO;
  2299. if (strncmp(code, "023836", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractAuthenticationRes = NO;
  2300. if (strncmp(code, "023837", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargeParameterDiscoveryRes = NO;
  2301. if (strncmp(code, "023838", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryRes = NO;
  2302. if (strncmp(code, "023839", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheckRes = NO;
  2303. if (strncmp(code, "023840", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPreChargeRes = NO;
  2304. if (strncmp(code, "023841", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCurrentDemandRes = NO;
  2305. if (strncmp(code, "023842", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWeldingDetectionRes = NO;
  2306. if (strncmp(code, "023843", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionStopRes = NO;
  2307. if (strncmp(code, "023844", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequence_Time = NO;
  2308. if (strncmp(code, "023845", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsReadyToCharge_Performance_Time = NO;
  2309. if (strncmp(code, "023846", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCommunicationSetup_Performance_Time = NO;
  2310. if (strncmp(code, "023847", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheck_Performance_Time = NO;
  2311. if (strncmp(code, "023848", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPState_Detection_Time = NO;
  2312. if (strncmp(code, "023849", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPOscillator_Retain_Time = NO;
  2313. if (strncmp(code, "023850", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutV2GPreChargePerformaceTime = NO;
  2314. if (strncmp(code, "023855", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_TARGET_INFO = NO;
  2315. if (strncmp(code, "023856", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_TARGET_INFO = NO;
  2316. if (strncmp(code, "023857", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_BATTERY_INFO = NO;
  2317. if (strncmp(code, "023858", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_BATTERY_INFO = NO;
  2318. if (strncmp(code, "023859", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EV_STOP_EVENT = NO;
  2319. if (strncmp(code, "023860", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EV_STOP_EVENT = NO;
  2320. if (strncmp(code, "023861", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_STOP_EVENT = NO;
  2321. if (strncmp(code, "023862", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_STOP_EVENT = NO;
  2322. if (strncmp(code, "023863", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_MISC_INFO = NO;
  2323. if (strncmp(code, "023864", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_MISC_INFO = NO;
  2324. if (strncmp(code, "023865", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_REQUEST = NO;
  2325. if (strncmp(code, "023866", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_REQUEST = NO;
  2326. if (strncmp(code, "023867", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_START_BLOCK_TRANSFER = NO;
  2327. if (strncmp(code, "023868", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_START_BLOCK_TRANSFER = NO;
  2328. if (strncmp(code, "023869", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DATA_TRANSFER = NO;
  2329. if (strncmp(code, "023870", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DATA_TRANSFER = NO;
  2330. if (strncmp(code, "023871", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_FINISH = NO;
  2331. if (strncmp(code, "023872", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_FINISH = NO;
  2332. if (strncmp(code, "023873", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_ISOLATION_STATUS = NO;
  2333. if (strncmp(code, "023874", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_ISOLATION_STATUS = NO;
  2334. if (strncmp(code, "023875", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_CONNECTOR_INFO = NO;
  2335. if (strncmp(code, "023876", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_CONNECTOR_INFO = NO;
  2336. if (strncmp(code, "023877", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_RTC_INFO = NO;
  2337. if (strncmp(code, "023878", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_RTC_INFO = NO;
  2338. if (strncmp(code, "023879", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_PRECHARGE_INFO = NO;
  2339. if (strncmp(code, "023880", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_PRECHARGE_INFO = NO;
  2340. if (strncmp(code, "023881", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMSG_Sequence = NO;
  2341. if (strncmp(code, "023882", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCAN_MSG_Unrecognized_CMD_ID = NO;
  2342. if (strncmp(code, "023883", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Decode_Error = NO;
  2343. if (strncmp(code, "023884", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Encode_Error = NO;
  2344. if (strncmp(code, "023885", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Decode_Error = NO;
  2345. if (strncmp(code, "023886", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Encode_Error = NO;
  2346. if (strncmp(code, "023887", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Decode_Error = NO;
  2347. if (strncmp(code, "023888", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Encode_Error = NO;
  2348. if (strncmp(code, "023889", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCpStatus_Error = NO;
  2349. if (strncmp(code, "023890", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnexpectVolBeforeCharing_Error = NO;
  2350. if (strncmp(code, "023891", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccNotReadyForCharging = NO;
  2351. //if (strncmp(code, "023892", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutQCA7000Comm = NO;
  2352. if (strncmp(code, "023893", 6) == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccFailForQCA7000SetKey = NO;
  2353. }
  2354. }
  2355. }
  2356. }
  2357. }
  2358. bool AbnormalStopAnalysis(byte gun_index, byte *errCode)
  2359. {
  2360. char string[7];
  2361. sprintf(string, "%d%d%d%d%d%d", *(errCode + 0), *(errCode + 1), *(errCode + 2), *(errCode + 3), *(errCode + 4), *(errCode + 5));
  2362. PRINTF_FUNC("NOTIFICATION_EV_STOP : Err Code = %s \n", string);
  2363. if (strncmp(string, "000000", 6) == EQUAL)
  2364. return false;
  2365. if (strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) != EQUAL)
  2366. return true;
  2367. memcpy(_chargingData[gun_index]->EvConnAlarmCode, string, 6);
  2368. PRINTF_FUNC("NOTIFICATION_EV_STOP : EvConnAlarmCode = %s \n", _chargingData[gun_index]->EvConnAlarmCode);
  2369. if (strcmp(string, "023700") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvCommFail = YES;
  2370. if (strcmp(string, "023704") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryMalfun = YES;
  2371. if (strcmp(string, "023705") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoNoPermission = YES;
  2372. if (strcmp(string, "023706") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryIncompatibility = YES;
  2373. if (strcmp(string, "023707") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOVP = YES;
  2374. if (strcmp(string, "023708") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryUVP = YES;
  2375. if (strcmp(string, "023709") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOTP = YES;
  2376. if (strcmp(string, "023710") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryCurrentDiff = YES;
  2377. if (strcmp(string, "023711") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryVoltageDiff = YES;
  2378. if (strcmp(string, "023712") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoShiftPosition = YES;
  2379. if (strcmp(string, "023713") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBatteryOtherFault = YES;
  2380. if (strcmp(string, "023714") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargingSystemError = YES;
  2381. if (strcmp(string, "023715") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoEvNormalStop = YES;
  2382. if (strcmp(string, "023716") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoTempSensorBroken = YES;
  2383. if (strcmp(string, "023717") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoConnectorLockFail = YES;
  2384. if (strcmp(string, "023718") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoD1OnNoReceive = YES;
  2385. if (strcmp(string, "023719") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJTimeout = YES;
  2386. if (strcmp(string, "023720") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeAllowTimeout = YES;
  2387. if (strcmp(string, "023721") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoWaitGfdTimeout = YES;
  2388. if (strcmp(string, "023722") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayTimeout = YES;
  2389. if (strcmp(string, "023723") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsReqCurrentTimeout = YES;
  2390. if (strcmp(string, "023724") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsKtoJOffTimeout = YES;
  2391. if (strcmp(string, "023725") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsEvRelayOffTimeout = YES;
  2392. if (strcmp(string, "023726") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan10V = YES;
  2393. if (strcmp(string, "023727") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoAdcMoreThan20V = YES;
  2394. if (strcmp(string, "023728") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoBmsChargeBeforeStop = YES;
  2395. if (strcmp(string, "023729") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetNormalStop = YES;
  2396. if (strcmp(string, "023730") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargerGetEmergencyStop = YES;
  2397. if (strcmp(string, "023731") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoIsolationResultFail = YES;
  2398. if (strcmp(string, "023732") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoMissLinkWithMotherBoard = YES;
  2399. if (strcmp(string, "023733") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoOutputVolMoreThanLimit = YES;
  2400. if (strcmp(string, "023734") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReqCurrentMoreThanLimit = YES;
  2401. if (strcmp(string, "023735") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed = YES;
  2402. if (strcmp(string, "023736") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown = YES;
  2403. if (strcmp(string, "023701") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail = YES;
  2404. if (strcmp(string, "023737") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit = YES;
  2405. if (strcmp(string, "023738") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition = YES;
  2406. if (strcmp(string, "023739") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargerConnectorLockFault = YES;
  2407. if (strcmp(string, "023740") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVRESSMalfunction = YES;
  2408. if (strcmp(string, "023741") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingCurrentdifferential = YES;
  2409. if (strcmp(string, "023742") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingVoltageOutOfRange = YES;
  2410. if (strcmp(string, "023743") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingSystemIncompatibility = YES;
  2411. if (strcmp(string, "023744") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEmergencyEvent = YES;
  2412. if (strcmp(string, "023745") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsBreaker = YES;
  2413. if (strcmp(string, "023746") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoData = YES;
  2414. if (strcmp(string, "023747") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_A = YES;
  2415. if (strcmp(string, "023748") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_B = YES;
  2416. if (strcmp(string, "023749") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_DIN_C = YES;
  2417. if (strcmp(string, "023750") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_1 = YES;
  2418. if (strcmp(string, "023751") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_2 = YES;
  2419. if (strcmp(string, "023752") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_ISO_3 = YES;
  2420. if (strcmp(string, "023753") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_1 = YES;
  2421. if (strcmp(string, "023754") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_2 = YES;
  2422. if (strcmp(string, "023755") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_3 = YES;
  2423. if (strcmp(string, "023756") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_4 = YES;
  2424. if (strcmp(string, "023757") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.Ccsreserved_by_OEM_5 = YES;
  2425. if (strcmp(string, "023758") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequenceError = YES;
  2426. if (strcmp(string, "023759") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSignatureError = YES;
  2427. if (strcmp(string, "023760") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnknownSession = YES;
  2428. if (strcmp(string, "023761") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceIDInvalid = YES;
  2429. if (strcmp(string, "023762") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPaymentSelectionInvalid = YES;
  2430. if (strcmp(string, "023763") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsIdentificationSelectionInvalid = YES;
  2431. if (strcmp(string, "023764") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceSelectionInvalid = YES;
  2432. if (strcmp(string, "023765") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateExpired = YES;
  2433. if (strcmp(string, "023766") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotYetValid = YES;
  2434. if (strcmp(string, "023767") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateRevoked = YES;
  2435. if (strcmp(string, "023768") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoCertificateAvailable = YES;
  2436. if (strcmp(string, "023769") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertChainError = YES;
  2437. if (strcmp(string, "023770") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertValidationError = YES;
  2438. if (strcmp(string, "023771") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertVerificationError = YES;
  2439. if (strcmp(string, "023772") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractCanceled = YES;
  2440. if (strcmp(string, "023773") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChallengeInvalid = YES;
  2441. if (strcmp(string, "023774") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongEnergyTransferMode = YES;
  2442. if (strcmp(string, "023775") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWrongChargeParameter = YES;
  2443. if (strcmp(string, "023776") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargingProfileInvalid = YES;
  2444. if (strcmp(string, "023777") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTariffSelectionInvalid = YES;
  2445. if (strcmp(string, "023778") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEPresentVoltageToLow = YES;
  2446. if (strcmp(string, "023779") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryNotApplied = YES;
  2447. if (strcmp(string, "023780") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMeteringSignatureNotValid = YES;
  2448. if (strcmp(string, "023781") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoChargeServiceSelected = YES;
  2449. if (strcmp(string, "023782") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContactorError = YES;
  2450. if (strcmp(string, "023783") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCertificateNotAllowedAtThisEVSE = YES;
  2451. if (strcmp(string, "023784") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsGAChargeStop = YES;
  2452. if (strcmp(string, "023785") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAlignmentError = YES;
  2453. if (strcmp(string, "023786") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsACDError = YES;
  2454. if (strcmp(string, "023787") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsAssociationError = YES;
  2455. if (strcmp(string, "023788") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVSEChargeAbort = YES;
  2456. if (strcmp(string, "023789") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsNoSupportedAppProtocol = YES;
  2457. if (strcmp(string, "023790") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractNotAccepted = YES;
  2458. if (strcmp(string, "023791") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMOUnknown = YES;
  2459. if (strcmp(string, "023792") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_Prov_CertificateRevoke = YES;
  2460. if (strcmp(string, "023793") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA1_CertificateRevoked = YES;
  2461. if (strcmp(string, "023794") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_SubCA2_CertificateRevoked = YES;
  2462. if (strcmp(string, "023795") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsOEM_RootCA_CertificateRevoked = YES;
  2463. if (strcmp(string, "023796") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_Prov_CertificateRevoked = YES;
  2464. if (strcmp(string, "023797") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA1_CertificateRevoked = YES;
  2465. if (strcmp(string, "023798") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_SubCA2_CertificateRevoked = YES;
  2466. if (strcmp(string, "023799") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMO_RootCA_CertificateRevoked = YES;
  2467. if (strcmp(string, "023800") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_Prov_CertificateRevoked = YES;
  2468. if (strcmp(string, "023801") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA1_CertificateRevoked = YES;
  2469. if (strcmp(string, "023802") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_SubCA2_CertificateRevoked = YES;
  2470. if (strcmp(string, "023803") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPS_RootCA_CertificateRevoked = YES;
  2471. if (strcmp(string, "023809") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_SLAC_init = YES;
  2472. if (strcmp(string, "023810") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_match_response = YES;
  2473. if (strcmp(string, "023811") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_sequence = YES;
  2474. if (strcmp(string, "023812") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_match_MNBC = YES;
  2475. if (strcmp(string, "023813") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_avg_atten_calc = YES;
  2476. if (strcmp(string, "023814") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_match_response = YES;
  2477. if (strcmp(string, "023815") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_match_session = YES;
  2478. if (strcmp(string, "023816") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_assoc_session = YES;
  2479. if (strcmp(string, "023817") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_vald_toggle = YES;
  2480. if (strcmp(string, "023818") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmMnbcSound = YES;
  2481. if (strcmp(string, "023819") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccSlacTimeoutCmValidateReq = YES;
  2482. if (strcmp(string, "023823") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUDP_TT_match_join = YES;
  2483. if (strcmp(string, "023824") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTCP_TT_match_join = YES;
  2484. if (strcmp(string, "023825") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_amp_map_exchange = YES;
  2485. if (strcmp(string, "023826") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_link_ready_notification = YES;
  2486. if (strcmp(string, "023832") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSupportedAppProtocolRes = YES;
  2487. if (strcmp(string, "023833") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionSetupRes = YES;
  2488. if (strcmp(string, "023834") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServiceDiscoveryRes = YES;
  2489. if (strcmp(string, "023835") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsServicePaymentSelectionRes = YES;
  2490. if (strcmp(string, "023836") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsContractAuthenticationRes = YES;
  2491. if (strcmp(string, "023837") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsChargeParameterDiscoveryRes = YES;
  2492. if (strcmp(string, "023838") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPowerDeliveryRes = YES;
  2493. if (strcmp(string, "023839") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheckRes = YES;
  2494. if (strcmp(string, "023840") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsPreChargeRes = YES;
  2495. if (strcmp(string, "023841") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCurrentDemandRes = YES;
  2496. if (strcmp(string, "023842") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsWeldingDetectionRes = YES;
  2497. if (strcmp(string, "023843") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSessionStopRes = YES;
  2498. if (strcmp(string, "023844") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSequence_Time = YES;
  2499. if (strcmp(string, "023845") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsReadyToCharge_Performance_Time = YES;
  2500. if (strcmp(string, "023846") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCommunicationSetup_Performance_Time = YES;
  2501. if (strcmp(string, "023847") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCableCheck_Performance_Time = YES;
  2502. if (strcmp(string, "023848") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPState_Detection_Time = YES;
  2503. if (strcmp(string, "023849") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCPOscillator_Retain_Time = YES;
  2504. if (strcmp(string, "023850") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutV2GPreChargePerformaceTime = YES;
  2505. if (strcmp(string, "023855") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_TARGET_INFO = YES;
  2506. if (strcmp(string, "023856") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_TARGET_INFO = YES;
  2507. if (strcmp(string, "023857") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_EV_BATTERY_INFO = YES;
  2508. if (strcmp(string, "023858") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_EV_BATTERY_INFO = YES;
  2509. if (strcmp(string, "023859") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EV_STOP_EVENT = YES;
  2510. if (strcmp(string, "023860") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EV_STOP_EVENT = YES;
  2511. if (strcmp(string, "023861") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_STOP_EVENT = YES;
  2512. if (strcmp(string, "023862") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_STOP_EVENT = YES;
  2513. if (strcmp(string, "023863") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_GET_MISC_INFO = YES;
  2514. if (strcmp(string, "023864") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_GET_MISC_INFO = YES;
  2515. if (strcmp(string, "023865") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_REQUEST = YES;
  2516. if (strcmp(string, "023866") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_REQUEST = YES;
  2517. if (strcmp(string, "023867") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_START_BLOCK_TRANSFER = YES;
  2518. if (strcmp(string, "023868") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_START_BLOCK_TRANSFER = YES;
  2519. if (strcmp(string, "023869") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DATA_TRANSFER = YES;
  2520. if (strcmp(string, "023870") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DATA_TRANSFER = YES;
  2521. if (strcmp(string, "023871") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_DOWNLOAD_FINISH = YES;
  2522. if (strcmp(string, "023872") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_DOWNLOAD_FINISH = YES;
  2523. if (strcmp(string, "023873") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_ISOLATION_STATUS = YES;
  2524. if (strcmp(string, "023874") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_ISOLATION_STATUS = YES;
  2525. if (strcmp(string, "023875") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_CONNECTOR_INFO = YES;
  2526. if (strcmp(string, "023876") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_CONNECTOR_INFO = YES;
  2527. if (strcmp(string, "023877") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_RTC_INFO = YES;
  2528. if (strcmp(string, "023878") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_RTC_INFO = YES;
  2529. if (strcmp(string, "023879") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTP_EVSE_PRECHARGE_INFO = YES;
  2530. if (strcmp(string, "023880") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsTT_EVSE_PRECHARGE_INFO = YES;
  2531. if (strcmp(string, "023881") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsMSG_Sequence = YES;
  2532. if (strcmp(string, "023882") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCAN_MSG_Unrecognized_CMD_ID = YES;
  2533. if (strcmp(string, "023883") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Decode_Error = YES;
  2534. if (strcmp(string, "023884") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsDIN_Msg_Encode_Error = YES;
  2535. if (strcmp(string, "023885") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Decode_Error = YES;
  2536. if (strcmp(string, "023886") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO1_Msg_Encode_Error = YES;
  2537. if (strcmp(string, "023887") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Decode_Error = YES;
  2538. if (strcmp(string, "023888") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsISO2_Msg_Encode_Error = YES;
  2539. if (strcmp(string, "023889") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsCpStatus_Error = YES;
  2540. if (strcmp(string, "023890") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsUnexpectVolBeforeCharing_Error = YES;
  2541. if (strcmp(string, "023891") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccNotReadyForCharging = YES;
  2542. if (strcmp(string, "023892") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccTimeoutQCA7000Comm = YES;
  2543. if (strcmp(string, "023893") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsSeccFailForQCA7000SetKey = YES;
  2544. if (strcmp(string, "023702") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.GbEvCommFail = YES;
  2545. if (strcmp(string, "023900") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_LOS_CC1 = YES;
  2546. if (strcmp(string, "023901") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CONNECTOR_LOCK_FAIL = YES;
  2547. if (strcmp(string, "023902") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BATTERY_INCOMPATIBLE = YES;
  2548. if (strcmp(string, "023903") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_BROAA_TIMEOUT = YES;
  2549. if (strcmp(string, "023904") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CSU_PRECHARGE_TIMEOUT = YES;
  2550. if (strcmp(string, "023905") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_PRESENT_VOLTAGE_FAULT = YES;
  2551. if (strcmp(string, "023906") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BMS_VOLTAGE_OVER_RANGE = YES;
  2552. if (strcmp(string, "023907") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_BSM_CHARGE_ALLOW_00_10MIN_COUUNTDONE = YES;
  2553. if (strcmp(string, "023908") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_WAIT_GROUNDFAULT_TIMEOUT = YES;
  2554. if (strcmp(string, "023909") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_10V = YES;
  2555. if (strcmp(string, "023910") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ADC_MORE_THAN_60V = YES;
  2556. if (strcmp(string, "023911") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_NORMAL_STOP_CMD = YES;
  2557. if (strcmp(string, "023912") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_CHARGER_GET_EMERGENCY_STOP_CMD = YES;
  2558. if (strcmp(string, "023913") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_ISOLATION_RESULT_FAIL = YES;
  2559. if (strcmp(string, "023914") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_MOTHER_BOARD_MISS_LINK = YES;
  2560. if (strcmp(string, "023915") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_LIMIT = YES;
  2561. if (strcmp(string, "023916") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_REQ_CURRENT_MORE_THAN_LIMIT = YES;
  2562. if (strcmp(string, "023917") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_MORE_THAN_10_PERCENT = YES;
  2563. if (strcmp(string, "023918") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_OUTPUT_VOLTAGE_DIFF_BCS_5_PERCENT = YES;
  2564. if (strcmp(string, "023919") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GBT_STOP_ADC_MORE_THAN_10V = YES;
  2565. if (strcmp(string, "023930") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BHM_TIMEOUT = YES;
  2566. if (strcmp(string, "023931") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRM_TIMEOUT = YES;
  2567. if (strcmp(string, "023932") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCP_TIMEOUT = YES;
  2568. if (strcmp(string, "023933") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BRO_TIMEOUT = YES;
  2569. if (strcmp(string, "023934") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCL_TIMEOUT = YES;
  2570. if (strcmp(string, "023935") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BCS_TIMEOUT = YES;
  2571. if (strcmp(string, "023936") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSM_TIMEOUT = YES;
  2572. if (strcmp(string, "023937") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BST_TIMEOUT = YES;
  2573. if (strcmp(string, "023938") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BSD_TIMEOUT = YES;
  2574. if (strcmp(string, "023939") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_CEM_BEM_OTHER_TIMEOUT = YES;
  2575. if (strcmp(string, "023940") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRM_TIMEOUT = YES;
  2576. if (strcmp(string, "023941") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRMAA_TIMEOUT = YES;
  2577. if (strcmp(string, "023942") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CTS_CML_TIMEOUT = YES;
  2578. if (strcmp(string, "023943") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CRO_TIMEOUT = YES;
  2579. if (strcmp(string, "023944") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CCS_TIMEOUT = YES;
  2580. if (strcmp(string, "023945") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CST_TIMEOUT = YES;
  2581. if (strcmp(string, "023946") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_CSD_TIMEOUT = YES;
  2582. if (strcmp(string, "023947") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BEM_BEM_OTHER_TIMEOUT = YES;
  2583. if (strcmp(string, "023950") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_SOC_GOAL = YES;
  2584. if (strcmp(string, "023951") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_TOTAL_VOLTAGE_GOAL = YES;
  2585. if (strcmp(string, "023952") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CELL_VOLTAGE_GOAL = YES;
  2586. if (strcmp(string, "023953") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_GET_CST = YES;
  2587. if (strcmp(string, "023954") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_ISOLATION = YES;
  2588. if (strcmp(string, "023955") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OUTPUT_CONNECTOR_OTP = YES;
  2589. if (strcmp(string, "023956") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_COMPONENT = YES;
  2590. if (strcmp(string, "023957") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CHARGE_CONNECTOR = YES;
  2591. if (strcmp(string, "023958") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTP = YES;
  2592. if (strcmp(string, "023959") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_OTHER = YES;
  2593. if (strcmp(string, "023960") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_HIGH_V = YES;
  2594. if (strcmp(string, "023961") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CC2 = YES;
  2595. if (strcmp(string, "023962") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_CURRENT = YES;
  2596. if (strcmp(string, "023963") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BST_VOLTAGE = YES;
  2597. if (strcmp(string, "023964") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_GET_BST_NO_REASON = YES;
  2598. if (strcmp(string, "023970") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_OVER_VOLTAGE = YES;
  2599. if (strcmp(string, "023971") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CELL_UNDER_VOLTAGE = YES;
  2600. if (strcmp(string, "023972") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OVER_SOC = YES;
  2601. if (strcmp(string, "023973") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_UNDER_SOC = YES;
  2602. if (strcmp(string, "023974") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_CURRENT = YES;
  2603. if (strcmp(string, "023975") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_TEMPERATURE = YES;
  2604. if (strcmp(string, "023976") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_ISOLATE = YES;
  2605. if (strcmp(string, "023977") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ERROR_CODE_BSM_OUTPUT_CONNECTOR = YES;
  2606. return true;
  2607. }
  2608. void CANReceiver()
  2609. {
  2610. pid_t canRecPid;
  2611. canRecPid = fork();
  2612. if(canRecPid > 0)
  2613. {
  2614. int nbytes;
  2615. struct can_frame frame;
  2616. int intCmd;
  2617. // 槍資訊
  2618. struct ChargingInfoData *_chargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  2619. struct timeval _cmd_ack_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
  2620. bool isPass = false;
  2621. gun_count = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
  2622. while(!isPass)
  2623. {
  2624. isPass = true;
  2625. for (byte _index = 0; _index < gun_count; _index++)
  2626. {
  2627. if (!FindChargingInfoData(_index, &_chargingData[0]))
  2628. {
  2629. DEBUG_ERROR("EvComm (main) : FindChargingInfoData false \n");
  2630. isPass = false;
  2631. break;
  2632. }
  2633. }
  2634. sleep(1);
  2635. }
  2636. for (byte _index = 0; _index < gun_count; _index++)
  2637. gettimeofday(&_cmd_ack_timeout[_index], NULL);
  2638. while (1)
  2639. {
  2640. memset(&frame, 0, sizeof(struct can_frame));
  2641. nbytes = read(CanFd, &frame, sizeof(struct can_frame));
  2642. for (byte _index = 0; _index < gun_count; _index++)
  2643. {
  2644. if (GetTimeoutValue(_cmd_ack_timeout[_index]) >= 5000000)
  2645. {
  2646. // ACK timeout
  2647. //PRINTF_FUNC("gun = %x, ack timeout \n", _index);
  2648. }
  2649. }
  2650. if (nbytes > 0)
  2651. {
  2652. byte target;
  2653. byte targetGun = 0x00;
  2654. intCmd = (int) (frame.can_id & CAN_EFF_MASK);
  2655. if (intCmd == ADDRESS_REQ)
  2656. {
  2657. AddrAssignment(frame.data);
  2658. continue;
  2659. }
  2660. intCmd = (int) (frame.can_id & CAN_EFF_MASK & 0xFFFFFF00);
  2661. target = ((byte) (frame.can_id & 0x000000FF)); // 0x01 or 0x02
  2662. for (byte _index = 0; _index < gun_count; _index++)
  2663. {
  2664. if (_chargingData[_index]->Evboard_id == target)
  2665. {
  2666. targetGun = _index;
  2667. break;
  2668. }
  2669. }
  2670. if(targetGun < 0 || targetGun >= CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY)
  2671. {
  2672. PRINTF_FUNC("EvComm (CANReceiver) : Target index = %x is < 0 or > QUANTITY \n", targetGun);
  2673. continue;
  2674. }
  2675. if(intCmd == 256)
  2676. {
  2677. continue;
  2678. }
  2679. gettimeofday(&_cmd_ack_timeout[targetGun], NULL);
  2680. switch (intCmd)
  2681. {
  2682. case NOTIFICATION_EV_STATUS:
  2683. {
  2684. if (_chargingData[targetGun]->ConnectorPlugIn != frame.data[0])
  2685. PRINTF_FUNC("Conn %d, Ori Plug status = %x, Now Plug status = %x \n", targetGun, _chargingData[targetGun]->ConnectorPlugIn, frame.data[0]);
  2686. _chargingData[targetGun]->ConnectorPlugIn = frame.data[0];
  2687. _chargingData[targetGun]->PilotVoltage = frame.data[1];
  2688. //PRINTF_FUNC("index = %d, ConnectorPlugIn = %x, data[0] = %x \n", targetGun, _chargingData[targetGun]->ConnectorPlugIn, frame.data[0]);
  2689. //PRINTF_FUNC("ConnectorPlugIn = %x \n", (-120 + frame.data[1]) / 10);
  2690. }
  2691. break;
  2692. case ACK_EV_FW_VERSION:
  2693. {
  2694. byte ver[16];
  2695. memset(ver, 0, sizeof(ver));
  2696. if (_chargingData[targetGun]->Type == _Type_Chademo)
  2697. {
  2698. memcpy(ver, frame.data, frame.can_dlc);
  2699. memcpy(ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].version, ver, ARRAY_SIZE(ver));
  2700. ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].SelfTest_Comp = PASS;
  2701. PRINTF_FUNC("Connector %d, Chadmoe Ver. : %s\n",
  2702. targetGun, ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].version);
  2703. }
  2704. else if (_chargingData[targetGun]->Type == _Type_GB)
  2705. {
  2706. memcpy(ver, frame.data, frame.can_dlc);
  2707. memcpy(ShmGBTData->evse[_chargingData[targetGun]->type_index].version, ver, ARRAY_SIZE(ver));
  2708. ShmGBTData->evse[_chargingData[targetGun]->type_index].SelfTest_Comp = PASS;
  2709. PRINTF_FUNC("Connector %d, GBT Ver. : %s\n",
  2710. targetGun, ShmGBTData->evse[_chargingData[targetGun]->type_index].version);
  2711. }
  2712. else if (_chargingData[targetGun]->Type == _Type_CCS_2)
  2713. {
  2714. if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121)
  2715. {
  2716. memcpy(ver, frame.data, frame.can_dlc);
  2717. memcpy(&ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].version, ver, ARRAY_SIZE(ver));
  2718. ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].SelfTest_Comp = PASS;
  2719. PRINTF_FUNC("Connector %d, CCS Ver. = %s \n",
  2720. targetGun, ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].version);
  2721. }
  2722. }
  2723. if (targetGun == 0)
  2724. {
  2725. memset(ShmSysConfigAndInfo->SysInfo.Connector1FwRev, 0, sizeof(ShmSysConfigAndInfo->SysInfo.Connector1FwRev));
  2726. memcpy(ShmSysConfigAndInfo->SysInfo.Connector1FwRev, ver, ARRAY_SIZE(ver));
  2727. }
  2728. else
  2729. {
  2730. memset(ShmSysConfigAndInfo->SysInfo.Connector2FwRev, 0, sizeof(ShmSysConfigAndInfo->SysInfo.Connector2FwRev));
  2731. memcpy(ShmSysConfigAndInfo->SysInfo.Connector2FwRev, ver, ARRAY_SIZE(ver));
  2732. }
  2733. }
  2734. break;
  2735. case ACK_EV_HW_VERSION:
  2736. {
  2737. //PRINTF_FUNC("Get EV HW = %s \n", frame.data);
  2738. }
  2739. break;
  2740. case ACK_GET_OUTPUT_REQ:
  2741. {
  2742. if ((_chargingData[targetGun]->SystemStatus >= S_PREPARING_FOR_EV &&
  2743. _chargingData[targetGun]->SystemStatus <= S_CHARGING) ||
  2744. (_chargingData[targetGun]->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
  2745. _chargingData[targetGun]->SystemStatus <= S_CCS_PRECHARGE_ST1))
  2746. {
  2747. if (_chargingData[targetGun]->EvBatteryStartSoc <= 0)
  2748. _chargingData[targetGun]->EvBatteryStartSoc = frame.data[1];
  2749. if (frame.data[1] > _chargingData[targetGun]->EvBatterySoc)
  2750. _chargingData[targetGun]->EvBatterySoc = frame.data[1];
  2751. }
  2752. _chargingData[targetGun]->EvBatterytargetVoltage = (float)((frame.data[3] << 8) + frame.data[2]) / 10;
  2753. _chargingData[targetGun]->EvBatterytargetCurrent = (float)((frame.data[5] << 8) + frame.data[4]) / 10;
  2754. _chargingData[targetGun]->RemainChargingDuration = ((short) frame.data[7] << 8) + (short) frame.data[6];
  2755. if (_chargingData[targetGun]->Type == _Type_Chademo)
  2756. {
  2757. //if (ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].EvDetection != frame.data[0])
  2758. {
  2759. ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].PresentMsgFlowStatus = frame.data[0];
  2760. }
  2761. ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].EvDetection = frame.data[0];
  2762. ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].SOC = _chargingData[targetGun]->EvBatterySoc;
  2763. ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].TargetBatteryVoltage = (_chargingData[targetGun]->EvBatterytargetVoltage * 10);
  2764. ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].ChargingCurrentRequest = (_chargingData[targetGun]->EvBatterytargetCurrent * 10);
  2765. }
  2766. else if (_chargingData[targetGun]->Type == _Type_GB)
  2767. {
  2768. //if (ShmGBTData->ev[_chargingData[targetGun]->type_index].EvDetection != frame.data[0])
  2769. {
  2770. ShmGBTData->ev[_chargingData[targetGun]->type_index].PresentMsgFlowStatus = frame.data[0];
  2771. }
  2772. ShmGBTData->ev[_chargingData[targetGun]->type_index].EvDetection = frame.data[0];
  2773. ShmGBTData->ev[_chargingData[targetGun]->type_index].SOC = _chargingData[targetGun]->EvBatterySoc;
  2774. ShmGBTData->ev[_chargingData[targetGun]->type_index].TargetBatteryVoltage = (_chargingData[targetGun]->EvBatterytargetVoltage * 10);
  2775. ShmGBTData->ev[_chargingData[targetGun]->type_index].ChargingCurrentRequest = (_chargingData[targetGun]->EvBatterytargetCurrent * 10);
  2776. }
  2777. else if (_chargingData[targetGun]->Type == _Type_CCS_2)
  2778. {
  2779. if(ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121)
  2780. {
  2781. ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].PresentMsgFlowStatus = frame.data[0];
  2782. }
  2783. }
  2784. //PRINTF_FUNC("EvBatterytargetVoltage = %f \n", _chargingData[targetGun]->EvBatterytargetVoltage);
  2785. //PRINTF_FUNC("EvBatterytargetCurrent = %f \n", _chargingData[targetGun]->EvBatterytargetCurrent);
  2786. //PRINTF_FUNC("BatteryVoltage = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].TargetBatteryVoltage);
  2787. //PRINTF_FUNC("CurrentRequest = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].ChargingCurrentRequest);
  2788. }
  2789. break;
  2790. case ACK_GET_EV_BATTERY_INFO:
  2791. {
  2792. //_chargingData[target].EvACorDCcharging = frame.data[0];
  2793. //_chargingData[target]->TotalBatteryCap = ((float) frame.data[4] << 8) + (short) frame.data[3];
  2794. _chargingData[targetGun]->EvBatteryMaxVoltage = (((short) frame.data[4] << 8) + (short) frame.data[3]) / 10;
  2795. //_chargingData[target]->EvBatteryMaxCurrent = ((float) frame.data[4] << 8) + (short) frame.data[3];
  2796. //_chargingData[target].MaxiBatteryCurrent = ((short) frame.data[6] << 8) + (short) frame.data[5];
  2797. if (_chargingData[targetGun]->Type == _Type_Chademo)
  2798. {
  2799. ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].TotalBatteryCapacity = ((short) frame.data[2] << 8) + (short) frame.data[1];
  2800. ShmCHAdeMOData->ev[_chargingData[targetGun]->type_index].MaxiBatteryVoltage = _chargingData[targetGun]->EvBatteryMaxVoltage;
  2801. //PRINTF_FUNC("EvBatteryMaxVoltage = %f \n", _chargingData[target]->EvBatteryMaxVoltage);
  2802. //PRINTF_FUNC("TotalBatteryCapacity = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].TotalBatteryCapacity);
  2803. //PRINTF_FUNC("MaxiBatteryVoltage = %d \n", ShmCHAdeMOData->ev[_chargingData[target]->type_index].MaxiBatteryVoltage);
  2804. }
  2805. else if (_chargingData[targetGun]->Type == _Type_GB)
  2806. {
  2807. ShmGBTData->ev[_chargingData[targetGun]->type_index].TotalBatteryCapacity = ((short) frame.data[2] << 8) + (short) frame.data[1];
  2808. ShmGBTData->ev[_chargingData[targetGun]->type_index].MaxiBatteryVoltage = _chargingData[targetGun]->EvBatteryMaxVoltage;
  2809. }
  2810. else if (_chargingData[targetGun]->Type == _Type_CCS_2)
  2811. {
  2812. }
  2813. }
  2814. break;
  2815. case ACK_GET_MISCELLANEOUS_INFO:
  2816. {
  2817. _chargingData[targetGun]->GunLocked = frame.data[0];
  2818. _chargingData[targetGun]->PilotVoltage = (float)(-120 + frame.data[3]) / 10;
  2819. if (_chargingData[targetGun]->Type == _Type_Chademo)
  2820. {
  2821. ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureP = frame.data[1];
  2822. ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureN = frame.data[2];
  2823. ShmCHAdeMOData->evse[_chargingData[targetGun]->type_index].EvboardStatus = frame.data[7];
  2824. }
  2825. else if (_chargingData[targetGun]->Type == _Type_GB)
  2826. {
  2827. ShmGBTData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureP = frame.data[1];
  2828. ShmGBTData->evse[_chargingData[targetGun]->type_index].ConnectorTemperatureN = frame.data[2];
  2829. ShmGBTData->evse[_chargingData[targetGun]->type_index].EvboardStatus = frame.data[7];
  2830. }
  2831. else if (_chargingData[targetGun]->Type == _Type_CCS_2)
  2832. {
  2833. if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121)
  2834. {
  2835. //ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index]. .ConnectorTemperatureP = frame.data[1];
  2836. //ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index]. .ConnectorTemperatureN = frame.data[2];
  2837. }
  2838. }
  2839. //PRINTF_FUNC("EvboardStatus = %x \n", ShmCHAdeMOData->evse[_chargingData[target]->type_index].EvboardStatus);
  2840. //PRINTF_FUNC("ConnectorPlug locked = %x \n", frame.data[0]);
  2841. //PRINTF_FUNC("ConnectorTemp 0= %d \n", ShmCHAdeMOData->evse[_chargingData[target]->type_index].ConnectorTemperatureP);
  2842. //PRINTF_FUNC("ConnectorTemp 1= %d \n", ShmCHAdeMOData->evse[_chargingData[target]->type_index].ConnectorTemperatureN);
  2843. //PRINTF_FUNC("PilotVoltage = %x \n", (-120 + frame.data[3]) / 10);
  2844. }
  2845. break;
  2846. case ACK_EVSE_ISOLATION_STATUS: {}
  2847. break;
  2848. case ACK_EVSE_PRECHAGE_INFO:
  2849. {
  2850. _chargingData[targetGun]->PrechargeStatus = frame.data[0];
  2851. }
  2852. break;
  2853. case NOTIFICATION_EV_STOP:
  2854. {
  2855. // 車端要求停止
  2856. if ((_chargingData[targetGun]->SystemStatus >= S_REASSIGN_CHECK &&
  2857. _chargingData[targetGun]->SystemStatus <= S_TERMINATING) ||
  2858. (_chargingData[targetGun]->SystemStatus >= S_CCS_PRECHARGE_ST0 &&
  2859. _chargingData[targetGun]->SystemStatus <= S_CCS_PRECHARGE_ST1))
  2860. {
  2861. // frame.data[0] : 0x01 => normal stop, 0x02 => ev emergency stop
  2862. PRINTF_FUNC("Gun_%d, Stop charging by EV. \n", targetGun);
  2863. //if (frame.data[0] == 0x02)
  2864. {
  2865. if (AbnormalStopAnalysis(targetGun, frame.data + 1))
  2866. {
  2867. _chargingData[targetGun]->StopChargeFlag = YES;
  2868. }
  2869. else
  2870. {
  2871. // 六個蛋
  2872. _chargingData[targetGun]->UnKnowStopChargeFlag = YES;
  2873. }
  2874. }
  2875. }
  2876. }
  2877. break;
  2878. default:
  2879. //PRINTF_FUNC("EV board = %d, Ack none defined. intCmd = %d \n", targetGun, intCmd);
  2880. break;
  2881. }
  2882. }
  2883. else
  2884. usleep(10000);
  2885. }
  2886. }
  2887. }
  2888. //================================================
  2889. // Main process
  2890. //================================================
  2891. // 檢查 Byte 中某個 Bit 的值
  2892. // _byte : 欲改變的 byte
  2893. // _bit : 該 byte 的第幾個 bit
  2894. unsigned char EvDetectionStatus(unsigned char _byte, unsigned char _bit)
  2895. {
  2896. return ( _byte & mask_table[_bit] ) != 0x00;
  2897. }
  2898. bool IsConnectorPlugIn(struct ChargingInfoData *chargingData)
  2899. {
  2900. return (chargingData->ConnectorPlugIn == 0x01) ? true : false;
  2901. }
  2902. void SetPresentChargingOutputPower(struct ChargingInfoData *chargingData_1, struct ChargingInfoData *chargingData_2)
  2903. {
  2904. float vol1 = 0, cur1 = 0;
  2905. float vol2 = 0, cur2 = 0;
  2906. // if (ShmGBTData->ev[chargingData_1->type_index].PresentMsgFlowStatus == 10)
  2907. // vol1 = ShmPsuData->PsuGroup[0].GroupTargetOutputVoltage;
  2908. // else
  2909. vol1 = chargingData_1->FireChargingVoltage;
  2910. cur1 = (chargingData_1->PresentChargingCurrent * 10);
  2911. // if (ShmGBTData->ev[chargingData_2->type_index].PresentMsgFlowStatus == 10)
  2912. // vol2 = ShmPsuData->PsuGroup[1].GroupTargetOutputVoltage;
  2913. // else
  2914. vol2 = chargingData_2->FireChargingVoltage;
  2915. cur2 = (chargingData_2->PresentChargingCurrent * 10);
  2916. if (
  2917. (LogInfo[0][EV_LOG_NOW_OUTPUT_VOL] >= vol1 + CHK_VOL_RANGE) || (LogInfo[0][EV_LOG_NOW_OUTPUT_VOL] <= vol1 - CHK_VOL_RANGE) ||
  2918. (LogInfo[0][EV_LOG_NOW_OUTPUT_CUR] >= cur1 + CHK_CUR_RANGE) || (LogInfo[0][EV_LOG_NOW_OUTPUT_CUR] <= cur1 - CHK_CUR_RANGE) ||
  2919. (LogInfo[1][EV_LOG_NOW_OUTPUT_VOL] >= vol2 + CHK_VOL_RANGE) || (LogInfo[1][EV_LOG_NOW_OUTPUT_VOL] <= vol2 - CHK_VOL_RANGE) ||
  2920. (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] >= cur2 + CHK_CUR_RANGE) || (LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] <= cur2 - CHK_CUR_RANGE)
  2921. )
  2922. {
  2923. PRINTF_FUNC("G1 -> Output Vol = %.1f, Output Cur = %.1f -- G2 -> Output Vol = %.1f, Output Cur = %.1f \n",
  2924. vol1 / 10, cur1 / 10, vol2 / 10, cur2 / 10);
  2925. LogInfo[0][EV_LOG_NOW_OUTPUT_VOL] = vol1;
  2926. LogInfo[0][EV_LOG_NOW_OUTPUT_CUR] = cur1;
  2927. LogInfo[1][EV_LOG_NOW_OUTPUT_VOL] = vol2;
  2928. LogInfo[1][EV_LOG_NOW_OUTPUT_CUR] = cur2;
  2929. }
  2930. SetPresentOutputPower(vol1, cur1, vol2, cur2);
  2931. }
  2932. void SetPresentChargingOutputCap(struct ChargingInfoData *chargingData_1, struct ChargingInfoData *chargingData_2)
  2933. {
  2934. float pow1 = 0, cur1 = 0;
  2935. float pow2 = 0, cur2 = 0;
  2936. float vol = 0;
  2937. pow1 = chargingData_1->AvailableChargingPower;
  2938. cur1 = chargingData_1->AvailableChargingCurrent;
  2939. vol = chargingData_1->MaximumChargingVoltage;
  2940. GetMaxVolAndCurMethod(chargingData_1->Index, &vol, &cur1);
  2941. GetMaxPowerMethod(chargingData_1->Index, &pow1);
  2942. if (pow1 <= 0)
  2943. cur1 = 0;
  2944. else
  2945. {
  2946. if (chargingData_1->SystemStatus == S_CHARGING &&
  2947. chargingData_1->FireChargingVoltage > 1500)
  2948. {
  2949. float maxCur = 0;
  2950. maxCur = (pow1 * 1000) / chargingData_1->FireChargingVoltage;
  2951. if (maxCur * 10 <= cur1)
  2952. {
  2953. //PRINTF_FUNC("Gun1 -> MaxCharging Current = %f, Cap Current = %f \n", (maxCur * 10), cur1);
  2954. cur1 = maxCur * 10;
  2955. }
  2956. }
  2957. }
  2958. pow2 = chargingData_2->AvailableChargingPower;
  2959. cur2 = chargingData_2->AvailableChargingCurrent;
  2960. vol = chargingData_2->MaximumChargingVoltage;
  2961. GetMaxVolAndCurMethod(chargingData_2->Index, &vol, &cur2);
  2962. GetMaxPowerMethod(chargingData_2->Index, &pow2);
  2963. if (pow2 <= 0)
  2964. cur2 = 0;
  2965. else
  2966. {
  2967. if (chargingData_2->SystemStatus == S_CHARGING &&
  2968. chargingData_2->FireChargingVoltage > 1500)
  2969. {
  2970. float maxCur = 0;
  2971. maxCur = (pow2 * 1000) / chargingData_2->FireChargingVoltage;
  2972. if (maxCur * 10 <= cur2)
  2973. {
  2974. //PRINTF_FUNC("Gun2 -> MaxCharging Current = %f, Cap Current = %f \n", (maxCur * 10), cur2);
  2975. cur2 = maxCur * 10;
  2976. }
  2977. }
  2978. }
  2979. if ((LogInfo[0][EV_LOG_OUTPUT_CAP_POW] <= pow1 - 0.5 || LogInfo[0][EV_LOG_OUTPUT_CAP_POW] >= pow1 + 0.5) ||
  2980. (LogInfo[0][EV_LOG_OUTPUT_CAP_CUR] <= cur1 - 0.5 || LogInfo[0][EV_LOG_OUTPUT_CAP_CUR] >= cur1+ 0.5) ||
  2981. (LogInfo[1][EV_LOG_OUTPUT_CAP_POW] <= pow2 - 0.5 || LogInfo[1][EV_LOG_OUTPUT_CAP_POW] >= pow2 + 0.5) ||
  2982. (LogInfo[1][EV_LOG_OUTPUT_CAP_CUR] <= cur2 - 0.5 || LogInfo[1][EV_LOG_OUTPUT_CAP_CUR] >= cur2 + 0.5))
  2983. {
  2984. PRINTF_FUNC("----------------------------------------------------- \n");
  2985. PRINTF_FUNC("To EV (Real) Power_1 = %.1f, Cur_1 = %.1f, Power_2 = %.1f, Cur_2 = %.1f \n",
  2986. pow1 / 10, cur1 / 10, pow2 / 10, cur2 / 10);
  2987. PRINTF_FUNC("----------------------------------------------------- \n");
  2988. LogInfo[0][EV_LOG_OUTPUT_CAP_POW] = pow1;
  2989. LogInfo[0][EV_LOG_OUTPUT_CAP_CUR] = cur1;
  2990. LogInfo[1][EV_LOG_OUTPUT_CAP_POW] = pow2;
  2991. LogInfo[1][EV_LOG_OUTPUT_CAP_CUR] = cur2;
  2992. chargingData_1->RealMaxCurrent = cur1;
  2993. chargingData_1->RealMaxPower = pow1;
  2994. if (gun_count == 2)
  2995. {
  2996. chargingData_2->RealMaxCurrent = cur2;
  2997. chargingData_2->RealMaxPower = pow2;
  2998. }
  2999. }
  3000. SetPresentOutputCapacity(pow1, cur1, pow2, cur2);
  3001. }
  3002. void Initialization()
  3003. {
  3004. bool isPass = false;
  3005. while(!isPass)
  3006. {
  3007. isPass = true;
  3008. for (byte _index = 0; _index < gun_count; _index++)
  3009. {
  3010. if (!FindChargingInfoData(_index, &_chargingData[0]))
  3011. {
  3012. DEBUG_ERROR("EvComm (main) : FindChargingInfoData false \n");
  3013. isPass = false;
  3014. break;
  3015. }
  3016. }
  3017. sleep(1);
  3018. }
  3019. }
  3020. void GetMaxVolAndCurMethod(byte index, float *vol, float *cur)
  3021. {
  3022. if (maxChargingVol[index] != 0 && maxChargingVol[index] <= *vol)
  3023. *vol = maxChargingVol[index];
  3024. if (maxChargingCur[index] != 0 && maxChargingCur[index] <= *cur)
  3025. *cur = maxChargingCur[index];
  3026. if (((_chargingData[index]->SystemStatus >= S_PREPARING_FOR_EVSE && _chargingData[index]->SystemStatus <= S_CHARGING) ||
  3027. (_chargingData[index]->SystemStatus >= S_CCS_PRECHARGE_ST0 && _chargingData[index]->SystemStatus <= S_CCS_PRECHARGE_ST1)) &&
  3028. _chargingData[index]->ChargingProfileCurrent >= 0 &&
  3029. _chargingData[index]->ChargingProfileCurrent <= *cur)
  3030. {
  3031. *cur = _chargingData[index]->ChargingProfileCurrent;
  3032. }
  3033. }
  3034. void GetMaxPowerMethod(byte index, float *pow)
  3035. {
  3036. if (maxChargingPow != 0 && maxChargingPow <= *pow)
  3037. *pow = maxChargingPow;
  3038. if (((_chargingData[index]->SystemStatus >= S_PREPARING_FOR_EVSE && _chargingData[index]->SystemStatus <= S_CHARGING) ||
  3039. (_chargingData[index]->SystemStatus >= S_CCS_PRECHARGE_ST0 && _chargingData[index]->SystemStatus <= S_CCS_PRECHARGE_ST1)) &&
  3040. _chargingData[index]->ChargingProfilePower >= 0 &&
  3041. _chargingData[index]->ChargingProfilePower <= *pow)
  3042. {
  3043. *pow = _chargingData[index]->ChargingProfilePower;
  3044. }
  3045. }
  3046. time_t GetRtcInfoForEpoch()
  3047. {
  3048. struct timeb csuTime;
  3049. struct tm *tmCSU;
  3050. struct tm t;
  3051. time_t result;
  3052. ftime(&csuTime);
  3053. tmCSU = localtime(&csuTime.time);
  3054. t.tm_year = tmCSU->tm_year;
  3055. t.tm_mon = tmCSU->tm_mon;
  3056. t.tm_mday = tmCSU->tm_mday;
  3057. t.tm_hour = tmCSU->tm_hour;
  3058. t.tm_min = tmCSU->tm_min;
  3059. t.tm_sec = tmCSU->tm_sec;
  3060. t.tm_isdst = -1;
  3061. result = mktime(&t);
  3062. return result;
  3063. }
  3064. byte GetStopChargingReasonByEvse(byte gunIndex, byte *reason)
  3065. {
  3066. byte result = NO;
  3067. if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip == 0x01)
  3068. {
  3069. // 012251
  3070. *(reason + 5) = 0;
  3071. *(reason + 4) = 1;
  3072. *(reason + 3) = 2;
  3073. *(reason + 2) = 2;
  3074. *(reason + 1) = 5;
  3075. *(reason + 0) = 1;
  3076. result = YES;
  3077. }
  3078. if (_chargingData[gunIndex]->Type == _Type_Chademo)
  3079. {
  3080. if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault == YES)
  3081. {
  3082. // 011012
  3083. *(reason + 5) = 0;
  3084. *(reason + 4) = 1;
  3085. *(reason + 3) = 1;
  3086. *(reason + 2) = 0;
  3087. *(reason + 1) = 1;
  3088. *(reason + 0) = 2;
  3089. result = YES;
  3090. }
  3091. else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.ChademoOutputUVPFail == YES)
  3092. {
  3093. // 012289
  3094. *(reason + 5) = 0;
  3095. *(reason + 4) = 1;
  3096. *(reason + 3) = 2;
  3097. *(reason + 2) = 2;
  3098. *(reason + 1) = 8;
  3099. *(reason + 0) = 9;
  3100. result = YES;
  3101. }
  3102. else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.ChademoGfdTrip == YES)
  3103. {
  3104. // 012234
  3105. *(reason + 5) = 0;
  3106. *(reason + 4) = 1;
  3107. *(reason + 3) = 2;
  3108. *(reason + 2) = 2;
  3109. *(reason + 1) = 3;
  3110. *(reason + 0) = 4;
  3111. result = YES;
  3112. }
  3113. }
  3114. else if (_chargingData[gunIndex]->Type == _Type_GB)
  3115. {
  3116. if (ShmStatusCodeData->FaultCode.FaultEvents.bits.ChademoOutputRelayDrivingFault == YES)
  3117. {
  3118. // 012290
  3119. *(reason + 5) = 0;
  3120. *(reason + 4) = 1;
  3121. *(reason + 3) = 2;
  3122. *(reason + 2) = 2;
  3123. *(reason + 1) = 9;
  3124. *(reason + 0) = 0;
  3125. result = YES;
  3126. }
  3127. else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.GbGfdTrip == YES)
  3128. {
  3129. // 012236
  3130. *(reason + 5) = 0;
  3131. *(reason + 4) = 1;
  3132. *(reason + 3) = 2;
  3133. *(reason + 2) = 2;
  3134. *(reason + 1) = 3;
  3135. *(reason + 0) = 6;
  3136. result = YES;
  3137. }
  3138. }
  3139. else if (_chargingData[gunIndex]->Type == _Type_CCS_2)
  3140. {
  3141. if (ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsOutputRelayDrivingFault == YES)
  3142. {
  3143. // 011014
  3144. *(reason + 5) = 0;
  3145. *(reason + 4) = 1;
  3146. *(reason + 3) = 1;
  3147. *(reason + 2) = 0;
  3148. *(reason + 1) = 1;
  3149. *(reason + 0) = 4;
  3150. result = YES;
  3151. }
  3152. else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsOutputUVPFail == YES)
  3153. {
  3154. // 012288
  3155. *(reason + 5) = 0;
  3156. *(reason + 4) = 1;
  3157. *(reason + 3) = 2;
  3158. *(reason + 2) = 2;
  3159. *(reason + 1) = 8;
  3160. *(reason + 0) = 8;
  3161. result = YES;
  3162. }
  3163. else if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsGfdTrip == YES)
  3164. {
  3165. // 012235
  3166. *(reason + 5) = 0;
  3167. *(reason + 4) = 1;
  3168. *(reason + 3) = 2;
  3169. *(reason + 2) = 2;
  3170. *(reason + 1) = 3;
  3171. *(reason + 0) = 5;
  3172. result = YES;
  3173. }
  3174. }
  3175. return result;
  3176. }
  3177. void SendCommunicationOnly(byte index)
  3178. {
  3179. SetChargingPermission(index, COMMUNICATION,
  3180. _chargingData[index]->AvailableChargingPower,
  3181. 0,
  3182. 0,
  3183. _chargingData[index]->Evboard_id);
  3184. }
  3185. void SendStopOnly(byte index)
  3186. {
  3187. SetChargingPermission(index, STOP,
  3188. _chargingData[index]->AvailableChargingPower,
  3189. 0,
  3190. 0,
  3191. _chargingData[index]->Evboard_id);
  3192. }
  3193. void FormatVoltageAndCurrent()
  3194. {
  3195. char isLowCur = 0x00;
  3196. char EvsePower[2];
  3197. EvsePower[2] = '\0';
  3198. if (strlen((char *) ShmSysConfigAndInfo->SysConfig.ModelName) >= 6)
  3199. {
  3200. strncpy(EvsePower, (char *)(ShmSysConfigAndInfo->SysConfig.ModelName + 4), 2);
  3201. if (strcmp(EvsePower, "30") == EQUAL)
  3202. {
  3203. isLowCur = 0x00;
  3204. }
  3205. else if (strcmp(EvsePower, "60") == EQUAL)
  3206. {
  3207. isLowCur = 0x01;
  3208. }
  3209. else
  3210. {
  3211. isLowCur = 0x02;
  3212. }
  3213. }
  3214. for (byte _index = 0; _index < gun_count; _index++)
  3215. {
  3216. if (_chargingData[_index]->Type == _Type_Chademo)
  3217. {
  3218. maxChargingVol[_index] = chademoVol;
  3219. }
  3220. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3221. {
  3222. maxChargingVol[_index] = ccsVol;
  3223. }
  3224. else if (_chargingData[_index]->Type == _Type_GB)
  3225. {
  3226. maxChargingVol[_index] = gbVol;
  3227. }
  3228. if (isLowCur == 0x00)
  3229. {
  3230. if (_chargingData[_index]->Type == _Type_Chademo)
  3231. {
  3232. maxChargingCur[_index] = 600;
  3233. }
  3234. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3235. {
  3236. maxChargingCur[_index] = 600;
  3237. }
  3238. else if (_chargingData[_index]->Type == _Type_GB)
  3239. {
  3240. maxChargingCur[_index] = 800;
  3241. }
  3242. }
  3243. else if (isLowCur == 0x01)
  3244. {
  3245. if (_chargingData[_index]->Type == _Type_Chademo)
  3246. {
  3247. maxChargingCur[_index] = 1200;
  3248. }
  3249. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3250. {
  3251. maxChargingCur[_index] = 1200;
  3252. }
  3253. else if (_chargingData[_index]->Type == _Type_GB)
  3254. {
  3255. maxChargingCur[_index] = 1200;
  3256. }
  3257. }
  3258. else
  3259. {
  3260. if (_chargingData[_index]->Type == _Type_Chademo)
  3261. {
  3262. maxChargingCur[_index] = 1200;
  3263. }
  3264. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3265. {
  3266. maxChargingCur[_index] = 2000;
  3267. }
  3268. else if (_chargingData[_index]->Type == _Type_GB)
  3269. {
  3270. maxChargingCur[_index] = 2500;
  3271. }
  3272. }
  3273. }
  3274. }
  3275. int main(int argc, char *argv[])
  3276. {
  3277. if(InitShareMemory() == FAIL)
  3278. {
  3279. #ifdef SystemLogMessage
  3280. DEBUG_ERROR("InitShareMemory NG\n");
  3281. #endif
  3282. if(ShmStatusCodeData != NULL)
  3283. {
  3284. ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
  3285. }
  3286. sleep(5);
  3287. return 0;
  3288. }
  3289. gun_count = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
  3290. Initialization();
  3291. // 根據輸出能量與槍別給予當前最大耐壓耐流
  3292. FormatVoltageAndCurrent();
  3293. CanFd = InitCanBus();
  3294. CANReceiver();
  3295. byte priorityLow = 1;
  3296. time_t rtc = GetRtcInfoForEpoch();
  3297. for (byte _index = 0; _index < gun_count; _index++)
  3298. {
  3299. if (_chargingData[_index]->Type == _Type_Chademo)
  3300. {
  3301. PRINTF_FUNC("Conn %d (Chademo), MaxVol = %f, MaxCur = %f \n",
  3302. _index, maxChargingVol[_index], maxChargingCur[_index]);
  3303. }
  3304. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3305. {
  3306. PRINTF_FUNC("Conn %d (CCS), MaxVol = %f, MaxCur = %f \n",
  3307. _index, maxChargingVol[_index], maxChargingCur[_index]);
  3308. }
  3309. else if (_chargingData[_index]->Type == _Type_GB)
  3310. {
  3311. PRINTF_FUNC("Conn %d (GBT), MaxVol = %f, MaxCur = %f \n",
  3312. _index, maxChargingVol[_index], maxChargingCur[_index]);
  3313. }
  3314. }
  3315. while(CanFd)
  3316. {
  3317. for(byte _index = 0; _index < gun_count; _index++)
  3318. {
  3319. if (priorityLow == 1)
  3320. {
  3321. // 優先權較低 - 只要有回應即不會再詢問
  3322. if (_chargingData[_index]->Type == _Type_Chademo &&
  3323. ShmCHAdeMOData->evse[_chargingData[_index]->type_index].SelfTest_Comp != PASS)
  3324. {
  3325. SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
  3326. GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
  3327. }
  3328. else if (_chargingData[_index]->Type == _Type_GB &&
  3329. ShmGBTData->evse[_chargingData[_index]->type_index].SelfTest_Comp != PASS)
  3330. {
  3331. SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
  3332. GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
  3333. }
  3334. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3335. {
  3336. if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121 &&
  3337. ShmCcsData->V2GMessage_DIN70121[_chargingData[_index]->type_index].SelfTest_Comp != PASS)
  3338. {
  3339. SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
  3340. GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
  3341. }
  3342. }
  3343. // 固定要取得的資訊 : 1.槍鎖狀態, 2."Connector 1" 溫度, 3."Connector 2" 溫度, 4.Pilot Voltage
  3344. //PRINTF_FUNC("GetMiscellaneousInfo. index = %d, Eid = %d \n", _index, _chargingData[_index]->Evboard_id);
  3345. GetMiscellaneousInfo(_index,
  3346. _chargingData[_index]->RelayK1K2Status,
  3347. _chargingData[_index]->PresentChargedEnergy,
  3348. (_chargingData[_index]->PresentChargingVoltage * 10),
  3349. _chargingData[_index]->Evboard_id);
  3350. }
  3351. switch (_chargingData[_index]->SystemStatus)
  3352. {
  3353. case S_IDLE:
  3354. case S_RESERVATION:
  3355. if (_chargingData[_index]->Type == _Type_Chademo)
  3356. {
  3357. ClearAbnormalStatus_Chademo(_index);
  3358. if (ShmSysConfigAndInfo->SysInfo.PageIndex == _LCM_WAIT_FOR_PLUG)
  3359. {
  3360. if (!chkChademoPermission[_index])
  3361. {
  3362. chkChademoPermission[_index] = true;
  3363. gettimeofday(&_chk_chademo_permission_timeout[_index], NULL);
  3364. SendCommunicationOnly(_index);
  3365. }
  3366. else
  3367. {
  3368. if (GetTimeoutValue(_chk_chademo_permission_timeout[_index]) / 1000 > 10000)
  3369. {
  3370. SendCommunicationOnly(_index);
  3371. gettimeofday(&_chk_chademo_permission_timeout[_index], NULL);
  3372. }
  3373. }
  3374. }
  3375. else if (chkChademoPermission[_index])
  3376. {
  3377. chkChademoPermission[_index] = false;
  3378. SendStopOnly(_index);
  3379. }
  3380. }
  3381. else if (_chargingData[_index]->Type == _Type_GB)
  3382. {
  3383. ClearAbnormalStatus_GB(_index);
  3384. }
  3385. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3386. {
  3387. ClearAbnormalStatus_CCS(_index);
  3388. }
  3389. if (priorityLow == 1)
  3390. {
  3391. _chargingData[_index]->PresentChargedEnergy = 0;
  3392. _chargingData[_index]->PresentChargingPower = 0;
  3393. _chargingData[_index]->GroundFaultStatus = GFD_WAIT;
  3394. _chargingData[_index]->RealRatingPower = 0;
  3395. _chargingData[_index]->StopChargeFlag = NO;
  3396. _chargingData[_index]->UnKnowStopChargeFlag = NO;
  3397. _chargingData[_index]->ChargingFee = 0.0;
  3398. _chargingData[_index]->EvBatterySoc = 0;
  3399. _chargingData[_index]->EvBatteryStartSoc = 0;
  3400. _chargingData[_index]->EvBatteryMaxVoltage = 0;
  3401. _chargingData[_index]->ChargingProfilePower = -1;
  3402. _chargingData[_index]->ChargingProfileCurrent = -1;
  3403. if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX)
  3404. {
  3405. _chargingData[_index]->PresentChargingVoltage = 0;
  3406. _chargingData[_index]->PresentChargingCurrent = 0;
  3407. }
  3408. chargingTime[_index] = 0;
  3409. SendErrorCount[_index] = 0;
  3410. //maxChargingPow = ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10;
  3411. // ShmPsuData->SystemAvailablePower 已是 * 10
  3412. maxChargingPow = ShmPsuData->SystemAvailablePower;
  3413. if (ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10 != 0 &&
  3414. ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10 < maxChargingPow)
  3415. maxChargingPow = ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10;
  3416. LogInfo[_index][EV_LOG_EVSE_MAX_VOL] = 0;
  3417. LogInfo[_index][EV_LOG_EVSE_MAX_CUR] = 0;
  3418. LogInfo[_index][EV_LOG_MAX_BATT_VOL] = 0;
  3419. LogInfo[_index][EV_LOG_REAL_CAP_POW] = 0;
  3420. LogInfo[_index][EV_LOG_SOC] = 0;
  3421. }
  3422. break;
  3423. case S_PREPARNING:
  3424. {
  3425. chkChademoPermission[_index] = false;
  3426. // 設定當前輸出
  3427. if (gun_count == 1)
  3428. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3429. else if (gun_count == 2)
  3430. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3431. _chargingData[_index]->PowerConsumption = 0;
  3432. }
  3433. break;
  3434. case S_PREPARING_FOR_EV:
  3435. {
  3436. // 開始確認車端是否同意開始充電 : 1.SOC, 2.Target Vol, 3.Target Cur, 4.Charging remaining time
  3437. GetOutputReq(_index, _chargingData[_index]->Evboard_id);
  3438. // 設定當前輸出
  3439. if (gun_count == 1)
  3440. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3441. else if (gun_count == 2)
  3442. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3443. if (priorityLow == 1)
  3444. {
  3445. float maxVol, maxCur;
  3446. // 樁端輸出能力
  3447. maxVol = _chargingData[_index]->MaximumChargingVoltage;
  3448. maxCur = _chargingData[_index]->AvailableChargingCurrent;
  3449. GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
  3450. if (LogInfo[_index][EV_LOG_EVSE_MAX_VOL] != maxVol ||
  3451. LogInfo[_index][EV_LOG_EVSE_MAX_CUR] != maxCur)
  3452. {
  3453. LogInfo[_index][EV_LOG_EVSE_MAX_VOL] = maxVol;
  3454. LogInfo[_index][EV_LOG_EVSE_MAX_CUR] = maxCur;
  3455. PRINTF_FUNC("To EV_%d Max_Vol = %.1f, Cap_Cur = %.1f, Cap_Pow = %.1f \n",
  3456. _index, maxVol / 10, maxCur / 10, _chargingData[_index]->AvailableChargingPower / 10);
  3457. }
  3458. _chargingData[_index]->RealMaxVoltage = maxVol;
  3459. SetChargingPermission(_index, START,
  3460. _chargingData[_index]->AvailableChargingPower,
  3461. maxCur,
  3462. maxVol,
  3463. _chargingData[_index]->Evboard_id);
  3464. // 取得車端電池資訊 : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
  3465. GetEvBatteryInfo(_index, _chargingData[_index]->Evboard_id);
  3466. }
  3467. gettimeofday(&_chk_ratingPower_timeout[_index], NULL);
  3468. }
  3469. break;
  3470. case S_PREPARING_FOR_EVSE:
  3471. case S_CCS_PRECHARGE_ST0:
  3472. case S_CCS_PRECHARGE_ST1:
  3473. {
  3474. // 開始確認車端是否同意開始充電
  3475. GetOutputReq(_index, _chargingData[_index]->Evboard_id);
  3476. // 設定當前輸出
  3477. if (gun_count == 1)
  3478. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3479. else if (gun_count == 2)
  3480. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3481. if (priorityLow % 5 == 1)
  3482. {
  3483. // 樁端輸出能力改變
  3484. if (gun_count == 1)
  3485. SetPresentChargingOutputCap(_chargingData[0], _chargingData[0]);
  3486. else if (gun_count == 2)
  3487. SetPresentChargingOutputCap(_chargingData[0], _chargingData[1]);
  3488. }
  3489. if (LogInfo[_index][EV_LOG_MAX_BATT_VOL] != _chargingData[_index]->EvBatteryMaxVoltage)
  3490. {
  3491. LogInfo[_index][EV_LOG_MAX_BATT_VOL] = _chargingData[_index]->EvBatteryMaxVoltage;
  3492. PRINTF_FUNC("index = %d, Ev Maximum Battery Voltage = %f \n", _index, _chargingData[_index]->EvBatteryMaxVoltage);
  3493. }
  3494. if (LogInfo[_index][EV_LOG_SOC] != _chargingData[_index]->EvBatterySoc)
  3495. {
  3496. LogInfo[_index][EV_LOG_SOC] = _chargingData[_index]->EvBatterySoc;
  3497. PRINTF_FUNC("index = %d, SOC = %d \n", _index, _chargingData[_index]->EvBatterySoc);
  3498. }
  3499. // 持續通知 Isolation 測試狀態
  3500. if (priorityLow == 1)
  3501. {
  3502. // 拉 500 V 如果在一秒鐘內 GFD 都符合則 PASS
  3503. // if (_chargingData[_index]->FireChargingVoltage >= 3500)
  3504. // _chargingData[_index]->GroundFaultStatus = GFD_PASS;
  3505. //PRINTF_FUNC("To EV_%d GFD = %d \n", _index, _chargingData[_index]->GroundFaultStatus);
  3506. //if(_chargingData[_index]->GroundFaultStatus != GFD_WAIT)
  3507. {
  3508. //if ((GetTimeoutValue(_derating_time) / 1000) > 1000)
  3509. unsigned char _result = _chargingData[_index]->GroundFaultStatus;
  3510. // GB & Chademo ~ Warning 也先算 Pass,因為 CCS 認證會驗 Warning 故不可更動
  3511. if(_chargingData[_index]->Type == _Type_Chademo ||
  3512. _chargingData[_index]->Type == _Type_GB)
  3513. {
  3514. if (_result == GFD_WARNING)
  3515. {
  3516. _result = GFD_PASS;
  3517. }
  3518. }
  3519. if (_result == GFD_WARNING || _result == GFD_PASS)
  3520. {
  3521. if (((GetTimeoutValue(_chk_ratingPower_timeout[_index]) / 1000) > 12000 &&
  3522. _chargingData[_index]->RealRatingPower > 0) ||
  3523. (GetTimeoutValue(_chk_ratingPower_timeout[_index]) / 1000) > 14000)
  3524. {
  3525. if (LogInfo[_index][EV_LOG_REAL_CAP_POW] != _chargingData[_index]->RealRatingPower)
  3526. {
  3527. LogInfo[_index][EV_LOG_REAL_CAP_POW] = _chargingData[_index]->RealRatingPower;
  3528. PRINTF_FUNC("Conn %d, RealRatingPower = %d \n",
  3529. _index, _chargingData[_index]->RealRatingPower);
  3530. }
  3531. }
  3532. else
  3533. _result = GFD_WAIT;
  3534. }
  3535. SetIsolationStatus(_index, _result, _chargingData[_index]->Evboard_id);
  3536. }
  3537. if(_chargingData[_index]->SystemStatus == S_CCS_PRECHARGE_ST0 &&
  3538. _chargingData[_index]->PrechargeStatus == PRECHARGE_READY)
  3539. {
  3540. SetEvsePrechargeInfo(_index, PRECHARGE_PRERELAY_PASS, _chargingData[_index]->Evboard_id);
  3541. }
  3542. }
  3543. }
  3544. break;
  3545. case S_CHARGING:
  3546. {
  3547. // 計算 Power
  3548. _chargingData[_index]->PresentChargingPower = ((float)((_chargingData[_index]->PresentChargingVoltage) * (_chargingData[_index]->PresentChargingCurrent)) / 1000);
  3549. if (chargingTime[_index] == 0 ||
  3550. chargingTime[_index] > _chargingData[_index]->PresentChargedDuration)
  3551. {
  3552. chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
  3553. }
  3554. else
  3555. {
  3556. int passTime = _chargingData[_index]->PresentChargedDuration - chargingTime[_index];
  3557. if (passTime > 0)
  3558. {
  3559. float changingPow = (_chargingData[_index]->PresentChargingPower) * passTime / 3600;
  3560. if (ShmSysConfigAndInfo->SysConfig.BillingData.isBilling)
  3561. {
  3562. _chargingData[_index]->ChargingFee += changingPow * ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee;
  3563. }
  3564. _chargingData[_index]->PresentChargedEnergy += changingPow;
  3565. _chargingData[_index]->PowerConsumption += changingPow;
  3566. chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
  3567. }
  3568. }
  3569. // 開始確認車端是否同意開始充電
  3570. GetOutputReq(_index, _chargingData[_index]->Evboard_id);
  3571. if (LogInfo[_index][EV_LOG_MAX_BATT_VOL] != _chargingData[_index]->EvBatteryMaxVoltage)
  3572. {
  3573. LogInfo[_index][EV_LOG_MAX_BATT_VOL] = _chargingData[_index]->EvBatteryMaxVoltage;
  3574. PRINTF_FUNC("index = %d, Ev Maximum Battery Voltage = %f \n", _index, _chargingData[_index]->EvBatteryMaxVoltage);
  3575. }
  3576. if (LogInfo[_index][EV_LOG_SOC] != _chargingData[_index]->EvBatterySoc)
  3577. {
  3578. LogInfo[_index][EV_LOG_SOC] = _chargingData[_index]->EvBatterySoc;
  3579. PRINTF_FUNC("index = %d, SOC = %d \n", _index, _chargingData[_index]->EvBatterySoc);
  3580. }
  3581. // 設定當前輸出
  3582. if (gun_count == 1)
  3583. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3584. else if (gun_count == 2)
  3585. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3586. // for test end
  3587. if (priorityLow % 5 == 0)
  3588. {
  3589. // 樁端輸出能力改變
  3590. if (gun_count == 1)
  3591. SetPresentChargingOutputCap(_chargingData[0], _chargingData[0]);
  3592. else if (gun_count == 2)
  3593. SetPresentChargingOutputCap(_chargingData[0], _chargingData[1]);
  3594. }
  3595. if(_chargingData[_index]->GroundFaultStatus == GFD_FAIL)
  3596. {
  3597. SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
  3598. }
  3599. else if(_chargingData[_index]->Type == _Type_CCS_2)
  3600. {
  3601. SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
  3602. }
  3603. // GFD 失敗再通知
  3604. if (priorityLow == 1)
  3605. {
  3606. if(_chargingData[_index]->Type == _Type_CCS_2 &&
  3607. _chargingData[_index]->PrechargeStatus == PRECHARGE_READY)
  3608. {
  3609. SetEvsePrechargeInfo(_index, PRECHARGE_CHARELAY_PASS, _chargingData[_index]->Evboard_id);
  3610. }
  3611. }
  3612. }
  3613. break;
  3614. case S_ALARM:
  3615. case S_TERMINATING:
  3616. {
  3617. // 設定當前輸出
  3618. if (gun_count == 1)
  3619. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3620. else if (gun_count == 2)
  3621. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3622. // 槍鎖還在,則代表是樁端要求的停止
  3623. if (SendErrorCount[_index] < 3 &&
  3624. (_chargingData[_index]->GunLocked == START ||
  3625. _chargingData[_index]->Type == _Type_CCS_2))
  3626. {
  3627. byte normalStop = 0x01;
  3628. byte stopReason[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  3629. if (GetStopChargingReasonByEvse(_index, stopReason))
  3630. {
  3631. normalStop = 0x02;
  3632. }
  3633. EvseStopChargingEvent(normalStop, stopReason, _chargingData[_index]->Evboard_id);
  3634. SendErrorCount[_index] += 1;
  3635. }
  3636. if(_chargingData[_index]->Type == _Type_CCS_2)
  3637. {
  3638. SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
  3639. }
  3640. GetOutputReq(_index, _chargingData[_index]->Evboard_id);
  3641. if (_chargingData[_index]->SystemStatus == S_ALARM)
  3642. {
  3643. if (priorityLow == 1)
  3644. {
  3645. float maxVol, maxCur;
  3646. // 樁端輸出能力
  3647. maxVol = _chargingData[_index]->MaximumChargingVoltage;
  3648. maxCur = _chargingData[_index]->AvailableChargingCurrent;
  3649. GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
  3650. SetChargingPermission(_index, STOP,
  3651. _chargingData[_index]->AvailableChargingPower,
  3652. maxCur,
  3653. maxVol,
  3654. _chargingData[_index]->Evboard_id);
  3655. }
  3656. }
  3657. }
  3658. break;
  3659. case S_COMPLETE:
  3660. {
  3661. // 設定當前輸出
  3662. if (gun_count == 1)
  3663. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3664. else if (gun_count == 2)
  3665. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3666. if (priorityLow == 1)
  3667. {
  3668. float maxVol, maxCur;
  3669. // 樁端輸出能力
  3670. maxVol = _chargingData[_index]->MaximumChargingVoltage;
  3671. maxCur = _chargingData[_index]->AvailableChargingCurrent;
  3672. GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
  3673. SetChargingPermission(_index, STOP,
  3674. _chargingData[_index]->AvailableChargingPower,
  3675. maxCur,
  3676. maxVol,
  3677. _chargingData[_index]->Evboard_id);
  3678. }
  3679. }
  3680. break;
  3681. }
  3682. }
  3683. priorityLow >= 20 ? priorityLow = 1 : priorityLow++;
  3684. usleep(45000); //EV 小板通訊 (50 ms)
  3685. }
  3686. DEBUG_INFO("Module_EvComm : Can-bus port = %d \n", CanFd);
  3687. return FAIL;
  3688. }