api.c 189 KB

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