api.c 190 KB

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