diff --git a/src/service/v2g_service.h b/src/service/v2g_service.h
new file mode 100644
index 0000000..7d9073b
--- /dev/null
+++ b/src/service/v2g_service.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef EXI_SERVICE_H_
+#define EXI_SERVICE_H_
+
+#include "v2g_serviceDataTypes.h"
+#include "EXITypes.h"
+
+struct uniqueIDPath
+{
+ int id[10];
+ size_t pos;
+};
+
+
+struct EXIService
+{
+ /* in-/ out-stream */
+ bitstream_t inStream;
+ bitstream_t outStream;
+
+ /* EXI */
+ exi_state_t stateDecode;
+ exi_state_t stateEncode;
+ exi_event_t event;
+ eqname_t eqn;
+ exi_value_t val;
+
+ /* v2g message data structure */
+ struct EXIDocumentType exiMsg;
+
+ /* unique id for ambiguous elements */
+ struct uniqueIDPath idPath;
+
+ /* error code */
+ uint8_t errorCode;
+
+ /* offset for transport header data */
+ uint16_t transportHeaderOffset;
+};
+
+/* define error codes (TODO: define precise error codes) */
+#define EXI_NON_VALID_MESSAGE 0x01
+#define EXI_SERIALIZATION_FAILED 0x02
+
+#define EXI_UNKNOWN_ERROR 0xFF
+
+#endif /* EXI_SERVICE_H_ */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/service/v2g_serviceClientDataTransmitter.h b/src/service/v2g_serviceClientDataTransmitter.h
new file mode 100644
index 0000000..d8b627d
--- /dev/null
+++ b/src/service/v2g_serviceClientDataTransmitter.h
@@ -0,0 +1,44 @@
+
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef V2G_SERVICECLIENTDATATRANSMITTER_H_
+#define V2G_SERVICECLIENTDATATRANSMITTER_H_
+
+#include "EXITypes.h"
+
+/* This method has to be implemented!
+ * This method sends EXI stream (outStream) to the EVSE and receives response stream (inStream)*/
+int serviceDataTransmitter(uint8_t* outStream, uint16_t outStreamLength, uint8_t* inStream);
+
+#endif /* V2G_SERVICECLIENTDATATRANSMITTER_H_ */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/service/v2g_serviceClientStubs.c b/src/service/v2g_serviceClientStubs.c
new file mode 100644
index 0000000..dad79f7
--- /dev/null
+++ b/src/service/v2g_serviceClientStubs.c
@@ -0,0 +1,1698 @@
+
+
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+
+ #include "v2g_serviceDataTypes.h"
+ #include "v2g_serviceDataTypes.c"
+ #include "v2g_serviceClientStubs.h"
+ #include "v2g_serviceDataSerialization.c"
+ #include "v2g_serviceClientDataTransmitter.h"
+ #include "EXITypes.h"
+ #include "EXIDecoder.h"
+ #include "EXIEncoder.h"
+
+
+static int deserializeMessage(struct EXIService* service);
+
+/**
+ * \brief Calls the remote sessionSetup method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct SessionSetupReqType* Request data for the server (has to be set up before)
+ * \param result struct SessionSetupResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+int call_sessionSetup(struct EXIService* service, struct HeaderType* header, struct SessionSetupReqType* params, struct SessionSetupResType* result)
+{
+ uint16_t posEncode, posDecode;
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ /* init outStream data structure */
+ posEncode = service->transportHeaderOffset;
+ service->outStream.pos = &posEncode;
+ service->outStream.buffer = 0;
+ service->outStream.capacity = 8;
+
+ /* init encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init inStream data structure */
+ posDecode = service->transportHeaderOffset;
+ service->inStream.pos = &posDecode;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+
+
+ /* assign data to service data structure */
+ service->exiMsg.V2G_Message.Header = header;
+ service->exiMsg.V2G_Message.Body.SessionSetupReq = params;
+ service->exiMsg.V2G_Message.Body.isused.SessionSetupReq=1;
+
+ /* encode data to exi stream*/
+ if(serialize_message(service))
+ {
+
+ return -1;
+ }
+
+ /* send data to server and wait for the response message */
+ service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
+ if(service->errorCode)
+ {
+ return -1;
+ }
+
+
+
+ service->exiMsg.V2G_Message.Body.SessionSetupRes = result;
+
+ /* init decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* deserilize the response message */
+ if(deserializeMessage(service)<0)
+ {
+
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+/**
+ * \brief Calls the remote serviceDiscovery method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct ServiceDiscoveryReqType* Request data for the server (has to be set up before)
+ * \param result struct ServiceDiscoveryResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+int call_serviceDiscovery(struct EXIService* service, struct HeaderType* header, struct ServiceDiscoveryReqType* params, struct ServiceDiscoveryResType* result)
+{
+ uint16_t posEncode, posDecode;
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ /* init outStream data structure */
+ posEncode = service->transportHeaderOffset;
+ service->outStream.pos = &posEncode;
+ service->outStream.buffer = 0;
+ service->outStream.capacity = 8;
+
+ /* init encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init inStream data structure */
+ posDecode = service->transportHeaderOffset;
+ service->inStream.pos = &posDecode;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+
+
+ /* assign data to service data structure */
+ service->exiMsg.V2G_Message.Header = header;
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq = params;
+ service->exiMsg.V2G_Message.Body.isused.ServiceDiscoveryReq=1;
+
+ /* encode data to exi stream*/
+ if(serialize_message(service))
+ {
+
+ return -1;
+ }
+
+ /* send data to server and wait for the response message */
+ service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
+ if(service->errorCode)
+ {
+ return -1;
+ }
+
+
+
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes = result;
+
+ /* init decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* deserilize the response message */
+ if(deserializeMessage(service)<0)
+ {
+
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+/**
+ * \brief Calls the remote selectedServicePayment method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct ServicePaymentSelectionReqType* Request data for the server (has to be set up before)
+ * \param result struct ServicePaymentSelectionResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+int call_selectedServicePayment(struct EXIService* service, struct HeaderType* header, struct ServicePaymentSelectionReqType* params, struct ServicePaymentSelectionResType* result)
+{
+ uint16_t posEncode, posDecode;
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ /* init outStream data structure */
+ posEncode = service->transportHeaderOffset;
+ service->outStream.pos = &posEncode;
+ service->outStream.buffer = 0;
+ service->outStream.capacity = 8;
+
+ /* init encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init inStream data structure */
+ posDecode = service->transportHeaderOffset;
+ service->inStream.pos = &posDecode;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+
+
+ /* assign data to service data structure */
+ service->exiMsg.V2G_Message.Header = header;
+ service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq = params;
+ service->exiMsg.V2G_Message.Body.isused.ServicePaymentSelectionReq=1;
+
+ /* encode data to exi stream*/
+ if(serialize_message(service))
+ {
+
+ return -1;
+ }
+
+ /* send data to server and wait for the response message */
+ service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
+ if(service->errorCode)
+ {
+ return -1;
+ }
+
+
+
+ service->exiMsg.V2G_Message.Body.ServicePaymentSelectionRes = result;
+
+ /* init decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* deserilize the response message */
+ if(deserializeMessage(service)<0)
+ {
+
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+/**
+ * \brief Calls the remote paymentDetails method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct PaymentDetailsReqType* Request data for the server (has to be set up before)
+ * \param result struct PaymentDetailsResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+int call_paymentDetails(struct EXIService* service, struct HeaderType* header, struct PaymentDetailsReqType* params, struct PaymentDetailsResType* result)
+{
+ uint16_t posEncode, posDecode;
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ /* init outStream data structure */
+ posEncode = service->transportHeaderOffset;
+ service->outStream.pos = &posEncode;
+ service->outStream.buffer = 0;
+ service->outStream.capacity = 8;
+
+ /* init encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init inStream data structure */
+ posDecode = service->transportHeaderOffset;
+ service->inStream.pos = &posDecode;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+
+
+ /* assign data to service data structure */
+ service->exiMsg.V2G_Message.Header = header;
+ service->exiMsg.V2G_Message.Body.PaymentDetailsReq = params;
+ service->exiMsg.V2G_Message.Body.isused.PaymentDetailsReq=1;
+
+ /* encode data to exi stream*/
+ if(serialize_message(service))
+ {
+
+ return -1;
+ }
+
+ /* send data to server and wait for the response message */
+ service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
+ if(service->errorCode)
+ {
+ return -1;
+ }
+
+
+
+ service->exiMsg.V2G_Message.Body.PaymentDetailsRes = result;
+
+ /* init decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* deserilize the response message */
+ if(deserializeMessage(service)<0)
+ {
+
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+/**
+ * \brief Calls the remote powerDiscovery method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct PowerDiscoveryReqType* Request data for the server (has to be set up before)
+ * \param result struct PowerDiscoveryResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+int call_powerDiscovery(struct EXIService* service, struct HeaderType* header, struct PowerDiscoveryReqType* params, struct PowerDiscoveryResType* result)
+{
+ uint16_t posEncode, posDecode;
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ /* init outStream data structure */
+ posEncode = service->transportHeaderOffset;
+ service->outStream.pos = &posEncode;
+ service->outStream.buffer = 0;
+ service->outStream.capacity = 8;
+
+ /* init encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init inStream data structure */
+ posDecode = service->transportHeaderOffset;
+ service->inStream.pos = &posDecode;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+
+
+ /* assign data to service data structure */
+ service->exiMsg.V2G_Message.Header = header;
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq = params;
+ service->exiMsg.V2G_Message.Body.isused.PowerDiscoveryReq=1;
+
+ /* encode data to exi stream*/
+ if(serialize_message(service))
+ {
+
+ return -1;
+ }
+
+ /* send data to server and wait for the response message */
+ service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
+ if(service->errorCode)
+ {
+ return -1;
+ }
+
+
+
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes = result;
+
+ /* init decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* deserilize the response message */
+ if(deserializeMessage(service)<0)
+ {
+
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+/**
+ * \brief Calls the remote lineLock method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct LineLockReqType* Request data for the server (has to be set up before)
+ * \param result struct LineLockResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+int call_lineLock(struct EXIService* service, struct HeaderType* header, struct LineLockReqType* params, struct LineLockResType* result)
+{
+ uint16_t posEncode, posDecode;
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ /* init outStream data structure */
+ posEncode = service->transportHeaderOffset;
+ service->outStream.pos = &posEncode;
+ service->outStream.buffer = 0;
+ service->outStream.capacity = 8;
+
+ /* init encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init inStream data structure */
+ posDecode = service->transportHeaderOffset;
+ service->inStream.pos = &posDecode;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+
+
+ /* assign data to service data structure */
+ service->exiMsg.V2G_Message.Header = header;
+ service->exiMsg.V2G_Message.Body.LineLockReq = params;
+ service->exiMsg.V2G_Message.Body.isused.LineLockReq=1;
+
+ /* encode data to exi stream*/
+ if(serialize_message(service))
+ {
+
+ return -1;
+ }
+
+ /* send data to server and wait for the response message */
+ service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
+ if(service->errorCode)
+ {
+ return -1;
+ }
+
+
+
+ service->exiMsg.V2G_Message.Body.LineLockRes = result;
+
+ /* init decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* deserilize the response message */
+ if(deserializeMessage(service)<0)
+ {
+
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+/**
+ * \brief Calls the remote powerDelivery method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct PowerDeliveryReqType* Request data for the server (has to be set up before)
+ * \param result struct PowerDeliveryResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+int call_powerDelivery(struct EXIService* service, struct HeaderType* header, struct PowerDeliveryReqType* params, struct PowerDeliveryResType* result)
+{
+ uint16_t posEncode, posDecode;
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ /* init outStream data structure */
+ posEncode = service->transportHeaderOffset;
+ service->outStream.pos = &posEncode;
+ service->outStream.buffer = 0;
+ service->outStream.capacity = 8;
+
+ /* init encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init inStream data structure */
+ posDecode = service->transportHeaderOffset;
+ service->inStream.pos = &posDecode;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+
+
+ /* assign data to service data structure */
+ service->exiMsg.V2G_Message.Header = header;
+ service->exiMsg.V2G_Message.Body.PowerDeliveryReq = params;
+ service->exiMsg.V2G_Message.Body.isused.PowerDeliveryReq=1;
+
+ /* encode data to exi stream*/
+ if(serialize_message(service))
+ {
+
+ return -1;
+ }
+
+ /* send data to server and wait for the response message */
+ service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
+ if(service->errorCode)
+ {
+ return -1;
+ }
+
+
+
+ service->exiMsg.V2G_Message.Body.PowerDeliveryRes = result;
+
+ /* init decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* deserilize the response message */
+ if(deserializeMessage(service)<0)
+ {
+
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+/**
+ * \brief Calls the remote meteringStatus method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param result struct MeteringStatusResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+int call_meteringStatus(struct EXIService* service, struct HeaderType* header, struct MeteringStatusResType* result)
+{
+ uint16_t posEncode, posDecode;
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ /* init outStream data structure */
+ posEncode = service->transportHeaderOffset;
+ service->outStream.pos = &posEncode;
+ service->outStream.buffer = 0;
+ service->outStream.capacity = 8;
+
+ /* init encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init inStream data structure */
+ posDecode = service->transportHeaderOffset;
+ service->inStream.pos = &posDecode;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+
+
+ /* assign data to service data structure */
+ service->exiMsg.V2G_Message.Header = header;
+ service->exiMsg.V2G_Message.Body.isused.MeteringStatusReq=1;
+
+ /* encode data to exi stream*/
+ if(serialize_message(service))
+ {
+
+ return -1;
+ }
+
+ /* send data to server and wait for the response message */
+ service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
+ if(service->errorCode)
+ {
+ return -1;
+ }
+
+
+
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes = result;
+
+ /* init decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* deserilize the response message */
+ if(deserializeMessage(service)<0)
+ {
+
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+/**
+ * \brief Calls the remote meteringReceipt method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct MeteringReceiptReqType* Request data for the server (has to be set up before)
+ * \param result struct MeteringReceiptResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+int call_meteringReceipt(struct EXIService* service, struct HeaderType* header, struct MeteringReceiptReqType* params, struct MeteringReceiptResType* result)
+{
+ uint16_t posEncode, posDecode;
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ /* init outStream data structure */
+ posEncode = service->transportHeaderOffset;
+ service->outStream.pos = &posEncode;
+ service->outStream.buffer = 0;
+ service->outStream.capacity = 8;
+
+ /* init encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init inStream data structure */
+ posDecode = service->transportHeaderOffset;
+ service->inStream.pos = &posDecode;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+
+
+ /* assign data to service data structure */
+ service->exiMsg.V2G_Message.Header = header;
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq = params;
+ service->exiMsg.V2G_Message.Body.isused.MeteringReceiptReq=1;
+
+ /* encode data to exi stream*/
+ if(serialize_message(service))
+ {
+
+ return -1;
+ }
+
+ /* send data to server and wait for the response message */
+ service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
+ if(service->errorCode)
+ {
+ return -1;
+ }
+
+
+
+ service->exiMsg.V2G_Message.Body.MeteringReceiptRes = result;
+
+ /* init decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* deserilize the response message */
+ if(deserializeMessage(service)<0)
+ {
+
+ return -1;
+ }
+
+
+
+ return 0;
+}
+
+
+
+ /**
+ * Deserialize an element value of the EXI stream and assign it to the
+ * service data structure
+ */
+static int deserializeElementCharacter(struct EXIService* service)
+{
+
+ switch(service->eqn.namespaceURI) {
+ case 4:
+ switch(service->eqn.localPart) {
+ case 44: /*ResponseCode*/
+ if(service->val.type == ENUMERATION)
+ {
+ if(service->idPath.id[2] == 58)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupRes->ResponseCode=service->val.enumeration;
+
+
+ } else if(service->idPath.id[2] == 47)
+ {
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ResponseCode=service->val.enumeration;
+
+
+ } else if(service->idPath.id[2] == 52)
+ {
+ service->exiMsg.V2G_Message.Body.ServicePaymentSelectionRes->ResponseCode=service->val.enumeration;
+
+
+ } else if(service->idPath.id[2] == 32)
+ {
+ service->exiMsg.V2G_Message.Body.PaymentDetailsRes->ResponseCode=service->val.enumeration;
+
+
+ } else if(service->idPath.id[2] == 40)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->ResponseCode=service->val.enumeration;
+
+
+ } else if(service->idPath.id[2] == 12)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockRes->ResponseCode=service->val.enumeration;
+
+
+ } else if(service->idPath.id[2] == 36)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDeliveryRes->ResponseCode=service->val.enumeration;
+
+
+ } else if(service->idPath.id[2] == 21)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->ResponseCode=service->val.enumeration;
+
+
+ } else if(service->idPath.id[2] == 17)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringReceiptRes->ResponseCode=service->val.enumeration;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 2: /*EVSEID*/
+
+ if(service->val.type == BINARY_HEX)
+ {
+ if(service->idPath.id[2]==58)
+ {
+ /* array copy and array length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.SessionSetupRes->EVSEID.data, service->val.binary.data,service->val.binary.len);
+ service->exiMsg.V2G_Message.Body.SessionSetupRes->EVSEID.arraylen.data = service->val.binary.len;
+ }
+ else
+ {
+ memcpy(service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEID.data, service->val.binary.data,service->val.binary.len);
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEID.arraylen.data = service->val.binary.len;
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 60: /*TCurrent*/
+ if(service->val.type == INTEGER_32)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupRes->TCurrent=service->val.int32;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 4: /*EVSEMaxPhases*/
+ if(service->val.type == INTEGER_16)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEMaxPhases=service->val.int32;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 8: /*EnergyProvider*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EnergyProvider.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EnergyProvider.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->isused.EnergyProvider=1;
+ break;
+ } /* close switch(service->eqn.localPart) */
+ break;
+ case 5:
+ switch(service->eqn.localPart) {
+ case 34: /*SessionID*/
+
+ if(service->val.type == BINARY_HEX)
+ {
+ /* array copy and array length assignment */
+ memcpy(service->exiMsg.V2G_Message.Header->SessionInformation.SessionID.data, service->val.binary.data,service->val.binary.len);
+ service->exiMsg.V2G_Message.Header->SessionInformation.SessionID.arraylen.data = service->val.binary.len;
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 32: /*ServiceSessionID*/
+
+ if(service->val.type == BINARY_HEX)
+ {
+ /* array copy and array length assignment */
+ memcpy(service->exiMsg.V2G_Message.Header->SessionInformation.ServiceSessionID.data, service->val.binary.data,service->val.binary.len);
+ service->exiMsg.V2G_Message.Header->SessionInformation.ServiceSessionID.arraylen.data = service->val.binary.len;
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->SessionInformation.isused.ServiceSessionID=1;
+ break;
+ case 24: /*ProtocolVersion*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Header->SessionInformation.ProtocolVersion.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Header->SessionInformation.ProtocolVersion.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->SessionInformation.isused.ProtocolVersion=1;
+ break;
+ case 9: /*Event*/
+ if(service->val.type == ENUMERATION)
+ {
+ service->exiMsg.V2G_Message.Header->Notification.EventList.Event=service->val.enumeration;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 13: /*FaultCode*/
+ if(service->val.type == ENUMERATION)
+ {
+ service->exiMsg.V2G_Message.Header->Notification.FaultCode=service->val.enumeration;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->Notification.isused.FaultCode=1;
+ break;
+ case 14: /*FaultMsg*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Header->Notification.FaultMsg.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Header->Notification.FaultMsg.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->Notification.isused.FaultMsg=1;
+ break;
+ case 12: /*FatalError*/
+ if(service->val.type == BOOLEAN)
+ {
+ if(service->idPath.id[2] == 58)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupRes->EVSEStatus.FatalError=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 40)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEStatus.FatalError=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 12)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockRes->EVSEStatus.FatalError=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 21)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEStatus.FatalError=service->val.boolean;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 7: /*EVSEStandby*/
+ if(service->val.type == BOOLEAN)
+ {
+ if(service->idPath.id[2] == 58)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupRes->EVSEStatus.EVSEStandby=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 40)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEStatus.EVSEStandby=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 12)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockRes->EVSEStatus.EVSEStandby=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 21)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEStatus.EVSEStandby=service->val.boolean;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 4: /*ConnectorLocked*/
+ if(service->val.type == BOOLEAN)
+ {
+ if(service->idPath.id[2] == 58)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupRes->EVSEStatus.ConnectorLocked=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 40)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEStatus.ConnectorLocked=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 12)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockRes->EVSEStatus.ConnectorLocked=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 21)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEStatus.ConnectorLocked=service->val.boolean;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 23: /*PowerSwitchClosed*/
+ if(service->val.type == BOOLEAN)
+ {
+ if(service->idPath.id[2] == 58)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupRes->EVSEStatus.PowerSwitchClosed=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 40)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEStatus.PowerSwitchClosed=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 12)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockRes->EVSEStatus.PowerSwitchClosed=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 21)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEStatus.PowerSwitchClosed=service->val.boolean;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 25: /*RCD*/
+ if(service->val.type == BOOLEAN)
+ {
+ if(service->idPath.id[2] == 58)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupRes->EVSEStatus.RCD=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 40)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEStatus.RCD=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 12)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockRes->EVSEStatus.RCD=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 21)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEStatus.RCD=service->val.boolean;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 36: /*ShutDownTime*/
+ if(service->val.type == INTEGER_32)
+ {
+ if(service->idPath.id[2] == 58)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupRes->EVSEStatus.ShutDownTime=service->val.int32;
+
+
+ } else if(service->idPath.id[2] == 40)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEStatus.ShutDownTime=service->val.int32;
+
+
+ } else if(service->idPath.id[2] == 12)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockRes->EVSEStatus.ShutDownTime=service->val.int32;
+
+
+ } else if(service->idPath.id[2] == 21)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEStatus.ShutDownTime=service->val.int32;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 28: /*ServiceID*/
+
+ if(service->val.type == BINARY_HEX)
+ {
+ /* array copy and array length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceID.data, service->val.binary.data,service->val.binary.len);
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceID.arraylen.data = service->val.binary.len;
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 30: /*ServiceName*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceName.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceName.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].isused.ServiceName=1;
+ break;
+ case 33: /*ServiceType*/
+ if(service->val.type == ENUMERATION)
+ {
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceType=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].isused.ServiceType=1;
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].isused.ServiceType=1;
+ break;
+ case 31: /*ServiceScope*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceScope.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceScope.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].isused.ServiceScope=1;
+ break;
+ case 20: /*Multiplier*/
+ if(service->val.type == ENUMERATION)
+ {
+ if(service->idPath.id[3] == 7)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEVoltage.Multiplier=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 3)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEIMax.Multiplier=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 5)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEMaxPower.Multiplier=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 23)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->PCurrent.Multiplier=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->isused.PCurrent=1;
+
+
+ } else if(service->idPath.id[1] == 0)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.MeterReading.Multiplier=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.MeterReading=1;
+
+
+ } else if(service->idPath.id[7] == 46)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Multiplier=service->val.enumeration;
+
+
+ } else if(service->idPath.id[7] == 6)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Multiplier=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].isused.EPrice=1;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 49: /*Unit*/
+ if(service->val.type == ENUMERATION)
+ {
+ if(service->idPath.id[3] == 7)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEVoltage.Unit=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 3)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEIMax.Unit=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 5)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEMaxPower.Unit=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 23)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->PCurrent.Unit=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->isused.PCurrent=1;
+
+
+ } else if(service->idPath.id[1] == 0)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.MeterReading.Unit=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.MeterReading=1;
+
+
+ } else if(service->idPath.id[7] == 46)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Unit=service->val.enumeration;
+
+
+ } else if(service->idPath.id[7] == 6)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Unit=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].isused.EPrice=1;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 50: /*Value*/
+ if(service->val.type == INTEGER_32)
+ {
+ if(service->idPath.id[3] == 7)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEVoltage.Value=service->val.int32;
+
+
+ } else if(service->idPath.id[3] == 3)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->EVSEIMax.Value=service->val.int32;
+
+
+ } else if(service->idPath.id[3] == 5)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->EVSEMaxPower.Value=service->val.int32;
+
+
+ } else if(service->idPath.id[3] == 23)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->PCurrent.Value=service->val.int32;
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->isused.PCurrent=1;
+
+
+ } else if(service->idPath.id[1] == 0)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.MeterReading.Value=service->val.int32;
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.MeterReading=1;
+
+
+ } else if(service->idPath.id[7] == 46)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Value=service->val.int32;
+
+
+ } else if(service->idPath.id[7] == 6)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Value=service->val.int32;
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].isused.EPrice=1;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 47: /*TariffStart*/
+ if(service->val.type == UNSIGNED_INTEGER_32)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffStart=service->val.uint32;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 45: /*TariffID*/
+ if(service->val.type == ENUMERATION)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffID=service->val.enumeration;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 40: /*TariffDescription*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffDescription.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffDescription.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].isused.TariffDescription=1;
+ break;
+ case 5: /*Currency*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Currency.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Currency.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 16: /*MeterID*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.MeterID.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.MeterID.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.MeterID=1;
+ break;
+ case 19: /*MeterStatus*/
+ if(service->val.type == INTEGER_16)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.MeterStatus=service->val.int32;
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->isused.MeterInfo=1;
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.MeterStatus=1;
+ break;
+ case 37: /*TMeter*/
+ if(service->val.type == INTEGER_32)
+ {
+
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.TMeter=service->val.int32;
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->isused.MeterInfo=1;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.TMeter=1;
+ break;
+ } /* close switch(service->eqn.localPart) */
+ break;
+
+ } /* close switch(service->eqn.namespaceURI) */
+ return 0;
+}
+
+/**
+ * Deserialize an element of the EXI stream
+ * @return 0 = 0K; -1 = ERROR
+ */
+static int deserializeElement(struct EXIService* service)
+{
+ switch(service->eqn.namespaceURI) {
+ case 4:
+ switch(service->eqn.localPart) {
+ case 49:/* ServiceList */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->isused.ServiceList=1;
+ break;
+ case 8:/* EnergyProvider */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->isused.EnergyProvider=1;
+ break;
+ case 62:/* TariffTable */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->isused.TariffTable=1;
+ break;
+ case 23:/* PCurrent */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->isused.PCurrent=1;
+ break;
+ case 14:/* MeterInfo */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->isused.MeterInfo=1;
+ break;
+ case 58:/* SessionSetupRes */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.isused.SessionSetupRes=1;
+ break;
+ case 47:/* ServiceDiscoveryRes */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.isused.ServiceDiscoveryRes=1;
+ break;
+ case 52:/* ServicePaymentSelectionRes */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.isused.ServicePaymentSelectionRes=1;
+ break;
+ case 32:/* PaymentDetailsRes */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.isused.PaymentDetailsRes=1;
+ break;
+ case 40:/* PowerDiscoveryRes */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.isused.PowerDiscoveryRes=1;
+ break;
+ case 12:/* LineLockRes */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.isused.LineLockRes=1;
+ break;
+ case 36:/* PowerDeliveryRes */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.isused.PowerDeliveryRes=1;
+ break;
+ case 21:/* MeteringStatusRes */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.isused.MeteringStatusRes=1;
+ break;
+ case 17:/* MeteringReceiptRes */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.isused.MeteringReceiptRes=1;
+ break;
+ }
+ break;case 5:
+ switch(service->eqn.localPart) {
+ case 32:/* ServiceSessionID */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->SessionInformation.isused.ServiceSessionID=1;
+ break;
+ case 24:/* ProtocolVersion */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->SessionInformation.isused.ProtocolVersion=1;
+ break;
+ case 13:/* FaultCode */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->Notification.isused.FaultCode=1;
+ break;
+ case 14:/* FaultMsg */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->Notification.isused.FaultMsg=1;
+ break;
+ case 10:/* EventList */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->Notification.isused.EventList=1;
+ break;
+ case 30:/* ServiceName */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].isused.ServiceName=1;
+ break;
+ case 31:/* ServiceScope */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].isused.ServiceScope=1;
+ break;
+ case 26:/* Service */
+
+ /* increment */
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service++;
+ break;
+ case 6:/* EPrice */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].isused.EPrice=1;
+ break;
+ case 43:/* TariffEntry */
+
+ /* increment */
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry++;
+ break;
+ case 40:/* TariffDescription */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.Tariff[service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff].isused.TariffDescription=1;
+ break;
+ case 38:/* Tariff */
+
+ /* increment */
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes->TariffTable.arraylen.Tariff++;
+ break;
+ case 16:/* MeterID */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.MeterID=1;
+ break;
+ case 18:/* MeterReading */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.MeterReading=1;
+ break;
+ }
+ break;case 7:
+ switch(service->eqn.localPart) {
+ case 1:/* Notification */
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->isused.Notification=1;
+ break;
+ }
+ break;
+ }
+ return 0;
+}
+
+
+
+
+ /**
+ * Deserialize the EXI stream
+ * @return 0 = 0K; -1 = ERROR
+ */
+static int deserializeMessage(struct EXIService* service)
+{
+ int noEndOfDocument = 1; /* true */
+ int returnCode=0;
+
+
+ do {
+ exiDecodeNextEvent(&(service->inStream), &(service->stateDecode), &(service->event));
+ if (returnCode < 0) {
+ printf("[ERROR] %d \n", returnCode);
+ return returnCode;
+ }
+
+ switch (service->event) {
+ case START_DOCUMENT:
+
+ returnCode = exiDecodeStartDocument(&(service->inStream), &(service->stateDecode));
+
+ break;
+ case END_DOCUMENT:
+
+ returnCode = exiDecodeEndDocument(&(service->inStream), &(service->stateDecode));
+ noEndOfDocument = 0; /* false */
+ break;
+ case START_ELEMENT:
+ returnCode = exiDecodeStartElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
+ service->idPath.id[service->idPath.pos++]=service->eqn.localPart;
+
+ break;
+ case END_ELEMENT:
+
+ returnCode = exiDecodeEndElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
+ service->idPath.pos--;
+
+ returnCode = deserializeElement(service);
+ break;
+ case CHARACTERS:
+ /* decode */
+ returnCode = exiDecodeCharacters(&(service->inStream), &(service->stateDecode), &(service->val));
+
+ /* assign character data to the v2g message structure */
+ returnCode = deserializeElementCharacter(service);
+ break;
+ case ATTRIBUTE:
+ /* decode */
+ /* returnCode = exiDecodeAttribute(&isStream, &stateDecode, &eqn, &val); */
+ break;
+ default:
+ /* ERROR */
+ return -1;
+ }
+
+ } while (noEndOfDocument);
+
+ return 0;
+}
+
+
+
+ /* Initialize the v2g client */
+int init_v2gServiceClient(struct EXIService* service, bytes_t bytes, string_ucs_t string, uint8_t* inStream, size_t max_inStream_size, uint8_t* outStream, size_t max_outStream_size, uint16_t transportHeaderOffset)
+{
+
+ /* init byte array */
+ service->val.binary = bytes;
+
+ /* init string array */
+ service->val.string = string;
+
+ /* init input / output stream */
+ service->inStream.data=inStream;
+ service->inStream.size=max_inStream_size;
+
+ service->outStream.data=outStream;
+ service->outStream.size=max_outStream_size;
+
+ /* init offset for transport protocoll */
+ service->transportHeaderOffset=transportHeaderOffset;
+
+ return 0;
+}
+
diff --git a/src/service/v2g_serviceClientStubs.h b/src/service/v2g_serviceClientStubs.h
new file mode 100644
index 0000000..f20c38a
--- /dev/null
+++ b/src/service/v2g_serviceClientStubs.h
@@ -0,0 +1,158 @@
+
+
+
+
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+
+
+ #ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SERVICECLIENTSTUBS_H
+#define SERVICECLIENTSTUBS_H
+
+ #include "v2g_service.h"
+ #include "v2g_serviceDataTypes.h"
+ #include "v2g_serviceClientStubs.h"
+
+/**
+ * \brief Calls the remote sessionSetup method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct SessionSetupReqType* Request data for the server (has to be set up before)
+ * \param result struct SessionSetupResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+ int call_sessionSetup(struct EXIService* service, struct HeaderType* header, struct SessionSetupReqType* params, struct SessionSetupResType* result);
+
+
+
+
+/**
+ * \brief Calls the remote serviceDiscovery method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct ServiceDiscoveryReqType* Request data for the server (has to be set up before)
+ * \param result struct ServiceDiscoveryResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+ int call_serviceDiscovery(struct EXIService* service, struct HeaderType* header, struct ServiceDiscoveryReqType* params, struct ServiceDiscoveryResType* result);
+
+
+
+
+/**
+ * \brief Calls the remote selectedServicePayment method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct ServicePaymentSelectionReqType* Request data for the server (has to be set up before)
+ * \param result struct ServicePaymentSelectionResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+ int call_selectedServicePayment(struct EXIService* service, struct HeaderType* header, struct ServicePaymentSelectionReqType* params, struct ServicePaymentSelectionResType* result);
+
+
+
+
+/**
+ * \brief Calls the remote paymentDetails method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct PaymentDetailsReqType* Request data for the server (has to be set up before)
+ * \param result struct PaymentDetailsResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+ int call_paymentDetails(struct EXIService* service, struct HeaderType* header, struct PaymentDetailsReqType* params, struct PaymentDetailsResType* result);
+
+
+
+
+/**
+ * \brief Calls the remote powerDiscovery method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct PowerDiscoveryReqType* Request data for the server (has to be set up before)
+ * \param result struct PowerDiscoveryResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+ int call_powerDiscovery(struct EXIService* service, struct HeaderType* header, struct PowerDiscoveryReqType* params, struct PowerDiscoveryResType* result);
+
+
+
+
+/**
+ * \brief Calls the remote lineLock method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct LineLockReqType* Request data for the server (has to be set up before)
+ * \param result struct LineLockResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+ int call_lineLock(struct EXIService* service, struct HeaderType* header, struct LineLockReqType* params, struct LineLockResType* result);
+
+
+
+
+/**
+ * \brief Calls the remote powerDelivery method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct PowerDeliveryReqType* Request data for the server (has to be set up before)
+ * \param result struct PowerDeliveryResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+ int call_powerDelivery(struct EXIService* service, struct HeaderType* header, struct PowerDeliveryReqType* params, struct PowerDeliveryResType* result);
+
+
+
+
+/**
+ * \brief Calls the remote meteringStatus method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param result struct MeteringStatusResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+ int call_meteringStatus(struct EXIService* service, struct HeaderType* header, struct MeteringStatusResType* result);
+
+
+
+
+/**
+ * \brief Calls the remote meteringReceipt method
+ * \param service struct EXIService* Service data structure (has to be initialized before)
+ * \param header struct HeaderType* Header data structure
+ * \param params struct MeteringReceiptReqType* Request data for the server (has to be set up before)
+ * \param result struct MeteringReceiptResType* Contains the response data from the server
+ * \return 0 = 0K; -1 = ERROR */
+ int call_meteringReceipt(struct EXIService* service, struct HeaderType* header, struct MeteringReceiptReqType* params, struct MeteringReceiptResType* result);
+
+
+
+
+
+ /* Initialize the v2g client */
+ int init_v2gServiceClient(struct EXIService* service, bytes_t bytes, string_ucs_t string, uint8_t* inStream, size_t max_inStream_size, uint8_t* outStream, size_t max_outStream_size, uint16_t transportHeaderOffset);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/service/v2g_serviceDataSerialization.c b/src/service/v2g_serviceDataSerialization.c
new file mode 100644
index 0000000..fb25fd2
--- /dev/null
+++ b/src/service/v2g_serviceDataSerialization.c
@@ -0,0 +1,2996 @@
+
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+
+#include "v2g_service.h"
+#include "v2g_serviceDataTypes.h"
+/* #include "v2g_serviceDataSerializiation.h" */
+#include "EXITypes.h"
+#include "EXIEncoder.h"
+
+
+
+
+
+
+static int serialize_SessionInformationType(struct SessionInformationType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of SessionID*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=34;
+ /* encode start element SessionID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+ service->val.type = BINARY_HEX;
+ service->val.binary.len = type->SessionID.arraylen.data;
+ service->val.binary.data= type->SessionID.data;
+
+ /* encode character SessionID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+
+ /* encode end element of SessionID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.ServiceSessionID)
+ {
+
+ /* element ID assignment of ServiceSessionID*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=32;
+ /* encode start element ServiceSessionID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+ service->val.type = BINARY_HEX;
+ service->val.binary.len = type->ServiceSessionID.arraylen.data;
+ service->val.binary.data= type->ServiceSessionID.data;
+
+ /* encode character ServiceSessionID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+
+ /* encode end element of ServiceSessionID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.ProtocolVersion)
+ {
+
+ /* element ID assignment of ProtocolVersion*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=24;
+ /* encode start element ProtocolVersion */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->ProtocolVersion.arraylen.data;
+ service->val.string.codepoints = type->ProtocolVersion.data;
+
+ /* encode character ProtocolVersion */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ProtocolVersion */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_EventListType(struct EventListType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of Event*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=9;
+ /* encode start element Event */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->Event;
+
+ /* encode character Event */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of Event */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_NotificationType(struct NotificationType* type, struct EXIService* service)
+{
+
+ if(type->isused.FaultCode)
+ {
+
+ /* element ID assignment of FaultCode*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=13;
+ /* encode start element FaultCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->FaultCode;
+
+ /* encode character FaultCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of FaultCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.FaultMsg)
+ {
+
+ /* element ID assignment of FaultMsg*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=14;
+ /* encode start element FaultMsg */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->FaultMsg.arraylen.data;
+ service->val.string.codepoints = type->FaultMsg.data;
+
+ /* encode character FaultMsg */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of FaultMsg */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.EventList)
+ {
+
+ /* element ID assignment of EventList*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=10;
+ /* encode start element EventList */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EventList */
+ if(serialize_EventListType( &(type->EventList),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EventList */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_HeaderType(struct HeaderType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of SessionInformation*/
+ service->eqn.namespaceURI=7;
+ service->eqn.localPart=2;
+ /* encode start element SessionInformation */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of SessionInformation */
+ if(serialize_SessionInformationType( &(type->SessionInformation),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of SessionInformation */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.Notification)
+ {
+
+ /* element ID assignment of Notification*/
+ service->eqn.namespaceURI=7;
+ service->eqn.localPart=1;
+ /* encode start element Notification */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of Notification */
+ if(serialize_NotificationType( &(type->Notification),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of Notification */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_PEVStatusType(struct PEVStatusType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ConnectorLocked*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=4;
+ /* encode start element ConnectorLocked */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = BOOLEAN;
+ service->val.boolean=type->ConnectorLocked;
+
+ /* encode character ConnectorLocked */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ConnectorLocked */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of ChargerStandby*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=0;
+ /* encode start element ChargerStandby */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = BOOLEAN;
+ service->val.boolean=type->ChargerStandby;
+
+ /* encode character ChargerStandby */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ChargerStandby */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_SessionSetupReqType(struct SessionSetupReqType* type, struct EXIService* service)
+{
+
+ if(type->isused.PEVID)
+ {
+
+ /* element ID assignment of PEVID*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=24;
+ /* encode start element PEVID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->PEVID.arraylen.data;
+ service->val.string.codepoints = type->PEVID.data;
+
+ /* encode character PEVID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of PEVID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ /* element ID assignment of PEVStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=29;
+ /* encode start element PEVStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PEVStatus */
+ if(serialize_PEVStatusType( &(type->PEVStatus),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PEVStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_EVSEStatusType(struct EVSEStatusType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of FatalError*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=12;
+ /* encode start element FatalError */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = BOOLEAN;
+ service->val.boolean=type->FatalError;
+
+ /* encode character FatalError */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of FatalError */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEStandby*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=7;
+ /* encode start element EVSEStandby */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = BOOLEAN;
+ service->val.boolean=type->EVSEStandby;
+
+ /* encode character EVSEStandby */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of EVSEStandby */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of ConnectorLocked*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=4;
+ /* encode start element ConnectorLocked */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = BOOLEAN;
+ service->val.boolean=type->ConnectorLocked;
+
+ /* encode character ConnectorLocked */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ConnectorLocked */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of PowerSwitchClosed*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=23;
+ /* encode start element PowerSwitchClosed */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = BOOLEAN;
+ service->val.boolean=type->PowerSwitchClosed;
+
+ /* encode character PowerSwitchClosed */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of PowerSwitchClosed */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of RCD*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=25;
+ /* encode start element RCD */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = BOOLEAN;
+ service->val.boolean=type->RCD;
+
+ /* encode character RCD */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of RCD */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of ShutDownTime*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=36;
+ /* encode start element ShutDownTime */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_32;
+ service->val.int32=type->ShutDownTime;
+
+ /* encode character ShutDownTime */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ShutDownTime */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_SessionSetupResType(struct SessionSetupResType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ResponseCode*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=44;
+ /* encode start element ResponseCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ResponseCode;
+
+ /* encode character ResponseCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ResponseCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEID*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=2;
+ /* encode start element EVSEID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+ service->val.type = BINARY_HEX;
+ service->val.binary.len = type->EVSEID.arraylen.data;
+ service->val.binary.data= type->EVSEID.data;
+
+ /* encode character EVSEID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+
+ /* encode end element of EVSEID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=6;
+ /* encode start element EVSEStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EVSEStatus */
+ if(serialize_EVSEStatusType( &(type->EVSEStatus),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EVSEStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of TCurrent*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=60;
+ /* encode start element TCurrent */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_32;
+ service->val.int32=type->TCurrent;
+
+ /* encode character TCurrent */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of TCurrent */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_ServiceDiscoveryReqType(struct ServiceDiscoveryReqType* type, struct EXIService* service)
+{
+
+ if(type->isused.ServiceType)
+ {
+
+ /* element ID assignment of ServiceType*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=55;
+ /* encode start element ServiceType */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ServiceType;
+
+ /* encode character ServiceType */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ServiceType */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.ServiceScope)
+ {
+
+ /* element ID assignment of ServiceScope*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=54;
+ /* encode start element ServiceScope */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->ServiceScope.arraylen.data;
+ service->val.string.codepoints = type->ServiceScope.data;
+
+ /* encode character ServiceScope */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ServiceScope */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_ServiceDescriptionType(struct ServiceDescriptionType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ServiceID*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=28;
+ /* encode start element ServiceID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+ service->val.type = BINARY_HEX;
+ service->val.binary.len = type->ServiceID.arraylen.data;
+ service->val.binary.data= type->ServiceID.data;
+
+ /* encode character ServiceID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+
+ /* encode end element of ServiceID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.ServiceName)
+ {
+
+ /* element ID assignment of ServiceName*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=30;
+ /* encode start element ServiceName */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->ServiceName.arraylen.data;
+ service->val.string.codepoints = type->ServiceName.data;
+
+ /* encode character ServiceName */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ServiceName */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.ServiceType)
+ {
+
+ /* element ID assignment of ServiceType*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=33;
+ /* encode start element ServiceType */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ServiceType;
+
+ /* encode character ServiceType */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ServiceType */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.ServiceScope)
+ {
+
+ /* element ID assignment of ServiceScope*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=31;
+ /* encode start element ServiceScope */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->ServiceScope.arraylen.data;
+ service->val.string.codepoints = type->ServiceScope.data;
+
+ /* encode character ServiceScope */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ServiceScope */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_ServiceListType(struct ServiceListType* type, struct EXIService* service)
+{
+
+ size_t i_loop;
+
+ for(i_loop=0;i_loop < type->arraylen.Service;i_loop++)
+ {
+
+ /* element ID assignment of Service*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=26;
+ /* encode start element Service */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of Service */
+ if(serialize_ServiceDescriptionType(&(type->Service[i_loop]),service))
+ {
+ return -1;
+ }
+
+
+ /* encode end element of Service */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_ServiceDiscoveryResType(struct ServiceDiscoveryResType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ResponseCode*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=44;
+ /* encode start element ResponseCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ResponseCode;
+
+ /* encode character ResponseCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ResponseCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.ServiceList)
+ {
+
+ /* element ID assignment of ServiceList*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=49;
+ /* encode start element ServiceList */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of ServiceList */
+ if(serialize_ServiceListType( &(type->ServiceList),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of ServiceList */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_ServicePaymentSelectionReqType(struct ServicePaymentSelectionReqType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ServiceList*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=49;
+ /* encode start element ServiceList */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of ServiceList */
+ if(serialize_ServiceListType( &(type->ServiceList),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of ServiceList */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_ServicePaymentSelectionResType(struct ServicePaymentSelectionResType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ResponseCode*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=44;
+ /* encode start element ResponseCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ResponseCode;
+
+ /* encode character ResponseCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ResponseCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_PaymentDetailsReqType(struct PaymentDetailsReqType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ContractID*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=0;
+ /* encode start element ContractID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->ContractID.arraylen.data;
+ service->val.string.codepoints = type->ContractID.data;
+
+ /* encode character ContractID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ContractID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_PaymentDetailsResType(struct PaymentDetailsResType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ResponseCode*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=44;
+ /* encode start element ResponseCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ResponseCode;
+
+ /* encode character ResponseCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ResponseCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_FloatingValueType(struct FloatingValueType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of Multiplier*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=20;
+ /* encode start element Multiplier */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->Multiplier;
+
+ /* encode character Multiplier */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of Multiplier */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of Unit*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=49;
+ /* encode start element Unit */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->Unit;
+
+ /* encode character Unit */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of Unit */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of Value*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=50;
+ /* encode start element Value */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_32;
+ service->val.int32=type->Value;
+
+ /* encode character Value */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of Value */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_PowerDiscoveryReqType(struct PowerDiscoveryReqType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of PEVStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=29;
+ /* encode start element PEVStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PEVStatus */
+ if(serialize_PEVStatusType( &(type->PEVStatus),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PEVStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EoC*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=9;
+ /* encode start element EoC */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_32;
+ service->val.int32=type->EoC;
+
+ /* encode character EoC */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of EoC */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EAmount*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=1;
+ /* encode start element EAmount */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EAmount */
+ if(serialize_FloatingValueType( &(type->EAmount),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EAmount */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of PEVMaxPower*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=26;
+ /* encode start element PEVMaxPower */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PEVMaxPower */
+ if(serialize_FloatingValueType( &(type->PEVMaxPower),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PEVMaxPower */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of PEVMaxPhases*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=25;
+ /* encode start element PEVMaxPhases */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_16;
+ service->val.int32=type->PEVMaxPhases;
+
+ /* encode character PEVMaxPhases */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of PEVMaxPhases */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of PEVMaxVoltage*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=27;
+ /* encode start element PEVMaxVoltage */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PEVMaxVoltage */
+ if(serialize_FloatingValueType( &(type->PEVMaxVoltage),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PEVMaxVoltage */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of PEVMinVoltage*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=28;
+ /* encode start element PEVMinVoltage */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PEVMinVoltage */
+ if(serialize_FloatingValueType( &(type->PEVMinVoltage),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PEVMinVoltage */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_TariffEntryType(struct TariffEntryType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of TariffStart*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=47;
+ /* encode start element TariffStart */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = UNSIGNED_INTEGER_32;
+ service->val.uint32=type->TariffStart;
+
+ /* encode character TariffStart */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of TariffStart */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of TariffPMax*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=46;
+ /* encode start element TariffPMax */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of TariffPMax */
+ if(serialize_FloatingValueType( &(type->TariffPMax),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of TariffPMax */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.EPrice)
+ {
+
+ /* element ID assignment of EPrice*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=6;
+ /* encode start element EPrice */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EPrice */
+ if(serialize_FloatingValueType( &(type->EPrice),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EPrice */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_TariffEntriesType(struct TariffEntriesType* type, struct EXIService* service)
+{
+
+ size_t i_loop;
+
+ for(i_loop=0;i_loop < type->arraylen.TariffEntry;i_loop++)
+ {
+
+ /* element ID assignment of TariffEntry*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=43;
+ /* encode start element TariffEntry */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of TariffEntry */
+ if(serialize_TariffEntryType(&(type->TariffEntry[i_loop]),service))
+ {
+ return -1;
+ }
+
+
+ /* encode end element of TariffEntry */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_TariffDescrType(struct TariffDescrType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of TariffID*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=45;
+ /* encode start element TariffID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->TariffID;
+
+ /* encode character TariffID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of TariffID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.TariffDescription)
+ {
+
+ /* element ID assignment of TariffDescription*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=40;
+ /* encode start element TariffDescription */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->TariffDescription.arraylen.data;
+ service->val.string.codepoints = type->TariffDescription.data;
+
+ /* encode character TariffDescription */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of TariffDescription */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ /* element ID assignment of TariffEntries*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=41;
+ /* encode start element TariffEntries */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of TariffEntries */
+ if(serialize_TariffEntriesType( &(type->TariffEntries),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of TariffEntries */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_TariffTableType(struct TariffTableType* type, struct EXIService* service)
+{
+
+ size_t i_loop;
+
+ /* element ID assignment of Currency*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=5;
+ /* encode start element Currency */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->Currency.arraylen.data;
+ service->val.string.codepoints = type->Currency.data;
+
+ /* encode character Currency */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of Currency */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ for(i_loop=0;i_loop < type->arraylen.Tariff;i_loop++)
+ {
+
+ /* element ID assignment of Tariff*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=38;
+ /* encode start element Tariff */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of Tariff */
+ if(serialize_TariffDescrType(&(type->Tariff[i_loop]),service))
+ {
+ return -1;
+ }
+
+
+ /* encode end element of Tariff */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_PowerDiscoveryResType(struct PowerDiscoveryResType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ResponseCode*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=44;
+ /* encode start element ResponseCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ResponseCode;
+
+ /* encode character ResponseCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ResponseCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=6;
+ /* encode start element EVSEStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EVSEStatus */
+ if(serialize_EVSEStatusType( &(type->EVSEStatus),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EVSEStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEVoltage*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=7;
+ /* encode start element EVSEVoltage */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EVSEVoltage */
+ if(serialize_FloatingValueType( &(type->EVSEVoltage),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EVSEVoltage */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEIMax*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=3;
+ /* encode start element EVSEIMax */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EVSEIMax */
+ if(serialize_FloatingValueType( &(type->EVSEIMax),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EVSEIMax */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEMaxPhases*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=4;
+ /* encode start element EVSEMaxPhases */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_16;
+ service->val.int32=type->EVSEMaxPhases;
+
+ /* encode character EVSEMaxPhases */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of EVSEMaxPhases */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.EnergyProvider)
+ {
+
+ /* element ID assignment of EnergyProvider*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=8;
+ /* encode start element EnergyProvider */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->EnergyProvider.arraylen.data;
+ service->val.string.codepoints = type->EnergyProvider.data;
+
+ /* encode character EnergyProvider */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of EnergyProvider */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.TariffTable)
+ {
+
+ /* element ID assignment of TariffTable*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=62;
+ /* encode start element TariffTable */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of TariffTable */
+ if(serialize_TariffTableType( &(type->TariffTable),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of TariffTable */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_LineLockReqType(struct LineLockReqType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of PEVStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=29;
+ /* encode start element PEVStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PEVStatus */
+ if(serialize_PEVStatusType( &(type->PEVStatus),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PEVStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of ReqLockStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=42;
+ /* encode start element ReqLockStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = BOOLEAN;
+ service->val.boolean=type->ReqLockStatus;
+
+ /* encode character ReqLockStatus */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ReqLockStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_LineLockResType(struct LineLockResType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ResponseCode*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=44;
+ /* encode start element ResponseCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ResponseCode;
+
+ /* encode character ResponseCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ResponseCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=6;
+ /* encode start element EVSEStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EVSEStatus */
+ if(serialize_EVSEStatusType( &(type->EVSEStatus),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EVSEStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_PowerDeliveryReqType(struct PowerDeliveryReqType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of PEVStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=29;
+ /* encode start element PEVStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PEVStatus */
+ if(serialize_PEVStatusType( &(type->PEVStatus),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PEVStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of ReqSwitchStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=43;
+ /* encode start element ReqSwitchStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = BOOLEAN;
+ service->val.boolean=type->ReqSwitchStatus;
+
+ /* encode character ReqSwitchStatus */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ReqSwitchStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.Tariff)
+ {
+
+ /* element ID assignment of Tariff*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=61;
+ /* encode start element Tariff */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->Tariff;
+
+ /* encode character Tariff */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of Tariff */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_PowerDeliveryResType(struct PowerDeliveryResType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ResponseCode*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=44;
+ /* encode start element ResponseCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ResponseCode;
+
+ /* encode character ResponseCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ResponseCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_MeteringStatusReqType(struct MeteringStatusReqType* type, struct EXIService* service)
+{
+
+
+ return 0;
+}
+
+
+static int serialize_MeterInfoType(struct MeterInfoType* type, struct EXIService* service)
+{
+
+ if(type->isused.MeterID)
+ {
+
+ /* element ID assignment of MeterID*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=16;
+ /* encode start element MeterID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->MeterID.arraylen.data;
+ service->val.string.codepoints = type->MeterID.data;
+
+ /* encode character MeterID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of MeterID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.MeterReading)
+ {
+
+ /* element ID assignment of MeterReading*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=18;
+ /* encode start element MeterReading */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of MeterReading */
+ if(serialize_FloatingValueType( &(type->MeterReading),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of MeterReading */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.MeterStatus)
+ {
+
+ /* element ID assignment of MeterStatus*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=19;
+ /* encode start element MeterStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_16;
+ service->val.int32=type->MeterStatus;
+
+ /* encode character MeterStatus */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of MeterStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.TMeter)
+ {
+
+ /* element ID assignment of TMeter*/
+ service->eqn.namespaceURI=5;
+ service->eqn.localPart=37;
+ /* encode start element TMeter */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_32;
+ service->val.int32=type->TMeter;
+
+ /* encode character TMeter */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of TMeter */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_MeteringStatusResType(struct MeteringStatusResType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ResponseCode*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=44;
+ /* encode start element ResponseCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ResponseCode;
+
+ /* encode character ResponseCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ResponseCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEID*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=2;
+ /* encode start element EVSEID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+ service->val.type = BINARY_HEX;
+ service->val.binary.len = type->EVSEID.arraylen.data;
+ service->val.binary.data= type->EVSEID.data;
+
+ /* encode character EVSEID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+
+ /* encode end element of EVSEID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=6;
+ /* encode start element EVSEStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EVSEStatus */
+ if(serialize_EVSEStatusType( &(type->EVSEStatus),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EVSEStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of TCurrent*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=60;
+ /* encode start element TCurrent */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_32;
+ service->val.int32=type->TCurrent;
+
+ /* encode character TCurrent */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of TCurrent */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of EVSEMaxPower*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=5;
+ /* encode start element EVSEMaxPower */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of EVSEMaxPower */
+ if(serialize_FloatingValueType( &(type->EVSEMaxPower),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of EVSEMaxPower */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.PCurrent)
+ {
+
+ /* element ID assignment of PCurrent*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=23;
+ /* encode start element PCurrent */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PCurrent */
+ if(serialize_FloatingValueType( &(type->PCurrent),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PCurrent */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.MeterInfo)
+ {
+
+ /* element ID assignment of MeterInfo*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=14;
+ /* encode start element MeterInfo */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of MeterInfo */
+ if(serialize_MeterInfoType( &(type->MeterInfo),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of MeterInfo */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_MeteringReceiptReqType(struct MeteringReceiptReqType* type, struct EXIService* service)
+{
+
+ if(type->isused.PEVID)
+ {
+
+ /* element ID assignment of PEVID*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=24;
+ /* encode start element PEVID */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = STRING;
+ service->val.string.len = type->PEVID.arraylen.data;
+ service->val.string.codepoints = type->PEVID.data;
+
+ /* encode character PEVID */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of PEVID */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ /* element ID assignment of PEVStatus*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=29;
+ /* encode start element PEVStatus */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PEVStatus */
+ if(serialize_PEVStatusType( &(type->PEVStatus),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PEVStatus */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ if(type->isused.TCurrent)
+ {
+
+ /* element ID assignment of TCurrent*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=60;
+ /* encode start element TCurrent */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = INTEGER_32;
+ service->val.int32=type->TCurrent;
+
+ /* encode character TCurrent */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of TCurrent */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ /* element ID assignment of Tariff*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=61;
+ /* encode start element Tariff */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->Tariff;
+
+ /* encode character Tariff */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of Tariff */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of MeterInfo*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=14;
+ /* encode start element MeterInfo */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of MeterInfo */
+ if(serialize_MeterInfoType( &(type->MeterInfo),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of MeterInfo */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_MeteringReceiptResType(struct MeteringReceiptResType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of ResponseCode*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=44;
+ /* encode start element ResponseCode */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ service->val.type = ENUMERATION;
+ service->val.enumeration=type->ResponseCode;
+
+ /* encode character ResponseCode */
+ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val)))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end element of ResponseCode */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_BodyType(struct BodyType* type, struct EXIService* service)
+{
+
+ if(type->isused.SessionSetupReq)
+ {
+
+ /* element ID assignment of SessionSetupReq*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=56;
+ /* encode start element SessionSetupReq */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of SessionSetupReq */
+ if(serialize_SessionSetupReqType( (type->SessionSetupReq),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of SessionSetupReq */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.SessionSetupRes)
+ {
+
+ /* element ID assignment of SessionSetupRes*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=58;
+ /* encode start element SessionSetupRes */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of SessionSetupRes */
+ if(serialize_SessionSetupResType( (type->SessionSetupRes),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of SessionSetupRes */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.ServiceDiscoveryReq)
+ {
+
+ /* element ID assignment of ServiceDiscoveryReq*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=45;
+ /* encode start element ServiceDiscoveryReq */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of ServiceDiscoveryReq */
+ if(serialize_ServiceDiscoveryReqType( (type->ServiceDiscoveryReq),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of ServiceDiscoveryReq */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.ServiceDiscoveryRes)
+ {
+
+ /* element ID assignment of ServiceDiscoveryRes*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=47;
+ /* encode start element ServiceDiscoveryRes */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of ServiceDiscoveryRes */
+ if(serialize_ServiceDiscoveryResType( (type->ServiceDiscoveryRes),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of ServiceDiscoveryRes */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.ServicePaymentSelectionReq)
+ {
+
+ /* element ID assignment of ServicePaymentSelectionReq*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=50;
+ /* encode start element ServicePaymentSelectionReq */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of ServicePaymentSelectionReq */
+ if(serialize_ServicePaymentSelectionReqType( (type->ServicePaymentSelectionReq),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of ServicePaymentSelectionReq */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.ServicePaymentSelectionRes)
+ {
+
+ /* element ID assignment of ServicePaymentSelectionRes*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=52;
+ /* encode start element ServicePaymentSelectionRes */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of ServicePaymentSelectionRes */
+ if(serialize_ServicePaymentSelectionResType( (type->ServicePaymentSelectionRes),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of ServicePaymentSelectionRes */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.PaymentDetailsReq)
+ {
+
+ /* element ID assignment of PaymentDetailsReq*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=30;
+ /* encode start element PaymentDetailsReq */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PaymentDetailsReq */
+ if(serialize_PaymentDetailsReqType( (type->PaymentDetailsReq),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PaymentDetailsReq */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.PaymentDetailsRes)
+ {
+
+ /* element ID assignment of PaymentDetailsRes*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=32;
+ /* encode start element PaymentDetailsRes */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PaymentDetailsRes */
+ if(serialize_PaymentDetailsResType( (type->PaymentDetailsRes),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PaymentDetailsRes */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.PowerDiscoveryReq)
+ {
+
+ /* element ID assignment of PowerDiscoveryReq*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=38;
+ /* encode start element PowerDiscoveryReq */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PowerDiscoveryReq */
+ if(serialize_PowerDiscoveryReqType( (type->PowerDiscoveryReq),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PowerDiscoveryReq */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.PowerDiscoveryRes)
+ {
+
+ /* element ID assignment of PowerDiscoveryRes*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=40;
+ /* encode start element PowerDiscoveryRes */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PowerDiscoveryRes */
+ if(serialize_PowerDiscoveryResType( (type->PowerDiscoveryRes),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PowerDiscoveryRes */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.LineLockReq)
+ {
+
+ /* element ID assignment of LineLockReq*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=10;
+ /* encode start element LineLockReq */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of LineLockReq */
+ if(serialize_LineLockReqType( (type->LineLockReq),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of LineLockReq */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.LineLockRes)
+ {
+
+ /* element ID assignment of LineLockRes*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=12;
+ /* encode start element LineLockRes */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of LineLockRes */
+ if(serialize_LineLockResType( (type->LineLockRes),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of LineLockRes */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.PowerDeliveryReq)
+ {
+
+ /* element ID assignment of PowerDeliveryReq*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=34;
+ /* encode start element PowerDeliveryReq */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PowerDeliveryReq */
+ if(serialize_PowerDeliveryReqType( (type->PowerDeliveryReq),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PowerDeliveryReq */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.PowerDeliveryRes)
+ {
+
+ /* element ID assignment of PowerDeliveryRes*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=36;
+ /* encode start element PowerDeliveryRes */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of PowerDeliveryRes */
+ if(serialize_PowerDeliveryResType( (type->PowerDeliveryRes),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of PowerDeliveryRes */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.MeteringStatusReq)
+ {
+
+ /* element ID assignment of MeteringStatusReq*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=19;
+ /* encode start element MeteringStatusReq */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of MeteringStatusReq */
+ if(serialize_MeteringStatusReqType( (type->MeteringStatusReq),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of MeteringStatusReq */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.MeteringStatusRes)
+ {
+
+ /* element ID assignment of MeteringStatusRes*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=21;
+ /* encode start element MeteringStatusRes */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of MeteringStatusRes */
+ if(serialize_MeteringStatusResType( (type->MeteringStatusRes),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of MeteringStatusRes */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.MeteringReceiptReq)
+ {
+
+ /* element ID assignment of MeteringReceiptReq*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=15;
+ /* encode start element MeteringReceiptReq */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of MeteringReceiptReq */
+ if(serialize_MeteringReceiptReqType( (type->MeteringReceiptReq),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of MeteringReceiptReq */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+ if(type->isused.MeteringReceiptRes)
+ {
+
+ /* element ID assignment of MeteringReceiptRes*/
+ service->eqn.namespaceURI=4;
+ service->eqn.localPart=17;
+ /* encode start element MeteringReceiptRes */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of MeteringReceiptRes */
+ if(serialize_MeteringReceiptResType( (type->MeteringReceiptRes),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of MeteringReceiptRes */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+ }
+
+
+ return 0;
+}
+
+
+static int serialize_AnonType_V2G_Message(struct AnonType_V2G_Message* type, struct EXIService* service)
+{
+
+ /* element ID assignment of Header*/
+ service->eqn.namespaceURI=6;
+ service->eqn.localPart=4;
+ /* encode start element Header */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of Header */
+ if(serialize_HeaderType( (type->Header),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of Header */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+ /* element ID assignment of Body*/
+ service->eqn.namespaceURI=6;
+ service->eqn.localPart=0;
+ /* encode start element Body */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of Body */
+ if(serialize_BodyType( &(type->Body),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of Body */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+static int serialize_EXIDocumentType(struct EXIDocumentType* type, struct EXIService* service)
+{
+
+ /* element ID assignment of V2G_Message*/
+ service->eqn.namespaceURI=6;
+ service->eqn.localPart=5;
+ /* encode start element V2G_Message */
+ if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn)))
+ {
+ return -1;
+ }
+
+ /* encode children of V2G_Message */
+ if(serialize_AnonType_V2G_Message( &(type->V2G_Message),service))
+ {
+ return -1;
+ }
+
+
+
+ /* encode end element of V2G_Message */
+ exiEncodeEndElement(&(service->outStream), &(service->stateEncode), &(service->eqn));
+
+
+
+ return 0;
+}
+
+
+
+
+
+
+ /* marshal data to EXI stream */
+static int serialize_message(struct EXIService* service)
+ {
+
+
+ /* encode start document */
+ if (exiEncodeStartDocument(&(service->outStream), &(service->stateEncode)) )
+ {
+
+ return -1;
+ }
+
+ /* encode root element of V2G_Message */
+ if (serialize_EXIDocumentType(&(service->exiMsg), service))
+ {
+
+ return -1;
+ }
+
+
+ /* encode end document */
+ if (exiEncodeEndDocument(&(service->outStream), &(service->stateEncode))) {
+
+ return -1;
+ }
+
+ return 0;
+
+ }
+
+
+
+
diff --git a/src/service/v2g_serviceDataTypes.c b/src/service/v2g_serviceDataTypes.c
new file mode 100644
index 0000000..11bb2ac
--- /dev/null
+++ b/src/service/v2g_serviceDataTypes.c
@@ -0,0 +1,357 @@
+
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+
+#include "EXITypes.h"
+#include "v2g_serviceDataTypes.h"
+
+
+static void init_SessionInformationType_SessionID(struct SessionInformationType_SessionID* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_SessionInformationType_ServiceSessionID(struct SessionInformationType_ServiceSessionID* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_SessionInformationType_ProtocolVersion(struct SessionInformationType_ProtocolVersion* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_SessionInformationType(struct SessionInformationType* type)
+{
+ init_SessionInformationType_SessionID(&(type->SessionID));
+ init_SessionInformationType_ServiceSessionID(&(type->ServiceSessionID));
+ type->isused.ServiceSessionID=0;
+ init_SessionInformationType_ProtocolVersion(&(type->ProtocolVersion));
+ type->isused.ProtocolVersion=0;
+
+}
+
+static void init_NotificationType_FaultMsg(struct NotificationType_FaultMsg* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_NotificationType(struct NotificationType* type)
+{
+ type->isused.FaultCode=0;
+ init_NotificationType_FaultMsg(&(type->FaultMsg));
+ type->isused.FaultMsg=0;
+ type->isused.EventList=0;
+
+}
+
+static void init_HeaderType(struct HeaderType* type)
+{
+ init_SessionInformationType(&(type->SessionInformation));
+ init_NotificationType(&(type->Notification));
+ type->isused.Notification=0;
+
+}
+
+static void init_SessionSetupReqType_PEVID(struct SessionSetupReqType_PEVID* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_SessionSetupReqType(struct SessionSetupReqType* type)
+{
+ init_SessionSetupReqType_PEVID(&(type->PEVID));
+ type->isused.PEVID=0;
+
+}
+
+static void init_SessionSetupResType_EVSEID(struct SessionSetupResType_EVSEID* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_SessionSetupResType(struct SessionSetupResType* type)
+{
+ init_SessionSetupResType_EVSEID(&(type->EVSEID));
+
+}
+
+static void init_ServiceDiscoveryReqType_ServiceScope(struct ServiceDiscoveryReqType_ServiceScope* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_ServiceDiscoveryReqType(struct ServiceDiscoveryReqType* type)
+{
+ type->isused.ServiceType=0;
+ init_ServiceDiscoveryReqType_ServiceScope(&(type->ServiceScope));
+ type->isused.ServiceScope=0;
+
+}
+
+static void init_ServiceDescriptionType_ServiceID(struct ServiceDescriptionType_ServiceID* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_ServiceDescriptionType_ServiceName(struct ServiceDescriptionType_ServiceName* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_ServiceDescriptionType_ServiceScope(struct ServiceDescriptionType_ServiceScope* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_ServiceDescriptionType(struct ServiceDescriptionType* type)
+{
+ init_ServiceDescriptionType_ServiceID(&(type->ServiceID));
+ init_ServiceDescriptionType_ServiceName(&(type->ServiceName));
+ type->isused.ServiceName=0;
+ type->isused.ServiceType=0;
+ init_ServiceDescriptionType_ServiceScope(&(type->ServiceScope));
+ type->isused.ServiceScope=0;
+
+}
+
+static void init_ServiceListType(struct ServiceListType* type)
+{
+ int i_loop;
+
+ for(i_loop=0; i_loop<8;i_loop++)
+ {
+ init_ServiceDescriptionType(&(type->Service[i_loop]));
+ }
+
+ type->arraylen.Service=0;
+
+}
+
+static void init_ServiceDiscoveryResType(struct ServiceDiscoveryResType* type)
+{
+ init_ServiceListType(&(type->ServiceList));
+ type->isused.ServiceList=0;
+
+}
+
+static void init_ServicePaymentSelectionReqType(struct ServicePaymentSelectionReqType* type)
+{
+ init_ServiceListType(&(type->ServiceList));
+
+}
+
+static void init_PaymentDetailsReqType_ContractID(struct PaymentDetailsReqType_ContractID* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_PaymentDetailsReqType(struct PaymentDetailsReqType* type)
+{
+ init_PaymentDetailsReqType_ContractID(&(type->ContractID));
+
+}
+
+static void init_PowerDiscoveryReqType(struct PowerDiscoveryReqType* type)
+{
+
+}
+
+static void init_PowerDiscoveryResType_EnergyProvider(struct PowerDiscoveryResType_EnergyProvider* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_TariffTableType_Currency(struct TariffTableType_Currency* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_TariffDescrType_TariffDescription(struct TariffDescrType_TariffDescription* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_TariffEntryType(struct TariffEntryType* type)
+{
+ type->isused.EPrice=0;
+
+}
+
+static void init_TariffEntriesType(struct TariffEntriesType* type)
+{
+ int i_loop;
+
+ for(i_loop=0; i_loop<8;i_loop++)
+ {
+ init_TariffEntryType(&(type->TariffEntry[i_loop]));
+ }
+
+ type->arraylen.TariffEntry=0;
+
+}
+
+static void init_TariffDescrType(struct TariffDescrType* type)
+{
+ init_TariffDescrType_TariffDescription(&(type->TariffDescription));
+ type->isused.TariffDescription=0;
+ init_TariffEntriesType(&(type->TariffEntries));
+
+}
+
+static void init_TariffTableType(struct TariffTableType* type)
+{
+ int i_loop;
+
+ init_TariffTableType_Currency(&(type->Currency));
+ for(i_loop=0; i_loop<6;i_loop++)
+ {
+ init_TariffDescrType(&(type->Tariff[i_loop]));
+ }
+
+ type->arraylen.Tariff=0;
+
+}
+
+static void init_PowerDiscoveryResType(struct PowerDiscoveryResType* type)
+{
+ init_PowerDiscoveryResType_EnergyProvider(&(type->EnergyProvider));
+ type->isused.EnergyProvider=0;
+ init_TariffTableType(&(type->TariffTable));
+ type->isused.TariffTable=0;
+
+}
+
+static void init_LineLockReqType(struct LineLockReqType* type)
+{
+
+}
+
+static void init_LineLockResType(struct LineLockResType* type)
+{
+
+}
+
+static void init_PowerDeliveryReqType(struct PowerDeliveryReqType* type)
+{
+ type->isused.Tariff=0;
+
+}
+
+static void init_MeteringStatusResType_EVSEID(struct MeteringStatusResType_EVSEID* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_MeterInfoType_MeterID(struct MeterInfoType_MeterID* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_MeterInfoType(struct MeterInfoType* type)
+{
+ init_MeterInfoType_MeterID(&(type->MeterID));
+ type->isused.MeterID=0;
+ type->isused.MeterReading=0;
+ type->isused.MeterStatus=0;
+ type->isused.TMeter=0;
+
+}
+
+static void init_MeteringStatusResType(struct MeteringStatusResType* type)
+{
+ init_MeteringStatusResType_EVSEID(&(type->EVSEID));
+ type->isused.PCurrent=0;
+ init_MeterInfoType(&(type->MeterInfo));
+ type->isused.MeterInfo=0;
+
+}
+
+static void init_MeteringReceiptReqType_PEVID(struct MeteringReceiptReqType_PEVID* type)
+{
+ type->arraylen.data=0;
+
+}
+
+static void init_MeteringReceiptReqType(struct MeteringReceiptReqType* type)
+{
+ init_MeteringReceiptReqType_PEVID(&(type->PEVID));
+ type->isused.PEVID=0;
+ type->isused.TCurrent=0;
+ init_MeterInfoType(&(type->MeterInfo));
+
+}
+
+static void init_BodyType(struct BodyType* type)
+{
+ type->isused.SessionSetupReq=0;
+ type->isused.SessionSetupRes=0;
+ type->isused.ServiceDiscoveryReq=0;
+ type->isused.ServiceDiscoveryRes=0;
+ type->isused.ServicePaymentSelectionReq=0;
+ type->isused.ServicePaymentSelectionRes=0;
+ type->isused.PaymentDetailsReq=0;
+ type->isused.PaymentDetailsRes=0;
+ type->isused.PowerDiscoveryReq=0;
+ type->isused.PowerDiscoveryRes=0;
+ type->isused.LineLockReq=0;
+ type->isused.LineLockRes=0;
+ type->isused.PowerDeliveryReq=0;
+ type->isused.PowerDeliveryRes=0;
+ type->isused.MeteringStatusReq=0;
+ type->isused.MeteringStatusRes=0;
+ type->isused.MeteringReceiptReq=0;
+ type->isused.MeteringReceiptRes=0;
+
+}
+
+static void init_AnonType_V2G_Message(struct AnonType_V2G_Message* type)
+{
+ init_BodyType(&(type->Body));
+
+}
+
+static void init_EXIDocumentType(struct EXIDocumentType* type)
+{
+ init_AnonType_V2G_Message(&(type->V2G_Message));
+
+}
diff --git a/src/service/v2g_serviceDataTypes.h b/src/service/v2g_serviceDataTypes.h
new file mode 100644
index 0000000..73fb9fa
--- /dev/null
+++ b/src/service/v2g_serviceDataTypes.h
@@ -0,0 +1,924 @@
+
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SERVICEDATATYPES_H
+#define SERVICEDATATYPES_H
+
+#include "EXITypes.h"
+
+
+
+
+enum faultCodeType
+{
+ ParsingError_faultCodeType,
+ V2GProtocolVersionNotSupported_faultCodeType,
+ UnknownError_faultCodeType
+
+};
+
+enum eventEntryType
+{
+ InitiateSessionSetup_eventEntryType,
+ InitiateServiceDiscovery_eventEntryType,
+ InitiatePowerDiscovery_eventEntryType,
+ InitiateLineLock_eventEntryType,
+ InitiatePowerDelivery_eventEntryType,
+ InitiateInitiateMeteringStatus_eventEntryType
+
+};
+
+enum responseCode_SessionSetupType
+{
+ OK_SessionSetup_responseCode_SessionSetupType,
+ OK_NewSessionEstablished_responseCode_SessionSetupType,
+ OK_OldSessionJoined_responseCode_SessionSetupType,
+ FAILED_UnknownSession_responseCode_SessionSetupType,
+ FAILED_SessionEstablishmentError_responseCode_SessionSetupType,
+ FAILED_UnknownError_InSessionSetup_responseCode_SessionSetupType
+
+};
+
+enum serviceTypeType
+{
+ PEV_Recharge_serviceTypeType,
+ Remote_Customer_Support_serviceTypeType,
+ Internet_serviceTypeType,
+ Other_serviceTypeType
+
+};
+
+enum responseCode_ServiceDiscoveryType
+{
+ OK_ServiceDiscovery_responseCode_ServiceDiscoveryType,
+ FAILED_NoServicesOfThisType_responseCode_ServiceDiscoveryType,
+ FAILED_NoServicesInThisScope_responseCode_ServiceDiscoveryType,
+ FAILED_NoServicesOfThisTypeScope_responseCode_ServiceDiscoveryType,
+ FAILED_NoServicesFound_responseCode_ServiceDiscoveryType,
+ FAILED_UnknownError_InServiceDiscovery_responseCode_ServiceDiscoveryType
+
+};
+
+enum responseCode_ServicePaymentSelectionType
+{
+ OK_ServicePaymentSelection_responseCode_ServicePaymentSelectionType,
+ FAILED_ServiceSelectionInvalid_responseCode_ServicePaymentSelectionType,
+ FAILED_PaymentSelectionInvalid_responseCode_ServicePaymentSelectionType,
+ FAILED_UnknownError_InServicePaymentSelection_responseCode_ServicePaymentSelectionType
+
+};
+
+enum responseCode_PaymentDetailsType
+{
+ OK_PaymentDetails_responseCode_PaymentDetailsType,
+ FAILED_PaymentDetailsInvalid_responseCode_PaymentDetailsType,
+ FAILED_UnknownError_responseCode_PaymentDetailsType
+
+};
+
+enum unitMultiplierType
+{
+ d_unitMultiplierType,
+ c_unitMultiplierType,
+ m_unitMultiplierType,
+ micro_unitMultiplierType,
+ n_unitMultiplierType,
+ p_unitMultiplierType,
+ k_unitMultiplierType,
+ M_unitMultiplierType,
+ G_unitMultiplierType,
+ T_unitMultiplierType,
+ none_unitMultiplierType
+
+};
+
+enum unitSymbolType
+{
+ A_unitSymbolType,
+ deg_unitSymbolType,
+ F_unitSymbolType,
+ g_unitSymbolType,
+ h_unitSymbolType,
+ J_unitSymbolType,
+ J_s_unitSymbolType,
+ kg_J_unitSymbolType,
+ min_unitSymbolType,
+ N_unitSymbolType,
+ ohm_unitSymbolType,
+ s_unitSymbolType,
+ S_unitSymbolType,
+ s_1_unitSymbolType,
+ V_unitSymbolType,
+ V_VAr_unitSymbolType,
+ VA_unitSymbolType,
+ VAh_unitSymbolType,
+ VAr_unitSymbolType,
+ VArh_unitSymbolType,
+ W_unitSymbolType,
+ W_Hz_unitSymbolType,
+ W_s_unitSymbolType,
+ Wh_unitSymbolType,
+ Ah_unitSymbolType
+
+};
+
+enum responseCode_PowerDiscoveryType
+{
+ OK_PowerDiscovery_responseCode_PowerDiscoveryType,
+ FAILED_UnknownError_InPowerDiscovery_responseCode_PowerDiscoveryType
+
+};
+
+enum tariffIDType
+{
+ Standard_charge_tariffIDType,
+ Fast_charge_tariffIDType,
+ Green_charge_tariffIDType,
+ Grid_friendly_charge_tariffIDType,
+ Freely_parameterisable_charge_tariffIDType,
+ Charge_under_reserve_tariffIDType
+
+};
+
+enum responseCode_LineLockType
+{
+ OK_LineLock_responseCode_LineLockType,
+ FAILED_LineLockNotApplied_responseCode_LineLockType,
+ FAILED_UnknownError_InLineLock_responseCode_LineLockType
+
+};
+
+enum responseCode_PowerDeliveryType
+{
+ OK_PowerDelivery_responseCode_PowerDeliveryType,
+ FAILED_PowerDeliveryNotApplied_responseCode_PowerDeliveryType,
+ FAILED_TariffSelectionInvalid_responseCode_PowerDeliveryType,
+ FAILED_ChargingProfileInvalid_responseCode_PowerDeliveryType,
+ FAILED_UnknownError_InPowerDelivery_responseCode_PowerDeliveryType
+
+};
+
+enum responseCode_MeteringStatusType
+{
+ OK_MeteringStatus_responseCode_MeteringStatusType,
+ FAILED_UnknownError_InMeteringStatus_responseCode_MeteringStatusType
+
+};
+
+enum responseCode_MeteringReceiptType
+{
+ OK_MeteringReceipt_responseCode_MeteringReceiptType,
+ FAILED_UnknownError_MeteringReceipt_responseCode_MeteringReceiptType
+
+};
+
+
+
+
+struct arraylen_SessionInformationType_SessionID
+{
+ size_t data;
+
+
+};
+
+struct SessionInformationType_SessionID
+{
+ uint8_t data[8];
+ struct arraylen_SessionInformationType_SessionID arraylen;
+
+};
+
+struct arraylen_SessionInformationType_ServiceSessionID
+{
+ size_t data;
+
+
+};
+
+struct SessionInformationType_ServiceSessionID
+{
+ uint8_t data[8];
+ struct arraylen_SessionInformationType_ServiceSessionID arraylen;
+
+};
+
+struct selection_SessionInformationType
+{
+ unsigned int ServiceSessionID:1;
+ unsigned int ProtocolVersion:1;
+
+
+};
+
+struct arraylen_SessionInformationType_ProtocolVersion
+{
+ size_t data;
+
+
+};
+
+struct SessionInformationType_ProtocolVersion
+{
+ uint32_t data[5];
+ struct arraylen_SessionInformationType_ProtocolVersion arraylen;
+
+};
+
+struct SessionInformationType
+{
+ struct SessionInformationType_SessionID SessionID;
+ struct SessionInformationType_ServiceSessionID ServiceSessionID;
+ struct SessionInformationType_ProtocolVersion ProtocolVersion;
+ struct selection_SessionInformationType isused;
+
+};
+
+struct selection_NotificationType
+{
+ unsigned int FaultCode:1;
+ unsigned int FaultMsg:1;
+ unsigned int EventList:1;
+
+
+};
+
+struct arraylen_NotificationType_FaultMsg
+{
+ size_t data;
+
+
+};
+
+struct NotificationType_FaultMsg
+{
+ uint32_t data[256];
+ struct arraylen_NotificationType_FaultMsg arraylen;
+
+};
+
+struct EventListType
+{
+ enum eventEntryType Event;
+
+
+};
+
+struct NotificationType
+{
+ enum faultCodeType FaultCode;
+ struct NotificationType_FaultMsg FaultMsg;
+ struct EventListType EventList;
+ struct selection_NotificationType isused;
+
+};
+
+struct selection_HeaderType
+{
+ unsigned int Notification:1;
+
+
+};
+
+struct HeaderType
+{
+ struct SessionInformationType SessionInformation;
+ struct NotificationType Notification;
+ struct selection_HeaderType isused;
+
+};
+
+struct arraylen_SessionSetupReqType_PEVID
+{
+ size_t data;
+
+
+};
+
+struct SessionSetupReqType_PEVID
+{
+ uint32_t data[32];
+ struct arraylen_SessionSetupReqType_PEVID arraylen;
+
+};
+
+struct selection_SessionSetupReqType
+{
+ unsigned int PEVID:1;
+
+
+};
+
+struct PEVStatusType
+{
+ int ConnectorLocked;
+ int ChargerStandby;
+
+
+};
+
+struct SessionSetupReqType
+{
+ struct SessionSetupReqType_PEVID PEVID;
+ struct PEVStatusType PEVStatus;
+ struct selection_SessionSetupReqType isused;
+
+};
+
+struct selection_BodyType
+{
+ unsigned int SessionSetupReq:1;
+ unsigned int SessionSetupRes:1;
+ unsigned int ServiceDiscoveryReq:1;
+ unsigned int ServiceDiscoveryRes:1;
+ unsigned int ServicePaymentSelectionReq:1;
+ unsigned int ServicePaymentSelectionRes:1;
+ unsigned int PaymentDetailsReq:1;
+ unsigned int PaymentDetailsRes:1;
+ unsigned int PowerDiscoveryReq:1;
+ unsigned int PowerDiscoveryRes:1;
+ unsigned int LineLockReq:1;
+ unsigned int LineLockRes:1;
+ unsigned int PowerDeliveryReq:1;
+ unsigned int PowerDeliveryRes:1;
+ unsigned int MeteringStatusReq:1;
+ unsigned int MeteringStatusRes:1;
+ unsigned int MeteringReceiptReq:1;
+ unsigned int MeteringReceiptRes:1;
+
+
+};
+
+struct arraylen_SessionSetupResType_EVSEID
+{
+ size_t data;
+
+
+};
+
+struct SessionSetupResType_EVSEID
+{
+ uint8_t data[32];
+ struct arraylen_SessionSetupResType_EVSEID arraylen;
+
+};
+
+struct EVSEStatusType
+{
+ int FatalError;
+ int EVSEStandby;
+ int ConnectorLocked;
+ int PowerSwitchClosed;
+ int RCD;
+ int32_t ShutDownTime;
+
+
+};
+
+struct SessionSetupResType
+{
+ enum responseCode_SessionSetupType ResponseCode;
+ struct SessionSetupResType_EVSEID EVSEID;
+ struct EVSEStatusType EVSEStatus;
+ int32_t TCurrent;
+
+
+};
+
+struct selection_ServiceDiscoveryReqType
+{
+ unsigned int ServiceType:1;
+ unsigned int ServiceScope:1;
+
+
+};
+
+struct arraylen_ServiceDiscoveryReqType_ServiceScope
+{
+ size_t data;
+
+
+};
+
+struct ServiceDiscoveryReqType_ServiceScope
+{
+ uint32_t data[20];
+ struct arraylen_ServiceDiscoveryReqType_ServiceScope arraylen;
+
+};
+
+struct ServiceDiscoveryReqType
+{
+ enum serviceTypeType ServiceType;
+ struct ServiceDiscoveryReqType_ServiceScope ServiceScope;
+ struct selection_ServiceDiscoveryReqType isused;
+
+};
+
+struct arraylen_ServiceDescriptionType_ServiceID
+{
+ size_t data;
+
+
+};
+
+struct ServiceDescriptionType_ServiceID
+{
+ uint8_t data[8];
+ struct arraylen_ServiceDescriptionType_ServiceID arraylen;
+
+};
+
+struct arraylen_ServiceDescriptionType_ServiceName
+{
+ size_t data;
+
+
+};
+
+struct ServiceDescriptionType_ServiceName
+{
+ uint32_t data[20];
+ struct arraylen_ServiceDescriptionType_ServiceName arraylen;
+
+};
+
+struct selection_ServiceDescriptionType
+{
+ unsigned int ServiceName:1;
+ unsigned int ServiceType:1;
+ unsigned int ServiceScope:1;
+
+
+};
+
+struct arraylen_ServiceDescriptionType_ServiceScope
+{
+ size_t data;
+
+
+};
+
+struct ServiceDescriptionType_ServiceScope
+{
+ uint32_t data[20];
+ struct arraylen_ServiceDescriptionType_ServiceScope arraylen;
+
+};
+
+struct ServiceDescriptionType
+{
+ struct ServiceDescriptionType_ServiceID ServiceID;
+ struct ServiceDescriptionType_ServiceName ServiceName;
+ enum serviceTypeType ServiceType;
+ struct ServiceDescriptionType_ServiceScope ServiceScope;
+ struct selection_ServiceDescriptionType isused;
+
+};
+
+struct arraylen_ServiceListType
+{
+ size_t Service;
+
+
+};
+
+struct ServiceListType
+{
+ struct ServiceDescriptionType Service[8];
+ struct arraylen_ServiceListType arraylen;
+
+};
+
+struct selection_ServiceDiscoveryResType
+{
+ unsigned int ServiceList:1;
+
+
+};
+
+struct ServiceDiscoveryResType
+{
+ enum responseCode_ServiceDiscoveryType ResponseCode;
+ struct ServiceListType ServiceList;
+ struct selection_ServiceDiscoveryResType isused;
+
+};
+
+struct ServicePaymentSelectionReqType
+{
+ struct ServiceListType ServiceList;
+
+
+};
+
+struct ServicePaymentSelectionResType
+{
+ enum responseCode_ServicePaymentSelectionType ResponseCode;
+
+
+};
+
+struct arraylen_PaymentDetailsReqType_ContractID
+{
+ size_t data;
+
+
+};
+
+struct PaymentDetailsReqType_ContractID
+{
+ uint32_t data[128];
+ struct arraylen_PaymentDetailsReqType_ContractID arraylen;
+
+};
+
+struct PaymentDetailsReqType
+{
+ struct PaymentDetailsReqType_ContractID ContractID;
+
+
+};
+
+struct PaymentDetailsResType
+{
+ enum responseCode_PaymentDetailsType ResponseCode;
+
+
+};
+
+struct FloatingValueType
+{
+ enum unitMultiplierType Multiplier;
+ enum unitSymbolType Unit;
+ int32_t Value;
+
+
+};
+
+struct PowerDiscoveryReqType
+{
+ struct PEVStatusType PEVStatus;
+ int32_t EoC;
+ struct FloatingValueType EAmount;
+ struct FloatingValueType PEVMaxPower;
+ int16_t PEVMaxPhases;
+ struct FloatingValueType PEVMaxVoltage;
+ struct FloatingValueType PEVMinVoltage;
+
+
+};
+
+struct arraylen_PowerDiscoveryResType_EnergyProvider
+{
+ size_t data;
+
+
+};
+
+struct PowerDiscoveryResType_EnergyProvider
+{
+ uint32_t data[20];
+ struct arraylen_PowerDiscoveryResType_EnergyProvider arraylen;
+
+};
+
+struct selection_PowerDiscoveryResType
+{
+ unsigned int EnergyProvider:1;
+ unsigned int TariffTable:1;
+
+
+};
+
+struct arraylen_TariffTableType_Currency
+{
+ size_t data;
+
+
+};
+
+struct TariffTableType_Currency
+{
+ uint32_t data[3];
+ struct arraylen_TariffTableType_Currency arraylen;
+
+};
+
+struct arraylen_TariffDescrType_TariffDescription
+{
+ size_t data;
+
+
+};
+
+struct TariffDescrType_TariffDescription
+{
+ uint32_t data[32];
+ struct arraylen_TariffDescrType_TariffDescription arraylen;
+
+};
+
+struct selection_TariffDescrType
+{
+ unsigned int TariffDescription:1;
+
+
+};
+
+struct selection_TariffEntryType
+{
+ unsigned int EPrice:1;
+
+
+};
+
+struct TariffEntryType
+{
+ uint32_t TariffStart;
+ struct FloatingValueType TariffPMax;
+ struct FloatingValueType EPrice;
+ struct selection_TariffEntryType isused;
+
+};
+
+struct arraylen_TariffEntriesType
+{
+ size_t TariffEntry;
+
+
+};
+
+struct TariffEntriesType
+{
+ struct TariffEntryType TariffEntry[8];
+ struct arraylen_TariffEntriesType arraylen;
+
+};
+
+struct TariffDescrType
+{
+ enum tariffIDType TariffID;
+ struct TariffDescrType_TariffDescription TariffDescription;
+ struct TariffEntriesType TariffEntries;
+ struct selection_TariffDescrType isused;
+
+};
+
+struct arraylen_TariffTableType
+{
+ size_t Tariff;
+
+
+};
+
+struct TariffTableType
+{
+ struct TariffTableType_Currency Currency;
+ struct TariffDescrType Tariff[6];
+ struct arraylen_TariffTableType arraylen;
+
+};
+
+struct PowerDiscoveryResType
+{
+ enum responseCode_PowerDiscoveryType ResponseCode;
+ struct EVSEStatusType EVSEStatus;
+ struct FloatingValueType EVSEVoltage;
+ struct FloatingValueType EVSEIMax;
+ int16_t EVSEMaxPhases;
+ struct PowerDiscoveryResType_EnergyProvider EnergyProvider;
+ struct TariffTableType TariffTable;
+ struct selection_PowerDiscoveryResType isused;
+
+};
+
+struct LineLockReqType
+{
+ struct PEVStatusType PEVStatus;
+ int ReqLockStatus;
+
+
+};
+
+struct LineLockResType
+{
+ enum responseCode_LineLockType ResponseCode;
+ struct EVSEStatusType EVSEStatus;
+
+
+};
+
+struct selection_PowerDeliveryReqType
+{
+ unsigned int Tariff:1;
+
+
+};
+
+struct PowerDeliveryReqType
+{
+ struct PEVStatusType PEVStatus;
+ int ReqSwitchStatus;
+ enum tariffIDType Tariff;
+ struct selection_PowerDeliveryReqType isused;
+
+};
+
+struct PowerDeliveryResType
+{
+ enum responseCode_PowerDeliveryType ResponseCode;
+
+
+};
+
+struct MeteringStatusReqType
+{
+
+
+ int NO_MEMBER:1;
+
+};
+
+struct arraylen_MeteringStatusResType_EVSEID
+{
+ size_t data;
+
+
+};
+
+struct MeteringStatusResType_EVSEID
+{
+ uint8_t data[32];
+ struct arraylen_MeteringStatusResType_EVSEID arraylen;
+
+};
+
+struct selection_MeteringStatusResType
+{
+ unsigned int PCurrent:1;
+ unsigned int MeterInfo:1;
+
+
+};
+
+struct arraylen_MeterInfoType_MeterID
+{
+ size_t data;
+
+
+};
+
+struct MeterInfoType_MeterID
+{
+ uint32_t data[32];
+ struct arraylen_MeterInfoType_MeterID arraylen;
+
+};
+
+struct selection_MeterInfoType
+{
+ unsigned int MeterID:1;
+ unsigned int MeterReading:1;
+ unsigned int MeterStatus:1;
+ unsigned int TMeter:1;
+
+
+};
+
+struct MeterInfoType
+{
+ struct MeterInfoType_MeterID MeterID;
+ struct FloatingValueType MeterReading;
+ int16_t MeterStatus;
+ int32_t TMeter;
+ struct selection_MeterInfoType isused;
+
+};
+
+struct MeteringStatusResType
+{
+ enum responseCode_MeteringStatusType ResponseCode;
+ struct MeteringStatusResType_EVSEID EVSEID;
+ struct EVSEStatusType EVSEStatus;
+ int32_t TCurrent;
+ struct FloatingValueType EVSEMaxPower;
+ struct FloatingValueType PCurrent;
+ struct MeterInfoType MeterInfo;
+ struct selection_MeteringStatusResType isused;
+
+};
+
+struct arraylen_MeteringReceiptReqType_PEVID
+{
+ size_t data;
+
+
+};
+
+struct MeteringReceiptReqType_PEVID
+{
+ uint32_t data[32];
+ struct arraylen_MeteringReceiptReqType_PEVID arraylen;
+
+};
+
+struct selection_MeteringReceiptReqType
+{
+ unsigned int PEVID:1;
+ unsigned int TCurrent:1;
+
+
+};
+
+struct MeteringReceiptReqType
+{
+ struct MeteringReceiptReqType_PEVID PEVID;
+ struct PEVStatusType PEVStatus;
+ int32_t TCurrent;
+ enum tariffIDType Tariff;
+ struct MeterInfoType MeterInfo;
+ struct selection_MeteringReceiptReqType isused;
+
+};
+
+struct MeteringReceiptResType
+{
+ enum responseCode_MeteringReceiptType ResponseCode;
+
+
+};
+
+struct BodyType
+{
+ struct SessionSetupReqType* SessionSetupReq;
+ struct SessionSetupResType* SessionSetupRes;
+ struct ServiceDiscoveryReqType* ServiceDiscoveryReq;
+ struct ServiceDiscoveryResType* ServiceDiscoveryRes;
+ struct ServicePaymentSelectionReqType* ServicePaymentSelectionReq;
+ struct ServicePaymentSelectionResType* ServicePaymentSelectionRes;
+ struct PaymentDetailsReqType* PaymentDetailsReq;
+ struct PaymentDetailsResType* PaymentDetailsRes;
+ struct PowerDiscoveryReqType* PowerDiscoveryReq;
+ struct PowerDiscoveryResType* PowerDiscoveryRes;
+ struct LineLockReqType* LineLockReq;
+ struct LineLockResType* LineLockRes;
+ struct PowerDeliveryReqType* PowerDeliveryReq;
+ struct PowerDeliveryResType* PowerDeliveryRes;
+ struct MeteringStatusReqType* MeteringStatusReq;
+ struct MeteringStatusResType* MeteringStatusRes;
+ struct MeteringReceiptReqType* MeteringReceiptReq;
+ struct MeteringReceiptResType* MeteringReceiptRes;
+ struct selection_BodyType isused;
+
+};
+
+struct AnonType_V2G_Message
+{
+ struct HeaderType* Header;
+ struct BodyType Body;
+
+
+};
+
+struct EXIDocumentType
+{
+ struct AnonType_V2G_Message V2G_Message;
+
+
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/service/v2g_serviceDispatcher.c b/src/service/v2g_serviceDispatcher.c
new file mode 100644
index 0000000..b925feb
--- /dev/null
+++ b/src/service/v2g_serviceDispatcher.c
@@ -0,0 +1,1178 @@
+
+
+
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+
+#include "v2g_service.h"
+#include "v2g_serviceDispatcher.h"
+#include "v2g_serviceDataTypes.h"
+#include "v2g_serviceDataTypes.c"
+#include "v2g_serviceMethods.h"
+#include "v2g_serviceDataSerialization.c"
+#include "EXITypes.h"
+#include "EXIDecoder.h"
+#include "EXIEncoder.h"
+
+
+static int deserializeMessage(struct EXIService* service);
+
+/**
+ * Deserialize an element value of the EXI stream and assign it to the
+ * service data structure
+ */
+static int deserializeElementCharacter(struct EXIService* service)
+{
+
+ switch(service->eqn.namespaceURI) {
+ case 4:
+ switch(service->eqn.localPart) {
+ case 24: /*PEVID*/
+
+ if(service->val.type == STRING)
+ {
+ if(service->idPath.id[2] == 56)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.SessionSetupReq->PEVID.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.SessionSetupReq->PEVID.arraylen.data = service->val.string.len;
+ service->exiMsg.V2G_Message.Body.SessionSetupReq->isused.PEVID=1;
+ }
+ else
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.MeteringReceiptReq->PEVID.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->PEVID.arraylen.data = service->val.string.len;
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->isused.PEVID=1;
+ }
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 55: /*ServiceType*/
+ if(service->val.type == ENUMERATION)
+ {
+ if(service->idPath.id[1] == 0)
+ {
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->ServiceType=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->isused.ServiceType=1;
+
+
+ } else if(service->idPath.id[1] == 0)
+ {
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceType=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].isused.ServiceType=1;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->isused.ServiceType=1;*/
+ break;
+ case 54: /*ServiceScope*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->ServiceScope.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->ServiceScope.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->isused.ServiceScope=1;*/
+ break;
+ case 0: /*ContractID*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractID.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractID.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 9: /*EoC*/
+ if(service->val.type == INTEGER_32)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->EoC=service->val.int32;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 25: /*PEVMaxPhases*/
+ if(service->val.type == INTEGER_16)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMaxPhases=service->val.int32;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 42: /*ReqLockStatus*/
+ if(service->val.type == BOOLEAN)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockReq->ReqLockStatus=service->val.boolean;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 43: /*ReqSwitchStatus*/
+ if(service->val.type == BOOLEAN)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDeliveryReq->ReqSwitchStatus=service->val.boolean;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 61: /*Tariff*/
+ if(service->val.type == ENUMERATION)
+ {
+ if(service->idPath.id[2] == 34)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDeliveryReq->Tariff=service->val.enumeration;
+ service->exiMsg.V2G_Message.Body.PowerDeliveryReq->isused.Tariff=1;
+
+
+ } else if(service->idPath.id[2] == 15)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->Tariff=service->val.enumeration;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Body.PowerDeliveryReq->isused.Tariff=1;*/
+ break;
+ case 60: /*TCurrent*/
+ if(service->val.type == INTEGER_32)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->TCurrent=service->val.int32;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Body.MeteringReceiptReq->isused.TCurrent=1;*/
+ break;
+ } /* close switch(service->eqn.localPart) */
+ break;
+ case 5:
+ switch(service->eqn.localPart) {
+ case 34: /*SessionID*/
+
+ if(service->val.type == BINARY_HEX)
+ {
+ /* array copy and array length assignment */
+ memcpy(service->exiMsg.V2G_Message.Header->SessionInformation.SessionID.data, service->val.binary.data,service->val.binary.len);
+ service->exiMsg.V2G_Message.Header->SessionInformation.SessionID.arraylen.data = service->val.binary.len;
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 32: /*ServiceSessionID*/
+
+ if(service->val.type == BINARY_HEX)
+ {
+ /* array copy and array length assignment */
+ memcpy(service->exiMsg.V2G_Message.Header->SessionInformation.ServiceSessionID.data, service->val.binary.data,service->val.binary.len);
+ service->exiMsg.V2G_Message.Header->SessionInformation.ServiceSessionID.arraylen.data = service->val.binary.len;
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Header->SessionInformation.isused.ServiceSessionID=1;*/
+ break;
+ case 24: /*ProtocolVersion*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Header->SessionInformation.ProtocolVersion.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Header->SessionInformation.ProtocolVersion.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Header->SessionInformation.isused.ProtocolVersion=1;*/
+ break;
+ case 9: /*Event*/
+ if(service->val.type == ENUMERATION)
+ {
+ service->exiMsg.V2G_Message.Header->Notification.EventList.Event=service->val.enumeration;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 13: /*FaultCode*/
+ if(service->val.type == ENUMERATION)
+ {
+ service->exiMsg.V2G_Message.Header->Notification.FaultCode=service->val.enumeration;
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Header->Notification.isused.FaultCode=1;*/
+ break;
+ case 14: /*FaultMsg*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Header->Notification.FaultMsg.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Header->Notification.FaultMsg.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Header->Notification.isused.FaultMsg=1;*/
+ break;
+ case 4: /*ConnectorLocked*/
+ if(service->val.type == BOOLEAN)
+ {
+ if(service->idPath.id[2] == 56)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupReq->PEVStatus.ConnectorLocked=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 38)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVStatus.ConnectorLocked=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 10)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockReq->PEVStatus.ConnectorLocked=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 34)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDeliveryReq->PEVStatus.ConnectorLocked=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 15)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->PEVStatus.ConnectorLocked=service->val.boolean;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 0: /*ChargerStandby*/
+ if(service->val.type == BOOLEAN)
+ {
+ if(service->idPath.id[2] == 56)
+ {
+ service->exiMsg.V2G_Message.Body.SessionSetupReq->PEVStatus.ChargerStandby=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 38)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVStatus.ChargerStandby=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 10)
+ {
+ service->exiMsg.V2G_Message.Body.LineLockReq->PEVStatus.ChargerStandby=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 34)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDeliveryReq->PEVStatus.ChargerStandby=service->val.boolean;
+
+
+ } else if(service->idPath.id[2] == 15)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->PEVStatus.ChargerStandby=service->val.boolean;
+
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 20: /*Multiplier*/
+ if(service->val.type == ENUMERATION)
+ {
+ if(service->idPath.id[3] == 1)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->EAmount.Multiplier=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 26)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMaxPower.Multiplier=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 27)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMaxVoltage.Multiplier=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 28)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMinVoltage.Multiplier=service->val.enumeration;
+
+
+ }else if(service->idPath.id[3] == 14)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterReading.Multiplier=service->val.enumeration;
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 49: /*Unit*/
+ if(service->val.type == ENUMERATION)
+ {
+ if(service->idPath.id[3] == 1)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->EAmount.Unit=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 26)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMaxPower.Unit=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 27)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMaxVoltage.Unit=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 28)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMinVoltage.Unit=service->val.enumeration;
+
+
+ } else if(service->idPath.id[3] == 14)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterReading.Unit=service->val.enumeration;
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 50: /*Value*/
+ if(service->val.type == INTEGER_32)
+ {
+ if(service->idPath.id[3] == 1)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->EAmount.Value=service->val.int32;
+
+
+ } else if(service->idPath.id[3] == 26)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMaxPower.Value=service->val.int32;
+
+
+ } else if(service->idPath.id[3] == 27)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMaxVoltage.Value=service->val.int32;
+
+
+ } else if(service->idPath.id[3] == 28)
+ {
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq->PEVMinVoltage.Value=service->val.int32;
+
+
+ }else if(service->idPath.id[3] == 14)
+ {
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterReading.Value=service->val.int32;
+
+ }
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ break;
+ case 16: /*MeterID*/
+
+ if(service->val.type == STRING)
+ {
+ /* string copy and string length assignment */
+ memcpy(service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterID.data, service->val.string.codepoints,service->val.string.len*sizeof(uint32_t));
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterID.arraylen.data = service->val.string.len;
+
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.MeterID=1;*/
+ break;
+ case 19: /*MeterStatus*/
+ if(service->val.type == INTEGER_16)
+ {
+
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterStatus=service->val.int32;
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.MeterStatus=1;*/
+ break;
+ case 37: /*TMeter*/
+ if(service->val.type == INTEGER_32)
+ {
+
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.TMeter=service->val.int32;
+
+ }
+ else
+ {
+ return -1; /* wrong data type */
+ }
+
+ /* is used */
+ /*service->exiMsg.V2G_Message.Body.MeteringStatusRes->MeterInfo.isused.TMeter=1;*/
+ break;
+ } /* close switch(service->eqn.localPart) */
+ break;
+
+ } /* close switch(service->eqn.namespaceURI) */
+ return 0;
+}
+
+/**
+ * Depending on the current EXI event a message element is deserialized or a
+ * defined service method is called in here
+ */
+static int deserializeElementOrServiceCall(struct EXIService* service)
+{
+
+ switch(service->eqn.namespaceURI) {
+ case 4:
+ switch(service->eqn.localPart) {
+ case 54:/* ServiceScope */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->isused.ServiceScope=1;
+ break;
+ case 60:/* TCurrent */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->isused.TCurrent=1;
+ break;
+ case 56:/* SessionSetupReq */
+
+
+
+
+ /* test, if data length is unequal to the expected payload */
+ if((service->inStream.size)!= *(service->inStream.pos))
+ {
+ service->errorCode = EXI_NON_VALID_MESSAGE;
+ return -1;
+ }
+
+ /* service call */
+ sessionSetup((service->exiMsg.V2G_Message.Body.SessionSetupReq), (service->exiMsg.V2G_Message.Body.SessionSetupRes));
+
+ /* signalize the response message */
+ service->exiMsg.V2G_Message.Body.isused.SessionSetupRes=1;
+
+ /* serialize the response data */
+ if(serialize_message(service))
+ {
+ /* serializiation error*/
+ service->errorCode= EXI_SERIALIZATION_FAILED;
+ }
+
+
+
+ break;
+ case 45:/* ServiceDiscoveryReq */
+
+
+
+
+ /* test, if data length is unequal to the expected payload */
+ if((service->inStream.size)!= *(service->inStream.pos))
+ {
+ service->errorCode = EXI_NON_VALID_MESSAGE;
+ return -1;
+ }
+
+ /* service call */
+ serviceDiscovery((service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq), (service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes));
+
+ /* signalize the response message */
+ service->exiMsg.V2G_Message.Body.isused.ServiceDiscoveryRes=1;
+
+ /* serialize the response data */
+ if(serialize_message(service))
+ {
+ /* serializiation error*/
+ service->errorCode= EXI_SERIALIZATION_FAILED;
+ }
+
+
+
+ break;
+ case 50:/* ServicePaymentSelectionReq */
+
+
+
+
+ /* test, if data length is unequal to the expected payload */
+ if((service->inStream.size)!= *(service->inStream.pos))
+ {
+ service->errorCode = EXI_NON_VALID_MESSAGE;
+ return -1;
+ }
+
+ /* service call */
+ selectedServicePayment((service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq), (service->exiMsg.V2G_Message.Body.ServicePaymentSelectionRes));
+
+ /* signalize the response message */
+ service->exiMsg.V2G_Message.Body.isused.ServicePaymentSelectionRes=1;
+
+ /* serialize the response data */
+ if(serialize_message(service))
+ {
+ /* serializiation error*/
+ service->errorCode= EXI_SERIALIZATION_FAILED;
+ }
+
+
+
+ break;
+ case 30:/* PaymentDetailsReq */
+
+
+
+
+ /* test, if data length is unequal to the expected payload */
+ if((service->inStream.size)!= *(service->inStream.pos))
+ {
+ service->errorCode = EXI_NON_VALID_MESSAGE;
+ return -1;
+ }
+
+ /* service call */
+ paymentDetails((service->exiMsg.V2G_Message.Body.PaymentDetailsReq), (service->exiMsg.V2G_Message.Body.PaymentDetailsRes));
+
+ /* signalize the response message */
+ service->exiMsg.V2G_Message.Body.isused.PaymentDetailsRes=1;
+
+ /* serialize the response data */
+ if(serialize_message(service))
+ {
+ /* serializiation error*/
+ service->errorCode= EXI_SERIALIZATION_FAILED;
+ }
+
+
+
+ break;
+ case 38:/* PowerDiscoveryReq */
+
+
+
+
+ /* test, if data length is unequal to the expected payload */
+ if((service->inStream.size)!= *(service->inStream.pos))
+ {
+ service->errorCode = EXI_NON_VALID_MESSAGE;
+ return -1;
+ }
+
+ /* service call */
+ powerDiscovery((service->exiMsg.V2G_Message.Body.PowerDiscoveryReq), (service->exiMsg.V2G_Message.Body.PowerDiscoveryRes));
+
+ /* signalize the response message */
+ service->exiMsg.V2G_Message.Body.isused.PowerDiscoveryRes=1;
+
+ /* serialize the response data */
+ if(serialize_message(service))
+ {
+ /* serializiation error*/
+ service->errorCode= EXI_SERIALIZATION_FAILED;
+ }
+
+
+
+ break;
+ case 10:/* LineLockReq */
+
+
+
+
+ /* test, if data length is unequal to the expected payload */
+ if((service->inStream.size)!= *(service->inStream.pos))
+ {
+ service->errorCode = EXI_NON_VALID_MESSAGE;
+ return -1;
+ }
+
+ /* service call */
+ lineLock((service->exiMsg.V2G_Message.Body.LineLockReq), (service->exiMsg.V2G_Message.Body.LineLockRes));
+
+ /* signalize the response message */
+ service->exiMsg.V2G_Message.Body.isused.LineLockRes=1;
+
+ /* serialize the response data */
+ if(serialize_message(service))
+ {
+ /* serializiation error*/
+ service->errorCode= EXI_SERIALIZATION_FAILED;
+ }
+
+
+
+ break;
+ case 34:/* PowerDeliveryReq */
+
+
+
+
+ /* test, if data length is unequal to the expected payload */
+ if((service->inStream.size)!= *(service->inStream.pos))
+ {
+ service->errorCode = EXI_NON_VALID_MESSAGE;
+ return -1;
+ }
+
+ /* service call */
+ powerDelivery((service->exiMsg.V2G_Message.Body.PowerDeliveryReq), (service->exiMsg.V2G_Message.Body.PowerDeliveryRes));
+
+ /* signalize the response message */
+ service->exiMsg.V2G_Message.Body.isused.PowerDeliveryRes=1;
+
+ /* serialize the response data */
+ if(serialize_message(service))
+ {
+ /* serializiation error*/
+ service->errorCode= EXI_SERIALIZATION_FAILED;
+ }
+
+
+
+ break;
+ case 19:/* MeteringStatusReq */
+
+
+
+
+ /* test, if data length is unequal to the expected payload */
+ if((service->inStream.size)!= *(service->inStream.pos))
+ {
+ service->errorCode = EXI_NON_VALID_MESSAGE;
+ return -1;
+ }
+
+ /* service call */
+ meteringStatus((service->exiMsg.V2G_Message.Body.MeteringStatusReq), (service->exiMsg.V2G_Message.Body.MeteringStatusRes));
+
+ /* signalize the response message */
+ service->exiMsg.V2G_Message.Body.isused.MeteringStatusRes=1;
+
+ /* serialize the response data */
+ if(serialize_message(service))
+ {
+ /* serializiation error*/
+ service->errorCode= EXI_SERIALIZATION_FAILED;
+ }
+
+
+
+ break;
+ case 15:/* MeteringReceiptReq */
+
+
+
+
+ /* test, if data length is unequal to the expected payload */
+ if((service->inStream.size)!= *(service->inStream.pos))
+ {
+ service->errorCode = EXI_NON_VALID_MESSAGE;
+ return -1;
+ }
+
+ /* service call */
+ meteringReceipt((service->exiMsg.V2G_Message.Body.MeteringReceiptReq), (service->exiMsg.V2G_Message.Body.MeteringReceiptRes));
+
+ /* signalize the response message */
+ service->exiMsg.V2G_Message.Body.isused.MeteringReceiptRes=1;
+
+ /* serialize the response data */
+ if(serialize_message(service))
+ {
+ /* serializiation error*/
+ service->errorCode= EXI_SERIALIZATION_FAILED;
+ }
+
+
+
+ break;
+ }
+ break;
+ case 5:
+ switch(service->eqn.localPart) {
+ case 32:/* ServiceSessionID */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->SessionInformation.isused.ServiceSessionID=1;
+ break;
+ case 24:/* ProtocolVersion */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->SessionInformation.isused.ProtocolVersion=1;
+ break;
+ case 13:/* FaultCode */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->Notification.isused.FaultCode=1;
+ break;
+ case 14:/* FaultMsg */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->Notification.isused.FaultMsg=1;
+ break;
+ case 10:/* EventList */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->Notification.isused.EventList=1;
+ break;
+ case 26:/* Service */
+
+ /* increment*/
+ service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq->ServiceList.arraylen.Service++;
+
+ break;
+ case 16:/* MeterID */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.isused.MeterID=1;
+ break;
+ case 18:/* MeterReading */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.isused.MeterReading=1;
+ break;
+ }
+ break;
+ case 7:
+ switch(service->eqn.localPart) {
+ case 1:/* Notification */
+
+
+ /* is used */
+ service->exiMsg.V2G_Message.Header->isused.Notification=1;
+ break;
+ }
+ break;
+
+ }
+ return 0;
+}
+
+static int deserializeSessionSetupReqMsg(struct EXIService* service)
+{
+ struct SessionSetupReqType reqMsg;
+ struct SessionSetupResType resMsg;
+ init_SessionSetupReqType(&reqMsg);
+
+ service->exiMsg.V2G_Message.Body.SessionSetupReq = &reqMsg;
+ service->exiMsg.V2G_Message.Body.SessionSetupRes = &resMsg;
+
+ return deserializeMessage(service);
+}
+
+static int deserializeServiceDiscoveryReqMsg(struct EXIService* service)
+{
+ struct ServiceDiscoveryReqType reqMsg;
+ struct ServiceDiscoveryResType resMsg;
+ init_ServiceDiscoveryReqType(&reqMsg);
+
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq = &reqMsg;
+ service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes = &resMsg;
+
+ return deserializeMessage(service);
+}
+
+static int deserializeServicePaymentSelectionReqMsg(struct EXIService* service)
+{
+ struct ServicePaymentSelectionReqType reqMsg;
+ struct ServicePaymentSelectionResType resMsg;
+ service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq = &reqMsg;
+ service->exiMsg.V2G_Message.Body.ServicePaymentSelectionRes = &resMsg;
+
+ return deserializeMessage(service);
+}
+
+static int deserializePaymentDetailsReqMsg(struct EXIService* service)
+{
+ struct PaymentDetailsReqType reqMsg;
+ struct PaymentDetailsResType resMsg;
+ service->exiMsg.V2G_Message.Body.PaymentDetailsReq = &reqMsg;
+ service->exiMsg.V2G_Message.Body.PaymentDetailsRes = &resMsg;
+
+ return deserializeMessage(service);
+}
+
+static int deserializePowerDiscoveryReqMsg(struct EXIService* service)
+{
+ struct PowerDiscoveryReqType reqMsg;
+ struct PowerDiscoveryResType resMsg;
+ init_PowerDiscoveryReqType(&reqMsg);
+
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryReq = &reqMsg;
+ service->exiMsg.V2G_Message.Body.PowerDiscoveryRes = &resMsg;
+
+ return deserializeMessage(service);
+}
+
+static int deserializeLineLockReqMsg(struct EXIService* service)
+{
+ struct LineLockReqType reqMsg;
+ struct LineLockResType resMsg;
+ init_LineLockReqType(&reqMsg);
+
+ service->exiMsg.V2G_Message.Body.LineLockReq = &reqMsg;
+ service->exiMsg.V2G_Message.Body.LineLockRes = &resMsg;
+
+ return deserializeMessage(service);
+}
+
+static int deserializePowerDeliveryReqMsg(struct EXIService* service)
+{
+ struct PowerDeliveryReqType reqMsg;
+ struct PowerDeliveryResType resMsg;
+ init_PowerDeliveryReqType(&reqMsg);
+
+ service->exiMsg.V2G_Message.Body.PowerDeliveryReq = &reqMsg;
+ service->exiMsg.V2G_Message.Body.PowerDeliveryRes = &resMsg;
+
+ return deserializeMessage(service);
+}
+
+static int deserializeMeteringStatusReqMsg(struct EXIService* service)
+{
+ struct MeteringStatusReqType reqMsg;
+ struct MeteringStatusResType resMsg;
+ service->exiMsg.V2G_Message.Body.MeteringStatusReq = &reqMsg;
+ service->exiMsg.V2G_Message.Body.MeteringStatusRes = &resMsg;
+
+ return deserializeMessage(service);
+}
+
+static int deserializeMeteringReceiptReqMsg(struct EXIService* service)
+{
+ struct MeteringReceiptReqType reqMsg;
+ struct MeteringReceiptResType resMsg;
+ init_MeteringReceiptReqType(&reqMsg);
+
+ service->exiMsg.V2G_Message.Body.MeteringReceiptReq = &reqMsg;
+ service->exiMsg.V2G_Message.Body.MeteringReceiptRes = &resMsg;
+
+ return deserializeMessage(service);
+}
+
+/**
+ * Deserialize the EXI stream
+ * @return 0 = 0K; -1 = ERROR
+ */
+static int deserializeMessage(struct EXIService* service)
+{
+ int noEndOfDocument = 1; /* true */
+ int returnCode=0;
+
+
+ do {
+ exiDecodeNextEvent(&(service->inStream), &(service->stateDecode), &(service->event));
+ if (returnCode)
+ {
+
+ if(service->errorCode==0)
+ {
+ service->errorCode= EXI_NON_VALID_MESSAGE;
+ }
+
+ return returnCode;
+ }
+
+ switch (service->event) {
+ case START_DOCUMENT:
+
+ returnCode = exiDecodeStartDocument(&(service->inStream), &(service->stateDecode));
+
+ break;
+ case END_DOCUMENT:
+
+ returnCode = exiDecodeEndDocument(&(service->inStream), &(service->stateDecode));
+ noEndOfDocument = 0; /* false */
+ break;
+ case START_ELEMENT:
+ returnCode = exiDecodeStartElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
+ service->idPath.id[service->idPath.pos++]=service->eqn.localPart;
+
+ /* setup the request context*/
+ if(service->eqn.localPart==56 && service->eqn.namespaceURI==4)
+ {
+ return deserializeSessionSetupReqMsg(service);
+ } else if(service->eqn.localPart==45 && service->eqn.namespaceURI==4)
+ {
+ return deserializeServiceDiscoveryReqMsg(service);
+ } else if(service->eqn.localPart==50 && service->eqn.namespaceURI==4)
+ {
+ return deserializeServicePaymentSelectionReqMsg(service);
+ } else if(service->eqn.localPart==30 && service->eqn.namespaceURI==4)
+ {
+ return deserializePaymentDetailsReqMsg(service);
+ } else if(service->eqn.localPart==38 && service->eqn.namespaceURI==4)
+ {
+ return deserializePowerDiscoveryReqMsg(service);
+ } else if(service->eqn.localPart==10 && service->eqn.namespaceURI==4)
+ {
+ return deserializeLineLockReqMsg(service);
+ } else if(service->eqn.localPart==34 && service->eqn.namespaceURI==4)
+ {
+ return deserializePowerDeliveryReqMsg(service);
+ } else if(service->eqn.localPart==19 && service->eqn.namespaceURI==4)
+ {
+ return deserializeMeteringStatusReqMsg(service);
+ } else if(service->eqn.localPart==15 && service->eqn.namespaceURI==4)
+ {
+ return deserializeMeteringReceiptReqMsg(service);
+ }
+
+
+ break;
+ case END_ELEMENT:
+
+ returnCode = exiDecodeEndElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
+ returnCode = deserializeElementOrServiceCall(service);
+ service->idPath.pos--;
+
+ break;
+ case CHARACTERS:
+ /* decode */
+ returnCode = exiDecodeCharacters(&(service->inStream), &(service->stateDecode), &(service->val));
+
+ /* assign data to the EXI message structure */
+ returnCode = deserializeElementCharacter(service);
+ break;
+ case ATTRIBUTE:
+ /* decode */
+ /* returnCode = exiDecodeAttribute(&isStream, &stateDecode, &eqn, &val); */
+ break;
+ default:
+ /* ERROR */
+ return -1;
+ }
+
+ } while (noEndOfDocument);
+
+ return 0;
+}
+
+
+/**
+ * \brief Takes the EXI stream, invokes the called service method, and provides the response EXI stream
+ * \param service struct EXIService* Represent the service data structure
+ * \param inStream uint8_t* EXI in stream
+ * \param sizeInStream uint16_t Length of the inStream
+ * \param outStream uint8_t* Represent the out stream
+ * \param sizeOutStream uint16_t Size of the out stream
+ * \param outStreamLength uint16_t* Length of the stream
+ * \return 0 = 0K; -1 = ERROR
+ */
+int messageDispatcher(struct EXIService* service, uint8_t* inStream, uint16_t sizeInStream, uint8_t* outStream, uint16_t sizeOutStream, uint16_t* outStreamLength)
+{
+ struct HeaderType header;
+
+
+ uint16_t inPos, outPos;
+
+ /* assign inStream data to service EXI structure */
+ inPos = service->transportHeaderOffset;
+ service->inStream.data = inStream;
+ service->inStream.size = sizeInStream+inPos;
+ service->inStream.pos = &inPos;
+ service->inStream.buffer=0;
+ service->inStream.capacity=0;
+
+
+ /* assign outStream data to service EXI structure */
+ outPos=service->transportHeaderOffset;
+ service->outStream.data = outStream;
+ service->outStream.size = sizeOutStream;
+ service->outStream.pos = &outPos;
+ service->outStream.buffer=0;
+ service->outStream.capacity=8;
+
+ /* clear error code */
+ service->errorCode = 0;
+
+ /* init EXI decoder (read header, set initial state) */
+ exiInitDecoder(&(service->inStream), &(service->stateDecode));
+
+ /* init EXI encoder (write header, set initial state) */
+ exiInitEncoder(&(service->outStream), &(service->stateEncode));
+
+ /* init uniqueID stack */
+ service->idPath.pos=0;
+
+ init_HeaderType(&header);
+ service->exiMsg.V2G_Message.Header = &header;
+
+ /* init EXI message */
+ init_EXIDocumentType(&(service->exiMsg));
+
+ /* deserialize the input stream and call the corresponding service */
+ if(deserializeMessage(service))
+ {
+ return -1; /* something went wrong */
+ }
+
+ /* determine payload size (without transport offset) */
+ outPos -= service->transportHeaderOffset;
+ *outStreamLength = outPos;
+
+
+ return 0;
+}
+
+/**
+ * \brief Init the v2g service data structure
+ * \param service struct EXIService* Service data structure
+ * \param bytes bytes_t setted up byte data structure
+ * \param string_ucs_t setted up string data structure
+ * \param transportHeaderOffset uint16_t Transport protocol offset
+ * \return 0 = 0K; -1 = ERROR
+ */
+int init_v2gservice(struct EXIService* service, bytes_t bytes, string_ucs_t string, uint16_t transportHeaderOffset)
+{
+
+ /* init byte array */
+ service->val.binary = bytes;
+
+ /* init string array */
+ service->val.string = string;
+
+ /* init offset for transport protocoll */
+ service->transportHeaderOffset=transportHeaderOffset;
+
+ return 0;
+}
diff --git a/src/service/v2g_serviceDispatcher.h b/src/service/v2g_serviceDispatcher.h
new file mode 100644
index 0000000..24de0aa
--- /dev/null
+++ b/src/service/v2g_serviceDispatcher.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef V2GSERVER_H_
+#define V2GSERVER_H_
+
+#include "v2g_serviceDataTypes.h"
+
+
+int init_v2gservice(struct EXIService* service,bytes_t bytes, string_ucs_t string, uint16_t transportHeaderOffset);
+int messageDispatcher(struct EXIService* service, uint8_t* inStream, uint16_t sizeInStream, uint8_t* outStream, uint16_t sizeOutStream, uint16_t* outPos);
+
+#endif /* V2GSERVER_H_ */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/service/v2g_serviceMethods.h b/src/service/v2g_serviceMethods.h
new file mode 100644
index 0000000..e2cbd9a
--- /dev/null
+++ b/src/service/v2g_serviceMethods.h
@@ -0,0 +1,69 @@
+
+
+
+
+/*
+ * Copyright (C) 2007-2010 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch.EXT@siemens.com
+ * @version 0.3.1
+ * @contact Joerg.Heuer@siemens.com
+ *
+ ********************************************************************/
+
+
+ #ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SERVICEMETHODS_H
+#define SERVICEMETHODS_H
+
+#include "v2g_serviceDataTypes.h"
+#include "EXITypes.h"
+
+/* This service methods has to be implemented by the EVSE server */
+int sessionSetup(struct SessionSetupReqType* param, struct SessionSetupResType* result);
+
+int serviceDiscovery(struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result);
+
+int selectedServicePayment(struct ServicePaymentSelectionReqType* param, struct ServicePaymentSelectionResType* result);
+
+int paymentDetails(struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result);
+
+int powerDiscovery(struct PowerDiscoveryReqType* param, struct PowerDiscoveryResType* result);
+
+int lineLock(struct LineLockReqType* param, struct LineLockResType* result);
+
+int powerDelivery(struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result);
+
+int meteringStatus(struct MeteringStatusReqType* param, struct MeteringStatusResType* result);
+
+int meteringReceipt(struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result);
+
+
+
+
+
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif