api.c 190 KB

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