Module_EvComm.c 206 KB

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