api.c 186 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084
  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;
  630. out->Multiplier = 1;
  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;
  668. out->Multiplier = 1;
  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 = 32;
  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 = 1u;
  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. /*===========================================================================
  1124. FUNCTION: SHM_Save_din_ServiceAndPaymentSelectionReq
  1125. DESCRIPTION:
  1126. PRE-CONDITION:
  1127. INPUT:
  1128. OUTPUT:
  1129. GLOBAL VARIABLES:
  1130. =============================================================================*/
  1131. void SHM_Save_din_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1132. {
  1133. // ======== [STEP 1/3] Initialize ========
  1134. int i = 0;
  1135. struct ServiceAndPaymentSelectionRequest_DIN70121 *shm_msg;
  1136. struct dinServicePaymentSelectionReqType *exi;
  1137. shm_msg = &shm_ccs->V2GMessage_DIN70121.ServiceAndPaymentSelectionRequest;
  1138. exi = &exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq;
  1139. // ======== [STEP 2/3] Update Flags ========
  1140. // ======== [STEP 3/3] Transfer Data ========
  1141. //SHM_Save_din_V2GMSG_Header(buf);
  1142. //[1/2] SelectedPaymentOption
  1143. shm_msg->SelectedPaymentOption = (unsigned char) exi->SelectedPaymentOption;
  1144. //[2/2] SelectedServiceList
  1145. shm_msg->SelectedServiceList.SelectedServiceLen = (unsigned int) exi->SelectedServiceList.SelectedService.arrayLen;
  1146. for (i = 0; i< shm_msg->SelectedServiceList.SelectedServiceLen; i++)
  1147. {
  1148. shm_msg->SelectedServiceList.SelectedService[i].ServiceID =
  1149. (unsigned short) exi->SelectedServiceList.SelectedService.array[i].ServiceID;
  1150. shm_msg->SelectedServiceList.SelectedService[i].ParameterSetID =
  1151. (short) exi->SelectedServiceList.SelectedService.array[i].ParameterSetID;
  1152. }
  1153. }
  1154. /*===========================================================================
  1155. FUNCTION: SHM_Save_iso1_ServiceAndPaymentSelectionReq
  1156. DESCRIPTION:
  1157. PRE-CONDITION:
  1158. INPUT:
  1159. OUTPUT:
  1160. GLOBAL VARIABLES:
  1161. =============================================================================*/
  1162. void SHM_Save_iso1_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1163. {
  1164. // ======== [STEP 1/3] Initialize ========
  1165. int i = 0;
  1166. struct ServiceAndPaymentSelectionRequest_ISO15118_2014 *shm_msg;
  1167. struct iso1PaymentServiceSelectionReqType *exi;
  1168. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ServiceAndPaymentSelectionRequest;
  1169. exi = &exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq;
  1170. // ======== [STEP 2/3] Update Flags ========
  1171. // ======== [STEP 3/3] Transfer Data ========
  1172. //SHM_Save_iso1_V2GMSG_Header(buf);
  1173. //[1/2] SelectedPaymentOption
  1174. shm_msg->SelectedPaymentOption = (unsigned char) exi->SelectedPaymentOption;
  1175. //[2/2] SelectedServiceList
  1176. shm_msg->SelectedServiceList.SelectedServiceLen = (unsigned int) exi->SelectedServiceList.SelectedService.arrayLen;
  1177. for (i = 0; i< shm_msg->SelectedServiceList.SelectedServiceLen; i++)
  1178. {
  1179. shm_msg->SelectedServiceList.SelectedService[i].ServiceID =
  1180. (unsigned short) exi->SelectedServiceList.SelectedService.array[i].ServiceID;
  1181. shm_msg->SelectedServiceList.SelectedService[i].ParameterSetID =
  1182. (short) exi->SelectedServiceList.SelectedService.array[i].ParameterSetID;
  1183. }
  1184. }
  1185. /*===========================================================================
  1186. FUNCTION: SHM_Save_din_ContractAuthenticationReq
  1187. DESCRIPTION:
  1188. PRE-CONDITION:
  1189. INPUT:
  1190. OUTPUT:
  1191. GLOBAL VARIABLES:
  1192. =============================================================================*/
  1193. void SHM_Save_din_ContractAuthenticationReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1194. {
  1195. // ======== [STEP 1/3] Initialize ========
  1196. int i = 0;
  1197. struct ContractAuthenticationRequest_DIN70121 *shm_msg;
  1198. struct dinContractAuthenticationReqType *exi;
  1199. shm_msg = &shm_ccs->V2GMessage_DIN70121.ContractAuthenticationRequest;
  1200. exi = &exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq;
  1201. // ======== [STEP 2/3] Update Flags ========
  1202. // ======== [STEP 3/3] Transfer Data ========
  1203. //SHM_Save_din_V2GMSG_Header(buf);
  1204. //none
  1205. }
  1206. /*===========================================================================
  1207. FUNCTION: SHM_Save_iso1_AuthorizationReq
  1208. DESCRIPTION:
  1209. PRE-CONDITION:
  1210. INPUT:
  1211. OUTPUT:
  1212. GLOBAL VARIABLES:
  1213. =============================================================================*/
  1214. void SHM_Save_iso1_AuthorizationReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1215. {
  1216. // ======== [STEP 1/3] Initialize ========
  1217. int i = 0;
  1218. struct AuthorizationRequest_ISO15118_2014 *shm_msg;
  1219. struct iso1AuthorizationReqType *exi;
  1220. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.AuthorizationRequest;
  1221. exi = &exi_doc_ISO1->V2G_Message.Body.AuthorizationReq;
  1222. // ======== [STEP 2/3] Update Flags ========
  1223. // ======== [STEP 3/3] Transfer Data ========
  1224. //SHM_Save_iso1_V2GMSG_Header(buf);
  1225. //none
  1226. }
  1227. /*===========================================================================
  1228. FUNCTION: SHM_Save_din_ChargeParameterDiscoveryReq
  1229. DESCRIPTION: Save into share memories
  1230. (1) ShmCcsData (shm_ccs)
  1231. (2) ShmSysConfigAndInfo (shm_sys)
  1232. PRE-CONDITION:
  1233. INPUT:
  1234. OUTPUT:
  1235. GLOBAL VARIABLES:
  1236. =============================================================================*/
  1237. void SHM_Save_din_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1238. {
  1239. // ======== [STEP 1/3] Initialize ========
  1240. int i = 0;
  1241. struct ChargeParameterDiscoveryRequest_DIN70121 *shm_msg;
  1242. struct dinChargeParameterDiscoveryReqType *exi;
  1243. struct ChargingInfoData *sys;
  1244. shm_msg = &shm_ccs->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest;
  1245. exi = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq;
  1246. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1247. // ======== [STEP 2/3] Update Flags ========
  1248. // ======== [STEP 3/3] Transfer Data ========
  1249. //SHM_Save_din_V2GMSG_Header(buf);
  1250. //===== [BODY (1/9)] EVRequestedEnergyTransferType =====
  1251. shm_msg->EVRequestedEnergyTransferType = (unsigned char) exi->EVRequestedEnergyTransferType;
  1252. //===== [BODY (2/9)] DC_EVChargeParameter of EVChargeParameter =====
  1253. //DC_EVStatus
  1254. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVReady;
  1255. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVCabinConditioning;
  1256. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSConditioning;
  1257. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVErrorCode;
  1258. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
  1259. sys->EvBatterySoc = (int) shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
  1260. //[BODY (3/9)] EVMaximumCurrentLimit
  1261. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier =
  1262. (int) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier;
  1263. //shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit;
  1264. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = A_DIN70121;
  1265. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Value =
  1266. (short) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Value;
  1267. sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit);
  1268. //[BODY (4/9)] EVMaximumPowerLimit
  1269. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier =
  1270. (int) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier;
  1271. //shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Unit;
  1272. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = W_DIN70121;
  1273. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Value =
  1274. (short) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Value;
  1275. sys->EvBatteryMaxPower = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit);
  1276. //[BODY (5/9)] EVMaximumVoltageLimit
  1277. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier =
  1278. (int) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier;
  1279. //shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit;
  1280. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = V_DIN70121;
  1281. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Value =
  1282. (short) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Value;
  1283. sys->EvBatteryMaxVoltage = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit);
  1284. //[BODY (6/9)] EVEnergyCapacity
  1285. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Multiplier =
  1286. (int) exi->DC_EVChargeParameter.EVEnergyCapacity.Multiplier;
  1287. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Unit = WH_DIN70121;
  1288. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Value =
  1289. (short) exi->DC_EVChargeParameter.EVEnergyCapacity.Value;
  1290. sys->EvBatteryCapacity = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyCapacity);
  1291. //[BODY (7/9)] EVEnergyRequest
  1292. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Multiplier =
  1293. (int) exi->DC_EVChargeParameter.EVEnergyRequest.Multiplier;
  1294. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Unit = WH_DIN70121;
  1295. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Value =
  1296. (short) exi->DC_EVChargeParameter.EVEnergyRequest.Value;
  1297. sys->EvBatteryEngergyRequest = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyRequest);
  1298. //[BODY (8/9)] FullSOC
  1299. if (exi->DC_EVChargeParameter.FullSOC_isUsed != 0 && exi->DC_EVChargeParameter.FullSOC != 0)
  1300. {
  1301. shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.FullSOC;
  1302. }
  1303. else
  1304. {
  1305. shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
  1306. }
  1307. //[BODY (9/9)] BulkSOC
  1308. shm_msg->DC_EVChargeParameter.BulkSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
  1309. }
  1310. /*===========================================================================
  1311. FUNCTION: SHM_Save_iso1_ChargeParameterDiscoveryReq
  1312. DESCRIPTION: Save into share memories
  1313. (1) ShmCcsData (shm_ccs)
  1314. (2) ShmSysConfigAndInfo (shm_sys)
  1315. PRE-CONDITION:
  1316. INPUT:
  1317. OUTPUT:
  1318. GLOBAL VARIABLES:
  1319. =============================================================================*/
  1320. void SHM_Save_iso1_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1321. {
  1322. // ======== [STEP 1/3] Initialize ========
  1323. int i = 0;
  1324. struct ChargeParameterDiscoveryRequest_ISO15118_2014 *shm_msg;
  1325. struct iso1ChargeParameterDiscoveryReqType *exi;
  1326. struct ChargingInfoData *sys;
  1327. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest;
  1328. exi = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq;
  1329. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1330. // ======== [STEP 2/3] Update Flags ========
  1331. // ======== [STEP 3/3] Transfer Data ========
  1332. //SHM_Save_iso1_V2GMSG_Header(buf);
  1333. //===== [BODY (1/9)] EVRequestedEnergyTransferType =====
  1334. shm_msg->RequestedEnergyTransferMode = (unsigned char) exi->RequestedEnergyTransferMode;
  1335. //===== [BODY (2/9)] DC_EVChargeParameter of EVChargeParameter =====
  1336. //DC_EVStatus
  1337. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVReady;
  1338. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVErrorCode;
  1339. shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
  1340. sys->EvBatterySoc = (int) shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
  1341. //[BODY (3/9)] EVMaximumCurrentLimit
  1342. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier =
  1343. (int) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier;
  1344. //shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit;
  1345. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = A_ISO15118_2014;
  1346. shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Value =
  1347. (short) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Value;
  1348. sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit);
  1349. //[BODY (4/9)] EVMaximumPowerLimit
  1350. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier =
  1351. (int) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier;
  1352. //shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Unit;
  1353. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = W_ISO15118_2014;
  1354. shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Value =
  1355. (short) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Value;
  1356. sys->EvBatteryMaxPower = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit);
  1357. //[BODY (5/9)] EVMaximumVoltageLimit
  1358. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier =
  1359. (int) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier;
  1360. //shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit;
  1361. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = V_ISO15118_2014;
  1362. shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Value =
  1363. (short) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Value;
  1364. sys->EvBatteryMaxVoltage = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit);
  1365. //[BODY (6/9)] EVEnergyCapacity
  1366. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Multiplier =
  1367. (int) exi->DC_EVChargeParameter.EVEnergyCapacity.Multiplier;
  1368. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Unit = Wh_ISO15118_2014;
  1369. shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Value =
  1370. (short) exi->DC_EVChargeParameter.EVEnergyCapacity.Value;
  1371. sys->EvBatteryCapacity = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyCapacity);
  1372. //[BODY (7/9)] EVEnergyRequest
  1373. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Multiplier =
  1374. (int) exi->DC_EVChargeParameter.EVEnergyRequest.Multiplier;
  1375. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Unit = Wh_ISO15118_2014;
  1376. shm_msg->DC_EVChargeParameter.EVEnergyRequest.Value =
  1377. (short) exi->DC_EVChargeParameter.EVEnergyRequest.Value;
  1378. sys->EvBatteryEngergyRequest = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyRequest);
  1379. //[BODY (8/9)] FullSOC
  1380. if (exi->DC_EVChargeParameter.FullSOC_isUsed != 0 && exi->DC_EVChargeParameter.FullSOC != 0)
  1381. {
  1382. shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.FullSOC;
  1383. }
  1384. else
  1385. {
  1386. shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
  1387. }
  1388. //[BODY (9/9)] BulkSOC
  1389. shm_msg->DC_EVChargeParameter.BulkSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
  1390. }
  1391. /*===========================================================================
  1392. FUNCTION: SHM_Save_din_CableCheckReq
  1393. DESCRIPTION:
  1394. PRE-CONDITION:
  1395. INPUT:
  1396. OUTPUT:
  1397. GLOBAL VARIABLES:
  1398. =============================================================================*/
  1399. void SHM_Save_din_CableCheckReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1400. {
  1401. // ======== [STEP 1/3] Initialize ========
  1402. struct CableCheckRequest_DIN70121 *shm_msg;
  1403. struct dinCableCheckReqType *exi;
  1404. struct ChargingInfoData *sys;
  1405. shm_msg = &shm_ccs->V2GMessage_DIN70121.CableCheckRequest;
  1406. exi = &exi_doc_DIN->V2G_Message.Body.CableCheckReq;
  1407. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1408. // ======== [STEP 2/3] Update Flags ========
  1409. // ======== [STEP 3/3] Transfer Data ========
  1410. //SHM_Save_din_V2GMSG_Header(buf);
  1411. //===== [BODY (1/1)] DC_EVStatus =====
  1412. //DC_EVStatus
  1413. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1414. shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
  1415. shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
  1416. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1417. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1418. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1419. //Check for EVReady
  1420. //if (shm_msg->DC_EVStatus.EVReady == TRUE && shm_msg->DC_EVStatus.EVErrorCode == NO_ERROR)
  1421. //{
  1422. //sys->ConnectorLocked = TRUE; //Inicating EVSE that the CCS Connector is Locked.
  1423. //}
  1424. }
  1425. /*===========================================================================
  1426. FUNCTION: SHM_Save_iso1_CableCheckReq
  1427. DESCRIPTION:
  1428. PRE-CONDITION:
  1429. INPUT:
  1430. OUTPUT:
  1431. GLOBAL VARIABLES:
  1432. =============================================================================*/
  1433. void SHM_Save_iso1_CableCheckReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1434. {
  1435. // ======== [STEP 1/3] Initialize ========
  1436. struct CableCheckRequest_ISO15118_2014 *shm_msg;
  1437. struct iso1CableCheckReqType *exi;
  1438. struct ChargingInfoData *sys;
  1439. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.CableCheckRequest;
  1440. exi = &exi_doc_ISO1->V2G_Message.Body.CableCheckReq;
  1441. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1442. // ======== [STEP 2/3] Update Flags ========
  1443. // ======== [STEP 3/3] Transfer Data ========
  1444. //SHM_Save_iso1_V2GMSG_Header(buf);
  1445. //===== [BODY (1/1)] DC_EVStatus =====
  1446. //DC_EVStatus
  1447. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  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_din_PreChargeReq
  1459. DESCRIPTION:
  1460. PRE-CONDITION:
  1461. INPUT:
  1462. OUTPUT:
  1463. GLOBAL VARIABLES:
  1464. =============================================================================*/
  1465. void SHM_Save_din_PreChargeReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1466. {
  1467. // ======== [STEP 1/3] Initialize ========
  1468. struct PreChargeRequest_DIN70121 *shm_msg;
  1469. struct dinPreChargeReqType *exi;
  1470. struct ChargingInfoData *sys;
  1471. shm_msg = &shm_ccs->V2GMessage_DIN70121.PreChargeRequest;
  1472. exi = &exi_doc_DIN->V2G_Message.Body.PreChargeReq;
  1473. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1474. shm_msg->cnt++;
  1475. // ======== [STEP 2/3] Update Flags ========
  1476. // ======== [STEP 3/3] Transfer Data ========
  1477. //SHM_Save_din_V2GMSG_Header(buf);
  1478. //===== [BODY (1/3)] DC_EVStatus =====
  1479. //DC_EVStatus
  1480. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1481. shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
  1482. shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
  1483. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1484. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1485. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1486. //[BODY (2/3)] EVTargetVoltage
  1487. shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
  1488. //shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
  1489. shm_msg->EVTargetVoltage.Unit = V_DIN70121;
  1490. shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
  1491. if ((sys->EVSEPrechargeStatus == EVSE_STATUS_NOT_READY_FOR_PRECHARGE) || (shm_msg->cnt <= 2)) //0
  1492. {
  1493. sys->EvBatterytargetVoltage = 0; //0V, in order to avoid of turning off relay when D+/D- owns voltage.
  1494. }
  1495. else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
  1496. {
  1497. sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage);
  1498. //sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + 5; //for test, add 10V
  1499. }
  1500. //[BODY (3/3)] EVTargetCurrent
  1501. shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
  1502. //shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
  1503. shm_msg->EVTargetCurrent.Unit = A_DIN70121;
  1504. shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
  1505. if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
  1506. {
  1507. //sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
  1508. sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT; //for EVSE (default: 2A)
  1509. }
  1510. else
  1511. {
  1512. sys->EvBatterytargetCurrent = 0; //0A
  1513. }
  1514. //printf("\n\n[%d-th]sys-EvBatterytargetVoltage = %.02f (ori = %d)\n\n", cnt, sys->EvBatterytargetVoltage, shm_msg->EVTargetVoltage.Value);
  1515. }
  1516. /*===========================================================================
  1517. FUNCTION: SHM_Save_iso1_PreChargeReq
  1518. DESCRIPTION:
  1519. PRE-CONDITION:
  1520. INPUT:
  1521. OUTPUT:
  1522. GLOBAL VARIABLES:
  1523. =============================================================================*/
  1524. void SHM_Save_iso1_PreChargeReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1525. {
  1526. // ======== [STEP 1/3] Initialize ========
  1527. struct PreChargeRequest_ISO15118_2014 *shm_msg;
  1528. struct iso1PreChargeReqType *exi;
  1529. struct ChargingInfoData *sys;
  1530. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.PreChargeRequest;
  1531. exi = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq;
  1532. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1533. shm_msg->cnt++;
  1534. // ======== [STEP 2/3] Update Flags ========
  1535. // ======== [STEP 3/3] Transfer Data ========
  1536. //SHM_Save_iso1_V2GMSG_Header(buf);
  1537. //===== [BODY (1/3)] DC_EVStatus =====
  1538. //DC_EVStatus
  1539. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1540. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1541. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1542. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1543. //[BODY (2/3)] EVTargetVoltage
  1544. shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
  1545. //shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
  1546. shm_msg->EVTargetVoltage.Unit = V_ISO15118_2014;
  1547. shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
  1548. if ((sys->EVSEPrechargeStatus == EVSE_STATUS_NOT_READY_FOR_PRECHARGE) || (shm_msg->cnt <= 2)) //0
  1549. {
  1550. sys->EvBatterytargetVoltage = 0; //0V, in order to avoid of turning off relay when D+/D- owns voltage.
  1551. }
  1552. else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
  1553. {
  1554. sys->EvBatterytargetVoltage = ISO151182014PhyValDecode(shm_msg->EVTargetVoltage);
  1555. }
  1556. //[BODY (3/3)] EVTargetCurrent
  1557. shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
  1558. //shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
  1559. shm_msg->EVTargetCurrent.Unit = A_ISO15118_2014;
  1560. shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
  1561. if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
  1562. {
  1563. //sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
  1564. sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT; //for EVSE (default: 2A)
  1565. }
  1566. else
  1567. {
  1568. sys->EvBatterytargetCurrent = 0; //0A
  1569. }
  1570. //printf("\n\n[%d-th]sys-EvBatterytargetVoltage = %.02f (ori = %d)\n\n", cnt, sys->EvBatterytargetVoltage, shm_msg->EVTargetVoltage.Value);
  1571. }
  1572. /*===========================================================================
  1573. FUNCTION: SHM_Save_din_PowerDeliveryReq
  1574. DESCRIPTION:
  1575. PRE-CONDITION:
  1576. INPUT:
  1577. OUTPUT:
  1578. GLOBAL VARIABLES:
  1579. =============================================================================*/
  1580. void SHM_Save_din_PowerDeliveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1581. {
  1582. // ======== [STEP 1/3] Initialize ========
  1583. int i = 0;
  1584. struct PowerDeliveryRequest_DIN70121 *shm_msg;
  1585. struct dinPowerDeliveryReqType *exi;
  1586. struct ChargingInfoData *sys;
  1587. shm_msg = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryRequest;
  1588. exi = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq;
  1589. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1590. // ======== [STEP 2/3] Update Flags ========
  1591. // ======== [STEP 3/3] Transfer Data ========
  1592. //SHM_Save_din_V2GMSG_Header(buf);
  1593. //[BODY (1/3)] ReadyToChargeState
  1594. shm_msg->ReadyToChargeState = (BOOL) exi->ReadyToChargeState;
  1595. //[BODY (2/3)] ChargingProfile
  1596. //[BODY (3/3)] DC_EVPowerDeliveryParameters
  1597. //DC_EVStatus
  1598. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady;
  1599. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVCabinConditioning;
  1600. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSConditioning;
  1601. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode;
  1602. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
  1603. sys->EvBatterySoc = (int) shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
  1604. //BulkChargingComplete
  1605. shm_msg->DC_EVPowerDeliveryParameter.BulkChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.BulkChargingComplete;
  1606. //ChargingComplete
  1607. shm_msg->DC_EVPowerDeliveryParameter.ChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.ChargingComplete;
  1608. }
  1609. /*===========================================================================
  1610. FUNCTION: SHM_Save_iso1_PowerDeliveryReq
  1611. DESCRIPTION:
  1612. PRE-CONDITION:
  1613. INPUT:
  1614. OUTPUT:
  1615. GLOBAL VARIABLES:
  1616. =============================================================================*/
  1617. void SHM_Save_iso1_PowerDeliveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1618. {
  1619. // ======== [STEP 1/3] Initialize ========
  1620. int i = 0;
  1621. struct PowerDeliveryRequest_ISO15118_2014 *shm_msg;
  1622. struct iso1PowerDeliveryReqType *exi;
  1623. struct ChargingInfoData *sys;
  1624. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.PowerDeliveryRequest;
  1625. exi = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq;
  1626. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1627. // ======== [STEP 2/3] Update Flags ========
  1628. // ======== [STEP 3/3] Transfer Data ========
  1629. //SHM_Save_iso1_V2GMSG_Header(buf);
  1630. //[BODY (1/3)] ChargeProgress
  1631. shm_msg->ChargeProgress = (BOOL) exi->ChargeProgress;
  1632. //[BODY (2/3)] ChargingProfile
  1633. //[BODY (3/3)] DC_EVPowerDeliveryParameters
  1634. //DC_EVStatus
  1635. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady;
  1636. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode;
  1637. shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
  1638. sys->EvBatterySoc = (int) shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
  1639. //BulkChargingComplete
  1640. shm_msg->DC_EVPowerDeliveryParameter.BulkChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.BulkChargingComplete;
  1641. //ChargingComplete
  1642. shm_msg->DC_EVPowerDeliveryParameter.ChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.ChargingComplete;
  1643. }
  1644. /*===========================================================================
  1645. FUNCTION: SHM_Save_din_CurrentDemandReq
  1646. DESCRIPTION:
  1647. PRE-CONDITION:
  1648. INPUT:
  1649. OUTPUT:
  1650. GLOBAL VARIABLES:
  1651. =============================================================================*/
  1652. void SHM_Save_din_CurrentDemandReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1653. {
  1654. // ======== [STEP 1/3] Initialize ========
  1655. int i = 0;
  1656. struct CurrentDemandRequest_DIN70121 *shm_msg;
  1657. struct dinCurrentDemandReqType *exi;
  1658. struct ChargingInfoData *sys;
  1659. shm_msg = &shm_ccs->V2GMessage_DIN70121.CurrentDemandRequest;
  1660. exi = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq;
  1661. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1662. // ======== [STEP 2/3] Update Flags ========
  1663. // ======== [STEP 3/3] Transfer Data ========
  1664. //SHM_Save_din_V2GMSG_Header(buf);
  1665. //[BODY (1/10)] DC_EVStatus
  1666. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1667. shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
  1668. shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
  1669. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1670. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1671. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1672. //[BODY (2/10)] EVTargetCurrent
  1673. shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
  1674. //shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
  1675. shm_msg->EVTargetCurrent.Unit = A_DIN70121;
  1676. shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
  1677. if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_ENERGY_TRANSFER) //3 (Precharge Relay OFF, DC+ Relay ON)
  1678. {
  1679. sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
  1680. #if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
  1681. sys->EvBatterytargetCurrent = SUDO_EV_TARGET_CURRENT; //60A, for test;
  1682. #endif
  1683. }
  1684. else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2 (Precharge Relay ON, DC+ Relay OFF)
  1685. {
  1686. //sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT; //2A, unit: 1A
  1687. sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
  1688. }
  1689. else //0 (Precharge Relay is still under preparing, not ON, yet.)
  1690. {
  1691. //sys->EvBatterytargetCurrent = 0; //0A
  1692. sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
  1693. }
  1694. //[BODY (3/10)] EVMaximumVoltageLimit
  1695. shm_msg->EVMaximumVoltageLimit.Multiplier = (int) exi->EVMaximumVoltageLimit.Multiplier;
  1696. //shm_msg->EVMaximumVoltageLimit.Unit = (unsigned char) exi->EVMaximumVoltageLimit.Unit;
  1697. shm_msg->EVMaximumVoltageLimit.Unit = V_DIN70121;
  1698. shm_msg->EVMaximumVoltageLimit.Value = (short) exi->EVMaximumVoltageLimit.Value;
  1699. if (shm_msg->EVMaximumVoltageLimit.Value != 0 && exi->EVMaximumVoltageLimit_isUsed == 1u) //Gridwiz EVCC Emulator will not send EVMaximumVoltageLimit in CurrentDemandReq
  1700. {
  1701. sys->EvBatteryMaxVoltage = DIN70121PhyValDecode(shm_msg->EVMaximumVoltageLimit);
  1702. }
  1703. //[BODY (4/10)] EVMaximumCurrentLimit
  1704. shm_msg->EVMaximumCurrentLimit.Multiplier = (int) exi->EVMaximumCurrentLimit.Multiplier;
  1705. //shm_msg->EVMaximumCurrentLimit.Unit = (unsigned char) exi->EVMaximumCurrentLimit.Unit;
  1706. shm_msg->EVMaximumCurrentLimit.Unit = A_DIN70121;
  1707. shm_msg->EVMaximumCurrentLimit.Value = (short) exi->EVMaximumCurrentLimit.Value;
  1708. sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->EVMaximumCurrentLimit);
  1709. //[BODY (5/10)] EVMaximumPowerLimit
  1710. shm_msg->EVMaximumPowerLimit.Multiplier = (int) exi->EVMaximumPowerLimit.Multiplier;
  1711. //shm_msg->EVMaximumPowerLimit.Unit = (unsigned char) exi->EVMaximumPowerLimit.Unit;
  1712. shm_msg->EVMaximumPowerLimit.Unit = W_DIN70121;
  1713. shm_msg->EVMaximumPowerLimit.Value = (short) exi->EVMaximumPowerLimit.Value;
  1714. sys->EvBatteryMaxPower = DIN70121PhyValDecode(shm_msg->EVMaximumPowerLimit);
  1715. //[BODY (6/10)] BulkChargingComplete
  1716. shm_msg->BulkChargingComplete = (BOOL) exi->BulkChargingComplete;
  1717. //[BODY (7/10)] ChargingComplete
  1718. shm_msg->ChargingComplete = (BOOL) exi->ChargingComplete;
  1719. //[BODY (8/10)] RemainingTimeToFullSoC
  1720. shm_msg->RemainingTimeToFullSoC.Multiplier = (int) exi->RemainingTimeToFullSoC.Multiplier;
  1721. shm_msg->RemainingTimeToFullSoC.Unit = (unsigned char) exi->RemainingTimeToFullSoC.Unit;
  1722. shm_msg->RemainingTimeToFullSoC.Value = (short) exi->RemainingTimeToFullSoC.Value;
  1723. sys->RemainChargingDuration = DIN70121PhyValDecode(shm_msg->RemainingTimeToFullSoC);
  1724. //[BODY (9/10)] RemainingTimeToBulkSoC
  1725. shm_msg->RemainingTimeToBulkSoC.Multiplier = (int) exi->RemainingTimeToBulkSoC.Multiplier;
  1726. shm_msg->RemainingTimeToBulkSoC.Unit = (unsigned char) exi->RemainingTimeToBulkSoC.Unit;
  1727. shm_msg->RemainingTimeToBulkSoC.Value = (short) exi->RemainingTimeToBulkSoC.Value;
  1728. //[BODY (10/10)] EVTargetVoltage
  1729. shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
  1730. //shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
  1731. shm_msg->EVTargetVoltage.Unit = V_DIN70121;
  1732. shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
  1733. if((shm_msg->EVTargetVoltage.Value != 0) && (sys->EvBatteryMaxVoltage != 0))
  1734. {
  1735. sys->EvBatterytargetVoltage = (DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
  1736. }
  1737. else
  1738. {
  1739. sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage);
  1740. }
  1741. #if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
  1742. sys->EvBatterytargetVoltage = SUDO_EV_TARGET_VOLTAGE; //for test (500V, unit: 1V)
  1743. #endif
  1744. }
  1745. /*===========================================================================
  1746. FUNCTION: SHM_Save_iso1_CurrentDemandReq
  1747. DESCRIPTION:
  1748. PRE-CONDITION:
  1749. INPUT:
  1750. OUTPUT:
  1751. GLOBAL VARIABLES:
  1752. =============================================================================*/
  1753. void SHM_Save_iso1_CurrentDemandReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1754. {
  1755. // ======== [STEP 1/3] Initialize ========
  1756. int i = 0;
  1757. struct CurrentDemandRequest_ISO15118_2014 *shm_msg;
  1758. struct iso1CurrentDemandReqType *exi;
  1759. struct ChargingInfoData *sys;
  1760. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.CurrentDemandRequest;
  1761. exi = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq;
  1762. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1763. // ======== [STEP 2/3] Update Flags ========
  1764. // ======== [STEP 3/3] Transfer Data ========
  1765. //SHM_Save_iso1_V2GMSG_Header(buf);
  1766. //[BODY (1/10)] DC_EVStatus
  1767. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1768. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1769. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1770. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1771. //[BODY (2/10)] EVTargetCurrent
  1772. shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
  1773. //shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
  1774. shm_msg->EVTargetCurrent.Unit = A_ISO15118_2014;
  1775. shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
  1776. if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_ENERGY_TRANSFER) //3 (Precharge Relay OFF, DC+ Relay ON)
  1777. {
  1778. sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
  1779. #if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
  1780. sys->EvBatterytargetCurrent = SUDO_EV_TARGET_CURRENT; //60A, for test;
  1781. #endif
  1782. }
  1783. else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2 (Precharge Relay ON, DC+ Relay OFF)
  1784. {
  1785. //sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT; //2A, unit: 1A
  1786. sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
  1787. }
  1788. else //0 (Precharge Relay is still under preparing, not ON, yet.)
  1789. {
  1790. //sys->EvBatterytargetCurrent = 0; //0A
  1791. sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
  1792. }
  1793. //[BODY (3/10)] EVMaximumVoltageLimit
  1794. shm_msg->EVMaximumVoltageLimit.Multiplier = (int) exi->EVMaximumVoltageLimit.Multiplier;
  1795. //shm_msg->EVMaximumVoltageLimit.Unit = (unsigned char) exi->EVMaximumVoltageLimit.Unit;
  1796. shm_msg->EVMaximumVoltageLimit.Unit = V_ISO15118_2014;
  1797. shm_msg->EVMaximumVoltageLimit.Value = (short) exi->EVMaximumVoltageLimit.Value;
  1798. if (shm_msg->EVMaximumVoltageLimit.Value != 0 && exi->EVMaximumVoltageLimit_isUsed == 1u) //Gridwiz EVCC Emulator will not send EVMaximumVoltageLimit in CurrentDemandReq
  1799. {
  1800. sys->EvBatteryMaxVoltage = ISO151182014PhyValDecode(shm_msg->EVMaximumVoltageLimit);
  1801. }
  1802. /*
  1803. printf("[SeccComm] <V_ev_max> = %d, %d, %.02f\n",
  1804. exi->EVMaximumVoltageLimit.Value,
  1805. shm_msg->EVMaximumVoltageLimit.Value,
  1806. sys->EvBatteryMaxVoltage
  1807. );
  1808. */
  1809. //[BODY (4/10)] EVMaximumCurrentLimit
  1810. shm_msg->EVMaximumCurrentLimit.Multiplier = (int) exi->EVMaximumCurrentLimit.Multiplier;
  1811. //shm_msg->EVMaximumCurrentLimit.Unit = (unsigned char) exi->EVMaximumCurrentLimit.Unit;
  1812. shm_msg->EVMaximumCurrentLimit.Unit = A_ISO15118_2014;
  1813. shm_msg->EVMaximumCurrentLimit.Value = (short) exi->EVMaximumCurrentLimit.Value;
  1814. sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->EVMaximumCurrentLimit);
  1815. //[BODY (5/10)] EVMaximumPowerLimit
  1816. shm_msg->EVMaximumPowerLimit.Multiplier = (int) exi->EVMaximumPowerLimit.Multiplier;
  1817. //shm_msg->EVMaximumPowerLimit.Unit = (unsigned char) exi->EVMaximumPowerLimit.Unit;
  1818. shm_msg->EVMaximumPowerLimit.Unit = W_ISO15118_2014;
  1819. shm_msg->EVMaximumPowerLimit.Value = (short) exi->EVMaximumPowerLimit.Value;
  1820. sys->EvBatteryMaxPower = ISO151182014PhyValDecode(shm_msg->EVMaximumPowerLimit);
  1821. //[BODY (6/10)] BulkChargingComplete
  1822. shm_msg->BulkChargingComplete = (BOOL) exi->BulkChargingComplete;
  1823. //[BODY (7/10)] ChargingComplete
  1824. shm_msg->ChargingComplete = (BOOL) exi->ChargingComplete;
  1825. //[BODY (8/10)] RemainingTimeToFullSoC
  1826. shm_msg->RemainingTimeToFullSoC.Multiplier = (int) exi->RemainingTimeToFullSoC.Multiplier;
  1827. shm_msg->RemainingTimeToFullSoC.Unit = (unsigned char) exi->RemainingTimeToFullSoC.Unit;
  1828. shm_msg->RemainingTimeToFullSoC.Value = (short) exi->RemainingTimeToFullSoC.Value;
  1829. sys->RemainChargingDuration = ISO151182014PhyValDecode(shm_msg->RemainingTimeToFullSoC);
  1830. //[BODY (9/10)] RemainingTimeToBulkSoC
  1831. shm_msg->RemainingTimeToBulkSoC.Multiplier = (int) exi->RemainingTimeToBulkSoC.Multiplier;
  1832. shm_msg->RemainingTimeToBulkSoC.Unit = (unsigned char) exi->RemainingTimeToBulkSoC.Unit;
  1833. shm_msg->RemainingTimeToBulkSoC.Value = (short) exi->RemainingTimeToBulkSoC.Value;
  1834. //[BODY (10/10)] EVTargetVoltage
  1835. shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
  1836. //shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
  1837. shm_msg->EVTargetVoltage.Unit = V_ISO15118_2014;
  1838. shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
  1839. if((shm_msg->EVTargetVoltage.Value != 0) && (sys->EvBatteryMaxVoltage != 0))
  1840. {
  1841. sys->EvBatterytargetVoltage = (ISO151182014PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
  1842. }
  1843. else
  1844. {
  1845. sys->EvBatterytargetVoltage = ISO151182014PhyValDecode(shm_msg->EVTargetVoltage);
  1846. }
  1847. /*
  1848. printf("[SeccComm] <V_ev_target> = %d, %d, %.02f\n",
  1849. exi->EVTargetVoltage.Value,
  1850. shm_msg->EVTargetVoltage.Value,
  1851. sys->EvBatterytargetVoltage
  1852. );
  1853. */
  1854. #if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
  1855. sys->EvBatterytargetVoltage = SUDO_EV_TARGET_VOLTAGE; //for test (500V, unit: 1V)
  1856. #endif
  1857. }
  1858. /*===========================================================================
  1859. FUNCTION: SHM_Save_iso1_ChargingStatusReq
  1860. DESCRIPTION:
  1861. PRE-CONDITION:
  1862. INPUT:
  1863. OUTPUT:
  1864. GLOBAL VARIABLES:
  1865. =============================================================================*/
  1866. void SHM_Save_iso1_ChargingStatusReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1867. {
  1868. //no content for ISO1
  1869. }
  1870. /*===========================================================================
  1871. FUNCTION: SHM_Save_din_WeldingDetectionReq
  1872. DESCRIPTION:
  1873. PRE-CONDITION:
  1874. INPUT:
  1875. OUTPUT:
  1876. GLOBAL VARIABLES:
  1877. =============================================================================*/
  1878. void SHM_Save_din_WeldingDetectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1879. {
  1880. // ======== [STEP 1/3] Initialize ========
  1881. int i = 0;
  1882. struct WeldingDetectionRequest_DIN70121 *shm_msg;
  1883. struct dinWeldingDetectionReqType *exi;
  1884. struct ChargingInfoData *sys;
  1885. shm_msg = &shm_ccs->V2GMessage_DIN70121.WeldingDetectionRequest;
  1886. exi = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq;
  1887. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1888. // ======== [STEP 2/3] Update Flags ========
  1889. // ======== [STEP 3/3] Transfer Data ========
  1890. //SHM_Save_din_V2GMSG_Header(buf);
  1891. //===== [BODY (1/3)] DC_EVStatus =====
  1892. //DC_EVStatus
  1893. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1894. shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
  1895. shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
  1896. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1897. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1898. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1899. }
  1900. /*===========================================================================
  1901. FUNCTION: SHM_Save_iso1_WeldingDetectionReq
  1902. DESCRIPTION:
  1903. PRE-CONDITION:
  1904. INPUT:
  1905. OUTPUT:
  1906. GLOBAL VARIABLES:
  1907. =============================================================================*/
  1908. void SHM_Save_iso1_WeldingDetectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1909. {
  1910. // ======== [STEP 1/3] Initialize ========
  1911. int i = 0;
  1912. struct WeldingDetectionRequest_ISO15118_2014 *shm_msg;
  1913. struct iso1WeldingDetectionReqType *exi;
  1914. struct ChargingInfoData *sys;
  1915. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.WeldingDetectionRequest;
  1916. exi = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq;
  1917. sys = &shm_sys->SysInfo.CcsChargingData[0];
  1918. // ======== [STEP 2/3] Update Flags ========
  1919. // ======== [STEP 3/3] Transfer Data ========
  1920. //SHM_Save_iso1_V2GMSG_Header(buf);
  1921. //===== [BODY (1/3)] DC_EVStatus =====
  1922. //DC_EVStatus
  1923. shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
  1924. shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
  1925. shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
  1926. sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
  1927. }
  1928. /*===========================================================================
  1929. FUNCTION: SHM_Save_din_SessionStopReq
  1930. DESCRIPTION:
  1931. PRE-CONDITION:
  1932. INPUT:
  1933. OUTPUT:
  1934. GLOBAL VARIABLES:
  1935. =============================================================================*/
  1936. void SHM_Save_din_SessionStopReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
  1937. {
  1938. // ======== [STEP 1/3] Initialize ========
  1939. /*
  1940. int i = 0;
  1941. struct SessionStopRequest_DIN70121 *shm_msg;
  1942. struct dinSessionStopReqType *exi;
  1943. shm_msg = &shm_ccs->V2GMessage_DIN70121.SessionStopRequest;
  1944. exi = &exi_doc_DIN->V2G_Message.Body.SessionStopReq;
  1945. */
  1946. // ======== [STEP 2/3] Update Flags ========
  1947. // ======== [STEP 3/3] Transfer Data ========
  1948. //SHM_Save_din_V2GMSG_Header(buf);
  1949. //null
  1950. }
  1951. /*===========================================================================
  1952. FUNCTION: SHM_Save_iso1_SessionStopReq
  1953. DESCRIPTION:
  1954. PRE-CONDITION:
  1955. INPUT:
  1956. OUTPUT:
  1957. GLOBAL VARIABLES:
  1958. =============================================================================*/
  1959. void SHM_Save_iso1_SessionStopReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
  1960. {
  1961. // ======== [STEP 1/3] Initialize ========
  1962. /*
  1963. int i = 0;
  1964. struct SessionStopRequest_ISO15118_2014 *shm_msg;
  1965. struct iso1SessionStopReqType *exi;
  1966. shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.SessionStopRequest;
  1967. exi = &exi_doc_ISO1->V2G_Message.Body.SessionStopReq;
  1968. */
  1969. // ======== [STEP 2/3] Update Flags ========
  1970. // ======== [STEP 3/3] Transfer Data ========
  1971. //SHM_Save_iso1_V2GMSG_Header(buf);
  1972. //null
  1973. }
  1974. /*===========================================================================
  1975. FUNCTION: SHM_Read_din_SessionSetupRes
  1976. DESCRIPTION:
  1977. PRE-CONDITION:
  1978. INPUT:
  1979. 1. shm_ccs
  1980. OUTPUT:
  1981. 2. exi_doc_DIN
  1982. GLOBAL VARIABLES:
  1983. =============================================================================*/
  1984. void SHM_Read_din_SessionSetupRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  1985. {
  1986. int i = 0;
  1987. struct dinSessionSetupResType *out;
  1988. struct SessionSetupResponse_DIN70121 *in;
  1989. out = &exi_doc_DIN->V2G_Message.Body.SessionSetupRes;
  1990. in = &shm_ccs->V2GMessage_DIN70121.SessionSetupResponse;
  1991. exi_doc_DIN->V2G_Message.Body.SessionSetupRes_isUsed = 1u;
  1992. // ====== [BODY (1/3) ResponseCode ======
  1993. out->ResponseCode = in->ResponseCode;
  1994. // ====== [BODY (2/3) EVSEID ======
  1995. out->EVSEID.bytesLen = 32; //max = 32 bytes(DIN), all zero
  1996. for (i = 0; i< 32; i++)
  1997. {
  1998. out->EVSEID.bytes[i] = (unsigned char) in->EVSEID[i];
  1999. }
  2000. // ====== [BODY (3/3) DateTimeNow ======
  2001. out->DateTimeNow_isUsed = 1u;
  2002. out->DateTimeNow = (int64_t) in->EVSETimeStamp; //Format: Unix Time Stamp
  2003. }
  2004. /*===========================================================================
  2005. FUNCTION: SHM_Read_din_ContractAuthenticationRes
  2006. DESCRIPTION:
  2007. PRE-CONDITION:
  2008. INPUT:
  2009. 1. shm_ccs
  2010. OUTPUT:
  2011. 2. exi_doc_DIN
  2012. GLOBAL VARIABLES:
  2013. =============================================================================*/
  2014. void SHM_Read_din_ContractAuthenticationRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2015. {
  2016. struct dinContractAuthenticationResType *out;
  2017. struct ContractAuthenticationResponse_DIN70121 *in;
  2018. out = &exi_doc_DIN->V2G_Message.Body.ContractAuthenticationRes;
  2019. in = &shm_ccs->V2GMessage_DIN70121.ContractAuthenticationResponse;
  2020. //[BODY (2/2)] EVSEProcessing
  2021. out->EVSEProcessing = (BOOL)in->EVSEProcessing; //0(Finished) or 1(Ongoing)
  2022. }
  2023. /*===========================================================================
  2024. FUNCTION: SHM_Read_din_ChargeParameterDiscoveryRes
  2025. DESCRIPTION:
  2026. PRE-CONDITION:
  2027. INPUT:
  2028. 1. shm_ccs
  2029. OUTPUT:
  2030. 2. exi_doc_DIN
  2031. GLOBAL VARIABLES:
  2032. =============================================================================*/
  2033. void SHM_Read_din_ChargeParameterDiscoveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2034. {
  2035. struct dinChargeParameterDiscoveryResType *out;
  2036. struct ChargeParameterDiscoveryResponse_DIN70121 *in;
  2037. out = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryRes;
  2038. in = &shm_ccs->V2GMessage_DIN70121.ChargeParameterDiscoveryResponse;
  2039. //Initialize
  2040. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2041. init_dinChargeParameterDiscoveryResType(out);
  2042. exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
  2043. //----- [BODY (1/5)] ResponseCode -----
  2044. out->ResponseCode = (unsigned char) in->ResponseCode;
  2045. //----- [BODY (2/5)] EVSEProcessing -----
  2046. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2047. // dinEVSEProcessingType_Finished = 0,
  2048. // dinEVSEProcessingType_Ongoing = 1
  2049. //----- [BODY (3/5)] SAScheduleList of SASchedules -----
  2050. //[Joseph] Here keep constant values and not copy from share memory, yet.
  2051. out->SAScheduleList_isUsed = 1u;
  2052. struct dinSAScheduleListType *list;
  2053. list = &out->SAScheduleList;
  2054. //
  2055. list->SAScheduleTuple.arrayLen = 1;
  2056. list->SAScheduleTuple.array[0].SAScheduleTupleID = 0;
  2057. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleID = 0;
  2058. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
  2059. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
  2060. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
  2061. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = 86400; //24Hrs at least, unit:second
  2062. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
  2063. /*+++ 20200808, vern, add Pmax parameters in chargeParameters discovery +++*/
  2064. in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value*=10;
  2065. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax = in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value;
  2066. /*--- 20200808, vern, add Pmax parameters in chargeParameters discovery ---*/
  2067. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
  2068. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 600;
  2069. //list->SAScheduleTuple.array[0].SalesTariff.xxx
  2070. //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
  2071. //----- [BODY (4/5)] AC_EVSEChargeParameter of EVSEChargeParameter -----
  2072. //ignore, since DIN doesn't support AC
  2073. //----- [BODY (5/5)] DC_EVSEChargeParameter of EVSEChargeParameter -----
  2074. out->DC_EVSEChargeParameter_isUsed = 1u;
  2075. struct dinDC_EVSEChargeParameterType *out_dc_para;
  2076. struct DC_EVSEChargeParameterType_DIN70121 *in_dc_para;
  2077. out_dc_para = &out->DC_EVSEChargeParameter;
  2078. in_dc_para = &in->DC_EVSEChargeParameter;
  2079. //DC_EVSEStatus
  2080. out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
  2081. SHM_Read_dinDC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
  2082. //EVSEMaximumCurrentLimit
  2083. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
  2084. //EVSEMaximumPowerLimit
  2085. out_dc_para->EVSEMaximumPowerLimit_isUsed = 1u;
  2086. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
  2087. //EVSEMaximumVoltageLimit
  2088. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
  2089. //EVSEMinimumVoltageLimit
  2090. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
  2091. //EVSEMinimumCurrentLimit
  2092. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
  2093. //EVSECurrentRegulationTolerance_isUsed
  2094. out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
  2095. //EVSECurrentRegulationTolerance
  2096. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
  2097. //EVSEEnergyToBeDelivered_isUsed
  2098. out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
  2099. //EVSEEnergyToBeDelivered (optional)
  2100. //SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
  2101. //EVSEPeakCurrentRipple
  2102. SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
  2103. }
  2104. /*===========================================================================
  2105. FUNCTION: SHM_Read_iso1_ChargeParameterDiscoveryRes
  2106. DESCRIPTION:
  2107. PRE-CONDITION:
  2108. INPUT:
  2109. 1. shm_ccs
  2110. OUTPUT:
  2111. 2. exi_doc_ISO1
  2112. GLOBAL VARIABLES:
  2113. =============================================================================*/
  2114. void SHM_Read_iso1_ChargeParameterDiscoveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2115. {
  2116. struct iso1ChargeParameterDiscoveryResType *out;
  2117. struct ChargeParameterDiscoveryResponse_ISO15118_2014 *in;
  2118. out = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes;
  2119. in = &shm_ccs->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryResponse;
  2120. //Initialize
  2121. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2122. init_iso1ChargeParameterDiscoveryResType(out);
  2123. exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
  2124. //----- [BODY (1/5)] ResponseCode -----
  2125. out->ResponseCode = (unsigned char) in->ResponseCode;
  2126. //----- [BODY (2/5)] EVSEProcessing -----
  2127. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2128. // iso1EVSEProcessingType_Finished = 0,
  2129. // iso1EVSEProcessingType_Ongoing = 1
  2130. //----- [BODY (3/5)] SAScheduleList of SASchedules -----
  2131. //[Joseph] Here keep constant values and not copy from share memory, yet.
  2132. out->SAScheduleList_isUsed = 1u;
  2133. struct iso1SAScheduleListType *list;
  2134. list = &out->SAScheduleList;
  2135. //
  2136. list->SAScheduleTuple.arrayLen = 1;
  2137. list->SAScheduleTuple.array[0].SAScheduleTupleID = 1;
  2138. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleID = 0;
  2139. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
  2140. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
  2141. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
  2142. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = 86400; //24Hrs at least, unit:second
  2143. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
  2144. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
  2145. //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 86400;
  2146. /*+++ 20200808, vern, add Pmax parameters in chargeParameters discovery +++*/
  2147. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Unit = iso1unitSymbolType_W; //iso1unitSymbolType_W
  2148. in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value*=10; /*+++ 20200808, vern, lack one more 0 ---*/
  2149. list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Value =in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value; //30000 if DW/DM product
  2150. /*--- 20200808, vern, add Pmax parameters in chargeParameters discovery ---*/
  2151. //list->SAScheduleTuple.array[0].SalesTariff.xxx
  2152. //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
  2153. //----- [BODY (4/5)] AC/DC EVSEChargeParameter -----
  2154. #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
  2155. {
  2156. //----- [BODY (4/5)] AC_EVSEChargeParameter -----
  2157. out->AC_EVSEChargeParameter_isUsed = 1u;
  2158. struct iso1AC_EVSEChargeParameterType *out_ac_para;
  2159. struct AC_EVSEChargeParameterType_ISO15118_2014 *in_ac_para;
  2160. out_ac_para = &out->AC_EVSEChargeParameter;
  2161. in_ac_para = &in->AC_EVSEChargeParameter;
  2162. //[1/3] AC_EVSEStatus
  2163. SHM_Read_iso1AC_EVSEStatusType(&out_ac_para->AC_EVSEStatus, &in_ac_para->AC_EVSEStatus);
  2164. //[2/3] EVSENominalVoltage
  2165. SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSENominalVoltage, &in_ac_para->EVSENominalVoltage);
  2166. //[3/3] EVSEMaxCurrent
  2167. SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSEMaxCurrent, &in_ac_para->EVSEMaxCurrent);
  2168. }
  2169. #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
  2170. {
  2171. //----- [BODY (5/5)] DC_EVSEChargeParameter -----
  2172. out->DC_EVSEChargeParameter_isUsed = 1u;
  2173. struct iso1DC_EVSEChargeParameterType *out_dc_para;
  2174. struct DC_EVSEChargeParameterType_ISO15118_2014 *in_dc_para;
  2175. out_dc_para = &out->DC_EVSEChargeParameter;
  2176. in_dc_para = &in->DC_EVSEChargeParameter;
  2177. //DC_EVSEStatus
  2178. out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
  2179. SHM_Read_iso1DC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
  2180. //EVSEMaximumCurrentLimit
  2181. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
  2182. //EVSEMaximumPowerLimit
  2183. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
  2184. //EVSEMaximumVoltageLimit
  2185. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
  2186. //EVSEMinimumVoltageLimit
  2187. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
  2188. //EVSEMinimumCurrentLimit
  2189. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
  2190. //EVSECurrentRegulationTolerance_isUsed
  2191. out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
  2192. //EVSECurrentRegulationTolerance
  2193. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
  2194. //EVSEEnergyToBeDelivered_isUsed
  2195. out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
  2196. //EVSEEnergyToBeDelivered (optional)
  2197. //SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
  2198. //EVSEPeakCurrentRipple
  2199. SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
  2200. }
  2201. #endif
  2202. }
  2203. /*===========================================================================
  2204. FUNCTION: SHM_Read_din_CableCheckRes
  2205. DESCRIPTION:
  2206. PRE-CONDITION:
  2207. INPUT:
  2208. 1. shm_ccs
  2209. OUTPUT:
  2210. 2. exi_doc_DIN
  2211. GLOBAL VARIABLES:
  2212. =============================================================================*/
  2213. void SHM_Read_din_CableCheckRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2214. {
  2215. struct dinCableCheckResType *out;
  2216. struct CableCheckResponse_DIN70121 *in;
  2217. out = &exi_doc_DIN->V2G_Message.Body.CableCheckRes;
  2218. in = &shm_ccs->V2GMessage_DIN70121.CableCheckResponse;
  2219. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2220. init_dinCableCheckResType(out);
  2221. exi_doc_DIN->V2G_Message.Body.CableCheckRes_isUsed = 1u;
  2222. //----- [BODY (1/3)] ResponseCode -----
  2223. out->ResponseCode = (unsigned char) in->ResponseCode;
  2224. //----- [BODY (2/3)] EVSEProcessing -----
  2225. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2226. // dinEVSEProcessingType_Finished = 0,
  2227. // dinEVSEProcessingType_Ongoing = 1
  2228. //----- [BODY (3/3)] DC_EVSEStatus -----
  2229. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2230. }
  2231. /*===========================================================================
  2232. FUNCTION: SHM_Read_iso1_CableCheckRes
  2233. DESCRIPTION:
  2234. PRE-CONDITION:
  2235. INPUT:
  2236. 1. shm_ccs
  2237. OUTPUT:
  2238. 2. exi_doc_ISO1
  2239. GLOBAL VARIABLES:
  2240. =============================================================================*/
  2241. void SHM_Read_iso1_CableCheckRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2242. {
  2243. struct iso1CableCheckResType *out;
  2244. struct CableCheckResponse_ISO15118_2014 *in;
  2245. out = &exi_doc_ISO1->V2G_Message.Body.CableCheckRes;
  2246. in = &shm_ccs->V2GMessage_ISO15118_2014.CableCheckResponse;
  2247. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2248. init_iso1CableCheckResType(out);
  2249. exi_doc_ISO1->V2G_Message.Body.CableCheckRes_isUsed = 1u;
  2250. //----- [BODY (1/3)] ResponseCode -----
  2251. out->ResponseCode = (unsigned char) in->ResponseCode;
  2252. //----- [BODY (2/3)] EVSEProcessing -----
  2253. out->EVSEProcessing = (BOOL) in->EVSEProcessing;
  2254. // iso1EVSEProcessingType_Finished = 0,
  2255. // iso1EVSEProcessingType_Ongoing = 1
  2256. //----- [BODY (3/3)] DC_EVSEStatus -----
  2257. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2258. }
  2259. /*===========================================================================
  2260. FUNCTION: SHM_Read_din_PreChargeRes
  2261. DESCRIPTION:
  2262. PRE-CONDITION:
  2263. INPUT:
  2264. 1. shm_ccs
  2265. OUTPUT:
  2266. 2. exi_doc_DIN
  2267. GLOBAL VARIABLES:
  2268. =============================================================================*/
  2269. void SHM_Read_din_PreChargeRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2270. {
  2271. struct dinPreChargeResType *out;
  2272. struct PreChargeResponse_DIN70121 *in;
  2273. out = &exi_doc_DIN->V2G_Message.Body.PreChargeRes;
  2274. in = &shm_ccs->V2GMessage_DIN70121.PreChargeResponse;
  2275. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2276. init_dinPreChargeResType(&exi_doc_DIN->V2G_Message.Body.PreChargeRes);
  2277. exi_doc_DIN->V2G_Message.Body.PreChargeRes_isUsed = 1u;
  2278. //----- [BODY (1/3)] ResponseCode -----
  2279. out->ResponseCode = (unsigned char) in->ResponseCode;
  2280. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2281. SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2282. // dinunitSymbolType_h = 0,
  2283. // dinunitSymbolType_m = 1,
  2284. // dinunitSymbolType_s = 2,
  2285. // dinunitSymbolType_A = 3,
  2286. // dinunitSymbolType_Ah = 4,
  2287. // dinunitSymbolType_V = 5,
  2288. // dinunitSymbolType_VA = 6,
  2289. // dinunitSymbolType_W = 7,
  2290. // dinunitSymbolType_W_s = 8,
  2291. // dinunitSymbolType_Wh = 9
  2292. //----- [BODY (3/3)] DC_EVSEStatus -----
  2293. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2294. }
  2295. /*===========================================================================
  2296. FUNCTION: SHM_Read_iso1_PreChargeRes
  2297. DESCRIPTION:
  2298. PRE-CONDITION:
  2299. INPUT:
  2300. 1. shm_ccs
  2301. OUTPUT:
  2302. 2. exi_doc_ISO1
  2303. GLOBAL VARIABLES:
  2304. =============================================================================*/
  2305. void SHM_Read_iso1_PreChargeRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2306. {
  2307. struct iso1PreChargeResType *out;
  2308. struct PreChargeResponse_ISO15118_2014 *in;
  2309. out = &exi_doc_ISO1->V2G_Message.Body.PreChargeRes;
  2310. in = &shm_ccs->V2GMessage_ISO15118_2014.PreChargeResponse;
  2311. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2312. init_iso1PreChargeResType(&exi_doc_ISO1->V2G_Message.Body.PreChargeRes);
  2313. exi_doc_ISO1->V2G_Message.Body.PreChargeRes_isUsed = 1u;
  2314. //----- [BODY (1/3)] ResponseCode -----
  2315. out->ResponseCode = (unsigned char) in->ResponseCode;
  2316. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2317. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2318. //iso1unitSymbolType_h = 0,
  2319. //iso1unitSymbolType_m = 1,
  2320. //iso1unitSymbolType_s = 2,
  2321. //iso1unitSymbolType_A = 3,
  2322. //iso1unitSymbolType_V = 4,
  2323. //iso1unitSymbolType_W = 5,
  2324. //iso1unitSymbolType_Wh = 6
  2325. //----- [BODY (3/3)] DC_EVSEStatus -----
  2326. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2327. }
  2328. /*===========================================================================
  2329. FUNCTION: SHM_Read_din_PowerDeliveryRes
  2330. DESCRIPTION:
  2331. PRE-CONDITION:
  2332. INPUT:
  2333. 1. shm_ccs
  2334. OUTPUT:
  2335. 2. exi_doc_DIN
  2336. GLOBAL VARIABLES:
  2337. =============================================================================*/
  2338. void SHM_Read_din_PowerDeliveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2339. {
  2340. struct dinPowerDeliveryResType *out;
  2341. struct PowerDeliveryResponse_DIN70121 *in;
  2342. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2343. init_dinPowerDeliveryResType(&exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes);
  2344. out = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes;
  2345. in = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryResponse;
  2346. exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
  2347. //----- [BODY (1/3)] ResponseCode -----
  2348. out->ResponseCode = (unsigned char) in->ResponseCode;
  2349. //----- [BODY (2/3)] AC_EVSEStatus -----
  2350. //ignore, since DIN 70121 doesn't support AC, yet.
  2351. //----- [BODY (2/3)] DC_EVSEStatus -----
  2352. out->DC_EVSEStatus_isUsed = 1u;
  2353. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2354. }
  2355. /*===========================================================================
  2356. FUNCTION: SHM_Read_iso1_PowerDeliveryRes
  2357. DESCRIPTION:
  2358. PRE-CONDITION:
  2359. INPUT:
  2360. 1. shm_ccs
  2361. OUTPUT:
  2362. 2. exi_doc_ISO1
  2363. GLOBAL VARIABLES:
  2364. =============================================================================*/
  2365. void SHM_Read_iso1_PowerDeliveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2366. {
  2367. struct iso1PowerDeliveryResType *out;
  2368. struct PowerDeliveryResponse_ISO15118_2014 *in;
  2369. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2370. init_iso1PowerDeliveryResType(&exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes);
  2371. out = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes;
  2372. in = &shm_ccs->V2GMessage_ISO15118_2014.PowerDeliveryResponse;
  2373. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
  2374. //----- [BODY (1/3)] ResponseCode -----
  2375. out->ResponseCode = (unsigned char) in->ResponseCode;
  2376. //----- [BODY (2/3)] AC_EVSEStatus -----
  2377. //ignore, since our ISO1 70121 doesn't support AC, yet.
  2378. //----- [BODY (2/3)] DC_EVSEStatus -----
  2379. #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
  2380. {
  2381. //out->DC_EVSEStatus_isUsed = 0u;
  2382. }
  2383. #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
  2384. {
  2385. out->DC_EVSEStatus_isUsed = 1u;
  2386. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2387. }
  2388. #endif
  2389. }
  2390. /*===========================================================================
  2391. FUNCTION: SHM_Read_din_CurrentDemandRes
  2392. DESCRIPTION:
  2393. PRE-CONDITION:
  2394. INPUT:
  2395. 1. shm_ccs
  2396. OUTPUT:
  2397. 2. exi_doc_DIN
  2398. GLOBAL VARIABLES:
  2399. =============================================================================*/
  2400. void SHM_Read_din_CurrentDemandRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2401. {
  2402. struct dinCurrentDemandResType *out;
  2403. struct CurrentDemandResponse_DIN70121 *in;
  2404. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2405. init_dinCurrentDemandResType(&exi_doc_DIN->V2G_Message.Body.CurrentDemandRes);
  2406. out = &exi_doc_DIN->V2G_Message.Body.CurrentDemandRes;
  2407. in = &shm_ccs->V2GMessage_DIN70121.CurrentDemandResponse;
  2408. exi_doc_DIN->V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
  2409. //----- [BODY (1/10)] ResponseCode -----
  2410. out->ResponseCode = (unsigned char) in->ResponseCode;
  2411. //----- [BODY (2/10)] DC_EVSEStatus -----
  2412. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2413. //----- [BODY (3/10)] EVSEPresentVoltage -----
  2414. SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2415. //----- [BODY (4/10)] EVSEPresentCurrent -----
  2416. SHM_Read_dinPhysicalValueType(&out->EVSEPresentCurrent, &in->EVSEPresentCurrent);
  2417. //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
  2418. out->EVSECurrentLimitAchieved = in->EVSECurrentLimitAchieved;
  2419. //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
  2420. out->EVSEVoltageLimitAchieved = in->EVSEVoltageLimitAchieved;
  2421. //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
  2422. out->EVSEPowerLimitAchieved = in->EVSEPowerLimitAchieved;
  2423. //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
  2424. out->EVSEMaximumVoltageLimit_isUsed = 1u;
  2425. SHM_Read_dinPhysicalValueType(&out->EVSEMaximumVoltageLimit, &in->EVSEMaximumVoltageLimit);
  2426. //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
  2427. out->EVSEMaximumCurrentLimit_isUsed = 1u;
  2428. SHM_Read_dinPhysicalValueType(&out->EVSEMaximumCurrentLimit, &in->EVSEMaximumCurrentLimit);
  2429. //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
  2430. out->EVSEMaximumPowerLimit_isUsed = 1u;
  2431. SHM_Read_dinPhysicalValueType(&out->EVSEMaximumPowerLimit, &in->EVSEMaximumPowerLimit);
  2432. }
  2433. /*===========================================================================
  2434. FUNCTION: SHM_Read_iso1_CurrentDemandRes
  2435. DESCRIPTION:
  2436. PRE-CONDITION:
  2437. INPUT:
  2438. 1. shm_ccs
  2439. OUTPUT:
  2440. 2. exi_doc_ISO1
  2441. GLOBAL VARIABLES:
  2442. =============================================================================*/
  2443. void SHM_Read_iso1_CurrentDemandRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2444. {
  2445. struct iso1CurrentDemandResType *out;
  2446. struct CurrentDemandResponse_ISO15118_2014 *in;
  2447. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2448. init_iso1CurrentDemandResType(&exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes);
  2449. out = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes;
  2450. in = &shm_ccs->V2GMessage_ISO15118_2014.CurrentDemandResponse;
  2451. exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
  2452. //vern, fill up necessary
  2453. out->EVSEID.charactersLen=7;
  2454. out->EVSEID.characters[0]='Z';
  2455. out->EVSEID.characters[1]='Z';
  2456. out->EVSEID.characters[2]='0';
  2457. out->EVSEID.characters[3]='0';
  2458. out->EVSEID.characters[4]='0';
  2459. out->EVSEID.characters[5]='0';
  2460. out->EVSEID.characters[6]='0';
  2461. out->SAScheduleTupleID=1;
  2462. out->MeterInfo_isUsed=0u;
  2463. out->ReceiptRequired_isUsed=0u;
  2464. //----- [BODY (1/10)] ResponseCode -----
  2465. out->ResponseCode = (unsigned char) in->ResponseCode;
  2466. //----- [BODY (2/10)] DC_EVSEStatus -----
  2467. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2468. //----- [BODY (3/10)] EVSEPresentVoltage -----
  2469. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2470. //----- [BODY (4/10)] EVSEPresentCurrent -----
  2471. SHM_Read_iso1PhysicalValueType(&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_iso1PhysicalValueType(&out->EVSEMaximumVoltageLimit, &in->EVSEMaximumVoltageLimit);
  2481. //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
  2482. out->EVSEMaximumCurrentLimit_isUsed = 1u;
  2483. SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumCurrentLimit, &in->EVSEMaximumCurrentLimit);
  2484. //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
  2485. out->EVSEMaximumPowerLimit_isUsed = 1u;
  2486. SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumPowerLimit, &in->EVSEMaximumPowerLimit);
  2487. }
  2488. /*===========================================================================
  2489. FUNCTION: SHM_Read_iso1_ChargingStatusRes
  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_ChargingStatusRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2499. {
  2500. int i = 0;
  2501. struct iso1ChargingStatusResType *out;
  2502. struct ChargingStatusResponse_ISO15118_2014 *in;
  2503. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2504. init_iso1ChargingStatusResType(&exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes);
  2505. out = &exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes;
  2506. in = &shm_ccs->V2GMessage_ISO15118_2014.ChargingStatusResponse;
  2507. exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes_isUsed = 1u;
  2508. //----- [BODY (1/10)] ResponseCode -----
  2509. out->ResponseCode = (unsigned char)in->ResponseCode;
  2510. //----- [BODY (2/10)] AC_EVSEStatus -----
  2511. SHM_Read_iso1AC_EVSEStatusType(&out->AC_EVSEStatus, &in->AC_EVSEStatus);
  2512. //----- [BODY (3/10)] EVSEMaxCurrent -----
  2513. out->EVSEMaxCurrent_isUsed = 1u;
  2514. SHM_Read_iso1PhysicalValueType(&out->EVSEMaxCurrent, &in->EVSEMaxCurrent);
  2515. //----- [BODY (4/10)] SAScheduleTupleID -----
  2516. out->SAScheduleTupleID = (unsigned char)in->SAScheduleTupleID; //[CAUTION] data type
  2517. //----- [BODY (5/10)] EVSEID -----
  2518. out->EVSEID.charactersLen = 37; //min length: 7, max length:37 bytes(ISO1, AC)
  2519. for (i = 0; i< out->EVSEID.charactersLen; i++)
  2520. {
  2521. out->EVSEID.characters[i] = (unsigned char)in->EVSEID[i];
  2522. }
  2523. //----- [BODY (6/10)] MeterInfo -----
  2524. out->MeterInfo_isUsed = 1u;
  2525. SHM_Read_iso1MeterInfo(&out->MeterInfo, &in->MeterInfo);
  2526. //----- [BODY (7/10)] ReceiptRequired -----
  2527. out->ReceiptRequired_isUsed = 1u;
  2528. out->ReceiptRequired = (int)in->ReceiptRequired;
  2529. }
  2530. /*===========================================================================
  2531. FUNCTION: SHM_Read_din_WeldingDetectionRes
  2532. DESCRIPTION:
  2533. PRE-CONDITION:
  2534. INPUT:
  2535. 1. shm_ccs
  2536. OUTPUT:
  2537. 2. exi_doc_DIN
  2538. GLOBAL VARIABLES:
  2539. =============================================================================*/
  2540. void SHM_Read_din_WeldingDetectionRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2541. {
  2542. struct dinWeldingDetectionResType *out;
  2543. struct WeldingDetectionResponse_DIN70121 *in;
  2544. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2545. init_dinWeldingDetectionResType(&exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes);
  2546. out = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes;
  2547. in = &shm_ccs->V2GMessage_DIN70121.WeldingDetectionResponse;
  2548. exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
  2549. //----- [BODY (1/3)] ResponseCode -----
  2550. out->ResponseCode = (unsigned char) in->ResponseCode;
  2551. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2552. SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2553. //----- [BODY (3/3)] DC_EVSEStatus -----
  2554. SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2555. }
  2556. /*===========================================================================
  2557. FUNCTION: SHM_Read_iso1_WeldingDetectionRes
  2558. DESCRIPTION:
  2559. PRE-CONDITION:
  2560. INPUT:
  2561. 1. shm_ccs
  2562. OUTPUT:
  2563. 2. exi_doc_ISO1
  2564. GLOBAL VARIABLES:
  2565. =============================================================================*/
  2566. void SHM_Read_iso1_WeldingDetectionRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2567. {
  2568. struct iso1WeldingDetectionResType *out;
  2569. struct WeldingDetectionResponse_ISO15118_2014 *in;
  2570. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2571. init_iso1WeldingDetectionResType(&exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes);
  2572. out = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes;
  2573. in = &shm_ccs->V2GMessage_ISO15118_2014.WeldingDetectionResponse;
  2574. exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
  2575. //----- [BODY (1/3)] ResponseCode -----
  2576. out->ResponseCode = (unsigned char) in->ResponseCode;
  2577. //----- [BODY (2/3)] EVSEPresentVoltage -----
  2578. SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
  2579. //----- [BODY (3/3)] DC_EVSEStatus -----
  2580. SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
  2581. }
  2582. /*===========================================================================
  2583. FUNCTION: SHM_Read_din_SessionStopRes
  2584. DESCRIPTION:
  2585. PRE-CONDITION:
  2586. INPUT:
  2587. 1. shm_ccs
  2588. OUTPUT:
  2589. 2. exi_doc_DIN
  2590. GLOBAL VARIABLES:
  2591. =============================================================================*/
  2592. void SHM_Read_din_SessionStopRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
  2593. {
  2594. struct dinSessionStopResType *out;
  2595. struct SessionStopResponse_DIN70121 *in;
  2596. init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
  2597. init_dinSessionStopResType(&exi_doc_DIN->V2G_Message.Body.SessionStopRes);
  2598. out = &exi_doc_DIN->V2G_Message.Body.SessionStopRes;
  2599. in = &shm_ccs->V2GMessage_DIN70121.SessionStopResponse;
  2600. exi_doc_DIN->V2G_Message.Body.SessionStopRes_isUsed = 1u;
  2601. //----- [BODY (1/3)] ResponseCode -----
  2602. out->ResponseCode = (unsigned char) in->ResponseCode;
  2603. }
  2604. /*===========================================================================
  2605. FUNCTION: SHM_Read_iso1_SessionStopRes
  2606. DESCRIPTION:
  2607. PRE-CONDITION:
  2608. INPUT:
  2609. 1. shm_ccs
  2610. OUTPUT:
  2611. 2. exi_doc_ISO1
  2612. GLOBAL VARIABLES:
  2613. =============================================================================*/
  2614. void SHM_Read_iso1_SessionStopRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
  2615. {
  2616. struct iso1SessionStopResType *out;
  2617. struct SessionStopResponse_ISO15118_2014 *in;
  2618. init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
  2619. init_iso1SessionStopResType(&exi_doc_ISO1->V2G_Message.Body.SessionStopRes);
  2620. out = &exi_doc_ISO1->V2G_Message.Body.SessionStopRes;
  2621. in = &shm_ccs->V2GMessage_ISO15118_2014.SessionStopResponse;
  2622. exi_doc_ISO1->V2G_Message.Body.SessionStopRes_isUsed = 1u;
  2623. //----- [BODY (1/3)] ResponseCode -----
  2624. out->ResponseCode = (unsigned char) in->ResponseCode;
  2625. }
  2626. /*===========================================================================
  2627. FUNCTION: PRINT_V2G_MSG_din_Header
  2628. DESCRIPTION:
  2629. PRE-CONDITION:
  2630. INPUT:
  2631. OUTPUT:
  2632. GLOBAL VARIABLES:
  2633. =============================================================================*/
  2634. void PRINT_V2G_MSG_din_Header(struct dinEXIDocument *exi_doc_DIN)
  2635. {
  2636. int i = 0;
  2637. int leng = 0;
  2638. leng = exi_doc_DIN->V2G_Message.Header.SessionID.bytesLen;
  2639. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
  2640. for (i = 0; i <leng ; i++)
  2641. {
  2642. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Header.SessionID.bytes[i]);
  2643. }
  2644. }
  2645. /*===========================================================================
  2646. FUNCTION: PRINT_V2G_MSG_iso1_Header
  2647. DESCRIPTION:
  2648. PRE-CONDITION:
  2649. INPUT:
  2650. OUTPUT:
  2651. GLOBAL VARIABLES:
  2652. =============================================================================*/
  2653. void PRINT_V2G_MSG_iso1_Header(struct iso1EXIDocument *exi_doc_ISO1)
  2654. {
  2655. int i = 0;
  2656. int leng = 0;
  2657. leng = exi_doc_ISO1->V2G_Message.Header.SessionID.bytesLen;
  2658. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
  2659. for (i = 0; i <leng ; i++)
  2660. {
  2661. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[i]);
  2662. }
  2663. }
  2664. /*===========================================================================
  2665. FUNCTION: PRINT_V2G_MSG_iso1_Header
  2666. DESCRIPTION:
  2667. PRE-CONDITION:
  2668. INPUT:
  2669. OUTPUT:
  2670. GLOBAL VARIABLES:
  2671. =============================================================================*/
  2672. void PRINT_V2G_MSG_iso2_Header(struct iso2EXIDocument *exi_doc_ISO2)
  2673. {
  2674. int i = 0;
  2675. int leng = 0;
  2676. leng = exi_doc_ISO2->V2G_Message.Header.SessionID.bytesLen;
  2677. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
  2678. for (i = 0; i <leng ; i++)
  2679. {
  2680. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[i]);
  2681. }
  2682. }
  2683. /*===========================================================================
  2684. FUNCTION: DEBUG_PRINT_EXI_MSG_supportedAppProtocolReq
  2685. DESCRIPTION:
  2686. PRE-CONDITION:
  2687. INPUT:
  2688. OUTPUT:
  2689. GLOBAL VARIABLES:
  2690. =============================================================================*/
  2691. void PRINT_XML_DOC_supportedAppProtocolReq(struct appHandEXIDocument *exi_doc)
  2692. {
  2693. int i = 0;
  2694. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n EVSE side: List of application handshake protocols of the EV \n");
  2695. for(i = 0; i < exi_doc->supportedAppProtocolReq.AppProtocol.arrayLen; i++)
  2696. {
  2697. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\tProtocol entry #=%d\n",(i+1));
  2698. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tProtocolNamespace=");
  2699. printASCIIString(
  2700. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.characters,
  2701. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.charactersLen
  2702. );
  2703. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tVersion=%d.%d\n",
  2704. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMajor,
  2705. exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMinor);
  2706. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tSchemaID=%d\n", exi_doc->supportedAppProtocolReq.AppProtocol.array[i].SchemaID);
  2707. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tPriority=%d\n", exi_doc->supportedAppProtocolReq.AppProtocol.array[i].Priority);
  2708. }
  2709. }
  2710. /*===========================================================================
  2711. FUNCTION: PRINT_XML_DOC_DIN_SessionSetupReq
  2712. DESCRIPTION:
  2713. PRE-CONDITION:
  2714. INPUT:
  2715. OUTPUT:
  2716. GLOBAL VARIABLES:
  2717. =============================================================================*/
  2718. void PRINT_XML_DOC_DIN_SessionSetupReq(struct dinEXIDocument *exi_doc_DIN)
  2719. {
  2720. int i = 0;
  2721. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
  2722. //===== [Header] SessionID =====
  2723. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  2724. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
  2725. for (i = 0; i < exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
  2726. {
  2727. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
  2728. }
  2729. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
  2730. }
  2731. /*===========================================================================
  2732. FUNCTION: PRINT_XML_DOC_ISO1_SessionSetupReq
  2733. DESCRIPTION:
  2734. PRE-CONDITION:
  2735. INPUT:
  2736. OUTPUT:
  2737. GLOBAL VARIABLES:
  2738. =============================================================================*/
  2739. void PRINT_XML_DOC_ISO1_SessionSetupReq(struct iso1EXIDocument *exi_doc_ISO1)
  2740. {
  2741. int i = 0;
  2742. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
  2743. //===== [Header] SessionID =====
  2744. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  2745. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
  2746. for (i = 0; i < exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
  2747. {
  2748. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
  2749. }
  2750. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
  2751. }
  2752. /*===========================================================================
  2753. FUNCTION: PRINT_XML_DOC_ISO2_SessionSetupReq
  2754. DESCRIPTION:
  2755. PRE-CONDITION:
  2756. INPUT:
  2757. OUTPUT:
  2758. GLOBAL VARIABLES:
  2759. =============================================================================*/
  2760. void PRINT_XML_DOC_ISO2_SessionSetupReq(struct iso2EXIDocument *exi_doc_ISO2)
  2761. {
  2762. int i = 0;
  2763. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
  2764. //===== [Header] SessionID =====
  2765. PRINT_V2G_MSG_iso2_Header(exi_doc_ISO2);
  2766. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
  2767. for (i = 0; i < exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
  2768. {
  2769. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
  2770. }
  2771. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
  2772. }
  2773. /*===========================================================================
  2774. FUNCTION: PRINT_XML_DOC_DIN_ServiceDiscoveryReq
  2775. DESCRIPTION:
  2776. PRE-CONDITION:
  2777. INPUT:
  2778. OUTPUT:
  2779. GLOBAL VARIABLES:
  2780. =============================================================================*/
  2781. void PRINT_XML_DOC_DIN_ServiceDiscoveryReq(struct dinEXIDocument *exi_doc_DIN)
  2782. {
  2783. int i = 0;
  2784. int leng = 0;
  2785. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServiceDiscoveryReq ⨀⨀⨀⨀⨀⬇\n");
  2786. //===== [Header] SessionID =====
  2787. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  2788. //[BODY(1/2)] Service Scope
  2789. leng = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.charactersLen;
  2790. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceScope (%d Bytes, optional) = ", leng);
  2791. for (i = 0; i <leng ; i++)
  2792. {
  2793. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
  2794. }
  2795. //[BODY(2/2)] Service Category
  2796. int cat = 0;
  2797. cat = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
  2798. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceCategory = %d ", cat);
  2799. switch (cat)
  2800. {
  2801. case dinserviceCategoryType_EVCharging: //0
  2802. {
  2803. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(EVCharging)");
  2804. break;
  2805. }
  2806. case dinserviceCategoryType_Internet: //1
  2807. {
  2808. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Internet: not supported)");
  2809. break;
  2810. }
  2811. case dinserviceCategoryType_ContractCertificate: //2
  2812. {
  2813. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ContractCertificate: not supported)");
  2814. break;
  2815. }
  2816. case dinserviceCategoryType_OtherCustom: //3
  2817. {
  2818. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(OtherCustom: not supported)");
  2819. break;
  2820. }
  2821. default:
  2822. {
  2823. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected Service Category: %d)", cat);
  2824. break;
  2825. }
  2826. }
  2827. //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
  2828. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServiceDiscoveryReq ⨂⨂⨂⨂⨂⬆\n\n");
  2829. }
  2830. /*===========================================================================
  2831. FUNCTION: PRINT_XML_DOC_ISO1_ServiceDiscoveryReq
  2832. DESCRIPTION:
  2833. PRE-CONDITION:
  2834. INPUT:
  2835. OUTPUT:
  2836. GLOBAL VARIABLES:
  2837. =============================================================================*/
  2838. void PRINT_XML_DOC_ISO1_ServiceDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1)
  2839. {
  2840. int i = 0;
  2841. int leng = 0;
  2842. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServiceDiscoveryReq ⨀⨀⨀⨀⨀⬇\n");
  2843. //===== [Header] SessionID =====
  2844. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  2845. //[BODY(1/2)] Service Scope
  2846. leng = exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.charactersLen;
  2847. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceScope (%d Bytes, optional) = ", leng);
  2848. for (i = 0; i <leng ; i++)
  2849. {
  2850. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
  2851. }
  2852. //[BODY(2/2)] Service Category
  2853. int cat = 0;
  2854. cat = exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
  2855. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceCategory = %d ", cat);
  2856. switch (cat)
  2857. {
  2858. case iso1serviceCategoryType_EVCharging: //0
  2859. {
  2860. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(EVCharging)");
  2861. break;
  2862. }
  2863. case iso1serviceCategoryType_Internet: //1
  2864. {
  2865. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Internet: not supported)");
  2866. break;
  2867. }
  2868. case iso1serviceCategoryType_ContractCertificate: //2
  2869. {
  2870. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ContractCertificate: not supported)");
  2871. break;
  2872. }
  2873. case iso1serviceCategoryType_OtherCustom: //3
  2874. {
  2875. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(OtherCustom: not supported)");
  2876. break;
  2877. }
  2878. default:
  2879. {
  2880. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected Service Category)");
  2881. break;
  2882. }
  2883. }
  2884. //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
  2885. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServiceDiscoveryReq ⨂⨂⨂⨂⨂⬆\n\n");
  2886. }
  2887. /*===========================================================================
  2888. FUNCTION: PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq
  2889. DESCRIPTION:
  2890. PRE-CONDITION:
  2891. INPUT:
  2892. OUTPUT:
  2893. GLOBAL VARIABLES:
  2894. =============================================================================*/
  2895. void PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq(struct dinEXIDocument *exi_doc_DIN)
  2896. {
  2897. int i = 0;
  2898. int leng = 0;
  2899. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServicePaymentSelectionReq ⨀⨀⨀⨀⨀⬇\n");
  2900. //===== [Header] SessionID =====
  2901. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  2902. //[BODY(1/2)] SelectedPaymentOption
  2903. int opt = 0;
  2904. opt = exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedPaymentOption;
  2905. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedPaymentOption = %d ", opt);
  2906. switch (opt)
  2907. {
  2908. case dinpaymentOptionType_Contract: //0
  2909. {
  2910. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Contract)");
  2911. break;
  2912. }
  2913. case dinpaymentOptionType_ExternalPayment: //1
  2914. {
  2915. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ExternalPayment)");
  2916. break;
  2917. }
  2918. default:
  2919. {
  2920. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected SelectedPaymentOption)\n");
  2921. break;
  2922. }
  2923. }
  2924. //[BODY(2/2)] SelectedServiceList
  2925. leng = exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.arrayLen;
  2926. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedServiceList (%d items) = \n", leng);
  2927. for (i = 0; i< leng; i++)
  2928. {
  2929. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t\t [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
  2930. (i+1),
  2931. exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ServiceID,
  2932. exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID,
  2933. exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID_isUsed);
  2934. }
  2935. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServicePaymentSelectionReq ⨂⨂⨂⨂⨂⬆\n\n");
  2936. }
  2937. /*===========================================================================
  2938. FUNCTION: PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq
  2939. DESCRIPTION:
  2940. PRE-CONDITION:
  2941. INPUT:
  2942. OUTPUT:
  2943. GLOBAL VARIABLES:
  2944. =============================================================================*/
  2945. void PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq(struct iso1EXIDocument *exi_doc_ISO1)
  2946. {
  2947. int i = 0;
  2948. int leng = 0;
  2949. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PaymentServiceSelectionReq ⨀⨀⨀⨀⨀⬇\n");
  2950. //===== [Header] SessionID =====
  2951. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  2952. //[BODY(1/2)] SelectedPaymentOption
  2953. int opt = 0;
  2954. opt = exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedPaymentOption;
  2955. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedPaymentOption = %d ", opt);
  2956. switch (opt)
  2957. {
  2958. case iso1paymentOptionType_Contract: //0
  2959. {
  2960. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Contract)");
  2961. break;
  2962. }
  2963. case iso1paymentOptionType_ExternalPayment: //1
  2964. {
  2965. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ExternalPayment)");
  2966. break;
  2967. }
  2968. default:
  2969. {
  2970. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected SelectedPaymentOption)\n");
  2971. break;
  2972. }
  2973. }
  2974. //[BODY(2/2)] SelectedServiceList
  2975. leng = exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.arrayLen;
  2976. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedServiceList (%d items) = \n", leng);
  2977. for (i = 0; i< leng; i++)
  2978. {
  2979. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t\t [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
  2980. (i+1),
  2981. exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ServiceID,
  2982. exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID,
  2983. exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID_isUsed);
  2984. }
  2985. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PaymentServiceSelectionReq ⨂⨂⨂⨂⨂⬆\n\n");
  2986. }
  2987. /*===========================================================================
  2988. FUNCTION: PRINT_XML_DOC_DIN_ContractAuthenticationReq
  2989. DESCRIPTION:
  2990. PRE-CONDITION:
  2991. INPUT:
  2992. OUTPUT:
  2993. GLOBAL VARIABLES:
  2994. =============================================================================*/
  2995. void PRINT_XML_DOC_DIN_ContractAuthenticationReq(struct dinEXIDocument *exi_doc_DIN)
  2996. {
  2997. int i = 0;
  2998. static int cnt = 0;
  2999. cnt++;
  3000. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ContractAuthenticationReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3001. //===== [Header] SessionID =====
  3002. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3003. //[BODY(1/2)] Id
  3004. //[Joseph, To-Do, not full implemented, yet]
  3005. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t Id_isUsed = %d ",
  3006. exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq.Id_isUsed);
  3007. //[BODY(2/2)] GenChallenge
  3008. //[Joseph, To-Do, not full implemented, yet]
  3009. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t GenChallenge_isUsed = %d ",
  3010. exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq.GenChallenge_isUsed);
  3011. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ContractAuthenticationReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3012. }
  3013. /*===========================================================================
  3014. FUNCTION: PRINT_XML_DOC_ISO1_AuthorizationReq
  3015. DESCRIPTION:
  3016. PRE-CONDITION:
  3017. INPUT:
  3018. OUTPUT:
  3019. GLOBAL VARIABLES:
  3020. =============================================================================*/
  3021. void PRINT_XML_DOC_ISO1_AuthorizationReq(struct iso1EXIDocument *exi_doc_ISO1)
  3022. {
  3023. int i = 0;
  3024. static int cnt = 0;
  3025. cnt++;
  3026. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing AuthorizationReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3027. //===== [Header] SessionID =====
  3028. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3029. //[BODY(1/2)] Id
  3030. //[Joseph, To-Do, not full implemented, yet]
  3031. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t Id_isUsed = %d ",
  3032. exi_doc_ISO1->V2G_Message.Body.AuthorizationReq.Id_isUsed);
  3033. //[BODY(2/2)] GenChallenge
  3034. //[Joseph, To-Do, not full implemented, yet]
  3035. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t GenChallenge_isUsed = %d ",
  3036. exi_doc_ISO1->V2G_Message.Body.AuthorizationReq.GenChallenge_isUsed);
  3037. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing AuthorizationReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3038. }
  3039. /*===========================================================================
  3040. FUNCTION: PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq
  3041. DESCRIPTION:
  3042. PRE-CONDITION:
  3043. INPUT:
  3044. OUTPUT:
  3045. GLOBAL VARIABLES:
  3046. =============================================================================*/
  3047. void PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq(struct dinEXIDocument *exi_doc_DIN)
  3048. {
  3049. int i = 0;
  3050. static int cnt = 0;
  3051. cnt++;
  3052. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargeParameterDiscoveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3053. //===== [Header] SessionID =====
  3054. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3055. //===== [BODY (1/3)] EVRequestedEnergyTransferType =====
  3056. int type = 0;
  3057. type = exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.EVRequestedEnergyTransferType;
  3058. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVRequestedEnergyTransferType = %d ", type);
  3059. switch (type)
  3060. {
  3061. case dinEVRequestedEnergyTransferType_AC_single_phase_core: //0,
  3062. {
  3063. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_single_phase_core)\n");
  3064. break;
  3065. }
  3066. case dinEVRequestedEnergyTransferType_AC_three_phase_core: //1,
  3067. {
  3068. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_three_phase_core)\n");
  3069. break;
  3070. }
  3071. case dinEVRequestedEnergyTransferType_DC_core: //2,
  3072. {
  3073. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_core)\n");
  3074. break;
  3075. }
  3076. case dinEVRequestedEnergyTransferType_DC_extended: //3,
  3077. {
  3078. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_extended)\n"); //expected
  3079. //[Joseph, To-Do]
  3080. //If this parameter is different from previous message,
  3081. //a warning should be noted.
  3082. break;
  3083. }
  3084. case dinEVRequestedEnergyTransferType_DC_combo_core: //4,
  3085. {
  3086. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_combo_core)\n");
  3087. break;
  3088. }
  3089. case dinEVRequestedEnergyTransferType_DC_unique: //5
  3090. {
  3091. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_unique)\n");
  3092. break;
  3093. }
  3094. }
  3095. //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
  3096. //ignored, since DIN doesn't support AC.
  3097. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t AC_EVChargeParameter_isUsed = %d ",
  3098. exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
  3099. //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
  3100. int value = 0;
  3101. struct dinPhysicalValueType *obj;
  3102. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3103. exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
  3104. //DC_EVStatus
  3105. struct dinDC_EVStatusType *status;
  3106. status = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.DC_EVStatus;
  3107. PRINT_dinDC_EVStatusType(status);
  3108. //EVMaximumCurrentLimit
  3109. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumCurrentLimit;
  3110. value = GetValue_dinPhysicalValueType(obj);
  3111. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", value);
  3112. PRINT_dinPhysicalValueType_UNIT(obj);
  3113. //EVMaximumPowerLimit
  3114. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
  3115. value = GetValue_dinPhysicalValueType(obj);
  3116. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", value);
  3117. PRINT_dinPhysicalValueType_UNIT(obj);
  3118. //EVMaximumVoltageLimit
  3119. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
  3120. value = GetValue_dinPhysicalValueType(obj);
  3121. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", value);
  3122. PRINT_dinPhysicalValueType_UNIT(obj);
  3123. //EVEnergyCapacity
  3124. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
  3125. value = GetValue_dinPhysicalValueType(obj);
  3126. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyCapacity = %d (DEC) ", value);
  3127. PRINT_dinPhysicalValueType_UNIT(obj);
  3128. //EVEnergyRequest
  3129. obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
  3130. value = GetValue_dinPhysicalValueType(obj);
  3131. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyRequest = %d (DEC) ", value);
  3132. PRINT_dinPhysicalValueType_UNIT(obj);
  3133. //FullSOC
  3134. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t FullSOC = %d \% (DEC)",
  3135. exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
  3136. //BulkSOC
  3137. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkSOC = %d \% (DEC)",
  3138. exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
  3139. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargeParameterDiscoveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3140. }
  3141. /*===========================================================================
  3142. FUNCTION: PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq
  3143. DESCRIPTION:
  3144. PRE-CONDITION:
  3145. INPUT:
  3146. OUTPUT:
  3147. GLOBAL VARIABLES:
  3148. =============================================================================*/
  3149. void PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1)
  3150. {
  3151. int i = 0;
  3152. static int cnt = 0;
  3153. cnt++;
  3154. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargeParameterDiscoveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3155. //===== [Header] SessionID =====
  3156. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3157. //===== [BODY (1/3)] RequestedEnergyTransferMode =====
  3158. int type = 0;
  3159. type = exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.RequestedEnergyTransferMode;
  3160. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RequestedEnergyTransferMode = %d ", type);
  3161. switch (type)
  3162. {
  3163. case iso1EnergyTransferModeType_AC_single_phase_core: //0,
  3164. {
  3165. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_single_phase_core)\n");
  3166. break;
  3167. }
  3168. case iso1EnergyTransferModeType_AC_three_phase_core: //1,
  3169. {
  3170. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_three_phase_core)\n");
  3171. break;
  3172. }
  3173. case iso1EnergyTransferModeType_DC_core: //2,
  3174. {
  3175. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_core)\n");
  3176. break;
  3177. }
  3178. case iso1EnergyTransferModeType_DC_extended: //3,
  3179. {
  3180. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_extended)\n"); //expected
  3181. //[Joseph, To-Do]
  3182. //If this parameter is different from previous message,
  3183. //a warning should be noted.
  3184. break;
  3185. }
  3186. case iso1EnergyTransferModeType_DC_combo_core: //4,
  3187. {
  3188. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_combo_core)\n");
  3189. break;
  3190. }
  3191. case iso1EnergyTransferModeType_DC_unique: //5
  3192. {
  3193. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_unique)\n");
  3194. break;
  3195. }
  3196. }
  3197. //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
  3198. //ignored, since our ISO1 doesn't support AC.
  3199. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t AC_EVChargeParameter_isUsed = %d ",
  3200. exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
  3201. //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
  3202. int value = 0;
  3203. struct iso1PhysicalValueType *obj;
  3204. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3205. exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
  3206. //DC_EVStatus
  3207. struct iso1DC_EVStatusType *status;
  3208. status = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.DC_EVStatus;
  3209. PRINT_iso1DC_EVStatusType(status);
  3210. //EVMaximumCurrentLimit
  3211. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumCurrentLimit;
  3212. value = GetValue_iso1PhysicalValueType(obj);
  3213. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", value);
  3214. PRINT_iso1PhysicalValueType_UNIT(obj);
  3215. //EVMaximumPowerLimit
  3216. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
  3217. value = GetValue_iso1PhysicalValueType(obj);
  3218. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", value);
  3219. PRINT_iso1PhysicalValueType_UNIT(obj);
  3220. //EVMaximumVoltageLimit
  3221. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
  3222. value = GetValue_iso1PhysicalValueType(obj);
  3223. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", value);
  3224. PRINT_iso1PhysicalValueType_UNIT(obj);
  3225. //EVEnergyCapacity
  3226. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
  3227. value = GetValue_iso1PhysicalValueType(obj);
  3228. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyCapacity = %d (DEC) ", value);
  3229. PRINT_iso1PhysicalValueType_UNIT(obj);
  3230. //EVEnergyRequest
  3231. obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
  3232. value = GetValue_iso1PhysicalValueType(obj);
  3233. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyRequest = %d (DEC) ", value);
  3234. PRINT_iso1PhysicalValueType_UNIT(obj);
  3235. //FullSOC
  3236. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t FullSOC = %d \% (DEC)",
  3237. exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
  3238. //BulkSOC
  3239. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkSOC = %d \% (DEC)",
  3240. exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
  3241. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargeParameterDiscoveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3242. }
  3243. /*===========================================================================
  3244. FUNCTION: PRINT_XML_DOC_DIN_CableCheckReq
  3245. DESCRIPTION:
  3246. PRE-CONDITION:
  3247. INPUT:
  3248. OUTPUT:
  3249. GLOBAL VARIABLES:
  3250. =============================================================================*/
  3251. void PRINT_XML_DOC_DIN_CableCheckReq(struct dinEXIDocument *exi_doc_DIN)
  3252. {
  3253. int i = 0;
  3254. static int cnt = 0;
  3255. cnt++;
  3256. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CableCheckReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3257. //===== [Header] SessionID =====
  3258. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3259. //===== [BODY (1/1)] DC_EVStatus =====
  3260. struct dinDC_EVStatusType *status;
  3261. status = &exi_doc_DIN->V2G_Message.Body.CableCheckReq.DC_EVStatus;
  3262. PRINT_dinDC_EVStatusType(status);
  3263. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CableCheckReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3264. }
  3265. /*===========================================================================
  3266. FUNCTION: PRINT_XML_DOC_ISO1_CableCheckReq
  3267. DESCRIPTION:
  3268. PRE-CONDITION:
  3269. INPUT:
  3270. OUTPUT:
  3271. GLOBAL VARIABLES:
  3272. =============================================================================*/
  3273. void PRINT_XML_DOC_ISO1_CableCheckReq(struct iso1EXIDocument *exi_doc_ISO1)
  3274. {
  3275. int i = 0;
  3276. static int cnt = 0;
  3277. cnt++;
  3278. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CableCheckReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3279. //===== [Header] SessionID =====
  3280. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3281. //===== [BODY (1/1)] DC_EVStatus =====
  3282. struct iso1DC_EVStatusType *status;
  3283. status = &exi_doc_ISO1->V2G_Message.Body.CableCheckReq.DC_EVStatus;
  3284. PRINT_iso1DC_EVStatusType(status);
  3285. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CableCheckReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3286. }
  3287. /*===========================================================================
  3288. FUNCTION: PRINT_XML_DOC_DIN_PreChargeReq
  3289. DESCRIPTION:
  3290. PRE-CONDITION:
  3291. INPUT:
  3292. OUTPUT:
  3293. GLOBAL VARIABLES:
  3294. =============================================================================*/
  3295. void PRINT_XML_DOC_DIN_PreChargeReq(struct dinEXIDocument *exi_doc_DIN)
  3296. {
  3297. int i = 0;
  3298. static int cnt = 0;
  3299. cnt++;
  3300. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PreChargeReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3301. //===== [Header] SessionID =====
  3302. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3303. //===== [BODY (1/3)] DC_EVStatus =====
  3304. struct dinDC_EVStatusType *status;
  3305. status = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.DC_EVStatus;
  3306. PRINT_dinDC_EVStatusType(status);
  3307. //===== [BODY (2/3)] EVTargetVoltage =====
  3308. int value = 0;
  3309. struct dinPhysicalValueType *obj;
  3310. obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
  3311. value = GetValue_dinPhysicalValueType(obj);
  3312. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", value);
  3313. PRINT_dinPhysicalValueType_UNIT(obj);
  3314. //===== [BODY (3/3)] EVTargetCurrent =====
  3315. obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
  3316. value = GetValue_dinPhysicalValueType(obj);
  3317. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", value);
  3318. PRINT_dinPhysicalValueType_UNIT(obj);
  3319. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PreChargeReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3320. }
  3321. /*===========================================================================
  3322. FUNCTION: PRINT_XML_DOC_ISO1_PreChargeReq
  3323. DESCRIPTION:
  3324. PRE-CONDITION:
  3325. INPUT:
  3326. OUTPUT:
  3327. GLOBAL VARIABLES:
  3328. =============================================================================*/
  3329. void PRINT_XML_DOC_ISO1_PreChargeReq(struct iso1EXIDocument *exi_doc_ISO1)
  3330. {
  3331. int i = 0;
  3332. static int cnt = 0;
  3333. cnt++;
  3334. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PreChargeReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3335. //===== [Header] SessionID =====
  3336. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3337. //===== [BODY (1/3)] DC_EVStatus =====
  3338. struct iso1DC_EVStatusType *status;
  3339. status = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.DC_EVStatus;
  3340. PRINT_iso1DC_EVStatusType(status);
  3341. //===== [BODY (2/3)] EVTargetVoltage =====
  3342. int value = 0;
  3343. struct iso1PhysicalValueType *obj;
  3344. obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
  3345. value = GetValue_iso1PhysicalValueType(obj);
  3346. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", value);
  3347. PRINT_iso1PhysicalValueType_UNIT(obj);
  3348. //===== [BODY (3/3)] EVTargetCurrent =====
  3349. obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
  3350. value = GetValue_iso1PhysicalValueType(obj);
  3351. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", value);
  3352. PRINT_iso1PhysicalValueType_UNIT(obj);
  3353. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PreChargeReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3354. }
  3355. /*===========================================================================
  3356. FUNCTION: PRINT_XML_DOC_DIN_PowerDeliveryReq
  3357. DESCRIPTION:
  3358. PRE-CONDITION:
  3359. INPUT:
  3360. OUTPUT:
  3361. GLOBAL VARIABLES:
  3362. =============================================================================*/
  3363. void PRINT_XML_DOC_DIN_PowerDeliveryReq(struct dinEXIDocument *exi_doc_DIN)
  3364. {
  3365. int i = 0;
  3366. static int cnt = 0;
  3367. cnt++;
  3368. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PowerDeliveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3369. //===== [Header] SessionID =====
  3370. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3371. //===== [BODY (1/3)] ReadyToChargeState =====
  3372. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ReadyToChargeState = %d (DEC)",
  3373. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ReadyToChargeState);
  3374. //===== [BODY (2/3)] ChargingProfile =====
  3375. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingProfile_isUsed = %d (DEC)",
  3376. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
  3377. //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
  3378. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVPowerDeliveryParameter_isUsed = %d (DEC)",
  3379. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
  3380. //DC_EVStatus
  3381. struct dinDC_EVStatusType *status;
  3382. status = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.DC_EVStatus;
  3383. PRINT_dinDC_EVStatusType(status);
  3384. //BulkChargingComplete
  3385. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d (DEC)",
  3386. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
  3387. //BulkChargingComplete_isUsed
  3388. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d (DEC)",
  3389. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
  3390. //ChargingComplete
  3391. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d (DEC)",
  3392. exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
  3393. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PowerDeliveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3394. }
  3395. /*===========================================================================
  3396. FUNCTION: PRINT_XML_DOC_ISO1_PowerDeliveryReq
  3397. DESCRIPTION:
  3398. PRE-CONDITION:
  3399. INPUT:
  3400. OUTPUT:
  3401. GLOBAL VARIABLES:
  3402. =============================================================================*/
  3403. void PRINT_XML_DOC_ISO1_PowerDeliveryReq(struct iso1EXIDocument *exi_doc_ISO1)
  3404. {
  3405. int i = 0;
  3406. static int cnt = 0;
  3407. cnt++;
  3408. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PowerDeliveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3409. //===== [Header] SessionID =====
  3410. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3411. //===== [BODY (1/3)] ChargeProgress =====
  3412. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargeProgress = %d (DEC, 0:start, 1:stop, 2:renegotiate)",
  3413. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.ChargeProgress);
  3414. //iso1chargeProgressType_Start = 0,
  3415. //iso1chargeProgressType_Stop = 1,
  3416. //iso1chargeProgressType_Renegotiate = 2
  3417. //===== [BODY (2/3)] ChargingProfile =====
  3418. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingProfile_isUsed = %d (DEC)",
  3419. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
  3420. //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
  3421. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVPowerDeliveryParameter_isUsed = %d (DEC)",
  3422. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
  3423. //DC_EVStatus
  3424. struct iso1DC_EVStatusType *status;
  3425. status = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.DC_EVStatus;
  3426. PRINT_iso1DC_EVStatusType(status);
  3427. //BulkChargingComplete
  3428. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d (DEC)",
  3429. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
  3430. //BulkChargingComplete_isUsed
  3431. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d (DEC)",
  3432. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
  3433. //ChargingComplete
  3434. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d (DEC)",
  3435. exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
  3436. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PowerDeliveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3437. }
  3438. /*===========================================================================
  3439. FUNCTION: PRINT_XML_DOC_DIN_CurrentDemandReq
  3440. DESCRIPTION:
  3441. PRE-CONDITION:
  3442. INPUT:
  3443. OUTPUT:
  3444. GLOBAL VARIABLES:
  3445. =============================================================================*/
  3446. void PRINT_XML_DOC_DIN_CurrentDemandReq(struct dinEXIDocument *exi_doc_DIN)
  3447. {
  3448. int i = 0;
  3449. static int cnt = 0;
  3450. cnt++;
  3451. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CurrentDemandReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3452. //===== [Header] SessionID =====
  3453. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3454. //===== [BODY (1/10)] DC_EVStatus =====
  3455. struct dinDC_EVStatusType *status;
  3456. status = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.DC_EVStatus;
  3457. PRINT_dinDC_EVStatusType(status);
  3458. //===== [BODY (2/10)] EVTargetCurrent =====
  3459. int value = 0;
  3460. struct dinPhysicalValueType *obj;
  3461. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
  3462. value = GetValue_dinPhysicalValueType(obj);
  3463. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", value);
  3464. PRINT_dinPhysicalValueType_UNIT(obj);
  3465. //===== [BODY (3/10)] EVMaximumVoltageLimit =====
  3466. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3467. exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
  3468. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
  3469. value = GetValue_dinPhysicalValueType(obj);
  3470. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", value);
  3471. PRINT_dinPhysicalValueType_UNIT(obj);
  3472. //===== [BODY (4/10)] EVMaximumCurrentLimit =====
  3473. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3474. exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
  3475. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
  3476. value = GetValue_dinPhysicalValueType(obj);
  3477. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", value);
  3478. PRINT_dinPhysicalValueType_UNIT(obj);
  3479. //===== [BODY (5/10)] EVMaximumPowerLimit =====
  3480. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3481. exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
  3482. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
  3483. value = GetValue_dinPhysicalValueType(obj);
  3484. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", value);
  3485. PRINT_dinPhysicalValueType_UNIT(obj);
  3486. //===== [BODY (6/10)] BulkChargingComplete =====
  3487. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d \n",
  3488. exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
  3489. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d \n",
  3490. exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
  3491. //===== [BODY (7/10)] ChargingComplete =====
  3492. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d \n",
  3493. exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
  3494. //===== [BODY (8/10)] RemainingTimeToFullSoC =====
  3495. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3496. exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
  3497. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
  3498. value = GetValue_dinPhysicalValueType(obj);
  3499. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToFullSoC = %d (DEC) ", value);
  3500. PRINT_dinPhysicalValueType_UNIT(obj);
  3501. //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
  3502. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3503. exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
  3504. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
  3505. value = GetValue_dinPhysicalValueType(obj);
  3506. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToBulkSoC = %d (DEC) ", value);
  3507. PRINT_dinPhysicalValueType_UNIT(obj);
  3508. //===== [BODY (10/10)] EVTargetVoltage =====
  3509. obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
  3510. value = GetValue_dinPhysicalValueType(obj);
  3511. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", value);
  3512. PRINT_dinPhysicalValueType_UNIT(obj);
  3513. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CurrentDemandReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3514. }
  3515. /*===========================================================================
  3516. FUNCTION: PRINT_XML_DOC_ISO1_CurrentDemandReq
  3517. DESCRIPTION:
  3518. PRE-CONDITION:
  3519. INPUT:
  3520. OUTPUT:
  3521. GLOBAL VARIABLES:
  3522. =============================================================================*/
  3523. void PRINT_XML_DOC_ISO1_CurrentDemandReq(struct iso1EXIDocument *exi_doc_ISO1)
  3524. {
  3525. int i = 0;
  3526. static int cnt = 0;
  3527. cnt++;
  3528. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CurrentDemandReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3529. //===== [Header] SessionID =====
  3530. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3531. //===== [BODY (1/10)] DC_EVStatus =====
  3532. struct iso1DC_EVStatusType *status;
  3533. status = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.DC_EVStatus;
  3534. PRINT_iso1DC_EVStatusType(status);
  3535. //===== [BODY (2/10)] EVTargetCurrent =====
  3536. int value = 0;
  3537. struct iso1PhysicalValueType *obj;
  3538. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
  3539. value = GetValue_iso1PhysicalValueType(obj);
  3540. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", value);
  3541. PRINT_iso1PhysicalValueType_UNIT(obj);
  3542. //===== [BODY (3/10)] EVMaximumVoltageLimit =====
  3543. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3544. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
  3545. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
  3546. value = GetValue_iso1PhysicalValueType(obj);
  3547. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", value);
  3548. PRINT_iso1PhysicalValueType_UNIT(obj);
  3549. //===== [BODY (4/10)] EVMaximumCurrentLimit =====
  3550. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3551. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
  3552. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
  3553. value = GetValue_iso1PhysicalValueType(obj);
  3554. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", value);
  3555. PRINT_iso1PhysicalValueType_UNIT(obj);
  3556. //===== [BODY (5/10)] EVMaximumPowerLimit =====
  3557. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3558. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
  3559. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
  3560. value = GetValue_iso1PhysicalValueType(obj);
  3561. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", value);
  3562. PRINT_iso1PhysicalValueType_UNIT(obj);
  3563. //===== [BODY (6/10)] BulkChargingComplete =====
  3564. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d \n",
  3565. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
  3566. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d \n",
  3567. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
  3568. //===== [BODY (7/10)] ChargingComplete =====
  3569. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d \n",
  3570. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
  3571. //===== [BODY (8/10)] RemainingTimeToFullSoC =====
  3572. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3573. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
  3574. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
  3575. value = GetValue_iso1PhysicalValueType(obj);
  3576. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToFullSoC = %d (DEC) ", value);
  3577. PRINT_iso1PhysicalValueType_UNIT(obj);
  3578. //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
  3579. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
  3580. exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
  3581. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
  3582. value = GetValue_iso1PhysicalValueType(obj);
  3583. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToBulkSoC = %d (DEC) ", value);
  3584. PRINT_iso1PhysicalValueType_UNIT(obj);
  3585. //===== [BODY (10/10)] EVTargetVoltage =====
  3586. obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
  3587. value = GetValue_iso1PhysicalValueType(obj);
  3588. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", value);
  3589. PRINT_iso1PhysicalValueType_UNIT(obj);
  3590. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CurrentDemandReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3591. }
  3592. /*===========================================================================
  3593. FUNCTION: PRINT_XML_DOC_ISO1_ChargingStatusReq
  3594. DESCRIPTION:
  3595. PRE-CONDITION:
  3596. INPUT:
  3597. OUTPUT:
  3598. GLOBAL VARIABLES:
  3599. =============================================================================*/
  3600. void PRINT_XML_DOC_ISO1_ChargingStatusReq(struct iso1EXIDocument *exi_doc_ISO1)
  3601. {
  3602. static int cnt = 0;
  3603. cnt++;
  3604. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargingStatusReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3605. //===== [Header] SessionID =====
  3606. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3607. //===== [BODY (0/0)] =====
  3608. //ISO1: no content
  3609. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t no content (ISO1)");
  3610. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargingStatusReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3611. }
  3612. /*===========================================================================
  3613. FUNCTION: PRINT_XML_DOC_DIN_WeldingDetectionReq
  3614. DESCRIPTION:
  3615. PRE-CONDITION:
  3616. INPUT:
  3617. OUTPUT:
  3618. GLOBAL VARIABLES:
  3619. =============================================================================*/
  3620. void PRINT_XML_DOC_DIN_WeldingDetectionReq(struct dinEXIDocument *exi_doc_DIN)
  3621. {
  3622. int i = 0;
  3623. static int cnt = 0;
  3624. cnt++;
  3625. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing WeldingDetectionReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3626. //===== [Header] SessionID =====
  3627. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3628. //===== [BODY (1/3)] DC_EVStatus =====
  3629. struct dinDC_EVStatusType *status;
  3630. status = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq.DC_EVStatus;
  3631. PRINT_dinDC_EVStatusType(status);
  3632. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing WeldingDetectionReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3633. }
  3634. /*===========================================================================
  3635. FUNCTION: PRINT_XML_DOC_ISO1_WeldingDetectionReq
  3636. DESCRIPTION:
  3637. PRE-CONDITION:
  3638. INPUT:
  3639. OUTPUT:
  3640. GLOBAL VARIABLES:
  3641. =============================================================================*/
  3642. void PRINT_XML_DOC_ISO1_WeldingDetectionReq(struct iso1EXIDocument *exi_doc_ISO1)
  3643. {
  3644. int i = 0;
  3645. static int cnt = 0;
  3646. cnt++;
  3647. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing WeldingDetectionReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3648. //===== [Header] SessionID =====
  3649. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3650. //===== [BODY (1/3)] DC_EVStatus =====
  3651. struct iso1DC_EVStatusType *status;
  3652. status = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq.DC_EVStatus;
  3653. PRINT_iso1DC_EVStatusType(status);
  3654. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing WeldingDetectionReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3655. }
  3656. /*===========================================================================
  3657. FUNCTION: PRINT_XML_DOC_DIN_SessionStopReq
  3658. DESCRIPTION:
  3659. PRE-CONDITION:
  3660. INPUT:
  3661. OUTPUT:
  3662. GLOBAL VARIABLES:
  3663. =============================================================================*/
  3664. void PRINT_XML_DOC_DIN_SessionStopReq(struct dinEXIDocument *exi_doc_DIN)
  3665. {
  3666. int i = 0;
  3667. static int cnt = 0;
  3668. cnt++;
  3669. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionStopReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3670. //===== [Header] SessionID =====
  3671. PRINT_V2G_MSG_din_Header(exi_doc_DIN);
  3672. //===== [BODY (0/0)] noContent =====
  3673. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionStopReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3674. }
  3675. /*===========================================================================
  3676. FUNCTION: PRINT_XML_DOC_ISO1_SessionStopReq
  3677. DESCRIPTION:
  3678. PRE-CONDITION:
  3679. INPUT:
  3680. OUTPUT:
  3681. GLOBAL VARIABLES:
  3682. =============================================================================*/
  3683. void PRINT_XML_DOC_ISO1_SessionStopReq(struct iso1EXIDocument *exi_doc_ISO1)
  3684. {
  3685. int i = 0;
  3686. static int cnt = 0;
  3687. cnt++;
  3688. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionStopReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
  3689. //===== [Header] SessionID =====
  3690. PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
  3691. //===== [BODY (0/0)] noContent =====
  3692. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionStopReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
  3693. }
  3694. /*===========================================================================
  3695. FUNCTION: PRINT_V2GTP_STREAM
  3696. DESCRIPTION:
  3697. PRE-CONDITION:
  3698. INPUT:
  3699. OUTPUT:
  3700. GLOBAL VARIABLES:
  3701. =============================================================================*/
  3702. void PRINT_V2GTP_STREAM(bitstream_t *stream)
  3703. {
  3704. #if (DEBUG_PRINTF_EXI_ENGINE_DETAIL_SHOW == ENABLE)
  3705. int i = 0;
  3706. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- Got a new V2GTP Message -----\n\n");
  3707. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t SIZE: %d (Bytes, DEC)\n", (int)stream->size);
  3708. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t HEADER (HEX): ");
  3709. for (i = 0; i < stream->size; i++)
  3710. {
  3711. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", stream->data[i]);
  3712. if (i == (V2GTP_HEADER_LENGTH - 1))
  3713. {
  3714. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t EXI (HEX): ");
  3715. }
  3716. }
  3717. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n");
  3718. #endif
  3719. }
  3720. /*===========================================================================
  3721. FUNCTION: API_V2GMSG_EXI_Decoder_AppProtocol
  3722. DESCRIPTION:
  3723. PRE-CONDITION:
  3724. 1. #define EXI_STREAM BYTE_ARRAY
  3725. INPUT:
  3726. 1. V2GTP_msg
  3727. 2. V2GTP_msg_length
  3728. OUTPUT:
  3729. 1. ccs_handshake //Share Memory
  3730. 2. V2gFlowStatus //Status Flag
  3731. GLOBAL VARIABLES:
  3732. 1. iStream
  3733. 2. exiDoc
  3734. =============================================================================*/
  3735. int API_V2GMSG_EXI_Decoder_AppProtocol(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct appHandEXIDocument *exiDoc_handshake)
  3736. {
  3737. int errn = 0;
  3738. size_t pos = 0;
  3739. uint32_t payloadLengthDec = 0;
  3740. //Initialize iStream
  3741. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3742. iStream.pos = &pos;
  3743. iStream.data = V2GTP_msg;
  3744. //Initialize exiDoc
  3745. init_appHandEXIDocument(exiDoc_handshake);
  3746. //Print the original EXI message
  3747. PRINT_V2GTP_STREAM(&iStream);
  3748. //STEP 1: Parsing Header
  3749. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3750. //TC_SECC_VTB_V2GTPSessionSetup_004
  3751. if (payloadLengthDec == 0)
  3752. {
  3753. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_AppProtocol]payloadLengthDec = 0\n");
  3754. errn = -1;
  3755. }
  3756. if (errn == 0)
  3757. {
  3758. //STEP 2: Parsing Payload EXI Message
  3759. *iStream.pos = V2GTP_HEADER_LENGTH;
  3760. errn = decode_appHandExiDocument(&iStream, exiDoc_handshake);
  3761. if(errn == 0)
  3762. {
  3763. //Print the decoded XML Document
  3764. PRINT_XML_DOC_supportedAppProtocolReq(exiDoc_handshake);
  3765. //errn = SupportedAppProtocolRequest; //17 (define.h)
  3766. }
  3767. else
  3768. {
  3769. /* an error occured */
  3770. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_AppProtocol]decode_appHandExiDocument()\n");
  3771. errn = -1;
  3772. }
  3773. }
  3774. return errn;
  3775. }
  3776. int API_V2GMSG_EXI_Encoder_AppProtocol(struct appHandEXIDocument *exi_doc, bitstream_t *exi_packet)
  3777. {
  3778. int i = 0;
  3779. int errn = 0;
  3780. size_t pos = 0;
  3781. exi_packet->pos = &pos;
  3782. //*exi_packet->pos = 0;
  3783. exi_packet->size = V2GTP_MSG_TX_BUFFER_SIZE; //(64*1024) //65,536 = 65.5KB
  3784. exi_packet->data = V2GTP_Tx_buf;
  3785. *exi_packet->pos = V2GTP_HEADER_LENGTH;
  3786. if( (errn = encode_appHandExiDocument(exi_packet, exi_doc)) == 0)
  3787. {
  3788. errn = write_v2gtpHeader(exi_packet->data, (*exi_packet->pos) - V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
  3789. //*exi_packet.pos = total length of the encoded V2GMSG.
  3790. //V2GTP_HEADER_LENGTH = 8 Bytes
  3791. }
  3792. exi_packet->size = *exi_packet->pos; //total length of the encoded V2GMSG.
  3793. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- supportedAppProtocolRes [START] -----\n\n");
  3794. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t SIZE: %d (Bytes, DEC)\n", (int)exi_packet->size);
  3795. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t HEADER (HEX): ");
  3796. for (i = 0; i < (int)exi_packet->size; i++)
  3797. {
  3798. DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_packet->data[i]);
  3799. if (i == (V2GTP_HEADER_LENGTH - 1)) DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t EXI (HEX): ");
  3800. }
  3801. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- supportedAppProtocolRes [END] -----\n\n");
  3802. return errn;
  3803. }
  3804. /*===========================================================================
  3805. FUNCTION: API_V2GMSG_EXI_Decoder_DIN
  3806. DESCRIPTION:
  3807. PRE-CONDITION:
  3808. INPUT:
  3809. OUTPUT:
  3810. GLOBAL VARIABLES:
  3811. =============================================================================*/
  3812. int API_V2GMSG_EXI_Decoder_DIN(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct dinEXIDocument *exi_doc_DIN)
  3813. {
  3814. DEBUG_PRINTF_EXI_ENGINE_DETAIL("API_V2GMSG_EXI_Decoder_DIN(): Entered!\n");
  3815. int errn = 0;
  3816. size_t pos = 0;
  3817. uint32_t payloadLengthDec = 0;
  3818. //Initialize iStream
  3819. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3820. iStream.pos = &pos;
  3821. iStream.data = V2GTP_msg;
  3822. iStream.buffer = 0;
  3823. iStream.capacity = 0;
  3824. //Print the original EXI message
  3825. PRINT_V2GTP_STREAM(&iStream);
  3826. //STEP 1: Parsing Header
  3827. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3828. //TC_SECC_VTB_V2GTPSessionSetup_004
  3829. if (payloadLengthDec == 0)
  3830. {
  3831. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][Error][API_V2GMSG_EXI_Decoder_DIN]payloadLengthDec = 0\n");
  3832. errn = -1;
  3833. }
  3834. if (errn == 0)
  3835. {
  3836. //STEP 2: Parsing Payload EXI Message
  3837. *iStream.pos = V2GTP_HEADER_LENGTH;
  3838. errn = decode_dinExiDocument(&iStream, exi_doc_DIN);
  3839. //The "eventcode" inside this function could present which kind of message it is.
  3840. if (errn == 0)
  3841. {
  3842. // successfully received and parsed.
  3843. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_DIN] decode_dinExiDocument: %d (DEC) => OK!\n", errn);
  3844. errn = Check_V2G_Rx_Msg_Name_din(exi_doc_DIN);
  3845. if (errn < 0)
  3846. {
  3847. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
  3848. }
  3849. }
  3850. else
  3851. {
  3852. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_DIN] decode_dinExiDocument: %d (DEC)\n", errn);
  3853. errn = -1;
  3854. }
  3855. }
  3856. else
  3857. {
  3858. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_DIN] read_v2gtpHeader: %d (DEC)\n", errn);
  3859. }
  3860. return errn;
  3861. }
  3862. /*===========================================================================
  3863. FUNCTION: API_V2GMSG_EXI_Decoder_ISO1
  3864. DESCRIPTION:
  3865. PRE-CONDITION:
  3866. INPUT:
  3867. OUTPUT:
  3868. GLOBAL VARIABLES:
  3869. =============================================================================*/
  3870. int API_V2GMSG_EXI_Decoder_ISO1(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso1EXIDocument *exi_doc_ISO1)
  3871. {
  3872. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[API_V2GMSG_EXI_Decoder_ISO1] Entered!\n");
  3873. int errn = 0;
  3874. size_t pos = 0;
  3875. uint32_t payloadLengthDec = 0;
  3876. //Initialize iStream
  3877. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3878. iStream.pos = &pos;
  3879. iStream.data = V2GTP_msg;
  3880. iStream.buffer = 0;
  3881. iStream.capacity = 0;
  3882. //Print the original EXI message
  3883. PRINT_V2GTP_STREAM(&iStream);
  3884. //STEP 1: Parsing Header
  3885. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3886. //TC_SECC_VTB_V2GTPSessionSetup_004
  3887. if (payloadLengthDec == 0)
  3888. {
  3889. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO1]payloadLengthDec = 0");
  3890. errn = -1;
  3891. }
  3892. if (errn == 0)
  3893. {
  3894. //STEP 2: Parsing Payload EXI Message
  3895. *iStream.pos = V2GTP_HEADER_LENGTH;
  3896. errn = decode_iso1ExiDocument(&iStream, exi_doc_ISO1);
  3897. //The "eventcode" inside this function could present which kind of message it is.
  3898. if (errn == 0)
  3899. {
  3900. // successfully received and parsed.
  3901. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO1] decode_iso1ExiDocument: %d (DEC) => OK!\n", errn);
  3902. errn = Check_V2G_Rx_Msg_Name_iso1(exi_doc_ISO1);
  3903. if (errn < 0)
  3904. {
  3905. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
  3906. }
  3907. }
  3908. else
  3909. {
  3910. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO1] decode_iso1ExiDocument: %d (DEC)\n", errn);
  3911. errn = -1;
  3912. }
  3913. }
  3914. else
  3915. {
  3916. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO1] read_v2gtpHeader: %d (DEC)\n", errn);
  3917. }
  3918. return errn;
  3919. }
  3920. /*===========================================================================
  3921. FUNCTION: API_V2GMSG_EXI_Decoder_ISO2
  3922. DESCRIPTION:
  3923. PRE-CONDITION:
  3924. INPUT:
  3925. OUTPUT:
  3926. GLOBAL VARIABLES:
  3927. =============================================================================*/
  3928. int API_V2GMSG_EXI_Decoder_ISO2(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso2EXIDocument *exi_doc_ISO2)
  3929. {
  3930. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[API_V2GMSG_EXI_Decoder_ISO2] Entered!\n");
  3931. int errn = 0;
  3932. size_t pos = 0;
  3933. uint32_t payloadLengthDec = 0;
  3934. //Initialize iStream
  3935. iStream.size = V2GTP_msg_length; //V2GTP_MSG_RX_BUFFER_SIZE; //64*1024 = 65,536
  3936. iStream.pos = &pos;
  3937. iStream.data = V2GTP_msg;
  3938. iStream.buffer = 0;
  3939. iStream.capacity = 0;
  3940. //Print the original EXI message
  3941. PRINT_V2GTP_STREAM(&iStream);
  3942. //STEP 1: Parsing Header
  3943. errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
  3944. //TC_SECC_VTB_V2GTPSessionSetup_004
  3945. if (payloadLengthDec == 0)
  3946. {
  3947. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO2]payloadLengthDec = 0\n");
  3948. errn = -1;
  3949. }
  3950. if (errn == 0)
  3951. {
  3952. //STEP 2: Parsing Payload EXI Message
  3953. *iStream.pos = V2GTP_HEADER_LENGTH;
  3954. errn = decode_iso2ExiDocument(&iStream, exi_doc_ISO2);
  3955. //The "eventcode" inside this function could present which kind of message it is.
  3956. if (errn == 0)
  3957. {
  3958. // successfully received and parsed.
  3959. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO2] decode_iso2ExiDocument: %d (DEC) => OK!\n", errn);
  3960. errn = Check_V2G_Rx_Msg_Name_iso2(exi_doc_ISO2);
  3961. if (errn < 0)
  3962. {
  3963. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
  3964. }
  3965. }
  3966. else
  3967. {
  3968. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO2] decode_iso2ExiDocument: %d (DEC)\n", errn);
  3969. }
  3970. }
  3971. else
  3972. {
  3973. DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO2] read_v2gtpHeader: %d (DEC)\n", errn);
  3974. }
  3975. return errn;
  3976. }
  3977. /*===========================================================================
  3978. FUNCTION: PRINT_dinPhysicalValueType_UNIT
  3979. DESCRIPTION:
  3980. PRE-CONDITION:
  3981. INPUT:
  3982. OUTPUT:
  3983. GLOBAL VARIABLES:
  3984. =============================================================================*/
  3985. void PRINT_dinPhysicalValueType_UNIT(struct dinPhysicalValueType *obj)
  3986. {
  3987. if (obj->Unit_isUsed == TRUE)
  3988. {
  3989. switch (obj->Unit)
  3990. {
  3991. case dinunitSymbolType_h: // = 0,
  3992. {
  3993. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: h)");
  3994. break;
  3995. }
  3996. case dinunitSymbolType_m: // = 1,
  3997. {
  3998. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: m)");
  3999. break;
  4000. }
  4001. case dinunitSymbolType_s: // = 2,
  4002. {
  4003. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: s)");
  4004. break;
  4005. }
  4006. case dinunitSymbolType_A: // = 3,
  4007. {
  4008. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: A)");
  4009. break;
  4010. }
  4011. case dinunitSymbolType_Ah: // = 4,
  4012. {
  4013. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Ah)");
  4014. break;
  4015. }
  4016. case dinunitSymbolType_V: // = 5,
  4017. {
  4018. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: V)");
  4019. break;
  4020. }
  4021. case dinunitSymbolType_VA: // = 6,
  4022. {
  4023. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: VA)");
  4024. break;
  4025. }
  4026. case dinunitSymbolType_W: // = 7,
  4027. {
  4028. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W)");
  4029. break;
  4030. }
  4031. case dinunitSymbolType_W_s: // = 8,
  4032. {
  4033. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W_s)");
  4034. break;
  4035. }
  4036. case dinunitSymbolType_Wh: // = 9
  4037. {
  4038. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Wh)");
  4039. break;
  4040. }
  4041. default:
  4042. {
  4043. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] unit: unexpected dinPhysicalValueType unit)");
  4044. break;
  4045. }
  4046. }
  4047. }
  4048. else
  4049. {
  4050. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: null)");
  4051. }
  4052. }
  4053. /*===========================================================================
  4054. FUNCTION: PRINT_iso1PhysicalValueType_UNIT
  4055. DESCRIPTION:
  4056. PRE-CONDITION:
  4057. INPUT:
  4058. OUTPUT:
  4059. GLOBAL VARIABLES:
  4060. =============================================================================*/
  4061. void PRINT_iso1PhysicalValueType_UNIT(struct iso1PhysicalValueType *obj)
  4062. {
  4063. switch (obj->Unit)
  4064. {
  4065. case iso1unitSymbolType_h: // = 0,
  4066. {
  4067. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: h)");
  4068. break;
  4069. }
  4070. case iso1unitSymbolType_m: // = 1,
  4071. {
  4072. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: m)");
  4073. break;
  4074. }
  4075. case iso1unitSymbolType_s: // = 2,
  4076. {
  4077. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: s)");
  4078. break;
  4079. }
  4080. case iso1unitSymbolType_A: // = 3,
  4081. {
  4082. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: A)");
  4083. break;
  4084. }
  4085. case iso1unitSymbolType_V: // = 4,
  4086. {
  4087. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: V)");
  4088. break;
  4089. }
  4090. case iso1unitSymbolType_W: // = 5,
  4091. {
  4092. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W)");
  4093. break;
  4094. }
  4095. case iso1unitSymbolType_Wh: // = 6
  4096. {
  4097. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Wh)");
  4098. break;
  4099. }
  4100. default:
  4101. {
  4102. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] unit: unexpected iso1PhysicalValueType unit)");
  4103. break;
  4104. }
  4105. }
  4106. }
  4107. /*===========================================================================
  4108. FUNCTION: GetValue_dinPhysicalValueType
  4109. DESCRIPTION:
  4110. PRE-CONDITION:
  4111. INPUT:
  4112. OUTPUT:
  4113. GLOBAL VARIABLES:
  4114. =============================================================================*/
  4115. int GetValue_dinPhysicalValueType(struct dinPhysicalValueType *obj)
  4116. {
  4117. int result;
  4118. result = (obj->Value) * pow(10, obj->Multiplier);
  4119. return result;
  4120. }
  4121. /*===========================================================================
  4122. FUNCTION: GetValue_iso1PhysicalValueType
  4123. DESCRIPTION:
  4124. PRE-CONDITION:
  4125. INPUT:
  4126. OUTPUT:
  4127. GLOBAL VARIABLES:
  4128. =============================================================================*/
  4129. int GetValue_iso1PhysicalValueType(struct iso1PhysicalValueType *obj)
  4130. {
  4131. int result;
  4132. result = (obj->Value) * pow(10, obj->Multiplier);
  4133. return result;
  4134. }
  4135. /*===========================================================================
  4136. FUNCTION: PRINT_dinDC_EVErrorCodeType
  4137. DESCRIPTION:
  4138. PRE-CONDITION:
  4139. INPUT:
  4140. OUTPUT:
  4141. GLOBAL VARIABLES:
  4142. =============================================================================*/
  4143. void PRINT_dinDC_EVErrorCodeType(struct dinDC_EVStatusType *status)
  4144. {
  4145. switch (status->EVErrorCode)
  4146. {
  4147. case dinDC_EVErrorCodeType_NO_ERROR: // = 0,
  4148. {
  4149. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NO_ERROR)");
  4150. break;
  4151. }
  4152. case dinDC_EVErrorCodeType_FAILED_RESSTemperatureInhibit: // = 1,
  4153. {
  4154. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)");
  4155. break;
  4156. }
  4157. case dinDC_EVErrorCodeType_FAILED_EVShiftPosition: // = 2,
  4158. {
  4159. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)");
  4160. break;
  4161. }
  4162. case dinDC_EVErrorCodeType_FAILED_ChargerConnectorLockFault: // = 3,
  4163. {
  4164. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)");
  4165. break;
  4166. }
  4167. case dinDC_EVErrorCodeType_FAILED_EVRESSMalfunction: // = 4,
  4168. {
  4169. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)");
  4170. break;
  4171. }
  4172. case dinDC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
  4173. {
  4174. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)");
  4175. break;
  4176. }
  4177. case dinDC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange: // = 6,
  4178. {
  4179. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)");
  4180. break;
  4181. }
  4182. case dinDC_EVErrorCodeType_Reserved_A: // = 7,
  4183. {
  4184. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)");
  4185. break;
  4186. }
  4187. case dinDC_EVErrorCodeType_Reserved_B: // = 8,
  4188. {
  4189. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)");
  4190. break;
  4191. }
  4192. case dinDC_EVErrorCodeType_Reserved_C: // = 9,
  4193. {
  4194. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)");
  4195. break;
  4196. }
  4197. case dinDC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
  4198. {
  4199. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)");
  4200. break;
  4201. }
  4202. case dinDC_EVErrorCodeType_NoData: // = 11
  4203. {
  4204. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)");
  4205. break;
  4206. }
  4207. default:
  4208. {
  4209. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected din EVErrorCode)");
  4210. break;
  4211. }
  4212. }
  4213. }
  4214. /*===========================================================================
  4215. FUNCTION: PRINT_iso1DC_EVErrorCodeType
  4216. DESCRIPTION:
  4217. PRE-CONDITION:
  4218. INPUT:
  4219. OUTPUT:
  4220. GLOBAL VARIABLES:
  4221. =============================================================================*/
  4222. void PRINT_iso1DC_EVErrorCodeType(struct iso1DC_EVStatusType *status)
  4223. {
  4224. switch (status->EVErrorCode)
  4225. {
  4226. case iso1DC_EVErrorCodeType_NO_ERROR: // = 0,
  4227. {
  4228. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NO_ERROR)");
  4229. break;
  4230. }
  4231. case iso1DC_EVErrorCodeType_FAILED_RESSTemperatureInhibit: // = 1,
  4232. {
  4233. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)");
  4234. break;
  4235. }
  4236. case iso1DC_EVErrorCodeType_FAILED_EVShiftPosition: // = 2,
  4237. {
  4238. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)");
  4239. break;
  4240. }
  4241. case iso1DC_EVErrorCodeType_FAILED_ChargerConnectorLockFault: // = 3,
  4242. {
  4243. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)");
  4244. break;
  4245. }
  4246. case iso1DC_EVErrorCodeType_FAILED_EVRESSMalfunction: // = 4,
  4247. {
  4248. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)");
  4249. break;
  4250. }
  4251. case iso1DC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
  4252. {
  4253. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)");
  4254. break;
  4255. }
  4256. case iso1DC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange: // = 6,
  4257. {
  4258. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)");
  4259. break;
  4260. }
  4261. case iso1DC_EVErrorCodeType_Reserved_A: // = 7,
  4262. {
  4263. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)");
  4264. break;
  4265. }
  4266. case iso1DC_EVErrorCodeType_Reserved_B: // = 8,
  4267. {
  4268. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)");
  4269. break;
  4270. }
  4271. case iso1DC_EVErrorCodeType_Reserved_C: // = 9,
  4272. {
  4273. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)");
  4274. break;
  4275. }
  4276. case iso1DC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
  4277. {
  4278. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)");
  4279. break;
  4280. }
  4281. case iso1DC_EVErrorCodeType_NoData: // = 11
  4282. {
  4283. DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)");
  4284. break;
  4285. }
  4286. default:
  4287. {
  4288. DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected iso1 EVErrorCode)");
  4289. break;
  4290. }
  4291. }
  4292. }
  4293. /*===========================================================================
  4294. FUNCTION: PRINT_dinDC_EVStatusType
  4295. DESCRIPTION:
  4296. PRE-CONDITION:
  4297. INPUT:
  4298. OUTPUT:
  4299. GLOBAL VARIABLES:
  4300. =============================================================================*/
  4301. void PRINT_dinDC_EVStatusType(struct dinDC_EVStatusType *status)
  4302. {
  4303. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVStatus:");
  4304. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVReady = %d (DEC) ", status->EVReady);
  4305. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVErrorCode = %d (DEC) ", status->EVErrorCode);
  4306. PRINT_dinDC_EVErrorCodeType(status);
  4307. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSSOC = %d \%(DEC) \n", status->EVRESSSOC);
  4308. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVCabinConditioning = %d (DEC) ", status->EVCabinConditioning);
  4309. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVCabinConditioning_isUsed = %d (DEC) ", status->EVCabinConditioning_isUsed);
  4310. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSConditioning = %d (DEC) ", status->EVRESSConditioning);
  4311. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSConditioning_isUsed = %d (DEC) \n", status->EVRESSConditioning_isUsed);
  4312. }
  4313. /*===========================================================================
  4314. FUNCTION: PRINT_iso1DC_EVStatusType
  4315. DESCRIPTION:
  4316. PRE-CONDITION:
  4317. INPUT:
  4318. OUTPUT:
  4319. GLOBAL VARIABLES:
  4320. =============================================================================*/
  4321. void PRINT_iso1DC_EVStatusType(struct iso1DC_EVStatusType *status)
  4322. {
  4323. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVStatus:");
  4324. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVReady = %d (DEC) ", status->EVReady);
  4325. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVErrorCode = %d (DEC) ", status->EVErrorCode);
  4326. PRINT_iso1DC_EVErrorCodeType(status);
  4327. DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSSOC = %d \%(DEC) \n", status->EVRESSSOC);
  4328. }