api.c 190 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031
  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. /*+++ 20200808, vern, add Pmax parameters in chargeParameters discovery +++*/
  2067. in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value*=10;
  2068. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax = in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value;
  2069. /*--- 20200808, vern, add Pmax parameters in chargeParameters discovery ---*/
  2070. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
  2071. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 600;
  2072. //list->SAScheduleTuple.array[0].SalesTariff.xxx
  2073. //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
  2074. //----- [BODY (4/5)] AC_EVSEChargeParameter of EVSEChargeParameter -----
  2075. //ignore, since DIN doesn't support AC
  2076. //----- [BODY (5/5)] DC_EVSEChargeParameter of EVSEChargeParameter -----
  2077. out->DC_EVSEChargeParameter_isUsed = 1u;
  2078. struct dinDC_EVSEChargeParameterType *out_dc_para;
  2079. struct DC_EVSEChargeParameterType_DIN70121 *in_dc_para;
  2080. out_dc_para = &out->DC_EVSEChargeParameter;
  2081. in_dc_para = &in->DC_EVSEChargeParameter;
  2082. //DC_EVSEStatus
  2083. out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
  2084. SHM_Read_dinDC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
  2085. //EVSEMaximumCurrentLimit
  2086. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
  2087. //EVSEMaximumPowerLimit
  2088. out_dc_para->EVSEMaximumPowerLimit_isUsed = 1u;
  2089. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
  2090. //EVSEMaximumVoltageLimit
  2091. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
  2092. //EVSEMinimumVoltageLimit
  2093. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
  2094. //EVSEMinimumCurrentLimit
  2095. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
  2096. //EVSECurrentRegulationTolerance_isUsed
  2097. out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
  2098. //EVSECurrentRegulationTolerance
  2099. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
  2100. //EVSEEnergyToBeDelivered_isUsed
  2101. out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
  2102. //EVSEEnergyToBeDelivered (optional)
  2103. //SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
  2104. //EVSEPeakCurrentRipple
  2105. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
  2106. }
  2107. /*===========================================================================
  2108. FUNCTION: SHM_Read_iso1_ChargeParameterDiscoveryRes
  2109. DESCRIPTION:
  2110. PRE-CONDITION:
  2111. INPUT:
  2112. 1. shm_ccs
  2113. OUTPUT:
  2114. 2. exi_doc_ISO1
  2115. GLOBAL VARIABLES:
  2116. =============================================================================*/
  2117. void SHM_Read_iso1_ChargeParameterDiscoveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2118. {
  2119. struct iso1ChargeParameterDiscoveryResType *out;
  2120. struct ChargeParameterDiscoveryResponse_ISO15118_2014 *in;
  2121. out = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes;
  2122. in = &shm_ccs->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryResponse;
  2123. //Initialize
  2124. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2125. init_iso1ChargeParameterDiscoveryResType(out);
  2126. exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
  2127. //----- [BODY (1/5)] ResponseCode -----
  2128. out->ResponseCode = (unsigned char) in->ResponseCode;
  2129. //----- [BODY (2/5)] EVSEProcessing -----
  2130. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2131. // iso1EVSEProcessingType_Finished = 0,
  2132. // iso1EVSEProcessingType_Ongoing = 1
  2133. //----- [BODY (3/5)] SAScheduleList of SASchedules -----
  2134. //[Joseph] Here keep constant values and not copy from share memory, yet.
  2135. out->SAScheduleList_isUsed = 1u;
  2136. struct iso1SAScheduleListType *list;
  2137. list = &out->SAScheduleList;
  2138. //
  2139. list->SAScheduleTuple.arrayLen = 1;
  2140. list->SAScheduleTuple.array[0].SAScheduleTupleID = 0;
  2141. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleID = 0;
  2142. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
  2143. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
  2144. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
  2145. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = 86400; //24Hrs at least, unit:second
  2146. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
  2147. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
  2148. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 86400;
  2149. /*+++ 20200808, vern, add Pmax parameters in chargeParameters discovery +++*/
  2150. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Unit = iso1unitSymbolType_W; //iso1unitSymbolType_W
  2151. in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value*=10; /*+++ 20200808, vern, lack one more 0 ---*/
  2152. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Value =in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value; //30000 if DW/DM product
  2153. /*--- 20200808, vern, add Pmax parameters in chargeParameters discovery ---*/
  2154. //list->SAScheduleTuple.array[0].SalesTariff.xxx
  2155. //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
  2156. //----- [BODY (4/5)] AC/DC EVSEChargeParameter -----
  2157. #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
  2158. {
  2159. //----- [BODY (4/5)] AC_EVSEChargeParameter -----
  2160. out->AC_EVSEChargeParameter_isUsed = 1u;
  2161. struct iso1AC_EVSEChargeParameterType *out_ac_para;
  2162. struct AC_EVSEChargeParameterType_ISO15118_2014 *in_ac_para;
  2163. out_ac_para = &out->AC_EVSEChargeParameter;
  2164. in_ac_para = &in->AC_EVSEChargeParameter;
  2165. //[1/3] AC_EVSEStatus
  2166. SHM_Read_iso1AC_EVSEStatusType(&out_ac_para->AC_EVSEStatus, &in_ac_para->AC_EVSEStatus);
  2167. //[2/3] EVSENominalVoltage
  2168. SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSENominalVoltage, &in_ac_para->EVSENominalVoltage);
  2169. //[3/3] EVSEMaxCurrent
  2170. SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSEMaxCurrent, &in_ac_para->EVSEMaxCurrent);
  2171. }
  2172. #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
  2173. {
  2174. //----- [BODY (5/5)] DC_EVSEChargeParameter -----
  2175. out->DC_EVSEChargeParameter_isUsed = 1u;
  2176. struct iso1DC_EVSEChargeParameterType *out_dc_para;
  2177. struct DC_EVSEChargeParameterType_ISO15118_2014 *in_dc_para;
  2178. out_dc_para = &out->DC_EVSEChargeParameter;
  2179. in_dc_para = &in->DC_EVSEChargeParameter;
  2180. //DC_EVSEStatus
  2181. out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
  2182. SHM_Read_iso1DC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
  2183. //EVSEMaximumCurrentLimit
  2184. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
  2185. //EVSEMaximumPowerLimit
  2186. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
  2187. //EVSEMaximumVoltageLimit
  2188. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
  2189. //EVSEMinimumVoltageLimit
  2190. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
  2191. //EVSEMinimumCurrentLimit
  2192. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
  2193. //EVSECurrentRegulationTolerance_isUsed
  2194. out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
  2195. //EVSECurrentRegulationTolerance
  2196. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
  2197. //EVSEEnergyToBeDelivered_isUsed
  2198. out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
  2199. //EVSEEnergyToBeDelivered (optional)
  2200. //SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
  2201. //EVSEPeakCurrentRipple
  2202. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
  2203. }
  2204. #endif
  2205. }
  2206. /*===========================================================================
  2207. FUNCTION: SHM_Read_din_CableCheckRes
  2208. DESCRIPTION:
  2209. PRE-CONDITION:
  2210. INPUT:
  2211. 1. shm_ccs
  2212. OUTPUT:
  2213. 2. exi_doc_DIN
  2214. GLOBAL VARIABLES:
  2215. =============================================================================*/
  2216. void SHM_Read_din_CableCheckRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2217. {
  2218. struct dinCableCheckResType *out;
  2219. struct CableCheckResponse_DIN70121 *in;
  2220. out = &exi_doc_DIN->V2G_Message.Body.CableCheckRes;
  2221. in = &shm_ccs->V2GMessage_DIN70121.CableCheckResponse;
  2222. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2223. init_dinCableCheckResType(out);
  2224. exi_doc_DIN->V2G_Message.Body.CableCheckRes_isUsed = 1u;
  2225. //----- [BODY (1/3)] ResponseCode -----
  2226. out->ResponseCode = (unsigned char) in->ResponseCode;
  2227. //----- [BODY (2/3)] EVSEProcessing -----
  2228. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2229. // dinEVSEProcessingType_Finished = 0,
  2230. // dinEVSEProcessingType_Ongoing = 1
  2231. //----- [BODY (3/3)] DC_EVSEStatus -----
  2232. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2233. }
  2234. /*===========================================================================
  2235. FUNCTION: SHM_Read_iso1_CableCheckRes
  2236. DESCRIPTION:
  2237. PRE-CONDITION:
  2238. INPUT:
  2239. 1. shm_ccs
  2240. OUTPUT:
  2241. 2. exi_doc_ISO1
  2242. GLOBAL VARIABLES:
  2243. =============================================================================*/
  2244. void SHM_Read_iso1_CableCheckRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2245. {
  2246. struct iso1CableCheckResType *out;
  2247. struct CableCheckResponse_ISO15118_2014 *in;
  2248. out = &exi_doc_ISO1->V2G_Message.Body.CableCheckRes;
  2249. in = &shm_ccs->V2GMessage_ISO15118_2014.CableCheckResponse;
  2250. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2251. init_iso1CableCheckResType(out);
  2252. exi_doc_ISO1->V2G_Message.Body.CableCheckRes_isUsed = 1u;
  2253. //----- [BODY (1/3)] ResponseCode -----
  2254. out->ResponseCode = (unsigned char) in->ResponseCode;
  2255. //----- [BODY (2/3)] EVSEProcessing -----
  2256. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2257. // iso1EVSEProcessingType_Finished = 0,
  2258. // iso1EVSEProcessingType_Ongoing = 1
  2259. //----- [BODY (3/3)] DC_EVSEStatus -----
  2260. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2261. }
  2262. /*===========================================================================
  2263. FUNCTION: SHM_Read_din_PreChargeRes
  2264. DESCRIPTION:
  2265. PRE-CONDITION:
  2266. INPUT:
  2267. 1. shm_ccs
  2268. OUTPUT:
  2269. 2. exi_doc_DIN
  2270. GLOBAL VARIABLES:
  2271. =============================================================================*/
  2272. void SHM_Read_din_PreChargeRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2273. {
  2274. struct dinPreChargeResType *out;
  2275. struct PreChargeResponse_DIN70121 *in;
  2276. out = &exi_doc_DIN->V2G_Message.Body.PreChargeRes;
  2277. in = &shm_ccs->V2GMessage_DIN70121.PreChargeResponse;
  2278. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2279. init_dinPreChargeResType(&exi_doc_DIN->V2G_Message.Body.PreChargeRes);
  2280. exi_doc_DIN->V2G_Message.Body.PreChargeRes_isUsed = 1u;
  2281. //----- [BODY (1/3)] ResponseCode -----
  2282. out->ResponseCode = (unsigned char) in->ResponseCode;
  2283. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2284. SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2285. // dinunitSymbolType_h = 0,
  2286. // dinunitSymbolType_m = 1,
  2287. // dinunitSymbolType_s = 2,
  2288. // dinunitSymbolType_A = 3,
  2289. // dinunitSymbolType_Ah = 4,
  2290. // dinunitSymbolType_V = 5,
  2291. // dinunitSymbolType_VA = 6,
  2292. // dinunitSymbolType_W = 7,
  2293. // dinunitSymbolType_W_s = 8,
  2294. // dinunitSymbolType_Wh = 9
  2295. //----- [BODY (3/3)] DC_EVSEStatus -----
  2296. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2297. }
  2298. /*===========================================================================
  2299. FUNCTION: SHM_Read_iso1_PreChargeRes
  2300. DESCRIPTION:
  2301. PRE-CONDITION:
  2302. INPUT:
  2303. 1. shm_ccs
  2304. OUTPUT:
  2305. 2. exi_doc_ISO1
  2306. GLOBAL VARIABLES:
  2307. =============================================================================*/
  2308. void SHM_Read_iso1_PreChargeRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2309. {
  2310. struct iso1PreChargeResType *out;
  2311. struct PreChargeResponse_ISO15118_2014 *in;
  2312. out = &exi_doc_ISO1->V2G_Message.Body.PreChargeRes;
  2313. in = &shm_ccs->V2GMessage_ISO15118_2014.PreChargeResponse;
  2314. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2315. init_iso1PreChargeResType(&exi_doc_ISO1->V2G_Message.Body.PreChargeRes);
  2316. exi_doc_ISO1->V2G_Message.Body.PreChargeRes_isUsed = 1u;
  2317. //----- [BODY (1/3)] ResponseCode -----
  2318. out->ResponseCode = (unsigned char) in->ResponseCode;
  2319. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2320. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2321. //iso1unitSymbolType_h = 0,
  2322. //iso1unitSymbolType_m = 1,
  2323. //iso1unitSymbolType_s = 2,
  2324. //iso1unitSymbolType_A = 3,
  2325. //iso1unitSymbolType_V = 4,
  2326. //iso1unitSymbolType_W = 5,
  2327. //iso1unitSymbolType_Wh = 6
  2328. //----- [BODY (3/3)] DC_EVSEStatus -----
  2329. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2330. }
  2331. /*===========================================================================
  2332. FUNCTION: SHM_Read_din_PowerDeliveryRes
  2333. DESCRIPTION:
  2334. PRE-CONDITION:
  2335. INPUT:
  2336. 1. shm_ccs
  2337. OUTPUT:
  2338. 2. exi_doc_DIN
  2339. GLOBAL VARIABLES:
  2340. =============================================================================*/
  2341. void SHM_Read_din_PowerDeliveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2342. {
  2343. struct dinPowerDeliveryResType *out;
  2344. struct PowerDeliveryResponse_DIN70121 *in;
  2345. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2346. init_dinPowerDeliveryResType(&exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes);
  2347. out = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes;
  2348. in = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryResponse;
  2349. exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
  2350. //----- [BODY (1/3)] ResponseCode -----
  2351. out->ResponseCode = (unsigned char) in->ResponseCode;
  2352. //----- [BODY (2/3)] AC_EVSEStatus -----
  2353. //ignore, since DIN 70121 doesn't support AC, yet.
  2354. //----- [BODY (2/3)] DC_EVSEStatus -----
  2355. out->DC_EVSEStatus_isUsed = 1u;
  2356. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2357. }
  2358. /*===========================================================================
  2359. FUNCTION: SHM_Read_iso1_PowerDeliveryRes
  2360. DESCRIPTION:
  2361. PRE-CONDITION:
  2362. INPUT:
  2363. 1. shm_ccs
  2364. OUTPUT:
  2365. 2. exi_doc_ISO1
  2366. GLOBAL VARIABLES:
  2367. =============================================================================*/
  2368. void SHM_Read_iso1_PowerDeliveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2369. {
  2370. struct iso1PowerDeliveryResType *out;
  2371. struct PowerDeliveryResponse_ISO15118_2014 *in;
  2372. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2373. init_iso1PowerDeliveryResType(&exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes);
  2374. out = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes;
  2375. in = &shm_ccs->V2GMessage_ISO15118_2014.PowerDeliveryResponse;
  2376. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
  2377. //----- [BODY (1/3)] ResponseCode -----
  2378. out->ResponseCode = (unsigned char) in->ResponseCode;
  2379. //----- [BODY (2/3)] AC_EVSEStatus -----
  2380. //ignore, since our ISO1 70121 doesn't support AC, yet.
  2381. //----- [BODY (2/3)] DC_EVSEStatus -----
  2382. #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
  2383. {
  2384. //out->DC_EVSEStatus_isUsed = 0u;
  2385. }
  2386. #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
  2387. {
  2388. out->DC_EVSEStatus_isUsed = 1u;
  2389. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2390. }
  2391. #endif
  2392. }
  2393. /*===========================================================================
  2394. FUNCTION: SHM_Read_din_CurrentDemandRes
  2395. DESCRIPTION:
  2396. PRE-CONDITION:
  2397. INPUT:
  2398. 1. shm_ccs
  2399. OUTPUT:
  2400. 2. exi_doc_DIN
  2401. GLOBAL VARIABLES:
  2402. =============================================================================*/
  2403. void SHM_Read_din_CurrentDemandRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2404. {
  2405. struct dinCurrentDemandResType *out;
  2406. struct CurrentDemandResponse_DIN70121 *in;
  2407. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2408. init_dinCurrentDemandResType(&exi_doc_DIN->V2G_Message.Body.CurrentDemandRes);
  2409. out = &exi_doc_DIN->V2G_Message.Body.CurrentDemandRes;
  2410. in = &shm_ccs->V2GMessage_DIN70121.CurrentDemandResponse;
  2411. exi_doc_DIN->V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
  2412. //----- [BODY (1/10)] ResponseCode -----
  2413. out->ResponseCode = (unsigned char) in->ResponseCode;
  2414. //----- [BODY (2/10)] DC_EVSEStatus -----
  2415. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2416. //----- [BODY (3/10)] EVSEPresentVoltage -----
  2417. SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2418. //----- [BODY (4/10)] EVSEPresentCurrent -----
  2419. SHM_Read_dinPhysicalValueType(&out->EVSEPresentCurrent, &in->EVSEPresentCurrent);
  2420. //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
  2421. out->EVSECurrentLimitAchieved = in->EVSECurrentLimitAchieved;
  2422. //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
  2423. out->EVSEVoltageLimitAchieved = in->EVSEVoltageLimitAchieved;
  2424. //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
  2425. out->EVSEPowerLimitAchieved = in->EVSEPowerLimitAchieved;
  2426. //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
  2427. out->EVSEMaximumVoltageLimit_isUsed = 1u;
  2428. SHM_Read_dinPhysicalValueType(&out->EVSEMaximumVoltageLimit, &in->EVSEMaximumVoltageLimit);
  2429. //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
  2430. out->EVSEMaximumCurrentLimit_isUsed = 1u;
  2431. SHM_Read_dinPhysicalValueType(&out->EVSEMaximumCurrentLimit, &in->EVSEMaximumCurrentLimit);
  2432. //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
  2433. out->EVSEMaximumPowerLimit_isUsed = 1u;
  2434. SHM_Read_dinPhysicalValueType(&out->EVSEMaximumPowerLimit, &in->EVSEMaximumPowerLimit);
  2435. }
  2436. /*===========================================================================
  2437. FUNCTION: SHM_Read_iso1_CurrentDemandRes
  2438. DESCRIPTION:
  2439. PRE-CONDITION:
  2440. INPUT:
  2441. 1. shm_ccs
  2442. OUTPUT:
  2443. 2. exi_doc_ISO1
  2444. GLOBAL VARIABLES:
  2445. =============================================================================*/
  2446. void SHM_Read_iso1_CurrentDemandRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2447. {
  2448. struct iso1CurrentDemandResType *out;
  2449. struct CurrentDemandResponse_ISO15118_2014 *in;
  2450. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2451. init_iso1CurrentDemandResType(&exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes);
  2452. out = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes;
  2453. in = &shm_ccs->V2GMessage_ISO15118_2014.CurrentDemandResponse;
  2454. exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
  2455. //vern, fill up necessary
  2456. out->EVSEID.charactersLen=7;
  2457. out->EVSEID.characters[0]='Z';
  2458. out->EVSEID.characters[1]='Z';
  2459. out->EVSEID.characters[2]='0';
  2460. out->EVSEID.characters[3]='0';
  2461. out->EVSEID.characters[4]='0';
  2462. out->EVSEID.characters[5]='0';
  2463. out->EVSEID.characters[6]='0';
  2464. out->SAScheduleTupleID=1;
  2465. out->MeterInfo_isUsed=0u;
  2466. out->ReceiptRequired_isUsed=0u;
  2467. //----- [BODY (1/10)] ResponseCode -----
  2468. out->ResponseCode = (unsigned char) in->ResponseCode;
  2469. //----- [BODY (2/10)] DC_EVSEStatus -----
  2470. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2471. //----- [BODY (3/10)] EVSEPresentVoltage -----
  2472. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2473. //----- [BODY (4/10)] EVSEPresentCurrent -----
  2474. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentCurrent, &in->EVSEPresentCurrent);
  2475. //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
  2476. out->EVSECurrentLimitAchieved = in->EVSECurrentLimitAchieved;
  2477. //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
  2478. out->EVSEVoltageLimitAchieved = in->EVSEVoltageLimitAchieved;
  2479. //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
  2480. out->EVSEPowerLimitAchieved = in->EVSEPowerLimitAchieved;
  2481. //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
  2482. out->EVSEMaximumVoltageLimit_isUsed = 1u;
  2483. SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumVoltageLimit, &in->EVSEMaximumVoltageLimit);
  2484. //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
  2485. out->EVSEMaximumCurrentLimit_isUsed = 1u;
  2486. SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumCurrentLimit, &in->EVSEMaximumCurrentLimit);
  2487. //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
  2488. out->EVSEMaximumPowerLimit_isUsed = 1u;
  2489. SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumPowerLimit, &in->EVSEMaximumPowerLimit);
  2490. }
  2491. /*===========================================================================
  2492. FUNCTION: SHM_Read_iso1_ChargingStatusRes
  2493. DESCRIPTION:
  2494. PRE-CONDITION:
  2495. INPUT:
  2496. 1. shm_ccs
  2497. OUTPUT:
  2498. 2. exi_doc_ISO1
  2499. GLOBAL VARIABLES:
  2500. =============================================================================*/
  2501. void SHM_Read_iso1_ChargingStatusRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2502. {
  2503. int i = 0;
  2504. struct iso1ChargingStatusResType *out;
  2505. struct ChargingStatusResponse_ISO15118_2014 *in;
  2506. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2507. init_iso1ChargingStatusResType(&exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes);
  2508. out = &exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes;
  2509. in = &shm_ccs->V2GMessage_ISO15118_2014.ChargingStatusResponse;
  2510. exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes_isUsed = 1u;
  2511. //----- [BODY (1/10)] ResponseCode -----
  2512. out->ResponseCode = (unsigned char)in->ResponseCode;
  2513. //----- [BODY (2/10)] AC_EVSEStatus -----
  2514. SHM_Read_iso1AC_EVSEStatusType(&out->AC_EVSEStatus, &in->AC_EVSEStatus);
  2515. //----- [BODY (3/10)] EVSEMaxCurrent -----
  2516. out->EVSEMaxCurrent_isUsed = 1u;
  2517. SHM_Read_iso1PhysicalValueType(&out->EVSEMaxCurrent, &in->EVSEMaxCurrent);
  2518. //----- [BODY (4/10)] SAScheduleTupleID -----
  2519. out->SAScheduleTupleID = (unsigned char)in->SAScheduleTupleID; //[CAUTION] data type
  2520. //----- [BODY (5/10)] EVSEID -----
  2521. out->EVSEID.charactersLen = 37; //min length: 7, max length:37 bytes(ISO1, AC)
  2522. for (i = 0; i< out->EVSEID.charactersLen; i++)
  2523. {
  2524. out->EVSEID.characters[i] = (unsigned char)in->EVSEID[i];
  2525. }
  2526. //----- [BODY (6/10)] MeterInfo -----
  2527. out->MeterInfo_isUsed = 1u;
  2528. SHM_Read_iso1MeterInfo(&out->MeterInfo, &in->MeterInfo);
  2529. //----- [BODY (7/10)] ReceiptRequired -----
  2530. out->ReceiptRequired_isUsed = 1u;
  2531. out->ReceiptRequired = (int)in->ReceiptRequired;
  2532. }
  2533. /*===========================================================================
  2534. FUNCTION: SHM_Read_din_WeldingDetectionRes
  2535. DESCRIPTION:
  2536. PRE-CONDITION:
  2537. INPUT:
  2538. 1. shm_ccs
  2539. OUTPUT:
  2540. 2. exi_doc_DIN
  2541. GLOBAL VARIABLES:
  2542. =============================================================================*/
  2543. void SHM_Read_din_WeldingDetectionRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2544. {
  2545. struct dinWeldingDetectionResType *out;
  2546. struct WeldingDetectionResponse_DIN70121 *in;
  2547. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2548. init_dinWeldingDetectionResType(&exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes);
  2549. out = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes;
  2550. in = &shm_ccs->V2GMessage_DIN70121.WeldingDetectionResponse;
  2551. exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
  2552. //----- [BODY (1/3)] ResponseCode -----
  2553. out->ResponseCode = (unsigned char) in->ResponseCode;
  2554. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2555. SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2556. //----- [BODY (3/3)] DC_EVSEStatus -----
  2557. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2558. }
  2559. /*===========================================================================
  2560. FUNCTION: SHM_Read_iso1_WeldingDetectionRes
  2561. DESCRIPTION:
  2562. PRE-CONDITION:
  2563. INPUT:
  2564. 1. shm_ccs
  2565. OUTPUT:
  2566. 2. exi_doc_ISO1
  2567. GLOBAL VARIABLES:
  2568. =============================================================================*/
  2569. void SHM_Read_iso1_WeldingDetectionRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2570. {
  2571. struct iso1WeldingDetectionResType *out;
  2572. struct WeldingDetectionResponse_ISO15118_2014 *in;
  2573. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2574. init_iso1WeldingDetectionResType(&exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes);
  2575. out = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes;
  2576. in = &shm_ccs->V2GMessage_ISO15118_2014.WeldingDetectionResponse;
  2577. exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
  2578. //----- [BODY (1/3)] ResponseCode -----
  2579. out->ResponseCode = (unsigned char) in->ResponseCode;
  2580. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2581. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2582. //----- [BODY (3/3)] DC_EVSEStatus -----
  2583. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2584. }
  2585. /*===========================================================================
  2586. FUNCTION: SHM_Read_din_SessionStopRes
  2587. DESCRIPTION:
  2588. PRE-CONDITION:
  2589. INPUT:
  2590. 1. shm_ccs
  2591. OUTPUT:
  2592. 2. exi_doc_DIN
  2593. GLOBAL VARIABLES:
  2594. =============================================================================*/
  2595. void SHM_Read_din_SessionStopRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2596. {
  2597. struct dinSessionStopResType *out;
  2598. struct SessionStopResponse_DIN70121 *in;
  2599. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2600. init_dinSessionStopResType(&exi_doc_DIN->V2G_Message.Body.SessionStopRes);
  2601. out = &exi_doc_DIN->V2G_Message.Body.SessionStopRes;
  2602. in = &shm_ccs->V2GMessage_DIN70121.SessionStopResponse;
  2603. exi_doc_DIN->V2G_Message.Body.SessionStopRes_isUsed = 1u;
  2604. //----- [BODY (1/3)] ResponseCode -----
  2605. out->ResponseCode = (unsigned char) in->ResponseCode;
  2606. }
  2607. /*===========================================================================
  2608. FUNCTION: SHM_Read_iso1_SessionStopRes
  2609. DESCRIPTION:
  2610. PRE-CONDITION:
  2611. INPUT:
  2612. 1. shm_ccs
  2613. OUTPUT:
  2614. 2. exi_doc_ISO1
  2615. GLOBAL VARIABLES:
  2616. =============================================================================*/
  2617. void SHM_Read_iso1_SessionStopRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2618. {
  2619. struct iso1SessionStopResType *out;
  2620. struct SessionStopResponse_ISO15118_2014 *in;
  2621. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2622. init_iso1SessionStopResType(&exi_doc_ISO1->V2G_Message.Body.SessionStopRes);
  2623. out = &exi_doc_ISO1->V2G_Message.Body.SessionStopRes;
  2624. in = &shm_ccs->V2GMessage_ISO15118_2014.SessionStopResponse;
  2625. exi_doc_ISO1->V2G_Message.Body.SessionStopRes_isUsed = 1u;
  2626. //----- [BODY (1/3)] ResponseCode -----
  2627. out->ResponseCode = (unsigned char) in->ResponseCode;
  2628. }
  2629. /*===========================================================================
  2630. FUNCTION: PRINT_V2G_MSG_din_Header
  2631. DESCRIPTION:
  2632. PRE-CONDITION:
  2633. INPUT:
  2634. OUTPUT:
  2635. GLOBAL VARIABLES:
  2636. =============================================================================*/
  2637. void PRINT_V2G_MSG_din_Header(struct dinEXIDocument *exi_doc_DIN)
  2638. {
  2639. int i = 0;
  2640. int leng = 0;
  2641. leng = exi_doc_DIN->V2G_Message.Header.SessionID.bytesLen;
  2642. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
  2643. for (i = 0; i <leng ; i++)
  2644. {
  2645. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Header.SessionID.bytes[i]);
  2646. }
  2647. }
  2648. /*===========================================================================
  2649. FUNCTION: PRINT_V2G_MSG_iso1_Header
  2650. DESCRIPTION:
  2651. PRE-CONDITION:
  2652. INPUT:
  2653. OUTPUT:
  2654. GLOBAL VARIABLES:
  2655. =============================================================================*/
  2656. void PRINT_V2G_MSG_iso1_Header(struct iso1EXIDocument *exi_doc_ISO1)
  2657. {
  2658. int i = 0;
  2659. int leng = 0;
  2660. leng = exi_doc_ISO1->V2G_Message.Header.SessionID.bytesLen;
  2661. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
  2662. for (i = 0; i <leng ; i++)
  2663. {
  2664. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[i]);
  2665. }
  2666. }
  2667. /*===========================================================================
  2668. FUNCTION: PRINT_V2G_MSG_iso1_Header
  2669. DESCRIPTION:
  2670. PRE-CONDITION:
  2671. INPUT:
  2672. OUTPUT:
  2673. GLOBAL VARIABLES:
  2674. =============================================================================*/
  2675. void PRINT_V2G_MSG_iso2_Header(struct iso2EXIDocument *exi_doc_ISO2)
  2676. {
  2677. int i = 0;
  2678. int leng = 0;
  2679. leng = exi_doc_ISO2->V2G_Message.Header.SessionID.bytesLen;
  2680. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
  2681. for (i = 0; i <leng ; i++)
  2682. {
  2683. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[i]);
  2684. }
  2685. }
  2686. /*===========================================================================
  2687. FUNCTION: DEBUG_PRINT_EXI_MSG_supportedAppProtocolReq
  2688. DESCRIPTION:
  2689. PRE-CONDITION:
  2690. INPUT:
  2691. OUTPUT:
  2692. GLOBAL VARIABLES:
  2693. =============================================================================*/
  2694. void PRINT_XML_DOC_supportedAppProtocolReq(struct appHandEXIDocument *exi_doc)
  2695. {
  2696. int i = 0;
  2697. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n EVSE side: List of application handshake protocols of the EV \n");
  2698. for(i = 0; i < exi_doc->supportedAppProtocolReq.AppProtocol.arrayLen; i++)
  2699. {
  2700. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\tProtocol entry #=%d\n",(i+1));
  2701. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tProtocolNamespace=");
  2702. printASCIIString(
  2703. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.characters,
  2704. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.charactersLen
  2705. );
  2706. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tVersion=%d.%d\n",
  2707. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMajor,
  2708. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMinor);
  2709. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tSchemaID=%d\n", exi_doc->supportedAppProtocolReq.AppProtocol.array[i].SchemaID);
  2710. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tPriority=%d\n", exi_doc->supportedAppProtocolReq.AppProtocol.array[i].Priority);
  2711. }
  2712. }
  2713. /*===========================================================================
  2714. FUNCTION: PRINT_XML_DOC_DIN_SessionSetupReq
  2715. DESCRIPTION:
  2716. PRE-CONDITION:
  2717. INPUT:
  2718. OUTPUT:
  2719. GLOBAL VARIABLES:
  2720. =============================================================================*/
  2721. void PRINT_XML_DOC_DIN_SessionSetupReq(struct dinEXIDocument *exi_doc_DIN)
  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_din_Header(exi_doc_DIN);
  2727. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
  2728. for (i = 0; i < exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
  2729. {
  2730. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->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_ISO1_SessionSetupReq
  2736. DESCRIPTION:
  2737. PRE-CONDITION:
  2738. INPUT:
  2739. OUTPUT:
  2740. GLOBAL VARIABLES:
  2741. =============================================================================*/
  2742. void PRINT_XML_DOC_ISO1_SessionSetupReq(struct iso1EXIDocument *exi_doc_ISO1)
  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_iso1_Header(exi_doc_ISO1);
  2748. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
  2749. for (i = 0; i < exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
  2750. {
  2751. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->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_ISO2_SessionSetupReq
  2757. DESCRIPTION:
  2758. PRE-CONDITION:
  2759. INPUT:
  2760. OUTPUT:
  2761. GLOBAL VARIABLES:
  2762. =============================================================================*/
  2763. void PRINT_XML_DOC_ISO2_SessionSetupReq(struct iso2EXIDocument *exi_doc_ISO2)
  2764. {
  2765. int i = 0;
  2766. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
  2767. //===== [Header] SessionID =====
  2768. PRINT_V2G_MSG_iso2_Header(exi_doc_ISO2);
  2769. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
  2770. for (i = 0; i < exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
  2771. {
  2772. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
  2773. }
  2774. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
  2775. }
  2776. /*===========================================================================
  2777. FUNCTION: PRINT_XML_DOC_DIN_ServiceDiscoveryReq
  2778. DESCRIPTION:
  2779. PRE-CONDITION:
  2780. INPUT:
  2781. OUTPUT:
  2782. GLOBAL VARIABLES:
  2783. =============================================================================*/
  2784. void PRINT_XML_DOC_DIN_ServiceDiscoveryReq(struct dinEXIDocument *exi_doc_DIN)
  2785. {
  2786. int i = 0;
  2787. int leng = 0;
  2788. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServiceDiscoveryReq ⨀⨀⨀⨀⨀⬇\n");
  2789. //===== [Header] SessionID =====
  2790. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  2791. //[BODY(1/2)] Service Scope
  2792. leng = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.charactersLen;
  2793. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceScope (%d Bytes, optional) = ", leng);
  2794. for (i = 0; i <leng ; i++)
  2795. {
  2796. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
  2797. }
  2798. //[BODY(2/2)] Service Category
  2799. int cat = 0;
  2800. cat = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
  2801. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceCategory = %d ", cat);
  2802. switch (cat)
  2803. {
  2804. case dinserviceCategoryType_EVCharging: //0
  2805. {
  2806. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(EVCharging)");
  2807. break;
  2808. }
  2809. case dinserviceCategoryType_Internet: //1
  2810. {
  2811. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Internet: not supported)");
  2812. break;
  2813. }
  2814. case dinserviceCategoryType_ContractCertificate: //2
  2815. {
  2816. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ContractCertificate: not supported)");
  2817. break;
  2818. }
  2819. case dinserviceCategoryType_OtherCustom: //3
  2820. {
  2821. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(OtherCustom: not supported)");
  2822. break;
  2823. }
  2824. default:
  2825. {
  2826. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected Service Category: %d)", cat);
  2827. break;
  2828. }
  2829. }
  2830. //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
  2831. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServiceDiscoveryReq ⨂⨂⨂⨂⨂⬆\n\n");
  2832. }
  2833. /*===========================================================================
  2834. FUNCTION: PRINT_XML_DOC_ISO1_ServiceDiscoveryReq
  2835. DESCRIPTION:
  2836. PRE-CONDITION:
  2837. INPUT:
  2838. OUTPUT:
  2839. GLOBAL VARIABLES:
  2840. =============================================================================*/
  2841. void PRINT_XML_DOC_ISO1_ServiceDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1)
  2842. {
  2843. int i = 0;
  2844. int leng = 0;
  2845. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServiceDiscoveryReq ⨀⨀⨀⨀⨀⬇\n");
  2846. //===== [Header] SessionID =====
  2847. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  2848. //[BODY(1/2)] Service Scope
  2849. leng = exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.charactersLen;
  2850. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceScope (%d Bytes, optional) = ", leng);
  2851. for (i = 0; i <leng ; i++)
  2852. {
  2853. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
  2854. }
  2855. //[BODY(2/2)] Service Category
  2856. int cat = 0;
  2857. cat = exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
  2858. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceCategory = %d ", cat);
  2859. switch (cat)
  2860. {
  2861. case iso1serviceCategoryType_EVCharging: //0
  2862. {
  2863. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(EVCharging)");
  2864. break;
  2865. }
  2866. case iso1serviceCategoryType_Internet: //1
  2867. {
  2868. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Internet: not supported)");
  2869. break;
  2870. }
  2871. case iso1serviceCategoryType_ContractCertificate: //2
  2872. {
  2873. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ContractCertificate: not supported)");
  2874. break;
  2875. }
  2876. case iso1serviceCategoryType_OtherCustom: //3
  2877. {
  2878. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(OtherCustom: not supported)");
  2879. break;
  2880. }
  2881. default:
  2882. {
  2883. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected Service Category)");
  2884. break;
  2885. }
  2886. }
  2887. //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
  2888. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServiceDiscoveryReq ⨂⨂⨂⨂⨂⬆\n\n");
  2889. }
  2890. /*===========================================================================
  2891. FUNCTION: PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq
  2892. DESCRIPTION:
  2893. PRE-CONDITION:
  2894. INPUT:
  2895. OUTPUT:
  2896. GLOBAL VARIABLES:
  2897. =============================================================================*/
  2898. void PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq(struct dinEXIDocument *exi_doc_DIN)
  2899. {
  2900. int i = 0;
  2901. int leng = 0;
  2902. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServicePaymentSelectionReq ⨀⨀⨀⨀⨀⬇\n");
  2903. //===== [Header] SessionID =====
  2904. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  2905. //[BODY(1/2)] SelectedPaymentOption
  2906. int opt = 0;
  2907. opt = exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedPaymentOption;
  2908. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedPaymentOption = %d ", opt);
  2909. switch (opt)
  2910. {
  2911. case dinpaymentOptionType_Contract: //0
  2912. {
  2913. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Contract)");
  2914. break;
  2915. }
  2916. case dinpaymentOptionType_ExternalPayment: //1
  2917. {
  2918. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ExternalPayment)");
  2919. break;
  2920. }
  2921. default:
  2922. {
  2923. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected SelectedPaymentOption)\n");
  2924. break;
  2925. }
  2926. }
  2927. //[BODY(2/2)] SelectedServiceList
  2928. leng = exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.arrayLen;
  2929. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedServiceList (%d items) = \n", leng);
  2930. for (i = 0; i< leng; i++)
  2931. {
  2932. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t\t [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
  2933. (i+1),
  2934. exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ServiceID,
  2935. exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID,
  2936. exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID_isUsed);
  2937. }
  2938. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServicePaymentSelectionReq ⨂⨂⨂⨂⨂⬆\n\n");
  2939. }
  2940. /*===========================================================================
  2941. FUNCTION: PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq
  2942. DESCRIPTION:
  2943. PRE-CONDITION:
  2944. INPUT:
  2945. OUTPUT:
  2946. GLOBAL VARIABLES:
  2947. =============================================================================*/
  2948. void PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq(struct iso1EXIDocument *exi_doc_ISO1)
  2949. {
  2950. int i = 0;
  2951. int leng = 0;
  2952. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PaymentServiceSelectionReq ⨀⨀⨀⨀⨀⬇\n");
  2953. //===== [Header] SessionID =====
  2954. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  2955. //[BODY(1/2)] SelectedPaymentOption
  2956. int opt = 0;
  2957. opt = exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedPaymentOption;
  2958. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedPaymentOption = %d ", opt);
  2959. switch (opt)
  2960. {
  2961. case iso1paymentOptionType_Contract: //0
  2962. {
  2963. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Contract)");
  2964. break;
  2965. }
  2966. case iso1paymentOptionType_ExternalPayment: //1
  2967. {
  2968. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ExternalPayment)");
  2969. break;
  2970. }
  2971. default:
  2972. {
  2973. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected SelectedPaymentOption)\n");
  2974. break;
  2975. }
  2976. }
  2977. //[BODY(2/2)] SelectedServiceList
  2978. leng = exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.arrayLen;
  2979. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedServiceList (%d items) = \n", leng);
  2980. for (i = 0; i< leng; i++)
  2981. {
  2982. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t\t [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
  2983. (i+1),
  2984. exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ServiceID,
  2985. exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID,
  2986. exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID_isUsed);
  2987. }
  2988. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PaymentServiceSelectionReq ⨂⨂⨂⨂⨂⬆\n\n");
  2989. }
  2990. /*===========================================================================
  2991. FUNCTION: PRINT_XML_DOC_DIN_ContractAuthenticationReq
  2992. DESCRIPTION:
  2993. PRE-CONDITION:
  2994. INPUT:
  2995. OUTPUT:
  2996. GLOBAL VARIABLES:
  2997. =============================================================================*/
  2998. void PRINT_XML_DOC_DIN_ContractAuthenticationReq(struct dinEXIDocument *exi_doc_DIN)
  2999. {
  3000. //int i = 0;
  3001. static int cnt = 0;
  3002. cnt++;
  3003. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ContractAuthenticationReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3004. //===== [Header] SessionID =====
  3005. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3006. //[BODY(1/2)] Id
  3007. //[Joseph, To-Do, not full implemented, yet]
  3008. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t Id_isUsed = %d ",
  3009. exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq.Id_isUsed);
  3010. //[BODY(2/2)] GenChallenge
  3011. //[Joseph, To-Do, not full implemented, yet]
  3012. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t GenChallenge_isUsed = %d ",
  3013. exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq.GenChallenge_isUsed);
  3014. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ContractAuthenticationReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3015. }
  3016. /*===========================================================================
  3017. FUNCTION: PRINT_XML_DOC_ISO1_AuthorizationReq
  3018. DESCRIPTION:
  3019. PRE-CONDITION:
  3020. INPUT:
  3021. OUTPUT:
  3022. GLOBAL VARIABLES:
  3023. =============================================================================*/
  3024. void PRINT_XML_DOC_ISO1_AuthorizationReq(struct iso1EXIDocument *exi_doc_ISO1)
  3025. {
  3026. //int i = 0;
  3027. static int cnt = 0;
  3028. cnt++;
  3029. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing AuthorizationReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3030. //===== [Header] SessionID =====
  3031. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3032. //[BODY(1/2)] Id
  3033. //[Joseph, To-Do, not full implemented, yet]
  3034. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t Id_isUsed = %d ",
  3035. exi_doc_ISO1->V2G_Message.Body.AuthorizationReq.Id_isUsed);
  3036. //[BODY(2/2)] GenChallenge
  3037. //[Joseph, To-Do, not full implemented, yet]
  3038. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t GenChallenge_isUsed = %d ",
  3039. exi_doc_ISO1->V2G_Message.Body.AuthorizationReq.GenChallenge_isUsed);
  3040. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing AuthorizationReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3041. }
  3042. /*===========================================================================
  3043. FUNCTION: PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq
  3044. DESCRIPTION:
  3045. PRE-CONDITION:
  3046. INPUT:
  3047. OUTPUT:
  3048. GLOBAL VARIABLES:
  3049. =============================================================================*/
  3050. void PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq(struct dinEXIDocument *exi_doc_DIN)
  3051. {
  3052. //int i = 0;
  3053. static int cnt = 0;
  3054. cnt++;
  3055. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargeParameterDiscoveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3056. //===== [Header] SessionID =====
  3057. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3058. //===== [BODY (1/3)] EVRequestedEnergyTransferType =====
  3059. int type = 0;
  3060. type = exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.EVRequestedEnergyTransferType;
  3061. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVRequestedEnergyTransferType = %d ", type);
  3062. switch (type)
  3063. {
  3064. case dinEVRequestedEnergyTransferType_AC_single_phase_core: //0,
  3065. {
  3066. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_single_phase_core)\n");
  3067. break;
  3068. }
  3069. case dinEVRequestedEnergyTransferType_AC_three_phase_core: //1,
  3070. {
  3071. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_three_phase_core)\n");
  3072. break;
  3073. }
  3074. case dinEVRequestedEnergyTransferType_DC_core: //2,
  3075. {
  3076. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_core)\n");
  3077. break;
  3078. }
  3079. case dinEVRequestedEnergyTransferType_DC_extended: //3,
  3080. {
  3081. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_extended)\n"); //expected
  3082. //[Joseph, To-Do]
  3083. //If this parameter is different from previous message,
  3084. //a warning should be noted.
  3085. break;
  3086. }
  3087. case dinEVRequestedEnergyTransferType_DC_combo_core: //4,
  3088. {
  3089. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_combo_core)\n");
  3090. break;
  3091. }
  3092. case dinEVRequestedEnergyTransferType_DC_unique: //5
  3093. {
  3094. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_unique)\n");
  3095. break;
  3096. }
  3097. }
  3098. //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
  3099. //ignored, since DIN doesn't support AC.
  3100. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t AC_EVChargeParameter_isUsed = %d ", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
  3101. //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
  3102. struct dinPhysicalValueType *obj;
  3103. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
  3104. //DC_EVStatus
  3105. struct dinDC_EVStatusType *status;
  3106. status = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.DC_EVStatus;
  3107. PRINT_dinDC_EVStatusType(status);
  3108. //EVMaximumCurrentLimit
  3109. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumCurrentLimit;
  3110. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3111. PRINT_dinPhysicalValueType_UNIT(obj);
  3112. //EVMaximumPowerLimit
  3113. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
  3114. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3115. PRINT_dinPhysicalValueType_UNIT(obj);
  3116. //EVMaximumVoltageLimit
  3117. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
  3118. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3119. PRINT_dinPhysicalValueType_UNIT(obj);
  3120. //EVEnergyCapacity
  3121. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
  3122. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyCapacity = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3123. PRINT_dinPhysicalValueType_UNIT(obj);
  3124. //EVEnergyRequest
  3125. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
  3126. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyRequest = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3127. PRINT_dinPhysicalValueType_UNIT(obj);
  3128. //FullSOC
  3129. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t FullSOC = %d \% (DEC)", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
  3130. //BulkSOC
  3131. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkSOC = %d \% (DEC)", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
  3132. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargeParameterDiscoveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3133. }
  3134. /*===========================================================================
  3135. FUNCTION: PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq
  3136. DESCRIPTION:
  3137. PRE-CONDITION:
  3138. INPUT:
  3139. OUTPUT:
  3140. GLOBAL VARIABLES:
  3141. =============================================================================*/
  3142. void PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1)
  3143. {
  3144. //int i = 0;
  3145. static int cnt = 0;
  3146. cnt++;
  3147. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargeParameterDiscoveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3148. //===== [Header] SessionID =====
  3149. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3150. //===== [BODY (1/3)] RequestedEnergyTransferMode =====
  3151. int type = 0;
  3152. type = exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.RequestedEnergyTransferMode;
  3153. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RequestedEnergyTransferMode = %d ", type);
  3154. switch (type)
  3155. {
  3156. case iso1EnergyTransferModeType_AC_single_phase_core: //0,
  3157. {
  3158. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_single_phase_core)\n");
  3159. break;
  3160. }
  3161. case iso1EnergyTransferModeType_AC_three_phase_core: //1,
  3162. {
  3163. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_three_phase_core)\n");
  3164. break;
  3165. }
  3166. case iso1EnergyTransferModeType_DC_core: //2,
  3167. {
  3168. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_core)\n");
  3169. break;
  3170. }
  3171. case iso1EnergyTransferModeType_DC_extended: //3,
  3172. {
  3173. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_extended)\n"); //expected
  3174. //[Joseph, To-Do]
  3175. //If this parameter is different from previous message,
  3176. //a warning should be noted.
  3177. break;
  3178. }
  3179. case iso1EnergyTransferModeType_DC_combo_core: //4,
  3180. {
  3181. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_combo_core)\n");
  3182. break;
  3183. }
  3184. case iso1EnergyTransferModeType_DC_unique: //5
  3185. {
  3186. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_unique)\n");
  3187. break;
  3188. }
  3189. }
  3190. //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
  3191. //ignored, since our ISO1 doesn't support AC.
  3192. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t AC_EVChargeParameter_isUsed = %d ", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
  3193. //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
  3194. struct iso1PhysicalValueType *obj;
  3195. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
  3196. //DC_EVStatus
  3197. struct iso1DC_EVStatusType *status;
  3198. status = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.DC_EVStatus;
  3199. PRINT_iso1DC_EVStatusType(status);
  3200. //EVMaximumCurrentLimit
  3201. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumCurrentLimit;
  3202. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3203. PRINT_iso1PhysicalValueType_UNIT(obj);
  3204. //EVMaximumPowerLimit
  3205. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
  3206. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3207. PRINT_iso1PhysicalValueType_UNIT(obj);
  3208. //EVMaximumVoltageLimit
  3209. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
  3210. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3211. PRINT_iso1PhysicalValueType_UNIT(obj);
  3212. //EVEnergyCapacity
  3213. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
  3214. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyCapacity = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3215. PRINT_iso1PhysicalValueType_UNIT(obj);
  3216. //EVEnergyRequest
  3217. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
  3218. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyRequest = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3219. PRINT_iso1PhysicalValueType_UNIT(obj);
  3220. //FullSOC
  3221. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t FullSOC = %d \% (DEC)", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
  3222. //BulkSOC
  3223. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkSOC = %d \% (DEC)", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
  3224. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargeParameterDiscoveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3225. }
  3226. /*===========================================================================
  3227. FUNCTION: PRINT_XML_DOC_DIN_CableCheckReq
  3228. DESCRIPTION:
  3229. PRE-CONDITION:
  3230. INPUT:
  3231. OUTPUT:
  3232. GLOBAL VARIABLES:
  3233. =============================================================================*/
  3234. void PRINT_XML_DOC_DIN_CableCheckReq(struct dinEXIDocument *exi_doc_DIN)
  3235. {
  3236. //int i = 0;
  3237. static int cnt = 0;
  3238. cnt++;
  3239. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CableCheckReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3240. //===== [Header] SessionID =====
  3241. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3242. //===== [BODY (1/1)] DC_EVStatus =====
  3243. struct dinDC_EVStatusType *status;
  3244. status = &exi_doc_DIN->V2G_Message.Body.CableCheckReq.DC_EVStatus;
  3245. PRINT_dinDC_EVStatusType(status);
  3246. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CableCheckReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3247. }
  3248. /*===========================================================================
  3249. FUNCTION: PRINT_XML_DOC_ISO1_CableCheckReq
  3250. DESCRIPTION:
  3251. PRE-CONDITION:
  3252. INPUT:
  3253. OUTPUT:
  3254. GLOBAL VARIABLES:
  3255. =============================================================================*/
  3256. void PRINT_XML_DOC_ISO1_CableCheckReq(struct iso1EXIDocument *exi_doc_ISO1)
  3257. {
  3258. //int i = 0;
  3259. static int cnt = 0;
  3260. cnt++;
  3261. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CableCheckReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3262. //===== [Header] SessionID =====
  3263. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3264. //===== [BODY (1/1)] DC_EVStatus =====
  3265. struct iso1DC_EVStatusType *status;
  3266. status = &exi_doc_ISO1->V2G_Message.Body.CableCheckReq.DC_EVStatus;
  3267. PRINT_iso1DC_EVStatusType(status);
  3268. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CableCheckReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3269. }
  3270. /*===========================================================================
  3271. FUNCTION: PRINT_XML_DOC_DIN_PreChargeReq
  3272. DESCRIPTION:
  3273. PRE-CONDITION:
  3274. INPUT:
  3275. OUTPUT:
  3276. GLOBAL VARIABLES:
  3277. =============================================================================*/
  3278. void PRINT_XML_DOC_DIN_PreChargeReq(struct dinEXIDocument *exi_doc_DIN)
  3279. {
  3280. //int i = 0;
  3281. static int cnt = 0;
  3282. cnt++;
  3283. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PreChargeReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3284. //===== [Header] SessionID =====
  3285. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3286. //===== [BODY (1/3)] DC_EVStatus =====
  3287. struct dinDC_EVStatusType *status;
  3288. status = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.DC_EVStatus;
  3289. PRINT_dinDC_EVStatusType(status);
  3290. //===== [BODY (2/3)] EVTargetVoltage =====
  3291. struct dinPhysicalValueType *obj;
  3292. obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
  3293. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3294. PRINT_dinPhysicalValueType_UNIT(obj);
  3295. //===== [BODY (3/3)] EVTargetCurrent =====
  3296. obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
  3297. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3298. PRINT_dinPhysicalValueType_UNIT(obj);
  3299. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PreChargeReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3300. }
  3301. /*===========================================================================
  3302. FUNCTION: PRINT_XML_DOC_ISO1_PreChargeReq
  3303. DESCRIPTION:
  3304. PRE-CONDITION:
  3305. INPUT:
  3306. OUTPUT:
  3307. GLOBAL VARIABLES:
  3308. =============================================================================*/
  3309. void PRINT_XML_DOC_ISO1_PreChargeReq(struct iso1EXIDocument *exi_doc_ISO1)
  3310. {
  3311. //int i = 0;
  3312. static int cnt = 0;
  3313. cnt++;
  3314. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PreChargeReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3315. //===== [Header] SessionID =====
  3316. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3317. //===== [BODY (1/3)] DC_EVStatus =====
  3318. struct iso1DC_EVStatusType *status;
  3319. status = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.DC_EVStatus;
  3320. PRINT_iso1DC_EVStatusType(status);
  3321. //===== [BODY (2/3)] EVTargetVoltage =====
  3322. struct iso1PhysicalValueType *obj;
  3323. obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
  3324. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3325. PRINT_iso1PhysicalValueType_UNIT(obj);
  3326. //===== [BODY (3/3)] EVTargetCurrent =====
  3327. obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
  3328. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3329. PRINT_iso1PhysicalValueType_UNIT(obj);
  3330. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PreChargeReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3331. }
  3332. /*===========================================================================
  3333. FUNCTION: PRINT_XML_DOC_DIN_PowerDeliveryReq
  3334. DESCRIPTION:
  3335. PRE-CONDITION:
  3336. INPUT:
  3337. OUTPUT:
  3338. GLOBAL VARIABLES:
  3339. =============================================================================*/
  3340. void PRINT_XML_DOC_DIN_PowerDeliveryReq(struct dinEXIDocument *exi_doc_DIN)
  3341. {
  3342. //int i = 0;
  3343. static int cnt = 0;
  3344. cnt++;
  3345. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PowerDeliveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3346. //===== [Header] SessionID =====
  3347. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3348. //===== [BODY (1/3)] ReadyToChargeState =====
  3349. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ReadyToChargeState = %d (DEC)",
  3350. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ReadyToChargeState);
  3351. //===== [BODY (2/3)] ChargingProfile =====
  3352. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingProfile_isUsed = %d (DEC)",
  3353. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
  3354. //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
  3355. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVPowerDeliveryParameter_isUsed = %d (DEC)",
  3356. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
  3357. //DC_EVStatus
  3358. struct dinDC_EVStatusType *status;
  3359. status = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.DC_EVStatus;
  3360. PRINT_dinDC_EVStatusType(status);
  3361. //BulkChargingComplete
  3362. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d (DEC)",
  3363. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
  3364. //BulkChargingComplete_isUsed
  3365. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d (DEC)",
  3366. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
  3367. //ChargingComplete
  3368. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d (DEC)",
  3369. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
  3370. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PowerDeliveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3371. }
  3372. /*===========================================================================
  3373. FUNCTION: PRINT_XML_DOC_ISO1_PowerDeliveryReq
  3374. DESCRIPTION:
  3375. PRE-CONDITION:
  3376. INPUT:
  3377. OUTPUT:
  3378. GLOBAL VARIABLES:
  3379. =============================================================================*/
  3380. void PRINT_XML_DOC_ISO1_PowerDeliveryReq(struct iso1EXIDocument *exi_doc_ISO1)
  3381. {
  3382. //int i = 0;
  3383. static int cnt = 0;
  3384. cnt++;
  3385. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PowerDeliveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3386. //===== [Header] SessionID =====
  3387. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3388. //===== [BODY (1/3)] ChargeProgress =====
  3389. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargeProgress = %d (DEC, 0:start, 1:stop, 2:renegotiate)",
  3390. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.ChargeProgress);
  3391. //iso1chargeProgressType_Start = 0,
  3392. //iso1chargeProgressType_Stop = 1,
  3393. //iso1chargeProgressType_Renegotiate = 2
  3394. //===== [BODY (2/3)] ChargingProfile =====
  3395. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingProfile_isUsed = %d (DEC)",
  3396. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
  3397. //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
  3398. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVPowerDeliveryParameter_isUsed = %d (DEC)",
  3399. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
  3400. //DC_EVStatus
  3401. struct iso1DC_EVStatusType *status;
  3402. status = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.DC_EVStatus;
  3403. PRINT_iso1DC_EVStatusType(status);
  3404. //BulkChargingComplete
  3405. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d (DEC)",
  3406. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
  3407. //BulkChargingComplete_isUsed
  3408. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d (DEC)",
  3409. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
  3410. //ChargingComplete
  3411. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d (DEC)",
  3412. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
  3413. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PowerDeliveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3414. }
  3415. /*===========================================================================
  3416. FUNCTION: PRINT_XML_DOC_DIN_CurrentDemandReq
  3417. DESCRIPTION:
  3418. PRE-CONDITION:
  3419. INPUT:
  3420. OUTPUT:
  3421. GLOBAL VARIABLES:
  3422. =============================================================================*/
  3423. void PRINT_XML_DOC_DIN_CurrentDemandReq(struct dinEXIDocument *exi_doc_DIN)
  3424. {
  3425. //int i = 0;
  3426. static int cnt = 0;
  3427. cnt++;
  3428. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CurrentDemandReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3429. //===== [Header] SessionID =====
  3430. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3431. //===== [BODY (1/10)] DC_EVStatus =====
  3432. struct dinDC_EVStatusType *status;
  3433. status = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.DC_EVStatus;
  3434. PRINT_dinDC_EVStatusType(status);
  3435. //===== [BODY (2/10)] EVTargetCurrent =====
  3436. struct dinPhysicalValueType *obj;
  3437. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
  3438. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3439. PRINT_dinPhysicalValueType_UNIT(obj);
  3440. //===== [BODY (3/10)] EVMaximumVoltageLimit =====
  3441. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
  3442. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
  3443. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3444. PRINT_dinPhysicalValueType_UNIT(obj);
  3445. //===== [BODY (4/10)] EVMaximumCurrentLimit =====
  3446. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
  3447. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
  3448. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3449. PRINT_dinPhysicalValueType_UNIT(obj);
  3450. //===== [BODY (5/10)] EVMaximumPowerLimit =====
  3451. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
  3452. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
  3453. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3454. PRINT_dinPhysicalValueType_UNIT(obj);
  3455. //===== [BODY (6/10)] BulkChargingComplete =====
  3456. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
  3457. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
  3458. //===== [BODY (7/10)] ChargingComplete =====
  3459. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
  3460. //===== [BODY (8/10)] RemainingTimeToFullSoC =====
  3461. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
  3462. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
  3463. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToFullSoC = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3464. PRINT_dinPhysicalValueType_UNIT(obj);
  3465. //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
  3466. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
  3467. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
  3468. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToBulkSoC = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3469. PRINT_dinPhysicalValueType_UNIT(obj);
  3470. //===== [BODY (10/10)] EVTargetVoltage =====
  3471. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
  3472. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", GetValue_dinPhysicalValueType(obj));
  3473. PRINT_dinPhysicalValueType_UNIT(obj);
  3474. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CurrentDemandReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3475. }
  3476. /*===========================================================================
  3477. FUNCTION: PRINT_XML_DOC_ISO1_CurrentDemandReq
  3478. DESCRIPTION:
  3479. PRE-CONDITION:
  3480. INPUT:
  3481. OUTPUT:
  3482. GLOBAL VARIABLES:
  3483. =============================================================================*/
  3484. void PRINT_XML_DOC_ISO1_CurrentDemandReq(struct iso1EXIDocument *exi_doc_ISO1)
  3485. {
  3486. //int i = 0;
  3487. static int cnt = 0;
  3488. cnt++;
  3489. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CurrentDemandReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3490. //===== [Header] SessionID =====
  3491. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3492. //===== [BODY (1/10)] DC_EVStatus =====
  3493. struct iso1DC_EVStatusType *status;
  3494. status = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.DC_EVStatus;
  3495. PRINT_iso1DC_EVStatusType(status);
  3496. //===== [BODY (2/10)] EVTargetCurrent =====
  3497. struct iso1PhysicalValueType *obj;
  3498. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
  3499. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3500. PRINT_iso1PhysicalValueType_UNIT(obj);
  3501. //===== [BODY (3/10)] EVMaximumVoltageLimit =====
  3502. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
  3503. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
  3504. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3505. PRINT_iso1PhysicalValueType_UNIT(obj);
  3506. //===== [BODY (4/10)] EVMaximumCurrentLimit =====
  3507. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3508. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
  3509. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
  3510. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3511. PRINT_iso1PhysicalValueType_UNIT(obj);
  3512. //===== [BODY (5/10)] EVMaximumPowerLimit =====
  3513. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
  3514. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
  3515. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3516. PRINT_iso1PhysicalValueType_UNIT(obj);
  3517. //===== [BODY (6/10)] BulkChargingComplete =====
  3518. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
  3519. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
  3520. //===== [BODY (7/10)] ChargingComplete =====
  3521. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
  3522. //===== [BODY (8/10)] RemainingTimeToFullSoC =====
  3523. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
  3524. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
  3525. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToFullSoC = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3526. PRINT_iso1PhysicalValueType_UNIT(obj);
  3527. //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
  3528. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
  3529. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
  3530. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToBulkSoC = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3531. PRINT_iso1PhysicalValueType_UNIT(obj);
  3532. //===== [BODY (10/10)] EVTargetVoltage =====
  3533. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
  3534. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", GetValue_iso1PhysicalValueType(obj));
  3535. PRINT_iso1PhysicalValueType_UNIT(obj);
  3536. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CurrentDemandReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3537. }
  3538. /*===========================================================================
  3539. FUNCTION: PRINT_XML_DOC_ISO1_ChargingStatusReq
  3540. DESCRIPTION:
  3541. PRE-CONDITION:
  3542. INPUT:
  3543. OUTPUT:
  3544. GLOBAL VARIABLES:
  3545. =============================================================================*/
  3546. void PRINT_XML_DOC_ISO1_ChargingStatusReq(struct iso1EXIDocument *exi_doc_ISO1)
  3547. {
  3548. static int cnt = 0;
  3549. cnt++;
  3550. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargingStatusReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3551. //===== [Header] SessionID =====
  3552. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3553. //===== [BODY (0/0)] =====
  3554. //ISO1: no content
  3555. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t no content (ISO1)");
  3556. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargingStatusReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3557. }
  3558. /*===========================================================================
  3559. FUNCTION: PRINT_XML_DOC_DIN_WeldingDetectionReq
  3560. DESCRIPTION:
  3561. PRE-CONDITION:
  3562. INPUT:
  3563. OUTPUT:
  3564. GLOBAL VARIABLES:
  3565. =============================================================================*/
  3566. void PRINT_XML_DOC_DIN_WeldingDetectionReq(struct dinEXIDocument *exi_doc_DIN)
  3567. {
  3568. //int i = 0;
  3569. static int cnt = 0;
  3570. cnt++;
  3571. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing WeldingDetectionReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3572. //===== [Header] SessionID =====
  3573. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3574. //===== [BODY (1/3)] DC_EVStatus =====
  3575. struct dinDC_EVStatusType *status;
  3576. status = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq.DC_EVStatus;
  3577. PRINT_dinDC_EVStatusType(status);
  3578. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing WeldingDetectionReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3579. }
  3580. /*===========================================================================
  3581. FUNCTION: PRINT_XML_DOC_ISO1_WeldingDetectionReq
  3582. DESCRIPTION:
  3583. PRE-CONDITION:
  3584. INPUT:
  3585. OUTPUT:
  3586. GLOBAL VARIABLES:
  3587. =============================================================================*/
  3588. void PRINT_XML_DOC_ISO1_WeldingDetectionReq(struct iso1EXIDocument *exi_doc_ISO1)
  3589. {
  3590. //int i = 0;
  3591. static int cnt = 0;
  3592. cnt++;
  3593. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing WeldingDetectionReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3594. //===== [Header] SessionID =====
  3595. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3596. //===== [BODY (1/3)] DC_EVStatus =====
  3597. struct iso1DC_EVStatusType *status;
  3598. status = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq.DC_EVStatus;
  3599. PRINT_iso1DC_EVStatusType(status);
  3600. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing WeldingDetectionReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3601. }
  3602. /*===========================================================================
  3603. FUNCTION: PRINT_XML_DOC_DIN_SessionStopReq
  3604. DESCRIPTION:
  3605. PRE-CONDITION:
  3606. INPUT:
  3607. OUTPUT:
  3608. GLOBAL VARIABLES:
  3609. =============================================================================*/
  3610. void PRINT_XML_DOC_DIN_SessionStopReq(struct dinEXIDocument *exi_doc_DIN)
  3611. {
  3612. //int i = 0;
  3613. static int cnt = 0;
  3614. cnt++;
  3615. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionStopReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3616. //===== [Header] SessionID =====
  3617. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3618. //===== [BODY (0/0)] noContent =====
  3619. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionStopReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3620. }
  3621. /*===========================================================================
  3622. FUNCTION: PRINT_XML_DOC_ISO1_SessionStopReq
  3623. DESCRIPTION:
  3624. PRE-CONDITION:
  3625. INPUT:
  3626. OUTPUT:
  3627. GLOBAL VARIABLES:
  3628. =============================================================================*/
  3629. void PRINT_XML_DOC_ISO1_SessionStopReq(struct iso1EXIDocument *exi_doc_ISO1)
  3630. {
  3631. //int i = 0;
  3632. static int cnt = 0;
  3633. cnt++;
  3634. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionStopReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3635. //===== [Header] SessionID =====
  3636. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3637. //===== [BODY (0/0)] noContent =====
  3638. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionStopReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3639. }
  3640. /*===========================================================================
  3641. FUNCTION: PRINT_V2GTP_STREAM
  3642. DESCRIPTION:
  3643. PRE-CONDITION:
  3644. INPUT:
  3645. OUTPUT:
  3646. GLOBAL VARIABLES:
  3647. =============================================================================*/
  3648. void PRINT_V2GTP_STREAM(bitstream_t *stream)
  3649. {
  3650. #if (DEBUG_PRINTF_EXI_ENGINE_DETAIL_SHOW == ENABLE)
  3651. int i = 0;
  3652. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- Got a new V2GTP Message -----\n\n");
  3653. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t SIZE: %d (Bytes, DEC)\n", (int)stream->size);
  3654. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t HEADER (HEX): ");
  3655. for (i = 0; i < stream->size; i++)
  3656. {
  3657. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", stream->data[i]);
  3658. if (i == (V2GTP_HEADER_LENGTH - 1))
  3659. {
  3660. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t EXI (HEX): ");
  3661. }
  3662. }
  3663. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n");
  3664. #endif
  3665. }
  3666. /*===========================================================================
  3667. FUNCTION: API_V2GMSG_EXI_Decoder_AppProtocol
  3668. DESCRIPTION:
  3669. PRE-CONDITION:
  3670. 1. #define EXI_STREAM BYTE_ARRAY
  3671. INPUT:
  3672. 1. V2GTP_msg
  3673. 2. V2GTP_msg_length
  3674. OUTPUT:
  3675. 1. ccs_handshake //Share Memory
  3676. 2. V2gFlowStatus //Status Flag
  3677. GLOBAL VARIABLES:
  3678. 1. iStream
  3679. 2. exiDoc
  3680. =============================================================================*/
  3681. int API_V2GMSG_EXI_Decoder_AppProtocol(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct appHandEXIDocument *exiDoc_handshake)
  3682. {
  3683. int errn = 0;
  3684. size_t pos = 0;
  3685. uint32_t payloadLengthDec = 0;
  3686. //Initialize iStream
  3687. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3688. iStream.pos = &pos;
  3689. iStream.data = V2GTP_msg;
  3690. //Initialize exiDoc
  3691. init_appHandEXIDocument(exiDoc_handshake);
  3692. //Print the original EXI message
  3693. PRINT_V2GTP_STREAM(&iStream);
  3694. //STEP 1: Parsing Header
  3695. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3696. //TC_SECC_VTB_V2GTPSessionSetup_004
  3697. if (payloadLengthDec == 0)
  3698. {
  3699. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_AppProtocol]payloadLengthDec = 0\n");
  3700. errn = -1;
  3701. }
  3702. if (errn == 0)
  3703. {
  3704. //STEP 2: Parsing Payload EXI Message
  3705. *iStream.pos = V2GTP_HEADER_LENGTH;
  3706. errn = decode_appHandExiDocument(&iStream, exiDoc_handshake);
  3707. if(errn == 0)
  3708. {
  3709. //Print the decoded XML Document
  3710. PRINT_XML_DOC_supportedAppProtocolReq(exiDoc_handshake);
  3711. //errn = SupportedAppProtocolRequest; //17 (define.h)
  3712. }
  3713. else
  3714. {
  3715. /* an error occured */
  3716. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_AppProtocol]decode_appHandExiDocument()\n");
  3717. errn = -1;
  3718. }
  3719. }
  3720. return errn;
  3721. }
  3722. int API_V2GMSG_EXI_Encoder_AppProtocol(struct appHandEXIDocument *exi_doc, bitstream_t *exi_packet)
  3723. {
  3724. int i = 0;
  3725. int errn = 0;
  3726. size_t pos = 0;
  3727. exi_packet->pos = &pos;
  3728. //*exi_packet->pos = 0;
  3729. exi_packet->size = V2GTP_MSG_TX_BUFFER_SIZE; //(64*1024) //65,536 = 65.5KB
  3730. exi_packet->data = V2GTP_Tx_buf;
  3731. *exi_packet->pos = V2GTP_HEADER_LENGTH;
  3732. if( (errn = encode_appHandExiDocument(exi_packet, exi_doc)) == 0)
  3733. {
  3734. errn = write_v2gtpHeader(exi_packet->data, (*exi_packet->pos) - V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
  3735. //*exi_packet.pos = total length of the encoded V2GMSG.
  3736. //V2GTP_HEADER_LENGTH = 8 Bytes
  3737. }
  3738. exi_packet->size = *exi_packet->pos; //total length of the encoded V2GMSG.
  3739. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- supportedAppProtocolRes [START] -----\n\n");
  3740. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t SIZE: %d (Bytes, DEC)\n", (int)exi_packet->size);
  3741. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t HEADER (HEX): ");
  3742. for (i = 0; i < (int)exi_packet->size; i++)
  3743. {
  3744. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_packet->data[i]);
  3745. if (i == (V2GTP_HEADER_LENGTH - 1)) DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t EXI (HEX): ");
  3746. }
  3747. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- supportedAppProtocolRes [END] -----\n\n");
  3748. return errn;
  3749. }
  3750. /*===========================================================================
  3751. FUNCTION: API_V2GMSG_EXI_Decoder_DIN
  3752. DESCRIPTION:
  3753. PRE-CONDITION:
  3754. INPUT:
  3755. OUTPUT:
  3756. GLOBAL VARIABLES:
  3757. =============================================================================*/
  3758. int API_V2GMSG_EXI_Decoder_DIN(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct dinEXIDocument *exi_doc_DIN)
  3759. {
  3760. DEBUG_PRINTF_EXI_ENGINE_DETAIL("API_V2GMSG_EXI_Decoder_DIN(): Entered!\n");
  3761. int errn = 0;
  3762. size_t pos = 0;
  3763. uint32_t payloadLengthDec = 0;
  3764. //Initialize iStream
  3765. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3766. iStream.pos = &pos;
  3767. iStream.data = V2GTP_msg;
  3768. iStream.buffer = 0;
  3769. iStream.capacity = 0;
  3770. //Print the original EXI message
  3771. PRINT_V2GTP_STREAM(&iStream);
  3772. //STEP 1: Parsing Header
  3773. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3774. //TC_SECC_VTB_V2GTPSessionSetup_004
  3775. if (payloadLengthDec == 0)
  3776. {
  3777. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][Error][API_V2GMSG_EXI_Decoder_DIN]payloadLengthDec = 0\n");
  3778. errn = -1;
  3779. }
  3780. if (errn == 0)
  3781. {
  3782. //STEP 2: Parsing Payload EXI Message
  3783. *iStream.pos = V2GTP_HEADER_LENGTH;
  3784. errn = decode_dinExiDocument(&iStream, exi_doc_DIN);
  3785. //The "eventcode" inside this function could present which kind of message it is.
  3786. if (errn == 0)
  3787. {
  3788. // successfully received and parsed.
  3789. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_DIN] decode_dinExiDocument: %d (DEC) => OK!\n", errn);
  3790. errn = Check_V2G_Rx_Msg_Name_din(exi_doc_DIN);
  3791. if (errn < 0)
  3792. {
  3793. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
  3794. }
  3795. }
  3796. else
  3797. {
  3798. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_DIN] decode_dinExiDocument: %d (DEC)\n", errn);
  3799. errn = -1;
  3800. }
  3801. }
  3802. else
  3803. {
  3804. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_DIN] read_v2gtpHeader: %d (DEC)\n", errn);
  3805. }
  3806. return errn;
  3807. }
  3808. /*===========================================================================
  3809. FUNCTION: API_V2GMSG_EXI_Decoder_ISO1
  3810. DESCRIPTION:
  3811. PRE-CONDITION:
  3812. INPUT:
  3813. OUTPUT:
  3814. GLOBAL VARIABLES:
  3815. =============================================================================*/
  3816. int API_V2GMSG_EXI_Decoder_ISO1(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso1EXIDocument *exi_doc_ISO1)
  3817. {
  3818. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[API_V2GMSG_EXI_Decoder_ISO1] Entered!\n");
  3819. int errn = 0;
  3820. size_t pos = 0;
  3821. uint32_t payloadLengthDec = 0;
  3822. //Initialize iStream
  3823. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3824. iStream.pos = &pos;
  3825. iStream.data = V2GTP_msg;
  3826. iStream.buffer = 0;
  3827. iStream.capacity = 0;
  3828. //Print the original EXI message
  3829. PRINT_V2GTP_STREAM(&iStream);
  3830. //STEP 1: Parsing Header
  3831. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3832. //TC_SECC_VTB_V2GTPSessionSetup_004
  3833. if (payloadLengthDec == 0)
  3834. {
  3835. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO1]payloadLengthDec = 0");
  3836. errn = -1;
  3837. }
  3838. if (errn == 0)
  3839. {
  3840. //STEP 2: Parsing Payload EXI Message
  3841. *iStream.pos = V2GTP_HEADER_LENGTH;
  3842. errn = decode_iso1ExiDocument(&iStream, exi_doc_ISO1);
  3843. //The "eventcode" inside this function could present which kind of message it is.
  3844. if (errn == 0)
  3845. {
  3846. // successfully received and parsed.
  3847. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO1] decode_iso1ExiDocument: %d (DEC) => OK!\n", errn);
  3848. errn = Check_V2G_Rx_Msg_Name_iso1(exi_doc_ISO1);
  3849. if (errn < 0)
  3850. {
  3851. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
  3852. }
  3853. }
  3854. else
  3855. {
  3856. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO1] decode_iso1ExiDocument: %d (DEC)\n", errn);
  3857. errn = -1;
  3858. }
  3859. }
  3860. else
  3861. {
  3862. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO1] read_v2gtpHeader: %d (DEC)\n", errn);
  3863. }
  3864. return errn;
  3865. }
  3866. /*===========================================================================
  3867. FUNCTION: API_V2GMSG_EXI_Decoder_ISO2
  3868. DESCRIPTION:
  3869. PRE-CONDITION:
  3870. INPUT:
  3871. OUTPUT:
  3872. GLOBAL VARIABLES:
  3873. =============================================================================*/
  3874. int API_V2GMSG_EXI_Decoder_ISO2(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso2EXIDocument *exi_doc_ISO2)
  3875. {
  3876. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[API_V2GMSG_EXI_Decoder_ISO2] Entered!\n");
  3877. int errn = 0;
  3878. size_t pos = 0;
  3879. uint32_t payloadLengthDec = 0;
  3880. //Initialize iStream
  3881. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3882. iStream.pos = &pos;
  3883. iStream.data = V2GTP_msg;
  3884. iStream.buffer = 0;
  3885. iStream.capacity = 0;
  3886. //Print the original EXI message
  3887. PRINT_V2GTP_STREAM(&iStream);
  3888. //STEP 1: Parsing Header
  3889. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3890. //TC_SECC_VTB_V2GTPSessionSetup_004
  3891. if (payloadLengthDec == 0)
  3892. {
  3893. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO2]payloadLengthDec = 0\n");
  3894. errn = -1;
  3895. }
  3896. if (errn == 0)
  3897. {
  3898. //STEP 2: Parsing Payload EXI Message
  3899. *iStream.pos = V2GTP_HEADER_LENGTH;
  3900. errn = decode_iso2ExiDocument(&iStream, exi_doc_ISO2);
  3901. //The "eventcode" inside this function could present which kind of message it is.
  3902. if (errn == 0)
  3903. {
  3904. // successfully received and parsed.
  3905. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO2] decode_iso2ExiDocument: %d (DEC) => OK!\n", errn);
  3906. errn = Check_V2G_Rx_Msg_Name_iso2(exi_doc_ISO2);
  3907. if (errn < 0)
  3908. {
  3909. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
  3910. }
  3911. }
  3912. else
  3913. {
  3914. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO2] decode_iso2ExiDocument: %d (DEC)\n", errn);
  3915. }
  3916. }
  3917. else
  3918. {
  3919. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO2] read_v2gtpHeader: %d (DEC)\n", errn);
  3920. }
  3921. return errn;
  3922. }
  3923. /*===========================================================================
  3924. FUNCTION: PRINT_dinPhysicalValueType_UNIT
  3925. DESCRIPTION:
  3926. PRE-CONDITION:
  3927. INPUT:
  3928. OUTPUT:
  3929. GLOBAL VARIABLES:
  3930. =============================================================================*/
  3931. void PRINT_dinPhysicalValueType_UNIT(struct dinPhysicalValueType *obj)
  3932. {
  3933. if (obj->Unit_isUsed == TRUE)
  3934. {
  3935. switch (obj->Unit)
  3936. {
  3937. case dinunitSymbolType_h: // = 0,
  3938. {
  3939. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: h)");
  3940. break;
  3941. }
  3942. case dinunitSymbolType_m: // = 1,
  3943. {
  3944. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: m)");
  3945. break;
  3946. }
  3947. case dinunitSymbolType_s: // = 2,
  3948. {
  3949. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: s)");
  3950. break;
  3951. }
  3952. case dinunitSymbolType_A: // = 3,
  3953. {
  3954. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: A)");
  3955. break;
  3956. }
  3957. case dinunitSymbolType_Ah: // = 4,
  3958. {
  3959. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Ah)");
  3960. break;
  3961. }
  3962. case dinunitSymbolType_V: // = 5,
  3963. {
  3964. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: V)");
  3965. break;
  3966. }
  3967. case dinunitSymbolType_VA: // = 6,
  3968. {
  3969. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: VA)");
  3970. break;
  3971. }
  3972. case dinunitSymbolType_W: // = 7,
  3973. {
  3974. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W)");
  3975. break;
  3976. }
  3977. case dinunitSymbolType_W_s: // = 8,
  3978. {
  3979. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W_s)");
  3980. break;
  3981. }
  3982. case dinunitSymbolType_Wh: // = 9
  3983. {
  3984. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Wh)");
  3985. break;
  3986. }
  3987. default:
  3988. {
  3989. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] unit: unexpected dinPhysicalValueType unit)");
  3990. break;
  3991. }
  3992. }
  3993. }
  3994. else
  3995. {
  3996. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: null)");
  3997. }
  3998. }
  3999. /*===========================================================================
  4000. FUNCTION: PRINT_iso1PhysicalValueType_UNIT
  4001. DESCRIPTION:
  4002. PRE-CONDITION:
  4003. INPUT:
  4004. OUTPUT:
  4005. GLOBAL VARIABLES:
  4006. =============================================================================*/
  4007. void PRINT_iso1PhysicalValueType_UNIT(struct iso1PhysicalValueType *obj)
  4008. {
  4009. switch (obj->Unit)
  4010. {
  4011. case iso1unitSymbolType_h: // = 0,
  4012. {
  4013. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: h)");
  4014. break;
  4015. }
  4016. case iso1unitSymbolType_m: // = 1,
  4017. {
  4018. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: m)");
  4019. break;
  4020. }
  4021. case iso1unitSymbolType_s: // = 2,
  4022. {
  4023. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: s)");
  4024. break;
  4025. }
  4026. case iso1unitSymbolType_A: // = 3,
  4027. {
  4028. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: A)");
  4029. break;
  4030. }
  4031. case iso1unitSymbolType_V: // = 4,
  4032. {
  4033. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: V)");
  4034. break;
  4035. }
  4036. case iso1unitSymbolType_W: // = 5,
  4037. {
  4038. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W)");
  4039. break;
  4040. }
  4041. case iso1unitSymbolType_Wh: // = 6
  4042. {
  4043. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Wh)");
  4044. break;
  4045. }
  4046. default:
  4047. {
  4048. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] unit: unexpected iso1PhysicalValueType unit)");
  4049. break;
  4050. }
  4051. }
  4052. }
  4053. /*===========================================================================
  4054. FUNCTION: GetValue_dinPhysicalValueType
  4055. DESCRIPTION:
  4056. PRE-CONDITION:
  4057. INPUT:
  4058. OUTPUT:
  4059. GLOBAL VARIABLES:
  4060. =============================================================================*/
  4061. int GetValue_dinPhysicalValueType(struct dinPhysicalValueType *obj)
  4062. {
  4063. int result;
  4064. result = (obj->Value) * pow(10, obj->Multiplier);
  4065. return result;
  4066. }
  4067. /*===========================================================================
  4068. FUNCTION: GetValue_iso1PhysicalValueType
  4069. DESCRIPTION:
  4070. PRE-CONDITION:
  4071. INPUT:
  4072. OUTPUT:
  4073. GLOBAL VARIABLES:
  4074. =============================================================================*/
  4075. int GetValue_iso1PhysicalValueType(struct iso1PhysicalValueType *obj)
  4076. {
  4077. int result;
  4078. result = (obj->Value) * pow(10, obj->Multiplier);
  4079. return result;
  4080. }
  4081. /*===========================================================================
  4082. FUNCTION: PRINT_dinDC_EVErrorCodeType
  4083. DESCRIPTION:
  4084. PRE-CONDITION:
  4085. INPUT:
  4086. OUTPUT:
  4087. GLOBAL VARIABLES:
  4088. =============================================================================*/
  4089. void PRINT_dinDC_EVErrorCodeType(struct dinDC_EVStatusType *status)
  4090. {
  4091. switch (status->EVErrorCode)
  4092. {
  4093. case dinDC_EVErrorCodeType_NO_ERROR: // = 0,
  4094. {
  4095. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NO_ERROR)");
  4096. break;
  4097. }
  4098. case dinDC_EVErrorCodeType_FAILED_RESSTemperatureInhibit: // = 1,
  4099. {
  4100. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)");
  4101. break;
  4102. }
  4103. case dinDC_EVErrorCodeType_FAILED_EVShiftPosition: // = 2,
  4104. {
  4105. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)");
  4106. break;
  4107. }
  4108. case dinDC_EVErrorCodeType_FAILED_ChargerConnectorLockFault: // = 3,
  4109. {
  4110. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)");
  4111. break;
  4112. }
  4113. case dinDC_EVErrorCodeType_FAILED_EVRESSMalfunction: // = 4,
  4114. {
  4115. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)");
  4116. break;
  4117. }
  4118. case dinDC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
  4119. {
  4120. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)");
  4121. break;
  4122. }
  4123. case dinDC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange: // = 6,
  4124. {
  4125. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)");
  4126. break;
  4127. }
  4128. case dinDC_EVErrorCodeType_Reserved_A: // = 7,
  4129. {
  4130. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)");
  4131. break;
  4132. }
  4133. case dinDC_EVErrorCodeType_Reserved_B: // = 8,
  4134. {
  4135. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)");
  4136. break;
  4137. }
  4138. case dinDC_EVErrorCodeType_Reserved_C: // = 9,
  4139. {
  4140. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)");
  4141. break;
  4142. }
  4143. case dinDC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
  4144. {
  4145. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)");
  4146. break;
  4147. }
  4148. case dinDC_EVErrorCodeType_NoData: // = 11
  4149. {
  4150. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)");
  4151. break;
  4152. }
  4153. default:
  4154. {
  4155. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected din EVErrorCode)");
  4156. break;
  4157. }
  4158. }
  4159. }
  4160. /*===========================================================================
  4161. FUNCTION: PRINT_iso1DC_EVErrorCodeType
  4162. DESCRIPTION:
  4163. PRE-CONDITION:
  4164. INPUT:
  4165. OUTPUT:
  4166. GLOBAL VARIABLES:
  4167. =============================================================================*/
  4168. void PRINT_iso1DC_EVErrorCodeType(struct iso1DC_EVStatusType *status)
  4169. {
  4170. switch (status->EVErrorCode)
  4171. {
  4172. case iso1DC_EVErrorCodeType_NO_ERROR: // = 0,
  4173. {
  4174. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NO_ERROR)");
  4175. break;
  4176. }
  4177. case iso1DC_EVErrorCodeType_FAILED_RESSTemperatureInhibit: // = 1,
  4178. {
  4179. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)");
  4180. break;
  4181. }
  4182. case iso1DC_EVErrorCodeType_FAILED_EVShiftPosition: // = 2,
  4183. {
  4184. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)");
  4185. break;
  4186. }
  4187. case iso1DC_EVErrorCodeType_FAILED_ChargerConnectorLockFault: // = 3,
  4188. {
  4189. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)");
  4190. break;
  4191. }
  4192. case iso1DC_EVErrorCodeType_FAILED_EVRESSMalfunction: // = 4,
  4193. {
  4194. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)");
  4195. break;
  4196. }
  4197. case iso1DC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
  4198. {
  4199. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)");
  4200. break;
  4201. }
  4202. case iso1DC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange: // = 6,
  4203. {
  4204. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)");
  4205. break;
  4206. }
  4207. case iso1DC_EVErrorCodeType_Reserved_A: // = 7,
  4208. {
  4209. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)");
  4210. break;
  4211. }
  4212. case iso1DC_EVErrorCodeType_Reserved_B: // = 8,
  4213. {
  4214. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)");
  4215. break;
  4216. }
  4217. case iso1DC_EVErrorCodeType_Reserved_C: // = 9,
  4218. {
  4219. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)");
  4220. break;
  4221. }
  4222. case iso1DC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
  4223. {
  4224. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)");
  4225. break;
  4226. }
  4227. case iso1DC_EVErrorCodeType_NoData: // = 11
  4228. {
  4229. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)");
  4230. break;
  4231. }
  4232. default:
  4233. {
  4234. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected iso1 EVErrorCode)");
  4235. break;
  4236. }
  4237. }
  4238. }
  4239. /*===========================================================================
  4240. FUNCTION: PRINT_dinDC_EVStatusType
  4241. DESCRIPTION:
  4242. PRE-CONDITION:
  4243. INPUT:
  4244. OUTPUT:
  4245. GLOBAL VARIABLES:
  4246. =============================================================================*/
  4247. void PRINT_dinDC_EVStatusType(struct dinDC_EVStatusType *status)
  4248. {
  4249. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVStatus:");
  4250. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVReady = %d (DEC) ", status->EVReady);
  4251. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVErrorCode = %d (DEC) ", status->EVErrorCode);
  4252. PRINT_dinDC_EVErrorCodeType(status);
  4253. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSSOC = %d \%(DEC) \n", status->EVRESSSOC);
  4254. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVCabinConditioning = %d (DEC) ", status->EVCabinConditioning);
  4255. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVCabinConditioning_isUsed = %d (DEC) ", status->EVCabinConditioning_isUsed);
  4256. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSConditioning = %d (DEC) ", status->EVRESSConditioning);
  4257. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSConditioning_isUsed = %d (DEC) \n", status->EVRESSConditioning_isUsed);
  4258. }
  4259. /*===========================================================================
  4260. FUNCTION: PRINT_iso1DC_EVStatusType
  4261. DESCRIPTION:
  4262. PRE-CONDITION:
  4263. INPUT:
  4264. OUTPUT:
  4265. GLOBAL VARIABLES:
  4266. =============================================================================*/
  4267. void PRINT_iso1DC_EVStatusType(struct iso1DC_EVStatusType *status)
  4268. {
  4269. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVStatus:");
  4270. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVReady = %d (DEC) ", status->EVReady);
  4271. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVErrorCode = %d (DEC) ", status->EVErrorCode);
  4272. PRINT_iso1DC_EVErrorCodeType(status);
  4273. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSSOC = %d \%(DEC) \n", status->EVRESSSOC);
  4274. }