Module_EvComm.c 187 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183
  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)
  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. while(CanFd)
  3518. {
  3519. for(byte _index = 0; _index < gun_count; _index++)
  3520. {
  3521. byte targetID = _chargingData[_index]->Evboard_id;
  3522. if (gun_count == 1 &&
  3523. _chargingData[_index]->Type == _Type_CCS_2 &&
  3524. ShmDcCommonData->CcsVersion == _CCS_VERSION_CHECK_TAG_V015S0)
  3525. {
  3526. targetID += 1;
  3527. }
  3528. if (priorityLow == 1)
  3529. {
  3530. // 優先權較低 - 只要有回應即不會再詢問
  3531. if (_chargingData[_index]->Type == _Type_Chademo &&
  3532. ShmCHAdeMOData->evse[_chargingData[_index]->type_index].SelfTest_Comp != PASS)
  3533. {
  3534. SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
  3535. GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
  3536. }
  3537. else if (_chargingData[_index]->Type == _Type_GB &&
  3538. ShmGBTData->evse[_chargingData[_index]->type_index].SelfTest_Comp != PASS)
  3539. {
  3540. SyncRtcInfo(_index, _chargingData[_index]->Evboard_id, (int)rtc);
  3541. GetFirmwareVersion(_index, _chargingData[_index]->Evboard_id);
  3542. }
  3543. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3544. {
  3545. if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121 &&
  3546. ShmCcsData->V2GMessage_DIN70121[_chargingData[_index]->type_index].SelfTest_Comp != PASS)
  3547. {
  3548. SyncRtcInfo(_index, targetID, (int)rtc);
  3549. GetFirmwareVersion(_index, targetID);
  3550. }
  3551. }
  3552. // 固定要取得的資訊 : 1.槍鎖狀態, 2."Connector 1" 溫度, 3."Connector 2" 溫度, 4.Pilot Voltage
  3553. //PRINTF_FUNC("GetMiscellaneousInfo. index = %d, Eid = %d \n", _index, _chargingData[_index]->Evboard_id);
  3554. GetMiscellaneousInfo(_index,
  3555. _chargingData[_index]->RelayK1K2Status,
  3556. _chargingData[_index]->PresentChargedEnergy,
  3557. (_chargingData[_index]->PresentChargingVoltage * 10),
  3558. targetID);
  3559. bool isOTP = false;
  3560. if (_chargingData[_index]->Type == _Type_Chademo)
  3561. {
  3562. if (ShmDcCommonData->ConnectErrList[_index].GunBits.ChaConnectOTP)
  3563. isOTP = true;
  3564. else
  3565. isOTP = false;
  3566. }
  3567. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3568. {
  3569. if (ShmDcCommonData->ConnectErrList[_index].GunBits.CCSConnectOTP)
  3570. isOTP = true;
  3571. else
  3572. isOTP = false;
  3573. }
  3574. else if (_chargingData[_index]->Type == _Type_GB)
  3575. {
  3576. if (ShmDcCommonData->ConnectErrList[_index].GunBits.GBTConnectOTP)
  3577. isOTP = true;
  3578. else
  3579. isOTP = false;
  3580. }
  3581. if (isOTP)
  3582. {
  3583. if (gunTempAllowCount[_index] >= 2)
  3584. _chargingData[_index]->StopChargeFlag = YES;
  3585. else
  3586. gunTempAllowCount[_index] += 1;
  3587. }
  3588. else
  3589. gunTempAllowCount[_index] = 0;
  3590. }
  3591. switch (_chargingData[_index]->SystemStatus)
  3592. {
  3593. case S_IDLE:
  3594. case S_RESERVATION:
  3595. if (_chargingData[_index]->Type == _Type_Chademo)
  3596. {
  3597. ClearAbnormalStatus_Chademo(_index);
  3598. if (ShmSysConfigAndInfo->SysInfo.PageIndex == _LCM_WAIT_FOR_PLUG)
  3599. {
  3600. if (!chkChademoPermission[_index])
  3601. {
  3602. chkChademoPermission[_index] = true;
  3603. gettimeofday(&_chk_chademo_permission_timeout[_index], NULL);
  3604. SendCommunicationOnly(_index);
  3605. }
  3606. else
  3607. {
  3608. if (GetTimeoutValue(_chk_chademo_permission_timeout[_index]) / 1000 > 10000)
  3609. {
  3610. SendCommunicationOnly(_index);
  3611. gettimeofday(&_chk_chademo_permission_timeout[_index], NULL);
  3612. }
  3613. }
  3614. }
  3615. else if (chkChademoPermission[_index])
  3616. {
  3617. chkChademoPermission[_index] = false;
  3618. SendStopOnly(_index);
  3619. }
  3620. if (ShmDcCommonData->ConnectErrList[_index].GunBits.ChaConnectOTP == NO)
  3621. _chargingData[_index]->StopChargeFlag = NO;
  3622. }
  3623. else if (_chargingData[_index]->Type == _Type_GB)
  3624. {
  3625. ClearAbnormalStatus_GB(_index);
  3626. if (ShmDcCommonData->ConnectErrList[_index].GunBits.GBTConnectOTP == NO)
  3627. _chargingData[_index]->StopChargeFlag = NO;
  3628. }
  3629. else if (_chargingData[_index]->Type == _Type_CCS_2)
  3630. {
  3631. ClearAbnormalStatus_CCS(_index);
  3632. if (ShmDcCommonData->ConnectErrList[_index].GunBits.CCSConnectOTP == NO)
  3633. _chargingData[_index]->StopChargeFlag = NO;
  3634. }
  3635. if (priorityLow == 1)
  3636. {
  3637. _chargingData[_index]->PresentChargedEnergy = 0;
  3638. _chargingData[_index]->PresentChargingPower = 0;
  3639. _chargingData[_index]->GroundFaultStatus = GFD_WAIT;
  3640. _chargingData[_index]->RealRatingPower = 0;
  3641. _chargingData[_index]->NormalStopChargeFlag = NO;
  3642. _chargingData[_index]->ChargingFee = 0.0;
  3643. _chargingData[_index]->EvBatterySoc = 0;
  3644. _chargingData[_index]->EvBatteryStartSoc = 0;
  3645. _chargingData[_index]->EvBatteryMaxVoltage = 0;
  3646. _chargingData[_index]->ChargingProfilePower = -1;
  3647. _chargingData[_index]->ChargingProfileCurrent = -1;
  3648. curAllowCount[_index] = 0;
  3649. if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX)
  3650. {
  3651. _chargingData[_index]->PresentChargingVoltage = 0;
  3652. _chargingData[_index]->PresentChargingCurrent = 0;
  3653. }
  3654. chargingTime[_index] = 0;
  3655. SendErrorCount[_index] = 0;
  3656. // 使用 Meter 狀況
  3657. if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M' ||
  3658. ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'L')
  3659. {
  3660. if (ShmCsuMeterData->_meter[_index].isCalculation == NO)
  3661. {
  3662. if (ShmCsuMeterData->_meter[_index].curMeterValue != 0 ||
  3663. ShmCsuMeterData->_meter[_index]._chargingValue != 0 ||
  3664. ShmCsuMeterData->_meter[_index]._curTotalCharging != 0 )
  3665. {
  3666. ShmCsuMeterData->_meter[_index].curMeterValue = 0;
  3667. ShmCsuMeterData->_meter[_index]._chargingValue = 0;
  3668. ShmCsuMeterData->_meter[_index]._curTotalCharging = 0;
  3669. }
  3670. }
  3671. }
  3672. //maxChargingPow = ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10;
  3673. // ShmPsuData->SystemAvailablePower 已是 * 10
  3674. maxChargingPow = ShmPsuData->SystemAvailablePower;
  3675. if (ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10 != 0 &&
  3676. ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10 < maxChargingPow)
  3677. maxChargingPow = ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10;
  3678. LogInfo[_index][EV_LOG_EVSE_MAX_VOL] = 0;
  3679. LogInfo[_index][EV_LOG_EVSE_MAX_CUR] = 0;
  3680. LogInfo[_index][EV_LOG_MAX_BATT_VOL] = 0;
  3681. LogInfo[_index][EV_LOG_REAL_CAP_POW] = 0;
  3682. LogInfo[_index][EV_LOG_SOC] = 0;
  3683. if (gun_count == 1)
  3684. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3685. else if (gun_count == 2)
  3686. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3687. }
  3688. break;
  3689. case S_PREPARNING:
  3690. {
  3691. chkChademoPermission[_index] = false;
  3692. // 設定當前輸出
  3693. if (gun_count == 1)
  3694. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3695. else if (gun_count == 2)
  3696. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3697. }
  3698. break;
  3699. case S_PREPARING_FOR_EV:
  3700. {
  3701. if (ShmDcCommonData->startTransationFlag[_index] == START_TRANSATION_STATUS_WAIT)
  3702. continue;
  3703. // 開始確認車端是否同意開始充電 : 1.SOC, 2.Target Vol, 3.Target Cur, 4.Charging remaining time
  3704. GetOutputReq(_index, targetID);
  3705. // 設定當前輸出
  3706. if (gun_count == 1)
  3707. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3708. else if (gun_count == 2)
  3709. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3710. if (priorityLow == 1)
  3711. {
  3712. float maxVol, maxCur;
  3713. // 樁端輸出能力
  3714. maxVol = _chargingData[_index]->MaximumChargingVoltage;
  3715. maxCur = _chargingData[_index]->AvailableChargingCurrent;
  3716. GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
  3717. if (LogInfo[_index][EV_LOG_EVSE_MAX_VOL] != maxVol ||
  3718. LogInfo[_index][EV_LOG_EVSE_MAX_CUR] != maxCur)
  3719. {
  3720. LogInfo[_index][EV_LOG_EVSE_MAX_VOL] = maxVol;
  3721. LogInfo[_index][EV_LOG_EVSE_MAX_CUR] = maxCur;
  3722. PRINTF_FUNC("To EV_%d Max_Vol = %.1f, Cap_Cur = %.1f, Cap_Pow = %.1f \n",
  3723. _index, maxVol / 10, maxCur / 10, _chargingData[_index]->AvailableChargingPower / 10);
  3724. }
  3725. _chargingData[_index]->RealMaxVoltage = maxVol;
  3726. SetChargingPermission(_index, START,
  3727. _chargingData[_index]->AvailableChargingPower,
  3728. maxCur,
  3729. maxVol,
  3730. targetID);
  3731. // 取得車端電池資訊 : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
  3732. GetEvBatteryInfo(_index, targetID);
  3733. }
  3734. gettimeofday(&_chk_ratingPower_timeout[_index], NULL);
  3735. }
  3736. break;
  3737. case S_PREPARING_FOR_EVSE:
  3738. case S_CCS_PRECHARGE_ST0:
  3739. case S_CCS_PRECHARGE_ST1:
  3740. {
  3741. // 開始確認車端是否同意開始充電
  3742. GetOutputReq(_index, targetID);
  3743. // 設定當前輸出
  3744. if (gun_count == 1)
  3745. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3746. else if (gun_count == 2)
  3747. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3748. if (priorityLow % 5 == 1)
  3749. {
  3750. // 取得車端電池資訊 : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
  3751. GetEvBatteryInfo(_index, targetID);
  3752. // 樁端輸出能力改變
  3753. if (gun_count == 1)
  3754. SetPresentChargingOutputCap(_chargingData[0], _chargingData[0]);
  3755. else if (gun_count == 2)
  3756. SetPresentChargingOutputCap(_chargingData[0], _chargingData[1]);
  3757. }
  3758. if (LogInfo[_index][EV_LOG_MAX_BATT_VOL] != _chargingData[_index]->EvBatteryMaxVoltage)
  3759. {
  3760. LogInfo[_index][EV_LOG_MAX_BATT_VOL] = _chargingData[_index]->EvBatteryMaxVoltage;
  3761. PRINTF_FUNC("index = %d, Ev Maximum Battery Voltage = %f \n", _index, _chargingData[_index]->EvBatteryMaxVoltage);
  3762. }
  3763. if (LogInfo[_index][EV_LOG_SOC] != _chargingData[_index]->EvBatterySoc)
  3764. {
  3765. LogInfo[_index][EV_LOG_SOC] = _chargingData[_index]->EvBatterySoc;
  3766. PRINTF_FUNC("index = %d, SOC = %d \n", _index, _chargingData[_index]->EvBatterySoc);
  3767. }
  3768. // 持續通知 Isolation 測試狀態
  3769. if (priorityLow == 1)
  3770. {
  3771. // 拉 500 V 如果在一秒鐘內 GFD 都符合則 PASS
  3772. // if (_chargingData[_index]->FireChargingVoltage >= 3500)
  3773. // _chargingData[_index]->GroundFaultStatus = GFD_PASS;
  3774. //PRINTF_FUNC("To EV_%d GFD = %d \n", _index, _chargingData[_index]->GroundFaultStatus);
  3775. //if(_chargingData[_index]->GroundFaultStatus != GFD_WAIT)
  3776. {
  3777. //if ((GetTimeoutValue(_derating_time) / 1000) > 1000)
  3778. unsigned char _result = _chargingData[_index]->GroundFaultStatus;
  3779. // GB & Chademo ~ Warning 也先算 Pass,因為 CCS 認證會驗 Warning 故不可更動
  3780. if(_chargingData[_index]->Type == _Type_Chademo ||
  3781. _chargingData[_index]->Type == _Type_GB)
  3782. {
  3783. if (_result == GFD_WARNING)
  3784. {
  3785. _result = GFD_PASS;
  3786. }
  3787. }
  3788. if (_result == GFD_WARNING || _result == GFD_PASS)
  3789. {
  3790. if (((GetTimeoutValue(_chk_ratingPower_timeout[_index]) / 1000) > 12000 &&
  3791. _chargingData[_index]->RealRatingPower > 0) ||
  3792. (GetTimeoutValue(_chk_ratingPower_timeout[_index]) / 1000) > 14000)
  3793. {
  3794. if (LogInfo[_index][EV_LOG_REAL_CAP_POW] != _chargingData[_index]->RealRatingPower)
  3795. {
  3796. LogInfo[_index][EV_LOG_REAL_CAP_POW] = _chargingData[_index]->RealRatingPower;
  3797. PRINTF_FUNC("Conn %d, RealRatingPower = %d \n",
  3798. _index, _chargingData[_index]->RealRatingPower);
  3799. }
  3800. }
  3801. else
  3802. _result = GFD_WAIT;
  3803. }
  3804. SetIsolationStatus(_index, _result, targetID);
  3805. }
  3806. if(_chargingData[_index]->SystemStatus == S_CCS_PRECHARGE_ST0 &&
  3807. _chargingData[_index]->PrechargeStatus == PRECHARGE_READY)
  3808. {
  3809. SetEvsePrechargeInfo(_index, PRECHARGE_PRERELAY_PASS, targetID);
  3810. }
  3811. }
  3812. }
  3813. break;
  3814. case S_CHARGING:
  3815. {
  3816. // 當前 Power
  3817. _chargingData[_index]->PresentChargingPower = ((float)((_chargingData[_index]->PresentChargingVoltage) * (_chargingData[_index]->PresentChargingCurrent)) / 1000);
  3818. CalOutputPowerAndEnergy(_index);
  3819. // 開始確認車端是否同意開始充電
  3820. GetOutputReq(_index, targetID);
  3821. if (LogInfo[_index][EV_LOG_MAX_BATT_VOL] != _chargingData[_index]->EvBatteryMaxVoltage)
  3822. {
  3823. LogInfo[_index][EV_LOG_MAX_BATT_VOL] = _chargingData[_index]->EvBatteryMaxVoltage;
  3824. PRINTF_FUNC("index = %d, Ev Maximum Battery Voltage = %f \n", _index, _chargingData[_index]->EvBatteryMaxVoltage);
  3825. }
  3826. if (LogInfo[_index][EV_LOG_SOC] != _chargingData[_index]->EvBatterySoc)
  3827. {
  3828. LogInfo[_index][EV_LOG_SOC] = _chargingData[_index]->EvBatterySoc;
  3829. PRINTF_FUNC("index = %d, SOC = %d \n", _index, _chargingData[_index]->EvBatterySoc);
  3830. }
  3831. // 設定當前輸出
  3832. if (gun_count == 1)
  3833. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3834. else if (gun_count == 2)
  3835. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3836. // for test end
  3837. if (priorityLow % 5 == 0)
  3838. {
  3839. // 樁端輸出能力改變
  3840. if (gun_count == 1)
  3841. SetPresentChargingOutputCap(_chargingData[0], _chargingData[0]);
  3842. else if (gun_count == 2)
  3843. SetPresentChargingOutputCap(_chargingData[0], _chargingData[1]);
  3844. }
  3845. if(_chargingData[_index]->GroundFaultStatus == GFD_FAIL)
  3846. {
  3847. SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, targetID);
  3848. }
  3849. else if(_chargingData[_index]->Type == _Type_CCS_2)
  3850. {
  3851. SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, targetID);
  3852. }
  3853. // GFD 失敗再通知
  3854. if (priorityLow == 1)
  3855. {
  3856. if(_chargingData[_index]->Type == _Type_CCS_2 &&
  3857. _chargingData[_index]->PrechargeStatus == PRECHARGE_READY)
  3858. {
  3859. SetEvsePrechargeInfo(_index, PRECHARGE_CHARELAY_PASS, targetID);
  3860. }
  3861. // 取得車端電池資訊 : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
  3862. GetEvBatteryInfo(_index, targetID);
  3863. }
  3864. }
  3865. break;
  3866. case S_ALARM:
  3867. case S_TERMINATING:
  3868. {
  3869. // 設定當前輸出
  3870. if (gun_count == 1)
  3871. {
  3872. if (_chargingData[0]->FireChargingVoltage <= 500)
  3873. _chargingData[0]->PresentChargingCurrent = 0;
  3874. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3875. }
  3876. else if (gun_count == 2)
  3877. {
  3878. if (_chargingData[0]->FireChargingVoltage <= 500)
  3879. _chargingData[0]->PresentChargingCurrent = 0;
  3880. if (_chargingData[1]->FireChargingVoltage <= 500)
  3881. _chargingData[1]->PresentChargingCurrent = 0;
  3882. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3883. }
  3884. // 槍鎖還在,則代表是樁端要求的停止
  3885. if (SendErrorCount[_index] < 3 &&
  3886. (_chargingData[_index]->GunLocked == START ||
  3887. _chargingData[_index]->Type == _Type_CCS_2))
  3888. {
  3889. byte normalStop = 0x01;
  3890. byte stopReason[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  3891. if (GetStopChargingReasonByEvse(_index, stopReason))
  3892. {
  3893. normalStop = 0x02;
  3894. }
  3895. EvseStopChargingEvent(normalStop, stopReason, targetID);
  3896. SendErrorCount[_index] += 1;
  3897. }
  3898. if(_chargingData[_index]->Type == _Type_CCS_2)
  3899. {
  3900. SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, targetID);
  3901. }
  3902. GetOutputReq(_index, targetID);
  3903. if (_chargingData[_index]->SystemStatus == S_ALARM)
  3904. {
  3905. if (priorityLow == 1)
  3906. {
  3907. float maxVol, maxCur;
  3908. // 樁端輸出能力
  3909. maxVol = _chargingData[_index]->MaximumChargingVoltage;
  3910. maxCur = _chargingData[_index]->AvailableChargingCurrent;
  3911. GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
  3912. SetChargingPermission(_index, STOP,
  3913. _chargingData[_index]->AvailableChargingPower,
  3914. maxCur,
  3915. maxVol,
  3916. targetID);
  3917. }
  3918. }
  3919. }
  3920. break;
  3921. case S_COMPLETE:
  3922. {
  3923. // 設定當前輸出
  3924. if (gun_count == 1)
  3925. SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);
  3926. else if (gun_count == 2)
  3927. SetPresentChargingOutputPower(_chargingData[0], _chargingData[1]);
  3928. if (priorityLow == 1)
  3929. {
  3930. float maxVol, maxCur;
  3931. // 樁端輸出能力
  3932. maxVol = _chargingData[_index]->MaximumChargingVoltage;
  3933. maxCur = _chargingData[_index]->AvailableChargingCurrent;
  3934. GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
  3935. SetChargingPermission(_index, STOP,
  3936. _chargingData[_index]->AvailableChargingPower,
  3937. maxCur,
  3938. maxVol,
  3939. targetID);
  3940. }
  3941. }
  3942. break;
  3943. }
  3944. }
  3945. priorityLow >= 20 ? priorityLow = 1 : priorityLow++;
  3946. usleep(45000); //EV 小板通訊 (50 ms)
  3947. }
  3948. DEBUG_INFO("Module_EvComm : Can-bus port = %d \n", CanFd);
  3949. return FAIL;
  3950. }