api.c 189 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010
  1. /*===========================================================================
  2. Combined Charging System (CCS): SECC
  3. api.c
  4. initiated by Joseph
  5. (since 2019/08/07)
  6. =============================================================================*/
  7. #include <netinet/ip.h>
  8. #include <arpa/inet.h>
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <fcntl.h>
  12. #include <linux/termios.h>
  13. #include <stdio.h>
  14. #include <string.h>
  15. #include <time.h>
  16. #include <stdlib.h>
  17. #include <sys/ipc.h>
  18. #include <sys/shm.h>
  19. #include <sys/mman.h>
  20. #include <linux/sockios.h>
  21. #include <linux/socket.h>
  22. #include <sys/socket.h>
  23. #include <netinet/in.h>
  24. #include <sys/time.h>
  25. #include <sys/timeb.h>
  26. #include <math.h>//for pow
  27. #include <unistd.h>
  28. #include <linux/if_packet.h>
  29. #include <netinet/if_ether.h>
  30. #include <net/if.h>
  31. #include <netinet/ether.h>
  32. #include <linux/can.h>
  33. #include <linux/can/raw.h>
  34. #include "api.h"
  35. #include "Module_CCS.h"
  36. //#include "../../CsuComm.h"
  37. #include "define_ccs.h"
  38. #include "../codec/EXITypes.h"
  39. /* Activate support for DIN */
  40. #include "../din/dinEXIDatatypes.h"
  41. #if DEPLOY_DIN_CODEC == SUPPORT_YES
  42. #include "../din/dinEXIDatatypesEncoder.h"
  43. #include "../din/dinEXIDatatypesDecoder.h"
  44. #endif /* DEPLOY_DIN_CODEC == SUPPORT_YES */
  45. /* Activate support for XMLDSIG */
  46. #include "../xmldsig/xmldsigEXIDatatypes.h"
  47. #if DEPLOY_XMLDSIG_CODEC == SUPPORT_YES
  48. #include "../xmldsig/xmldsigEXIDatatypesEncoder.h"
  49. #include "../xmldsig/xmldsigEXIDatatypesDecoder.h"
  50. #endif /* DEPLOY_XMLDSIG_CODEC == SUPPORT_YES */
  51. /* Activate support for ISO1 */
  52. #include "../iso1/iso1EXIDatatypes.h"
  53. #if DEPLOY_ISO1_CODEC == SUPPORT_YES
  54. #include "../iso1/iso1EXIDatatypesEncoder.h"
  55. #include "../iso1/iso1EXIDatatypesDecoder.h"
  56. #endif /* DEPLOY_ISO1_CODEC == SUPPORT_YES */
  57. /* Activate support for ISO2 */
  58. #include "../iso2/iso2EXIDatatypes.h"
  59. #if DEPLOY_ISO2_CODEC == SUPPORT_YES
  60. #include "../iso2/iso2EXIDatatypesEncoder.h"
  61. #include "../iso2/iso2EXIDatatypesDecoder.h"
  62. #endif /* DEPLOY_ISO2_CODEC == SUPPORT_YES */
  63. #include "../transport/v2gtp.h"
  64. extern struct SysConfigAndInfo *ShmSysConfigAndInfo;
  65. extern struct StatusCodeData *ShmStatusCodeData;
  66. extern struct CcsData *ShmCcsData;
  67. extern struct InternalComm *ShmInternalComm;
  68. extern struct InternalCommAC *ShmInternalCommAC;
  69. /*Preserve V2GTP Rx and Tx Buffer*/
  70. //unsigned char V2GTP_Rx_buf[V2GTP_MSG_RX_BUFFER_SIZE]; //(64*1024) //65,536 = 65.5KB
  71. unsigned char V2GTP_Tx_buf[V2GTP_MSG_TX_BUFFER_SIZE]; //(64*1024) //65,536 = 65.5KB
  72. bitstream_t iStream; //for V2GTP Message
  73. struct appHandEXIDocument exiDoc; //for decoded V2GTP messages, i.e. EXI DOC (XML)
  74. unsigned char buf_log_exi_api[256];
  75. /*===========================================================================
  76. FUNCTION: printASCIIString
  77. DESCRIPTION:
  78. PRE-CONDITION:
  79. INPUT:
  80. 1. exi_doc_DIN
  81. OUTPUT:
  82. GLOBAL VARIABLES:
  83. =============================================================================*/
  84. static void printASCIIString(exi_string_character_t* string, uint16_t len)
  85. {
  86. unsigned int i = 0;
  87. for(i = 0; i < len; i++)
  88. {
  89. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%c", (char)string[i]);
  90. }
  91. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n");
  92. }
  93. /*===========================================================================
  94. FUNCTION: writeStringToEXIString
  95. DESCRIPTION:
  96. PRE-CONDITION:
  97. INPUT:
  98. 1. exi_doc_DIN
  99. OUTPUT:
  100. GLOBAL VARIABLES:
  101. =============================================================================*/
  102. /*
  103. static int writeStringToEXIString(char* string, exi_string_character_t* exiString)
  104. {
  105. int pos = 0;
  106. while(string[pos]!='\0')
  107. {
  108. exiString[pos] = string[pos];
  109. pos++;
  110. }
  111. return pos;
  112. }*/
  113. /*===========================================================================
  114. FUNCTION: PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN
  115. DESCRIPTION:
  116. PRE-CONDITION:
  117. INPUT:
  118. 1. exi_doc_DIN
  119. OUTPUT:
  120. GLOBAL VARIABLES:
  121. =============================================================================*/
  122. int Check_V2G_Rx_Msg_Name_din(struct dinEXIDocument *exi_doc_DIN)
  123. {
  124. int errn = 0;
  125. //Session Setup (0a ⇄ 0b)
  126. if (exi_doc_DIN->V2G_Message.Body.SessionSetupReq_isUsed == 1u)
  127. {
  128. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] SessionSetupReq_isUsed: YES (0a ⇄ 0b)\n");
  129. EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionSetupRequest;
  130. }
  131. //Service Discovery (1a ⇄ 1b)
  132. else if (exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq_isUsed == 1u)
  133. {
  134. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] ServiceDiscoveryReq_isUsed: YES (1a ⇄ 1b)\n");
  135. EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDiscoveryRequest;
  136. }
  137. //Service Payment Selection (2a ⇄ 2b)
  138. else if (exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq_isUsed == 1u)
  139. {
  140. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] ServicePaymentSelectionReq_isUsed: YES (2a ⇄ 2b)\n");
  141. EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceAndPaymentSelectionRequest;
  142. }
  143. //Contract Contract Authentication (Xa ⇄ Xb)
  144. else if (exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq_isUsed == 1u)
  145. {
  146. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] ContractAuthenticationReq_isUsed: YES (Xa ⇄ Xb)\n");
  147. EVCOMM_SYS_INFO.V2G_Rx_Msg = AuthorizationRequest;
  148. }
  149. //Charge Parameter Discovery (3a ⇄ 3b)
  150. else if (exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq_isUsed == 1u)
  151. {
  152. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] ChargeParameterDiscoveryReq_isUsed: YES (3a ⇄ 3b)\n");
  153. EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargeParameterDiscoveryRequest;
  154. }
  155. //Cable Check (4a ⇄ 4b)
  156. else if (exi_doc_DIN->V2G_Message.Body.CableCheckReq_isUsed == 1u)
  157. {
  158. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] CableCheckReq_isUsed: YES (4a ⇄ 4b)\n");
  159. EVCOMM_SYS_INFO.V2G_Rx_Msg = CableCheckRequest;
  160. }
  161. //Precharge (5a ⇄ 5b)
  162. else if (exi_doc_DIN->V2G_Message.Body.PreChargeReq_isUsed == 1u)
  163. {
  164. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] PreChargeReq_isUsed: YES (5a ⇄ 5b)\n");
  165. EVCOMM_SYS_INFO.V2G_Rx_Msg = PreChargeRequest;
  166. }
  167. //Power Delivery (6a ⇄ 6b)
  168. else if (exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
  169. {
  170. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] PowerDeliveryReq_isUsed: YES (6a ⇄ 6b)\n");
  171. if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == PreChargeRequest)
  172. {
  173. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
  174. }
  175. else
  176. {
  177. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
  178. }
  179. }
  180. //Current Demand (7a ⇄ 7b)
  181. else if (exi_doc_DIN->V2G_Message.Body.CurrentDemandReq_isUsed == 1u)
  182. {
  183. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] CurrentDemandReq_isUsed: YES (7a ⇄ 7b)\n");
  184. EVCOMM_SYS_INFO.V2G_Rx_Msg = CurrentDemandRequest;
  185. }
  186. //Welding Detection (9a ⇄ 9b)
  187. else if (exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq_isUsed == 1u)
  188. {
  189. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] WeldingDetectionReq_isUsed: YES (9a ⇄ 9b)\n");
  190. EVCOMM_SYS_INFO.V2G_Rx_Msg = WeldingDetectionRequest;
  191. }
  192. //Session Stop (10a ⇄ 10b)
  193. else if (exi_doc_DIN->V2G_Message.Body.SessionStopReq_isUsed == 1u)
  194. {
  195. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] SessionStopReq_isUsed: YES (10a ⇄ 10b)\n");
  196. EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionStopRequest;
  197. }
  198. else
  199. {
  200. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unidentified V2G_Rx_Msg\n");
  201. errn = -1;
  202. }
  203. //Compare with the previous Message
  204. if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre != EVCOMM_SYS_INFO.V2G_Rx_Msg)
  205. {
  206. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[V2G_RX_MSG]%d >> %d\n",
  207. EVCOMM_SYS_INFO.V2G_Rx_Msg_pre,
  208. EVCOMM_SYS_INFO.V2G_Rx_Msg);
  209. EVCOMM_SYS_INFO.V2G_Rx_Msg_pre = EVCOMM_SYS_INFO.V2G_Rx_Msg;
  210. }
  211. return errn;
  212. }
  213. /*===========================================================================
  214. FUNCTION: PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1
  215. DESCRIPTION:
  216. PRE-CONDITION:
  217. INPUT:
  218. 1. exi_doc_ISO1
  219. OUTPUT:
  220. GLOBAL VARIABLES:
  221. =============================================================================*/
  222. int Check_V2G_Rx_Msg_Name_iso1(struct iso1EXIDocument *exi_doc_ISO1)
  223. {
  224. int errn = 0;
  225. //Session Setup (0a ⇄ 0b)
  226. if (exi_doc_ISO1->V2G_Message.Body.SessionSetupReq_isUsed == 1u)
  227. {
  228. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] SessionSetupReq_isUsed: YES (0a ⇄ 0b)\n");
  229. EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionSetupRequest;
  230. }
  231. //Service Discovery (1a ⇄ 1b)
  232. else if (exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq_isUsed == 1u)
  233. {
  234. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] ServiceDiscoveryReq_isUsed: YES (1a ⇄ 1b)\n");
  235. EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDiscoveryRequest;
  236. }
  237. //Service Detail
  238. else if (exi_doc_ISO1->V2G_Message.Body.ServiceDetailReq_isUsed == 1u)
  239. {
  240. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] ServiceDetailReq_isUsed: YES\n");
  241. EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDetailRequest;
  242. }
  243. //Payment Service Selection (2a ⇄ 2b)
  244. else if (exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq_isUsed == 1u)
  245. {
  246. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] PaymentServiceSelectionReq_isUsed: YES (2a ⇄ 2b)\n");
  247. EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceAndPaymentSelectionRequest;
  248. }
  249. //Payment Details
  250. else if (exi_doc_ISO1->V2G_Message.Body.PaymentDetailsReq_isUsed == 1u)
  251. {
  252. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] PaymentDetailsReq_isUsed: YES\n");
  253. EVCOMM_SYS_INFO.V2G_Rx_Msg = PaymentDetailsRequest;
  254. }
  255. //Authorization (Xa ⇄ Xb)
  256. else if (exi_doc_ISO1->V2G_Message.Body.AuthorizationReq_isUsed == 1u)
  257. {
  258. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] AuthorizationReq_isUsed: YES (Xa ⇄ Xb)\n");
  259. EVCOMM_SYS_INFO.V2G_Rx_Msg = AuthorizationRequest;
  260. }
  261. //Certificate Update
  262. else if (exi_doc_ISO1->V2G_Message.Body.CertificateUpdateReq_isUsed == 1u)
  263. {
  264. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] CertificateUpdateReq_isUsed: YES\n");
  265. EVCOMM_SYS_INFO.V2G_Rx_Msg = CertificateUpdateRequest;
  266. }
  267. //Certificate Installation
  268. else if (exi_doc_ISO1->V2G_Message.Body.CertificateInstallationReq_isUsed == 1u)
  269. {
  270. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] CertificateInstallationReq_isUsed: YES\n");
  271. EVCOMM_SYS_INFO.V2G_Rx_Msg = CertificateInstallationRequest;
  272. }
  273. //Charge Parameter Discovery (3a ⇄ 3b)
  274. else if (exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq_isUsed == 1u)
  275. {
  276. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] ChargeParameterDiscoveryReq_isUsed: YES (3a ⇄ 3b)\n");
  277. EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargeParameterDiscoveryRequest;
  278. }
  279. //Cable Check (4a ⇄ 4b)
  280. else if (exi_doc_ISO1->V2G_Message.Body.CableCheckReq_isUsed == 1u)
  281. {
  282. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] CableCheckReq_isUsed: YES (4a ⇄ 4b)\n");
  283. EVCOMM_SYS_INFO.V2G_Rx_Msg = CableCheckRequest;
  284. }
  285. //Precharge (5a ⇄ 5b)
  286. else if (exi_doc_ISO1->V2G_Message.Body.PreChargeReq_isUsed == 1u)
  287. {
  288. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] PreChargeReq_isUsed: YES (5a ⇄ 5b)\n");
  289. EVCOMM_SYS_INFO.V2G_Rx_Msg = PreChargeRequest;
  290. }
  291. //Power Delivery (6a ⇄ 6b)
  292. else if (exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
  293. {
  294. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] PowerDeliveryReq_isUsed: YES (6a ⇄ 6b)\n");
  295. //For DC
  296. if (CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED)
  297. {
  298. if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == PreChargeRequest)
  299. {
  300. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
  301. }
  302. else
  303. {
  304. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
  305. }
  306. }
  307. //For AC
  308. else if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
  309. {
  310. if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == ChargeParameterDiscoveryRequest)
  311. {
  312. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
  313. }
  314. else
  315. {
  316. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
  317. }
  318. }
  319. else
  320. {
  321. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unexpected CCS_ENERGY_TRANSFER_MODE(%d)\n", CCS_ENERGY_TRANSFER_MODE);
  322. errn = -2;
  323. }
  324. }
  325. //Current Demand (7a ⇄ 7b)
  326. else if (exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq_isUsed == 1u)
  327. {
  328. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] CurrentDemandReq_isUsed: YES (7a ⇄ 7b)\n");
  329. EVCOMM_SYS_INFO.V2G_Rx_Msg = CurrentDemandRequest;
  330. }
  331. //Charging Status
  332. else if (exi_doc_ISO1->V2G_Message.Body.ChargingStatusReq_isUsed == 1u)
  333. {
  334. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] ChargingStatusReq_isUsed: YES (7a ⇄ 7b)\n");
  335. EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargingStatusRequest;
  336. }
  337. //Metering Receipt
  338. else if (exi_doc_ISO1->V2G_Message.Body.MeteringReceiptReq_isUsed == 1u)
  339. {
  340. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] MeteringReceiptReq_isUsed: YES\n");
  341. EVCOMM_SYS_INFO.V2G_Rx_Msg = MeteringReceiptRequest;
  342. }
  343. //Welding Detection (9a ⇄ 9b)
  344. else if (exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq_isUsed == 1u)
  345. {
  346. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] WeldingDetectionReq_isUsed: YES (9a ⇄ 9b)\n");
  347. EVCOMM_SYS_INFO.V2G_Rx_Msg = WeldingDetectionRequest;
  348. }
  349. //Session Stop (10a ⇄ 10b)
  350. else if (exi_doc_ISO1->V2G_Message.Body.SessionStopReq_isUsed == 1u)
  351. {
  352. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] SessionStopReq_isUsed: YES (10a ⇄ 10b)\n");
  353. EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionStopRequest;
  354. }
  355. else
  356. {
  357. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unidentified V2G_Rx_Msg\n");
  358. errn = -1;
  359. }
  360. //Compare with the previous Message
  361. if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre != EVCOMM_SYS_INFO.V2G_Rx_Msg)
  362. {
  363. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[V2G_RX_MSG]%d >> %d\n",
  364. EVCOMM_SYS_INFO.V2G_Rx_Msg_pre,
  365. EVCOMM_SYS_INFO.V2G_Rx_Msg);
  366. EVCOMM_SYS_INFO.V2G_Rx_Msg_pre = EVCOMM_SYS_INFO.V2G_Rx_Msg;
  367. }
  368. return errn;
  369. }
  370. /*===========================================================================
  371. FUNCTION: PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2
  372. DESCRIPTION:
  373. PRE-CONDITION:
  374. INPUT:
  375. 1. exi_doc_ISO2
  376. OUTPUT:
  377. GLOBAL VARIABLES:
  378. =============================================================================*/
  379. int Check_V2G_Rx_Msg_Name_iso2(struct iso2EXIDocument *exi_doc_ISO2)
  380. {
  381. int errn = 0;
  382. //V2GRequest_isUsed
  383. if (exi_doc_ISO2->V2G_Message.Body.V2GRequest_isUsed == 1u)
  384. {
  385. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] V2GRequest_isUsed: YES\n");
  386. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  387. }
  388. //DisconnectChargingDeviceReq_isUsed
  389. else if (exi_doc_ISO2->V2G_Message.Body.DisconnectChargingDeviceReq_isUsed == 1u)
  390. {
  391. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] DisconnectChargingDeviceReq_isUsed: YES\n");
  392. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  393. }
  394. //ConnectChargingDeviceReq_isUsed
  395. else if (exi_doc_ISO2->V2G_Message.Body.ConnectChargingDeviceReq_isUsed == 1u)
  396. {
  397. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ConnectChargingDeviceReq_isUsed: YES\n");
  398. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  399. }
  400. //SystemStatusReq_isUsed
  401. else if (exi_doc_ISO2->V2G_Message.Body.SystemStatusReq_isUsed == 1u)
  402. {
  403. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] SystemStatusReq_isUsed: YES\n");
  404. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  405. }
  406. //DC_BidirectionalControlReq_isUsed
  407. else if (exi_doc_ISO2->V2G_Message.Body.DC_BidirectionalControlReq_isUsed == 1u)
  408. {
  409. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] DC_BidirectionalControlReq_isUsed: YES\n");
  410. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  411. }
  412. //AC_BidirectionalControlReq_isUsed
  413. else if (exi_doc_ISO2->V2G_Message.Body.AC_BidirectionalControlReq_isUsed == 1u)
  414. {
  415. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] AC_BidirectionalControlReq_isUsed: YES\n");
  416. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  417. }
  418. //VehicleCheckOutReq_isUsed
  419. else if (exi_doc_ISO2->V2G_Message.Body.VehicleCheckOutReq_isUsed == 1u)
  420. {
  421. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] VehicleCheckOutReq_isUsed: YES\n");
  422. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  423. }
  424. //VehicleCheckInReq_isUsed
  425. else if (exi_doc_ISO2->V2G_Message.Body.VehicleCheckInReq_isUsed == 1u)
  426. {
  427. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] VehicleCheckInReq_isUsed: YES\n");
  428. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  429. }
  430. //PowerDemandReq_isUsed
  431. else if (exi_doc_ISO2->V2G_Message.Body.PowerDemandReq_isUsed == 1u)
  432. {
  433. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PowerDemandReq_isUsed: YES\n");
  434. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  435. }
  436. //PairingReq_isUsed
  437. else if (exi_doc_ISO2->V2G_Message.Body.PairingReq_isUsed == 1u)
  438. {
  439. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PairingReq_isUsed: YES\n");
  440. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  441. }
  442. //AlignmentCheckReq_isUsed
  443. else if (exi_doc_ISO2->V2G_Message.Body.AlignmentCheckReq_isUsed == 1u)
  444. {
  445. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] AlignmentCheckReq_isUsed: YES\n");
  446. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  447. }
  448. //FinePositioningReq_isUsed
  449. else if (exi_doc_ISO2->V2G_Message.Body.FinePositioningReq_isUsed == 1u)
  450. {
  451. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] FinePositioningReq_isUsed: YES\n");
  452. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  453. }
  454. //FinePositioningSetupReq_isUsed
  455. else if (exi_doc_ISO2->V2G_Message.Body.FinePositioningSetupReq_isUsed == 1u)
  456. {
  457. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] FinePositioningSetupReq_isUsed: YES\n");
  458. //EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
  459. }
  460. //Session Setup (0a ⇄ 0b)
  461. else if (exi_doc_ISO2->V2G_Message.Body.SessionSetupReq_isUsed == 1u)
  462. {
  463. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] SessionSetupReq_isUsed: YES (0a ⇄ 0b)\n");
  464. EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionSetupRequest;
  465. }
  466. //Service Discovery (1a ⇄ 1b)
  467. else if (exi_doc_ISO2->V2G_Message.Body.ServiceDiscoveryReq_isUsed == 1u)
  468. {
  469. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ServiceDiscoveryReq_isUsed: YES (1a ⇄ 1b)\n");
  470. EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDiscoveryRequest;
  471. }
  472. //Service Detail
  473. else if (exi_doc_ISO2->V2G_Message.Body.ServiceDetailReq_isUsed == 1u)
  474. {
  475. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ServiceDetailReq_isUsed: YES\n");
  476. EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDetailRequest;
  477. }
  478. //Payment Service Selection (2a ⇄ 2b)
  479. else if (exi_doc_ISO2->V2G_Message.Body.PaymentServiceSelectionReq_isUsed == 1u)
  480. {
  481. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PaymentServiceSelectionReq_isUsed: YES (2a ⇄ 2b)\n");
  482. EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceAndPaymentSelectionRequest;
  483. }
  484. //Payment Details
  485. else if (exi_doc_ISO2->V2G_Message.Body.PaymentDetailsReq_isUsed == 1u)
  486. {
  487. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PaymentDetailsReq_isUsed: YES\n");
  488. EVCOMM_SYS_INFO.V2G_Rx_Msg = PaymentDetailsRequest;
  489. }
  490. //Authorization (Xa ⇄ Xb)
  491. else if (exi_doc_ISO2->V2G_Message.Body.AuthorizationReq_isUsed == 1u)
  492. {
  493. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] AuthorizationReq_isUsed: YES (Xa ⇄ Xb)\n");
  494. EVCOMM_SYS_INFO.V2G_Rx_Msg = AuthorizationRequest;
  495. }
  496. //Certificate Update
  497. else if (exi_doc_ISO2->V2G_Message.Body.CertificateUpdateReq_isUsed == 1u)
  498. {
  499. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] CertificateUpdateReq_isUsed: YES\n");
  500. EVCOMM_SYS_INFO.V2G_Rx_Msg = CertificateUpdateRequest;
  501. }
  502. //Certificate Installation
  503. else if (exi_doc_ISO2->V2G_Message.Body.CertificateInstallationReq_isUsed == 1u)
  504. {
  505. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] CertificateInstallationReq_isUsed: YES\n");
  506. EVCOMM_SYS_INFO.V2G_Rx_Msg = CertificateInstallationRequest;
  507. }
  508. //Charge Parameter Discovery (3a ⇄ 3b)
  509. else if (exi_doc_ISO2->V2G_Message.Body.ChargeParameterDiscoveryReq_isUsed == 1u)
  510. {
  511. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ChargeParameterDiscoveryReq_isUsed: YES (3a ⇄ 3b)\n");
  512. EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargeParameterDiscoveryRequest;
  513. }
  514. //Cable Check (4a ⇄ 4b)
  515. else if (exi_doc_ISO2->V2G_Message.Body.CableCheckReq_isUsed == 1u)
  516. {
  517. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] CableCheckReq_isUsed: YES (4a ⇄ 4b)\n");
  518. EVCOMM_SYS_INFO.V2G_Rx_Msg = CableCheckRequest;
  519. }
  520. //Precharge (5a ⇄ 5b)
  521. else if (exi_doc_ISO2->V2G_Message.Body.PreChargeReq_isUsed == 1u)
  522. {
  523. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PreChargeReq_isUsed: YES (5a ⇄ 5b)\n");
  524. EVCOMM_SYS_INFO.V2G_Rx_Msg = PreChargeRequest;
  525. }
  526. //Power Delivery (6a ⇄ 6b)
  527. else if (exi_doc_ISO2->V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
  528. {
  529. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PowerDeliveryReq_isUsed: YES (6a ⇄ 6b)\n");
  530. //For DC
  531. if (CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED)
  532. {
  533. if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == PreChargeRequest)
  534. {
  535. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
  536. }
  537. else
  538. {
  539. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
  540. }
  541. }
  542. //For AC
  543. else if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
  544. {
  545. if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == ChargeParameterDiscoveryRequest)
  546. {
  547. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
  548. }
  549. else
  550. {
  551. EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
  552. }
  553. }
  554. else
  555. {
  556. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unexpected CCS_ENERGY_TRANSFER_MODE(%d)\n", CCS_ENERGY_TRANSFER_MODE);
  557. errn = -2;
  558. }
  559. }
  560. //Current Demand (7a ⇄ 7b)
  561. else if (exi_doc_ISO2->V2G_Message.Body.CurrentDemandReq_isUsed == 1u)
  562. {
  563. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] CurrentDemandReq_isUsed: YES (7a ⇄ 7b)\n");
  564. EVCOMM_SYS_INFO.V2G_Rx_Msg = CurrentDemandRequest;
  565. }
  566. //Charging Status
  567. else if (exi_doc_ISO2->V2G_Message.Body.ChargingStatusReq_isUsed == 1u)
  568. {
  569. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ChargingStatusReq_isUsed: YES (7a ⇄ 7b)\n");
  570. EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargingStatusRequest;
  571. }
  572. //Metering Receipt
  573. else if (exi_doc_ISO2->V2G_Message.Body.MeteringReceiptReq_isUsed == 1u)
  574. {
  575. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] MeteringReceiptReq_isUsed: YES\n");
  576. EVCOMM_SYS_INFO.V2G_Rx_Msg = MeteringReceiptRequest;
  577. }
  578. //Welding Detection (9a ⇄ 9b)
  579. else if (exi_doc_ISO2->V2G_Message.Body.WeldingDetectionReq_isUsed == 1u)
  580. {
  581. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] WeldingDetectionReq_isUsed: YES (9a ⇄ 9b)\n");
  582. EVCOMM_SYS_INFO.V2G_Rx_Msg = WeldingDetectionRequest;
  583. }
  584. //Session Stop (10a ⇄ 10b)
  585. else if (exi_doc_ISO2->V2G_Message.Body.SessionStopReq_isUsed == 1u)
  586. {
  587. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] SessionStopReq_isUsed: YES (10a ⇄ 10b)\n");
  588. EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionStopRequest;
  589. }
  590. else
  591. {
  592. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unidentified V2G_Rx_Msg\n");
  593. errn = -1;
  594. }
  595. //Compare with the previous Message
  596. if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre != EVCOMM_SYS_INFO.V2G_Rx_Msg)
  597. {
  598. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[V2G_RX_MSG]%d >> %d\n",
  599. EVCOMM_SYS_INFO.V2G_Rx_Msg_pre,
  600. EVCOMM_SYS_INFO.V2G_Rx_Msg);
  601. EVCOMM_SYS_INFO.V2G_Rx_Msg_pre = EVCOMM_SYS_INFO.V2G_Rx_Msg;
  602. }
  603. return errn;
  604. }
  605. /*===========================================================================
  606. FUNCTION: SAVE_PhysicalValueType_DIN70121
  607. DESCRIPTION:
  608. PRE-CONDITION:
  609. INPUT:
  610. OUTPUT:
  611. GLOBAL VARIABLES:
  612. =============================================================================*/
  613. void SAVE_PhysicalValueType_DIN70121(struct PhysicalValueType_DIN70121 *out, int in_value, unsigned char unit)
  614. {
  615. out->Value = in_value;
  616. out->Unit = unit;
  617. switch (unit)
  618. {
  619. case H_DIN70121:
  620. case M_DIN70121:
  621. case S_DIN70121:
  622. case A_DIN70121:
  623. case V_DIN70121:
  624. case AH_DIN70121:
  625. case VA_DIN70121:
  626. out->Multiplier = -1;
  627. break; //KW
  628. case W_DIN70121:
  629. case WH_DIN70121:
  630. out->Value = in_value * 10;
  631. out->Multiplier = 1;
  632. break; //KWh
  633. }
  634. //H_DIN70121 = 0,
  635. //M_DIN70121 = 1,
  636. //S_DIN70121 = 2,
  637. //A_DIN70121 = 3,
  638. //AH_DIN70121 = 4,
  639. //V_DIN70121 = 5,
  640. //VA_DIN70121 = 6,
  641. //W_DIN70121 = 7,
  642. //WS_DIN70121 = 8,
  643. //WH_DIN70121 = 9};
  644. }
  645. /*===========================================================================
  646. FUNCTION: SAVE_PhysicalValueType_ISO15118_2014
  647. DESCRIPTION:
  648. PRE-CONDITION:
  649. INPUT:
  650. OUTPUT:
  651. GLOBAL VARIABLES:
  652. =============================================================================*/
  653. void SAVE_PhysicalValueType_ISO15118_2014(struct PhysicalValueType_ISO15118_2014 *out, int in_value, unsigned char unit)
  654. {
  655. out->Value = in_value;
  656. out->Unit = unit;
  657. switch (unit)
  658. {
  659. case h_ISO15118_2014:
  660. case m_ISO15118_2014:
  661. case s_ISO15118_2014:
  662. case A_ISO15118_2014:
  663. case V_ISO15118_2014:
  664. out->Multiplier = -1;
  665. break; //KW
  666. case W_ISO15118_2014:
  667. case Wh_ISO15118_2014:
  668. out->Value = in_value * 10;
  669. out->Multiplier = 1;
  670. break; //KWh
  671. }
  672. //H_DIN70121 = 0,
  673. //M_DIN70121 = 1,
  674. //S_DIN70121 = 2,
  675. //A_DIN70121 = 3,
  676. //AH_DIN70121 = 4,
  677. //V_DIN70121 = 5,
  678. //VA_DIN70121 = 6,
  679. //W_DIN70121 = 7,
  680. //WS_DIN70121 = 8,
  681. //WH_DIN70121 = 9};
  682. }
  683. /*===========================================================================
  684. FUNCTION: DIN70121PhyValDecode
  685. DESCRIPTION:
  686. Output Unit: 1V, 1A, 1S, etc.
  687. PRE-CONDITION:
  688. INPUT:
  689. OUTPUT:
  690. GLOBAL VARIABLES:
  691. =============================================================================*/
  692. float DIN70121PhyValDecode(struct PhysicalValueType_DIN70121 PhysicalData)
  693. {
  694. short DataValue;
  695. int DataMultiplier;
  696. float Rtn;
  697. DataValue = PhysicalData.Value;
  698. DataMultiplier = PhysicalData.Multiplier;
  699. switch(PhysicalData.Unit)
  700. {
  701. case H_DIN70121:
  702. Rtn = (DataValue * pow(10, DataMultiplier) * 60 * 60);
  703. return Rtn;
  704. case M_DIN70121:
  705. Rtn = (DataValue * pow(10, DataMultiplier) * 60);
  706. return Rtn;
  707. case S_DIN70121:
  708. case A_DIN70121:
  709. case V_DIN70121:
  710. Rtn = (DataValue * pow(10, DataMultiplier));
  711. return Rtn; //S, A, V
  712. case AH_DIN70121:
  713. Rtn = (DataValue * pow(10, DataMultiplier));
  714. return Rtn;
  715. case VA_DIN70121:
  716. case W_DIN70121:
  717. Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
  718. return Rtn; //kW
  719. case WS_DIN70121:
  720. Rtn = (DataValue * pow(10, DataMultiplier)) / 1000; //[Joseph] TBD
  721. return Rtn;
  722. case WH_DIN70121:
  723. Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
  724. return Rtn; //kWh
  725. }
  726. return 0;
  727. }
  728. /*===========================================================================
  729. FUNCTION: ISO151182014PhyValDecode
  730. DESCRIPTION:
  731. PRE-CONDITION:
  732. INPUT:
  733. OUTPUT:
  734. GLOBAL VARIABLES:
  735. =============================================================================*/
  736. float ISO151182014PhyValDecode(struct PhysicalValueType_ISO15118_2014 PhysicalData)
  737. {
  738. short DataValue;
  739. int DataMultiplier;
  740. float Rtn;
  741. DataValue = PhysicalData.Value;
  742. DataMultiplier = PhysicalData.Multiplier;
  743. switch(PhysicalData.Unit)
  744. {
  745. case h_ISO15118_2014:
  746. Rtn = (DataValue * pow(10, DataMultiplier) * 60 * 60);
  747. return Rtn;
  748. case m_ISO15118_2014:
  749. Rtn = (DataValue * pow(10, DataMultiplier) * 60);
  750. return Rtn;
  751. case s_ISO15118_2014:
  752. case A_ISO15118_2014:
  753. case V_ISO15118_2014:
  754. Rtn = (DataValue * pow(10, DataMultiplier));
  755. return Rtn;
  756. case W_ISO15118_2014:
  757. Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
  758. return Rtn; //kW
  759. case Wh_ISO15118_2014:
  760. Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
  761. return Rtn; //kWh
  762. }
  763. return 0;
  764. }
  765. /*===========================================================================
  766. FUNCTION: SHM_Read_dinPhysicalValueType
  767. DESCRIPTION:
  768. PRE-CONDITION:
  769. INPUT:
  770. 1. in
  771. OUTPUT:
  772. 2. out
  773. GLOBAL VARIABLES:
  774. =============================================================================*/
  775. void SHM_Read_dinPhysicalValueType(struct dinPhysicalValueType *out, struct PhysicalValueType_DIN70121 *in)
  776. {
  777. out->Value = (short) in->Value;
  778. out->Multiplier = (char) in->Multiplier;
  779. out->Unit_isUsed = 1u; //[CAUTION] Remember to put Uinit, since here we set it as 1 as default.
  780. out->Unit = (unsigned char) in->Unit;
  781. // dinunitSymbolType_h = 0,
  782. // dinunitSymbolType_m = 1,
  783. // dinunitSymbolType_s = 2,
  784. // dinunitSymbolType_A = 3,
  785. // dinunitSymbolType_Ah = 4,
  786. // dinunitSymbolType_V = 5,
  787. // dinunitSymbolType_VA = 6,
  788. // dinunitSymbolType_W = 7,
  789. // dinunitSymbolType_W_s = 8,
  790. // dinunitSymbolType_Wh = 9
  791. }
  792. /*===========================================================================
  793. FUNCTION: SHM_Read_iso1PhysicalValueType
  794. DESCRIPTION:
  795. PRE-CONDITION:
  796. INPUT:
  797. 1. in
  798. OUTPUT:
  799. 2. out
  800. GLOBAL VARIABLES:
  801. =============================================================================*/
  802. void SHM_Read_iso1PhysicalValueType(struct iso1PhysicalValueType *out, struct PhysicalValueType_ISO15118_2014 *in)
  803. {
  804. out->Value = (short) in->Value;
  805. out->Multiplier = (char) in->Multiplier;
  806. //out->Unit_isUsed = 1u; //[CAUTION] Remember to put Uinit, since here we set it as 1 as default.
  807. out->Unit = (unsigned char) in->Unit;
  808. //iso1unitSymbolType_h = 0,
  809. //iso1unitSymbolType_m = 1,
  810. //iso1unitSymbolType_s = 2,
  811. //iso1unitSymbolType_A = 3,
  812. //iso1unitSymbolType_V = 4,
  813. //iso1unitSymbolType_W = 5,
  814. //iso1unitSymbolType_Wh = 6
  815. }
  816. /*===========================================================================
  817. FUNCTION: SHM_Read_dinDC_EVSEStatusType
  818. DESCRIPTION:
  819. PRE-CONDITION:
  820. INPUT:
  821. 1. in
  822. OUTPUT:
  823. 2. out
  824. GLOBAL VARIABLES:
  825. =============================================================================*/
  826. void SHM_Read_dinDC_EVSEStatusType(struct dinDC_EVSEStatusType *out, struct DC_EVSEStatusType_DIN70121 *in)
  827. {
  828. out->EVSEIsolationStatus_isUsed = 1u;
  829. out->EVSEIsolationStatus = (unsigned char) in->EVSEIsolationStatus;
  830. // dinisolationLevelType_Invalid = 0, (default)
  831. // dinisolationLevelType_Valid = 1,
  832. // dinisolationLevelType_Warning = 2,
  833. // dinisolationLevelType_Fault = 3
  834. out->EVSEStatusCode = (unsigned char) in->EVSEStatusCode;
  835. // dinDC_EVSEStatusCodeType_EVSE_NotReady = 0,
  836. // dinDC_EVSEStatusCodeType_EVSE_Ready = 1, (default)
  837. // dinDC_EVSEStatusCodeType_EVSE_Shutdown = 2,
  838. // dinDC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
  839. // dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
  840. // dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
  841. // dinDC_EVSEStatusCodeType_EVSE_Malfunction = 6,
  842. // dinDC_EVSEStatusCodeType_Reserved_8 = 7,
  843. // dinDC_EVSEStatusCodeType_Reserved_9 = 8,
  844. // dinDC_EVSEStatusCodeType_Reserved_A = 9,
  845. // dinDC_EVSEStatusCodeType_Reserved_B = 10,
  846. // dinDC_EVSEStatusCodeType_Reserved_C = 11
  847. out->NotificationMaxDelay = 0u;
  848. out->EVSENotification = (unsigned char) in->EVSENotification;
  849. // dinEVSENotificationType_None = 0, (default)
  850. // dinEVSENotificationType_StopCharging = 1,
  851. // dinEVSENotificationType_ReNegotiation = 2
  852. }
  853. /*===========================================================================
  854. FUNCTION: SHM_Read_iso1DC_EVSEStatusType
  855. DESCRIPTION:
  856. PRE-CONDITION:
  857. INPUT:
  858. 1. in
  859. OUTPUT:
  860. 2. out
  861. GLOBAL VARIABLES:
  862. =============================================================================*/
  863. void SHM_Read_iso1DC_EVSEStatusType(struct iso1DC_EVSEStatusType *out, struct DC_EVSEStatusType_ISO15118_2014 *in)
  864. {
  865. out->EVSEIsolationStatus_isUsed = 1u;
  866. out->EVSEIsolationStatus = (unsigned char) in->EVSEIsolationStatus;
  867. //iso1isolationLevelType_Invalid = 0,
  868. //iso1isolationLevelType_Valid = 1,
  869. //iso1isolationLevelType_Warning = 2,
  870. //iso1isolationLevelType_Fault = 3,
  871. //iso1isolationLevelType_No_IMD = 4
  872. out->EVSEStatusCode = (unsigned char) in->DC_EVSEStatusCode;
  873. //iso1DC_EVSEStatusCodeType_EVSE_NotReady = 0,
  874. //iso1DC_EVSEStatusCodeType_EVSE_Ready = 1,
  875. //iso1DC_EVSEStatusCodeType_EVSE_Shutdown = 2,
  876. //iso1DC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
  877. //iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
  878. //iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
  879. //iso1DC_EVSEStatusCodeType_EVSE_Malfunction = 6,
  880. //iso1DC_EVSEStatusCodeType_Reserved_8 = 7,
  881. //iso1DC_EVSEStatusCodeType_Reserved_9 = 8,
  882. //iso1DC_EVSEStatusCodeType_Reserved_A = 9,
  883. //iso1DC_EVSEStatusCodeType_Reserved_B = 10,
  884. //iso1DC_EVSEStatusCodeType_Reserved_C = 11
  885. out->NotificationMaxDelay = 0u;
  886. out->EVSENotification = (unsigned char) in->EVSENotification;
  887. //iso1EVSENotificationType_None = 0, (default)
  888. //iso1EVSENotificationType_StopCharging = 1,
  889. //iso1EVSENotificationType_ReNegotiation = 2
  890. }
  891. /*===========================================================================
  892. FUNCTION: SHM_Read_iso1AC_EVSEStatusType
  893. DESCRIPTION:
  894. PRE-CONDITION:
  895. INPUT:
  896. 1. in
  897. OUTPUT:
  898. 2. out
  899. GLOBAL VARIABLES:
  900. =============================================================================*/
  901. void SHM_Read_iso1AC_EVSEStatusType(struct iso1AC_EVSEStatusType *out, struct AC_EVSEStatusType_ISO15118_2014 *in)
  902. {
  903. out->RCD = (int)in->RCD;
  904. //0: no error is detected
  905. //1: an error is detected
  906. out->NotificationMaxDelay = (unsigned short)in->NotificationMaxDelay;
  907. //unit: 1s
  908. //The time SECC expects EVCC to perform EVSENotification
  909. out->EVSENotification = (unsigned char)in->EVSENotification;
  910. //iso1EVSENotificationType_None = 0,
  911. //iso1EVSENotificationType_StopCharging = 1,
  912. //iso1EVSENotificationType_ReNegotiation = 2
  913. }
  914. /*===========================================================================
  915. FUNCTION: SHM_Read_iso1MeterInfo
  916. DESCRIPTION:
  917. PRE-CONDITION:
  918. INPUT:
  919. 1. in
  920. OUTPUT:
  921. 2. out
  922. GLOBAL VARIABLES:
  923. =============================================================================*/
  924. void SHM_Read_iso1MeterInfo(struct iso1MeterInfoType *out, struct MeterInfoType_ISO15118_2014 *in)
  925. {
  926. int i = 0;
  927. //[1/5] MeterID
  928. out->MeterID.charactersLen = 32;
  929. for (i = 0; i < out->MeterID.charactersLen; i++)
  930. {
  931. out->MeterID.characters[i] = (unsigned char)in->MeterID[i];
  932. }
  933. //[2/5] MeterReading
  934. out->MeterReading_isUsed = 1u;
  935. out->MeterReading = (unsigned long)in->MeterReading;
  936. //[3/5] SigMeterReading
  937. out->SigMeterReading_isUsed = 1u;
  938. out->SigMeterReading.bytesLen = 64;
  939. for (i = 0; i < out->SigMeterReading.bytesLen; i++)
  940. {
  941. out->SigMeterReading.bytes[i] = (unsigned char)in->SigMeterReading[i];
  942. }
  943. //[4/5] MeterStatus
  944. out->MeterStatus_isUsed = 1u;
  945. out->MeterStatus = (short)in->MeterStatus;
  946. //[5/5] TMeter
  947. out->TMeter_isUsed = 1u;
  948. out->TMeter = (long)in->TMeter; //[CAUTION] data type
  949. }
  950. /*===========================================================================
  951. FUNCTION: SHM_Save_din_supportedAppProtocolReq
  952. DESCRIPTION:
  953. PRE-CONDITION:
  954. INPUT:
  955. OUTPUT:
  956. GLOBAL VARIABLES:
  957. =============================================================================*/
  958. void SHM_Save_din_supportedAppProtocolReq(struct CcsData *shm_ccs, struct appHandEXIDocument *buf, struct SysConfigAndInfo *shm_sys)
  959. {
  960. // ======== [STEP 1/3] Initialize ========
  961. int i = 0;
  962. int j = 0;
  963. struct SupportedAppProtocolRequest_DIN70121 *shm_msg;
  964. struct appHandAnonType_supportedAppProtocolReq *exi;
  965. shm_msg = &shm_ccs->V2GMessage_DIN70121.SupportedAppProtocolRequest;
  966. exi = &buf->supportedAppProtocolReq;
  967. // ======== [STEP 2/3] Update Flags ========
  968. // ======== [STEP 3/3] Transfer Data ========
  969. for (i = 0; i < exi->AppProtocol.arrayLen ; i++)
  970. {
  971. //ProtocolNamespace
  972. shm_msg->AppProtocol[i].ProtocolNamespaceLen = (unsigned int) exi->AppProtocol.array[i].ProtocolNamespace.charactersLen;
  973. for (j = 0; j< shm_msg->AppProtocol[i].ProtocolNamespaceLen; j++)
  974. {
  975. shm_msg->AppProtocol[i].ProtocolNamespace[j] = (unsigned char) exi->AppProtocol.array[i].ProtocolNamespace.characters[j];
  976. }
  977. //Version (Major, Minor)
  978. shm_msg->AppProtocol[i].VersionNumberMajor = (unsigned int) exi->AppProtocol.array[i].VersionNumberMajor;
  979. shm_msg->AppProtocol[i].VersionNumberMinor = (unsigned int) exi->AppProtocol.array[i].VersionNumberMinor;
  980. //SchemaID
  981. shm_msg->AppProtocol[i].SchemaID = (unsigned char) exi->AppProtocol.array[i].SchemaID;
  982. //Priority
  983. shm_msg->AppProtocol[i].Priority = (unsigned char) exi->AppProtocol.array[i].Priority;
  984. }
  985. }
  986. /*===========================================================================
  987. FUNCTION: SHM_Save_din_SessionSetupReq
  988. DESCRIPTION:
  989. PRE-CONDITION:
  990. INPUT:
  991. OUTPUT:
  992. GLOBAL VARIABLES:
  993. =============================================================================*/
  994. void SHM_Save_din_SessionSetupReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  995. {
  996. // ======== [STEP 1/3] Initialize ========
  997. int i = 0;
  998. struct SessionSetupRequest_DIN70121 *shm_msg;
  999. struct dinSessionSetupReqType *exi;
  1000. shm_msg = &shm_ccs->V2GMessage_DIN70121.SessionSetupRequest;
  1001. exi = &exi_doc_DIN->V2G_Message.Body.SessionSetupReq;
  1002. // ======== [STEP 2/3] Update Flags ========
  1003. // ======== [STEP 3/3] Transfer Data ========
  1004. //SHM_Save_din_V2GMSG_Header(buf);
  1005. //EVCCID Length
  1006. EVCOMM_SYS_INFO.EVCCID_length = (unsigned char)exi->EVCCID.bytesLen;
  1007. //EVCCID
  1008. for (i = 0; i < exi->EVCCID.bytesLen; i++)
  1009. {
  1010. shm_msg->EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
  1011. EVCOMM_SYS_INFO.EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
  1012. }
  1013. }
  1014. /*===========================================================================
  1015. FUNCTION: SHM_Save_iso1_SessionSetupReq
  1016. DESCRIPTION:
  1017. PRE-CONDITION:
  1018. INPUT:
  1019. OUTPUT:
  1020. GLOBAL VARIABLES:
  1021. =============================================================================*/
  1022. void SHM_Save_iso1_SessionSetupReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1023. {
  1024. // ======== [STEP 1/3] Initialize ========
  1025. int i = 0;
  1026. struct SessionSetupRequest_ISO15118_2014 *shm_msg;
  1027. struct iso1SessionSetupReqType *exi;
  1028. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.SessionSetupRequest;
  1029. exi = &exi_doc_ISO1->V2G_Message.Body.SessionSetupReq;
  1030. // ======== [STEP 2/3] Update Flags ========
  1031. // ======== [STEP 3/3] Transfer Data ========
  1032. //SHM_Save_din_V2GMSG_Header(buf);
  1033. //EVCCID Length
  1034. EVCOMM_SYS_INFO.EVCCID_length = (unsigned char)exi->EVCCID.bytesLen;
  1035. //EVCCID
  1036. for (i = 0; i < exi->EVCCID.bytesLen; i++)
  1037. {
  1038. shm_msg->EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
  1039. EVCOMM_SYS_INFO.EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
  1040. }
  1041. }
  1042. /*===========================================================================
  1043. FUNCTION: SHM_Save_iso2_SessionSetupReq
  1044. DESCRIPTION:
  1045. PRE-CONDITION:
  1046. INPUT:
  1047. OUTPUT:
  1048. GLOBAL VARIABLES:
  1049. =============================================================================*/
  1050. void SHM_Save_iso2_SessionSetupReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys)
  1051. {
  1052. // ======== [STEP 1/3] Initialize ========
  1053. int i = 0;
  1054. struct SessionSetupRequest_ISO15118_2018 *shm_msg;
  1055. struct iso2SessionSetupReqType *exi;
  1056. shm_msg = &shm_ccs->V2GMessage_ISO15118_2018.SessionSetupRequest;
  1057. exi = &exi_doc_ISO2->V2G_Message.Body.SessionSetupReq;
  1058. // ======== [STEP 2/3] Update Flags ========
  1059. // ======== [STEP 3/3] Transfer Data ========
  1060. //SHM_Save_din_V2GMSG_Header(buf);
  1061. //EVCCID Length
  1062. EVCOMM_SYS_INFO.EVCCID_length = (unsigned char)exi->EVCCID.bytesLen;
  1063. //EVCCID
  1064. for (i = 0; i < exi->EVCCID.bytesLen; i++)
  1065. {
  1066. shm_msg->EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
  1067. EVCOMM_SYS_INFO.EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
  1068. }
  1069. }
  1070. /*===========================================================================
  1071. FUNCTION: SHM_Save_din_ServiceDiscoveryReq
  1072. DESCRIPTION:
  1073. PRE-CONDITION:
  1074. INPUT:
  1075. OUTPUT:
  1076. GLOBAL VARIABLES:
  1077. =============================================================================*/
  1078. void SHM_Save_din_ServiceDiscoveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1079. {
  1080. // ======== [STEP 1/3] Initialize ========
  1081. int i = 0;
  1082. struct ServiceDiscoveryRequest_DIN70121 *shm_msg;
  1083. struct dinServiceDiscoveryReqType *exi;
  1084. shm_msg = &shm_ccs->V2GMessage_DIN70121.ServiceDiscoveryRequest;
  1085. exi = &exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq;
  1086. // ======== [STEP 2/3] Update Flags ========
  1087. // ======== [STEP 3/3] Transfer Data ========
  1088. //SHM_Save_din_V2GMSG_Header(buf);
  1089. //ServiceScope
  1090. shm_msg->ServiceScopeLen = (unsigned int) exi->ServiceScope.charactersLen;
  1091. for (i = 0; i <shm_msg->ServiceScopeLen ; i++)
  1092. {
  1093. shm_msg->ServiceScope[i] = (unsigned char) exi->ServiceScope.characters[i];
  1094. }
  1095. //ServiceCategory
  1096. shm_msg->ServiceCategory = (unsigned int) exi->ServiceCategory;
  1097. }
  1098. /*===========================================================================
  1099. FUNCTION: SHM_Save_iso1_ServiceDiscoveryReq
  1100. DESCRIPTION:
  1101. PRE-CONDITION:
  1102. INPUT:
  1103. OUTPUT:
  1104. GLOBAL VARIABLES:
  1105. =============================================================================*/
  1106. void SHM_Save_iso1_ServiceDiscoveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1107. {
  1108. // ======== [STEP 1/3] Initialize ========
  1109. int i = 0;
  1110. struct ServiceDiscoveryRequest_ISO15118_2014 *shm_msg;
  1111. struct iso1ServiceDiscoveryReqType *exi;
  1112. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ServiceDiscoveryRequest;
  1113. exi = &exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq;
  1114. // ======== [STEP 2/3] Update Flags ========
  1115. // ======== [STEP 3/3] Transfer Data ========
  1116. //SHM_Save_iso1_V2GMSG_Header(buf);
  1117. //ServiceScope
  1118. shm_msg->ServiceScopeLen = (unsigned int) exi->ServiceScope.charactersLen;
  1119. for (i = 0; i <shm_msg->ServiceScopeLen ; i++)
  1120. {
  1121. shm_msg->ServiceScope[i] = (unsigned char) exi->ServiceScope.characters[i];
  1122. }
  1123. //ServiceCategory
  1124. shm_msg->ServiceCategory = (unsigned int) exi->ServiceCategory;
  1125. }
  1126. /*===========================================================================
  1127. FUNCTION: SHM_Save_din_ServiceAndPaymentSelectionReq
  1128. DESCRIPTION:
  1129. PRE-CONDITION:
  1130. INPUT:
  1131. OUTPUT:
  1132. GLOBAL VARIABLES:
  1133. =============================================================================*/
  1134. void SHM_Save_din_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1135. {
  1136. // ======== [STEP 1/3] Initialize ========
  1137. int i = 0;
  1138. struct ServiceAndPaymentSelectionRequest_DIN70121 *shm_msg;
  1139. struct dinServicePaymentSelectionReqType *exi;
  1140. shm_msg = &shm_ccs->V2GMessage_DIN70121.ServiceAndPaymentSelectionRequest;
  1141. exi = &exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq;
  1142. // ======== [STEP 2/3] Update Flags ========
  1143. // ======== [STEP 3/3] Transfer Data ========
  1144. //SHM_Save_din_V2GMSG_Header(buf);
  1145. //[1/2] SelectedPaymentOption
  1146. shm_msg->SelectedPaymentOption = (unsigned char) exi->SelectedPaymentOption;
  1147. //[2/2] SelectedServiceList
  1148. shm_msg->SelectedServiceList.SelectedServiceLen = (unsigned int) exi->SelectedServiceList.SelectedService.arrayLen;
  1149. for (i = 0; i< shm_msg->SelectedServiceList.SelectedServiceLen; i++)
  1150. {
  1151. shm_msg->SelectedServiceList.SelectedService[i].ServiceID =
  1152. (unsigned short) exi->SelectedServiceList.SelectedService.array[i].ServiceID;
  1153. shm_msg->SelectedServiceList.SelectedService[i].ParameterSetID =
  1154. (short) exi->SelectedServiceList.SelectedService.array[i].ParameterSetID;
  1155. }
  1156. }
  1157. /*===========================================================================
  1158. FUNCTION: SHM_Save_iso1_ServiceAndPaymentSelectionReq
  1159. DESCRIPTION:
  1160. PRE-CONDITION:
  1161. INPUT:
  1162. OUTPUT:
  1163. GLOBAL VARIABLES:
  1164. =============================================================================*/
  1165. void SHM_Save_iso1_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1166. {
  1167. // ======== [STEP 1/3] Initialize ========
  1168. int i = 0;
  1169. struct ServiceAndPaymentSelectionRequest_ISO15118_2014 *shm_msg;
  1170. struct iso1PaymentServiceSelectionReqType *exi;
  1171. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ServiceAndPaymentSelectionRequest;
  1172. exi = &exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq;
  1173. // ======== [STEP 2/3] Update Flags ========
  1174. // ======== [STEP 3/3] Transfer Data ========
  1175. //SHM_Save_iso1_V2GMSG_Header(buf);
  1176. //[1/2] SelectedPaymentOption
  1177. shm_msg->SelectedPaymentOption = (unsigned char) exi->SelectedPaymentOption;
  1178. //[2/2] SelectedServiceList
  1179. shm_msg->SelectedServiceList.SelectedServiceLen = (unsigned int) exi->SelectedServiceList.SelectedService.arrayLen;
  1180. for (i = 0; i< shm_msg->SelectedServiceList.SelectedServiceLen; i++)
  1181. {
  1182. shm_msg->SelectedServiceList.SelectedService[i].ServiceID =
  1183. (unsigned short) exi->SelectedServiceList.SelectedService.array[i].ServiceID;
  1184. shm_msg->SelectedServiceList.SelectedService[i].ParameterSetID =
  1185. (short) exi->SelectedServiceList.SelectedService.array[i].ParameterSetID;
  1186. }
  1187. }
  1188. /*===========================================================================
  1189. FUNCTION: SHM_Save_din_ContractAuthenticationReq
  1190. DESCRIPTION:
  1191. PRE-CONDITION:
  1192. INPUT:
  1193. OUTPUT:
  1194. GLOBAL VARIABLES:
  1195. =============================================================================*/
  1196. void SHM_Save_din_ContractAuthenticationReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1197. {
  1198. // ======== [STEP 1/3] Initialize ========
  1199. //int i = 0;
  1200. //struct ContractAuthenticationRequest_DIN70121 *shm_msg;
  1201. //struct dinContractAuthenticationReqType *exi;
  1202. //shm_msg = &shm_ccs->V2GMessage_DIN70121.ContractAuthenticationRequest;
  1203. //exi = &exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq;
  1204. // ======== [STEP 2/3] Update Flags ========
  1205. // ======== [STEP 3/3] Transfer Data ========
  1206. //SHM_Save_din_V2GMSG_Header(buf);
  1207. //none
  1208. }
  1209. /*===========================================================================
  1210. FUNCTION: SHM_Save_iso1_AuthorizationReq
  1211. DESCRIPTION:
  1212. PRE-CONDITION:
  1213. INPUT:
  1214. OUTPUT:
  1215. GLOBAL VARIABLES:
  1216. =============================================================================*/
  1217. void SHM_Save_iso1_AuthorizationReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1218. {
  1219. // ======== [STEP 1/3] Initialize ========
  1220. //int i = 0;
  1221. //struct AuthorizationRequest_ISO15118_2014 *shm_msg;
  1222. //struct iso1AuthorizationReqType *exi;
  1223. //shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.AuthorizationRequest;
  1224. // exi = &exi_doc_ISO1->V2G_Message.Body.AuthorizationReq;
  1225. // ======== [STEP 2/3] Update Flags ========
  1226. // ======== [STEP 3/3] Transfer Data ========
  1227. //SHM_Save_iso1_V2GMSG_Header(buf);
  1228. //none
  1229. }
  1230. /*===========================================================================
  1231. FUNCTION: SHM_Save_din_ChargeParameterDiscoveryReq
  1232. DESCRIPTION: Save into share memories
  1233. (1) ShmCcsData (shm_ccs)
  1234. (2) ShmSysConfigAndInfo (shm_sys)
  1235. PRE-CONDITION:
  1236. INPUT:
  1237. OUTPUT:
  1238. GLOBAL VARIABLES:
  1239. =============================================================================*/
  1240. void SHM_Save_din_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1241. {
  1242. // ======== [STEP 1/3] Initialize ========
  1243. //int i = 0;
  1244. struct ChargeParameterDiscoveryRequest_DIN70121 *shm_msg;
  1245. struct dinChargeParameterDiscoveryReqType *exi;
  1246. struct ChargingInfoData *sys;
  1247. shm_msg = &shm_ccs->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest;
  1248. exi = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq;
  1249. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1250. // ======== [STEP 2/3] Update Flags ========
  1251. // ======== [STEP 3/3] Transfer Data ========
  1252. //SHM_Save_din_V2GMSG_Header(buf);
  1253. //===== [BODY (1/9)] EVRequestedEnergyTransferType =====
  1254. shm_msg->EVRequestedEnergyTransferType = (unsigned char) exi->EVRequestedEnergyTransferType;
  1255. //===== [BODY (2/9)] DC_EVChargeParameter of EVChargeParameter =====
  1256. //DC_EVStatus
  1257. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVReady;
  1258. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVCabinConditioning;
  1259. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSConditioning;
  1260. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVErrorCode;
  1261. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
  1262. sys->EvBatterySoc = (int) shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
  1263. //[BODY (3/9)] EVMaximumCurrentLimit
  1264. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier =
  1265. (int) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier;
  1266. //shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit;
  1267. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = A_DIN70121;
  1268. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Value =
  1269. (short) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Value;
  1270. sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit);
  1271. //[BODY (4/9)] EVMaximumPowerLimit
  1272. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier =
  1273. (int) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier;
  1274. //shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Unit;
  1275. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = W_DIN70121;
  1276. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Value =
  1277. (short) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Value;
  1278. sys->EvBatteryMaxPower = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit);
  1279. //[BODY (5/9)] EVMaximumVoltageLimit
  1280. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier =
  1281. (int) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier;
  1282. //shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit;
  1283. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = V_DIN70121;
  1284. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Value =
  1285. (short) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Value;
  1286. sys->EvBatteryMaxVoltage = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit);
  1287. //[BODY (6/9)] EVEnergyCapacity
  1288. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Multiplier =
  1289. (int) exi->DC_EVChargeParameter.EVEnergyCapacity.Multiplier;
  1290. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Unit = WH_DIN70121;
  1291. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Value =
  1292. (short) exi->DC_EVChargeParameter.EVEnergyCapacity.Value;
  1293. sys->EvBatteryCapacity = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyCapacity);
  1294. //[BODY (7/9)] EVEnergyRequest
  1295. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Multiplier =
  1296. (int) exi->DC_EVChargeParameter.EVEnergyRequest.Multiplier;
  1297. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Unit = WH_DIN70121;
  1298. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Value =
  1299. (short) exi->DC_EVChargeParameter.EVEnergyRequest.Value;
  1300. sys->EvBatteryEngergyRequest = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyRequest);
  1301. //[BODY (8/9)] FullSOC
  1302. if (exi->DC_EVChargeParameter.FullSOC_isUsed != 0 && exi->DC_EVChargeParameter.FullSOC != 0)
  1303. {
  1304. shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.FullSOC;
  1305. }
  1306. else
  1307. {
  1308. shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
  1309. }
  1310. //[BODY (9/9)] BulkSOC
  1311. shm_msg->DC_EVChargeParameter.BulkSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
  1312. }
  1313. /*===========================================================================
  1314. FUNCTION: SHM_Save_iso1_ChargeParameterDiscoveryReq
  1315. DESCRIPTION: Save into share memories
  1316. (1) ShmCcsData (shm_ccs)
  1317. (2) ShmSysConfigAndInfo (shm_sys)
  1318. PRE-CONDITION:
  1319. INPUT:
  1320. OUTPUT:
  1321. GLOBAL VARIABLES:
  1322. =============================================================================*/
  1323. void SHM_Save_iso1_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1324. {
  1325. // ======== [STEP 1/3] Initialize ========
  1326. //int i = 0;
  1327. struct ChargeParameterDiscoveryRequest_ISO15118_2014 *shm_msg;
  1328. struct iso1ChargeParameterDiscoveryReqType *exi;
  1329. struct ChargingInfoData *sys;
  1330. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest;
  1331. exi = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq;
  1332. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1333. // ======== [STEP 2/3] Update Flags ========
  1334. // ======== [STEP 3/3] Transfer Data ========
  1335. //SHM_Save_iso1_V2GMSG_Header(buf);
  1336. //===== [BODY (1/9)] EVRequestedEnergyTransferType =====
  1337. shm_msg->RequestedEnergyTransferMode = (unsigned char) exi->RequestedEnergyTransferMode;
  1338. //===== [BODY (2/9)] DC_EVChargeParameter of EVChargeParameter =====
  1339. //DC_EVStatus
  1340. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVReady;
  1341. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVErrorCode;
  1342. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
  1343. sys->EvBatterySoc = (int) shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
  1344. //[BODY (3/9)] EVMaximumCurrentLimit
  1345. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier =
  1346. (int) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier;
  1347. //shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit;
  1348. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = A_ISO15118_2014;
  1349. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Value =
  1350. (short) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Value;
  1351. sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit);
  1352. //[BODY (4/9)] EVMaximumPowerLimit
  1353. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier =
  1354. (int) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier;
  1355. //shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Unit;
  1356. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = W_ISO15118_2014;
  1357. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Value =
  1358. (short) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Value;
  1359. sys->EvBatteryMaxPower = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit);
  1360. //[BODY (5/9)] EVMaximumVoltageLimit
  1361. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier =
  1362. (int) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier;
  1363. //shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit;
  1364. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = V_ISO15118_2014;
  1365. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Value =
  1366. (short) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Value;
  1367. sys->EvBatteryMaxVoltage = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit);
  1368. //[BODY (6/9)] EVEnergyCapacity
  1369. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Multiplier =
  1370. (int) exi->DC_EVChargeParameter.EVEnergyCapacity.Multiplier;
  1371. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Unit = Wh_ISO15118_2014;
  1372. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Value =
  1373. (short) exi->DC_EVChargeParameter.EVEnergyCapacity.Value;
  1374. sys->EvBatteryCapacity = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyCapacity);
  1375. //[BODY (7/9)] EVEnergyRequest
  1376. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Multiplier =
  1377. (int) exi->DC_EVChargeParameter.EVEnergyRequest.Multiplier;
  1378. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Unit = Wh_ISO15118_2014;
  1379. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Value =
  1380. (short) exi->DC_EVChargeParameter.EVEnergyRequest.Value;
  1381. sys->EvBatteryEngergyRequest = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyRequest);
  1382. //[BODY (8/9)] FullSOC
  1383. if (exi->DC_EVChargeParameter.FullSOC_isUsed != 0 && exi->DC_EVChargeParameter.FullSOC != 0)
  1384. {
  1385. shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.FullSOC;
  1386. }
  1387. else
  1388. {
  1389. shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
  1390. }
  1391. //[BODY (9/9)] BulkSOC
  1392. shm_msg->DC_EVChargeParameter.BulkSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
  1393. }
  1394. /*===========================================================================
  1395. FUNCTION: SHM_Save_din_CableCheckReq
  1396. DESCRIPTION:
  1397. PRE-CONDITION:
  1398. INPUT:
  1399. OUTPUT:
  1400. GLOBAL VARIABLES:
  1401. =============================================================================*/
  1402. void SHM_Save_din_CableCheckReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1403. {
  1404. // ======== [STEP 1/3] Initialize ========
  1405. struct CableCheckRequest_DIN70121 *shm_msg;
  1406. struct dinCableCheckReqType *exi;
  1407. struct ChargingInfoData *sys;
  1408. shm_msg = &shm_ccs->V2GMessage_DIN70121.CableCheckRequest;
  1409. exi = &exi_doc_DIN->V2G_Message.Body.CableCheckReq;
  1410. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1411. // ======== [STEP 2/3] Update Flags ========
  1412. // ======== [STEP 3/3] Transfer Data ========
  1413. //SHM_Save_din_V2GMSG_Header(buf);
  1414. //===== [BODY (1/1)] DC_EVStatus =====
  1415. //DC_EVStatus
  1416. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1417. shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
  1418. shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
  1419. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1420. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1421. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1422. //Check for EVReady
  1423. //if (shm_msg->DC_EVStatus.EVReady == TRUE && shm_msg->DC_EVStatus.EVErrorCode == NO_ERROR)
  1424. //{
  1425. //sys->ConnectorLocked = TRUE; //Inicating EVSE that the CCS Connector is Locked.
  1426. //}
  1427. }
  1428. /*===========================================================================
  1429. FUNCTION: SHM_Save_iso1_CableCheckReq
  1430. DESCRIPTION:
  1431. PRE-CONDITION:
  1432. INPUT:
  1433. OUTPUT:
  1434. GLOBAL VARIABLES:
  1435. =============================================================================*/
  1436. void SHM_Save_iso1_CableCheckReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1437. {
  1438. // ======== [STEP 1/3] Initialize ========
  1439. struct CableCheckRequest_ISO15118_2014 *shm_msg;
  1440. struct iso1CableCheckReqType *exi;
  1441. struct ChargingInfoData *sys;
  1442. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.CableCheckRequest;
  1443. exi = &exi_doc_ISO1->V2G_Message.Body.CableCheckReq;
  1444. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1445. // ======== [STEP 2/3] Update Flags ========
  1446. // ======== [STEP 3/3] Transfer Data ========
  1447. //SHM_Save_iso1_V2GMSG_Header(buf);
  1448. //===== [BODY (1/1)] DC_EVStatus =====
  1449. //DC_EVStatus
  1450. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1451. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1452. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1453. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1454. //Check for EVReady
  1455. //if (shm_msg->DC_EVStatus.EVReady == TRUE && shm_msg->DC_EVStatus.EVErrorCode == NO_ERROR)
  1456. //{
  1457. //sys->ConnectorLocked = TRUE; //Inicating EVSE that the CCS Connector is Locked.
  1458. //}
  1459. }
  1460. /*===========================================================================
  1461. FUNCTION: SHM_Save_din_PreChargeReq
  1462. DESCRIPTION:
  1463. PRE-CONDITION:
  1464. INPUT:
  1465. OUTPUT:
  1466. GLOBAL VARIABLES:
  1467. =============================================================================*/
  1468. void SHM_Save_din_PreChargeReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1469. {
  1470. // ======== [STEP 1/3] Initialize ========
  1471. struct PreChargeRequest_DIN70121 *shm_msg;
  1472. struct dinPreChargeReqType *exi;
  1473. struct ChargingInfoData *sys;
  1474. shm_msg = &shm_ccs->V2GMessage_DIN70121.PreChargeRequest;
  1475. exi = &exi_doc_DIN->V2G_Message.Body.PreChargeReq;
  1476. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1477. shm_msg->cnt++;
  1478. // ======== [STEP 2/3] Update Flags ========
  1479. // ======== [STEP 3/3] Transfer Data ========
  1480. //SHM_Save_din_V2GMSG_Header(buf);
  1481. //===== [BODY (1/3)] DC_EVStatus =====
  1482. //DC_EVStatus
  1483. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1484. shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
  1485. shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
  1486. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1487. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1488. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1489. //[BODY (2/3)] EVTargetVoltage
  1490. shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
  1491. //shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
  1492. shm_msg->EVTargetVoltage.Unit = V_DIN70121;
  1493. shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
  1494. if ((sys->EVSEPrechargeStatus == EVSE_STATUS_NOT_READY_FOR_PRECHARGE) || (shm_msg->cnt <= 2)) //0
  1495. {
  1496. sys->EvBatterytargetVoltage = 0; //0V, in order to avoid of turning off relay when D+/D- owns voltage.
  1497. }
  1498. else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
  1499. {
  1500. sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage);
  1501. //sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + 5; //for test, add 10V
  1502. }
  1503. //[BODY (3/3)] EVTargetCurrent
  1504. shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
  1505. //shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
  1506. shm_msg->EVTargetCurrent.Unit = A_DIN70121;
  1507. shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
  1508. if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
  1509. {
  1510. //sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
  1511. sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT; //for EVSE (default: 2A)
  1512. }
  1513. else
  1514. {
  1515. sys->EvBatterytargetCurrent = 0; //0A
  1516. }
  1517. //printf("\n\n[%d-th]sys-EvBatterytargetVoltage = %.02f (ori = %d)\n\n", cnt, sys->EvBatterytargetVoltage, shm_msg->EVTargetVoltage.Value);
  1518. }
  1519. /*===========================================================================
  1520. FUNCTION: SHM_Save_iso1_PreChargeReq
  1521. DESCRIPTION:
  1522. PRE-CONDITION:
  1523. INPUT:
  1524. OUTPUT:
  1525. GLOBAL VARIABLES:
  1526. =============================================================================*/
  1527. void SHM_Save_iso1_PreChargeReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1528. {
  1529. // ======== [STEP 1/3] Initialize ========
  1530. struct PreChargeRequest_ISO15118_2014 *shm_msg;
  1531. struct iso1PreChargeReqType *exi;
  1532. struct ChargingInfoData *sys;
  1533. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.PreChargeRequest;
  1534. exi = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq;
  1535. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1536. shm_msg->cnt++;
  1537. // ======== [STEP 2/3] Update Flags ========
  1538. // ======== [STEP 3/3] Transfer Data ========
  1539. //SHM_Save_iso1_V2GMSG_Header(buf);
  1540. //===== [BODY (1/3)] DC_EVStatus =====
  1541. //DC_EVStatus
  1542. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1543. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1544. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1545. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1546. //[BODY (2/3)] EVTargetVoltage
  1547. shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
  1548. //shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
  1549. shm_msg->EVTargetVoltage.Unit = V_ISO15118_2014;
  1550. shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
  1551. if ((sys->EVSEPrechargeStatus == EVSE_STATUS_NOT_READY_FOR_PRECHARGE) || (shm_msg->cnt <= 2)) //0
  1552. {
  1553. sys->EvBatterytargetVoltage = 0; //0V, in order to avoid of turning off relay when D+/D- owns voltage.
  1554. }
  1555. else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
  1556. {
  1557. sys->EvBatterytargetVoltage = ISO151182014PhyValDecode(shm_msg->EVTargetVoltage);
  1558. }
  1559. //[BODY (3/3)] EVTargetCurrent
  1560. shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
  1561. //shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
  1562. shm_msg->EVTargetCurrent.Unit = A_ISO15118_2014;
  1563. shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
  1564. if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
  1565. {
  1566. //sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
  1567. sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT; //for EVSE (default: 2A)
  1568. }
  1569. else
  1570. {
  1571. sys->EvBatterytargetCurrent = 0; //0A
  1572. }
  1573. //printf("\n\n[%d-th]sys-EvBatterytargetVoltage = %.02f (ori = %d)\n\n", cnt, sys->EvBatterytargetVoltage, shm_msg->EVTargetVoltage.Value);
  1574. }
  1575. /*===========================================================================
  1576. FUNCTION: SHM_Save_din_PowerDeliveryReq
  1577. DESCRIPTION:
  1578. PRE-CONDITION:
  1579. INPUT:
  1580. OUTPUT:
  1581. GLOBAL VARIABLES:
  1582. =============================================================================*/
  1583. void SHM_Save_din_PowerDeliveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1584. {
  1585. // ======== [STEP 1/3] Initialize ========
  1586. //int i = 0;
  1587. struct PowerDeliveryRequest_DIN70121 *shm_msg;
  1588. struct dinPowerDeliveryReqType *exi;
  1589. struct ChargingInfoData *sys;
  1590. shm_msg = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryRequest;
  1591. exi = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq;
  1592. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1593. // ======== [STEP 2/3] Update Flags ========
  1594. // ======== [STEP 3/3] Transfer Data ========
  1595. //SHM_Save_din_V2GMSG_Header(buf);
  1596. //[BODY (1/3)] ReadyToChargeState
  1597. shm_msg->ReadyToChargeState = (BOOL) exi->ReadyToChargeState;
  1598. //[BODY (2/3)] ChargingProfile
  1599. //[BODY (3/3)] DC_EVPowerDeliveryParameters
  1600. //DC_EVStatus
  1601. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady;
  1602. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVCabinConditioning;
  1603. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSConditioning;
  1604. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode;
  1605. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
  1606. sys->EvBatterySoc = (int) shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
  1607. //BulkChargingComplete
  1608. shm_msg->DC_EVPowerDeliveryParameter.BulkChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.BulkChargingComplete;
  1609. //ChargingComplete
  1610. shm_msg->DC_EVPowerDeliveryParameter.ChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.ChargingComplete;
  1611. }
  1612. /*===========================================================================
  1613. FUNCTION: SHM_Save_iso1_PowerDeliveryReq
  1614. DESCRIPTION:
  1615. PRE-CONDITION:
  1616. INPUT:
  1617. OUTPUT:
  1618. GLOBAL VARIABLES:
  1619. =============================================================================*/
  1620. void SHM_Save_iso1_PowerDeliveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1621. {
  1622. // ======== [STEP 1/3] Initialize ========
  1623. //int i = 0;
  1624. struct PowerDeliveryRequest_ISO15118_2014 *shm_msg;
  1625. struct iso1PowerDeliveryReqType *exi;
  1626. struct ChargingInfoData *sys;
  1627. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.PowerDeliveryRequest;
  1628. exi = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq;
  1629. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1630. // ======== [STEP 2/3] Update Flags ========
  1631. // ======== [STEP 3/3] Transfer Data ========
  1632. //SHM_Save_iso1_V2GMSG_Header(buf);
  1633. //[BODY (1/3)] ChargeProgress
  1634. shm_msg->ChargeProgress = (BOOL) exi->ChargeProgress;
  1635. //[BODY (2/3)] ChargingProfile
  1636. //[BODY (3/3)] DC_EVPowerDeliveryParameters
  1637. //DC_EVStatus
  1638. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady;
  1639. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode;
  1640. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
  1641. sys->EvBatterySoc = (int) shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
  1642. //BulkChargingComplete
  1643. shm_msg->DC_EVPowerDeliveryParameter.BulkChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.BulkChargingComplete;
  1644. //ChargingComplete
  1645. shm_msg->DC_EVPowerDeliveryParameter.ChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.ChargingComplete;
  1646. }
  1647. /*===========================================================================
  1648. FUNCTION: SHM_Save_din_CurrentDemandReq
  1649. DESCRIPTION:
  1650. PRE-CONDITION:
  1651. INPUT:
  1652. OUTPUT:
  1653. GLOBAL VARIABLES:
  1654. =============================================================================*/
  1655. void SHM_Save_din_CurrentDemandReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1656. {
  1657. // ======== [STEP 1/3] Initialize ========
  1658. //int i = 0;
  1659. struct CurrentDemandRequest_DIN70121 *shm_msg;
  1660. struct dinCurrentDemandReqType *exi;
  1661. struct ChargingInfoData *sys;
  1662. shm_msg = &shm_ccs->V2GMessage_DIN70121.CurrentDemandRequest;
  1663. exi = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq;
  1664. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1665. // ======== [STEP 2/3] Update Flags ========
  1666. // ======== [STEP 3/3] Transfer Data ========
  1667. //SHM_Save_din_V2GMSG_Header(buf);
  1668. //[BODY (1/10)] DC_EVStatus
  1669. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1670. shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
  1671. shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
  1672. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1673. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1674. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1675. //[BODY (2/10)] EVTargetCurrent
  1676. shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
  1677. //shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
  1678. shm_msg->EVTargetCurrent.Unit = A_DIN70121;
  1679. shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
  1680. if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_ENERGY_TRANSFER) //3 (Precharge Relay OFF, DC+ Relay ON)
  1681. {
  1682. sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
  1683. #if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
  1684. sys->EvBatterytargetCurrent = SUDO_EV_TARGET_CURRENT; //60A, for test;
  1685. #endif
  1686. }
  1687. else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2 (Precharge Relay ON, DC+ Relay OFF)
  1688. {
  1689. //sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT; //2A, unit: 1A
  1690. sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
  1691. }
  1692. else //0 (Precharge Relay is still under preparing, not ON, yet.)
  1693. {
  1694. //sys->EvBatterytargetCurrent = 0; //0A
  1695. sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
  1696. }
  1697. //[BODY (3/10)] EVMaximumVoltageLimit
  1698. shm_msg->EVMaximumVoltageLimit.Multiplier = (int) exi->EVMaximumVoltageLimit.Multiplier;
  1699. //shm_msg->EVMaximumVoltageLimit.Unit = (unsigned char) exi->EVMaximumVoltageLimit.Unit;
  1700. shm_msg->EVMaximumVoltageLimit.Unit = V_DIN70121;
  1701. shm_msg->EVMaximumVoltageLimit.Value = (short) exi->EVMaximumVoltageLimit.Value;
  1702. if (shm_msg->EVMaximumVoltageLimit.Value != 0 && exi->EVMaximumVoltageLimit_isUsed == 1u) //Gridwiz EVCC Emulator will not send EVMaximumVoltageLimit in CurrentDemandReq
  1703. {
  1704. sys->EvBatteryMaxVoltage = DIN70121PhyValDecode(shm_msg->EVMaximumVoltageLimit);
  1705. }
  1706. //[BODY (4/10)] EVMaximumCurrentLimit
  1707. shm_msg->EVMaximumCurrentLimit.Multiplier = (int) exi->EVMaximumCurrentLimit.Multiplier;
  1708. //shm_msg->EVMaximumCurrentLimit.Unit = (unsigned char) exi->EVMaximumCurrentLimit.Unit;
  1709. shm_msg->EVMaximumCurrentLimit.Unit = A_DIN70121;
  1710. shm_msg->EVMaximumCurrentLimit.Value = (short) exi->EVMaximumCurrentLimit.Value;
  1711. sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->EVMaximumCurrentLimit);
  1712. //[BODY (5/10)] EVMaximumPowerLimit
  1713. shm_msg->EVMaximumPowerLimit.Multiplier = (int) exi->EVMaximumPowerLimit.Multiplier;
  1714. //shm_msg->EVMaximumPowerLimit.Unit = (unsigned char) exi->EVMaximumPowerLimit.Unit;
  1715. shm_msg->EVMaximumPowerLimit.Unit = W_DIN70121;
  1716. shm_msg->EVMaximumPowerLimit.Value = (short) exi->EVMaximumPowerLimit.Value;
  1717. sys->EvBatteryMaxPower = DIN70121PhyValDecode(shm_msg->EVMaximumPowerLimit);
  1718. //[BODY (6/10)] BulkChargingComplete
  1719. shm_msg->BulkChargingComplete = (BOOL) exi->BulkChargingComplete;
  1720. //[BODY (7/10)] ChargingComplete
  1721. shm_msg->ChargingComplete = (BOOL) exi->ChargingComplete;
  1722. //[BODY (8/10)] RemainingTimeToFullSoC
  1723. shm_msg->RemainingTimeToFullSoC.Multiplier = (int) exi->RemainingTimeToFullSoC.Multiplier;
  1724. shm_msg->RemainingTimeToFullSoC.Unit = (unsigned char) exi->RemainingTimeToFullSoC.Unit;
  1725. shm_msg->RemainingTimeToFullSoC.Value = (short) exi->RemainingTimeToFullSoC.Value;
  1726. sys->RemainChargingDuration = DIN70121PhyValDecode(shm_msg->RemainingTimeToFullSoC);
  1727. //[BODY (9/10)] RemainingTimeToBulkSoC
  1728. shm_msg->RemainingTimeToBulkSoC.Multiplier = (int) exi->RemainingTimeToBulkSoC.Multiplier;
  1729. shm_msg->RemainingTimeToBulkSoC.Unit = (unsigned char) exi->RemainingTimeToBulkSoC.Unit;
  1730. shm_msg->RemainingTimeToBulkSoC.Value = (short) exi->RemainingTimeToBulkSoC.Value;
  1731. //[BODY (10/10)] EVTargetVoltage
  1732. shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
  1733. //shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
  1734. shm_msg->EVTargetVoltage.Unit = V_DIN70121;
  1735. shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
  1736. if((shm_msg->EVTargetVoltage.Value != 0) && (sys->EvBatteryMaxVoltage != 0))
  1737. {
  1738. sys->EvBatterytargetVoltage = (DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
  1739. }
  1740. else
  1741. {
  1742. sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage);
  1743. }
  1744. #if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
  1745. sys->EvBatterytargetVoltage = SUDO_EV_TARGET_VOLTAGE; //for test (500V, unit: 1V)
  1746. #endif
  1747. }
  1748. /*===========================================================================
  1749. FUNCTION: SHM_Save_iso1_CurrentDemandReq
  1750. DESCRIPTION:
  1751. PRE-CONDITION:
  1752. INPUT:
  1753. OUTPUT:
  1754. GLOBAL VARIABLES:
  1755. =============================================================================*/
  1756. void SHM_Save_iso1_CurrentDemandReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1757. {
  1758. // ======== [STEP 1/3] Initialize ========
  1759. //int i = 0;
  1760. struct CurrentDemandRequest_ISO15118_2014 *shm_msg;
  1761. struct iso1CurrentDemandReqType *exi;
  1762. struct ChargingInfoData *sys;
  1763. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.CurrentDemandRequest;
  1764. exi = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq;
  1765. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1766. // ======== [STEP 2/3] Update Flags ========
  1767. // ======== [STEP 3/3] Transfer Data ========
  1768. //SHM_Save_iso1_V2GMSG_Header(buf);
  1769. //[BODY (1/10)] DC_EVStatus
  1770. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1771. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1772. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1773. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1774. //[BODY (2/10)] EVTargetCurrent
  1775. shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
  1776. //shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
  1777. shm_msg->EVTargetCurrent.Unit = A_ISO15118_2014;
  1778. shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
  1779. if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_ENERGY_TRANSFER) //3 (Precharge Relay OFF, DC+ Relay ON)
  1780. {
  1781. sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
  1782. #if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
  1783. sys->EvBatterytargetCurrent = SUDO_EV_TARGET_CURRENT; //60A, for test;
  1784. #endif
  1785. }
  1786. else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2 (Precharge Relay ON, DC+ Relay OFF)
  1787. {
  1788. //sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT; //2A, unit: 1A
  1789. sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
  1790. }
  1791. else //0 (Precharge Relay is still under preparing, not ON, yet.)
  1792. {
  1793. //sys->EvBatterytargetCurrent = 0; //0A
  1794. sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
  1795. }
  1796. //[BODY (3/10)] EVMaximumVoltageLimit
  1797. shm_msg->EVMaximumVoltageLimit.Multiplier = (int) exi->EVMaximumVoltageLimit.Multiplier;
  1798. //shm_msg->EVMaximumVoltageLimit.Unit = (unsigned char) exi->EVMaximumVoltageLimit.Unit;
  1799. shm_msg->EVMaximumVoltageLimit.Unit = V_ISO15118_2014;
  1800. shm_msg->EVMaximumVoltageLimit.Value = (short) exi->EVMaximumVoltageLimit.Value;
  1801. if (shm_msg->EVMaximumVoltageLimit.Value != 0 && exi->EVMaximumVoltageLimit_isUsed == 1u) //Gridwiz EVCC Emulator will not send EVMaximumVoltageLimit in CurrentDemandReq
  1802. {
  1803. sys->EvBatteryMaxVoltage = ISO151182014PhyValDecode(shm_msg->EVMaximumVoltageLimit);
  1804. }
  1805. /*
  1806. printf("[SeccComm] <V_ev_max> = %d, %d, %.02f\n",
  1807. exi->EVMaximumVoltageLimit.Value,
  1808. shm_msg->EVMaximumVoltageLimit.Value,
  1809. sys->EvBatteryMaxVoltage
  1810. );
  1811. */
  1812. //[BODY (4/10)] EVMaximumCurrentLimit
  1813. shm_msg->EVMaximumCurrentLimit.Multiplier = (int) exi->EVMaximumCurrentLimit.Multiplier;
  1814. //shm_msg->EVMaximumCurrentLimit.Unit = (unsigned char) exi->EVMaximumCurrentLimit.Unit;
  1815. shm_msg->EVMaximumCurrentLimit.Unit = A_ISO15118_2014;
  1816. shm_msg->EVMaximumCurrentLimit.Value = (short) exi->EVMaximumCurrentLimit.Value;
  1817. sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->EVMaximumCurrentLimit);
  1818. //[BODY (5/10)] EVMaximumPowerLimit
  1819. shm_msg->EVMaximumPowerLimit.Multiplier = (int) exi->EVMaximumPowerLimit.Multiplier;
  1820. //shm_msg->EVMaximumPowerLimit.Unit = (unsigned char) exi->EVMaximumPowerLimit.Unit;
  1821. shm_msg->EVMaximumPowerLimit.Unit = W_ISO15118_2014;
  1822. shm_msg->EVMaximumPowerLimit.Value = (short) exi->EVMaximumPowerLimit.Value;
  1823. sys->EvBatteryMaxPower = ISO151182014PhyValDecode(shm_msg->EVMaximumPowerLimit);
  1824. //[BODY (6/10)] BulkChargingComplete
  1825. shm_msg->BulkChargingComplete = (BOOL) exi->BulkChargingComplete;
  1826. //[BODY (7/10)] ChargingComplete
  1827. shm_msg->ChargingComplete = (BOOL) exi->ChargingComplete;
  1828. //[BODY (8/10)] RemainingTimeToFullSoC
  1829. shm_msg->RemainingTimeToFullSoC.Multiplier = (int) exi->RemainingTimeToFullSoC.Multiplier;
  1830. shm_msg->RemainingTimeToFullSoC.Unit = (unsigned char) exi->RemainingTimeToFullSoC.Unit;
  1831. shm_msg->RemainingTimeToFullSoC.Value = (short) exi->RemainingTimeToFullSoC.Value;
  1832. sys->RemainChargingDuration = ISO151182014PhyValDecode(shm_msg->RemainingTimeToFullSoC);
  1833. //[BODY (9/10)] RemainingTimeToBulkSoC
  1834. shm_msg->RemainingTimeToBulkSoC.Multiplier = (int) exi->RemainingTimeToBulkSoC.Multiplier;
  1835. shm_msg->RemainingTimeToBulkSoC.Unit = (unsigned char) exi->RemainingTimeToBulkSoC.Unit;
  1836. shm_msg->RemainingTimeToBulkSoC.Value = (short) exi->RemainingTimeToBulkSoC.Value;
  1837. //[BODY (10/10)] EVTargetVoltage
  1838. shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
  1839. //shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
  1840. shm_msg->EVTargetVoltage.Unit = V_ISO15118_2014;
  1841. shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
  1842. if((shm_msg->EVTargetVoltage.Value != 0) && (sys->EvBatteryMaxVoltage != 0))
  1843. {
  1844. sys->EvBatterytargetVoltage = (ISO151182014PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
  1845. }
  1846. else
  1847. {
  1848. sys->EvBatterytargetVoltage = ISO151182014PhyValDecode(shm_msg->EVTargetVoltage);
  1849. }
  1850. /*
  1851. printf("[SeccComm] <V_ev_target> = %d, %d, %.02f\n",
  1852. exi->EVTargetVoltage.Value,
  1853. shm_msg->EVTargetVoltage.Value,
  1854. sys->EvBatterytargetVoltage
  1855. );
  1856. */
  1857. #if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
  1858. sys->EvBatterytargetVoltage = SUDO_EV_TARGET_VOLTAGE; //for test (500V, unit: 1V)
  1859. #endif
  1860. }
  1861. /*===========================================================================
  1862. FUNCTION: SHM_Save_iso1_ChargingStatusReq
  1863. DESCRIPTION:
  1864. PRE-CONDITION:
  1865. INPUT:
  1866. OUTPUT:
  1867. GLOBAL VARIABLES:
  1868. =============================================================================*/
  1869. void SHM_Save_iso1_ChargingStatusReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1870. {
  1871. //no content for ISO1
  1872. }
  1873. /*===========================================================================
  1874. FUNCTION: SHM_Save_din_WeldingDetectionReq
  1875. DESCRIPTION:
  1876. PRE-CONDITION:
  1877. INPUT:
  1878. OUTPUT:
  1879. GLOBAL VARIABLES:
  1880. =============================================================================*/
  1881. void SHM_Save_din_WeldingDetectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1882. {
  1883. // ======== [STEP 1/3] Initialize ========
  1884. //int i = 0;
  1885. struct WeldingDetectionRequest_DIN70121 *shm_msg;
  1886. struct dinWeldingDetectionReqType *exi;
  1887. struct ChargingInfoData *sys;
  1888. shm_msg = &shm_ccs->V2GMessage_DIN70121.WeldingDetectionRequest;
  1889. exi = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq;
  1890. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1891. // ======== [STEP 2/3] Update Flags ========
  1892. // ======== [STEP 3/3] Transfer Data ========
  1893. //SHM_Save_din_V2GMSG_Header(buf);
  1894. //===== [BODY (1/3)] DC_EVStatus =====
  1895. //DC_EVStatus
  1896. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1897. shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
  1898. shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
  1899. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1900. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1901. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1902. }
  1903. /*===========================================================================
  1904. FUNCTION: SHM_Save_iso1_WeldingDetectionReq
  1905. DESCRIPTION:
  1906. PRE-CONDITION:
  1907. INPUT:
  1908. OUTPUT:
  1909. GLOBAL VARIABLES:
  1910. =============================================================================*/
  1911. void SHM_Save_iso1_WeldingDetectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1912. {
  1913. // ======== [STEP 1/3] Initialize ========
  1914. //int i = 0;
  1915. struct WeldingDetectionRequest_ISO15118_2014 *shm_msg;
  1916. struct iso1WeldingDetectionReqType *exi;
  1917. struct ChargingInfoData *sys;
  1918. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.WeldingDetectionRequest;
  1919. exi = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq;
  1920. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1921. // ======== [STEP 2/3] Update Flags ========
  1922. // ======== [STEP 3/3] Transfer Data ========
  1923. //SHM_Save_iso1_V2GMSG_Header(buf);
  1924. //===== [BODY (1/3)] DC_EVStatus =====
  1925. //DC_EVStatus
  1926. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1927. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1928. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1929. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1930. }
  1931. /*===========================================================================
  1932. FUNCTION: SHM_Save_din_SessionStopReq
  1933. DESCRIPTION:
  1934. PRE-CONDITION:
  1935. INPUT:
  1936. OUTPUT:
  1937. GLOBAL VARIABLES:
  1938. =============================================================================*/
  1939. void SHM_Save_din_SessionStopReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1940. {
  1941. // ======== [STEP 1/3] Initialize ========
  1942. /*
  1943. int i = 0;
  1944. struct SessionStopRequest_DIN70121 *shm_msg;
  1945. struct dinSessionStopReqType *exi;
  1946. shm_msg = &shm_ccs->V2GMessage_DIN70121.SessionStopRequest;
  1947. exi = &exi_doc_DIN->V2G_Message.Body.SessionStopReq;
  1948. */
  1949. // ======== [STEP 2/3] Update Flags ========
  1950. // ======== [STEP 3/3] Transfer Data ========
  1951. //SHM_Save_din_V2GMSG_Header(buf);
  1952. //null
  1953. }
  1954. /*===========================================================================
  1955. FUNCTION: SHM_Save_iso1_SessionStopReq
  1956. DESCRIPTION:
  1957. PRE-CONDITION:
  1958. INPUT:
  1959. OUTPUT:
  1960. GLOBAL VARIABLES:
  1961. =============================================================================*/
  1962. void SHM_Save_iso1_SessionStopReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1963. {
  1964. // ======== [STEP 1/3] Initialize ========
  1965. /*
  1966. int i = 0;
  1967. struct SessionStopRequest_ISO15118_2014 *shm_msg;
  1968. struct iso1SessionStopReqType *exi;
  1969. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.SessionStopRequest;
  1970. exi = &exi_doc_ISO1->V2G_Message.Body.SessionStopReq;
  1971. */
  1972. // ======== [STEP 2/3] Update Flags ========
  1973. // ======== [STEP 3/3] Transfer Data ========
  1974. //SHM_Save_iso1_V2GMSG_Header(buf);
  1975. //null
  1976. }
  1977. /*===========================================================================
  1978. FUNCTION: SHM_Read_din_SessionSetupRes
  1979. DESCRIPTION:
  1980. PRE-CONDITION:
  1981. INPUT:
  1982. 1. shm_ccs
  1983. OUTPUT:
  1984. 2. exi_doc_DIN
  1985. GLOBAL VARIABLES:
  1986. =============================================================================*/
  1987. void SHM_Read_din_SessionSetupRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  1988. {
  1989. int i = 0;
  1990. struct dinSessionSetupResType *out;
  1991. struct SessionSetupResponse_DIN70121 *in;
  1992. out = &exi_doc_DIN->V2G_Message.Body.SessionSetupRes;
  1993. in = &shm_ccs->V2GMessage_DIN70121.SessionSetupResponse;
  1994. exi_doc_DIN->V2G_Message.Body.SessionSetupRes_isUsed = 1u;
  1995. // ====== [BODY (1/3) ResponseCode ======
  1996. out->ResponseCode = in->ResponseCode;
  1997. // ====== [BODY (2/3) EVSEID ======
  1998. out->EVSEID.bytesLen = 32; //max = 32 bytes(DIN), all zero
  1999. for (i = 0; i< 32; i++)
  2000. {
  2001. out->EVSEID.bytes[i] = (unsigned char) in->EVSEID[i];
  2002. }
  2003. // ====== [BODY (3/3) DateTimeNow ======
  2004. out->DateTimeNow_isUsed = 1u;
  2005. out->DateTimeNow = (int64_t) in->EVSETimeStamp; //Format: Unix Time Stamp
  2006. }
  2007. /*===========================================================================
  2008. FUNCTION: SHM_Read_din_ContractAuthenticationRes
  2009. DESCRIPTION:
  2010. PRE-CONDITION:
  2011. INPUT:
  2012. 1. shm_ccs
  2013. OUTPUT:
  2014. 2. exi_doc_DIN
  2015. GLOBAL VARIABLES:
  2016. =============================================================================*/
  2017. void SHM_Read_din_ContractAuthenticationRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2018. {
  2019. struct dinContractAuthenticationResType *out;
  2020. struct ContractAuthenticationResponse_DIN70121 *in;
  2021. out = &exi_doc_DIN->V2G_Message.Body.ContractAuthenticationRes;
  2022. in = &shm_ccs->V2GMessage_DIN70121.ContractAuthenticationResponse;
  2023. //[BODY (2/2)] EVSEProcessing
  2024. out->EVSEProcessing = (BOOL)in->EVSEProcessing; //0(Finished) or 1(Ongoing)
  2025. }
  2026. /*===========================================================================
  2027. FUNCTION: SHM_Read_din_ChargeParameterDiscoveryRes
  2028. DESCRIPTION:
  2029. PRE-CONDITION:
  2030. INPUT:
  2031. 1. shm_ccs
  2032. OUTPUT:
  2033. 2. exi_doc_DIN
  2034. GLOBAL VARIABLES:
  2035. =============================================================================*/
  2036. void SHM_Read_din_ChargeParameterDiscoveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2037. {
  2038. struct dinChargeParameterDiscoveryResType *out;
  2039. struct ChargeParameterDiscoveryResponse_DIN70121 *in;
  2040. out = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryRes;
  2041. in = &shm_ccs->V2GMessage_DIN70121.ChargeParameterDiscoveryResponse;
  2042. //Initialize
  2043. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2044. init_dinChargeParameterDiscoveryResType(out);
  2045. exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
  2046. //----- [BODY (1/5)] ResponseCode -----
  2047. out->ResponseCode = (unsigned char) in->ResponseCode;
  2048. //----- [BODY (2/5)] EVSEProcessing -----
  2049. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2050. // dinEVSEProcessingType_Finished = 0,
  2051. // dinEVSEProcessingType_Ongoing = 1
  2052. //----- [BODY (3/5)] SAScheduleList of SASchedules -----
  2053. //[Joseph] Here keep constant values and not copy from share memory, yet.
  2054. out->SAScheduleList_isUsed = 1u;
  2055. struct dinSAScheduleListType *list;
  2056. list = &out->SAScheduleList;
  2057. //
  2058. list->SAScheduleTuple.arrayLen = 1;
  2059. list->SAScheduleTuple.array[0].SAScheduleTupleID = 0;
  2060. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleID = 0;
  2061. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
  2062. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
  2063. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
  2064. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = 86400; //24Hrs at least, unit:second
  2065. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
  2066. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
  2067. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 600;
  2068. //list->SAScheduleTuple.array[0].SalesTariff.xxx
  2069. //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
  2070. //----- [BODY (4/5)] AC_EVSEChargeParameter of EVSEChargeParameter -----
  2071. //ignore, since DIN doesn't support AC
  2072. //----- [BODY (5/5)] DC_EVSEChargeParameter of EVSEChargeParameter -----
  2073. out->DC_EVSEChargeParameter_isUsed = 1u;
  2074. struct dinDC_EVSEChargeParameterType *out_dc_para;
  2075. struct DC_EVSEChargeParameterType_DIN70121 *in_dc_para;
  2076. out_dc_para = &out->DC_EVSEChargeParameter;
  2077. in_dc_para = &in->DC_EVSEChargeParameter;
  2078. //DC_EVSEStatus
  2079. out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
  2080. SHM_Read_dinDC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
  2081. //EVSEMaximumCurrentLimit
  2082. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
  2083. //EVSEMaximumPowerLimit
  2084. out_dc_para->EVSEMaximumPowerLimit_isUsed = 1u;
  2085. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
  2086. //EVSEMaximumVoltageLimit
  2087. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
  2088. //EVSEMinimumVoltageLimit
  2089. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
  2090. //EVSEMinimumCurrentLimit
  2091. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
  2092. //EVSECurrentRegulationTolerance_isUsed
  2093. out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
  2094. //EVSECurrentRegulationTolerance
  2095. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
  2096. //EVSEEnergyToBeDelivered_isUsed
  2097. out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
  2098. //EVSEEnergyToBeDelivered (optional)
  2099. //SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
  2100. //EVSEPeakCurrentRipple
  2101. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
  2102. }
  2103. /*===========================================================================
  2104. FUNCTION: SHM_Read_iso1_ChargeParameterDiscoveryRes
  2105. DESCRIPTION:
  2106. PRE-CONDITION:
  2107. INPUT:
  2108. 1. shm_ccs
  2109. OUTPUT:
  2110. 2. exi_doc_ISO1
  2111. GLOBAL VARIABLES:
  2112. =============================================================================*/
  2113. void SHM_Read_iso1_ChargeParameterDiscoveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2114. {
  2115. struct iso1ChargeParameterDiscoveryResType *out;
  2116. struct ChargeParameterDiscoveryResponse_ISO15118_2014 *in;
  2117. out = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes;
  2118. in = &shm_ccs->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryResponse;
  2119. //Initialize
  2120. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2121. init_iso1ChargeParameterDiscoveryResType(out);
  2122. exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
  2123. //----- [BODY (1/5)] ResponseCode -----
  2124. out->ResponseCode = (unsigned char) in->ResponseCode;
  2125. //----- [BODY (2/5)] EVSEProcessing -----
  2126. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2127. // iso1EVSEProcessingType_Finished = 0,
  2128. // iso1EVSEProcessingType_Ongoing = 1
  2129. //----- [BODY (3/5)] SAScheduleList of SASchedules -----
  2130. //[Joseph] Here keep constant values and not copy from share memory, yet.
  2131. out->SAScheduleList_isUsed = 1u;
  2132. struct iso1SAScheduleListType *list;
  2133. list = &out->SAScheduleList;
  2134. //
  2135. list->SAScheduleTuple.arrayLen = 1;
  2136. list->SAScheduleTuple.array[0].SAScheduleTupleID = 0;
  2137. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleID = 0;
  2138. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
  2139. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
  2140. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
  2141. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = 86400; //24Hrs at least, unit:second
  2142. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
  2143. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
  2144. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 86400;
  2145. //list->SAScheduleTuple.array[0].SalesTariff.xxx
  2146. //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
  2147. //----- [BODY (4/5)] AC/DC EVSEChargeParameter -----
  2148. #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
  2149. {
  2150. //----- [BODY (4/5)] AC_EVSEChargeParameter -----
  2151. out->AC_EVSEChargeParameter_isUsed = 1u;
  2152. struct iso1AC_EVSEChargeParameterType *out_ac_para;
  2153. struct AC_EVSEChargeParameterType_ISO15118_2014 *in_ac_para;
  2154. out_ac_para = &out->AC_EVSEChargeParameter;
  2155. in_ac_para = &in->AC_EVSEChargeParameter;
  2156. //[1/3] AC_EVSEStatus
  2157. SHM_Read_iso1AC_EVSEStatusType(&out_ac_para->AC_EVSEStatus, &in_ac_para->AC_EVSEStatus);
  2158. //[2/3] EVSENominalVoltage
  2159. SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSENominalVoltage, &in_ac_para->EVSENominalVoltage);
  2160. //[3/3] EVSEMaxCurrent
  2161. SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSEMaxCurrent, &in_ac_para->EVSEMaxCurrent);
  2162. }
  2163. #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
  2164. {
  2165. //----- [BODY (5/5)] DC_EVSEChargeParameter -----
  2166. out->DC_EVSEChargeParameter_isUsed = 1u;
  2167. struct iso1DC_EVSEChargeParameterType *out_dc_para;
  2168. struct DC_EVSEChargeParameterType_ISO15118_2014 *in_dc_para;
  2169. out_dc_para = &out->DC_EVSEChargeParameter;
  2170. in_dc_para = &in->DC_EVSEChargeParameter;
  2171. //DC_EVSEStatus
  2172. out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
  2173. SHM_Read_iso1DC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
  2174. //EVSEMaximumCurrentLimit
  2175. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
  2176. //EVSEMaximumPowerLimit
  2177. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
  2178. //EVSEMaximumVoltageLimit
  2179. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
  2180. //EVSEMinimumVoltageLimit
  2181. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
  2182. //EVSEMinimumCurrentLimit
  2183. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
  2184. //EVSECurrentRegulationTolerance_isUsed
  2185. out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
  2186. //EVSECurrentRegulationTolerance
  2187. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
  2188. //EVSEEnergyToBeDelivered_isUsed
  2189. out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
  2190. //EVSEEnergyToBeDelivered (optional)
  2191. //SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
  2192. //EVSEPeakCurrentRipple
  2193. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
  2194. }
  2195. #endif
  2196. }
  2197. /*===========================================================================
  2198. FUNCTION: SHM_Read_din_CableCheckRes
  2199. DESCRIPTION:
  2200. PRE-CONDITION:
  2201. INPUT:
  2202. 1. shm_ccs
  2203. OUTPUT:
  2204. 2. exi_doc_DIN
  2205. GLOBAL VARIABLES:
  2206. =============================================================================*/
  2207. void SHM_Read_din_CableCheckRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2208. {
  2209. struct dinCableCheckResType *out;
  2210. struct CableCheckResponse_DIN70121 *in;
  2211. out = &exi_doc_DIN->V2G_Message.Body.CableCheckRes;
  2212. in = &shm_ccs->V2GMessage_DIN70121.CableCheckResponse;
  2213. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2214. init_dinCableCheckResType(out);
  2215. exi_doc_DIN->V2G_Message.Body.CableCheckRes_isUsed = 1u;
  2216. //----- [BODY (1/3)] ResponseCode -----
  2217. out->ResponseCode = (unsigned char) in->ResponseCode;
  2218. //----- [BODY (2/3)] EVSEProcessing -----
  2219. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2220. // dinEVSEProcessingType_Finished = 0,
  2221. // dinEVSEProcessingType_Ongoing = 1
  2222. //----- [BODY (3/3)] DC_EVSEStatus -----
  2223. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2224. }
  2225. /*===========================================================================
  2226. FUNCTION: SHM_Read_iso1_CableCheckRes
  2227. DESCRIPTION:
  2228. PRE-CONDITION:
  2229. INPUT:
  2230. 1. shm_ccs
  2231. OUTPUT:
  2232. 2. exi_doc_ISO1
  2233. GLOBAL VARIABLES:
  2234. =============================================================================*/
  2235. void SHM_Read_iso1_CableCheckRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2236. {
  2237. struct iso1CableCheckResType *out;
  2238. struct CableCheckResponse_ISO15118_2014 *in;
  2239. out = &exi_doc_ISO1->V2G_Message.Body.CableCheckRes;
  2240. in = &shm_ccs->V2GMessage_ISO15118_2014.CableCheckResponse;
  2241. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2242. init_iso1CableCheckResType(out);
  2243. exi_doc_ISO1->V2G_Message.Body.CableCheckRes_isUsed = 1u;
  2244. //----- [BODY (1/3)] ResponseCode -----
  2245. out->ResponseCode = (unsigned char) in->ResponseCode;
  2246. //----- [BODY (2/3)] EVSEProcessing -----
  2247. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2248. // iso1EVSEProcessingType_Finished = 0,
  2249. // iso1EVSEProcessingType_Ongoing = 1
  2250. //----- [BODY (3/3)] DC_EVSEStatus -----
  2251. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2252. }
  2253. /*===========================================================================
  2254. FUNCTION: SHM_Read_din_PreChargeRes
  2255. DESCRIPTION:
  2256. PRE-CONDITION:
  2257. INPUT:
  2258. 1. shm_ccs
  2259. OUTPUT:
  2260. 2. exi_doc_DIN
  2261. GLOBAL VARIABLES:
  2262. =============================================================================*/
  2263. void SHM_Read_din_PreChargeRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2264. {
  2265. struct dinPreChargeResType *out;
  2266. struct PreChargeResponse_DIN70121 *in;
  2267. out = &exi_doc_DIN->V2G_Message.Body.PreChargeRes;
  2268. in = &shm_ccs->V2GMessage_DIN70121.PreChargeResponse;
  2269. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2270. init_dinPreChargeResType(&exi_doc_DIN->V2G_Message.Body.PreChargeRes);
  2271. exi_doc_DIN->V2G_Message.Body.PreChargeRes_isUsed = 1u;
  2272. //----- [BODY (1/3)] ResponseCode -----
  2273. out->ResponseCode = (unsigned char) in->ResponseCode;
  2274. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2275. SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2276. // dinunitSymbolType_h = 0,
  2277. // dinunitSymbolType_m = 1,
  2278. // dinunitSymbolType_s = 2,
  2279. // dinunitSymbolType_A = 3,
  2280. // dinunitSymbolType_Ah = 4,
  2281. // dinunitSymbolType_V = 5,
  2282. // dinunitSymbolType_VA = 6,
  2283. // dinunitSymbolType_W = 7,
  2284. // dinunitSymbolType_W_s = 8,
  2285. // dinunitSymbolType_Wh = 9
  2286. //----- [BODY (3/3)] DC_EVSEStatus -----
  2287. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2288. }
  2289. /*===========================================================================
  2290. FUNCTION: SHM_Read_iso1_PreChargeRes
  2291. DESCRIPTION:
  2292. PRE-CONDITION:
  2293. INPUT:
  2294. 1. shm_ccs
  2295. OUTPUT:
  2296. 2. exi_doc_ISO1
  2297. GLOBAL VARIABLES:
  2298. =============================================================================*/
  2299. void SHM_Read_iso1_PreChargeRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2300. {
  2301. struct iso1PreChargeResType *out;
  2302. struct PreChargeResponse_ISO15118_2014 *in;
  2303. out = &exi_doc_ISO1->V2G_Message.Body.PreChargeRes;
  2304. in = &shm_ccs->V2GMessage_ISO15118_2014.PreChargeResponse;
  2305. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2306. init_iso1PreChargeResType(&exi_doc_ISO1->V2G_Message.Body.PreChargeRes);
  2307. exi_doc_ISO1->V2G_Message.Body.PreChargeRes_isUsed = 1u;
  2308. //----- [BODY (1/3)] ResponseCode -----
  2309. out->ResponseCode = (unsigned char) in->ResponseCode;
  2310. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2311. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2312. //iso1unitSymbolType_h = 0,
  2313. //iso1unitSymbolType_m = 1,
  2314. //iso1unitSymbolType_s = 2,
  2315. //iso1unitSymbolType_A = 3,
  2316. //iso1unitSymbolType_V = 4,
  2317. //iso1unitSymbolType_W = 5,
  2318. //iso1unitSymbolType_Wh = 6
  2319. //----- [BODY (3/3)] DC_EVSEStatus -----
  2320. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2321. }
  2322. /*===========================================================================
  2323. FUNCTION: SHM_Read_din_PowerDeliveryRes
  2324. DESCRIPTION:
  2325. PRE-CONDITION:
  2326. INPUT:
  2327. 1. shm_ccs
  2328. OUTPUT:
  2329. 2. exi_doc_DIN
  2330. GLOBAL VARIABLES:
  2331. =============================================================================*/
  2332. void SHM_Read_din_PowerDeliveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2333. {
  2334. struct dinPowerDeliveryResType *out;
  2335. struct PowerDeliveryResponse_DIN70121 *in;
  2336. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2337. init_dinPowerDeliveryResType(&exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes);
  2338. out = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes;
  2339. in = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryResponse;
  2340. exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
  2341. //----- [BODY (1/3)] ResponseCode -----
  2342. out->ResponseCode = (unsigned char) in->ResponseCode;
  2343. //----- [BODY (2/3)] AC_EVSEStatus -----
  2344. //ignore, since DIN 70121 doesn't support AC, yet.
  2345. //----- [BODY (2/3)] DC_EVSEStatus -----
  2346. out->DC_EVSEStatus_isUsed = 1u;
  2347. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2348. }
  2349. /*===========================================================================
  2350. FUNCTION: SHM_Read_iso1_PowerDeliveryRes
  2351. DESCRIPTION:
  2352. PRE-CONDITION:
  2353. INPUT:
  2354. 1. shm_ccs
  2355. OUTPUT:
  2356. 2. exi_doc_ISO1
  2357. GLOBAL VARIABLES:
  2358. =============================================================================*/
  2359. void SHM_Read_iso1_PowerDeliveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2360. {
  2361. struct iso1PowerDeliveryResType *out;
  2362. struct PowerDeliveryResponse_ISO15118_2014 *in;
  2363. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2364. init_iso1PowerDeliveryResType(&exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes);
  2365. out = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes;
  2366. in = &shm_ccs->V2GMessage_ISO15118_2014.PowerDeliveryResponse;
  2367. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
  2368. //----- [BODY (1/3)] ResponseCode -----
  2369. out->ResponseCode = (unsigned char) in->ResponseCode;
  2370. //----- [BODY (2/3)] AC_EVSEStatus -----
  2371. //ignore, since our ISO1 70121 doesn't support AC, yet.
  2372. //----- [BODY (2/3)] DC_EVSEStatus -----
  2373. #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
  2374. {
  2375. //out->DC_EVSEStatus_isUsed = 0u;
  2376. }
  2377. #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
  2378. {
  2379. out->DC_EVSEStatus_isUsed = 1u;
  2380. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2381. }
  2382. #endif
  2383. }
  2384. /*===========================================================================
  2385. FUNCTION: SHM_Read_din_CurrentDemandRes
  2386. DESCRIPTION:
  2387. PRE-CONDITION:
  2388. INPUT:
  2389. 1. shm_ccs
  2390. OUTPUT:
  2391. 2. exi_doc_DIN
  2392. GLOBAL VARIABLES:
  2393. =============================================================================*/
  2394. void SHM_Read_din_CurrentDemandRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2395. {
  2396. struct dinCurrentDemandResType *out;
  2397. struct CurrentDemandResponse_DIN70121 *in;
  2398. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2399. init_dinCurrentDemandResType(&exi_doc_DIN->V2G_Message.Body.CurrentDemandRes);
  2400. out = &exi_doc_DIN->V2G_Message.Body.CurrentDemandRes;
  2401. in = &shm_ccs->V2GMessage_DIN70121.CurrentDemandResponse;
  2402. exi_doc_DIN->V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
  2403. //----- [BODY (1/10)] ResponseCode -----
  2404. out->ResponseCode = (unsigned char) in->ResponseCode;
  2405. //----- [BODY (2/10)] DC_EVSEStatus -----
  2406. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2407. //----- [BODY (3/10)] EVSEPresentVoltage -----
  2408. SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2409. //----- [BODY (4/10)] EVSEPresentCurrent -----
  2410. SHM_Read_dinPhysicalValueType(&out->EVSEPresentCurrent, &in->EVSEPresentCurrent);
  2411. //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
  2412. out->EVSECurrentLimitAchieved = in->EVSECurrentLimitAchieved;
  2413. //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
  2414. out->EVSEVoltageLimitAchieved = in->EVSEVoltageLimitAchieved;
  2415. //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
  2416. out->EVSEPowerLimitAchieved = in->EVSEPowerLimitAchieved;
  2417. //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
  2418. out->EVSEMaximumVoltageLimit_isUsed = 1u;
  2419. SHM_Read_dinPhysicalValueType(&out->EVSEMaximumVoltageLimit, &in->EVSEMaximumVoltageLimit);
  2420. //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
  2421. out->EVSEMaximumCurrentLimit_isUsed = 1u;
  2422. SHM_Read_dinPhysicalValueType(&out->EVSEMaximumCurrentLimit, &in->EVSEMaximumCurrentLimit);
  2423. //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
  2424. out->EVSEMaximumPowerLimit_isUsed = 1u;
  2425. SHM_Read_dinPhysicalValueType(&out->EVSEMaximumPowerLimit, &in->EVSEMaximumPowerLimit);
  2426. }
  2427. /*===========================================================================
  2428. FUNCTION: SHM_Read_iso1_CurrentDemandRes
  2429. DESCRIPTION:
  2430. PRE-CONDITION:
  2431. INPUT:
  2432. 1. shm_ccs
  2433. OUTPUT:
  2434. 2. exi_doc_ISO1
  2435. GLOBAL VARIABLES:
  2436. =============================================================================*/
  2437. void SHM_Read_iso1_CurrentDemandRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2438. {
  2439. struct iso1CurrentDemandResType *out;
  2440. struct CurrentDemandResponse_ISO15118_2014 *in;
  2441. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2442. init_iso1CurrentDemandResType(&exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes);
  2443. out = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes;
  2444. in = &shm_ccs->V2GMessage_ISO15118_2014.CurrentDemandResponse;
  2445. exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
  2446. //----- [BODY (1/10)] ResponseCode -----
  2447. out->ResponseCode = (unsigned char) in->ResponseCode;
  2448. //----- [BODY (2/10)] DC_EVSEStatus -----
  2449. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2450. //----- [BODY (3/10)] EVSEPresentVoltage -----
  2451. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2452. //----- [BODY (4/10)] EVSEPresentCurrent -----
  2453. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentCurrent, &in->EVSEPresentCurrent);
  2454. //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
  2455. out->EVSECurrentLimitAchieved = in->EVSECurrentLimitAchieved;
  2456. //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
  2457. out->EVSEVoltageLimitAchieved = in->EVSEVoltageLimitAchieved;
  2458. //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
  2459. out->EVSEPowerLimitAchieved = in->EVSEPowerLimitAchieved;
  2460. //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
  2461. out->EVSEMaximumVoltageLimit_isUsed = 1u;
  2462. SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumVoltageLimit, &in->EVSEMaximumVoltageLimit);
  2463. //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
  2464. out->EVSEMaximumCurrentLimit_isUsed = 1u;
  2465. SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumCurrentLimit, &in->EVSEMaximumCurrentLimit);
  2466. //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
  2467. out->EVSEMaximumPowerLimit_isUsed = 1u;
  2468. SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumPowerLimit, &in->EVSEMaximumPowerLimit);
  2469. }
  2470. /*===========================================================================
  2471. FUNCTION: SHM_Read_iso1_ChargingStatusRes
  2472. DESCRIPTION:
  2473. PRE-CONDITION:
  2474. INPUT:
  2475. 1. shm_ccs
  2476. OUTPUT:
  2477. 2. exi_doc_ISO1
  2478. GLOBAL VARIABLES:
  2479. =============================================================================*/
  2480. void SHM_Read_iso1_ChargingStatusRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2481. {
  2482. int i = 0;
  2483. struct iso1ChargingStatusResType *out;
  2484. struct ChargingStatusResponse_ISO15118_2014 *in;
  2485. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2486. init_iso1ChargingStatusResType(&exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes);
  2487. out = &exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes;
  2488. in = &shm_ccs->V2GMessage_ISO15118_2014.ChargingStatusResponse;
  2489. exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes_isUsed = 1u;
  2490. //----- [BODY (1/10)] ResponseCode -----
  2491. out->ResponseCode = (unsigned char)in->ResponseCode;
  2492. //----- [BODY (2/10)] AC_EVSEStatus -----
  2493. SHM_Read_iso1AC_EVSEStatusType(&out->AC_EVSEStatus, &in->AC_EVSEStatus);
  2494. //----- [BODY (3/10)] EVSEMaxCurrent -----
  2495. out->EVSEMaxCurrent_isUsed = 1u;
  2496. SHM_Read_iso1PhysicalValueType(&out->EVSEMaxCurrent, &in->EVSEMaxCurrent);
  2497. //----- [BODY (4/10)] SAScheduleTupleID -----
  2498. out->SAScheduleTupleID = (unsigned char)in->SAScheduleTupleID; //[CAUTION] data type
  2499. //----- [BODY (5/10)] EVSEID -----
  2500. out->EVSEID.charactersLen = 37; //min length: 7, max length:37 bytes(ISO1, AC)
  2501. for (i = 0; i< out->EVSEID.charactersLen; i++)
  2502. {
  2503. out->EVSEID.characters[i] = (unsigned char)in->EVSEID[i];
  2504. }
  2505. //----- [BODY (6/10)] MeterInfo -----
  2506. out->MeterInfo_isUsed = 1u;
  2507. SHM_Read_iso1MeterInfo(&out->MeterInfo, &in->MeterInfo);
  2508. //----- [BODY (7/10)] ReceiptRequired -----
  2509. out->ReceiptRequired_isUsed = 1u;
  2510. out->ReceiptRequired = (int)in->ReceiptRequired;
  2511. }
  2512. /*===========================================================================
  2513. FUNCTION: SHM_Read_din_WeldingDetectionRes
  2514. DESCRIPTION:
  2515. PRE-CONDITION:
  2516. INPUT:
  2517. 1. shm_ccs
  2518. OUTPUT:
  2519. 2. exi_doc_DIN
  2520. GLOBAL VARIABLES:
  2521. =============================================================================*/
  2522. void SHM_Read_din_WeldingDetectionRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2523. {
  2524. struct dinWeldingDetectionResType *out;
  2525. struct WeldingDetectionResponse_DIN70121 *in;
  2526. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2527. init_dinWeldingDetectionResType(&exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes);
  2528. out = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes;
  2529. in = &shm_ccs->V2GMessage_DIN70121.WeldingDetectionResponse;
  2530. exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
  2531. //----- [BODY (1/3)] ResponseCode -----
  2532. out->ResponseCode = (unsigned char) in->ResponseCode;
  2533. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2534. SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2535. //----- [BODY (3/3)] DC_EVSEStatus -----
  2536. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2537. }
  2538. /*===========================================================================
  2539. FUNCTION: SHM_Read_iso1_WeldingDetectionRes
  2540. DESCRIPTION:
  2541. PRE-CONDITION:
  2542. INPUT:
  2543. 1. shm_ccs
  2544. OUTPUT:
  2545. 2. exi_doc_ISO1
  2546. GLOBAL VARIABLES:
  2547. =============================================================================*/
  2548. void SHM_Read_iso1_WeldingDetectionRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2549. {
  2550. struct iso1WeldingDetectionResType *out;
  2551. struct WeldingDetectionResponse_ISO15118_2014 *in;
  2552. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2553. init_iso1WeldingDetectionResType(&exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes);
  2554. out = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes;
  2555. in = &shm_ccs->V2GMessage_ISO15118_2014.WeldingDetectionResponse;
  2556. exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
  2557. //----- [BODY (1/3)] ResponseCode -----
  2558. out->ResponseCode = (unsigned char) in->ResponseCode;
  2559. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2560. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2561. //----- [BODY (3/3)] DC_EVSEStatus -----
  2562. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2563. }
  2564. /*===========================================================================
  2565. FUNCTION: SHM_Read_din_SessionStopRes
  2566. DESCRIPTION:
  2567. PRE-CONDITION:
  2568. INPUT:
  2569. 1. shm_ccs
  2570. OUTPUT:
  2571. 2. exi_doc_DIN
  2572. GLOBAL VARIABLES:
  2573. =============================================================================*/
  2574. void SHM_Read_din_SessionStopRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2575. {
  2576. struct dinSessionStopResType *out;
  2577. struct SessionStopResponse_DIN70121 *in;
  2578. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2579. init_dinSessionStopResType(&exi_doc_DIN->V2G_Message.Body.SessionStopRes);
  2580. out = &exi_doc_DIN->V2G_Message.Body.SessionStopRes;
  2581. in = &shm_ccs->V2GMessage_DIN70121.SessionStopResponse;
  2582. exi_doc_DIN->V2G_Message.Body.SessionStopRes_isUsed = 1u;
  2583. //----- [BODY (1/3)] ResponseCode -----
  2584. out->ResponseCode = (unsigned char) in->ResponseCode;
  2585. }
  2586. /*===========================================================================
  2587. FUNCTION: SHM_Read_iso1_SessionStopRes
  2588. DESCRIPTION:
  2589. PRE-CONDITION:
  2590. INPUT:
  2591. 1. shm_ccs
  2592. OUTPUT:
  2593. 2. exi_doc_ISO1
  2594. GLOBAL VARIABLES:
  2595. =============================================================================*/
  2596. void SHM_Read_iso1_SessionStopRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2597. {
  2598. struct iso1SessionStopResType *out;
  2599. struct SessionStopResponse_ISO15118_2014 *in;
  2600. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2601. init_iso1SessionStopResType(&exi_doc_ISO1->V2G_Message.Body.SessionStopRes);
  2602. out = &exi_doc_ISO1->V2G_Message.Body.SessionStopRes;
  2603. in = &shm_ccs->V2GMessage_ISO15118_2014.SessionStopResponse;
  2604. exi_doc_ISO1->V2G_Message.Body.SessionStopRes_isUsed = 1u;
  2605. //----- [BODY (1/3)] ResponseCode -----
  2606. out->ResponseCode = (unsigned char) in->ResponseCode;
  2607. }
  2608. /*===========================================================================
  2609. FUNCTION: PRINT_V2G_MSG_din_Header
  2610. DESCRIPTION:
  2611. PRE-CONDITION:
  2612. INPUT:
  2613. OUTPUT:
  2614. GLOBAL VARIABLES:
  2615. =============================================================================*/
  2616. void PRINT_V2G_MSG_din_Header(struct dinEXIDocument *exi_doc_DIN)
  2617. {
  2618. int i = 0;
  2619. int leng = 0;
  2620. leng = exi_doc_DIN->V2G_Message.Header.SessionID.bytesLen;
  2621. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
  2622. for (i = 0; i <leng ; i++)
  2623. {
  2624. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Header.SessionID.bytes[i]);
  2625. }
  2626. }
  2627. /*===========================================================================
  2628. FUNCTION: PRINT_V2G_MSG_iso1_Header
  2629. DESCRIPTION:
  2630. PRE-CONDITION:
  2631. INPUT:
  2632. OUTPUT:
  2633. GLOBAL VARIABLES:
  2634. =============================================================================*/
  2635. void PRINT_V2G_MSG_iso1_Header(struct iso1EXIDocument *exi_doc_ISO1)
  2636. {
  2637. int i = 0;
  2638. int leng = 0;
  2639. leng = exi_doc_ISO1->V2G_Message.Header.SessionID.bytesLen;
  2640. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
  2641. for (i = 0; i <leng ; i++)
  2642. {
  2643. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[i]);
  2644. }
  2645. }
  2646. /*===========================================================================
  2647. FUNCTION: PRINT_V2G_MSG_iso1_Header
  2648. DESCRIPTION:
  2649. PRE-CONDITION:
  2650. INPUT:
  2651. OUTPUT:
  2652. GLOBAL VARIABLES:
  2653. =============================================================================*/
  2654. void PRINT_V2G_MSG_iso2_Header(struct iso2EXIDocument *exi_doc_ISO2)
  2655. {
  2656. int i = 0;
  2657. int leng = 0;
  2658. leng = exi_doc_ISO2->V2G_Message.Header.SessionID.bytesLen;
  2659. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
  2660. for (i = 0; i <leng ; i++)
  2661. {
  2662. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[i]);
  2663. }
  2664. }
  2665. /*===========================================================================
  2666. FUNCTION: DEBUG_PRINT_EXI_MSG_supportedAppProtocolReq
  2667. DESCRIPTION:
  2668. PRE-CONDITION:
  2669. INPUT:
  2670. OUTPUT:
  2671. GLOBAL VARIABLES:
  2672. =============================================================================*/
  2673. void PRINT_XML_DOC_supportedAppProtocolReq(struct appHandEXIDocument *exi_doc)
  2674. {
  2675. int i = 0;
  2676. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n EVSE side: List of application handshake protocols of the EV \n");
  2677. for(i = 0; i < exi_doc->supportedAppProtocolReq.AppProtocol.arrayLen; i++)
  2678. {
  2679. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\tProtocol entry #=%d\n",(i+1));
  2680. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tProtocolNamespace=");
  2681. printASCIIString(
  2682. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.characters,
  2683. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.charactersLen
  2684. );
  2685. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tVersion=%d.%d\n",
  2686. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMajor,
  2687. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMinor);
  2688. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tSchemaID=%d\n", exi_doc->supportedAppProtocolReq.AppProtocol.array[i].SchemaID);
  2689. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tPriority=%d\n", exi_doc->supportedAppProtocolReq.AppProtocol.array[i].Priority);
  2690. }
  2691. }
  2692. /*===========================================================================
  2693. FUNCTION: PRINT_XML_DOC_DIN_SessionSetupReq
  2694. DESCRIPTION:
  2695. PRE-CONDITION:
  2696. INPUT:
  2697. OUTPUT:
  2698. GLOBAL VARIABLES:
  2699. =============================================================================*/
  2700. void PRINT_XML_DOC_DIN_SessionSetupReq(struct dinEXIDocument *exi_doc_DIN)
  2701. {
  2702. int i = 0;
  2703. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
  2704. //===== [Header] SessionID =====
  2705. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  2706. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
  2707. for (i = 0; i < exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
  2708. {
  2709. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
  2710. }
  2711. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
  2712. }
  2713. /*===========================================================================
  2714. FUNCTION: PRINT_XML_DOC_ISO1_SessionSetupReq
  2715. DESCRIPTION:
  2716. PRE-CONDITION:
  2717. INPUT:
  2718. OUTPUT:
  2719. GLOBAL VARIABLES:
  2720. =============================================================================*/
  2721. void PRINT_XML_DOC_ISO1_SessionSetupReq(struct iso1EXIDocument *exi_doc_ISO1)
  2722. {
  2723. int i = 0;
  2724. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
  2725. //===== [Header] SessionID =====
  2726. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  2727. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
  2728. for (i = 0; i < exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
  2729. {
  2730. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
  2731. }
  2732. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
  2733. }
  2734. /*===========================================================================
  2735. FUNCTION: PRINT_XML_DOC_ISO2_SessionSetupReq
  2736. DESCRIPTION:
  2737. PRE-CONDITION:
  2738. INPUT:
  2739. OUTPUT:
  2740. GLOBAL VARIABLES:
  2741. =============================================================================*/
  2742. void PRINT_XML_DOC_ISO2_SessionSetupReq(struct iso2EXIDocument *exi_doc_ISO2)
  2743. {
  2744. int i = 0;
  2745. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
  2746. //===== [Header] SessionID =====
  2747. PRINT_V2G_MSG_iso2_Header(exi_doc_ISO2);
  2748. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
  2749. for (i = 0; i < exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
  2750. {
  2751. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
  2752. }
  2753. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
  2754. }
  2755. /*===========================================================================
  2756. FUNCTION: PRINT_XML_DOC_DIN_ServiceDiscoveryReq
  2757. DESCRIPTION:
  2758. PRE-CONDITION:
  2759. INPUT:
  2760. OUTPUT:
  2761. GLOBAL VARIABLES:
  2762. =============================================================================*/
  2763. void PRINT_XML_DOC_DIN_ServiceDiscoveryReq(struct dinEXIDocument *exi_doc_DIN)
  2764. {
  2765. int i = 0;
  2766. int leng = 0;
  2767. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServiceDiscoveryReq ⨀⨀⨀⨀⨀⬇\n");
  2768. //===== [Header] SessionID =====
  2769. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  2770. //[BODY(1/2)] Service Scope
  2771. leng = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.charactersLen;
  2772. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceScope (%d Bytes, optional) = ", leng);
  2773. for (i = 0; i <leng ; i++)
  2774. {
  2775. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
  2776. }
  2777. //[BODY(2/2)] Service Category
  2778. int cat = 0;
  2779. cat = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
  2780. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceCategory = %d ", cat);
  2781. switch (cat)
  2782. {
  2783. case dinserviceCategoryType_EVCharging: //0
  2784. {
  2785. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(EVCharging)");
  2786. break;
  2787. }
  2788. case dinserviceCategoryType_Internet: //1
  2789. {
  2790. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Internet: not supported)");
  2791. break;
  2792. }
  2793. case dinserviceCategoryType_ContractCertificate: //2
  2794. {
  2795. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ContractCertificate: not supported)");
  2796. break;
  2797. }
  2798. case dinserviceCategoryType_OtherCustom: //3
  2799. {
  2800. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(OtherCustom: not supported)");
  2801. break;
  2802. }
  2803. default:
  2804. {
  2805. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected Service Category: %d)", cat);
  2806. break;
  2807. }
  2808. }
  2809. //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
  2810. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServiceDiscoveryReq ⨂⨂⨂⨂⨂⬆\n\n");
  2811. }
  2812. /*===========================================================================
  2813. FUNCTION: PRINT_XML_DOC_ISO1_ServiceDiscoveryReq
  2814. DESCRIPTION:
  2815. PRE-CONDITION:
  2816. INPUT:
  2817. OUTPUT:
  2818. GLOBAL VARIABLES:
  2819. =============================================================================*/
  2820. void PRINT_XML_DOC_ISO1_ServiceDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1)
  2821. {
  2822. int i = 0;
  2823. int leng = 0;
  2824. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServiceDiscoveryReq ⨀⨀⨀⨀⨀⬇\n");
  2825. //===== [Header] SessionID =====
  2826. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  2827. //[BODY(1/2)] Service Scope
  2828. leng = exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.charactersLen;
  2829. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceScope (%d Bytes, optional) = ", leng);
  2830. for (i = 0; i <leng ; i++)
  2831. {
  2832. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
  2833. }
  2834. //[BODY(2/2)] Service Category
  2835. int cat = 0;
  2836. cat = exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
  2837. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceCategory = %d ", cat);
  2838. switch (cat)
  2839. {
  2840. case iso1serviceCategoryType_EVCharging: //0
  2841. {
  2842. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(EVCharging)");
  2843. break;
  2844. }
  2845. case iso1serviceCategoryType_Internet: //1
  2846. {
  2847. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Internet: not supported)");
  2848. break;
  2849. }
  2850. case iso1serviceCategoryType_ContractCertificate: //2
  2851. {
  2852. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ContractCertificate: not supported)");
  2853. break;
  2854. }
  2855. case iso1serviceCategoryType_OtherCustom: //3
  2856. {
  2857. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(OtherCustom: not supported)");
  2858. break;
  2859. }
  2860. default:
  2861. {
  2862. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected Service Category)");
  2863. break;
  2864. }
  2865. }
  2866. //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
  2867. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServiceDiscoveryReq ⨂⨂⨂⨂⨂⬆\n\n");
  2868. }
  2869. /*===========================================================================
  2870. FUNCTION: PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq
  2871. DESCRIPTION:
  2872. PRE-CONDITION:
  2873. INPUT:
  2874. OUTPUT:
  2875. GLOBAL VARIABLES:
  2876. =============================================================================*/
  2877. void PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq(struct dinEXIDocument *exi_doc_DIN)
  2878. {
  2879. int i = 0;
  2880. int leng = 0;
  2881. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServicePaymentSelectionReq ⨀⨀⨀⨀⨀⬇\n");
  2882. //===== [Header] SessionID =====
  2883. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  2884. //[BODY(1/2)] SelectedPaymentOption
  2885. int opt = 0;
  2886. opt = exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedPaymentOption;
  2887. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedPaymentOption = %d ", opt);
  2888. switch (opt)
  2889. {
  2890. case dinpaymentOptionType_Contract: //0
  2891. {
  2892. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Contract)");
  2893. break;
  2894. }
  2895. case dinpaymentOptionType_ExternalPayment: //1
  2896. {
  2897. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ExternalPayment)");
  2898. break;
  2899. }
  2900. default:
  2901. {
  2902. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected SelectedPaymentOption)\n");
  2903. break;
  2904. }
  2905. }
  2906. //[BODY(2/2)] SelectedServiceList
  2907. leng = exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.arrayLen;
  2908. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedServiceList (%d items) = \n", leng);
  2909. for (i = 0; i< leng; i++)
  2910. {
  2911. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t\t [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
  2912. (i+1),
  2913. exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ServiceID,
  2914. exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID,
  2915. exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID_isUsed);
  2916. }
  2917. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServicePaymentSelectionReq ⨂⨂⨂⨂⨂⬆\n\n");
  2918. }
  2919. /*===========================================================================
  2920. FUNCTION: PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq
  2921. DESCRIPTION:
  2922. PRE-CONDITION:
  2923. INPUT:
  2924. OUTPUT:
  2925. GLOBAL VARIABLES:
  2926. =============================================================================*/
  2927. void PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq(struct iso1EXIDocument *exi_doc_ISO1)
  2928. {
  2929. int i = 0;
  2930. int leng = 0;
  2931. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PaymentServiceSelectionReq ⨀⨀⨀⨀⨀⬇\n");
  2932. //===== [Header] SessionID =====
  2933. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  2934. //[BODY(1/2)] SelectedPaymentOption
  2935. int opt = 0;
  2936. opt = exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedPaymentOption;
  2937. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedPaymentOption = %d ", opt);
  2938. switch (opt)
  2939. {
  2940. case iso1paymentOptionType_Contract: //0
  2941. {
  2942. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Contract)");
  2943. break;
  2944. }
  2945. case iso1paymentOptionType_ExternalPayment: //1
  2946. {
  2947. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ExternalPayment)");
  2948. break;
  2949. }
  2950. default:
  2951. {
  2952. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected SelectedPaymentOption)\n");
  2953. break;
  2954. }
  2955. }
  2956. //[BODY(2/2)] SelectedServiceList
  2957. leng = exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.arrayLen;
  2958. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedServiceList (%d items) = \n", leng);
  2959. for (i = 0; i< leng; i++)
  2960. {
  2961. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t\t [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
  2962. (i+1),
  2963. exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ServiceID,
  2964. exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID,
  2965. exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID_isUsed);
  2966. }
  2967. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PaymentServiceSelectionReq ⨂⨂⨂⨂⨂⬆\n\n");
  2968. }
  2969. /*===========================================================================
  2970. FUNCTION: PRINT_XML_DOC_DIN_ContractAuthenticationReq
  2971. DESCRIPTION:
  2972. PRE-CONDITION:
  2973. INPUT:
  2974. OUTPUT:
  2975. GLOBAL VARIABLES:
  2976. =============================================================================*/
  2977. void PRINT_XML_DOC_DIN_ContractAuthenticationReq(struct dinEXIDocument *exi_doc_DIN)
  2978. {
  2979. //int i = 0;
  2980. static int cnt = 0;
  2981. cnt++;
  2982. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ContractAuthenticationReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  2983. //===== [Header] SessionID =====
  2984. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  2985. //[BODY(1/2)] Id
  2986. //[Joseph, To-Do, not full implemented, yet]
  2987. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t Id_isUsed = %d ",
  2988. exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq.Id_isUsed);
  2989. //[BODY(2/2)] GenChallenge
  2990. //[Joseph, To-Do, not full implemented, yet]
  2991. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t GenChallenge_isUsed = %d ",
  2992. exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq.GenChallenge_isUsed);
  2993. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ContractAuthenticationReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  2994. }
  2995. /*===========================================================================
  2996. FUNCTION: PRINT_XML_DOC_ISO1_AuthorizationReq
  2997. DESCRIPTION:
  2998. PRE-CONDITION:
  2999. INPUT:
  3000. OUTPUT:
  3001. GLOBAL VARIABLES:
  3002. =============================================================================*/
  3003. void PRINT_XML_DOC_ISO1_AuthorizationReq(struct iso1EXIDocument *exi_doc_ISO1)
  3004. {
  3005. //int i = 0;
  3006. static int cnt = 0;
  3007. cnt++;
  3008. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing AuthorizationReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3009. //===== [Header] SessionID =====
  3010. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3011. //[BODY(1/2)] Id
  3012. //[Joseph, To-Do, not full implemented, yet]
  3013. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t Id_isUsed = %d ",
  3014. exi_doc_ISO1->V2G_Message.Body.AuthorizationReq.Id_isUsed);
  3015. //[BODY(2/2)] GenChallenge
  3016. //[Joseph, To-Do, not full implemented, yet]
  3017. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t GenChallenge_isUsed = %d ",
  3018. exi_doc_ISO1->V2G_Message.Body.AuthorizationReq.GenChallenge_isUsed);
  3019. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing AuthorizationReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3020. }
  3021. /*===========================================================================
  3022. FUNCTION: PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq
  3023. DESCRIPTION:
  3024. PRE-CONDITION:
  3025. INPUT:
  3026. OUTPUT:
  3027. GLOBAL VARIABLES:
  3028. =============================================================================*/
  3029. void PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq(struct dinEXIDocument *exi_doc_DIN)
  3030. {
  3031. //int i = 0;
  3032. static int cnt = 0;
  3033. cnt++;
  3034. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargeParameterDiscoveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3035. //===== [Header] SessionID =====
  3036. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3037. //===== [BODY (1/3)] EVRequestedEnergyTransferType =====
  3038. int type = 0;
  3039. type = exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.EVRequestedEnergyTransferType;
  3040. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVRequestedEnergyTransferType = %d ", type);
  3041. switch (type)
  3042. {
  3043. case dinEVRequestedEnergyTransferType_AC_single_phase_core: //0,
  3044. {
  3045. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_single_phase_core)\n");
  3046. break;
  3047. }
  3048. case dinEVRequestedEnergyTransferType_AC_three_phase_core: //1,
  3049. {
  3050. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_three_phase_core)\n");
  3051. break;
  3052. }
  3053. case dinEVRequestedEnergyTransferType_DC_core: //2,
  3054. {
  3055. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_core)\n");
  3056. break;
  3057. }
  3058. case dinEVRequestedEnergyTransferType_DC_extended: //3,
  3059. {
  3060. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_extended)\n"); //expected
  3061. //[Joseph, To-Do]
  3062. //If this parameter is different from previous message,
  3063. //a warning should be noted.
  3064. break;
  3065. }
  3066. case dinEVRequestedEnergyTransferType_DC_combo_core: //4,
  3067. {
  3068. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_combo_core)\n");
  3069. break;
  3070. }
  3071. case dinEVRequestedEnergyTransferType_DC_unique: //5
  3072. {
  3073. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_unique)\n");
  3074. break;
  3075. }
  3076. }
  3077. //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
  3078. //ignored, since DIN doesn't support AC.
  3079. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t AC_EVChargeParameter_isUsed = %d ", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
  3080. //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
  3081. struct dinPhysicalValueType *obj;
  3082. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
  3083. //DC_EVStatus
  3084. struct dinDC_EVStatusType *status;
  3085. status = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.DC_EVStatus;
  3086. PRINT_dinDC_EVStatusType(status);
  3087. //EVMaximumCurrentLimit
  3088. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumCurrentLimit;
  3089. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3090. PRINT_dinPhysicalValueType_UNIT(obj);
  3091. //EVMaximumPowerLimit
  3092. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
  3093. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3094. PRINT_dinPhysicalValueType_UNIT(obj);
  3095. //EVMaximumVoltageLimit
  3096. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
  3097. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3098. PRINT_dinPhysicalValueType_UNIT(obj);
  3099. //EVEnergyCapacity
  3100. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
  3101. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyCapacity = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3102. PRINT_dinPhysicalValueType_UNIT(obj);
  3103. //EVEnergyRequest
  3104. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
  3105. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyRequest = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3106. PRINT_dinPhysicalValueType_UNIT(obj);
  3107. //FullSOC
  3108. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t FullSOC = %d \% (DEC)", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
  3109. //BulkSOC
  3110. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkSOC = %d \% (DEC)", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
  3111. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargeParameterDiscoveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3112. }
  3113. /*===========================================================================
  3114. FUNCTION: PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq
  3115. DESCRIPTION:
  3116. PRE-CONDITION:
  3117. INPUT:
  3118. OUTPUT:
  3119. GLOBAL VARIABLES:
  3120. =============================================================================*/
  3121. void PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1)
  3122. {
  3123. //int i = 0;
  3124. static int cnt = 0;
  3125. cnt++;
  3126. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargeParameterDiscoveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3127. //===== [Header] SessionID =====
  3128. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3129. //===== [BODY (1/3)] RequestedEnergyTransferMode =====
  3130. int type = 0;
  3131. type = exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.RequestedEnergyTransferMode;
  3132. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RequestedEnergyTransferMode = %d ", type);
  3133. switch (type)
  3134. {
  3135. case iso1EnergyTransferModeType_AC_single_phase_core: //0,
  3136. {
  3137. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_single_phase_core)\n");
  3138. break;
  3139. }
  3140. case iso1EnergyTransferModeType_AC_three_phase_core: //1,
  3141. {
  3142. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_three_phase_core)\n");
  3143. break;
  3144. }
  3145. case iso1EnergyTransferModeType_DC_core: //2,
  3146. {
  3147. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_core)\n");
  3148. break;
  3149. }
  3150. case iso1EnergyTransferModeType_DC_extended: //3,
  3151. {
  3152. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_extended)\n"); //expected
  3153. //[Joseph, To-Do]
  3154. //If this parameter is different from previous message,
  3155. //a warning should be noted.
  3156. break;
  3157. }
  3158. case iso1EnergyTransferModeType_DC_combo_core: //4,
  3159. {
  3160. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_combo_core)\n");
  3161. break;
  3162. }
  3163. case iso1EnergyTransferModeType_DC_unique: //5
  3164. {
  3165. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_unique)\n");
  3166. break;
  3167. }
  3168. }
  3169. //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
  3170. //ignored, since our ISO1 doesn't support AC.
  3171. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t AC_EVChargeParameter_isUsed = %d ", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
  3172. //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
  3173. struct iso1PhysicalValueType *obj;
  3174. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
  3175. //DC_EVStatus
  3176. struct iso1DC_EVStatusType *status;
  3177. status = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.DC_EVStatus;
  3178. PRINT_iso1DC_EVStatusType(status);
  3179. //EVMaximumCurrentLimit
  3180. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumCurrentLimit;
  3181. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3182. PRINT_iso1PhysicalValueType_UNIT(obj);
  3183. //EVMaximumPowerLimit
  3184. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
  3185. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3186. PRINT_iso1PhysicalValueType_UNIT(obj);
  3187. //EVMaximumVoltageLimit
  3188. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
  3189. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3190. PRINT_iso1PhysicalValueType_UNIT(obj);
  3191. //EVEnergyCapacity
  3192. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
  3193. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyCapacity = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3194. PRINT_iso1PhysicalValueType_UNIT(obj);
  3195. //EVEnergyRequest
  3196. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
  3197. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyRequest = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3198. PRINT_iso1PhysicalValueType_UNIT(obj);
  3199. //FullSOC
  3200. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t FullSOC = %d \% (DEC)", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
  3201. //BulkSOC
  3202. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkSOC = %d \% (DEC)", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
  3203. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargeParameterDiscoveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3204. }
  3205. /*===========================================================================
  3206. FUNCTION: PRINT_XML_DOC_DIN_CableCheckReq
  3207. DESCRIPTION:
  3208. PRE-CONDITION:
  3209. INPUT:
  3210. OUTPUT:
  3211. GLOBAL VARIABLES:
  3212. =============================================================================*/
  3213. void PRINT_XML_DOC_DIN_CableCheckReq(struct dinEXIDocument *exi_doc_DIN)
  3214. {
  3215. //int i = 0;
  3216. static int cnt = 0;
  3217. cnt++;
  3218. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CableCheckReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3219. //===== [Header] SessionID =====
  3220. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3221. //===== [BODY (1/1)] DC_EVStatus =====
  3222. struct dinDC_EVStatusType *status;
  3223. status = &exi_doc_DIN->V2G_Message.Body.CableCheckReq.DC_EVStatus;
  3224. PRINT_dinDC_EVStatusType(status);
  3225. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CableCheckReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3226. }
  3227. /*===========================================================================
  3228. FUNCTION: PRINT_XML_DOC_ISO1_CableCheckReq
  3229. DESCRIPTION:
  3230. PRE-CONDITION:
  3231. INPUT:
  3232. OUTPUT:
  3233. GLOBAL VARIABLES:
  3234. =============================================================================*/
  3235. void PRINT_XML_DOC_ISO1_CableCheckReq(struct iso1EXIDocument *exi_doc_ISO1)
  3236. {
  3237. //int i = 0;
  3238. static int cnt = 0;
  3239. cnt++;
  3240. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CableCheckReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3241. //===== [Header] SessionID =====
  3242. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3243. //===== [BODY (1/1)] DC_EVStatus =====
  3244. struct iso1DC_EVStatusType *status;
  3245. status = &exi_doc_ISO1->V2G_Message.Body.CableCheckReq.DC_EVStatus;
  3246. PRINT_iso1DC_EVStatusType(status);
  3247. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CableCheckReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3248. }
  3249. /*===========================================================================
  3250. FUNCTION: PRINT_XML_DOC_DIN_PreChargeReq
  3251. DESCRIPTION:
  3252. PRE-CONDITION:
  3253. INPUT:
  3254. OUTPUT:
  3255. GLOBAL VARIABLES:
  3256. =============================================================================*/
  3257. void PRINT_XML_DOC_DIN_PreChargeReq(struct dinEXIDocument *exi_doc_DIN)
  3258. {
  3259. //int i = 0;
  3260. static int cnt = 0;
  3261. cnt++;
  3262. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PreChargeReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3263. //===== [Header] SessionID =====
  3264. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3265. //===== [BODY (1/3)] DC_EVStatus =====
  3266. struct dinDC_EVStatusType *status;
  3267. status = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.DC_EVStatus;
  3268. PRINT_dinDC_EVStatusType(status);
  3269. //===== [BODY (2/3)] EVTargetVoltage =====
  3270. struct dinPhysicalValueType *obj;
  3271. obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
  3272. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3273. PRINT_dinPhysicalValueType_UNIT(obj);
  3274. //===== [BODY (3/3)] EVTargetCurrent =====
  3275. obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
  3276. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3277. PRINT_dinPhysicalValueType_UNIT(obj);
  3278. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PreChargeReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3279. }
  3280. /*===========================================================================
  3281. FUNCTION: PRINT_XML_DOC_ISO1_PreChargeReq
  3282. DESCRIPTION:
  3283. PRE-CONDITION:
  3284. INPUT:
  3285. OUTPUT:
  3286. GLOBAL VARIABLES:
  3287. =============================================================================*/
  3288. void PRINT_XML_DOC_ISO1_PreChargeReq(struct iso1EXIDocument *exi_doc_ISO1)
  3289. {
  3290. //int i = 0;
  3291. static int cnt = 0;
  3292. cnt++;
  3293. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PreChargeReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3294. //===== [Header] SessionID =====
  3295. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3296. //===== [BODY (1/3)] DC_EVStatus =====
  3297. struct iso1DC_EVStatusType *status;
  3298. status = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.DC_EVStatus;
  3299. PRINT_iso1DC_EVStatusType(status);
  3300. //===== [BODY (2/3)] EVTargetVoltage =====
  3301. struct iso1PhysicalValueType *obj;
  3302. obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
  3303. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3304. PRINT_iso1PhysicalValueType_UNIT(obj);
  3305. //===== [BODY (3/3)] EVTargetCurrent =====
  3306. obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
  3307. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3308. PRINT_iso1PhysicalValueType_UNIT(obj);
  3309. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PreChargeReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3310. }
  3311. /*===========================================================================
  3312. FUNCTION: PRINT_XML_DOC_DIN_PowerDeliveryReq
  3313. DESCRIPTION:
  3314. PRE-CONDITION:
  3315. INPUT:
  3316. OUTPUT:
  3317. GLOBAL VARIABLES:
  3318. =============================================================================*/
  3319. void PRINT_XML_DOC_DIN_PowerDeliveryReq(struct dinEXIDocument *exi_doc_DIN)
  3320. {
  3321. //int i = 0;
  3322. static int cnt = 0;
  3323. cnt++;
  3324. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PowerDeliveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3325. //===== [Header] SessionID =====
  3326. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3327. //===== [BODY (1/3)] ReadyToChargeState =====
  3328. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ReadyToChargeState = %d (DEC)",
  3329. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ReadyToChargeState);
  3330. //===== [BODY (2/3)] ChargingProfile =====
  3331. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingProfile_isUsed = %d (DEC)",
  3332. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
  3333. //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
  3334. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVPowerDeliveryParameter_isUsed = %d (DEC)",
  3335. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
  3336. //DC_EVStatus
  3337. struct dinDC_EVStatusType *status;
  3338. status = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.DC_EVStatus;
  3339. PRINT_dinDC_EVStatusType(status);
  3340. //BulkChargingComplete
  3341. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d (DEC)",
  3342. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
  3343. //BulkChargingComplete_isUsed
  3344. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d (DEC)",
  3345. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
  3346. //ChargingComplete
  3347. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d (DEC)",
  3348. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
  3349. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PowerDeliveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3350. }
  3351. /*===========================================================================
  3352. FUNCTION: PRINT_XML_DOC_ISO1_PowerDeliveryReq
  3353. DESCRIPTION:
  3354. PRE-CONDITION:
  3355. INPUT:
  3356. OUTPUT:
  3357. GLOBAL VARIABLES:
  3358. =============================================================================*/
  3359. void PRINT_XML_DOC_ISO1_PowerDeliveryReq(struct iso1EXIDocument *exi_doc_ISO1)
  3360. {
  3361. //int i = 0;
  3362. static int cnt = 0;
  3363. cnt++;
  3364. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PowerDeliveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3365. //===== [Header] SessionID =====
  3366. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3367. //===== [BODY (1/3)] ChargeProgress =====
  3368. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargeProgress = %d (DEC, 0:start, 1:stop, 2:renegotiate)",
  3369. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.ChargeProgress);
  3370. //iso1chargeProgressType_Start = 0,
  3371. //iso1chargeProgressType_Stop = 1,
  3372. //iso1chargeProgressType_Renegotiate = 2
  3373. //===== [BODY (2/3)] ChargingProfile =====
  3374. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingProfile_isUsed = %d (DEC)",
  3375. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
  3376. //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
  3377. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVPowerDeliveryParameter_isUsed = %d (DEC)",
  3378. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
  3379. //DC_EVStatus
  3380. struct iso1DC_EVStatusType *status;
  3381. status = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.DC_EVStatus;
  3382. PRINT_iso1DC_EVStatusType(status);
  3383. //BulkChargingComplete
  3384. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d (DEC)",
  3385. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
  3386. //BulkChargingComplete_isUsed
  3387. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d (DEC)",
  3388. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
  3389. //ChargingComplete
  3390. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d (DEC)",
  3391. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
  3392. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PowerDeliveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3393. }
  3394. /*===========================================================================
  3395. FUNCTION: PRINT_XML_DOC_DIN_CurrentDemandReq
  3396. DESCRIPTION:
  3397. PRE-CONDITION:
  3398. INPUT:
  3399. OUTPUT:
  3400. GLOBAL VARIABLES:
  3401. =============================================================================*/
  3402. void PRINT_XML_DOC_DIN_CurrentDemandReq(struct dinEXIDocument *exi_doc_DIN)
  3403. {
  3404. //int i = 0;
  3405. static int cnt = 0;
  3406. cnt++;
  3407. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CurrentDemandReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3408. //===== [Header] SessionID =====
  3409. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3410. //===== [BODY (1/10)] DC_EVStatus =====
  3411. struct dinDC_EVStatusType *status;
  3412. status = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.DC_EVStatus;
  3413. PRINT_dinDC_EVStatusType(status);
  3414. //===== [BODY (2/10)] EVTargetCurrent =====
  3415. struct dinPhysicalValueType *obj;
  3416. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
  3417. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3418. PRINT_dinPhysicalValueType_UNIT(obj);
  3419. //===== [BODY (3/10)] EVMaximumVoltageLimit =====
  3420. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
  3421. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
  3422. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3423. PRINT_dinPhysicalValueType_UNIT(obj);
  3424. //===== [BODY (4/10)] EVMaximumCurrentLimit =====
  3425. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
  3426. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
  3427. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3428. PRINT_dinPhysicalValueType_UNIT(obj);
  3429. //===== [BODY (5/10)] EVMaximumPowerLimit =====
  3430. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
  3431. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
  3432. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3433. PRINT_dinPhysicalValueType_UNIT(obj);
  3434. //===== [BODY (6/10)] BulkChargingComplete =====
  3435. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
  3436. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
  3437. //===== [BODY (7/10)] ChargingComplete =====
  3438. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
  3439. //===== [BODY (8/10)] RemainingTimeToFullSoC =====
  3440. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
  3441. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
  3442. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToFullSoC = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3443. PRINT_dinPhysicalValueType_UNIT(obj);
  3444. //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
  3445. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
  3446. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
  3447. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToBulkSoC = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3448. PRINT_dinPhysicalValueType_UNIT(obj);
  3449. //===== [BODY (10/10)] EVTargetVoltage =====
  3450. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
  3451. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3452. PRINT_dinPhysicalValueType_UNIT(obj);
  3453. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CurrentDemandReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3454. }
  3455. /*===========================================================================
  3456. FUNCTION: PRINT_XML_DOC_ISO1_CurrentDemandReq
  3457. DESCRIPTION:
  3458. PRE-CONDITION:
  3459. INPUT:
  3460. OUTPUT:
  3461. GLOBAL VARIABLES:
  3462. =============================================================================*/
  3463. void PRINT_XML_DOC_ISO1_CurrentDemandReq(struct iso1EXIDocument *exi_doc_ISO1)
  3464. {
  3465. //int i = 0;
  3466. static int cnt = 0;
  3467. cnt++;
  3468. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CurrentDemandReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3469. //===== [Header] SessionID =====
  3470. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3471. //===== [BODY (1/10)] DC_EVStatus =====
  3472. struct iso1DC_EVStatusType *status;
  3473. status = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.DC_EVStatus;
  3474. PRINT_iso1DC_EVStatusType(status);
  3475. //===== [BODY (2/10)] EVTargetCurrent =====
  3476. struct iso1PhysicalValueType *obj;
  3477. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
  3478. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3479. PRINT_iso1PhysicalValueType_UNIT(obj);
  3480. //===== [BODY (3/10)] EVMaximumVoltageLimit =====
  3481. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
  3482. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
  3483. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3484. PRINT_iso1PhysicalValueType_UNIT(obj);
  3485. //===== [BODY (4/10)] EVMaximumCurrentLimit =====
  3486. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3487. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
  3488. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
  3489. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3490. PRINT_iso1PhysicalValueType_UNIT(obj);
  3491. //===== [BODY (5/10)] EVMaximumPowerLimit =====
  3492. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
  3493. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
  3494. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3495. PRINT_iso1PhysicalValueType_UNIT(obj);
  3496. //===== [BODY (6/10)] BulkChargingComplete =====
  3497. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
  3498. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
  3499. //===== [BODY (7/10)] ChargingComplete =====
  3500. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
  3501. //===== [BODY (8/10)] RemainingTimeToFullSoC =====
  3502. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
  3503. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
  3504. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToFullSoC = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3505. PRINT_iso1PhysicalValueType_UNIT(obj);
  3506. //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
  3507. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
  3508. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
  3509. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToBulkSoC = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3510. PRINT_iso1PhysicalValueType_UNIT(obj);
  3511. //===== [BODY (10/10)] EVTargetVoltage =====
  3512. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
  3513. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3514. PRINT_iso1PhysicalValueType_UNIT(obj);
  3515. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CurrentDemandReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3516. }
  3517. /*===========================================================================
  3518. FUNCTION: PRINT_XML_DOC_ISO1_ChargingStatusReq
  3519. DESCRIPTION:
  3520. PRE-CONDITION:
  3521. INPUT:
  3522. OUTPUT:
  3523. GLOBAL VARIABLES:
  3524. =============================================================================*/
  3525. void PRINT_XML_DOC_ISO1_ChargingStatusReq(struct iso1EXIDocument *exi_doc_ISO1)
  3526. {
  3527. static int cnt = 0;
  3528. cnt++;
  3529. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargingStatusReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3530. //===== [Header] SessionID =====
  3531. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3532. //===== [BODY (0/0)] =====
  3533. //ISO1: no content
  3534. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t no content (ISO1)");
  3535. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargingStatusReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3536. }
  3537. /*===========================================================================
  3538. FUNCTION: PRINT_XML_DOC_DIN_WeldingDetectionReq
  3539. DESCRIPTION:
  3540. PRE-CONDITION:
  3541. INPUT:
  3542. OUTPUT:
  3543. GLOBAL VARIABLES:
  3544. =============================================================================*/
  3545. void PRINT_XML_DOC_DIN_WeldingDetectionReq(struct dinEXIDocument *exi_doc_DIN)
  3546. {
  3547. //int i = 0;
  3548. static int cnt = 0;
  3549. cnt++;
  3550. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing WeldingDetectionReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3551. //===== [Header] SessionID =====
  3552. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3553. //===== [BODY (1/3)] DC_EVStatus =====
  3554. struct dinDC_EVStatusType *status;
  3555. status = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq.DC_EVStatus;
  3556. PRINT_dinDC_EVStatusType(status);
  3557. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing WeldingDetectionReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3558. }
  3559. /*===========================================================================
  3560. FUNCTION: PRINT_XML_DOC_ISO1_WeldingDetectionReq
  3561. DESCRIPTION:
  3562. PRE-CONDITION:
  3563. INPUT:
  3564. OUTPUT:
  3565. GLOBAL VARIABLES:
  3566. =============================================================================*/
  3567. void PRINT_XML_DOC_ISO1_WeldingDetectionReq(struct iso1EXIDocument *exi_doc_ISO1)
  3568. {
  3569. //int i = 0;
  3570. static int cnt = 0;
  3571. cnt++;
  3572. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing WeldingDetectionReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3573. //===== [Header] SessionID =====
  3574. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3575. //===== [BODY (1/3)] DC_EVStatus =====
  3576. struct iso1DC_EVStatusType *status;
  3577. status = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq.DC_EVStatus;
  3578. PRINT_iso1DC_EVStatusType(status);
  3579. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing WeldingDetectionReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3580. }
  3581. /*===========================================================================
  3582. FUNCTION: PRINT_XML_DOC_DIN_SessionStopReq
  3583. DESCRIPTION:
  3584. PRE-CONDITION:
  3585. INPUT:
  3586. OUTPUT:
  3587. GLOBAL VARIABLES:
  3588. =============================================================================*/
  3589. void PRINT_XML_DOC_DIN_SessionStopReq(struct dinEXIDocument *exi_doc_DIN)
  3590. {
  3591. //int i = 0;
  3592. static int cnt = 0;
  3593. cnt++;
  3594. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionStopReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3595. //===== [Header] SessionID =====
  3596. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3597. //===== [BODY (0/0)] noContent =====
  3598. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionStopReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3599. }
  3600. /*===========================================================================
  3601. FUNCTION: PRINT_XML_DOC_ISO1_SessionStopReq
  3602. DESCRIPTION:
  3603. PRE-CONDITION:
  3604. INPUT:
  3605. OUTPUT:
  3606. GLOBAL VARIABLES:
  3607. =============================================================================*/
  3608. void PRINT_XML_DOC_ISO1_SessionStopReq(struct iso1EXIDocument *exi_doc_ISO1)
  3609. {
  3610. //int i = 0;
  3611. static int cnt = 0;
  3612. cnt++;
  3613. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionStopReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3614. //===== [Header] SessionID =====
  3615. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3616. //===== [BODY (0/0)] noContent =====
  3617. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionStopReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3618. }
  3619. /*===========================================================================
  3620. FUNCTION: PRINT_V2GTP_STREAM
  3621. DESCRIPTION:
  3622. PRE-CONDITION:
  3623. INPUT:
  3624. OUTPUT:
  3625. GLOBAL VARIABLES:
  3626. =============================================================================*/
  3627. void PRINT_V2GTP_STREAM(bitstream_t *stream)
  3628. {
  3629. #if (DEBUG_PRINTF_EXI_ENGINE_DETAIL_SHOW == ENABLE)
  3630. int i = 0;
  3631. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- Got a new V2GTP Message -----\n\n");
  3632. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t SIZE: %d (Bytes, DEC)\n", (int)stream->size);
  3633. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t HEADER (HEX): ");
  3634. for (i = 0; i < stream->size; i++)
  3635. {
  3636. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", stream->data[i]);
  3637. if (i == (V2GTP_HEADER_LENGTH - 1))
  3638. {
  3639. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t EXI (HEX): ");
  3640. }
  3641. }
  3642. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n");
  3643. #endif
  3644. }
  3645. /*===========================================================================
  3646. FUNCTION: API_V2GMSG_EXI_Decoder_AppProtocol
  3647. DESCRIPTION:
  3648. PRE-CONDITION:
  3649. 1. #define EXI_STREAM BYTE_ARRAY
  3650. INPUT:
  3651. 1. V2GTP_msg
  3652. 2. V2GTP_msg_length
  3653. OUTPUT:
  3654. 1. ccs_handshake //Share Memory
  3655. 2. V2gFlowStatus //Status Flag
  3656. GLOBAL VARIABLES:
  3657. 1. iStream
  3658. 2. exiDoc
  3659. =============================================================================*/
  3660. int API_V2GMSG_EXI_Decoder_AppProtocol(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct appHandEXIDocument *exiDoc_handshake)
  3661. {
  3662. int errn = 0;
  3663. size_t pos = 0;
  3664. uint32_t payloadLengthDec = 0;
  3665. //Initialize iStream
  3666. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3667. iStream.pos = &pos;
  3668. iStream.data = V2GTP_msg;
  3669. //Initialize exiDoc
  3670. init_appHandEXIDocument(exiDoc_handshake);
  3671. //Print the original EXI message
  3672. PRINT_V2GTP_STREAM(&iStream);
  3673. //STEP 1: Parsing Header
  3674. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3675. //TC_SECC_VTB_V2GTPSessionSetup_004
  3676. if (payloadLengthDec == 0)
  3677. {
  3678. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_AppProtocol]payloadLengthDec = 0\n");
  3679. errn = -1;
  3680. }
  3681. if (errn == 0)
  3682. {
  3683. //STEP 2: Parsing Payload EXI Message
  3684. *iStream.pos = V2GTP_HEADER_LENGTH;
  3685. errn = decode_appHandExiDocument(&iStream, exiDoc_handshake);
  3686. if(errn == 0)
  3687. {
  3688. //Print the decoded XML Document
  3689. PRINT_XML_DOC_supportedAppProtocolReq(exiDoc_handshake);
  3690. //errn = SupportedAppProtocolRequest; //17 (define.h)
  3691. }
  3692. else
  3693. {
  3694. /* an error occured */
  3695. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_AppProtocol]decode_appHandExiDocument()\n");
  3696. errn = -1;
  3697. }
  3698. }
  3699. return errn;
  3700. }
  3701. int API_V2GMSG_EXI_Encoder_AppProtocol(struct appHandEXIDocument *exi_doc, bitstream_t *exi_packet)
  3702. {
  3703. int i = 0;
  3704. int errn = 0;
  3705. size_t pos = 0;
  3706. exi_packet->pos = &pos;
  3707. //*exi_packet->pos = 0;
  3708. exi_packet->size = V2GTP_MSG_TX_BUFFER_SIZE; //(64*1024) //65,536 = 65.5KB
  3709. exi_packet->data = V2GTP_Tx_buf;
  3710. *exi_packet->pos = V2GTP_HEADER_LENGTH;
  3711. if( (errn = encode_appHandExiDocument(exi_packet, exi_doc)) == 0)
  3712. {
  3713. errn = write_v2gtpHeader(exi_packet->data, (*exi_packet->pos) - V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
  3714. //*exi_packet.pos = total length of the encoded V2GMSG.
  3715. //V2GTP_HEADER_LENGTH = 8 Bytes
  3716. }
  3717. exi_packet->size = *exi_packet->pos; //total length of the encoded V2GMSG.
  3718. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- supportedAppProtocolRes [START] -----\n\n");
  3719. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t SIZE: %d (Bytes, DEC)\n", (int)exi_packet->size);
  3720. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t HEADER (HEX): ");
  3721. for (i = 0; i < (int)exi_packet->size; i++)
  3722. {
  3723. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_packet->data[i]);
  3724. if (i == (V2GTP_HEADER_LENGTH - 1)) DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t EXI (HEX): ");
  3725. }
  3726. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- supportedAppProtocolRes [END] -----\n\n");
  3727. return errn;
  3728. }
  3729. /*===========================================================================
  3730. FUNCTION: API_V2GMSG_EXI_Decoder_DIN
  3731. DESCRIPTION:
  3732. PRE-CONDITION:
  3733. INPUT:
  3734. OUTPUT:
  3735. GLOBAL VARIABLES:
  3736. =============================================================================*/
  3737. int API_V2GMSG_EXI_Decoder_DIN(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct dinEXIDocument *exi_doc_DIN)
  3738. {
  3739. DEBUG_PRINTF_EXI_ENGINE_DETAIL("API_V2GMSG_EXI_Decoder_DIN(): Entered!\n");
  3740. int errn = 0;
  3741. size_t pos = 0;
  3742. uint32_t payloadLengthDec = 0;
  3743. //Initialize iStream
  3744. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3745. iStream.pos = &pos;
  3746. iStream.data = V2GTP_msg;
  3747. iStream.buffer = 0;
  3748. iStream.capacity = 0;
  3749. //Print the original EXI message
  3750. PRINT_V2GTP_STREAM(&iStream);
  3751. //STEP 1: Parsing Header
  3752. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3753. //TC_SECC_VTB_V2GTPSessionSetup_004
  3754. if (payloadLengthDec == 0)
  3755. {
  3756. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][Error][API_V2GMSG_EXI_Decoder_DIN]payloadLengthDec = 0\n");
  3757. errn = -1;
  3758. }
  3759. if (errn == 0)
  3760. {
  3761. //STEP 2: Parsing Payload EXI Message
  3762. *iStream.pos = V2GTP_HEADER_LENGTH;
  3763. errn = decode_dinExiDocument(&iStream, exi_doc_DIN);
  3764. //The "eventcode" inside this function could present which kind of message it is.
  3765. if (errn == 0)
  3766. {
  3767. // successfully received and parsed.
  3768. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_DIN] decode_dinExiDocument: %d (DEC) => OK!\n", errn);
  3769. errn = Check_V2G_Rx_Msg_Name_din(exi_doc_DIN);
  3770. if (errn < 0)
  3771. {
  3772. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
  3773. }
  3774. }
  3775. else
  3776. {
  3777. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_DIN] decode_dinExiDocument: %d (DEC)\n", errn);
  3778. errn = -1;
  3779. }
  3780. }
  3781. else
  3782. {
  3783. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_DIN] read_v2gtpHeader: %d (DEC)\n", errn);
  3784. }
  3785. return errn;
  3786. }
  3787. /*===========================================================================
  3788. FUNCTION: API_V2GMSG_EXI_Decoder_ISO1
  3789. DESCRIPTION:
  3790. PRE-CONDITION:
  3791. INPUT:
  3792. OUTPUT:
  3793. GLOBAL VARIABLES:
  3794. =============================================================================*/
  3795. int API_V2GMSG_EXI_Decoder_ISO1(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso1EXIDocument *exi_doc_ISO1)
  3796. {
  3797. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[API_V2GMSG_EXI_Decoder_ISO1] Entered!\n");
  3798. int errn = 0;
  3799. size_t pos = 0;
  3800. uint32_t payloadLengthDec = 0;
  3801. //Initialize iStream
  3802. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3803. iStream.pos = &pos;
  3804. iStream.data = V2GTP_msg;
  3805. iStream.buffer = 0;
  3806. iStream.capacity = 0;
  3807. //Print the original EXI message
  3808. PRINT_V2GTP_STREAM(&iStream);
  3809. //STEP 1: Parsing Header
  3810. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3811. //TC_SECC_VTB_V2GTPSessionSetup_004
  3812. if (payloadLengthDec == 0)
  3813. {
  3814. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO1]payloadLengthDec = 0");
  3815. errn = -1;
  3816. }
  3817. if (errn == 0)
  3818. {
  3819. //STEP 2: Parsing Payload EXI Message
  3820. *iStream.pos = V2GTP_HEADER_LENGTH;
  3821. errn = decode_iso1ExiDocument(&iStream, exi_doc_ISO1);
  3822. //The "eventcode" inside this function could present which kind of message it is.
  3823. if (errn == 0)
  3824. {
  3825. // successfully received and parsed.
  3826. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO1] decode_iso1ExiDocument: %d (DEC) => OK!\n", errn);
  3827. errn = Check_V2G_Rx_Msg_Name_iso1(exi_doc_ISO1);
  3828. if (errn < 0)
  3829. {
  3830. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
  3831. }
  3832. }
  3833. else
  3834. {
  3835. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO1] decode_iso1ExiDocument: %d (DEC)\n", errn);
  3836. errn = -1;
  3837. }
  3838. }
  3839. else
  3840. {
  3841. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO1] read_v2gtpHeader: %d (DEC)\n", errn);
  3842. }
  3843. return errn;
  3844. }
  3845. /*===========================================================================
  3846. FUNCTION: API_V2GMSG_EXI_Decoder_ISO2
  3847. DESCRIPTION:
  3848. PRE-CONDITION:
  3849. INPUT:
  3850. OUTPUT:
  3851. GLOBAL VARIABLES:
  3852. =============================================================================*/
  3853. int API_V2GMSG_EXI_Decoder_ISO2(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso2EXIDocument *exi_doc_ISO2)
  3854. {
  3855. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[API_V2GMSG_EXI_Decoder_ISO2] Entered!\n");
  3856. int errn = 0;
  3857. size_t pos = 0;
  3858. uint32_t payloadLengthDec = 0;
  3859. //Initialize iStream
  3860. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3861. iStream.pos = &pos;
  3862. iStream.data = V2GTP_msg;
  3863. iStream.buffer = 0;
  3864. iStream.capacity = 0;
  3865. //Print the original EXI message
  3866. PRINT_V2GTP_STREAM(&iStream);
  3867. //STEP 1: Parsing Header
  3868. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3869. //TC_SECC_VTB_V2GTPSessionSetup_004
  3870. if (payloadLengthDec == 0)
  3871. {
  3872. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO2]payloadLengthDec = 0\n");
  3873. errn = -1;
  3874. }
  3875. if (errn == 0)
  3876. {
  3877. //STEP 2: Parsing Payload EXI Message
  3878. *iStream.pos = V2GTP_HEADER_LENGTH;
  3879. errn = decode_iso2ExiDocument(&iStream, exi_doc_ISO2);
  3880. //The "eventcode" inside this function could present which kind of message it is.
  3881. if (errn == 0)
  3882. {
  3883. // successfully received and parsed.
  3884. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO2] decode_iso2ExiDocument: %d (DEC) => OK!\n", errn);
  3885. errn = Check_V2G_Rx_Msg_Name_iso2(exi_doc_ISO2);
  3886. if (errn < 0)
  3887. {
  3888. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
  3889. }
  3890. }
  3891. else
  3892. {
  3893. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO2] decode_iso2ExiDocument: %d (DEC)\n", errn);
  3894. }
  3895. }
  3896. else
  3897. {
  3898. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO2] read_v2gtpHeader: %d (DEC)\n", errn);
  3899. }
  3900. return errn;
  3901. }
  3902. /*===========================================================================
  3903. FUNCTION: PRINT_dinPhysicalValueType_UNIT
  3904. DESCRIPTION:
  3905. PRE-CONDITION:
  3906. INPUT:
  3907. OUTPUT:
  3908. GLOBAL VARIABLES:
  3909. =============================================================================*/
  3910. void PRINT_dinPhysicalValueType_UNIT(struct dinPhysicalValueType *obj)
  3911. {
  3912. if (obj->Unit_isUsed == TRUE)
  3913. {
  3914. switch (obj->Unit)
  3915. {
  3916. case dinunitSymbolType_h: // = 0,
  3917. {
  3918. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: h)");
  3919. break;
  3920. }
  3921. case dinunitSymbolType_m: // = 1,
  3922. {
  3923. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: m)");
  3924. break;
  3925. }
  3926. case dinunitSymbolType_s: // = 2,
  3927. {
  3928. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: s)");
  3929. break;
  3930. }
  3931. case dinunitSymbolType_A: // = 3,
  3932. {
  3933. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: A)");
  3934. break;
  3935. }
  3936. case dinunitSymbolType_Ah: // = 4,
  3937. {
  3938. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Ah)");
  3939. break;
  3940. }
  3941. case dinunitSymbolType_V: // = 5,
  3942. {
  3943. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: V)");
  3944. break;
  3945. }
  3946. case dinunitSymbolType_VA: // = 6,
  3947. {
  3948. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: VA)");
  3949. break;
  3950. }
  3951. case dinunitSymbolType_W: // = 7,
  3952. {
  3953. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W)");
  3954. break;
  3955. }
  3956. case dinunitSymbolType_W_s: // = 8,
  3957. {
  3958. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W_s)");
  3959. break;
  3960. }
  3961. case dinunitSymbolType_Wh: // = 9
  3962. {
  3963. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Wh)");
  3964. break;
  3965. }
  3966. default:
  3967. {
  3968. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] unit: unexpected dinPhysicalValueType unit)");
  3969. break;
  3970. }
  3971. }
  3972. }
  3973. else
  3974. {
  3975. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: null)");
  3976. }
  3977. }
  3978. /*===========================================================================
  3979. FUNCTION: PRINT_iso1PhysicalValueType_UNIT
  3980. DESCRIPTION:
  3981. PRE-CONDITION:
  3982. INPUT:
  3983. OUTPUT:
  3984. GLOBAL VARIABLES:
  3985. =============================================================================*/
  3986. void PRINT_iso1PhysicalValueType_UNIT(struct iso1PhysicalValueType *obj)
  3987. {
  3988. switch (obj->Unit)
  3989. {
  3990. case iso1unitSymbolType_h: // = 0,
  3991. {
  3992. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: h)");
  3993. break;
  3994. }
  3995. case iso1unitSymbolType_m: // = 1,
  3996. {
  3997. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: m)");
  3998. break;
  3999. }
  4000. case iso1unitSymbolType_s: // = 2,
  4001. {
  4002. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: s)");
  4003. break;
  4004. }
  4005. case iso1unitSymbolType_A: // = 3,
  4006. {
  4007. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: A)");
  4008. break;
  4009. }
  4010. case iso1unitSymbolType_V: // = 4,
  4011. {
  4012. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: V)");
  4013. break;
  4014. }
  4015. case iso1unitSymbolType_W: // = 5,
  4016. {
  4017. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W)");
  4018. break;
  4019. }
  4020. case iso1unitSymbolType_Wh: // = 6
  4021. {
  4022. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Wh)");
  4023. break;
  4024. }
  4025. default:
  4026. {
  4027. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] unit: unexpected iso1PhysicalValueType unit)");
  4028. break;
  4029. }
  4030. }
  4031. }
  4032. /*===========================================================================
  4033. FUNCTION: GetValue_dinPhysicalValueType
  4034. DESCRIPTION:
  4035. PRE-CONDITION:
  4036. INPUT:
  4037. OUTPUT:
  4038. GLOBAL VARIABLES:
  4039. =============================================================================*/
  4040. int GetValue_dinPhysicalValueType(struct dinPhysicalValueType *obj)
  4041. {
  4042. int result;
  4043. result = (obj->Value) * pow(10, obj->Multiplier);
  4044. return result;
  4045. }
  4046. /*===========================================================================
  4047. FUNCTION: GetValue_iso1PhysicalValueType
  4048. DESCRIPTION:
  4049. PRE-CONDITION:
  4050. INPUT:
  4051. OUTPUT:
  4052. GLOBAL VARIABLES:
  4053. =============================================================================*/
  4054. int GetValue_iso1PhysicalValueType(struct iso1PhysicalValueType *obj)
  4055. {
  4056. int result;
  4057. result = (obj->Value) * pow(10, obj->Multiplier);
  4058. return result;
  4059. }
  4060. /*===========================================================================
  4061. FUNCTION: PRINT_dinDC_EVErrorCodeType
  4062. DESCRIPTION:
  4063. PRE-CONDITION:
  4064. INPUT:
  4065. OUTPUT:
  4066. GLOBAL VARIABLES:
  4067. =============================================================================*/
  4068. void PRINT_dinDC_EVErrorCodeType(struct dinDC_EVStatusType *status)
  4069. {
  4070. switch (status->EVErrorCode)
  4071. {
  4072. case dinDC_EVErrorCodeType_NO_ERROR: // = 0,
  4073. {
  4074. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NO_ERROR)");
  4075. break;
  4076. }
  4077. case dinDC_EVErrorCodeType_FAILED_RESSTemperatureInhibit: // = 1,
  4078. {
  4079. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)");
  4080. break;
  4081. }
  4082. case dinDC_EVErrorCodeType_FAILED_EVShiftPosition: // = 2,
  4083. {
  4084. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)");
  4085. break;
  4086. }
  4087. case dinDC_EVErrorCodeType_FAILED_ChargerConnectorLockFault: // = 3,
  4088. {
  4089. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)");
  4090. break;
  4091. }
  4092. case dinDC_EVErrorCodeType_FAILED_EVRESSMalfunction: // = 4,
  4093. {
  4094. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)");
  4095. break;
  4096. }
  4097. case dinDC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
  4098. {
  4099. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)");
  4100. break;
  4101. }
  4102. case dinDC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange: // = 6,
  4103. {
  4104. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)");
  4105. break;
  4106. }
  4107. case dinDC_EVErrorCodeType_Reserved_A: // = 7,
  4108. {
  4109. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)");
  4110. break;
  4111. }
  4112. case dinDC_EVErrorCodeType_Reserved_B: // = 8,
  4113. {
  4114. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)");
  4115. break;
  4116. }
  4117. case dinDC_EVErrorCodeType_Reserved_C: // = 9,
  4118. {
  4119. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)");
  4120. break;
  4121. }
  4122. case dinDC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
  4123. {
  4124. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)");
  4125. break;
  4126. }
  4127. case dinDC_EVErrorCodeType_NoData: // = 11
  4128. {
  4129. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)");
  4130. break;
  4131. }
  4132. default:
  4133. {
  4134. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected din EVErrorCode)");
  4135. break;
  4136. }
  4137. }
  4138. }
  4139. /*===========================================================================
  4140. FUNCTION: PRINT_iso1DC_EVErrorCodeType
  4141. DESCRIPTION:
  4142. PRE-CONDITION:
  4143. INPUT:
  4144. OUTPUT:
  4145. GLOBAL VARIABLES:
  4146. =============================================================================*/
  4147. void PRINT_iso1DC_EVErrorCodeType(struct iso1DC_EVStatusType *status)
  4148. {
  4149. switch (status->EVErrorCode)
  4150. {
  4151. case iso1DC_EVErrorCodeType_NO_ERROR: // = 0,
  4152. {
  4153. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NO_ERROR)");
  4154. break;
  4155. }
  4156. case iso1DC_EVErrorCodeType_FAILED_RESSTemperatureInhibit: // = 1,
  4157. {
  4158. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)");
  4159. break;
  4160. }
  4161. case iso1DC_EVErrorCodeType_FAILED_EVShiftPosition: // = 2,
  4162. {
  4163. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)");
  4164. break;
  4165. }
  4166. case iso1DC_EVErrorCodeType_FAILED_ChargerConnectorLockFault: // = 3,
  4167. {
  4168. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)");
  4169. break;
  4170. }
  4171. case iso1DC_EVErrorCodeType_FAILED_EVRESSMalfunction: // = 4,
  4172. {
  4173. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)");
  4174. break;
  4175. }
  4176. case iso1DC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
  4177. {
  4178. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)");
  4179. break;
  4180. }
  4181. case iso1DC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange: // = 6,
  4182. {
  4183. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)");
  4184. break;
  4185. }
  4186. case iso1DC_EVErrorCodeType_Reserved_A: // = 7,
  4187. {
  4188. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)");
  4189. break;
  4190. }
  4191. case iso1DC_EVErrorCodeType_Reserved_B: // = 8,
  4192. {
  4193. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)");
  4194. break;
  4195. }
  4196. case iso1DC_EVErrorCodeType_Reserved_C: // = 9,
  4197. {
  4198. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)");
  4199. break;
  4200. }
  4201. case iso1DC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
  4202. {
  4203. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)");
  4204. break;
  4205. }
  4206. case iso1DC_EVErrorCodeType_NoData: // = 11
  4207. {
  4208. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)");
  4209. break;
  4210. }
  4211. default:
  4212. {
  4213. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected iso1 EVErrorCode)");
  4214. break;
  4215. }
  4216. }
  4217. }
  4218. /*===========================================================================
  4219. FUNCTION: PRINT_dinDC_EVStatusType
  4220. DESCRIPTION:
  4221. PRE-CONDITION:
  4222. INPUT:
  4223. OUTPUT:
  4224. GLOBAL VARIABLES:
  4225. =============================================================================*/
  4226. void PRINT_dinDC_EVStatusType(struct dinDC_EVStatusType *status)
  4227. {
  4228. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVStatus:");
  4229. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVReady = %d (DEC) ", status->EVReady);
  4230. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVErrorCode = %d (DEC) ", status->EVErrorCode);
  4231. PRINT_dinDC_EVErrorCodeType(status);
  4232. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSSOC = %d \%(DEC) \n", status->EVRESSSOC);
  4233. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVCabinConditioning = %d (DEC) ", status->EVCabinConditioning);
  4234. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVCabinConditioning_isUsed = %d (DEC) ", status->EVCabinConditioning_isUsed);
  4235. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSConditioning = %d (DEC) ", status->EVRESSConditioning);
  4236. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSConditioning_isUsed = %d (DEC) \n", status->EVRESSConditioning_isUsed);
  4237. }
  4238. /*===========================================================================
  4239. FUNCTION: PRINT_iso1DC_EVStatusType
  4240. DESCRIPTION:
  4241. PRE-CONDITION:
  4242. INPUT:
  4243. OUTPUT:
  4244. GLOBAL VARIABLES:
  4245. =============================================================================*/
  4246. void PRINT_iso1DC_EVStatusType(struct iso1DC_EVStatusType *status)
  4247. {
  4248. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVStatus:");
  4249. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVReady = %d (DEC) ", status->EVReady);
  4250. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVErrorCode = %d (DEC) ", status->EVErrorCode);
  4251. PRINT_iso1DC_EVErrorCodeType(status);
  4252. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSSOC = %d \%(DEC) \n", status->EVRESSSOC);
  4253. }