Module_EvComm.c 171 KB

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