Module_EvComm.c 184 KB

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