Module_EvComm.c 184 KB

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