api.c 186 KB

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