v2g_serviceDataSerialization.c 92 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871
  1. /*
  2. * Copyright (C) 2007-2010 Siemens AG
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*******************************************************************
  18. *
  19. * @author Sebastian.Kaebisch.EXT@siemens.com
  20. * @version 0.2.1
  21. * @contact Joerg.Heuer@siemens.com
  22. *
  23. ********************************************************************/
  24. #include "v2g_service.h"
  25. #include "v2g_serviceDataTypes.h"
  26. #include "v2g_serviceDataSerializiation.h"
  27. #include "EXITypes.h"
  28. #include "EXIEncoder.h"
  29. static int serialize_SessionInformationType(struct SessionInformationType* type, struct v2gService* service)
  30. {
  31. /* element ID assignment of SessionID*/
  32. service->eqn.namespaceURI=5;
  33. service->eqn.localPart=35;
  34. /* encode start element SessionID */
  35. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  36. {
  37. return -1;
  38. }
  39. service->val.type = BINARY_HEX;
  40. service->val.binary.len = type->SessionID.arraylen.data;
  41. memcpy(service->val.binary.data, type->SessionID.data, service->val.binary.len);
  42. /* encode character SessionID */
  43. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  44. {
  45. return -1;
  46. }
  47. /* encode end element of SessionID */
  48. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  49. {
  50. return -1;
  51. }if(type->isused.ServiceSessionID)
  52. {
  53. /* element ID assignment of ServiceSessionID*/
  54. service->eqn.namespaceURI=5;
  55. service->eqn.localPart=33;
  56. /* encode start element ServiceSessionID */
  57. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  58. {
  59. return -1;
  60. }
  61. service->val.type = BINARY_HEX;
  62. service->val.binary.len = type->ServiceSessionID.arraylen.data;
  63. memcpy(service->val.binary.data, type->ServiceSessionID.data, service->val.binary.len);
  64. /* encode character ServiceSessionID */
  65. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  66. {
  67. return -1;
  68. }
  69. /* encode end element of ServiceSessionID */
  70. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  71. {
  72. return -1;
  73. }}
  74. if(type->isused.ProtocolVersion)
  75. {
  76. /* element ID assignment of ProtocolVersion*/
  77. service->eqn.namespaceURI=5;
  78. service->eqn.localPart=25;
  79. /* encode start element ProtocolVersion */
  80. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  81. {
  82. return -1;
  83. }
  84. service->val.type = STRING;
  85. service->val.string.len = type->ProtocolVersion.arraylen.data;
  86. memcpy(service->val.string.codepoints, type->ProtocolVersion.data, service->val.string.len);
  87. /* encode character ProtocolVersion */
  88. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  89. {
  90. return -1;
  91. }
  92. /* encode end element of ProtocolVersion */
  93. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  94. {
  95. return -1;
  96. }}
  97. return 0;
  98. }
  99. static int serialize_EventListType(struct EventListType* type, struct v2gService* service)
  100. {
  101. /* element ID assignment of Event*/
  102. service->eqn.namespaceURI=5;
  103. service->eqn.localPart=9;
  104. /* encode start element Event */
  105. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  106. {
  107. return -1;
  108. }
  109. service->val.type = ENUMERATION;
  110. service->val.enumeration=service->v2gMsg.Header.Notification.EventList.Event;
  111. /* encode character Event */
  112. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  113. {
  114. return -1;
  115. }
  116. /* encode end element of Event */
  117. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  118. {
  119. return -1;
  120. }
  121. return 0;
  122. }
  123. static int serialize_NotificationType(struct NotificationType* type, struct v2gService* service)
  124. {if(type->isused.FaultCode)
  125. {
  126. /* element ID assignment of FaultCode*/
  127. service->eqn.namespaceURI=5;
  128. service->eqn.localPart=13;
  129. /* encode start element FaultCode */
  130. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  131. {
  132. return -1;
  133. }
  134. service->val.type = ENUMERATION;
  135. service->val.enumeration=service->v2gMsg.Header.Notification.FaultCode;
  136. /* encode character FaultCode */
  137. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  138. {
  139. return -1;
  140. }
  141. /* encode end element of FaultCode */
  142. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  143. {
  144. return -1;
  145. }}
  146. if(type->isused.FaultMsg)
  147. {
  148. /* element ID assignment of FaultMsg*/
  149. service->eqn.namespaceURI=5;
  150. service->eqn.localPart=14;
  151. /* encode start element FaultMsg */
  152. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  153. {
  154. return -1;
  155. }
  156. service->val.type = STRING;
  157. service->val.string.len = type->FaultMsg.arraylen.data;
  158. memcpy(service->val.string.codepoints, type->FaultMsg.data, service->val.string.len);
  159. /* encode character FaultMsg */
  160. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  161. {
  162. return -1;
  163. }
  164. /* encode end element of FaultMsg */
  165. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  166. {
  167. return -1;
  168. }}
  169. if(type->isused.EventList)
  170. {
  171. /* element ID assignment of EventList*/
  172. service->eqn.namespaceURI=5;
  173. service->eqn.localPart=10;
  174. /* encode start element EventList */
  175. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  176. {
  177. return -1;
  178. }
  179. /* encode children of EventList */
  180. if(serialize_EventListType(&(type->EventList),service)<0)
  181. {
  182. return -1;
  183. }
  184. /* encode end element of EventList */
  185. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  186. {
  187. return -1;
  188. }}
  189. return 0;
  190. }
  191. static int serialize_HeaderType(struct HeaderType* type, struct v2gService* service)
  192. {
  193. /* element ID assignment of SessionInformation*/
  194. service->eqn.namespaceURI=6;
  195. service->eqn.localPart=7;
  196. /* encode start element SessionInformation */
  197. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  198. {
  199. return -1;
  200. }
  201. /* encode children of SessionInformation */
  202. if(serialize_SessionInformationType(&(type->SessionInformation),service)<0)
  203. {
  204. return -1;
  205. }
  206. /* encode end element of SessionInformation */
  207. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  208. {
  209. return -1;
  210. }if(type->isused.Notification)
  211. {
  212. /* element ID assignment of Notification*/
  213. service->eqn.namespaceURI=6;
  214. service->eqn.localPart=6;
  215. /* encode start element Notification */
  216. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  217. {
  218. return -1;
  219. }
  220. /* encode children of Notification */
  221. if(serialize_NotificationType(&(type->Notification),service)<0)
  222. {
  223. return -1;
  224. }
  225. /* encode end element of Notification */
  226. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  227. {
  228. return -1;
  229. }}
  230. return 0;
  231. }
  232. static int serialize_PEVStatusType(struct PEVStatusType* type, struct v2gService* service)
  233. {
  234. /* element ID assignment of ConnectorLocked*/
  235. service->eqn.namespaceURI=5;
  236. service->eqn.localPart=4;
  237. /* encode start element ConnectorLocked */
  238. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  239. {
  240. return -1;
  241. }
  242. service->val.type = BOOLEAN;
  243. service->val.boolean=service->v2gMsg.Body.SessionSetupReq.PEVStatus.ConnectorLocked;
  244. /* encode character ConnectorLocked */
  245. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  246. {
  247. return -1;
  248. }
  249. /* encode end element of ConnectorLocked */
  250. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  251. {
  252. return -1;
  253. }
  254. /* element ID assignment of ChargerStandby*/
  255. service->eqn.namespaceURI=5;
  256. service->eqn.localPart=0;
  257. /* encode start element ChargerStandby */
  258. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  259. {
  260. return -1;
  261. }
  262. service->val.type = BOOLEAN;
  263. service->val.boolean=service->v2gMsg.Body.SessionSetupReq.PEVStatus.ChargerStandby;
  264. /* encode character ChargerStandby */
  265. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  266. {
  267. return -1;
  268. }
  269. /* encode end element of ChargerStandby */
  270. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  271. {
  272. return -1;
  273. }
  274. return 0;
  275. }
  276. static int serialize_SessionSetupReqType(struct SessionSetupReqType* type, struct v2gService* service)
  277. {if(type->isused.PEVID)
  278. {
  279. /* element ID assignment of PEVID*/
  280. service->eqn.namespaceURI=4;
  281. service->eqn.localPart=26;
  282. /* encode start element PEVID */
  283. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  284. {
  285. return -1;
  286. }
  287. service->val.type = STRING;
  288. service->val.string.len = type->PEVID.arraylen.data;
  289. memcpy(service->val.string.codepoints, type->PEVID.data, service->val.string.len);
  290. /* encode character PEVID */
  291. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  292. {
  293. return -1;
  294. }
  295. /* encode end element of PEVID */
  296. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  297. {
  298. return -1;
  299. }}
  300. /* element ID assignment of PEVStatus*/
  301. service->eqn.namespaceURI=4;
  302. service->eqn.localPart=32;
  303. /* encode start element PEVStatus */
  304. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  305. {
  306. return -1;
  307. }
  308. /* encode children of PEVStatus */
  309. if(serialize_PEVStatusType(&(type->PEVStatus),service)<0)
  310. {
  311. return -1;
  312. }
  313. /* encode end element of PEVStatus */
  314. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  315. {
  316. return -1;
  317. }
  318. return 0;
  319. }
  320. static int serialize_EVSEStatusType(struct EVSEStatusType* type, struct v2gService* service)
  321. {
  322. /* element ID assignment of FatalError*/
  323. service->eqn.namespaceURI=5;
  324. service->eqn.localPart=12;
  325. /* encode start element FatalError */
  326. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  327. {
  328. return -1;
  329. }
  330. service->val.type = BOOLEAN;
  331. service->val.boolean=service->v2gMsg.Body.SessionSetupRes.EVSEStatus.FatalError;
  332. /* encode character FatalError */
  333. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  334. {
  335. return -1;
  336. }
  337. /* encode end element of FatalError */
  338. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  339. {
  340. return -1;
  341. }
  342. /* element ID assignment of EVSEStandby*/
  343. service->eqn.namespaceURI=5;
  344. service->eqn.localPart=7;
  345. /* encode start element EVSEStandby */
  346. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  347. {
  348. return -1;
  349. }
  350. service->val.type = BOOLEAN;
  351. service->val.boolean=service->v2gMsg.Body.SessionSetupRes.EVSEStatus.EVSEStandby;
  352. /* encode character EVSEStandby */
  353. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  354. {
  355. return -1;
  356. }
  357. /* encode end element of EVSEStandby */
  358. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  359. {
  360. return -1;
  361. }
  362. /* element ID assignment of ConnectorLocked*/
  363. service->eqn.namespaceURI=5;
  364. service->eqn.localPart=4;
  365. /* encode start element ConnectorLocked */
  366. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  367. {
  368. return -1;
  369. }
  370. service->val.type = BOOLEAN;
  371. service->val.boolean=service->v2gMsg.Body.SessionSetupRes.EVSEStatus.ConnectorLocked;
  372. /* encode character ConnectorLocked */
  373. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  374. {
  375. return -1;
  376. }
  377. /* encode end element of ConnectorLocked */
  378. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  379. {
  380. return -1;
  381. }
  382. /* element ID assignment of PowerSwitchClosed*/
  383. service->eqn.namespaceURI=5;
  384. service->eqn.localPart=24;
  385. /* encode start element PowerSwitchClosed */
  386. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  387. {
  388. return -1;
  389. }
  390. service->val.type = BOOLEAN;
  391. service->val.boolean=service->v2gMsg.Body.SessionSetupRes.EVSEStatus.PowerSwitchClosed;
  392. /* encode character PowerSwitchClosed */
  393. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  394. {
  395. return -1;
  396. }
  397. /* encode end element of PowerSwitchClosed */
  398. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  399. {
  400. return -1;
  401. }
  402. /* element ID assignment of RCD*/
  403. service->eqn.namespaceURI=5;
  404. service->eqn.localPart=26;
  405. /* encode start element RCD */
  406. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  407. {
  408. return -1;
  409. }
  410. service->val.type = BOOLEAN;
  411. service->val.boolean=service->v2gMsg.Body.SessionSetupRes.EVSEStatus.RCD;
  412. /* encode character RCD */
  413. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  414. {
  415. return -1;
  416. }
  417. /* encode end element of RCD */
  418. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  419. {
  420. return -1;
  421. }
  422. /* element ID assignment of ShutDownTime*/
  423. service->eqn.namespaceURI=5;
  424. service->eqn.localPart=37;
  425. /* encode start element ShutDownTime */
  426. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  427. {
  428. return -1;
  429. }
  430. service->val.type = INTEGER_64;
  431. service->val.int64=service->v2gMsg.Body.SessionSetupRes.EVSEStatus.ShutDownTime;
  432. /* encode character ShutDownTime */
  433. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  434. {
  435. return -1;
  436. }
  437. /* encode end element of ShutDownTime */
  438. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  439. {
  440. return -1;
  441. }
  442. return 0;
  443. }
  444. static int serialize_SessionSetupResType(struct SessionSetupResType* type, struct v2gService* service)
  445. {
  446. /* element ID assignment of ResponseCode*/
  447. service->eqn.namespaceURI=4;
  448. service->eqn.localPart=47;
  449. /* encode start element ResponseCode */
  450. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  451. {
  452. return -1;
  453. }
  454. service->val.type = ENUMERATION;
  455. service->val.enumeration=service->v2gMsg.Body.SessionSetupRes.ResponseCode;
  456. /* encode character ResponseCode */
  457. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  458. {
  459. return -1;
  460. }
  461. /* encode end element of ResponseCode */
  462. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  463. {
  464. return -1;
  465. }
  466. /* element ID assignment of EVSEID*/
  467. service->eqn.namespaceURI=4;
  468. service->eqn.localPart=3;
  469. /* encode start element EVSEID */
  470. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  471. {
  472. return -1;
  473. }
  474. service->val.type = BINARY_HEX;
  475. service->val.binary.len = type->EVSEID.arraylen.data;
  476. memcpy(service->val.binary.data, type->EVSEID.data, service->val.binary.len);
  477. /* encode character EVSEID */
  478. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  479. {
  480. return -1;
  481. }
  482. /* encode end element of EVSEID */
  483. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  484. {
  485. return -1;
  486. }
  487. /* element ID assignment of EVSEStatus*/
  488. service->eqn.namespaceURI=4;
  489. service->eqn.localPart=7;
  490. /* encode start element EVSEStatus */
  491. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  492. {
  493. return -1;
  494. }
  495. /* encode children of EVSEStatus */
  496. if(serialize_EVSEStatusType(&(type->EVSEStatus),service)<0)
  497. {
  498. return -1;
  499. }
  500. /* encode end element of EVSEStatus */
  501. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  502. {
  503. return -1;
  504. }
  505. /* element ID assignment of TCurrent*/
  506. service->eqn.namespaceURI=4;
  507. service->eqn.localPart=63;
  508. /* encode start element TCurrent */
  509. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  510. {
  511. return -1;
  512. }
  513. service->val.type = INTEGER_64;
  514. service->val.int64=service->v2gMsg.Body.SessionSetupRes.TCurrent;
  515. /* encode character TCurrent */
  516. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  517. {
  518. return -1;
  519. }
  520. /* encode end element of TCurrent */
  521. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  522. {
  523. return -1;
  524. }
  525. return 0;
  526. }
  527. static int serialize_ServiceDiscoveryReqType(struct ServiceDiscoveryReqType* type, struct v2gService* service)
  528. {if(type->isused.ServiceType)
  529. {
  530. /* element ID assignment of ServiceType*/
  531. service->eqn.namespaceURI=4;
  532. service->eqn.localPart=58;
  533. /* encode start element ServiceType */
  534. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  535. {
  536. return -1;
  537. }
  538. service->val.type = ENUMERATION;
  539. service->val.enumeration=service->v2gMsg.Body.ServiceDiscoveryReq.ServiceType;
  540. /* encode character ServiceType */
  541. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  542. {
  543. return -1;
  544. }
  545. /* encode end element of ServiceType */
  546. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  547. {
  548. return -1;
  549. }}
  550. if(type->isused.ServiceScope)
  551. {
  552. /* element ID assignment of ServiceScope*/
  553. service->eqn.namespaceURI=4;
  554. service->eqn.localPart=57;
  555. /* encode start element ServiceScope */
  556. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  557. {
  558. return -1;
  559. }
  560. service->val.type = STRING;
  561. service->val.string.len = type->ServiceScope.arraylen.data;
  562. memcpy(service->val.string.codepoints, type->ServiceScope.data, service->val.string.len);
  563. /* encode character ServiceScope */
  564. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  565. {
  566. return -1;
  567. }
  568. /* encode end element of ServiceScope */
  569. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  570. {
  571. return -1;
  572. }}
  573. return 0;
  574. }
  575. static int serialize_ServiceDescriptionType(struct ServiceDescriptionType* type, struct v2gService* service)
  576. {
  577. /* element ID assignment of ServiceID*/
  578. service->eqn.namespaceURI=5;
  579. service->eqn.localPart=29;
  580. /* encode start element ServiceID */
  581. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  582. {
  583. return -1;
  584. }
  585. service->val.type = BINARY_HEX;
  586. service->val.binary.len = type->ServiceID.arraylen.data;
  587. memcpy(service->val.binary.data, type->ServiceID.data, service->val.binary.len);
  588. /* encode character ServiceID */
  589. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  590. {
  591. return -1;
  592. }
  593. /* encode end element of ServiceID */
  594. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  595. {
  596. return -1;
  597. }if(type->isused.ServiceName)
  598. {
  599. /* element ID assignment of ServiceName*/
  600. service->eqn.namespaceURI=5;
  601. service->eqn.localPart=31;
  602. /* encode start element ServiceName */
  603. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  604. {
  605. return -1;
  606. }
  607. service->val.type = STRING;
  608. service->val.string.len = type->ServiceName.arraylen.data;
  609. memcpy(service->val.string.codepoints, type->ServiceName.data, service->val.string.len);
  610. /* encode character ServiceName */
  611. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  612. {
  613. return -1;
  614. }
  615. /* encode end element of ServiceName */
  616. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  617. {
  618. return -1;
  619. }}
  620. if(type->isused.ServiceType)
  621. {
  622. /* element ID assignment of ServiceType*/
  623. service->eqn.namespaceURI=5;
  624. service->eqn.localPart=34;
  625. /* encode start element ServiceType */
  626. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  627. {
  628. return -1;
  629. }
  630. service->val.type = ENUMERATION;
  631. service->val.enumeration=service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.Service[service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.arraylen.Service].ServiceType;
  632. /* encode character ServiceType */
  633. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  634. {
  635. return -1;
  636. }
  637. /* encode end element of ServiceType */
  638. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  639. {
  640. return -1;
  641. }}
  642. if(type->isused.ServiceScope)
  643. {
  644. /* element ID assignment of ServiceScope*/
  645. service->eqn.namespaceURI=5;
  646. service->eqn.localPart=32;
  647. /* encode start element ServiceScope */
  648. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  649. {
  650. return -1;
  651. }
  652. service->val.type = STRING;
  653. service->val.string.len = type->ServiceScope.arraylen.data;
  654. memcpy(service->val.string.codepoints, type->ServiceScope.data, service->val.string.len);
  655. /* encode character ServiceScope */
  656. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  657. {
  658. return -1;
  659. }
  660. /* encode end element of ServiceScope */
  661. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  662. {
  663. return -1;
  664. }}
  665. return 0;
  666. }
  667. static int serialize_ServiceListType(struct ServiceListType* type, struct v2gService* service)
  668. {
  669. int i_loop;
  670. /* element ID assignment of Service*/
  671. service->eqn.namespaceURI=5;
  672. service->eqn.localPart=27;
  673. /* encode start element Service */
  674. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  675. {
  676. return -1;
  677. }
  678. for(i_loop=0;i_loop < type->arraylen.Service;i_loop++)
  679. {
  680. /* encode children of Service */
  681. if(serialize_ServiceDescriptionType(&(type->Service[i_loop]),service)<0)
  682. {
  683. return -1;
  684. }
  685. }
  686. /* encode end element of Service */
  687. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  688. {
  689. return -1;
  690. }
  691. return 0;
  692. }
  693. static int serialize_ServiceDiscoveryResType(struct ServiceDiscoveryResType* type, struct v2gService* service)
  694. {
  695. /* element ID assignment of ResponseCode*/
  696. service->eqn.namespaceURI=4;
  697. service->eqn.localPart=47;
  698. /* encode start element ResponseCode */
  699. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  700. {
  701. return -1;
  702. }
  703. service->val.type = ENUMERATION;
  704. service->val.enumeration=service->v2gMsg.Body.ServiceDiscoveryRes.ResponseCode;
  705. /* encode character ResponseCode */
  706. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  707. {
  708. return -1;
  709. }
  710. /* encode end element of ResponseCode */
  711. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  712. {
  713. return -1;
  714. }if(type->isused.ServiceList)
  715. {
  716. /* element ID assignment of ServiceList*/
  717. service->eqn.namespaceURI=4;
  718. service->eqn.localPart=52;
  719. /* encode start element ServiceList */
  720. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  721. {
  722. return -1;
  723. }
  724. /* encode children of ServiceList */
  725. if(serialize_ServiceListType(&(type->ServiceList),service)<0)
  726. {
  727. return -1;
  728. }
  729. /* encode end element of ServiceList */
  730. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  731. {
  732. return -1;
  733. }}
  734. return 0;
  735. }
  736. static int serialize_ServicePaymentSelectionReqType(struct ServicePaymentSelectionReqType* type, struct v2gService* service)
  737. {
  738. /* element ID assignment of ServiceList*/
  739. service->eqn.namespaceURI=4;
  740. service->eqn.localPart=52;
  741. /* encode start element ServiceList */
  742. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  743. {
  744. return -1;
  745. }
  746. /* encode children of ServiceList */
  747. if(serialize_ServiceListType(&(type->ServiceList),service)<0)
  748. {
  749. return -1;
  750. }
  751. /* encode end element of ServiceList */
  752. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  753. {
  754. return -1;
  755. }
  756. /* element ID assignment of PEVPubKey*/
  757. service->eqn.namespaceURI=4;
  758. service->eqn.localPart=31;
  759. /* encode start element PEVPubKey */
  760. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  761. {
  762. return -1;
  763. }
  764. service->val.type = BINARY_HEX;
  765. service->val.binary.len = type->PEVPubKey.arraylen.data;
  766. memcpy(service->val.binary.data, type->PEVPubKey.data, service->val.binary.len);
  767. /* encode character PEVPubKey */
  768. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  769. {
  770. return -1;
  771. }
  772. /* encode end element of PEVPubKey */
  773. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  774. {
  775. return -1;
  776. }
  777. return 0;
  778. }
  779. static int serialize_ServicePaymentSelectionResType(struct ServicePaymentSelectionResType* type, struct v2gService* service)
  780. {
  781. /* element ID assignment of ResponseCode*/
  782. service->eqn.namespaceURI=4;
  783. service->eqn.localPart=47;
  784. /* encode start element ResponseCode */
  785. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  786. {
  787. return -1;
  788. }
  789. service->val.type = ENUMERATION;
  790. service->val.enumeration=service->v2gMsg.Body.ServicePaymentSelectionRes.ResponseCode;
  791. /* encode character ResponseCode */
  792. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  793. {
  794. return -1;
  795. }
  796. /* encode end element of ResponseCode */
  797. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  798. {
  799. return -1;
  800. }if(type->isused.MeteringAuthPubKey)
  801. {
  802. /* element ID assignment of MeteringAuthPubKey*/
  803. service->eqn.namespaceURI=4;
  804. service->eqn.localPart=16;
  805. /* encode start element MeteringAuthPubKey */
  806. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  807. {
  808. return -1;
  809. }
  810. service->val.type = BINARY_HEX;
  811. service->val.binary.len = type->MeteringAuthPubKey.arraylen.data;
  812. memcpy(service->val.binary.data, type->MeteringAuthPubKey.data, service->val.binary.len);
  813. /* encode character MeteringAuthPubKey */
  814. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  815. {
  816. return -1;
  817. }
  818. /* encode end element of MeteringAuthPubKey */
  819. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  820. {
  821. return -1;
  822. }}
  823. return 0;
  824. }
  825. static int serialize_PaymentDetailsReqType(struct PaymentDetailsReqType* type, struct v2gService* service)
  826. {
  827. /* element ID assignment of ContractID*/
  828. service->eqn.namespaceURI=4;
  829. service->eqn.localPart=1;
  830. /* encode start element ContractID */
  831. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  832. {
  833. return -1;
  834. }
  835. service->val.type = STRING;
  836. service->val.string.len = type->ContractID.arraylen.data;
  837. memcpy(service->val.string.codepoints, type->ContractID.data, service->val.string.len);
  838. /* encode character ContractID */
  839. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  840. {
  841. return -1;
  842. }
  843. /* encode end element of ContractID */
  844. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  845. {
  846. return -1;
  847. }
  848. return 0;
  849. }
  850. static int serialize_PaymentDetailsResType(struct PaymentDetailsResType* type, struct v2gService* service)
  851. {
  852. /* element ID assignment of ResponseCode*/
  853. service->eqn.namespaceURI=4;
  854. service->eqn.localPart=47;
  855. /* encode start element ResponseCode */
  856. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  857. {
  858. return -1;
  859. }
  860. service->val.type = ENUMERATION;
  861. service->val.enumeration=service->v2gMsg.Body.PaymentDetailsRes.ResponseCode;
  862. /* encode character ResponseCode */
  863. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  864. {
  865. return -1;
  866. }
  867. /* encode end element of ResponseCode */
  868. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  869. {
  870. return -1;
  871. }
  872. return 0;
  873. }
  874. static int serialize_FloatingValueType(struct FloatingValueType* type, struct v2gService* service)
  875. {
  876. /* element ID assignment of Multiplier*/
  877. service->eqn.namespaceURI=5;
  878. service->eqn.localPart=21;
  879. /* encode start element Multiplier */
  880. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  881. {
  882. return -1;
  883. }
  884. service->val.type = ENUMERATION;
  885. service->val.enumeration=service->v2gMsg.Body.PowerDiscoveryReq.EAmount.Multiplier;
  886. /* encode character Multiplier */
  887. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  888. {
  889. return -1;
  890. }
  891. /* encode end element of Multiplier */
  892. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  893. {
  894. return -1;
  895. }
  896. /* element ID assignment of Unit*/
  897. service->eqn.namespaceURI=5;
  898. service->eqn.localPart=50;
  899. /* encode start element Unit */
  900. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  901. {
  902. return -1;
  903. }
  904. service->val.type = ENUMERATION;
  905. service->val.enumeration=service->v2gMsg.Body.PowerDiscoveryReq.EAmount.Unit;
  906. /* encode character Unit */
  907. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  908. {
  909. return -1;
  910. }
  911. /* encode end element of Unit */
  912. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  913. {
  914. return -1;
  915. }
  916. /* element ID assignment of Value*/
  917. service->eqn.namespaceURI=5;
  918. service->eqn.localPart=51;
  919. /* encode start element Value */
  920. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  921. {
  922. return -1;
  923. }
  924. service->val.type = INTEGER_16;
  925. service->val.int32=service->v2gMsg.Body.PowerDiscoveryReq.EAmount.Value;
  926. /* encode character Value */
  927. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  928. {
  929. return -1;
  930. }
  931. /* encode end element of Value */
  932. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  933. {
  934. return -1;
  935. }
  936. return 0;
  937. }
  938. static int serialize_PowerDiscoveryReqType(struct PowerDiscoveryReqType* type, struct v2gService* service)
  939. {
  940. /* element ID assignment of PEVStatus*/
  941. service->eqn.namespaceURI=4;
  942. service->eqn.localPart=32;
  943. /* encode start element PEVStatus */
  944. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  945. {
  946. return -1;
  947. }
  948. /* encode children of PEVStatus */
  949. if(serialize_PEVStatusType(&(type->PEVStatus),service)<0)
  950. {
  951. return -1;
  952. }
  953. /* encode end element of PEVStatus */
  954. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  955. {
  956. return -1;
  957. }
  958. /* element ID assignment of EoC*/
  959. service->eqn.namespaceURI=4;
  960. service->eqn.localPart=10;
  961. /* encode start element EoC */
  962. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  963. {
  964. return -1;
  965. }
  966. service->val.type = INTEGER_64;
  967. service->val.int64=service->v2gMsg.Body.PowerDiscoveryReq.EoC;
  968. /* encode character EoC */
  969. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  970. {
  971. return -1;
  972. }
  973. /* encode end element of EoC */
  974. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  975. {
  976. return -1;
  977. }
  978. /* element ID assignment of EAmount*/
  979. service->eqn.namespaceURI=4;
  980. service->eqn.localPart=2;
  981. /* encode start element EAmount */
  982. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  983. {
  984. return -1;
  985. }
  986. /* encode children of EAmount */
  987. if(serialize_FloatingValueType(&(type->EAmount),service)<0)
  988. {
  989. return -1;
  990. }
  991. /* encode end element of EAmount */
  992. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  993. {
  994. return -1;
  995. }
  996. /* element ID assignment of PEVMaxPower*/
  997. service->eqn.namespaceURI=4;
  998. service->eqn.localPart=28;
  999. /* encode start element PEVMaxPower */
  1000. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1001. {
  1002. return -1;
  1003. }
  1004. /* encode children of PEVMaxPower */
  1005. if(serialize_FloatingValueType(&(type->PEVMaxPower),service)<0)
  1006. {
  1007. return -1;
  1008. }
  1009. /* encode end element of PEVMaxPower */
  1010. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1011. {
  1012. return -1;
  1013. }
  1014. /* element ID assignment of PEVMaxPhases*/
  1015. service->eqn.namespaceURI=4;
  1016. service->eqn.localPart=27;
  1017. /* encode start element PEVMaxPhases */
  1018. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1019. {
  1020. return -1;
  1021. }
  1022. service->val.type = INTEGER_16;
  1023. service->val.int32=service->v2gMsg.Body.PowerDiscoveryReq.PEVMaxPhases;
  1024. /* encode character PEVMaxPhases */
  1025. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1026. {
  1027. return -1;
  1028. }
  1029. /* encode end element of PEVMaxPhases */
  1030. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1031. {
  1032. return -1;
  1033. }
  1034. /* element ID assignment of PEVMaxVoltage*/
  1035. service->eqn.namespaceURI=4;
  1036. service->eqn.localPart=29;
  1037. /* encode start element PEVMaxVoltage */
  1038. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1039. {
  1040. return -1;
  1041. }
  1042. /* encode children of PEVMaxVoltage */
  1043. if(serialize_FloatingValueType(&(type->PEVMaxVoltage),service)<0)
  1044. {
  1045. return -1;
  1046. }
  1047. /* encode end element of PEVMaxVoltage */
  1048. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1049. {
  1050. return -1;
  1051. }
  1052. /* element ID assignment of PEVMinVoltage*/
  1053. service->eqn.namespaceURI=4;
  1054. service->eqn.localPart=30;
  1055. /* encode start element PEVMinVoltage */
  1056. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1057. {
  1058. return -1;
  1059. }
  1060. /* encode children of PEVMinVoltage */
  1061. if(serialize_FloatingValueType(&(type->PEVMinVoltage),service)<0)
  1062. {
  1063. return -1;
  1064. }
  1065. /* encode end element of PEVMinVoltage */
  1066. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1067. {
  1068. return -1;
  1069. }
  1070. return 0;
  1071. }
  1072. static int serialize_TariffEntryType(struct TariffEntryType* type, struct v2gService* service)
  1073. {
  1074. /* element ID assignment of TariffStart*/
  1075. service->eqn.namespaceURI=5;
  1076. service->eqn.localPart=48;
  1077. /* encode start element TariffStart */
  1078. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1079. {
  1080. return -1;
  1081. }
  1082. service->val.type = UNSIGNED_INTEGER_32;
  1083. service->val.uint32=service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffStart;
  1084. /* encode character TariffStart */
  1085. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1086. {
  1087. return -1;
  1088. }
  1089. /* encode end element of TariffStart */
  1090. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1091. {
  1092. return -1;
  1093. }
  1094. /* element ID assignment of TariffPMax*/
  1095. service->eqn.namespaceURI=5;
  1096. service->eqn.localPart=47;
  1097. /* encode start element TariffPMax */
  1098. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1099. {
  1100. return -1;
  1101. }
  1102. /* encode children of TariffPMax */
  1103. if(serialize_FloatingValueType(&(type->TariffPMax),service)<0)
  1104. {
  1105. return -1;
  1106. }
  1107. /* encode end element of TariffPMax */
  1108. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1109. {
  1110. return -1;
  1111. }if(type->isused.EPrice)
  1112. {
  1113. /* element ID assignment of EPrice*/
  1114. service->eqn.namespaceURI=5;
  1115. service->eqn.localPart=6;
  1116. /* encode start element EPrice */
  1117. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1118. {
  1119. return -1;
  1120. }
  1121. /* encode children of EPrice */
  1122. if(serialize_FloatingValueType(&(type->EPrice),service)<0)
  1123. {
  1124. return -1;
  1125. }
  1126. /* encode end element of EPrice */
  1127. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1128. {
  1129. return -1;
  1130. }}
  1131. return 0;
  1132. }
  1133. static int serialize_TariffEntriesType(struct TariffEntriesType* type, struct v2gService* service)
  1134. {
  1135. int i_loop;
  1136. /* element ID assignment of TariffEntry*/
  1137. service->eqn.namespaceURI=5;
  1138. service->eqn.localPart=44;
  1139. /* encode start element TariffEntry */
  1140. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1141. {
  1142. return -1;
  1143. }
  1144. for(i_loop=0;i_loop < type->arraylen.TariffEntry;i_loop++)
  1145. {
  1146. /* encode children of TariffEntry */
  1147. if(serialize_TariffEntryType(&(type->TariffEntry[i_loop]),service)<0)
  1148. {
  1149. return -1;
  1150. }
  1151. }
  1152. /* encode end element of TariffEntry */
  1153. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1154. {
  1155. return -1;
  1156. }
  1157. return 0;
  1158. }
  1159. static int serialize_TariffDescrType(struct TariffDescrType* type, struct v2gService* service)
  1160. {
  1161. /* element ID assignment of TariffID*/
  1162. service->eqn.namespaceURI=5;
  1163. service->eqn.localPart=46;
  1164. /* encode start element TariffID */
  1165. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1166. {
  1167. return -1;
  1168. }
  1169. service->val.type = ENUMERATION;
  1170. service->val.enumeration=service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffID;
  1171. /* encode character TariffID */
  1172. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1173. {
  1174. return -1;
  1175. }
  1176. /* encode end element of TariffID */
  1177. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1178. {
  1179. return -1;
  1180. }if(type->isused.TariffDescription)
  1181. {
  1182. /* element ID assignment of TariffDescription*/
  1183. service->eqn.namespaceURI=5;
  1184. service->eqn.localPart=41;
  1185. /* encode start element TariffDescription */
  1186. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1187. {
  1188. return -1;
  1189. }
  1190. service->val.type = STRING;
  1191. service->val.string.len = type->TariffDescription.arraylen.data;
  1192. memcpy(service->val.string.codepoints, type->TariffDescription.data, service->val.string.len);
  1193. /* encode character TariffDescription */
  1194. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1195. {
  1196. return -1;
  1197. }
  1198. /* encode end element of TariffDescription */
  1199. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1200. {
  1201. return -1;
  1202. }}
  1203. /* element ID assignment of TariffEntries*/
  1204. service->eqn.namespaceURI=5;
  1205. service->eqn.localPart=42;
  1206. /* encode start element TariffEntries */
  1207. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1208. {
  1209. return -1;
  1210. }
  1211. /* encode children of TariffEntries */
  1212. if(serialize_TariffEntriesType(&(type->TariffEntries),service)<0)
  1213. {
  1214. return -1;
  1215. }
  1216. /* encode end element of TariffEntries */
  1217. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1218. {
  1219. return -1;
  1220. }
  1221. return 0;
  1222. }
  1223. static int serialize_TariffTableType(struct TariffTableType* type, struct v2gService* service)
  1224. {
  1225. int i_loop;
  1226. /* element ID assignment of Currency*/
  1227. service->eqn.namespaceURI=5;
  1228. service->eqn.localPart=5;
  1229. /* encode start element Currency */
  1230. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1231. {
  1232. return -1;
  1233. }
  1234. service->val.type = STRING;
  1235. service->val.string.len = type->Currency.arraylen.data;
  1236. memcpy(service->val.string.codepoints, type->Currency.data, service->val.string.len);
  1237. /* encode character Currency */
  1238. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1239. {
  1240. return -1;
  1241. }
  1242. /* encode end element of Currency */
  1243. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1244. {
  1245. return -1;
  1246. }
  1247. /* element ID assignment of Tariff*/
  1248. service->eqn.namespaceURI=5;
  1249. service->eqn.localPart=39;
  1250. /* encode start element Tariff */
  1251. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1252. {
  1253. return -1;
  1254. }
  1255. for(i_loop=0;i_loop < type->arraylen.Tariff;i_loop++)
  1256. {
  1257. /* encode children of Tariff */
  1258. if(serialize_TariffDescrType(&(type->Tariff[i_loop]),service)<0)
  1259. {
  1260. return -1;
  1261. }
  1262. }
  1263. /* encode end element of Tariff */
  1264. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1265. {
  1266. return -1;
  1267. }
  1268. return 0;
  1269. }
  1270. static int serialize_PowerDiscoveryResType(struct PowerDiscoveryResType* type, struct v2gService* service)
  1271. {
  1272. /* element ID assignment of ResponseCode*/
  1273. service->eqn.namespaceURI=4;
  1274. service->eqn.localPart=47;
  1275. /* encode start element ResponseCode */
  1276. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1277. {
  1278. return -1;
  1279. }
  1280. service->val.type = ENUMERATION;
  1281. service->val.enumeration=service->v2gMsg.Body.PowerDiscoveryRes.ResponseCode;
  1282. /* encode character ResponseCode */
  1283. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1284. {
  1285. return -1;
  1286. }
  1287. /* encode end element of ResponseCode */
  1288. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1289. {
  1290. return -1;
  1291. }
  1292. /* element ID assignment of EVSEStatus*/
  1293. service->eqn.namespaceURI=4;
  1294. service->eqn.localPart=7;
  1295. /* encode start element EVSEStatus */
  1296. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1297. {
  1298. return -1;
  1299. }
  1300. /* encode children of EVSEStatus */
  1301. if(serialize_EVSEStatusType(&(type->EVSEStatus),service)<0)
  1302. {
  1303. return -1;
  1304. }
  1305. /* encode end element of EVSEStatus */
  1306. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1307. {
  1308. return -1;
  1309. }
  1310. /* element ID assignment of EVSEVoltage*/
  1311. service->eqn.namespaceURI=4;
  1312. service->eqn.localPart=8;
  1313. /* encode start element EVSEVoltage */
  1314. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1315. {
  1316. return -1;
  1317. }
  1318. /* encode children of EVSEVoltage */
  1319. if(serialize_FloatingValueType(&(type->EVSEVoltage),service)<0)
  1320. {
  1321. return -1;
  1322. }
  1323. /* encode end element of EVSEVoltage */
  1324. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1325. {
  1326. return -1;
  1327. }
  1328. /* element ID assignment of EVSEIMax*/
  1329. service->eqn.namespaceURI=4;
  1330. service->eqn.localPart=4;
  1331. /* encode start element EVSEIMax */
  1332. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1333. {
  1334. return -1;
  1335. }
  1336. /* encode children of EVSEIMax */
  1337. if(serialize_FloatingValueType(&(type->EVSEIMax),service)<0)
  1338. {
  1339. return -1;
  1340. }
  1341. /* encode end element of EVSEIMax */
  1342. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1343. {
  1344. return -1;
  1345. }
  1346. /* element ID assignment of EVSEMaxPhases*/
  1347. service->eqn.namespaceURI=4;
  1348. service->eqn.localPart=5;
  1349. /* encode start element EVSEMaxPhases */
  1350. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1351. {
  1352. return -1;
  1353. }
  1354. service->val.type = INTEGER_16;
  1355. service->val.int32=service->v2gMsg.Body.PowerDiscoveryRes.EVSEMaxPhases;
  1356. /* encode character EVSEMaxPhases */
  1357. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1358. {
  1359. return -1;
  1360. }
  1361. /* encode end element of EVSEMaxPhases */
  1362. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1363. {
  1364. return -1;
  1365. }if(type->isused.EnergyProvider)
  1366. {
  1367. /* element ID assignment of EnergyProvider*/
  1368. service->eqn.namespaceURI=4;
  1369. service->eqn.localPart=9;
  1370. /* encode start element EnergyProvider */
  1371. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1372. {
  1373. return -1;
  1374. }
  1375. service->val.type = STRING;
  1376. service->val.string.len = type->EnergyProvider.arraylen.data;
  1377. memcpy(service->val.string.codepoints, type->EnergyProvider.data, service->val.string.len);
  1378. /* encode character EnergyProvider */
  1379. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1380. {
  1381. return -1;
  1382. }
  1383. /* encode end element of EnergyProvider */
  1384. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1385. {
  1386. return -1;
  1387. }}
  1388. if(type->isused.TariffTable)
  1389. {
  1390. /* element ID assignment of TariffTable*/
  1391. service->eqn.namespaceURI=4;
  1392. service->eqn.localPart=65;
  1393. /* encode start element TariffTable */
  1394. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1395. {
  1396. return -1;
  1397. }
  1398. /* encode children of TariffTable */
  1399. if(serialize_TariffTableType(&(type->TariffTable),service)<0)
  1400. {
  1401. return -1;
  1402. }
  1403. /* encode end element of TariffTable */
  1404. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1405. {
  1406. return -1;
  1407. }}
  1408. return 0;
  1409. }
  1410. static int serialize_LineLockReqType(struct LineLockReqType* type, struct v2gService* service)
  1411. {
  1412. /* element ID assignment of PEVStatus*/
  1413. service->eqn.namespaceURI=4;
  1414. service->eqn.localPart=32;
  1415. /* encode start element PEVStatus */
  1416. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1417. {
  1418. return -1;
  1419. }
  1420. /* encode children of PEVStatus */
  1421. if(serialize_PEVStatusType(&(type->PEVStatus),service)<0)
  1422. {
  1423. return -1;
  1424. }
  1425. /* encode end element of PEVStatus */
  1426. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1427. {
  1428. return -1;
  1429. }
  1430. /* element ID assignment of ReqLockStatus*/
  1431. service->eqn.namespaceURI=4;
  1432. service->eqn.localPart=45;
  1433. /* encode start element ReqLockStatus */
  1434. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1435. {
  1436. return -1;
  1437. }
  1438. service->val.type = BOOLEAN;
  1439. service->val.boolean=service->v2gMsg.Body.LineLockReq.ReqLockStatus;
  1440. /* encode character ReqLockStatus */
  1441. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1442. {
  1443. return -1;
  1444. }
  1445. /* encode end element of ReqLockStatus */
  1446. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1447. {
  1448. return -1;
  1449. }
  1450. return 0;
  1451. }
  1452. static int serialize_LineLockResType(struct LineLockResType* type, struct v2gService* service)
  1453. {
  1454. /* element ID assignment of ResponseCode*/
  1455. service->eqn.namespaceURI=4;
  1456. service->eqn.localPart=47;
  1457. /* encode start element ResponseCode */
  1458. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1459. {
  1460. return -1;
  1461. }
  1462. service->val.type = ENUMERATION;
  1463. service->val.enumeration=service->v2gMsg.Body.LineLockRes.ResponseCode;
  1464. /* encode character ResponseCode */
  1465. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1466. {
  1467. return -1;
  1468. }
  1469. /* encode end element of ResponseCode */
  1470. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1471. {
  1472. return -1;
  1473. }
  1474. /* element ID assignment of EVSEStatus*/
  1475. service->eqn.namespaceURI=4;
  1476. service->eqn.localPart=7;
  1477. /* encode start element EVSEStatus */
  1478. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1479. {
  1480. return -1;
  1481. }
  1482. /* encode children of EVSEStatus */
  1483. if(serialize_EVSEStatusType(&(type->EVSEStatus),service)<0)
  1484. {
  1485. return -1;
  1486. }
  1487. /* encode end element of EVSEStatus */
  1488. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1489. {
  1490. return -1;
  1491. }
  1492. return 0;
  1493. }
  1494. static int serialize_ChargingProfileType(struct ChargingProfileType* type, struct v2gService* service)
  1495. {
  1496. /* element ID assignment of ChargingProfileEntryStart*/
  1497. service->eqn.namespaceURI=5;
  1498. service->eqn.localPart=2;
  1499. /* encode start element ChargingProfileEntryStart */
  1500. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1501. {
  1502. return -1;
  1503. }
  1504. service->val.type = INTEGER_64;
  1505. service->val.int64=service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryStart;
  1506. /* encode character ChargingProfileEntryStart */
  1507. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1508. {
  1509. return -1;
  1510. }
  1511. /* encode end element of ChargingProfileEntryStart */
  1512. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1513. {
  1514. return -1;
  1515. }
  1516. /* element ID assignment of ChargingProfileEntryMaxPower*/
  1517. service->eqn.namespaceURI=5;
  1518. service->eqn.localPart=1;
  1519. /* encode start element ChargingProfileEntryMaxPower */
  1520. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1521. {
  1522. return -1;
  1523. }
  1524. /* encode children of ChargingProfileEntryMaxPower */
  1525. if(serialize_FloatingValueType(&(type->ChargingProfileEntryMaxPower),service)<0)
  1526. {
  1527. return -1;
  1528. }
  1529. /* encode end element of ChargingProfileEntryMaxPower */
  1530. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1531. {
  1532. return -1;
  1533. }
  1534. return 0;
  1535. }
  1536. static int serialize_PowerDeliveryReqType(struct PowerDeliveryReqType* type, struct v2gService* service)
  1537. {
  1538. /* element ID assignment of PEVStatus*/
  1539. service->eqn.namespaceURI=4;
  1540. service->eqn.localPart=32;
  1541. /* encode start element PEVStatus */
  1542. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1543. {
  1544. return -1;
  1545. }
  1546. /* encode children of PEVStatus */
  1547. if(serialize_PEVStatusType(&(type->PEVStatus),service)<0)
  1548. {
  1549. return -1;
  1550. }
  1551. /* encode end element of PEVStatus */
  1552. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1553. {
  1554. return -1;
  1555. }
  1556. /* element ID assignment of ReqSwitchStatus*/
  1557. service->eqn.namespaceURI=4;
  1558. service->eqn.localPart=46;
  1559. /* encode start element ReqSwitchStatus */
  1560. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1561. {
  1562. return -1;
  1563. }
  1564. service->val.type = BOOLEAN;
  1565. service->val.boolean=service->v2gMsg.Body.PowerDeliveryReq.ReqSwitchStatus;
  1566. /* encode character ReqSwitchStatus */
  1567. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1568. {
  1569. return -1;
  1570. }
  1571. /* encode end element of ReqSwitchStatus */
  1572. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1573. {
  1574. return -1;
  1575. }if(type->isused.Tariff)
  1576. {
  1577. /* element ID assignment of Tariff*/
  1578. service->eqn.namespaceURI=4;
  1579. service->eqn.localPart=64;
  1580. /* encode start element Tariff */
  1581. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1582. {
  1583. return -1;
  1584. }
  1585. service->val.type = ENUMERATION;
  1586. service->val.enumeration=service->v2gMsg.Body.PowerDeliveryReq.Tariff;
  1587. /* encode character Tariff */
  1588. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1589. {
  1590. return -1;
  1591. }
  1592. /* encode end element of Tariff */
  1593. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1594. {
  1595. return -1;
  1596. }}
  1597. if(type->isused.ChargingProfile)
  1598. {
  1599. /* element ID assignment of ChargingProfile*/
  1600. service->eqn.namespaceURI=4;
  1601. service->eqn.localPart=0;
  1602. /* encode start element ChargingProfile */
  1603. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1604. {
  1605. return -1;
  1606. }
  1607. /* encode children of ChargingProfile */
  1608. if(serialize_ChargingProfileType(&(type->ChargingProfile),service)<0)
  1609. {
  1610. return -1;
  1611. }
  1612. /* encode end element of ChargingProfile */
  1613. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1614. {
  1615. return -1;
  1616. }}
  1617. return 0;
  1618. }
  1619. static int serialize_PowerDeliveryResType(struct PowerDeliveryResType* type, struct v2gService* service)
  1620. {
  1621. /* element ID assignment of ResponseCode*/
  1622. service->eqn.namespaceURI=4;
  1623. service->eqn.localPart=47;
  1624. /* encode start element ResponseCode */
  1625. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1626. {
  1627. return -1;
  1628. }
  1629. service->val.type = ENUMERATION;
  1630. service->val.enumeration=service->v2gMsg.Body.PowerDeliveryRes.ResponseCode;
  1631. /* encode character ResponseCode */
  1632. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1633. {
  1634. return -1;
  1635. }
  1636. /* encode end element of ResponseCode */
  1637. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1638. {
  1639. return -1;
  1640. }
  1641. return 0;
  1642. }
  1643. static int serialize_MeteringStatusReqType(struct MeteringStatusReqType* type, struct v2gService* service)
  1644. {
  1645. return 0;
  1646. }
  1647. static int serialize_MeterInfoType(struct MeterInfoType* type, struct v2gService* service)
  1648. {if(type->isused.MeterID)
  1649. {
  1650. /* element ID assignment of MeterID*/
  1651. service->eqn.namespaceURI=5;
  1652. service->eqn.localPart=16;
  1653. /* encode start element MeterID */
  1654. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1655. {
  1656. return -1;
  1657. }
  1658. service->val.type = STRING;
  1659. service->val.string.len = type->MeterID.arraylen.data;
  1660. memcpy(service->val.string.codepoints, type->MeterID.data, service->val.string.len);
  1661. /* encode character MeterID */
  1662. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1663. {
  1664. return -1;
  1665. }
  1666. /* encode end element of MeterID */
  1667. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1668. {
  1669. return -1;
  1670. }}
  1671. if(type->isused.MeterPubKey)
  1672. {
  1673. /* element ID assignment of MeterPubKey*/
  1674. service->eqn.namespaceURI=5;
  1675. service->eqn.localPart=18;
  1676. /* encode start element MeterPubKey */
  1677. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1678. {
  1679. return -1;
  1680. }
  1681. service->val.type = BINARY_HEX;
  1682. service->val.binary.len = type->MeterPubKey.arraylen.data;
  1683. memcpy(service->val.binary.data, type->MeterPubKey.data, service->val.binary.len);
  1684. /* encode character MeterPubKey */
  1685. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1686. {
  1687. return -1;
  1688. }
  1689. /* encode end element of MeterPubKey */
  1690. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1691. {
  1692. return -1;
  1693. }}
  1694. if(type->isused.MeterReading)
  1695. {
  1696. /* element ID assignment of MeterReading*/
  1697. service->eqn.namespaceURI=5;
  1698. service->eqn.localPart=19;
  1699. /* encode start element MeterReading */
  1700. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1701. {
  1702. return -1;
  1703. }
  1704. /* encode children of MeterReading */
  1705. if(serialize_FloatingValueType(&(type->MeterReading),service)<0)
  1706. {
  1707. return -1;
  1708. }
  1709. /* encode end element of MeterReading */
  1710. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1711. {
  1712. return -1;
  1713. }}
  1714. if(type->isused.MeterStatus)
  1715. {
  1716. /* element ID assignment of MeterStatus*/
  1717. service->eqn.namespaceURI=5;
  1718. service->eqn.localPart=20;
  1719. /* encode start element MeterStatus */
  1720. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1721. {
  1722. return -1;
  1723. }
  1724. service->val.type = INTEGER_16;
  1725. service->val.int32=service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterStatus;
  1726. /* encode character MeterStatus */
  1727. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1728. {
  1729. return -1;
  1730. }
  1731. /* encode end element of MeterStatus */
  1732. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1733. {
  1734. return -1;
  1735. }}
  1736. if(type->isused.TMeter)
  1737. {
  1738. /* element ID assignment of TMeter*/
  1739. service->eqn.namespaceURI=5;
  1740. service->eqn.localPart=38;
  1741. /* encode start element TMeter */
  1742. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1743. {
  1744. return -1;
  1745. }
  1746. service->val.type = INTEGER_64;
  1747. service->val.int64=service->v2gMsg.Body.MeteringStatusRes.MeterInfo.TMeter;
  1748. /* encode character TMeter */
  1749. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1750. {
  1751. return -1;
  1752. }
  1753. /* encode end element of TMeter */
  1754. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1755. {
  1756. return -1;
  1757. }}
  1758. return 0;
  1759. }
  1760. static int serialize_MeteringStatusResType(struct MeteringStatusResType* type, struct v2gService* service)
  1761. {
  1762. /* element ID assignment of ResponseCode*/
  1763. service->eqn.namespaceURI=4;
  1764. service->eqn.localPart=47;
  1765. /* encode start element ResponseCode */
  1766. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1767. {
  1768. return -1;
  1769. }
  1770. service->val.type = ENUMERATION;
  1771. service->val.enumeration=service->v2gMsg.Body.MeteringStatusRes.ResponseCode;
  1772. /* encode character ResponseCode */
  1773. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1774. {
  1775. return -1;
  1776. }
  1777. /* encode end element of ResponseCode */
  1778. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1779. {
  1780. return -1;
  1781. }
  1782. /* element ID assignment of EVSEID*/
  1783. service->eqn.namespaceURI=4;
  1784. service->eqn.localPart=3;
  1785. /* encode start element EVSEID */
  1786. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1787. {
  1788. return -1;
  1789. }
  1790. service->val.type = BINARY_HEX;
  1791. service->val.binary.len = type->EVSEID.arraylen.data;
  1792. memcpy(service->val.binary.data, type->EVSEID.data, service->val.binary.len);
  1793. /* encode character EVSEID */
  1794. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1795. {
  1796. return -1;
  1797. }
  1798. /* encode end element of EVSEID */
  1799. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1800. {
  1801. return -1;
  1802. }
  1803. /* element ID assignment of EVSEStatus*/
  1804. service->eqn.namespaceURI=4;
  1805. service->eqn.localPart=7;
  1806. /* encode start element EVSEStatus */
  1807. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1808. {
  1809. return -1;
  1810. }
  1811. /* encode children of EVSEStatus */
  1812. if(serialize_EVSEStatusType(&(type->EVSEStatus),service)<0)
  1813. {
  1814. return -1;
  1815. }
  1816. /* encode end element of EVSEStatus */
  1817. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1818. {
  1819. return -1;
  1820. }
  1821. /* element ID assignment of TCurrent*/
  1822. service->eqn.namespaceURI=4;
  1823. service->eqn.localPart=63;
  1824. /* encode start element TCurrent */
  1825. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1826. {
  1827. return -1;
  1828. }
  1829. service->val.type = INTEGER_64;
  1830. service->val.int64=service->v2gMsg.Body.MeteringStatusRes.TCurrent;
  1831. /* encode character TCurrent */
  1832. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1833. {
  1834. return -1;
  1835. }
  1836. /* encode end element of TCurrent */
  1837. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1838. {
  1839. return -1;
  1840. }
  1841. /* element ID assignment of EVSEMaxPower*/
  1842. service->eqn.namespaceURI=4;
  1843. service->eqn.localPart=6;
  1844. /* encode start element EVSEMaxPower */
  1845. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1846. {
  1847. return -1;
  1848. }
  1849. /* encode children of EVSEMaxPower */
  1850. if(serialize_FloatingValueType(&(type->EVSEMaxPower),service)<0)
  1851. {
  1852. return -1;
  1853. }
  1854. /* encode end element of EVSEMaxPower */
  1855. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1856. {
  1857. return -1;
  1858. }if(type->isused.PCurrent)
  1859. {
  1860. /* element ID assignment of PCurrent*/
  1861. service->eqn.namespaceURI=4;
  1862. service->eqn.localPart=25;
  1863. /* encode start element PCurrent */
  1864. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1865. {
  1866. return -1;
  1867. }
  1868. /* encode children of PCurrent */
  1869. if(serialize_FloatingValueType(&(type->PCurrent),service)<0)
  1870. {
  1871. return -1;
  1872. }
  1873. /* encode end element of PCurrent */
  1874. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1875. {
  1876. return -1;
  1877. }}
  1878. if(type->isused.MeterInfo)
  1879. {
  1880. /* element ID assignment of MeterInfo*/
  1881. service->eqn.namespaceURI=4;
  1882. service->eqn.localPart=15;
  1883. /* encode start element MeterInfo */
  1884. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1885. {
  1886. return -1;
  1887. }
  1888. /* encode children of MeterInfo */
  1889. if(serialize_MeterInfoType(&(type->MeterInfo),service)<0)
  1890. {
  1891. return -1;
  1892. }
  1893. /* encode end element of MeterInfo */
  1894. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1895. {
  1896. return -1;
  1897. }}
  1898. return 0;
  1899. }
  1900. static int serialize_MeteringReceiptReqType(struct MeteringReceiptReqType* type, struct v2gService* service)
  1901. {if(type->isused.PEVID)
  1902. {
  1903. /* element ID assignment of PEVID*/
  1904. service->eqn.namespaceURI=4;
  1905. service->eqn.localPart=26;
  1906. /* encode start element PEVID */
  1907. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1908. {
  1909. return -1;
  1910. }
  1911. service->val.type = STRING;
  1912. service->val.string.len = type->PEVID.arraylen.data;
  1913. memcpy(service->val.string.codepoints, type->PEVID.data, service->val.string.len);
  1914. /* encode character PEVID */
  1915. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1916. {
  1917. return -1;
  1918. }
  1919. /* encode end element of PEVID */
  1920. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1921. {
  1922. return -1;
  1923. }}
  1924. /* element ID assignment of PEVStatus*/
  1925. service->eqn.namespaceURI=4;
  1926. service->eqn.localPart=32;
  1927. /* encode start element PEVStatus */
  1928. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1929. {
  1930. return -1;
  1931. }
  1932. /* encode children of PEVStatus */
  1933. if(serialize_PEVStatusType(&(type->PEVStatus),service)<0)
  1934. {
  1935. return -1;
  1936. }
  1937. /* encode end element of PEVStatus */
  1938. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1939. {
  1940. return -1;
  1941. }if(type->isused.TCurrent)
  1942. {
  1943. /* element ID assignment of TCurrent*/
  1944. service->eqn.namespaceURI=4;
  1945. service->eqn.localPart=63;
  1946. /* encode start element TCurrent */
  1947. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1948. {
  1949. return -1;
  1950. }
  1951. service->val.type = INTEGER_64;
  1952. service->val.int64=service->v2gMsg.Body.MeteringReceiptReq.TCurrent;
  1953. /* encode character TCurrent */
  1954. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1955. {
  1956. return -1;
  1957. }
  1958. /* encode end element of TCurrent */
  1959. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1960. {
  1961. return -1;
  1962. }}
  1963. /* element ID assignment of Tariff*/
  1964. service->eqn.namespaceURI=4;
  1965. service->eqn.localPart=64;
  1966. /* encode start element Tariff */
  1967. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1968. {
  1969. return -1;
  1970. }
  1971. service->val.type = ENUMERATION;
  1972. service->val.enumeration=service->v2gMsg.Body.MeteringReceiptReq.Tariff;
  1973. /* encode character Tariff */
  1974. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  1975. {
  1976. return -1;
  1977. }
  1978. /* encode end element of Tariff */
  1979. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1980. {
  1981. return -1;
  1982. }
  1983. /* element ID assignment of MeterInfo*/
  1984. service->eqn.namespaceURI=4;
  1985. service->eqn.localPart=15;
  1986. /* encode start element MeterInfo */
  1987. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1988. {
  1989. return -1;
  1990. }
  1991. /* encode children of MeterInfo */
  1992. if(serialize_MeterInfoType(&(type->MeterInfo),service)<0)
  1993. {
  1994. return -1;
  1995. }
  1996. /* encode end element of MeterInfo */
  1997. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  1998. {
  1999. return -1;
  2000. }
  2001. return 0;
  2002. }
  2003. static int serialize_MeteringReceiptResType(struct MeteringReceiptResType* type, struct v2gService* service)
  2004. {
  2005. /* element ID assignment of ResponseCode*/
  2006. service->eqn.namespaceURI=4;
  2007. service->eqn.localPart=47;
  2008. /* encode start element ResponseCode */
  2009. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2010. {
  2011. return -1;
  2012. }
  2013. service->val.type = ENUMERATION;
  2014. service->val.enumeration=service->v2gMsg.Body.MeteringReceiptRes.ResponseCode;
  2015. /* encode character ResponseCode */
  2016. if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)) < 0)
  2017. {
  2018. return -1;
  2019. }
  2020. /* encode end element of ResponseCode */
  2021. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2022. {
  2023. return -1;
  2024. }
  2025. return 0;
  2026. }
  2027. static int serialize_BodyType(struct BodyType* type, struct v2gService* service)
  2028. {if(type->isused.SessionSetupReq)
  2029. {
  2030. /* element ID assignment of SessionSetupReq*/
  2031. service->eqn.namespaceURI=4;
  2032. service->eqn.localPart=59;
  2033. /* encode start element SessionSetupReq */
  2034. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2035. {
  2036. return -1;
  2037. }
  2038. /* encode children of SessionSetupReq */
  2039. if(serialize_SessionSetupReqType(&(type->SessionSetupReq),service)<0)
  2040. {
  2041. return -1;
  2042. }
  2043. /* encode end element of SessionSetupReq */
  2044. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2045. {
  2046. return -1;
  2047. }}
  2048. if(type->isused.SessionSetupRes)
  2049. {
  2050. /* element ID assignment of SessionSetupRes*/
  2051. service->eqn.namespaceURI=4;
  2052. service->eqn.localPart=61;
  2053. /* encode start element SessionSetupRes */
  2054. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2055. {
  2056. return -1;
  2057. }
  2058. /* encode children of SessionSetupRes */
  2059. if(serialize_SessionSetupResType(&(type->SessionSetupRes),service)<0)
  2060. {
  2061. return -1;
  2062. }
  2063. /* encode end element of SessionSetupRes */
  2064. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2065. {
  2066. return -1;
  2067. }}
  2068. if(type->isused.ServiceDiscoveryReq)
  2069. {
  2070. /* element ID assignment of ServiceDiscoveryReq*/
  2071. service->eqn.namespaceURI=4;
  2072. service->eqn.localPart=48;
  2073. /* encode start element ServiceDiscoveryReq */
  2074. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2075. {
  2076. return -1;
  2077. }
  2078. /* encode children of ServiceDiscoveryReq */
  2079. if(serialize_ServiceDiscoveryReqType(&(type->ServiceDiscoveryReq),service)<0)
  2080. {
  2081. return -1;
  2082. }
  2083. /* encode end element of ServiceDiscoveryReq */
  2084. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2085. {
  2086. return -1;
  2087. }}
  2088. if(type->isused.ServiceDiscoveryRes)
  2089. {
  2090. /* element ID assignment of ServiceDiscoveryRes*/
  2091. service->eqn.namespaceURI=4;
  2092. service->eqn.localPart=50;
  2093. /* encode start element ServiceDiscoveryRes */
  2094. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2095. {
  2096. return -1;
  2097. }
  2098. /* encode children of ServiceDiscoveryRes */
  2099. if(serialize_ServiceDiscoveryResType(&(type->ServiceDiscoveryRes),service)<0)
  2100. {
  2101. return -1;
  2102. }
  2103. /* encode end element of ServiceDiscoveryRes */
  2104. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2105. {
  2106. return -1;
  2107. }}
  2108. if(type->isused.ServicePaymentSelectionReq)
  2109. {
  2110. /* element ID assignment of ServicePaymentSelectionReq*/
  2111. service->eqn.namespaceURI=4;
  2112. service->eqn.localPart=53;
  2113. /* encode start element ServicePaymentSelectionReq */
  2114. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2115. {
  2116. return -1;
  2117. }
  2118. /* encode children of ServicePaymentSelectionReq */
  2119. if(serialize_ServicePaymentSelectionReqType(&(type->ServicePaymentSelectionReq),service)<0)
  2120. {
  2121. return -1;
  2122. }
  2123. /* encode end element of ServicePaymentSelectionReq */
  2124. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2125. {
  2126. return -1;
  2127. }}
  2128. if(type->isused.ServicePaymentSelectionRes)
  2129. {
  2130. /* element ID assignment of ServicePaymentSelectionRes*/
  2131. service->eqn.namespaceURI=4;
  2132. service->eqn.localPart=55;
  2133. /* encode start element ServicePaymentSelectionRes */
  2134. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2135. {
  2136. return -1;
  2137. }
  2138. /* encode children of ServicePaymentSelectionRes */
  2139. if(serialize_ServicePaymentSelectionResType(&(type->ServicePaymentSelectionRes),service)<0)
  2140. {
  2141. return -1;
  2142. }
  2143. /* encode end element of ServicePaymentSelectionRes */
  2144. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2145. {
  2146. return -1;
  2147. }}
  2148. if(type->isused.PaymentDetailsReq)
  2149. {
  2150. /* element ID assignment of PaymentDetailsReq*/
  2151. service->eqn.namespaceURI=4;
  2152. service->eqn.localPart=33;
  2153. /* encode start element PaymentDetailsReq */
  2154. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2155. {
  2156. return -1;
  2157. }
  2158. /* encode children of PaymentDetailsReq */
  2159. if(serialize_PaymentDetailsReqType(&(type->PaymentDetailsReq),service)<0)
  2160. {
  2161. return -1;
  2162. }
  2163. /* encode end element of PaymentDetailsReq */
  2164. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2165. {
  2166. return -1;
  2167. }}
  2168. if(type->isused.PaymentDetailsRes)
  2169. {
  2170. /* element ID assignment of PaymentDetailsRes*/
  2171. service->eqn.namespaceURI=4;
  2172. service->eqn.localPart=35;
  2173. /* encode start element PaymentDetailsRes */
  2174. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2175. {
  2176. return -1;
  2177. }
  2178. /* encode children of PaymentDetailsRes */
  2179. if(serialize_PaymentDetailsResType(&(type->PaymentDetailsRes),service)<0)
  2180. {
  2181. return -1;
  2182. }
  2183. /* encode end element of PaymentDetailsRes */
  2184. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2185. {
  2186. return -1;
  2187. }}
  2188. if(type->isused.PowerDiscoveryReq)
  2189. {
  2190. /* element ID assignment of PowerDiscoveryReq*/
  2191. service->eqn.namespaceURI=4;
  2192. service->eqn.localPart=41;
  2193. /* encode start element PowerDiscoveryReq */
  2194. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2195. {
  2196. return -1;
  2197. }
  2198. /* encode children of PowerDiscoveryReq */
  2199. if(serialize_PowerDiscoveryReqType(&(type->PowerDiscoveryReq),service)<0)
  2200. {
  2201. return -1;
  2202. }
  2203. /* encode end element of PowerDiscoveryReq */
  2204. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2205. {
  2206. return -1;
  2207. }}
  2208. if(type->isused.PowerDiscoveryRes)
  2209. {
  2210. /* element ID assignment of PowerDiscoveryRes*/
  2211. service->eqn.namespaceURI=4;
  2212. service->eqn.localPart=43;
  2213. /* encode start element PowerDiscoveryRes */
  2214. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2215. {
  2216. return -1;
  2217. }
  2218. /* encode children of PowerDiscoveryRes */
  2219. if(serialize_PowerDiscoveryResType(&(type->PowerDiscoveryRes),service)<0)
  2220. {
  2221. return -1;
  2222. }
  2223. /* encode end element of PowerDiscoveryRes */
  2224. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2225. {
  2226. return -1;
  2227. }}
  2228. if(type->isused.LineLockReq)
  2229. {
  2230. /* element ID assignment of LineLockReq*/
  2231. service->eqn.namespaceURI=4;
  2232. service->eqn.localPart=11;
  2233. /* encode start element LineLockReq */
  2234. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2235. {
  2236. return -1;
  2237. }
  2238. /* encode children of LineLockReq */
  2239. if(serialize_LineLockReqType(&(type->LineLockReq),service)<0)
  2240. {
  2241. return -1;
  2242. }
  2243. /* encode end element of LineLockReq */
  2244. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2245. {
  2246. return -1;
  2247. }}
  2248. if(type->isused.LineLockRes)
  2249. {
  2250. /* element ID assignment of LineLockRes*/
  2251. service->eqn.namespaceURI=4;
  2252. service->eqn.localPart=13;
  2253. /* encode start element LineLockRes */
  2254. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2255. {
  2256. return -1;
  2257. }
  2258. /* encode children of LineLockRes */
  2259. if(serialize_LineLockResType(&(type->LineLockRes),service)<0)
  2260. {
  2261. return -1;
  2262. }
  2263. /* encode end element of LineLockRes */
  2264. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2265. {
  2266. return -1;
  2267. }}
  2268. if(type->isused.PowerDeliveryReq)
  2269. {
  2270. /* element ID assignment of PowerDeliveryReq*/
  2271. service->eqn.namespaceURI=4;
  2272. service->eqn.localPart=37;
  2273. /* encode start element PowerDeliveryReq */
  2274. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2275. {
  2276. return -1;
  2277. }
  2278. /* encode children of PowerDeliveryReq */
  2279. if(serialize_PowerDeliveryReqType(&(type->PowerDeliveryReq),service)<0)
  2280. {
  2281. return -1;
  2282. }
  2283. /* encode end element of PowerDeliveryReq */
  2284. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2285. {
  2286. return -1;
  2287. }}
  2288. if(type->isused.PowerDeliveryRes)
  2289. {
  2290. /* element ID assignment of PowerDeliveryRes*/
  2291. service->eqn.namespaceURI=4;
  2292. service->eqn.localPart=39;
  2293. /* encode start element PowerDeliveryRes */
  2294. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2295. {
  2296. return -1;
  2297. }
  2298. /* encode children of PowerDeliveryRes */
  2299. if(serialize_PowerDeliveryResType(&(type->PowerDeliveryRes),service)<0)
  2300. {
  2301. return -1;
  2302. }
  2303. /* encode end element of PowerDeliveryRes */
  2304. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2305. {
  2306. return -1;
  2307. }}
  2308. if(type->isused.MeteringStatusReq)
  2309. {
  2310. /* element ID assignment of MeteringStatusReq*/
  2311. service->eqn.namespaceURI=4;
  2312. service->eqn.localPart=21;
  2313. /* encode start element MeteringStatusReq */
  2314. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2315. {
  2316. return -1;
  2317. }
  2318. /* encode children of MeteringStatusReq */
  2319. if(serialize_MeteringStatusReqType(&(type->MeteringStatusReq),service)<0)
  2320. {
  2321. return -1;
  2322. }
  2323. /* encode end element of MeteringStatusReq */
  2324. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2325. {
  2326. return -1;
  2327. }}
  2328. if(type->isused.MeteringStatusRes)
  2329. {
  2330. /* element ID assignment of MeteringStatusRes*/
  2331. service->eqn.namespaceURI=4;
  2332. service->eqn.localPart=23;
  2333. /* encode start element MeteringStatusRes */
  2334. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2335. {
  2336. return -1;
  2337. }
  2338. /* encode children of MeteringStatusRes */
  2339. if(serialize_MeteringStatusResType(&(type->MeteringStatusRes),service)<0)
  2340. {
  2341. return -1;
  2342. }
  2343. /* encode end element of MeteringStatusRes */
  2344. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2345. {
  2346. return -1;
  2347. }}
  2348. if(type->isused.MeteringReceiptReq)
  2349. {
  2350. /* element ID assignment of MeteringReceiptReq*/
  2351. service->eqn.namespaceURI=4;
  2352. service->eqn.localPart=17;
  2353. /* encode start element MeteringReceiptReq */
  2354. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2355. {
  2356. return -1;
  2357. }
  2358. /* encode children of MeteringReceiptReq */
  2359. if(serialize_MeteringReceiptReqType(&(type->MeteringReceiptReq),service)<0)
  2360. {
  2361. return -1;
  2362. }
  2363. /* encode end element of MeteringReceiptReq */
  2364. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2365. {
  2366. return -1;
  2367. }}
  2368. if(type->isused.MeteringReceiptRes)
  2369. {
  2370. /* element ID assignment of MeteringReceiptRes*/
  2371. service->eqn.namespaceURI=4;
  2372. service->eqn.localPart=19;
  2373. /* encode start element MeteringReceiptRes */
  2374. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2375. {
  2376. return -1;
  2377. }
  2378. /* encode children of MeteringReceiptRes */
  2379. if(serialize_MeteringReceiptResType(&(type->MeteringReceiptRes),service)<0)
  2380. {
  2381. return -1;
  2382. }
  2383. /* encode end element of MeteringReceiptRes */
  2384. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2385. {
  2386. return -1;
  2387. }}
  2388. return 0;
  2389. }
  2390. static int serialize_AnonType_V2G_Message(struct AnonType_V2G_Message* type, struct v2gService* service)
  2391. {
  2392. /* element ID assignment of Header*/
  2393. service->eqn.namespaceURI=6;
  2394. service->eqn.localPart=4;
  2395. /* encode start element Header */
  2396. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2397. {
  2398. return -1;
  2399. }
  2400. /* encode children of Header */
  2401. if(serialize_HeaderType(&(type->Header),service)<0)
  2402. {
  2403. return -1;
  2404. }
  2405. /* encode end element of Header */
  2406. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2407. {
  2408. return -1;
  2409. }
  2410. /* element ID assignment of Body*/
  2411. service->eqn.namespaceURI=6;
  2412. service->eqn.localPart=0;
  2413. /* encode start element Body */
  2414. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2415. {
  2416. return -1;
  2417. }
  2418. /* encode children of Body */
  2419. if(serialize_BodyType(&(type->Body),service)<0)
  2420. {
  2421. return -1;
  2422. }
  2423. /* encode end element of Body */
  2424. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2425. {
  2426. return -1;
  2427. }
  2428. return 0;
  2429. }
  2430. /* marshal data to EXI stream */
  2431. int serialize_message(struct v2gService* service)
  2432. {
  2433. /* encode start document */
  2434. if (exiEncodeStartDocument(&(service->outStream), &(service->stateEncode)) < 0)
  2435. {
  2436. return -1;
  2437. }
  2438. /* element ID assignment of V2G_Message*/
  2439. service->eqn.namespaceURI=6;
  2440. service->eqn.localPart=8;
  2441. /* encode start element V2G_Message */
  2442. if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2443. {
  2444. return -1;
  2445. }
  2446. serialize_AnonType_V2G_Message(&(service->v2gMsg), service);
  2447. /* encode end element of V2G_Message */
  2448. if (exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn)) < 0)
  2449. {
  2450. return -1;
  2451. }
  2452. /* encode end document */
  2453. if (exiEncodeEndDocument(&(service->outStream), &(service->stateEncode)) < 0) {
  2454. return -1;
  2455. }
  2456. return 0;
  2457. }