Module_EvComm.c 188 KB

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