api.c 190 KB

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