Module_EvComm.c 160 KB

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