api.c 190 KB

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