diff --git a/src/service/v2g_service.h b/src/service/v2g_service.h new file mode 100644 index 0000000..67f8e8b --- /dev/null +++ b/src/service/v2g_service.h @@ -0,0 +1,83 @@ +/* + * 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.7 + * @contact Joerg.Heuer@siemens.com + * + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef EXI_SERVICE_H_ +#define EXI_SERVICE_H_ + +#include "v2g_dataTypes.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; + uint16_t qnameID; + 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 transported header data */ + uint16_t transportHeaderOffset; +}; + +/* define error codes */ +#define EXI_NON_VALID_MESSAGE 0x01 +#define EXI_SERIALIZATION_FAILED 0x02 +#define EXI_DESERIALIZATION_FAILED 0x03 +#define EXI_DATATYPE_FAILED 0x04 +#define EXI_VALUE_RANGE_FAILED 0x05 +#define EXI_SERVICE_CALL_FAILED 0x06 + +#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..6335cf2 --- /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.7 + * @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..db473cb --- /dev/null +++ b/src/service/v2g_serviceClientStubs.c @@ -0,0 +1,3655 @@ + + +/* + * Copyright (C) 2007-2012 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.7 + * @contact Joerg.Heuer@siemens.com + * + *

Code generated by EXISeGen

+ * + ********************************************************************/ + + + #include "v2g_dataTypes.h" + #include "v2g_dataTypes.c" + #include "v2g_serviceClientStubs.h" + #include "v2g_serviceDataSerialization.c" + #include "v2g_serviceClientDataTransmitter.h" + #include "EXITypes.h" + #include "EXIDecoder.h" + #include "EXIEncoder.h" + #include "QNameDefines.h" + #include "StringTable.h" + + +static int deserializeMessage(struct EXIService* service); + +uint16_t numberOfLocalStringsDecode[EXI_MAX_NUMBER_OF_QNAMES]; +uint16_t numberOfLocalStringsEncode[EXI_MAX_NUMBER_OF_QNAMES]; + + +static int _setInt64Value(exi_integer_t* iv, int64_t* int64) { + int errn = 0; + switch(iv->type) { + /* Unsigned Integer */ + case EXI_UNSIGNED_INTEGER_8: + *int64 = iv->val.uint8; + break; + case EXI_UNSIGNED_INTEGER_16: + *int64 = iv->val.uint16; + break; + case EXI_UNSIGNED_INTEGER_32: + if (iv->val.uint32 <= 2147483647) { + *int64 = iv->val.uint32; + } else { + errn = -1; + } + break; + case EXI_UNSIGNED_INTEGER_64: + *int64 = iv->val.uint64; + break; + /* (Signed) Integer */ + case EXI_INTEGER_8: + *int64 = iv->val.int8; + break; + case EXI_INTEGER_16: + *int64 = iv->val.int16; + break; + case EXI_INTEGER_32: + *int64 = iv->val.int32; + break; + case EXI_INTEGER_64: + *int64 = iv->val.int64; + break; + } + return errn; +} + + +static int _setUnsignedInt32Value(exi_integer_t* iv, uint32_t* int32) { + int errn = 0; + switch(iv->type) { + /* Unsigned Integer */ + case EXI_UNSIGNED_INTEGER_8: + *int32 = iv->val.uint8; + break; + case EXI_UNSIGNED_INTEGER_16: + *int32 = iv->val.uint16; + break; + case EXI_UNSIGNED_INTEGER_32: + if (iv->val.uint32 <= 2147483647) { + *int32 = iv->val.uint32; + } else { + errn = -1; + } + break; + case EXI_UNSIGNED_INTEGER_64: + errn = -1; + break; + /* (Signed) Integer */ + case EXI_INTEGER_8: + *int32 = iv->val.int8; + break; + case EXI_INTEGER_16: + *int32 = iv->val.int16; + break; + case EXI_INTEGER_32: + *int32 = iv->val.int32; + break; + case EXI_INTEGER_64: + errn = -1; + break; + } + return errn; +} + +static int _setUnsignedInt16Value(exi_integer_t* iv, uint16_t* uint16) { + int errn = 0; + switch(iv->type) { + /* Unsigned Integer */ + case EXI_UNSIGNED_INTEGER_8: + *uint16 = iv->val.uint8; + break; + case EXI_UNSIGNED_INTEGER_16: + *uint16 = iv->val.uint16; + break; + case EXI_UNSIGNED_INTEGER_32: + if (iv->val.uint32 <= 2147483647) { + errn = -1; + } else { + errn = -1; + } + break; + case EXI_UNSIGNED_INTEGER_64: + errn = -1; + break; + /* (Signed) Integer */ + case EXI_INTEGER_8: + *uint16 = iv->val.int8; + break; + case EXI_INTEGER_16: + *uint16 = iv->val.int16; + break; + case EXI_INTEGER_32: + errn = -1; + break; + case EXI_INTEGER_64: + errn = -1; + break; + } + return errn; +} + +static int _setInt16Value(exi_integer_t* iv, int16_t* int16) { + int errn = 0; + switch(iv->type) { + /* Unsigned Integer */ + case EXI_UNSIGNED_INTEGER_8: + *int16 = iv->val.uint8; + break; + case EXI_UNSIGNED_INTEGER_16: + *int16 = iv->val.int16; + break; + case EXI_UNSIGNED_INTEGER_32: + errn = -1; + break; + case EXI_UNSIGNED_INTEGER_64: + errn = -1; + break; + /* (Signed) Integer */ + case EXI_INTEGER_8: + *int16 = iv->val.int8; + break; + case EXI_INTEGER_16: + *int16 = iv->val.int16; + break; + case EXI_INTEGER_32: + errn = -1;; + break; + case EXI_INTEGER_64: + errn = -1; + break; + } + return errn; +} + + + + + +/** + * \brief Prepares the remote sessionSetup call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_sessionSetup(struct EXIService* service, struct MessageHeaderType* header, struct SessionSetupReqType* params, struct SessionSetupResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* 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; + + + service->exiMsg.V2G_Message.Body.SessionSetupRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote serviceDiscovery call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_serviceDiscovery(struct EXIService* service, struct MessageHeaderType* header, struct ServiceDiscoveryReqType* params, struct ServiceDiscoveryResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + init_ServiceDiscoveryResType(result); + + + + /* 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; + + + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote serviceDetail call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct ServiceDetailReqType* Request data for the server (has to be set up before) + * \param result struct ServiceDetailResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_serviceDetail(struct EXIService* service, struct MessageHeaderType* header, struct ServiceDetailReqType* params, struct ServiceDetailResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + + + + /* assign data to service data structure */ + service->exiMsg.V2G_Message.Header = header; + service->exiMsg.V2G_Message.Body.ServiceDetailReq = params; + service->exiMsg.V2G_Message.Body.isused.ServiceDetailReq=1; + + + service->exiMsg.V2G_Message.Body.ServiceDetailRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote servicePaymentSelection call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_servicePaymentSelection(struct EXIService* service, struct MessageHeaderType* header, struct ServicePaymentSelectionReqType* params, struct ServicePaymentSelectionResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* 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; + + + service->exiMsg.V2G_Message.Body.ServicePaymentSelectionRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote paymentDetails call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_paymentDetails(struct EXIService* service, struct MessageHeaderType* header, struct PaymentDetailsReqType* params, struct PaymentDetailsResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* 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; + + + service->exiMsg.V2G_Message.Body.PaymentDetailsRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote contractAuthentication call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct ContractAuthenticationReqType* Request data for the server (has to be set up before) + * \param result struct ContractAuthenticationResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_contractAuthentication(struct EXIService* service, struct MessageHeaderType* header, struct ContractAuthenticationReqType* params, struct ContractAuthenticationResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + + + + /* assign data to service data structure */ + service->exiMsg.V2G_Message.Header = header; + service->exiMsg.V2G_Message.Body.ContractAuthenticationReq = params; + service->exiMsg.V2G_Message.Body.isused.ContractAuthenticationReq=1; + + + service->exiMsg.V2G_Message.Body.ContractAuthenticationRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote chargeParameterDiscovery call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct ChargeParameterDiscoveryReqType* Request data for the server (has to be set up before) + * \param result struct ChargeParameterDiscoveryResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_chargeParameterDiscovery(struct EXIService* service, struct MessageHeaderType* header, struct ChargeParameterDiscoveryReqType* params, struct ChargeParameterDiscoveryResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + init_ChargeParameterDiscoveryResType(result); + + + /* assign data to service data structure */ + service->exiMsg.V2G_Message.Header = header; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq = params; + service->exiMsg.V2G_Message.Body.isused.ChargeParameterDiscoveryReq=1; + + + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote powerDelivery call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_powerDelivery(struct EXIService* service, struct MessageHeaderType* header, struct PowerDeliveryReqType* params, struct PowerDeliveryResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* 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; + + + service->exiMsg.V2G_Message.Body.PowerDeliveryRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote chargingStatus call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param result struct ChargingStatusResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_chargingStatus(struct EXIService* service, struct MessageHeaderType* header, struct ChargingStatusResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* 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.ChargingStatusReq=1; + + + service->exiMsg.V2G_Message.Body.ChargingStatusRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote meteringReceipt call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_meteringReceipt(struct EXIService* service, struct MessageHeaderType* header, struct MeteringReceiptReqType* params, struct MeteringReceiptResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* 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; + + + service->exiMsg.V2G_Message.Body.MeteringReceiptRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote certificateUpdate call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct CertificateUpdateReqType* Request data for the server (has to be set up before) + * \param result struct CertificateUpdateResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_certificateUpdate(struct EXIService* service, struct MessageHeaderType* header, struct CertificateUpdateReqType* params, struct CertificateUpdateResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + + + + /* assign data to service data structure */ + service->exiMsg.V2G_Message.Header = header; + service->exiMsg.V2G_Message.Body.CertificateUpdateReq = params; + service->exiMsg.V2G_Message.Body.isused.CertificateUpdateReq=1; + + + service->exiMsg.V2G_Message.Body.CertificateUpdateRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote certificateInstallation call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct CertificateInstallationReqType* Request data for the server (has to be set up before) + * \param result struct CertificateInstallationResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_certificateInstallation(struct EXIService* service, struct MessageHeaderType* header, struct CertificateInstallationReqType* params, struct CertificateInstallationResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + init_CertificateInstallationResType(result); + + + /* assign data to service data structure */ + service->exiMsg.V2G_Message.Header = header; + service->exiMsg.V2G_Message.Body.CertificateInstallationReq = params; + service->exiMsg.V2G_Message.Body.isused.CertificateInstallationReq=1; + + + service->exiMsg.V2G_Message.Body.CertificateInstallationRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote cableCheck call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct CableCheckReqType* Request data for the server (has to be set up before) + * \param result struct CableCheckResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_cableCheck(struct EXIService* service, struct MessageHeaderType* header, struct CableCheckReqType* params, struct CableCheckResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + + + + /* assign data to service data structure */ + service->exiMsg.V2G_Message.Header = header; + service->exiMsg.V2G_Message.Body.CableCheckReq = params; + service->exiMsg.V2G_Message.Body.isused.CableCheckReq=1; + + + service->exiMsg.V2G_Message.Body.CableCheckRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote preCharge call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct PreChargeReqType* Request data for the server (has to be set up before) + * \param result struct PreChargeResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_preCharge(struct EXIService* service, struct MessageHeaderType* header, struct PreChargeReqType* params, struct PreChargeResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + + + + /* assign data to service data structure */ + service->exiMsg.V2G_Message.Header = header; + service->exiMsg.V2G_Message.Body.PreChargeReq = params; + service->exiMsg.V2G_Message.Body.isused.PreChargeReq=1; + + + service->exiMsg.V2G_Message.Body.PreChargeRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote currentDemand call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct CurrentDemandReqType* Request data for the server (has to be set up before) + * \param result struct CurrentDemandResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_currentDemand(struct EXIService* service, struct MessageHeaderType* header, struct CurrentDemandReqType* params, struct CurrentDemandResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + + + + /* assign data to service data structure */ + service->exiMsg.V2G_Message.Header = header; + service->exiMsg.V2G_Message.Body.CurrentDemandReq = params; + service->exiMsg.V2G_Message.Body.isused.CurrentDemandReq=1; + + + service->exiMsg.V2G_Message.Body.CurrentDemandRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote weldingDetection call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct WeldingDetectionReqType* Request data for the server (has to be set up before) + * \param result struct WeldingDetectionResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_weldingDetection(struct EXIService* service, struct MessageHeaderType* header, struct WeldingDetectionReqType* params, struct WeldingDetectionResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + + + + /* assign data to service data structure */ + service->exiMsg.V2G_Message.Header = header; + service->exiMsg.V2G_Message.Body.WeldingDetectionReq = params; + service->exiMsg.V2G_Message.Body.isused.WeldingDetectionReq=1; + + + service->exiMsg.V2G_Message.Body.WeldingDetectionRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } +/** + * \brief Prepares the remote sessionStop call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param result struct SessionStopResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_sessionStop(struct EXIService* service, struct MessageHeaderType* header, struct SessionStopResType* result) +{ + exi_name_table_runtime_t runtimeTableEncode; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + /* init uniqueID stack */ + service->idPath.pos=0; + + /* init outStream data structure */ + *(service->outStream.pos) = service->transportHeaderOffset; + service->outStream.buffer = 0; + service->outStream.capacity = 8; + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + + + + + /* 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.SessionStopReq=1; + + + service->exiMsg.V2G_Message.Body.SessionStopRes = result; + + + + /* encode data to exi stream*/ + if(serialize_message(service)) + { + + service->errorCode = EXI_SERIALIZATION_FAILED; + return -1; + } + + *(service->outStream.pos) -= service->transportHeaderOffset; + + return 0; + } + + + + /** + * \brief Determines which response message was received + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param respMsg enum responseMessages* contains the name of the response message + * \param result struct SessionStopResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ +int determineResponseMesssage(struct EXIService* service, enum responseMessages* respMsg) +{ + + uint32_t posDecode; + exi_name_table_runtime_t runtimeTableDecode; + + exi_string_table_t stringTableDecode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsDecode}; + + + /* init inStream data structure */ + posDecode = service->transportHeaderOffset; + service->inStream.pos = &posDecode; + service->inStream.buffer=0; + service->inStream.capacity=0; + + /* init decoder (read header, set initial state) */ + /* init runtime table */ + exiInitNameTableRuntime(&runtimeTableDecode); + exiInitDecoder(&(service->inStream), &(service->stateDecode), runtimeTableDecode,stringTableDecode); + + /* deserilize the response message */ + if(deserializeMessage(service)<0) + { + + service->errorCode = EXI_DESERIALIZATION_FAILED; + return -1; + } + + if(service->exiMsg.V2G_Message.Body.isused.SessionSetupRes) + *respMsg = SESSIONSETUPRES; + else if(service->exiMsg.V2G_Message.Body.isused.ServiceDiscoveryRes) + *respMsg = SERVICEDISCOVERYRES; + else if(service->exiMsg.V2G_Message.Body.isused.ServiceDetailRes) + *respMsg = SERVICEDETAILRES; + else if(service->exiMsg.V2G_Message.Body.isused.ServicePaymentSelectionRes) + *respMsg = SERVICEPAYMENTSELECTIONRES; + else if(service->exiMsg.V2G_Message.Body.isused.PaymentDetailsRes) + *respMsg = PAYMENTDETAILSRES; + else if(service->exiMsg.V2G_Message.Body.isused.ContractAuthenticationRes) + *respMsg = CONTRACTAUTHENTICATIONRES; + else if(service->exiMsg.V2G_Message.Body.isused.ChargeParameterDiscoveryRes) + *respMsg = CHARGEPARAMETERDISCOVERYRES; + else if(service->exiMsg.V2G_Message.Body.isused.PowerDeliveryRes) + *respMsg = POWERDELIVERYRES; + else if(service->exiMsg.V2G_Message.Body.isused.ChargingStatusRes) + *respMsg = CHARGINGSTATUSRES; + else if(service->exiMsg.V2G_Message.Body.isused.MeteringReceiptRes) + *respMsg = METERINGRECEIPTRES; + else if(service->exiMsg.V2G_Message.Body.isused.SessionStopRes) + *respMsg = SESSIONSTOPRES; + else if(service->exiMsg.V2G_Message.Body.isused.CertificateUpdateRes) + *respMsg = CERTIFICATEUPDATERES; + else if(service->exiMsg.V2G_Message.Body.isused.CertificateInstallationRes) + *respMsg = CERTIFICATEINSTALLATIONRES; + else if(service->exiMsg.V2G_Message.Body.isused.CableCheckRes) + *respMsg = CABLECHECKRES; + else if(service->exiMsg.V2G_Message.Body.isused.PreChargeRes) + *respMsg = PRECHARGERES; + else if(service->exiMsg.V2G_Message.Body.isused.CurrentDemandRes) + *respMsg = CURRENTDEMANDRES; + else if(service->exiMsg.V2G_Message.Body.isused.WeldingDetectionRes) + *respMsg = WELDINGDETECTIONRES; + + return 0; +} + + + /** + * Deserialize an element value of the EXI stream and assign it to the + * service data structure + */ +static int deserializeElementAttributeCharacter(struct EXIService* service) +{ + + switch(service->qnameID) { + case 326: /* FaultCode */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + service->exiMsg.V2G_Message.Header->Notification.FaultCode=service->val.enumeration; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 327: /* FaultMsg */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Notification.FaultMsg.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Notification.FaultMsg.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Notification.isused.FaultMsg=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 0: /* attr_Algorithm */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if( service->idPath.id[4] == 61) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.CanonicalizationMethod.attr_Algorithm.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.CanonicalizationMethod.attr_Algorithm.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[4] == 104) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.SignatureMethod.attr_Algorithm.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.SignatureMethod.attr_Algorithm.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[4] == 95) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].DigestMethod.attr_Algorithm.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].DigestMethod.attr_Algorithm.arraylen.data = service->val.str.miss.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 2: /* attr_Id */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if(service->idPath.id[3] == 75) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.isused.attr_Id=1; + + } else if(service->idPath.id[6] == 95) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.isused.attr_Id=1; + + } else if(service->idPath.id[1] == 441 && service->idPath.id[2] == 103) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->isused.attr_Id=1; + + } else if(service->idPath.id[2] == 139) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationRes->attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.CertificateInstallationRes->attr_Id.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[2] == 143) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateRes->attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.CertificateUpdateRes->attr_Id.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[2] == 147) + { + memcpy(service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->attr_Id.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[4] == 95) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].isused.attr_Id=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 7: /* attr_URI */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_URI.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_URI.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].isused.attr_URI=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 6: /* attr_Type */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_Type.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_Type.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].isused.attr_Type=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 68: /* DigestValue */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].DigestValue.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].DigestValue.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 111: /* SignatureValue */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignatureValue.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->SignatureValue.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + case 123: /* X509IssuerName */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509IssuerSerial.X509IssuerName.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509IssuerSerial.X509IssuerName.arraylen.data = service->val.str.miss.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 127: /* X509SerialNumber */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + + if(_setInt64Value(&(service->val.integer),&(service->val.integer.val.int64))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509IssuerSerial.X509SerialNumber=service->val.integer.val.int64; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 126: /* X509SKI */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509SKI.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509SKI.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 128: /* X509SubjectName */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509SubjectName.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509SubjectName.arraylen.data = service->val.str.miss.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 120: /* X509Certificate */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509Certificate.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509Certificate.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 119: /* X509CRL */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509CRL.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509CRL.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 445: /* SessionID */ + + if(service->val.type == EXI_DATATYPE_BINARY_HEX) + { + memcpy(service->exiMsg.V2G_Message.Header->SessionID.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->SessionID.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 214: /* ResponseCode */ + + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + if( service->idPath.id[2] == 226) + { + if(service->exiMsg.V2G_Message.Body.isused.ServiceDiscoveryReq) + { + service->exiMsg.V2G_Message.Body.isused.ServiceDiscoveryRes=1; + } + else + { + return -1; + } + + + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 233) + { + if(service->exiMsg.V2G_Message.Body.isused.ServicePaymentSelectionReq) + { + service->exiMsg.V2G_Message.Body.isused.ServicePaymentSelectionRes=1; + } + else + { + return -1; + } + + service->exiMsg.V2G_Message.Body.ServicePaymentSelectionRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 204) + { + if(service->exiMsg.V2G_Message.Body.isused.PowerDeliveryReq) + { + service->exiMsg.V2G_Message.Body.isused.PowerDeliveryRes=1; + } + else + { + return -1; + } + + + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 194) + { + + + if(service->exiMsg.V2G_Message.Body.isused.MeteringReceiptReq) + { + service->exiMsg.V2G_Message.Body.isused.MeteringReceiptRes=1; + } + else + { + return -1; + } + service->exiMsg.V2G_Message.Body.MeteringReceiptRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 242) + { + + if(service->exiMsg.V2G_Message.Body.isused.SessionStopReq) + { + service->exiMsg.V2G_Message.Body.isused.SessionStopRes=1; + } + else + { + return -1; + } + + service->exiMsg.V2G_Message.Body.SessionStopRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 208) + { + + if(service->exiMsg.V2G_Message.Body.isused.PreChargeReq) + { + service->exiMsg.V2G_Message.Body.isused.PreChargeRes=1; + } + else + { + return -1; + } + + service->exiMsg.V2G_Message.Body.PreChargeRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 247) + { + + if(service->exiMsg.V2G_Message.Body.isused.WeldingDetectionReq) + { + service->exiMsg.V2G_Message.Body.isused.WeldingDetectionRes=1; + } + else + { + return -1; + } + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 222) + { + + if(service->exiMsg.V2G_Message.Body.isused.ServiceDetailReq) + { + service->exiMsg.V2G_Message.Body.isused.ServiceDetailRes=1; + } + else + { + return -1; + } + + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 158) + { + + if(service->exiMsg.V2G_Message.Body.isused.ContractAuthenticationReq) + { + service->exiMsg.V2G_Message.Body.isused.ContractAuthenticationRes=1; + } + else + { + return -1; + } + service->exiMsg.V2G_Message.Body.ContractAuthenticationRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 147) + { + + if(service->exiMsg.V2G_Message.Body.isused.ChargeParameterDiscoveryReq) + { + service->exiMsg.V2G_Message.Body.isused.ChargeParameterDiscoveryRes=1; + } + else + { + return -1; + } + + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 135) + { + + if(service->exiMsg.V2G_Message.Body.isused.CableCheckReq) + { + service->exiMsg.V2G_Message.Body.isused.CableCheckRes=1; + } + else + { + return -1; + } + service->exiMsg.V2G_Message.Body.CableCheckRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 239) + { + + if(service->exiMsg.V2G_Message.Body.isused.SessionSetupReq) + { + service->exiMsg.V2G_Message.Body.isused.SessionSetupRes=1; + } + else + { + return -1; + } + + service->exiMsg.V2G_Message.Body.SessionSetupRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 199) + { + + if(service->exiMsg.V2G_Message.Body.isused.PaymentDetailsReq) + { + service->exiMsg.V2G_Message.Body.isused.PaymentDetailsRes=1; + } + else + { + return -1; + } + + + service->exiMsg.V2G_Message.Body.PaymentDetailsRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 154) + { + + if(service->exiMsg.V2G_Message.Body.isused.ChargingStatusReq) + { + service->exiMsg.V2G_Message.Body.isused.ChargingStatusRes=1; + } + else + { + return -1; + } + service->exiMsg.V2G_Message.Body.ChargingStatusRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 165) + { + + + if(service->exiMsg.V2G_Message.Body.isused.CurrentDemandReq) + { + service->exiMsg.V2G_Message.Body.isused.CurrentDemandRes=1; + } + else + { + return -1; + } + + service->exiMsg.V2G_Message.Body.CurrentDemandRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 139) + { + + if(service->exiMsg.V2G_Message.Body.isused.CertificateInstallationReq) + { + service->exiMsg.V2G_Message.Body.isused.CertificateInstallationRes=1; + } + else + { + return -1; + } + + service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ResponseCode=service->val.enumeration; + } else if(service->idPath.id[2] == 143) + { + + if(service->exiMsg.V2G_Message.Body.isused.CertificateUpdateReq) + { + service->exiMsg.V2G_Message.Body.isused.CertificateUpdateRes=1; + } + else + { + return -1; + } + + + service->exiMsg.V2G_Message.Body.CertificateUpdateRes->ResponseCode=service->val.enumeration; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + case 177: /* EVSEID */ + + if(service->val.type == EXI_DATATYPE_BINARY_HEX) + { + if( service->idPath.id[2] == 239) + { + 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 if(service->idPath.id[2] == 154) + { + memcpy(service->exiMsg.V2G_Message.Body.ChargingStatusRes->EVSEID.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.ChargingStatusRes->EVSEID.arraylen.data = service->val.binary.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 170: /* DateTimeNow */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + + if(_setInt64Value(&(service->val.integer),&(service->val.integer.val.int64))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + + if( service->idPath.id[2] == 239) + { + service->exiMsg.V2G_Message.Body.SessionSetupRes->DateTimeNow=service->val.integer.val.int64; + service->exiMsg.V2G_Message.Body.SessionSetupRes->isused.DateTimeNow=1; + + } else if(service->idPath.id[2] == 199) + { + service->exiMsg.V2G_Message.Body.PaymentDetailsRes->DateTimeNow=service->val.integer.val.int64; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 352: /* PaymentOption */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->PaymentOptions.PaymentOption[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->PaymentOptions.arraylen.PaymentOption]=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->PaymentOptions.arraylen.PaymentOption++; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 383: /* ServiceID */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if( service->idPath.id[3] == 229) + { + if(_setUnsignedInt16Value(&(service->val.integer),&(service->val.integer.val.uint16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceTag.ServiceID=service->val.integer.val.uint16; + } else if(service->idPath.id[3] == 149) + { + if(_setUnsignedInt16Value(&(service->val.integer),&(service->val.integer.val.uint16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.ServiceTag.ServiceID=service->val.integer.val.uint16; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 384: /* ServiceName */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if( service->idPath.id[3] == 229) + { + memcpy(service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceTag.ServiceName.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceTag.ServiceName.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceTag.isused.ServiceName=1; + + } else if(service->idPath.id[3] == 149) + { + memcpy(service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.ServiceTag.ServiceName.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.ServiceTag.ServiceName.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.ServiceTag.isused.ServiceName=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 380: /* ServiceCategory */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + if( service->idPath.id[3] == 229) + { + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceTag.ServiceCategory=service->val.enumeration; + } else if(service->idPath.id[3] == 149) + { + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.ServiceTag.ServiceCategory=service->val.enumeration; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 386: /* ServiceScope */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if( service->idPath.id[3] == 229) + { + memcpy(service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceTag.ServiceScope.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceTag.ServiceScope.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].ServiceTag.isused.ServiceScope=1; + + } else if(service->idPath.id[3] == 149) + { + memcpy(service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.ServiceTag.ServiceScope.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.ServiceTag.ServiceScope.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.ServiceTag.isused.ServiceScope=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 328: /* FreeService */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + if( service->idPath.id[3] == 149) + { + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.FreeService=service->val.boolean; + } else if(service->idPath.id[3] == 229) + { + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.Service[service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service].FreeService=service->val.boolean; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 323: /* EnergyTransferType */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ChargeService.EnergyTransferType=service->val.enumeration; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 336: /* Multiplier */ + + if(service->val.type == EXI_DATATYPE_NBIT_UNSIGNED_INTEGER) + { + if( service->idPath.id[3] == 178) + { + service->exiMsg.V2G_Message.Body.ChargingStatusRes->EVSEMaxCurrent.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 208) + { + service->exiMsg.V2G_Message.Body.PreChargeRes->EVSEPresentVoltage.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 165 && service->idPath.id[3] == 184) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEPresentVoltage.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 183) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEPresentCurrent.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 181) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumVoltageLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 179) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumCurrentLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 180) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumPowerLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 247) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->EVSEPresentVoltage.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 306) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMaxVoltage.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 305) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMaxCurrent.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 310) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMinCurrent.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 307) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumCurrentLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 308) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumPowerLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 309) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumVoltageLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 311) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMinimumCurrentLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 312) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMinimumVoltageLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 302) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSECurrentRegulationTolerance.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 315) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEPeakCurrentRipple.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 303) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEEnergyToBeDelivered.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 191) + { + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterReading.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 222) + { + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].physicalValue.Multiplier=service->val.integer.val.int8; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 396: /* Unit */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + if( service->idPath.id[3] == 178) + { + service->exiMsg.V2G_Message.Body.ChargingStatusRes->EVSEMaxCurrent.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargingStatusRes->EVSEMaxCurrent.isused.Unit=1; + + } else if(service->idPath.id[2] == 208) + { + service->exiMsg.V2G_Message.Body.PreChargeRes->EVSEPresentVoltage.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.PreChargeRes->EVSEPresentVoltage.isused.Unit=1; + + } else if(service->idPath.id[2] == 165 && service->idPath.id[3] == 184) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEPresentVoltage.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEPresentVoltage.isused.Unit=1; + + } else if(service->idPath.id[3] == 183) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEPresentCurrent.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEPresentCurrent.isused.Unit=1; + + } else if(service->idPath.id[3] == 181) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumVoltageLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumVoltageLimit.isused.Unit=1; + + } else if(service->idPath.id[3] == 179) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumCurrentLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumCurrentLimit.isused.Unit=1; + + } else if(service->idPath.id[3] == 180) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumPowerLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumPowerLimit.isused.Unit=1; + + } else if(service->idPath.id[2] == 247) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->EVSEPresentVoltage.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->EVSEPresentVoltage.isused.Unit=1; + + } else if(service->idPath.id[4] == 306) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMaxVoltage.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMaxVoltage.isused.Unit=1; + + } else if(service->idPath.id[4] == 305) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMaxCurrent.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMaxCurrent.isused.Unit=1; + + } else if(service->idPath.id[4] == 310) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMinCurrent.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMinCurrent.isused.Unit=1; + + } else if(service->idPath.id[4] == 307) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumCurrentLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumCurrentLimit.isused.Unit=1; + + } else if(service->idPath.id[4] == 308) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumPowerLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumPowerLimit.isused.Unit=1; + + } else if(service->idPath.id[4] == 309) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumVoltageLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumVoltageLimit.isused.Unit=1; + + } else if(service->idPath.id[4] == 311) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMinimumCurrentLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMinimumCurrentLimit.isused.Unit=1; + + } else if(service->idPath.id[4] == 312) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMinimumVoltageLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMinimumVoltageLimit.isused.Unit=1; + + } else if(service->idPath.id[4] == 302) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSECurrentRegulationTolerance.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSECurrentRegulationTolerance.isused.Unit=1; + + } else if(service->idPath.id[4] == 315) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEPeakCurrentRipple.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEPeakCurrentRipple.isused.Unit=1; + + } else if(service->idPath.id[4] == 303) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEEnergyToBeDelivered.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEEnergyToBeDelivered.isused.Unit=1; + + } else if(service->idPath.id[3] == 191) + { + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterReading.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterReading.isused.Unit=1; + + } else if(service->idPath.id[2] == 222) + { + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].physicalValue.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].physicalValue.isused.Unit=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 397: /* Value */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if( service->idPath.id[3] == 178) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargingStatusRes->EVSEMaxCurrent.Value=service->val.integer.val.int16; + } else if(service->idPath.id[2] == 208) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.PreChargeRes->EVSEPresentVoltage.Value=service->val.integer.val.int16; + } else if(service->idPath.id[2] == 165 && service->idPath.id[3] == 184) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEPresentVoltage.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 183) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEPresentCurrent.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 181) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumVoltageLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 179) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumCurrentLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 180) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEMaximumPowerLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[2] == 247) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->EVSEPresentVoltage.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 306) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMaxVoltage.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 305) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMaxCurrent.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 310) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->EVSEMinCurrent.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 307) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumCurrentLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 308) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumPowerLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 309) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMaximumVoltageLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 311) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMinimumCurrentLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 312) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEMinimumVoltageLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 302) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSECurrentRegulationTolerance.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 315) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEPeakCurrentRipple.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 303) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->EVSEEnergyToBeDelivered.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 191) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterReading.Value=service->val.integer.val.int16; + } else if(service->idPath.id[2] == 222) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].physicalValue.Value=service->val.integer.val.int16; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 4: /* attr_Name */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].attr_Name.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].attr_Name.arraylen.data = service->val.str.miss.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 8: /* attr_ValueType */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].attr_ValueType.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].attr_ValueType.arraylen.data = service->val.str.miss.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 400: /* boolValue */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].boolValue=service->val.boolean; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 401: /* byteValue */ + + if(service->val.type == EXI_DATATYPE_NBIT_UNSIGNED_INTEGER) + { + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].byteValue=service->val.integer.val.int8; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 428: /* shortValue */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].shortValue=service->val.integer.val.int16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 413: /* intValue */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].intValue=service->val.integer.val.int32; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 432: /* stringValue */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].stringValue.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].stringValue.arraylen.data = service->val.str.miss.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 349: /* ParameterSetID */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].ParameterSetID=service->val.integer.val.int16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 228: /* ServiceID */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if(_setUnsignedInt16Value(&(service->val.integer),&(service->val.integer.val.uint16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceID=service->val.integer.val.uint16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 257: /* Certificate */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + if( service->idPath.id[2] == 143) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateRes->ContractSignatureCertChain.Certificate.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateUpdateRes->ContractSignatureCertChain.Certificate.arraylen.data = service->val.binary.len; + + } else if(service->idPath.id[2] == 139 && service->idPath.id[5] == 257) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractSignatureCertChain.SubCertificates.Certificate[service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractSignatureCertChain.SubCertificates.arraylen.Certificate].data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractSignatureCertChain.SubCertificates.Certificate[service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractSignatureCertChain.SubCertificates.arraylen.Certificate++].arraylen.data = service->val.binary.len; + + service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractSignatureCertChain.isused.SubCertificates=1; + + } else if(service->idPath.id[2] == 139) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractSignatureCertChain.Certificate.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractSignatureCertChain.Certificate.arraylen.data = service->val.binary.len; + + } else if(service->idPath.id[2] == 197) + { + memcpy(service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractSignatureCertChain.Certificate.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractSignatureCertChain.Certificate.arraylen.data = service->val.binary.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 189: /* GenChallenge */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Body.PaymentDetailsRes->GenChallenge.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.PaymentDetailsRes->GenChallenge.arraylen.data = service->val.str.miss.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 185: /* EVSEProcessing */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + if( service->idPath.id[2] == 158) + { + service->exiMsg.V2G_Message.Body.ContractAuthenticationRes->EVSEProcessing=service->val.enumeration; + } else if(service->idPath.id[2] == 147) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->EVSEProcessing=service->val.enumeration; + } else if(service->idPath.id[2] == 135) + { + service->exiMsg.V2G_Message.Body.CableCheckRes->EVSEProcessing=service->val.enumeration; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 430: /* start */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if( service->idPath.id[5] == 370) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].RelativeTimeInterval.start=service->val.integer.val.uint32; + } else if(service->idPath.id[5] == 341) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.PMaxScheduleEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.arraylen.PMaxScheduleEntry].RelativeTimeInterval.start=service->val.integer.val.uint32; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 407: /* duration */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if( service->idPath.id[5] == 370) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].RelativeTimeInterval.duration=service->val.integer.val.uint32; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].RelativeTimeInterval.isused.duration=1; + + } else if(service->idPath.id[5] == 341) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.PMaxScheduleEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.arraylen.PMaxScheduleEntry].RelativeTimeInterval.duration=service->val.integer.val.uint32; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.PMaxScheduleEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.arraylen.PMaxScheduleEntry].RelativeTimeInterval.isused.duration=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 340: /* PMax */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.PMaxScheduleEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.arraylen.PMaxScheduleEntry].PMax=service->val.integer.val.int16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 344: /* PMaxScheduleID */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.PMaxScheduleID=service->val.integer.val.int16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 404: /* costKind */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].Cost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].arraylen.Cost].costKind=service->val.enumeration; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 398: /* amount */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].Cost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].arraylen.Cost].amount=service->val.integer.val.uint32; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 399: /* amountMultiplier */ + + if(service->val.type == EXI_DATATYPE_NBIT_UNSIGNED_INTEGER) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].Cost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].arraylen.Cost].amountMultiplier=service->val.integer.val.int8; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].Cost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].arraylen.Cost].isused.amountMultiplier=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 431: /* startValue */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].startValue=service->val.integer.val.uint32; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 281: /* EPriceLevel */ + + if(service->val.type == EXI_DATATYPE_NBIT_UNSIGNED_INTEGER) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].EPriceLevel=service->val.integer.val.uint8; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 374: /* SalesTariffID */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + init_SalesTariffType(service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff); + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffID=service->val.integer.val.int16; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 371: /* SalesTariffDescription */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffDescription.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffDescription.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->isused.SalesTariffDescription=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 339: /* NumEPriceLevels */ + + if(service->val.type == EXI_DATATYPE_NBIT_UNSIGNED_INTEGER) + { + + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->NumEPriceLevels=service->val.integer.val.uint8; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 366: /* SAScheduleTupleID */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SAScheduleTupleID=service->val.integer.val.int16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 355: /* PowerSwitchClosed */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + if( service->idPath.id[2] == 204) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->AC_EVSEStatus->PowerSwitchClosed=service->val.boolean; + } else if(service->idPath.id[2] == 154) + { + service->exiMsg.V2G_Message.Body.ChargingStatusRes->AC_EVSEStatus.PowerSwitchClosed=service->val.boolean; + } else if(service->idPath.id[2] == 194) + { + service->exiMsg.V2G_Message.Body.MeteringReceiptRes->AC_EVSEStatus.PowerSwitchClosed=service->val.boolean; + } else if(service->idPath.id[2] == 147) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->AC_EVSEStatus.PowerSwitchClosed=service->val.boolean; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 358: /* RCD */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + if( service->idPath.id[2] == 204) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->AC_EVSEStatus->RCD=service->val.boolean; + } else if(service->idPath.id[2] == 154) + { + service->exiMsg.V2G_Message.Body.ChargingStatusRes->AC_EVSEStatus.RCD=service->val.boolean; + } else if(service->idPath.id[2] == 194) + { + service->exiMsg.V2G_Message.Body.MeteringReceiptRes->AC_EVSEStatus.RCD=service->val.boolean; + } else if(service->idPath.id[2] == 147) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->AC_EVSEStatus.RCD=service->val.boolean; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 337: /* NotificationMaxDelay */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if( service->idPath.id[3] == 253) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->AC_EVSEStatus->NotificationMaxDelay=service->val.integer.val.uint32; + } else if(service->idPath.id[2] == 154) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargingStatusRes->AC_EVSEStatus.NotificationMaxDelay=service->val.integer.val.uint32; + } else if(service->idPath.id[2] == 194) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.MeteringReceiptRes->AC_EVSEStatus.NotificationMaxDelay=service->val.integer.val.uint32; + } else if(service->idPath.id[3] == 274) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->DC_EVSEStatus->NotificationMaxDelay=service->val.integer.val.uint32; + } else if(service->idPath.id[2] == 135) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CableCheckRes->DC_EVSEStatus.NotificationMaxDelay=service->val.integer.val.uint32; + } else if(service->idPath.id[2] == 208) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.PreChargeRes->DC_EVSEStatus.NotificationMaxDelay=service->val.integer.val.uint32; + } else if(service->idPath.id[2] == 165) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandRes->DC_EVSEStatus.NotificationMaxDelay=service->val.integer.val.uint32; + } else if(service->idPath.id[2] == 247) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->DC_EVSEStatus.NotificationMaxDelay=service->val.integer.val.uint32; + } else if(service->idPath.id[3] == 251) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->AC_EVSEStatus.NotificationMaxDelay=service->val.integer.val.uint32; + } else if(service->idPath.id[3] == 272) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->DC_EVSEStatus.NotificationMaxDelay=service->val.integer.val.uint32; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 313: /* EVSENotification */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + if( service->idPath.id[3] == 253) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->AC_EVSEStatus->EVSENotification=service->val.enumeration; + } else if(service->idPath.id[2] == 154) + { + service->exiMsg.V2G_Message.Body.ChargingStatusRes->AC_EVSEStatus.EVSENotification=service->val.enumeration; + } else if(service->idPath.id[2] == 194) + { + service->exiMsg.V2G_Message.Body.MeteringReceiptRes->AC_EVSEStatus.EVSENotification=service->val.enumeration; + } else if(service->idPath.id[3] == 274) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->DC_EVSEStatus->EVSENotification=service->val.enumeration; + } else if(service->idPath.id[2] == 135) + { + service->exiMsg.V2G_Message.Body.CableCheckRes->DC_EVSEStatus.EVSENotification=service->val.enumeration; + } else if(service->idPath.id[2] == 208) + { + service->exiMsg.V2G_Message.Body.PreChargeRes->DC_EVSEStatus.EVSENotification=service->val.enumeration; + } else if(service->idPath.id[2] == 165) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->DC_EVSEStatus.EVSENotification=service->val.enumeration; + } else if(service->idPath.id[2] == 247) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->DC_EVSEStatus.EVSENotification=service->val.enumeration; + } else if(service->idPath.id[3] == 251) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->AC_EVSEChargeParameter->AC_EVSEStatus.EVSENotification=service->val.enumeration; + } else if(service->idPath.id[3] == 272) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->DC_EVSEStatus.EVSENotification=service->val.enumeration; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 304: /* EVSEIsolationStatus */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + if( service->idPath.id[2] == 204) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->DC_EVSEStatus->EVSEIsolationStatus=service->val.enumeration; + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->DC_EVSEStatus->isused.EVSEIsolationStatus=1; + + } else if(service->idPath.id[2] == 135) + { + service->exiMsg.V2G_Message.Body.CableCheckRes->DC_EVSEStatus.EVSEIsolationStatus=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CableCheckRes->DC_EVSEStatus.isused.EVSEIsolationStatus=1; + + } else if(service->idPath.id[2] == 208) + { + service->exiMsg.V2G_Message.Body.PreChargeRes->DC_EVSEStatus.EVSEIsolationStatus=service->val.enumeration; + service->exiMsg.V2G_Message.Body.PreChargeRes->DC_EVSEStatus.isused.EVSEIsolationStatus=1; + + } else if(service->idPath.id[2] == 165) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->DC_EVSEStatus.EVSEIsolationStatus=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandRes->DC_EVSEStatus.isused.EVSEIsolationStatus=1; + + } else if(service->idPath.id[2] == 247) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->DC_EVSEStatus.EVSEIsolationStatus=service->val.enumeration; + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->DC_EVSEStatus.isused.EVSEIsolationStatus=1; + + } else if(service->idPath.id[2] == 147) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->DC_EVSEStatus.EVSEIsolationStatus=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->DC_EVSEStatus.isused.EVSEIsolationStatus=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 318: /* EVSEStatusCode */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + if( service->idPath.id[2] == 204) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->DC_EVSEStatus->EVSEStatusCode=service->val.enumeration; + } else if(service->idPath.id[2] == 135) + { + service->exiMsg.V2G_Message.Body.CableCheckRes->DC_EVSEStatus.EVSEStatusCode=service->val.enumeration; + } else if(service->idPath.id[2] == 208) + { + service->exiMsg.V2G_Message.Body.PreChargeRes->DC_EVSEStatus.EVSEStatusCode=service->val.enumeration; + } else if(service->idPath.id[2] == 165) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->DC_EVSEStatus.EVSEStatusCode=service->val.enumeration; + } else if(service->idPath.id[2] == 247) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionRes->DC_EVSEStatus.EVSEStatusCode=service->val.enumeration; + } else if(service->idPath.id[2] == 147) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->DC_EVSEStatus.EVSEStatusCode=service->val.enumeration; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 332: /* MeterID */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterID.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterID.arraylen.data = service->val.str.miss.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 391: /* SigMeterReading */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.SigMeterReading.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.SigMeterReading.arraylen.data = service->val.binary.len; + + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.isused.SigMeterReading=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 335: /* MeterStatus */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterStatus=service->val.integer.val.int16; + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.isused.MeterStatus=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 394: /* TMeter */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + + if(_setInt64Value(&(service->val.integer),&(service->val.integer.val.int64))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.TMeter=service->val.integer.val.int64; + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.isused.TMeter=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 216: /* SAScheduleTupleID */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargingStatusRes->SAScheduleTupleID=service->val.integer.val.int16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 211: /* ReceiptRequired */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.ChargingStatusRes->ReceiptRequired=service->val.boolean; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 162: /* ContractSignatureEncryptedPrivateKey */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + if( service->idPath.id[2] == 139) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractSignatureEncryptedPrivateKey.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractSignatureEncryptedPrivateKey.arraylen.data = service->val.binary.len; + + } else if(service->idPath.id[2] == 143) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateRes->ContractSignatureEncryptedPrivateKey.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateUpdateRes->ContractSignatureEncryptedPrivateKey.arraylen.data = service->val.binary.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 169: /* DHParams */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + if( service->idPath.id[2] == 139) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationRes->DHParams.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateInstallationRes->DHParams.arraylen.data = service->val.binary.len; + + } else if(service->idPath.id[2] == 143) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateRes->DHParams.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateUpdateRes->DHParams.arraylen.data = service->val.binary.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 160: /* ContractID */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if( service->idPath.id[2] == 139) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractID.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.CertificateInstallationRes->ContractID.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[2] == 143) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateRes->ContractID.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.CertificateUpdateRes->ContractID.arraylen.data = service->val.str.miss.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 215: /* RetryCounter */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CertificateUpdateRes->RetryCounter=service->val.integer.val.int16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 176: /* EVSECurrentLimitAchieved */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSECurrentLimitAchieved=service->val.boolean; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 186: /* EVSEVoltageLimitAchieved */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEVoltageLimitAchieved=service->val.boolean; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 182: /* EVSEPowerLimitAchieved */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.CurrentDemandRes->EVSEPowerLimitAchieved=service->val.boolean; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + + } + return 0; +} + + +/** + * Deserialize an element of the EXI stream + * @return 0 = 0K; -1 = ERROR + */ +static int deserializeElement(struct EXIService* service) +{ + switch(service->qnameID) { + + case 75: /* KeyInfo */ + service->exiMsg.V2G_Message.Header->Signature->isused.KeyInfo=1; + + break; + case 444: /* Notification */ + service->exiMsg.V2G_Message.Header->isused.Notification=1; + + break; + case 103: /* Signature */ + service->exiMsg.V2G_Message.Header->isused.Signature=1; + + break; + case 379: /* Service */ + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->ServiceList.arraylen.Service++; + + break; + case 229: /* ServiceList */ + service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes->isused.ServiceList=1; + + break; + case 347: /* Parameter */ + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter++; + + break; + case 348: /* ParameterSet */ + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet++; + + break; + case 230: /* ServiceParameterList */ + service->exiMsg.V2G_Message.Body.ServiceDetailRes->isused.ServiceParameterList=1; + + break; + case 392: /* SubCertificates */ + + break; + case 342: /* PMaxScheduleEntry */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].PMaxSchedule.arraylen.PMaxScheduleEntry++; + + break; + case 265: /* Cost */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].isused.Cost=1; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].ConsumptionCost[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost].arraylen.Cost++; + + break; + case 263: /* ConsumptionCost */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].isused.ConsumptionCost=1; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->SalesTariffEntry[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry].arraylen.ConsumptionCost++; + + break; + case 372: /* SalesTariffEntry */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].SalesTariff->arraylen.SalesTariffEntry++; + + break; + case 370: /* SalesTariff */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.SAScheduleTuple[service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple].isused.SalesTariff=1; + + break; + case 365: /* SAScheduleTuple */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->SAScheduleList.arraylen.SAScheduleTuple++; + + break; + case 308: /* EVSEMaximumPowerLimit */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->isused.EVSEMaximumPowerLimit=1; + + break; + case 302: /* EVSECurrentRegulationTolerance */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->isused.EVSECurrentRegulationTolerance=1; + + break; + case 303: /* EVSEEnergyToBeDelivered */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->DC_EVSEChargeParameter->isused.EVSEEnergyToBeDelivered=1; + + break; + case 251: /* AC_EVSEChargeParameter */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->isused.AC_EVSEChargeParameter=1; + + break; + case 272: /* DC_EVSEChargeParameter */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes->isused.DC_EVSEChargeParameter=1; + + break; + case 253: /* AC_EVSEStatus */ + + + if(service->idPath.id[3]!=251) + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->isused.AC_EVSEStatus=1; + + break; + case 274: /* DC_EVSEStatus */ + + if(service->idPath.id[3]!=272) + service->exiMsg.V2G_Message.Body.PowerDeliveryRes->isused.DC_EVSEStatus=1; + + break; + case 334: /* MeterReading */ + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.isused.MeterReading=1; + + break; + case 178: /* EVSEMaxCurrent */ + service->exiMsg.V2G_Message.Body.ChargingStatusRes->isused.EVSEMaxCurrent=1; + + break; + case 191: /* MeterInfo */ + service->exiMsg.V2G_Message.Body.ChargingStatusRes->isused.MeterInfo=1; + + break; + case 181: /* EVSEMaximumVoltageLimit */ + service->exiMsg.V2G_Message.Body.CurrentDemandRes->isused.EVSEMaximumVoltageLimit=1; + + break; + case 179: /* EVSEMaximumCurrentLimit */ + service->exiMsg.V2G_Message.Body.CurrentDemandRes->isused.EVSEMaximumCurrentLimit=1; + + break; + case 180: /* EVSEMaximumPowerLimit */ + service->exiMsg.V2G_Message.Body.CurrentDemandRes->isused.EVSEMaximumPowerLimit=1; + + 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; + int derivationCounter = 0; + + + do { + exiDecodeNextEvent(&(service->inStream), &(service->stateDecode), &(service->event)); + if (returnCode < 0) { + printf("[ERROR] %d \n", returnCode); + return returnCode; + } + + switch (service->event) { + case EXI_EVENT_START_DOCUMENT: + + returnCode = exiDecodeStartDocument(&(service->inStream), &(service->stateDecode)); + + break; + case EXI_EVENT_END_DOCUMENT: + + returnCode = exiDecodeEndDocument(&(service->inStream), &(service->stateDecode)); + noEndOfDocument = 0; /* false */ + break; + case EXI_EVENT_START_ELEMENT_GENERIC: + case EXI_EVENT_START_ELEMENT_GENERIC_UNDECLARED: + derivationCounter++; + case EXI_EVENT_START_ELEMENT: + returnCode = exiDecodeStartElement(&(service->inStream), &(service->stateDecode), &(service->qnameID)); + service->idPath.id[service->idPath.pos++]=service->qnameID; + break; + case EXI_EVENT_END_ELEMENT_UNDECLARED: + case EXI_EVENT_END_ELEMENT: + + returnCode = exiDecodeEndElement(&(service->inStream), &(service->stateDecode), &(service->qnameID)); + service->idPath.pos--; + + if(derivationCounter==0) + returnCode = deserializeElement(service); + + if(derivationCounter>0) + derivationCounter--; + + break; + case EXI_EVENT_CHARACTERS_GENERIC: + case EXI_EVENT_CHARACTERS_GENERIC_UNDECLARED: + case EXI_EVENT_CHARACTERS: + /* decode */ + returnCode = exiDecodeCharacters(&(service->inStream), &(service->stateDecode), &(service->val)); + + /* assign character data to the v2g message structure */ + if(derivationCounter==0) + returnCode = deserializeElementAttributeCharacter(service); + break; + case EXI_EVENT_ATTRIBUTE_GENERIC: + case EXI_EVENT_ATTRIBUTE_GENERIC_UNDECLARED: + case EXI_EVENT_ATTRIBUTE_INVALID_VALUE: + case EXI_EVENT_ATTRIBUTE: + /* decode */ + returnCode = exiDecodeAttribute(&(service->inStream), &(service->stateDecode), &(service->qnameID), &(service->val)); + if(derivationCounter==0) + returnCode = deserializeElementAttributeCharacter(service); + break; + case EXI_EVENT_ATTRIBUTE_ANY_INVALID_VALUE: + break; + + default: + /* ERROR */ + return -1; + } + + + + } while (noEndOfDocument); + + return 0; +} + +/** + * \brief Initialize the v2g client + * \param service struct EXIService* Service data structure + * \param service_bytes exi_bytes_t Reserved for byte handling + * \param service_string exi_string_ucs_t Reserved for string handling + * \param inStream uint8_t* Instream buffer + * \param max_inStream_size size_t Max size for an instream message + * \param outStream uint8_t* Outstream buffer + * \param max_outStream_size size_t Max size for an outstream message + * \param transportHeaderOffset uint16_t Transport protocol offset + * \return 0 = 0K; -1 = ERROR + */ +int init_v2gServiceClient(struct EXIService* service, exi_bytes_t service_bytes, exi_string_ucs_t service_string, uint8_t* inStream, size_t max_inStream_size, uint8_t* outStream, size_t max_outStream_size,uint32_t* outPayloadLength, uint16_t transportHeaderOffset) + { + + /* init byte array */ + service->val.binary = service_bytes; + + /* init string array */ + service->val.str.miss = service_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; + service->outStream.pos=outPayloadLength; + + + /* init offset for transport protocol */ + 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..8d9a601 --- /dev/null +++ b/src/service/v2g_serviceClientStubs.h @@ -0,0 +1,320 @@ + + +/* + * Copyright (C) 2007-2012 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.7 + * @contact Joerg.Heuer@siemens.com + * + *

Code generated by EXISeGen

+ * + ********************************************************************/ + + + + #ifdef __cplusplus +extern "C" { +#endif + +#ifndef SERVICECLIENTSTUBS_H +#define SERVICECLIENTSTUBS_H + + #include "v2g_service.h" + #include "v2g_dataTypes.h" + #include "v2g_serviceClientStubs.h" + + + + +enum responseMessages +{ + SESSIONSETUPRES, + + SERVICEDISCOVERYRES, + + SERVICEDETAILRES, + + SERVICEPAYMENTSELECTIONRES, + + PAYMENTDETAILSRES, + + CONTRACTAUTHENTICATIONRES, + + CHARGEPARAMETERDISCOVERYRES, + + POWERDELIVERYRES, + + CHARGINGSTATUSRES, + + METERINGRECEIPTRES, + + CERTIFICATEUPDATERES, + + CERTIFICATEINSTALLATIONRES, + + CABLECHECKRES, + + PRECHARGERES, + + CURRENTDEMANDRES, + + WELDINGDETECTIONRES, + + SESSIONSTOPRES +}; + +/** + * \brief Prepares the remote sessionSetup call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_sessionSetup(struct EXIService* service, struct MessageHeaderType* header, struct SessionSetupReqType* params, struct SessionSetupResType* result); + + + + +/** + * \brief Prepares the remote serviceDiscovery call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_serviceDiscovery(struct EXIService* service, struct MessageHeaderType* header, struct ServiceDiscoveryReqType* params, struct ServiceDiscoveryResType* result); + + + + +/** + * \brief Prepares the remote serviceDetail call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct ServiceDetailReqType* Request data for the server (has to be set up before) + * \param result struct ServiceDetailResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_serviceDetail(struct EXIService* service, struct MessageHeaderType* header, struct ServiceDetailReqType* params, struct ServiceDetailResType* result); + + + + +/** + * \brief Prepares the remote servicePaymentSelection call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_servicePaymentSelection(struct EXIService* service, struct MessageHeaderType* header, struct ServicePaymentSelectionReqType* params, struct ServicePaymentSelectionResType* result); + + + + +/** + * \brief Prepares the remote paymentDetails call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_paymentDetails(struct EXIService* service, struct MessageHeaderType* header, struct PaymentDetailsReqType* params, struct PaymentDetailsResType* result); + + + + +/** + * \brief Prepares the remote contractAuthentication call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct ContractAuthenticationReqType* Request data for the server (has to be set up before) + * \param result struct ContractAuthenticationResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_contractAuthentication(struct EXIService* service, struct MessageHeaderType* header, struct ContractAuthenticationReqType* params, struct ContractAuthenticationResType* result); + + + + +/** + * \brief Prepares the remote chargeParameterDiscovery call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct ChargeParameterDiscoveryReqType* Request data for the server (has to be set up before) + * \param result struct ChargeParameterDiscoveryResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_chargeParameterDiscovery(struct EXIService* service, struct MessageHeaderType* header, struct ChargeParameterDiscoveryReqType* params, struct ChargeParameterDiscoveryResType* result); + + + + +/** + * \brief Prepares the remote powerDelivery call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_powerDelivery(struct EXIService* service, struct MessageHeaderType* header, struct PowerDeliveryReqType* params, struct PowerDeliveryResType* result); + + + + +/** + * \brief Prepares the remote chargingStatus call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param result struct ChargingStatusResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_chargingStatus(struct EXIService* service, struct MessageHeaderType* header, struct ChargingStatusResType* result); + + + + +/** + * \brief Prepares the remote meteringReceipt call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* 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 prepare_meteringReceipt(struct EXIService* service, struct MessageHeaderType* header, struct MeteringReceiptReqType* params, struct MeteringReceiptResType* result); + + + + +/** + * \brief Prepares the remote certificateUpdate call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct CertificateUpdateReqType* Request data for the server (has to be set up before) + * \param result struct CertificateUpdateResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_certificateUpdate(struct EXIService* service, struct MessageHeaderType* header, struct CertificateUpdateReqType* params, struct CertificateUpdateResType* result); + + + + +/** + * \brief Prepares the remote certificateInstallation call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct CertificateInstallationReqType* Request data for the server (has to be set up before) + * \param result struct CertificateInstallationResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_certificateInstallation(struct EXIService* service, struct MessageHeaderType* header, struct CertificateInstallationReqType* params, struct CertificateInstallationResType* result); + + + + +/** + * \brief Prepares the remote cableCheck call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct CableCheckReqType* Request data for the server (has to be set up before) + * \param result struct CableCheckResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_cableCheck(struct EXIService* service, struct MessageHeaderType* header, struct CableCheckReqType* params, struct CableCheckResType* result); + + + + +/** + * \brief Prepares the remote preCharge call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct PreChargeReqType* Request data for the server (has to be set up before) + * \param result struct PreChargeResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_preCharge(struct EXIService* service, struct MessageHeaderType* header, struct PreChargeReqType* params, struct PreChargeResType* result); + + + + +/** + * \brief Prepares the remote currentDemand call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct CurrentDemandReqType* Request data for the server (has to be set up before) + * \param result struct CurrentDemandResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_currentDemand(struct EXIService* service, struct MessageHeaderType* header, struct CurrentDemandReqType* params, struct CurrentDemandResType* result); + + + + +/** + * \brief Prepares the remote weldingDetection call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param params struct WeldingDetectionReqType* Request data for the server (has to be set up before) + * \param result struct WeldingDetectionResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_weldingDetection(struct EXIService* service, struct MessageHeaderType* header, struct WeldingDetectionReqType* params, struct WeldingDetectionResType* result); + + + + +/** + * \brief Prepares the remote sessionStop call + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param header struct MessageHeaderType* Header data structure + * \param result struct SessionStopResType* Contains the response data from the server + * \return 0 = 0K; -1 = ERROR */ + int prepare_sessionStop(struct EXIService* service, struct MessageHeaderType* header, struct SessionStopResType* result); + + + + + + + /** + * \brief Determines which response message was received + * \param service struct EXIService* Service data structure (has to be initialized before) + * \param respMsg enum responseMessages* contains the name of the response message + * \param result struct SessionStopResType* Contains the response data from the server + * \return 0 = 0K; 0 != ERROR */ +int determineResponseMesssage(struct EXIService* service, enum responseMessages* respMsg); + + + +/** + * \brief Initialize the v2g client + * \param service struct EXIService* Service data structure + * \param service_bytes exi_bytes_t Reserved for byte handling + * \param service_string exi_string_ucs_t Reserved for string handling + * \param inStream uint8_t* Instream buffer + * \param max_inStream_size size_t Max size for an instream message + * \param outStream uint8_t* Outstream buffer + * \param outPayloadLength uint32_t* Provides the length of the encoded request EXI message + * \param max_outStream_size size_t Max size for an outstream message + * \param transportHeaderOffset uint16_t Transport protocol offset + * \return 0 = 0K; -1 = ERROR + */ +int init_v2gServiceClient(struct EXIService* service, exi_bytes_t service_bytes, exi_string_ucs_t service_string, uint8_t* inStream, size_t max_inStream_size, uint8_t* outStream, size_t max_outStream_size,uint32_t* outPayloadLength, 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..9705b02 --- /dev/null +++ b/src/service/v2g_serviceDataSerialization.c @@ -0,0 +1,7399 @@ + +/* + * Copyright (C) 2007-2012 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.7 + * @contact Joerg.Heuer@siemens.com + * + *

Code generated by EXISeGen

+ * + ********************************************************************/ + + +#include "v2g_service.h" +#include "v2g_dataTypes.h" +#include "EXITypes.h" +#include "EXIEncoder.h" +#include + + + + + + +static int serialize_NotificationType(struct NotificationType* type, +struct EXIService* service) +{ + + + + /* encode start element FaultCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 326)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + if(type->isused.FaultMsg) + { + + + + /* encode start element FaultMsg */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 327)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->FaultMsg.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->FaultMsg.data,type->FaultMsg.arraylen.data*sizeof(uint32_t)); + + + + /* encode character FaultMsg */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of FaultMsg */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_CanonicalizationMethodType(struct CanonicalizationMethodType* type, +struct EXIService* service) +{ + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Algorithm.arraylen.data; + service->val.str.miss.codepoints= type->attr_Algorithm.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 0,&(service->val))) + { + return -1; + } + + + return 0; +} + + +static int serialize_SignatureMethodType(struct SignatureMethodType* type, +struct EXIService* service) +{ + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Algorithm.arraylen.data; + service->val.str.miss.codepoints= type->attr_Algorithm.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 0,&(service->val))) + { + return -1; + } + + + return 0; +} + + +static int serialize_DigestMethodType(struct DigestMethodType* type, +struct EXIService* service) +{ + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Algorithm.arraylen.data; + service->val.str.miss.codepoints= type->attr_Algorithm.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 0,&(service->val))) + { + return -1; + } + + + return 0; +} + + +static int serialize_ReferenceType(struct ReferenceType* type, +struct EXIService* service) +{ + + if(type->isused.attr_Id) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + } + + if(type->isused.attr_URI) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_URI.arraylen.data; + service->val.str.miss.codepoints= type->attr_URI.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 7,&(service->val))) + { + return -1; + } + } + + if(type->isused.attr_Type) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Type.arraylen.data; + service->val.str.miss.codepoints= type->attr_Type.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 6,&(service->val))) + { + return -1; + } + } + + + + /* encode start element DigestMethod */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 66)) + { + return -1; + } + + /* encode children of DigestMethod */ + if(serialize_DigestMethodType( &(type->DigestMethod),service)) + { + return -1; + } + + + + /* encode end element of DigestMethod */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element DigestValue */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 68)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->DigestValue.arraylen.data; + memcpy(service->val.binary.data, type->DigestValue.data,type->DigestValue.arraylen.data); + + + + + /* encode character DigestValue */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of DigestValue */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_SignedInfoType(struct SignedInfoType* type, +struct EXIService* service) +{ + + + + if(type->isused.attr_Id) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + } + + + + /* encode start element CanonicalizationMethod */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 61)) + { + return -1; + } + + /* encode children of CanonicalizationMethod */ + if(serialize_CanonicalizationMethodType( &(type->CanonicalizationMethod),service)) + { + return -1; + } + + + + /* encode end element of CanonicalizationMethod */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element SignatureMethod */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 104)) + { + return -1; + } + + /* encode children of SignatureMethod */ + if(serialize_SignatureMethodType( &(type->SignatureMethod),service)) + { + return -1; + } + + + + /* encode end element of SignatureMethod */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + /* encode start element Reference */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 95)) + { + return -1; + } + + /* encode children of Reference */ + if(serialize_ReferenceType(&(type->Reference[0]),service)) + { + return -1; + } + + + /* encode end element of Reference */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + return 0; +} + + + +static int serialize_X509IssuerSerialType(struct X509IssuerSerialType* type, +struct EXIService* service) +{ + + + + /* encode start element X509IssuerName */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 123)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->X509IssuerName.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->X509IssuerName.data,type->X509IssuerName.arraylen.data*sizeof(uint32_t)); + + + + /* encode character X509IssuerName */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of X509IssuerName */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element X509SerialNumber */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 127)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int64=type->X509SerialNumber; + + service->val.integer.type = EXI_INTEGER_64; + + /* encode character X509SerialNumber */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of X509SerialNumber */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_X509DataType(struct X509DataType* type, +struct EXIService* service) +{ + + + + /* encode start element X509IssuerSerial */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 124)) + { + return -1; + } + + /* encode children of X509IssuerSerial */ + if(serialize_X509IssuerSerialType( &(type->X509IssuerSerial),service)) + { + return -1; + } + + + + /* encode end element of X509IssuerSerial */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element X509SKI */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 126)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->X509SKI.arraylen.data; + memcpy(service->val.binary.data, type->X509SKI.data,type->X509SKI.arraylen.data); + + + + + /* encode character X509SKI */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of X509SKI */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element X509SubjectName */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 128)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->X509SubjectName.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->X509SubjectName.data,type->X509SubjectName.arraylen.data*sizeof(uint32_t)); + + + + /* encode character X509SubjectName */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of X509SubjectName */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element X509Certificate */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 120)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->X509Certificate.arraylen.data; + memcpy(service->val.binary.data, type->X509Certificate.data,type->X509Certificate.arraylen.data); + + + + + /* encode character X509Certificate */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of X509Certificate */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element X509CRL */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 119)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->X509CRL.arraylen.data; + memcpy(service->val.binary.data, type->X509CRL.data,type->X509CRL.arraylen.data); + + + + + /* encode character X509CRL */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of X509CRL */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_KeyInfoType(struct KeyInfoType* type, +struct EXIService* service) +{ + + if(type->isused.attr_Id) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + } + + + + /* encode start element X509Data */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 121)) + { + return -1; + } + + /* encode children of X509Data */ + if(serialize_X509DataType( &(type->X509Data),service)) + { + return -1; + } + + + + /* encode end element of X509Data */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_SignatureType(struct SignatureType* type, +struct EXIService* service) +{ + + if(type->isused.attr_Id) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + } + + + + /* encode start element SignedInfo */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 113)) + { + return -1; + } + + /* encode children of SignedInfo */ + if(serialize_SignedInfoType( &(type->SignedInfo),service)) + { + return -1; + } + + + + /* encode end element of SignedInfo */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element SignatureValue */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 111)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->SignatureValue.arraylen.data; + service->val.binary.data= type->SignatureValue.data; + + /* encode character DigestValue */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + + /* encode end element of SignatureValue */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.KeyInfo) + { + + + + /* encode start element KeyInfo */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 75)) + { + return -1; + } + + /* encode children of KeyInfo */ + if(serialize_KeyInfoType( &(type->KeyInfo),service)) + { + return -1; + } + + + + /* encode end element of KeyInfo */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_MessageHeaderType(struct MessageHeaderType* type, +struct EXIService* service) +{ + + + + /* encode start element SessionID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 445)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_HEX; + service->val.binary.len = type->SessionID.arraylen.data; + memcpy(service->val.binary.data, type->SessionID.data,type->SessionID.arraylen.data); + + + + + /* encode character SessionID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of SessionID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.Notification) + { + + + + /* encode start element Notification */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 444)) + { + return -1; + } + + /* encode children of Notification */ + if(serialize_NotificationType( &(type->Notification),service)) + { + return -1; + } + + + + /* encode end element of Notification */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.Signature) + { + + + + /* encode start element Signature */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 103)) + { + return -1; + } + + /* encode children of Signature */ + if(serialize_SignatureType( (type->Signature),service)) + { + return -1; + } + + + + /* encode end element of Signature */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_SessionSetupReqType(struct SessionSetupReqType* type, +struct EXIService* service) +{ + + + + /* encode start element EVCCID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 171)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_HEX; + service->val.binary.len = type->EVCCID.arraylen.data; + memcpy(service->val.binary.data, type->EVCCID.data,type->EVCCID.arraylen.data); + + + + + /* encode character EVCCID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of EVCCID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_SessionSetupResType(struct SessionSetupResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element EVSEID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 177)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_HEX; + service->val.binary.len = type->EVSEID.arraylen.data; + memcpy(service->val.binary.data, type->EVSEID.data,type->EVSEID.arraylen.data); + + + + + /* encode character EVSEID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of EVSEID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.DateTimeNow) + { + + + + /* encode start element DateTimeNow */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 170)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int64=type->DateTimeNow; + + service->val.integer.type = EXI_INTEGER_64; + + /* encode character DateTimeNow */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of DateTimeNow */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ServiceDiscoveryReqType(struct ServiceDiscoveryReqType* type, +struct EXIService* service) +{ + + if(type->isused.ServiceScope) + { + + + + /* encode start element ServiceScope */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 235)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->ServiceScope.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->ServiceScope.data,type->ServiceScope.arraylen.data*sizeof(uint32_t)); + + + + /* encode character ServiceScope */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ServiceScope */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ServiceCategory) + { + + + + /* encode start element ServiceCategory */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 219)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->ServiceCategory; + + + /* encode character ServiceCategory */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ServiceCategory */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_PaymentOptionsType(struct PaymentOptionsType* type, +struct EXIService* service) +{ + + size_t i_loop; + + for(i_loop=0;i_loop < type->arraylen.PaymentOption;i_loop++) + { + + + + /* encode start element PaymentOption */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 352)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->PaymentOption[i_loop]; + + /* encode character PaymentOption */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of PaymentOption */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ServiceTagType(struct ServiceTagType* type, +struct EXIService* service) +{ + + + + /* encode start element ServiceID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 383)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint16=type->ServiceID; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_16; + + /* encode character ServiceID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ServiceID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.ServiceName) + { + + + + /* encode start element ServiceName */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 384)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->ServiceName.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->ServiceName.data,type->ServiceName.arraylen.data*sizeof(uint32_t)); + + + + /* encode character ServiceName */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ServiceName */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element ServiceCategory */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 380)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->ServiceCategory; + + + /* encode character ServiceCategory */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ServiceCategory */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.ServiceScope) + { + + + + /* encode start element ServiceScope */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 386)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->ServiceScope.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->ServiceScope.data,type->ServiceScope.arraylen.data*sizeof(uint32_t)); + + + + /* encode character ServiceScope */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ServiceScope */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ServiceChargeType(struct ServiceChargeType* type, +struct EXIService* service) +{ + + + + /* encode start element ServiceTag */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 387)) + { + return -1; + } + + /* encode children of ServiceTag */ + if(serialize_ServiceTagType( &(type->ServiceTag),service)) + { + return -1; + } + + + + /* encode end element of ServiceTag */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element FreeService */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 328)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->FreeService; + + + /* encode character FreeService */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of FreeService */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EnergyTransferType */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 323)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EnergyTransferType; + + + /* encode character EnergyTransferType */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EnergyTransferType */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_ServiceType(struct ServiceType* type, +struct EXIService* service) +{ + + + + /* encode start element ServiceTag */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 387)) + { + return -1; + } + + /* encode children of ServiceTag */ + if(serialize_ServiceTagType( &(type->ServiceTag),service)) + { + return -1; + } + + + + /* encode end element of ServiceTag */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element FreeService */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 328)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->FreeService; + + + /* encode character FreeService */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of FreeService */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_ServiceTagListType(struct ServiceTagListType* type, +struct EXIService* service) +{ + + size_t i_loop; + + for(i_loop=0;i_loop < type->arraylen.Service;i_loop++) + { + + + + /* encode start element Service */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 379)) + { + return -1; + } + + /* encode children of Service */ + if(serialize_ServiceType(&(type->Service[i_loop]),service)) + { + return -1; + } + + + /* encode end element of Service */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ServiceDiscoveryResType(struct ServiceDiscoveryResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element PaymentOptions */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 201)) + { + return -1; + } + + /* encode children of PaymentOptions */ + if(serialize_PaymentOptionsType( &(type->PaymentOptions),service)) + { + return -1; + } + + + + /* encode end element of PaymentOptions */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ChargeService */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 149)) + { + return -1; + } + + /* encode children of ChargeService */ + if(serialize_ServiceChargeType( &(type->ChargeService),service)) + { + return -1; + } + + + + /* encode end element of ChargeService */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.ServiceList) + { + + + + /* encode start element ServiceList */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 229)) + { + return -1; + } + + /* encode children of ServiceList */ + if(serialize_ServiceTagListType( &(type->ServiceList),service)) + { + return -1; + } + + + + /* encode end element of ServiceList */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ServiceDetailReqType(struct ServiceDetailReqType* type, +struct EXIService* service) +{ + + + + /* encode start element ServiceID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 228)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint16=type->ServiceID; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_16; + + /* encode character ServiceID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ServiceID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_PhysicalValueType(struct PhysicalValueType* type, +struct EXIService* service) +{ + + + + /* encode start element Multiplier */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 336)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; + service->val.integer.val.int8=type->Multiplier; + + service->val.integer.type = EXI_INTEGER_8; + + /* encode character Multiplier */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of Multiplier */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.Unit) + { + + + + /* encode start element Unit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 396)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + } + + + + /* encode start element Value */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 397)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->Value; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character Value */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of Value */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_ParameterType(struct ParameterType* type, +struct EXIService* service) +{ + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Name.arraylen.data; + service->val.str.miss.codepoints= type->attr_Name.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 4,&(service->val))) + { + return -1; + } + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_ValueType.arraylen.data; + service->val.str.miss.codepoints= type->attr_ValueType.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 8,&(service->val))) + { + return -1; + } + + + + /* encode start element boolValue */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 400)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->boolValue; + + + /* encode character boolValue */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of boolValue */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element byteValue */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 401)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; + service->val.integer.val.int8=type->byteValue; + + service->val.integer.type = EXI_INTEGER_8; + + /* encode character byteValue */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of byteValue */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element shortValue */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 428)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->shortValue; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character shortValue */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of shortValue */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element intValue */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 413)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int32=type->intValue; + + service->val.integer.type = EXI_INTEGER_32; + + /* encode character intValue */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of intValue */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element physicalValue */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 419)) + { + return -1; + } + + /* encode children of physicalValue */ + if(serialize_PhysicalValueType( &(type->physicalValue),service)) + { + return -1; + } + + + + /* encode end element of physicalValue */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element stringValue */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 432)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->stringValue.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->stringValue.data,type->stringValue.arraylen.data*sizeof(uint32_t)); + + + + /* encode character stringValue */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of stringValue */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_ParameterSetType(struct ParameterSetType* type, +struct EXIService* service) +{ + + size_t i_loop; + + + + /* encode start element ParameterSetID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 349)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->ParameterSetID; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character ParameterSetID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ParameterSetID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + for(i_loop=0;i_loop < type->arraylen.Parameter;i_loop++) + { + + + + /* encode start element Parameter */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 347)) + { + return -1; + } + + /* encode children of Parameter */ + if(serialize_ParameterType(&(type->Parameter[i_loop]),service)) + { + return -1; + } + + + /* encode end element of Parameter */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ServiceParameterListType(struct ServiceParameterListType* type, +struct EXIService* service) +{ + + size_t i_loop; + + for(i_loop=0;i_loop < type->arraylen.ParameterSet;i_loop++) + { + + + + /* encode start element ParameterSet */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 348)) + { + return -1; + } + + /* encode children of ParameterSet */ + if(serialize_ParameterSetType(&(type->ParameterSet[i_loop]),service)) + { + return -1; + } + + + /* encode end element of ParameterSet */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ServiceDetailResType(struct ServiceDetailResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element ServiceID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 228)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint16=type->ServiceID; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_16; + + /* encode character ServiceID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ServiceID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.ServiceParameterList) + { + + + + /* encode start element ServiceParameterList */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 230)) + { + return -1; + } + + /* encode children of ServiceParameterList */ + if(serialize_ServiceParameterListType( &(type->ServiceParameterList),service)) + { + return -1; + } + + + + /* encode end element of ServiceParameterList */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_SelectedServiceType(struct SelectedServiceType* type, +struct EXIService* service) +{ + + + + /* encode start element ServiceID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 383)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint16=type->ServiceID; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_16; + + /* encode character ServiceID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ServiceID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.ParameterSetID) + { + + + + /* encode start element ParameterSetID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 349)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->ParameterSetID; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character ParameterSetID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ParameterSetID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_SelectedServiceListType(struct SelectedServiceListType* type, +struct EXIService* service) +{ + + size_t i_loop; + + for(i_loop=0;i_loop < type->arraylen.SelectedService;i_loop++) + { + + + + /* encode start element SelectedService */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 376)) + { + return -1; + } + + /* encode children of SelectedService */ + if(serialize_SelectedServiceType(&(type->SelectedService[i_loop]),service)) + { + return -1; + } + + + /* encode end element of SelectedService */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ServicePaymentSelectionReqType(struct ServicePaymentSelectionReqType* type, +struct EXIService* service) +{ + + + + /* encode start element SelectedPaymentOption */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 217)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->SelectedPaymentOption; + + + /* encode character SelectedPaymentOption */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of SelectedPaymentOption */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element SelectedServiceList */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 218)) + { + return -1; + } + + /* encode children of SelectedServiceList */ + if(serialize_SelectedServiceListType( &(type->SelectedServiceList),service)) + { + return -1; + } + + + + /* encode end element of SelectedServiceList */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_ServicePaymentSelectionResType(struct ServicePaymentSelectionResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + return 0; +} + + +static int serialize_SubCertificatesType(struct SubCertificatesType* type, +struct EXIService* service) +{ + + size_t i_loop; + + for(i_loop=0;i_loop < type->arraylen.Certificate;i_loop++) + { + + + + /* encode start element Certificate */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 257)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->Certificate[i_loop].arraylen.data; + memcpy(service->val.binary.data, type->Certificate[i_loop].data,type->Certificate[i_loop].arraylen.data); + + + + /* encode character Certificate */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of Certificate */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_CertificateChainType(struct CertificateChainType* type, +struct EXIService* service) +{ + + + + /* encode start element Certificate */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 257)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->Certificate.arraylen.data; + memcpy(service->val.binary.data, type->Certificate.data,type->Certificate.arraylen.data); + + + + + /* encode character Certificate */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of Certificate */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.SubCertificates) + { + + + + /* encode start element SubCertificates */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 392)) + { + return -1; + } + + /* encode children of SubCertificates */ + if(serialize_SubCertificatesType( &(type->SubCertificates),service)) + { + return -1; + } + + + + /* encode end element of SubCertificates */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_PaymentDetailsReqType(struct PaymentDetailsReqType* type, +struct EXIService* service) +{ + + + + /* encode start element ContractID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 160)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->ContractID.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->ContractID.data,type->ContractID.arraylen.data*sizeof(uint32_t)); + + + + /* encode character ContractID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ContractID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ContractSignatureCertChain */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 161)) + { + return -1; + } + + /* encode children of ContractSignatureCertChain */ + if(serialize_CertificateChainType( &(type->ContractSignatureCertChain),service)) + { + return -1; + } + + + + /* encode end element of ContractSignatureCertChain */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_PaymentDetailsResType(struct PaymentDetailsResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element GenChallenge */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 189)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->GenChallenge.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->GenChallenge.data,type->GenChallenge.arraylen.data*sizeof(uint32_t)); + + + + /* encode character GenChallenge */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of GenChallenge */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element DateTimeNow */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 170)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int64=type->DateTimeNow; + + service->val.integer.type = EXI_INTEGER_64; + + /* encode character DateTimeNow */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of DateTimeNow */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_ContractAuthenticationReqType(struct ContractAuthenticationReqType* type, +struct EXIService* service) +{ + + if(type->isused.attr_Id) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + } + + if(type->isused.GenChallenge) + { + + + + /* encode start element GenChallenge */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 189)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->GenChallenge.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->GenChallenge.data,type->GenChallenge.arraylen.data*sizeof(uint32_t)); + + + + /* encode character GenChallenge */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of GenChallenge */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ContractAuthenticationResType(struct ContractAuthenticationResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element EVSEProcessing */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 185)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EVSEProcessing; + + + /* encode character EVSEProcessing */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSEProcessing */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_AC_EVChargeParameterType(struct AC_EVChargeParameterType* type, +struct EXIService* service) +{ + + + + /* encode start element DepartureTime */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 279)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint32=type->DepartureTime; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_32; + + /* encode character DepartureTime */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of DepartureTime */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EAmount */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 280)) + { + return -1; + } + + /* encode children of EAmount */ + if(serialize_PhysicalValueType( &(type->EAmount),service)) + { + return -1; + } + + + + /* encode end element of EAmount */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVMaxVoltage */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 289)) + { + return -1; + } + + /* encode children of EVMaxVoltage */ + if(serialize_PhysicalValueType( &(type->EVMaxVoltage),service)) + { + return -1; + } + + + + /* encode end element of EVMaxVoltage */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVMaxCurrent */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 288)) + { + return -1; + } + + /* encode children of EVMaxCurrent */ + if(serialize_PhysicalValueType( &(type->EVMaxCurrent),service)) + { + return -1; + } + + + + /* encode end element of EVMaxCurrent */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVMinCurrent */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 293)) + { + return -1; + } + + /* encode children of EVMinCurrent */ + if(serialize_PhysicalValueType( &(type->EVMinCurrent),service)) + { + return -1; + } + + + + /* encode end element of EVMinCurrent */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_DC_EVStatusType(struct DC_EVStatusType* type, +struct EXIService* service) +{ + + + + /* encode start element EVReady */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 298)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->EVReady; + + + /* encode character EVReady */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVReady */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.EVCabinConditioning) + { + + + + /* encode start element EVCabinConditioning */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 282)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->EVCabinConditioning; + + + /* encode character EVCabinConditioning */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVCabinConditioning */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.EVRESSConditioning) + { + + + + /* encode start element EVRESSConditioning */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 296)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->EVRESSConditioning; + + + /* encode character EVRESSConditioning */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVRESSConditioning */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element EVErrorCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 287)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EVErrorCode; + + + /* encode character EVErrorCode */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVErrorCode */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVRESSSOC */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 297)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; + service->val.integer.val.int8=type->EVRESSSOC; + + service->val.integer.type = EXI_INTEGER_8; + + /* encode character EVRESSSOC */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVRESSSOC */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_DC_EVChargeParameterType(struct DC_EVChargeParameterType* type, +struct EXIService* service) +{ + + + + /* encode start element DC_EVStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 277)) + { + return -1; + } + + /* encode children of DC_EVStatus */ + if(serialize_DC_EVStatusType( &(type->DC_EVStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVMaximumCurrentLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 290)) + { + return -1; + } + + /* encode children of EVMaximumCurrentLimit */ + if(serialize_PhysicalValueType( &(type->EVMaximumCurrentLimit),service)) + { + return -1; + } + + + + /* encode end element of EVMaximumCurrentLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.EVMaximumPowerLimit) + { + + + + /* encode start element EVMaximumPowerLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 291)) + { + return -1; + } + + /* encode children of EVMaximumPowerLimit */ + if(serialize_PhysicalValueType( &(type->EVMaximumPowerLimit),service)) + { + return -1; + } + + + + /* encode end element of EVMaximumPowerLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element EVMaximumVoltageLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 292)) + { + return -1; + } + + /* encode children of EVMaximumVoltageLimit */ + if(serialize_PhysicalValueType( &(type->EVMaximumVoltageLimit),service)) + { + return -1; + } + + + + /* encode end element of EVMaximumVoltageLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.EVEnergyCapacity) + { + + + + /* encode start element EVEnergyCapacity */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 285)) + { + return -1; + } + + /* encode children of EVEnergyCapacity */ + if(serialize_PhysicalValueType( &(type->EVEnergyCapacity),service)) + { + return -1; + } + + + + /* encode end element of EVEnergyCapacity */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.EVEnergyRequest) + { + + + + /* encode start element EVEnergyRequest */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 286)) + { + return -1; + } + + /* encode children of EVEnergyRequest */ + if(serialize_PhysicalValueType( &(type->EVEnergyRequest),service)) + { + return -1; + } + + + + /* encode end element of EVEnergyRequest */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.FullSOC) + { + + + + /* encode start element FullSOC */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 329)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; + service->val.integer.val.int8=type->FullSOC; + + service->val.integer.type = EXI_INTEGER_8; + + /* encode character FullSOC */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of FullSOC */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.BulkSOC) + { + + + + /* encode start element BulkSOC */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 256)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; + service->val.integer.val.int8=type->BulkSOC; + + service->val.integer.type = EXI_INTEGER_8; + + /* encode character BulkSOC */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of BulkSOC */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ChargeParameterDiscoveryReqType(struct ChargeParameterDiscoveryReqType* type, +struct EXIService* service) +{ + + + + /* encode start element EVRequestedEnergyTransferType */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 175)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EVRequestedEnergyTransferType; + + + /* encode character EVRequestedEnergyTransferType */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVRequestedEnergyTransferType */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.AC_EVChargeParameter) + { + + + + /* encode start element AC_EVChargeParameter */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 249)) + { + return -1; + } + + /* encode children of AC_EVChargeParameter */ + if(serialize_AC_EVChargeParameterType( (type->AC_EVChargeParameter),service)) + { + return -1; + } + + + + /* encode end element of AC_EVChargeParameter */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.DC_EVChargeParameter) + { + + + + /* encode start element DC_EVChargeParameter */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 267)) + { + return -1; + } + + /* encode children of DC_EVChargeParameter */ + if(serialize_DC_EVChargeParameterType( (type->DC_EVChargeParameter),service)) + { + return -1; + } + + + + /* encode end element of DC_EVChargeParameter */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_RelativeTimeIntervalType(struct RelativeTimeIntervalType* type, +struct EXIService* service) +{ + + + + /* encode start element start */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 430)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint32=type->start; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_32; + + /* encode character start */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of start */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.duration) + { + + + + /* encode start element duration */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 407)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint32=type->duration; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_32; + + /* encode character duration */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of duration */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_PMaxScheduleEntryType(struct PMaxScheduleEntryType* type, +struct EXIService* service) +{ + + + + /* encode start element RelativeTimeInterval */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 359)) + { + return -1; + } + + /* encode children of RelativeTimeInterval */ + if(serialize_RelativeTimeIntervalType( &(type->RelativeTimeInterval),service)) + { + return -1; + } + + + + /* encode end element of RelativeTimeInterval */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element PMax */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 340)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->PMax; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character PMax */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of PMax */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_PMaxScheduleType(struct PMaxScheduleType* type, +struct EXIService* service) +{ + + size_t i_loop; + + + + /* encode start element PMaxScheduleID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 344)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->PMaxScheduleID; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character PMaxScheduleID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of PMaxScheduleID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + for(i_loop=0;i_loop < type->arraylen.PMaxScheduleEntry;i_loop++) + { + + + + /* encode start element PMaxScheduleEntry */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 342)) + { + return -1; + } + + /* encode children of PMaxScheduleEntry */ + if(serialize_PMaxScheduleEntryType(&(type->PMaxScheduleEntry[i_loop]),service)) + { + return -1; + } + + + /* encode end element of PMaxScheduleEntry */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_CostType(struct CostType* type, +struct EXIService* service) +{ + + + + /* encode start element costKind */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 404)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->costKind; + + + /* encode character costKind */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of costKind */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element amount */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 398)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint32=type->amount; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_32; + + /* encode character amount */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of amount */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.amountMultiplier) + { + + + + /* encode start element amountMultiplier */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 399)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; + service->val.integer.val.int8=type->amountMultiplier; + + service->val.integer.type = EXI_INTEGER_8; + + /* encode character amountMultiplier */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of amountMultiplier */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ConsumptionCostType(struct ConsumptionCostType* type, +struct EXIService* service) +{ + + size_t i_loop; + + + + /* encode start element startValue */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 431)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint32=type->startValue; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_32; + + /* encode character startValue */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of startValue */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.Cost) + { + + for(i_loop=0;i_loop < type->arraylen.Cost;i_loop++) + { + + + + /* encode start element Cost */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 265)) + { + return -1; + } + + /* encode children of Cost */ + if(serialize_CostType(&(type->Cost[i_loop]),service)) + { + return -1; + } + + + /* encode end element of Cost */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + } + + + return 0; +} + + +static int serialize_SalesTariffEntryType(struct SalesTariffEntryType* type, +struct EXIService* service) +{ + + size_t i_loop; + + + + /* encode start element RelativeTimeInterval */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 359)) + { + return -1; + } + + /* encode children of RelativeTimeInterval */ + if(serialize_RelativeTimeIntervalType( &(type->RelativeTimeInterval),service)) + { + return -1; + } + + + + /* encode end element of RelativeTimeInterval */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EPriceLevel */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 281)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; + service->val.integer.val.uint8=type->EPriceLevel; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_8; + + /* encode character EPriceLevel */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EPriceLevel */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.ConsumptionCost) + { + + for(i_loop=0;i_loop < type->arraylen.ConsumptionCost;i_loop++) + { + + + + /* encode start element ConsumptionCost */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 263)) + { + return -1; + } + + /* encode children of ConsumptionCost */ + if(serialize_ConsumptionCostType(&(type->ConsumptionCost[i_loop]),service)) + { + return -1; + } + + + /* encode end element of ConsumptionCost */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + } + + + return 0; +} + + +static int serialize_SalesTariffType(struct SalesTariffType* type, +struct EXIService* service) +{ + + size_t i_loop; + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + + + + /* encode start element SalesTariffID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 374)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->SalesTariffID; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character SalesTariffID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of SalesTariffID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.SalesTariffDescription) + { + + + + /* encode start element SalesTariffDescription */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 371)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->SalesTariffDescription.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->SalesTariffDescription.data,type->SalesTariffDescription.arraylen.data*sizeof(uint32_t)); + + + + /* encode character SalesTariffDescription */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of SalesTariffDescription */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element NumEPriceLevels */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 339)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; + service->val.integer.val.uint8=type->NumEPriceLevels; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_8; + + /* encode character NumEPriceLevels */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of NumEPriceLevels */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + for(i_loop=0;i_loop < type->arraylen.SalesTariffEntry;i_loop++) + { + + + + /* encode start element SalesTariffEntry */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 372)) + { + return -1; + } + + /* encode children of SalesTariffEntry */ + if(serialize_SalesTariffEntryType(&(type->SalesTariffEntry[i_loop]),service)) + { + return -1; + } + + + /* encode end element of SalesTariffEntry */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_SAScheduleTupleType(struct SAScheduleTupleType* type, +struct EXIService* service) +{ + + + + /* encode start element SAScheduleTupleID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 366)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->SAScheduleTupleID; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character SAScheduleTupleID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of SAScheduleTupleID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element PMaxSchedule */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 341)) + { + return -1; + } + + /* encode children of PMaxSchedule */ + if(serialize_PMaxScheduleType( &(type->PMaxSchedule),service)) + { + return -1; + } + + + + /* encode end element of PMaxSchedule */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.SalesTariff) + { + + + + /* encode start element SalesTariff */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 370)) + { + return -1; + } + + /* encode children of SalesTariff */ + if(serialize_SalesTariffType( (type->SalesTariff),service)) + { + return -1; + } + + + + /* encode end element of SalesTariff */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_SAScheduleListType(struct SAScheduleListType* type, +struct EXIService* service) +{ + + size_t i_loop; + + for(i_loop=0;i_loop < type->arraylen.SAScheduleTuple;i_loop++) + { + + + + /* encode start element SAScheduleTuple */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 365)) + { + return -1; + } + + /* encode children of SAScheduleTuple */ + if(serialize_SAScheduleTupleType(&(type->SAScheduleTuple[i_loop]),service)) + { + return -1; + } + + + /* encode end element of SAScheduleTuple */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_AC_EVSEStatusType(struct AC_EVSEStatusType* type, +struct EXIService* service) +{ + + + + /* encode start element PowerSwitchClosed */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 355)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element RCD */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 358)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element NotificationMaxDelay */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 337)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint32=type->NotificationMaxDelay; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_32; + + /* encode character NotificationMaxDelay */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of NotificationMaxDelay */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSENotification */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 313)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EVSENotification; + + + /* encode character EVSENotification */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSENotification */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_AC_EVSEChargeParameterType(struct AC_EVSEChargeParameterType* type, +struct EXIService* service) +{ + + + + /* encode start element AC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 253)) + { + return -1; + } + + /* encode children of AC_EVSEStatus */ + if(serialize_AC_EVSEStatusType( &(type->AC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of AC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEMaxVoltage */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 306)) + { + return -1; + } + + /* encode children of EVSEMaxVoltage */ + if(serialize_PhysicalValueType( &(type->EVSEMaxVoltage),service)) + { + return -1; + } + + + + /* encode end element of EVSEMaxVoltage */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEMaxCurrent */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 305)) + { + return -1; + } + + /* encode children of EVSEMaxCurrent */ + if(serialize_PhysicalValueType( &(type->EVSEMaxCurrent),service)) + { + return -1; + } + + + + /* encode end element of EVSEMaxCurrent */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEMinCurrent */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 310)) + { + return -1; + } + + /* encode children of EVSEMinCurrent */ + if(serialize_PhysicalValueType( &(type->EVSEMinCurrent),service)) + { + return -1; + } + + + + /* encode end element of EVSEMinCurrent */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_DC_EVSEStatusType(struct DC_EVSEStatusType* type, +struct EXIService* service) +{ + + if(type->isused.EVSEIsolationStatus) + { + + + + /* encode start element EVSEIsolationStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 304)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EVSEIsolationStatus; + + + /* encode character EVSEIsolationStatus */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSEIsolationStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element EVSEStatusCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 318)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EVSEStatusCode; + + + /* encode character EVSEStatusCode */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSEStatusCode */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element NotificationMaxDelay */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 337)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint32=type->NotificationMaxDelay; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_32; + + /* encode character NotificationMaxDelay */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of NotificationMaxDelay */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSENotification */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 313)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EVSENotification; + + + /* encode character EVSENotification */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSENotification */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_DC_EVSEChargeParameterType(struct DC_EVSEChargeParameterType* type, +struct EXIService* service) +{ + + + + /* encode start element DC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 274)) + { + return -1; + } + + /* encode children of DC_EVSEStatus */ + if(serialize_DC_EVSEStatusType( &(type->DC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEMaximumCurrentLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 307)) + { + return -1; + } + + /* encode children of EVSEMaximumCurrentLimit */ + if(serialize_PhysicalValueType( &(type->EVSEMaximumCurrentLimit),service)) + { + return -1; + } + + + + /* encode end element of EVSEMaximumCurrentLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.EVSEMaximumPowerLimit) + { + + + + /* encode start element EVSEMaximumPowerLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 308)) + { + return -1; + } + + /* encode children of EVSEMaximumPowerLimit */ + if(serialize_PhysicalValueType( &(type->EVSEMaximumPowerLimit),service)) + { + return -1; + } + + + + /* encode end element of EVSEMaximumPowerLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element EVSEMaximumVoltageLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 309)) + { + return -1; + } + + /* encode children of EVSEMaximumVoltageLimit */ + if(serialize_PhysicalValueType( &(type->EVSEMaximumVoltageLimit),service)) + { + return -1; + } + + + + /* encode end element of EVSEMaximumVoltageLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEMinimumCurrentLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 311)) + { + return -1; + } + + /* encode children of EVSEMinimumCurrentLimit */ + if(serialize_PhysicalValueType( &(type->EVSEMinimumCurrentLimit),service)) + { + return -1; + } + + + + /* encode end element of EVSEMinimumCurrentLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEMinimumVoltageLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 312)) + { + return -1; + } + + /* encode children of EVSEMinimumVoltageLimit */ + if(serialize_PhysicalValueType( &(type->EVSEMinimumVoltageLimit),service)) + { + return -1; + } + + + + /* encode end element of EVSEMinimumVoltageLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.EVSECurrentRegulationTolerance) + { + + + + /* encode start element EVSECurrentRegulationTolerance */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 302)) + { + return -1; + } + + /* encode children of EVSECurrentRegulationTolerance */ + if(serialize_PhysicalValueType( &(type->EVSECurrentRegulationTolerance),service)) + { + return -1; + } + + + + /* encode end element of EVSECurrentRegulationTolerance */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element EVSEPeakCurrentRipple */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 315)) + { + return -1; + } + + /* encode children of EVSEPeakCurrentRipple */ + if(serialize_PhysicalValueType( &(type->EVSEPeakCurrentRipple),service)) + { + return -1; + } + + + + /* encode end element of EVSEPeakCurrentRipple */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.EVSEEnergyToBeDelivered) + { + + + + /* encode start element EVSEEnergyToBeDelivered */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 303)) + { + return -1; + } + + /* encode children of EVSEEnergyToBeDelivered */ + if(serialize_PhysicalValueType( &(type->EVSEEnergyToBeDelivered),service)) + { + return -1; + } + + + + /* encode end element of EVSEEnergyToBeDelivered */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ChargeParameterDiscoveryResType(struct ChargeParameterDiscoveryResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element EVSEProcessing */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 185)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EVSEProcessing; + + + /* encode character EVSEProcessing */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSEProcessing */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element SAScheduleList */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 363)) + { + return -1; + } + + /* encode children of SAScheduleList */ + if(serialize_SAScheduleListType( &(type->SAScheduleList),service)) + { + return -1; + } + + + + /* encode end element of SAScheduleList */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.AC_EVSEChargeParameter) + { + + + + /* encode start element AC_EVSEChargeParameter */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 251)) + { + return -1; + } + + /* encode children of AC_EVSEChargeParameter */ + if(serialize_AC_EVSEChargeParameterType( (type->AC_EVSEChargeParameter),service)) + { + return -1; + } + + + + /* encode end element of AC_EVSEChargeParameter */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.DC_EVSEChargeParameter) + { + + + + /* encode start element DC_EVSEChargeParameter */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 272)) + { + return -1; + } + + /* encode children of DC_EVSEChargeParameter */ + if(serialize_DC_EVSEChargeParameterType( (type->DC_EVSEChargeParameter),service)) + { + return -1; + } + + + + /* encode end element of DC_EVSEChargeParameter */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ProfileEntryType(struct ProfileEntryType* type, +struct EXIService* service) +{ + + + + /* encode start element ChargingProfileEntryStart */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 261)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; + service->val.integer.val.uint32=type->ChargingProfileEntryStart; + + service->val.integer.type = EXI_UNSIGNED_INTEGER_32; + + /* encode character ChargingProfileEntryStart */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ChargingProfileEntryStart */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ChargingProfileEntryMaxPower */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 260)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->ChargingProfileEntryMaxPower; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character ChargingProfileEntryMaxPower */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ChargingProfileEntryMaxPower */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_ChargingProfileType(struct ChargingProfileType* type, +struct EXIService* service) +{ + + size_t i_loop; + + + + /* encode start element SAScheduleTupleID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 366)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->SAScheduleTupleID; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character SAScheduleTupleID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of SAScheduleTupleID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + for(i_loop=0;i_loop < type->arraylen.ProfileEntry;i_loop++) + { + + + + /* encode start element ProfileEntry */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 356)) + { + return -1; + } + + /* encode children of ProfileEntry */ + if(serialize_ProfileEntryType(&(type->ProfileEntry[i_loop]),service)) + { + return -1; + } + + + /* encode end element of ProfileEntry */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_DC_EVPowerDeliveryParameterType(struct DC_EVPowerDeliveryParameterType* type, +struct EXIService* service) +{ + + + + /* encode start element DC_EVStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 277)) + { + return -1; + } + + /* encode children of DC_EVStatus */ + if(serialize_DC_EVStatusType( &(type->DC_EVStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.BulkChargingComplete) + { + + + + /* encode start element BulkChargingComplete */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 255)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->BulkChargingComplete; + + + /* encode character BulkChargingComplete */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of BulkChargingComplete */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element ChargingComplete */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 259)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->ChargingComplete; + + + /* encode character ChargingComplete */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ChargingComplete */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_PowerDeliveryReqType(struct PowerDeliveryReqType* type, +struct EXIService* service) +{ + + + + /* encode start element ReadyToChargeState */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 210)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->ReadyToChargeState; + + + /* encode character ReadyToChargeState */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ReadyToChargeState */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.ChargingProfile) + { + + + + /* encode start element ChargingProfile */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 151)) + { + return -1; + } + + /* encode children of ChargingProfile */ + if(serialize_ChargingProfileType( &(type->ChargingProfile),service)) + { + return -1; + } + + + + /* encode end element of ChargingProfile */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.DC_EVPowerDeliveryParameter) + { + + + + /* encode start element DC_EVPowerDeliveryParameter */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 270)) + { + return -1; + } + + /* encode children of DC_EVPowerDeliveryParameter */ + if(serialize_DC_EVPowerDeliveryParameterType( (type->DC_EVPowerDeliveryParameter),service)) + { + return -1; + } + + + + /* encode end element of DC_EVPowerDeliveryParameter */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_PowerDeliveryResType(struct PowerDeliveryResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + if(type->isused.AC_EVSEStatus) + { + + + + /* encode start element AC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 253)) + { + return -1; + } + + /* encode children of AC_EVSEStatus */ + if(serialize_AC_EVSEStatusType( (type->AC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of AC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.DC_EVSEStatus) + { + + + + /* encode start element DC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 274)) + { + return -1; + } + + /* encode children of DC_EVSEStatus */ + if(serialize_DC_EVSEStatusType( (type->DC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ChargingStatusReqType(struct ChargingStatusReqType* type, +struct EXIService* service) +{ + + + return 0; +} + + +static int serialize_MeterInfoType(struct MeterInfoType* type, +struct EXIService* service) +{ + + + + /* encode start element MeterID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 332)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->MeterID.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->MeterID.data,type->MeterID.arraylen.data*sizeof(uint32_t)); + + + + /* encode character MeterID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of MeterID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.MeterReading) + { + + + + /* encode start element MeterReading */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 334)) + { + return -1; + } + + /* encode children of MeterReading */ + if(serialize_PhysicalValueType( &(type->MeterReading),service)) + { + return -1; + } + + + + /* encode end element of MeterReading */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.SigMeterReading) + { + + + + /* encode start element SigMeterReading */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 391)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->SigMeterReading.arraylen.data; + memcpy(service->val.binary.data, type->SigMeterReading.data,type->SigMeterReading.arraylen.data); + + + + + /* encode character SigMeterReading */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of SigMeterReading */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.MeterStatus) + { + + + + /* encode start element MeterStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 335)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->MeterStatus; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character MeterStatus */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of MeterStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.TMeter) + { + + + + /* encode start element TMeter */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 394)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int64=type->TMeter; + + service->val.integer.type = EXI_INTEGER_64; + + /* encode character TMeter */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of TMeter */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_ChargingStatusResType(struct ChargingStatusResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element EVSEID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 177)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_HEX; + service->val.binary.len = type->EVSEID.arraylen.data; + memcpy(service->val.binary.data, type->EVSEID.data,type->EVSEID.arraylen.data); + + + + + /* encode character EVSEID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of EVSEID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element SAScheduleTupleID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 216)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->SAScheduleTupleID; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character SAScheduleTupleID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of SAScheduleTupleID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.EVSEMaxCurrent) + { + + + + /* encode start element EVSEMaxCurrent */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 178)) + { + return -1; + } + + /* encode children of EVSEMaxCurrent */ + if(serialize_PhysicalValueType( &(type->EVSEMaxCurrent),service)) + { + return -1; + } + + + + /* encode end element of EVSEMaxCurrent */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.MeterInfo) + { + + + + /* encode start element MeterInfo */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 191)) + { + return -1; + } + + /* encode children of MeterInfo */ + if(serialize_MeterInfoType( &(type->MeterInfo),service)) + { + return -1; + } + + + + /* encode end element of MeterInfo */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element ReceiptRequired */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 211)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->ReceiptRequired; + + + /* encode character ReceiptRequired */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ReceiptRequired */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element AC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 131)) + { + return -1; + } + + /* encode children of AC_EVSEStatus */ + if(serialize_AC_EVSEStatusType( &(type->AC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of AC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_MeteringReceiptReqType(struct MeteringReceiptReqType* type, +struct EXIService* service) +{ + + if(type->isused.attr_Id) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + } + + + + /* encode start element SessionID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 236)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_HEX; + service->val.binary.len = type->SessionID.arraylen.data; + memcpy(service->val.binary.data, type->SessionID.data,type->SessionID.arraylen.data); + + + + + /* encode character SessionID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of SessionID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.SAScheduleTupleID) + { + + + + /* encode start element SAScheduleTupleID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 216)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->SAScheduleTupleID; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character SAScheduleTupleID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of SAScheduleTupleID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element MeterInfo */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 191)) + { + return -1; + } + + /* encode children of MeterInfo */ + if(serialize_MeterInfoType( &(type->MeterInfo),service)) + { + return -1; + } + + + + /* encode end element of MeterInfo */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_MeteringReceiptResType(struct MeteringReceiptResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element AC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 131)) + { + return -1; + } + + /* encode children of AC_EVSEStatus */ + if(serialize_AC_EVSEStatusType( &(type->AC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of AC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_SessionStopType(struct SessionStopType* type, +struct EXIService* service) +{ + + + return 0; +} + + +static int serialize_SessionStopResType(struct SessionStopResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + return 0; +} + + +static int serialize_ListOfRootCertificateIDsType(struct ListOfRootCertificateIDsType* type, +struct EXIService* service) +{ + + size_t i_loop; + + for(i_loop=0;i_loop < type->arraylen.RootCertificateID;i_loop++) + { + + + + /* encode start element RootCertificateID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 361)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->RootCertificateID[i_loop].arraylen.data; + memcpy(service->val.str.miss.codepoints, type->RootCertificateID[i_loop].data,type->RootCertificateID[i_loop].arraylen.data*sizeof(uint32_t)); + + + + /* encode character RootCertificateID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of RootCertificateID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_CertificateUpdateReqType(struct CertificateUpdateReqType* type, +struct EXIService* service) +{ + + if(type->isused.attr_Id) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + } + + + + /* encode start element ContractSignatureCertChain */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 161)) + { + return -1; + } + + /* encode children of ContractSignatureCertChain */ + if(serialize_CertificateChainType( &(type->ContractSignatureCertChain),service)) + { + return -1; + } + + + + /* encode end element of ContractSignatureCertChain */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ContractID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 160)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->ContractID.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->ContractID.data,type->ContractID.arraylen.data*sizeof(uint32_t)); + + + + /* encode character ContractID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ContractID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ListOfRootCertificateIDs */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 190)) + { + return -1; + } + + /* encode children of ListOfRootCertificateIDs */ + if(serialize_ListOfRootCertificateIDsType( &(type->ListOfRootCertificateIDs),service)) + { + return -1; + } + + + + /* encode end element of ListOfRootCertificateIDs */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element DHParams */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 169)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->DHParams.arraylen.data; + memcpy(service->val.binary.data, type->DHParams.data,type->DHParams.arraylen.data); + + + + + /* encode character DHParams */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of DHParams */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_CertificateUpdateResType(struct CertificateUpdateResType* type, +struct EXIService* service) +{ + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element ContractSignatureCertChain */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 161)) + { + return -1; + } + + /* encode children of ContractSignatureCertChain */ + if(serialize_CertificateChainType( &(type->ContractSignatureCertChain),service)) + { + return -1; + } + + + + /* encode end element of ContractSignatureCertChain */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ContractSignatureEncryptedPrivateKey */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 162)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->ContractSignatureEncryptedPrivateKey.arraylen.data; + memcpy(service->val.binary.data, type->ContractSignatureEncryptedPrivateKey.data,type->ContractSignatureEncryptedPrivateKey.arraylen.data); + + + + + /* encode character ContractSignatureEncryptedPrivateKey */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of ContractSignatureEncryptedPrivateKey */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element DHParams */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 169)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->DHParams.arraylen.data; + memcpy(service->val.binary.data, type->DHParams.data,type->DHParams.arraylen.data); + + + + + /* encode character DHParams */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of DHParams */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ContractID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 160)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->ContractID.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->ContractID.data,type->ContractID.arraylen.data*sizeof(uint32_t)); + + + + /* encode character ContractID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ContractID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element RetryCounter */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 215)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_INTEGER; + service->val.integer.val.int16=type->RetryCounter; + + service->val.integer.type = EXI_INTEGER_16; + + /* encode character RetryCounter */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of RetryCounter */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_CertificateInstallationReqType(struct CertificateInstallationReqType* type, +struct EXIService* service) +{ + + if(type->isused.attr_Id) + { + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + } + + + + /* encode start element OEMProvisioningCert */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 196)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->OEMProvisioningCert.arraylen.data; + memcpy(service->val.binary.data, type->OEMProvisioningCert.data,type->OEMProvisioningCert.arraylen.data); + + + + + /* encode character OEMProvisioningCert */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of OEMProvisioningCert */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ListOfRootCertificateIDs */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 190)) + { + return -1; + } + + /* encode children of ListOfRootCertificateIDs */ + if(serialize_ListOfRootCertificateIDsType( &(type->ListOfRootCertificateIDs),service)) + { + return -1; + } + + + + /* encode end element of ListOfRootCertificateIDs */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element DHParams */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 169)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->DHParams.arraylen.data; + memcpy(service->val.binary.data, type->DHParams.data,type->DHParams.arraylen.data); + + + + + /* encode character DHParams */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of DHParams */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_CertificateInstallationResType(struct CertificateInstallationResType* type, +struct EXIService* service) +{ + + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.miss.len = type->attr_Id.arraylen.data; + service->val.str.miss.codepoints= type->attr_Id.data; + if (exiEncodeAttribute(&(service->outStream), &(service->stateEncode), 2,&(service->val))) + { + return -1; + } + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element ContractSignatureCertChain */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 161)) + { + return -1; + } + + /* encode children of ContractSignatureCertChain */ + if(serialize_CertificateChainType( &(type->ContractSignatureCertChain),service)) + { + return -1; + } + + + + /* encode end element of ContractSignatureCertChain */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ContractSignatureEncryptedPrivateKey */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 162)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->ContractSignatureEncryptedPrivateKey.arraylen.data; + memcpy(service->val.binary.data, type->ContractSignatureEncryptedPrivateKey.data,type->ContractSignatureEncryptedPrivateKey.arraylen.data); + + + + + /* encode character ContractSignatureEncryptedPrivateKey */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of ContractSignatureEncryptedPrivateKey */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element DHParams */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 169)) + { + return -1; + } + service->val.type = EXI_DATATYPE_BINARY_BASE64; + service->val.binary.len = type->DHParams.arraylen.data; + memcpy(service->val.binary.data, type->DHParams.data,type->DHParams.arraylen.data); + + + + + /* encode character DHParams */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + + /* encode end element of DHParams */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element ContractID */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 160)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_STRING; + service->val.str.type = EXI_STRING_VALUE_MISS; + service->val.str.miss.len = type->ContractID.arraylen.data; + memcpy(service->val.str.miss.codepoints, type->ContractID.data,type->ContractID.arraylen.data*sizeof(uint32_t)); + + + + /* encode character ContractID */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ContractID */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_CableCheckReqType(struct CableCheckReqType* type, +struct EXIService* service) +{ + + + + /* encode start element DC_EVStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 168)) + { + return -1; + } + + /* encode children of DC_EVStatus */ + if(serialize_DC_EVStatusType( &(type->DC_EVStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_CableCheckResType(struct CableCheckResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element DC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 167)) + { + return -1; + } + + /* encode children of DC_EVSEStatus */ + if(serialize_DC_EVSEStatusType( &(type->DC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEProcessing */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 185)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_ENUMERATION; + service->val.enumeration=type->EVSEProcessing; + + + /* encode character EVSEProcessing */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSEProcessing */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_PreChargeReqType(struct PreChargeReqType* type, +struct EXIService* service) +{ + + + + /* encode start element DC_EVStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 168)) + { + return -1; + } + + /* encode children of DC_EVStatus */ + if(serialize_DC_EVStatusType( &(type->DC_EVStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVTargetVoltage */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 188)) + { + return -1; + } + + /* encode children of EVTargetVoltage */ + if(serialize_PhysicalValueType( &(type->EVTargetVoltage),service)) + { + return -1; + } + + + + /* encode end element of EVTargetVoltage */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVTargetCurrent */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 187)) + { + return -1; + } + + /* encode children of EVTargetCurrent */ + if(serialize_PhysicalValueType( &(type->EVTargetCurrent),service)) + { + return -1; + } + + + + /* encode end element of EVTargetCurrent */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_PreChargeResType(struct PreChargeResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element DC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 167)) + { + return -1; + } + + /* encode children of DC_EVSEStatus */ + if(serialize_DC_EVSEStatusType( &(type->DC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEPresentVoltage */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 184)) + { + return -1; + } + + /* encode children of EVSEPresentVoltage */ + if(serialize_PhysicalValueType( &(type->EVSEPresentVoltage),service)) + { + return -1; + } + + + + /* encode end element of EVSEPresentVoltage */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_CurrentDemandReqType(struct CurrentDemandReqType* type, +struct EXIService* service) +{ + + + + /* encode start element DC_EVStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 168)) + { + return -1; + } + + /* encode children of DC_EVStatus */ + if(serialize_DC_EVStatusType( &(type->DC_EVStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVTargetCurrent */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 187)) + { + return -1; + } + + /* encode children of EVTargetCurrent */ + if(serialize_PhysicalValueType( &(type->EVTargetCurrent),service)) + { + return -1; + } + + + + /* encode end element of EVTargetCurrent */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.EVMaximumVoltageLimit) + { + + + + /* encode start element EVMaximumVoltageLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 174)) + { + return -1; + } + + /* encode children of EVMaximumVoltageLimit */ + if(serialize_PhysicalValueType( &(type->EVMaximumVoltageLimit),service)) + { + return -1; + } + + + + /* encode end element of EVMaximumVoltageLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.EVMaximumCurrentLimit) + { + + + + /* encode start element EVMaximumCurrentLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 172)) + { + return -1; + } + + /* encode children of EVMaximumCurrentLimit */ + if(serialize_PhysicalValueType( &(type->EVMaximumCurrentLimit),service)) + { + return -1; + } + + + + /* encode end element of EVMaximumCurrentLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.EVMaximumPowerLimit) + { + + + + /* encode start element EVMaximumPowerLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 173)) + { + return -1; + } + + /* encode children of EVMaximumPowerLimit */ + if(serialize_PhysicalValueType( &(type->EVMaximumPowerLimit),service)) + { + return -1; + } + + + + /* encode end element of EVMaximumPowerLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.BulkChargingComplete) + { + + + + /* encode start element BulkChargingComplete */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 132)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->BulkChargingComplete; + + + /* encode character BulkChargingComplete */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of BulkChargingComplete */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element ChargingComplete */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 150)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->ChargingComplete; + + + /* encode character ChargingComplete */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of ChargingComplete */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.RemainingTimeToFullSoC) + { + + + + /* encode start element RemainingTimeToFullSoC */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 213)) + { + return -1; + } + + /* encode children of RemainingTimeToFullSoC */ + if(serialize_PhysicalValueType( &(type->RemainingTimeToFullSoC),service)) + { + return -1; + } + + + + /* encode end element of RemainingTimeToFullSoC */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.RemainingTimeToBulkSoC) + { + + + + /* encode start element RemainingTimeToBulkSoC */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 212)) + { + return -1; + } + + /* encode children of RemainingTimeToBulkSoC */ + if(serialize_PhysicalValueType( &(type->RemainingTimeToBulkSoC),service)) + { + return -1; + } + + + + /* encode end element of RemainingTimeToBulkSoC */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + + /* encode start element EVTargetVoltage */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 188)) + { + return -1; + } + + /* encode children of EVTargetVoltage */ + if(serialize_PhysicalValueType( &(type->EVTargetVoltage),service)) + { + return -1; + } + + + + /* encode end element of EVTargetVoltage */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_CurrentDemandResType(struct CurrentDemandResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element DC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 167)) + { + return -1; + } + + /* encode children of DC_EVSEStatus */ + if(serialize_DC_EVSEStatusType( &(type->DC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEPresentVoltage */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 184)) + { + return -1; + } + + /* encode children of EVSEPresentVoltage */ + if(serialize_PhysicalValueType( &(type->EVSEPresentVoltage),service)) + { + return -1; + } + + + + /* encode end element of EVSEPresentVoltage */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEPresentCurrent */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 183)) + { + return -1; + } + + /* encode children of EVSEPresentCurrent */ + if(serialize_PhysicalValueType( &(type->EVSEPresentCurrent),service)) + { + return -1; + } + + + + /* encode end element of EVSEPresentCurrent */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSECurrentLimitAchieved */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 176)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->EVSECurrentLimitAchieved; + + + /* encode character EVSECurrentLimitAchieved */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSECurrentLimitAchieved */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEVoltageLimitAchieved */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 186)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->EVSEVoltageLimitAchieved; + + + /* encode character EVSEVoltageLimitAchieved */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSEVoltageLimitAchieved */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEPowerLimitAchieved */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 182)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_BOOLEAN; + service->val.boolean=type->EVSEPowerLimitAchieved; + + + /* encode character EVSEPowerLimitAchieved */ + if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) + { + + return -1; + } + + + /* encode end element of EVSEPowerLimitAchieved */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + if(type->isused.EVSEMaximumVoltageLimit) + { + + + + /* encode start element EVSEMaximumVoltageLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 181)) + { + return -1; + } + + /* encode children of EVSEMaximumVoltageLimit */ + if(serialize_PhysicalValueType( &(type->EVSEMaximumVoltageLimit),service)) + { + return -1; + } + + + + /* encode end element of EVSEMaximumVoltageLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.EVSEMaximumCurrentLimit) + { + + + + /* encode start element EVSEMaximumCurrentLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 179)) + { + return -1; + } + + /* encode children of EVSEMaximumCurrentLimit */ + if(serialize_PhysicalValueType( &(type->EVSEMaximumCurrentLimit),service)) + { + return -1; + } + + + + /* encode end element of EVSEMaximumCurrentLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.EVSEMaximumPowerLimit) + { + + + + /* encode start element EVSEMaximumPowerLimit */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 180)) + { + return -1; + } + + /* encode children of EVSEMaximumPowerLimit */ + if(serialize_PhysicalValueType( &(type->EVSEMaximumPowerLimit),service)) + { + return -1; + } + + + + /* encode end element of EVSEMaximumPowerLimit */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_WeldingDetectionReqType(struct WeldingDetectionReqType* type, +struct EXIService* service) +{ + + + + /* encode start element DC_EVStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 168)) + { + return -1; + } + + /* encode children of DC_EVStatus */ + if(serialize_DC_EVStatusType( &(type->DC_EVStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_WeldingDetectionResType(struct WeldingDetectionResType* type, +struct EXIService* service) +{ + + + + /* encode start element ResponseCode */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 214)) + { + return -1; + } + + service->val.type = EXI_DATATYPE_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)); + + + + + /* encode start element DC_EVSEStatus */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 167)) + { + return -1; + } + + /* encode children of DC_EVSEStatus */ + if(serialize_DC_EVSEStatusType( &(type->DC_EVSEStatus),service)) + { + return -1; + } + + + + /* encode end element of DC_EVSEStatus */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element EVSEPresentVoltage */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 184)) + { + return -1; + } + + /* encode children of EVSEPresentVoltage */ + if(serialize_PhysicalValueType( &(type->EVSEPresentVoltage),service)) + { + return -1; + } + + + + /* encode end element of EVSEPresentVoltage */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_BodyType(struct BodyType* type, +struct EXIService* service) +{ + + if(type->isused.SessionSetupReq) + { + + + + /* encode start element SessionSetupReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 237)) + { + return -1; + } + + /* encode children of SessionSetupReq */ + if(serialize_SessionSetupReqType( (type->SessionSetupReq),service)) + { + return -1; + } + + + + /* encode end element of SessionSetupReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.SessionSetupRes) + { + + + + /* encode start element SessionSetupRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 239)) + { + return -1; + } + + /* encode children of SessionSetupRes */ + if(serialize_SessionSetupResType( (type->SessionSetupRes),service)) + { + return -1; + } + + + + /* encode end element of SessionSetupRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ServiceDiscoveryReq) + { + + + + /* encode start element ServiceDiscoveryReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 224)) + { + return -1; + } + + /* encode children of ServiceDiscoveryReq */ + if(serialize_ServiceDiscoveryReqType( (type->ServiceDiscoveryReq),service)) + { + return -1; + } + + + + /* encode end element of ServiceDiscoveryReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ServiceDiscoveryRes) + { + + + + /* encode start element ServiceDiscoveryRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 226)) + { + return -1; + } + + /* encode children of ServiceDiscoveryRes */ + if(serialize_ServiceDiscoveryResType( (type->ServiceDiscoveryRes),service)) + { + return -1; + } + + + + /* encode end element of ServiceDiscoveryRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ServiceDetailReq) + { + + + + /* encode start element ServiceDetailReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 220)) + { + return -1; + } + + /* encode children of ServiceDetailReq */ + if(serialize_ServiceDetailReqType( (type->ServiceDetailReq),service)) + { + return -1; + } + + + + /* encode end element of ServiceDetailReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ServiceDetailRes) + { + + + + /* encode start element ServiceDetailRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 222)) + { + return -1; + } + + /* encode children of ServiceDetailRes */ + if(serialize_ServiceDetailResType( (type->ServiceDetailRes),service)) + { + return -1; + } + + + + /* encode end element of ServiceDetailRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ServicePaymentSelectionReq) + { + + + + /* encode start element ServicePaymentSelectionReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 231)) + { + return -1; + } + + /* encode children of ServicePaymentSelectionReq */ + if(serialize_ServicePaymentSelectionReqType( (type->ServicePaymentSelectionReq),service)) + { + return -1; + } + + + + /* encode end element of ServicePaymentSelectionReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ServicePaymentSelectionRes) + { + + + + /* encode start element ServicePaymentSelectionRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 233)) + { + return -1; + } + + /* encode children of ServicePaymentSelectionRes */ + if(serialize_ServicePaymentSelectionResType( (type->ServicePaymentSelectionRes),service)) + { + return -1; + } + + + + /* encode end element of ServicePaymentSelectionRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.PaymentDetailsReq) + { + + + + /* encode start element PaymentDetailsReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 197)) + { + return -1; + } + + /* encode children of PaymentDetailsReq */ + if(serialize_PaymentDetailsReqType( (type->PaymentDetailsReq),service)) + { + return -1; + } + + + + /* encode end element of PaymentDetailsReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.PaymentDetailsRes) + { + + + + /* encode start element PaymentDetailsRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 199)) + { + return -1; + } + + /* encode children of PaymentDetailsRes */ + if(serialize_PaymentDetailsResType( (type->PaymentDetailsRes),service)) + { + return -1; + } + + + + /* encode end element of PaymentDetailsRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ContractAuthenticationReq) + { + + + + /* encode start element ContractAuthenticationReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 156)) + { + return -1; + } + + /* encode children of ContractAuthenticationReq */ + if(serialize_ContractAuthenticationReqType( (type->ContractAuthenticationReq),service)) + { + return -1; + } + + + + /* encode end element of ContractAuthenticationReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ContractAuthenticationRes) + { + + + + /* encode start element ContractAuthenticationRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 158)) + { + return -1; + } + + /* encode children of ContractAuthenticationRes */ + if(serialize_ContractAuthenticationResType( (type->ContractAuthenticationRes),service)) + { + return -1; + } + + + + /* encode end element of ContractAuthenticationRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ChargeParameterDiscoveryReq) + { + + + + /* encode start element ChargeParameterDiscoveryReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 145)) + { + return -1; + } + + /* encode children of ChargeParameterDiscoveryReq */ + if(serialize_ChargeParameterDiscoveryReqType( (type->ChargeParameterDiscoveryReq),service)) + { + return -1; + } + + + + /* encode end element of ChargeParameterDiscoveryReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ChargeParameterDiscoveryRes) + { + + + + /* encode start element ChargeParameterDiscoveryRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 147)) + { + return -1; + } + + /* encode children of ChargeParameterDiscoveryRes */ + if(serialize_ChargeParameterDiscoveryResType( (type->ChargeParameterDiscoveryRes),service)) + { + return -1; + } + + + + /* encode end element of ChargeParameterDiscoveryRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.PowerDeliveryReq) + { + + + + /* encode start element PowerDeliveryReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 202)) + { + return -1; + } + + /* encode children of PowerDeliveryReq */ + if(serialize_PowerDeliveryReqType( (type->PowerDeliveryReq),service)) + { + return -1; + } + + + + /* encode end element of PowerDeliveryReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.PowerDeliveryRes) + { + + + + /* encode start element PowerDeliveryRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 204)) + { + return -1; + } + + /* encode children of PowerDeliveryRes */ + if(serialize_PowerDeliveryResType( (type->PowerDeliveryRes),service)) + { + return -1; + } + + + + /* encode end element of PowerDeliveryRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ChargingStatusReq) + { + + + + /* encode start element ChargingStatusReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 152)) + { + return -1; + } + + /* encode children of ChargingStatusReq */ + if(serialize_ChargingStatusReqType( (type->ChargingStatusReq),service)) + { + return -1; + } + + + + /* encode end element of ChargingStatusReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.ChargingStatusRes) + { + + + + /* encode start element ChargingStatusRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 154)) + { + return -1; + } + + /* encode children of ChargingStatusRes */ + if(serialize_ChargingStatusResType( (type->ChargingStatusRes),service)) + { + return -1; + } + + + + /* encode end element of ChargingStatusRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.MeteringReceiptReq) + { + + + + /* encode start element MeteringReceiptReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 192)) + { + return -1; + } + + /* encode children of MeteringReceiptReq */ + if(serialize_MeteringReceiptReqType( (type->MeteringReceiptReq),service)) + { + return -1; + } + + + + /* encode end element of MeteringReceiptReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.MeteringReceiptRes) + { + + + + /* encode start element MeteringReceiptRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 194)) + { + return -1; + } + + /* encode children of MeteringReceiptRes */ + if(serialize_MeteringReceiptResType( (type->MeteringReceiptRes),service)) + { + return -1; + } + + + + /* encode end element of MeteringReceiptRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.SessionStopReq) + { + + + + /* encode start element SessionStopReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 241)) + { + return -1; + } + + /* encode children of SessionStopReq */ + if(serialize_SessionStopType( (type->SessionStopReq),service)) + { + return -1; + } + + + + /* encode end element of SessionStopReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.SessionStopRes) + { + + + + /* encode start element SessionStopRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 242)) + { + return -1; + } + + /* encode children of SessionStopRes */ + if(serialize_SessionStopResType( (type->SessionStopRes),service)) + { + return -1; + } + + + + /* encode end element of SessionStopRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.CertificateUpdateReq) + { + + + + /* encode start element CertificateUpdateReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 141)) + { + return -1; + } + + /* encode children of CertificateUpdateReq */ + if(serialize_CertificateUpdateReqType( (type->CertificateUpdateReq),service)) + { + return -1; + } + + + + /* encode end element of CertificateUpdateReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.CertificateUpdateRes) + { + + + + /* encode start element CertificateUpdateRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 143)) + { + return -1; + } + + /* encode children of CertificateUpdateRes */ + if(serialize_CertificateUpdateResType( (type->CertificateUpdateRes),service)) + { + return -1; + } + + + + /* encode end element of CertificateUpdateRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.CertificateInstallationReq) + { + + + + /* encode start element CertificateInstallationReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 137)) + { + return -1; + } + + /* encode children of CertificateInstallationReq */ + if(serialize_CertificateInstallationReqType( (type->CertificateInstallationReq),service)) + { + return -1; + } + + + + /* encode end element of CertificateInstallationReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.CertificateInstallationRes) + { + + + + /* encode start element CertificateInstallationRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 139)) + { + return -1; + } + + /* encode children of CertificateInstallationRes */ + if(serialize_CertificateInstallationResType( (type->CertificateInstallationRes),service)) + { + return -1; + } + + + + /* encode end element of CertificateInstallationRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.CableCheckReq) + { + + + + /* encode start element CableCheckReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 133)) + { + return -1; + } + + /* encode children of CableCheckReq */ + if(serialize_CableCheckReqType( (type->CableCheckReq),service)) + { + return -1; + } + + + + /* encode end element of CableCheckReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.CableCheckRes) + { + + + + /* encode start element CableCheckRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 135)) + { + return -1; + } + + /* encode children of CableCheckRes */ + if(serialize_CableCheckResType( (type->CableCheckRes),service)) + { + return -1; + } + + + + /* encode end element of CableCheckRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.PreChargeReq) + { + + + + /* encode start element PreChargeReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 206)) + { + return -1; + } + + /* encode children of PreChargeReq */ + if(serialize_PreChargeReqType( (type->PreChargeReq),service)) + { + return -1; + } + + + + /* encode end element of PreChargeReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.PreChargeRes) + { + + + + /* encode start element PreChargeRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 208)) + { + return -1; + } + + /* encode children of PreChargeRes */ + if(serialize_PreChargeResType( (type->PreChargeRes),service)) + { + return -1; + } + + + + /* encode end element of PreChargeRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.CurrentDemandReq) + { + + + + /* encode start element CurrentDemandReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 163)) + { + return -1; + } + + /* encode children of CurrentDemandReq */ + if(serialize_CurrentDemandReqType( (type->CurrentDemandReq),service)) + { + return -1; + } + + + + /* encode end element of CurrentDemandReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.CurrentDemandRes) + { + + + + /* encode start element CurrentDemandRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 165)) + { + return -1; + } + + /* encode children of CurrentDemandRes */ + if(serialize_CurrentDemandResType( (type->CurrentDemandRes),service)) + { + return -1; + } + + + + /* encode end element of CurrentDemandRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.WeldingDetectionReq) + { + + + + /* encode start element WeldingDetectionReq */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 245)) + { + return -1; + } + + /* encode children of WeldingDetectionReq */ + if(serialize_WeldingDetectionReqType( (type->WeldingDetectionReq),service)) + { + return -1; + } + + + + /* encode end element of WeldingDetectionReq */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + if(type->isused.WeldingDetectionRes) + { + + + + /* encode start element WeldingDetectionRes */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 247)) + { + return -1; + } + + /* encode children of WeldingDetectionRes */ + if(serialize_WeldingDetectionResType( (type->WeldingDetectionRes),service)) + { + return -1; + } + + + + /* encode end element of WeldingDetectionRes */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + } + + + return 0; +} + + +static int serialize_AnonType_V2G_Message(struct AnonType_V2G_Message* type, +struct EXIService* service) +{ + + + + /* encode start element Header */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 441)) + { + return -1; + } + + /* encode children of Header */ + if(serialize_MessageHeaderType( (type->Header),service)) + { + return -1; + } + + + + /* encode end element of Header */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + + /* encode start element Body */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 437)) + { + return -1; + } + + /* encode children of Body */ + if(serialize_BodyType( &(type->Body),service)) + { + return -1; + } + + + + /* encode end element of Body */ + exiEncodeEndElement(&(service->outStream), &(service->stateEncode)); + + + + return 0; +} + + +static int serialize_EXIDocumentType(struct EXIDocumentType* type, +struct EXIService* service) +{ + + + + /* encode start element V2G_Message */ + if (exiEncodeStartElement(&(service->outStream), &(service->stateEncode), 442)) + { + 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)); + + + + return 0; +} + + + + + + /* serialize 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_serviceDispatcher.c b/src/service/v2g_serviceDispatcher.c new file mode 100644 index 0000000..366805a --- /dev/null +++ b/src/service/v2g_serviceDispatcher.c @@ -0,0 +1,2712 @@ + + + +/* + * Copyright (C) 2007-2012 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.7 + * @contact Joerg.Heuer@siemens.com + * + *

Code generated by EXISeGen

+ * + ********************************************************************/ + + +#include "v2g_service.h" +#include "v2g_serviceDispatcher.h" +#include "v2g_dataTypes.h" +#include "v2g_dataTypes.c" +#include "v2g_serviceMethods.h" +#include "v2g_serviceDataSerialization.c" +#include "EXITypes.h" +#include "EXIDecoder.h" +#include "EXIEncoder.h" +#include "QNameDefines.h" +#include "StringTable.h" +#include + + + +static int deserializeMessage(struct EXIService* service); + +uint16_t numberOfLocalStringsDecode[EXI_MAX_NUMBER_OF_QNAMES]; +uint16_t numberOfLocalStringsEncode[EXI_MAX_NUMBER_OF_QNAMES]; + + +static int _setInt64Value(exi_integer_t* iv, int64_t* int64) { + int errn = 0; + switch(iv->type) { + /* Unsigned Integer */ + case EXI_UNSIGNED_INTEGER_8: + *int64 = iv->val.uint8; + break; + case EXI_UNSIGNED_INTEGER_16: + *int64 = iv->val.uint16; + break; + case EXI_UNSIGNED_INTEGER_32: + if (iv->val.uint32 <= 2147483647) { + *int64 = iv->val.uint32; + } else { + errn = -1; + } + break; + case EXI_UNSIGNED_INTEGER_64: + *int64 = iv->val.uint64; + break; + /* (Signed) Integer */ + case EXI_INTEGER_8: + *int64 = iv->val.int8; + break; + case EXI_INTEGER_16: + *int64 = iv->val.int16; + break; + case EXI_INTEGER_32: + *int64 = iv->val.int32; + break; + case EXI_INTEGER_64: + *int64 = iv->val.int64; + break; + } + return errn; +} + + static int _setUnsignedInt32Value(exi_integer_t* iv, uint32_t* int32) { + int errn = 0; + switch(iv->type) { + /* Unsigned Integer */ + case EXI_UNSIGNED_INTEGER_8: + *int32 = iv->val.uint8; + break; + case EXI_UNSIGNED_INTEGER_16: + *int32 = iv->val.uint16; + break; + case EXI_UNSIGNED_INTEGER_32: + if (iv->val.uint32 <= 2147483647) { + *int32 = iv->val.uint32; + } else { + errn = -1; + } + break; + case EXI_UNSIGNED_INTEGER_64: + errn = -1; + break; + /* (Signed) Integer */ + case EXI_INTEGER_8: + *int32 = iv->val.int8; + break; + case EXI_INTEGER_16: + *int32 = iv->val.int16; + break; + case EXI_INTEGER_32: + *int32 = iv->val.int32; + break; + case EXI_INTEGER_64: + errn = -1; + break; + } + return errn; +} + + +static int _setUnsignedInt16Value(exi_integer_t* iv, uint16_t* uint16) { + int errn = 0; + switch(iv->type) { + /* Unsigned Integer */ + case EXI_UNSIGNED_INTEGER_8: + *uint16 = iv->val.uint8; + break; + case EXI_UNSIGNED_INTEGER_16: + *uint16 = iv->val.uint16; + break; + case EXI_UNSIGNED_INTEGER_32: + if (iv->val.uint32 <= 2147483647) { + errn = -1; + } else { + errn = -1; + } + break; + case EXI_UNSIGNED_INTEGER_64: + errn = -1; + break; + /* (Signed) Integer */ + case EXI_INTEGER_8: + *uint16 = iv->val.int8; + break; + case EXI_INTEGER_16: + *uint16 = iv->val.int16; + break; + case EXI_INTEGER_32: + errn = -1; + break; + case EXI_INTEGER_64: + errn = -1; + break; + } + return errn; +} + + + + +static int _setInt16Value(exi_integer_t* iv, int16_t* int16) { + int errn = 0; + switch(iv->type) { + /* Unsigned Integer */ + case EXI_UNSIGNED_INTEGER_8: + *int16 = iv->val.uint8; + break; + case EXI_UNSIGNED_INTEGER_16: + *int16 = iv->val.int16; + break; + case EXI_UNSIGNED_INTEGER_32: + errn = -1; + break; + case EXI_UNSIGNED_INTEGER_64: + errn = -1; + break; + /* (Signed) Integer */ + case EXI_INTEGER_8: + *int16 = iv->val.int8; + break; + case EXI_INTEGER_16: + *int16 = iv->val.int16; + break; + case EXI_INTEGER_32: + errn = -1;; + break; + case EXI_INTEGER_64: + errn = -1; + break; + } + return errn; +} + +/** + * Deserialize an element value of the EXI stream and assign it to the + * service data structure + */ +static int deserializeElementAttributeCharacter(struct EXIService* service) +{ + + switch(service->qnameID) { + case 326: /* FaultCode */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + service->exiMsg.V2G_Message.Header->Notification.FaultCode=service->val.enumeration; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 327: /* FaultMsg */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Notification.FaultMsg.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Notification.FaultMsg.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Notification.isused.FaultMsg=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 0: /* attr_Algorithm */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if( service->idPath.id[4] == 61) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.CanonicalizationMethod.attr_Algorithm.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.CanonicalizationMethod.attr_Algorithm.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[4] == 104) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.SignatureMethod.attr_Algorithm.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.SignatureMethod.attr_Algorithm.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[4] == 95) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].DigestMethod.attr_Algorithm.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].DigestMethod.attr_Algorithm.arraylen.data = service->val.str.miss.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 2: /* attr_Id */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if(service->idPath.id[3] == 113 && service->idPath.id[4] == 2) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.isused.attr_Id=1; + + } else if(service->idPath.id[3] == 75) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.isused.attr_Id=1; + + } else if( service->idPath.id[1] == 441 && service->idPath.id[2] == 103) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->isused.attr_Id=1; + + } else if(service->idPath.id[2] == 156) + { + memcpy(service->exiMsg.V2G_Message.Body.ContractAuthenticationReq->attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ContractAuthenticationReq->attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.ContractAuthenticationReq->isused.attr_Id=1; + + } else if(service->idPath.id[2] == 192) + { + memcpy(service->exiMsg.V2G_Message.Body.MeteringReceiptReq->attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->isused.attr_Id=1; + + } else if(service->idPath.id[2] == 141) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateReq->attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.CertificateUpdateReq->attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.CertificateUpdateReq->isused.attr_Id=1; + + } else if(service->idPath.id[2] == 137) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationReq->attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.CertificateInstallationReq->attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.CertificateInstallationReq->isused.attr_Id=1; + + } else if(service->idPath.id[4] == 95) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_Id.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_Id.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].isused.attr_Id=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 7: /* attr_URI */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_URI.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_URI.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].isused.attr_URI=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 6: /* attr_Type */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_Type.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].attr_Type.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].isused.attr_Type=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 68: /* DigestValue */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].DigestValue.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->SignedInfo.Reference[0].DigestValue.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 111: /* SignatureValue */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->SignatureValue.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->SignatureValue.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 123: /* X509IssuerName */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509IssuerSerial.X509IssuerName.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509IssuerSerial.X509IssuerName.arraylen.data = service->val.str.miss.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 127: /* X509SerialNumber */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + + if(_setInt64Value(&(service->val.integer),&(service->val.integer.val.int64))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + + + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509IssuerSerial.X509SerialNumber=service->val.integer.val.int64; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 126: /* X509SKI */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509SKI.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509SKI.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 128: /* X509SubjectName */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509SubjectName.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509SubjectName.arraylen.data = service->val.str.miss.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 120: /* X509Certificate */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509Certificate.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509Certificate.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 119: /* X509CRL */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509CRL.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->Signature->KeyInfo.X509Data.X509CRL.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 445: /* SessionID */ + + if(service->val.type == EXI_DATATYPE_BINARY_HEX) + { + memcpy(service->exiMsg.V2G_Message.Header->SessionID.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Header->SessionID.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 171: /* EVCCID */ + + if(service->val.type == EXI_DATATYPE_BINARY_HEX) + { + memcpy(service->exiMsg.V2G_Message.Body.SessionSetupReq->EVCCID.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.SessionSetupReq->EVCCID.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 235: /* ServiceScope */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->ServiceScope.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->ServiceScope.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->isused.ServiceScope=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 219: /* ServiceCategory */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->ServiceCategory=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq->isused.ServiceCategory=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 228: /* ServiceID */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if(_setUnsignedInt16Value(&(service->val.integer),&(service->val.integer.val.uint16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServiceDetailReq->ServiceID=service->val.integer.val.uint16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 336: /* Multiplier */ + + if(service->val.type == EXI_DATATYPE_NBIT_UNSIGNED_INTEGER) + { + if( service->idPath.id[2] == 206 && service->idPath.id[3] == 188) + { + service->exiMsg.V2G_Message.Body.PreChargeReq->EVTargetVoltage.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 206 && service->idPath.id[3] == 187) + { + service->exiMsg.V2G_Message.Body.PreChargeReq->EVTargetCurrent.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 163 && service->idPath.id[3] == 187) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVTargetCurrent.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 174) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumVoltageLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 172) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumCurrentLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 173) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumPowerLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 213) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->RemainingTimeToFullSoC.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[3] == 212) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->RemainingTimeToBulkSoC.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 163 && service->idPath.id[3] == 188) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVTargetVoltage.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 280) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EAmount.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 289) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMaxVoltage.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 288) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMaxCurrent.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 293) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMinCurrent.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 290) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumCurrentLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 291) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumPowerLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 292) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumVoltageLimit.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 285) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVEnergyCapacity.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[4] == 286) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVEnergyRequest.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 192) + { + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterReading.Multiplier=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 222) + { + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].physicalValue.Multiplier=service->val.integer.val.int8; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 396: /* Unit */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + if( service->idPath.id[2] == 206 && service->idPath.id[3] == 188) + { + service->exiMsg.V2G_Message.Body.PreChargeReq->EVTargetVoltage.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.PreChargeReq->EVTargetVoltage.isused.Unit=1; + + } else if(service->idPath.id[2] == 206 && service->idPath.id[3] == 187) + { + service->exiMsg.V2G_Message.Body.PreChargeReq->EVTargetCurrent.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.PreChargeReq->EVTargetCurrent.isused.Unit=1; + + } else if(service->idPath.id[2] == 163 && service->idPath.id[3] == 187) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVTargetCurrent.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVTargetCurrent.isused.Unit=1; + + } else if(service->idPath.id[3] == 174) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumVoltageLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumVoltageLimit.isused.Unit=1; + + } else if(service->idPath.id[3] == 172) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumCurrentLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumCurrentLimit.isused.Unit=1; + + } else if(service->idPath.id[3] == 173) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumPowerLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumPowerLimit.isused.Unit=1; + + } else if(service->idPath.id[3] == 213) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->RemainingTimeToFullSoC.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->RemainingTimeToFullSoC.isused.Unit=1; + + } else if(service->idPath.id[3] == 212) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->RemainingTimeToBulkSoC.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->RemainingTimeToBulkSoC.isused.Unit=1; + + } else if(service->idPath.id[2] == 163 && service->idPath.id[3] == 188) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVTargetVoltage.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVTargetVoltage.isused.Unit=1; + + } else if(service->idPath.id[4] == 280) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EAmount.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EAmount.isused.Unit=1; + + } else if(service->idPath.id[4] == 289) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMaxVoltage.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMaxVoltage.isused.Unit=1; + + } else if(service->idPath.id[4] == 288) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMaxCurrent.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMaxCurrent.isused.Unit=1; + + } else if(service->idPath.id[4] == 293) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMinCurrent.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMinCurrent.isused.Unit=1; + + } else if(service->idPath.id[4] == 290) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumCurrentLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumCurrentLimit.isused.Unit=1; + + } else if(service->idPath.id[4] == 291) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumPowerLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumPowerLimit.isused.Unit=1; + + } else if(service->idPath.id[4] == 292) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumVoltageLimit.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumVoltageLimit.isused.Unit=1; + + } else if(service->idPath.id[4] == 285) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVEnergyCapacity.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVEnergyCapacity.isused.Unit=1; + + } else if(service->idPath.id[4] == 286) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVEnergyRequest.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVEnergyRequest.isused.Unit=1; + + } else if(service->idPath.id[2] == 192) + { + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterReading.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterReading.isused.Unit=1; + + } else if(service->idPath.id[2] == 222) + { + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].physicalValue.Unit=service->val.enumeration; + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].physicalValue.isused.Unit=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 397: /* Value */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if( service->idPath.id[2] == 206 && service->idPath.id[3] == 188) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.PreChargeReq->EVTargetVoltage.Value=service->val.integer.val.int16; + } else if(service->idPath.id[2] == 206 && service->idPath.id[3] == 187) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.PreChargeReq->EVTargetCurrent.Value=service->val.integer.val.int16; + } else if(service->idPath.id[2] == 163 && service->idPath.id[3] == 187) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVTargetCurrent.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 174) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumVoltageLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 172) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumCurrentLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 173) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVMaximumPowerLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 213) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandReq->RemainingTimeToFullSoC.Value=service->val.integer.val.int16; + } else if(service->idPath.id[3] == 212) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandReq->RemainingTimeToBulkSoC.Value=service->val.integer.val.int16; + } else if(service->idPath.id[2] == 163 && service->idPath.id[3] == 188) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.CurrentDemandReq->EVTargetVoltage.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 280) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EAmount.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 289) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMaxVoltage.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 288) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMaxCurrent.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 293) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->EVMinCurrent.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 290) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumCurrentLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 291) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumPowerLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 292) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVMaximumVoltageLimit.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 285) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVEnergyCapacity.Value=service->val.integer.val.int16; + } else if(service->idPath.id[4] == 286) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->EVEnergyRequest.Value=service->val.integer.val.int16; + } else if(service->idPath.id[2] == 192) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterReading.Value=service->val.integer.val.int16; + } else if(service->idPath.id[2] == 222) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].Parameter[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.ParameterSet[service->exiMsg.V2G_Message.Body.ServiceDetailRes->ServiceParameterList.arraylen.ParameterSet].arraylen.Parameter].physicalValue.Value=service->val.integer.val.int16; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 383: /* ServiceID */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if(_setUnsignedInt16Value(&(service->val.integer),&(service->val.integer.val.uint16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq->SelectedServiceList.SelectedService[service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq->SelectedServiceList.arraylen.SelectedService].ServiceID=service->val.integer.val.uint16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 349: /* ParameterSetID */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq->SelectedServiceList.SelectedService[service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq->SelectedServiceList.arraylen.SelectedService].ParameterSetID=service->val.integer.val.int16; + service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq->SelectedServiceList.SelectedService[service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq->SelectedServiceList.arraylen.SelectedService].isused.ParameterSetID=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 217: /* SelectedPaymentOption */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq->SelectedPaymentOption=service->val.enumeration; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 257: /* Certificate */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + if(service->idPath.id[2] == 141 && service->idPath.id[4] == 392) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ContractSignatureCertChain.SubCertificates.Certificate[service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ContractSignatureCertChain.SubCertificates.arraylen.Certificate].data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ContractSignatureCertChain.SubCertificates.Certificate[service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ContractSignatureCertChain.SubCertificates.arraylen.Certificate].arraylen.data = service->val.binary.len; + + service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ContractSignatureCertChain.SubCertificates.arraylen.Certificate++; + + } else if(service->idPath.id[2] == 141) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ContractSignatureCertChain.Certificate.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ContractSignatureCertChain.Certificate.arraylen.data = service->val.binary.len; + + } else if(service->idPath.id[4] == 257) + { + memcpy(service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractSignatureCertChain.Certificate.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractSignatureCertChain.Certificate.arraylen.data = service->val.binary.len; + + } else if(service->idPath.id[2] == 197 && service->idPath.id[4] == 392) + { + memcpy(service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractSignatureCertChain.SubCertificates.Certificate[service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractSignatureCertChain.SubCertificates.arraylen.Certificate].data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractSignatureCertChain.SubCertificates.Certificate[service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractSignatureCertChain.SubCertificates.arraylen.Certificate].arraylen.data = service->val.binary.len; + + service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractSignatureCertChain.SubCertificates.arraylen.Certificate++; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 160: /* ContractID */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if( service->idPath.id[2] == 197) + { + memcpy(service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractID.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.PaymentDetailsReq->ContractID.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[2] == 141) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ContractID.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ContractID.arraylen.data = service->val.str.miss.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 189: /* GenChallenge */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + memcpy(service->exiMsg.V2G_Message.Body.ContractAuthenticationReq->GenChallenge.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ContractAuthenticationReq->GenChallenge.arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.ContractAuthenticationReq->isused.GenChallenge=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 279: /* DepartureTime */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->AC_EVChargeParameter->DepartureTime=service->val.integer.val.uint32; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 298: /* EVReady */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + if( service->idPath.id[2] == 133) + { + service->exiMsg.V2G_Message.Body.CableCheckReq->DC_EVStatus.EVReady=service->val.boolean; + } else if(service->idPath.id[2] == 206) + { + service->exiMsg.V2G_Message.Body.PreChargeReq->DC_EVStatus.EVReady=service->val.boolean; + } else if(service->idPath.id[2] == 163) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->DC_EVStatus.EVReady=service->val.boolean; + } else if(service->idPath.id[2] == 245) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionReq->DC_EVStatus.EVReady=service->val.boolean; + } else if(service->idPath.id[2] == 202) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->DC_EVStatus.EVReady=service->val.boolean; + } else if(service->idPath.id[2] == 145) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->DC_EVStatus.EVReady=service->val.boolean; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 282: /* EVCabinConditioning */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + if( service->idPath.id[2] == 133) + { + service->exiMsg.V2G_Message.Body.CableCheckReq->DC_EVStatus.EVCabinConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.CableCheckReq->DC_EVStatus.isused.EVCabinConditioning=1; + + } else if(service->idPath.id[2] == 206) + { + service->exiMsg.V2G_Message.Body.PreChargeReq->DC_EVStatus.EVCabinConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.PreChargeReq->DC_EVStatus.isused.EVCabinConditioning=1; + + } else if(service->idPath.id[2] == 163) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->DC_EVStatus.EVCabinConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->DC_EVStatus.isused.EVCabinConditioning=1; + + } else if(service->idPath.id[2] == 245) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionReq->DC_EVStatus.EVCabinConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.WeldingDetectionReq->DC_EVStatus.isused.EVCabinConditioning=1; + + } else if(service->idPath.id[2] == 202) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->DC_EVStatus.EVCabinConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->DC_EVStatus.isused.EVCabinConditioning=1; + + } else if(service->idPath.id[2] == 145) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->DC_EVStatus.EVCabinConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->DC_EVStatus.isused.EVCabinConditioning=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 296: /* EVRESSConditioning */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + if( service->idPath.id[2] == 133) + { + service->exiMsg.V2G_Message.Body.CableCheckReq->DC_EVStatus.EVRESSConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.CableCheckReq->DC_EVStatus.isused.EVRESSConditioning=1; + + } else if(service->idPath.id[2] == 206) + { + service->exiMsg.V2G_Message.Body.PreChargeReq->DC_EVStatus.EVRESSConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.PreChargeReq->DC_EVStatus.isused.EVRESSConditioning=1; + + } else if(service->idPath.id[2] == 163) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->DC_EVStatus.EVRESSConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->DC_EVStatus.isused.EVRESSConditioning=1; + + } else if(service->idPath.id[2] == 245) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionReq->DC_EVStatus.EVRESSConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.WeldingDetectionReq->DC_EVStatus.isused.EVRESSConditioning=1; + + } else if(service->idPath.id[2] == 202) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->DC_EVStatus.EVRESSConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->DC_EVStatus.isused.EVRESSConditioning=1; + + } else if(service->idPath.id[2] == 145) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->DC_EVStatus.EVRESSConditioning=service->val.boolean; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->DC_EVStatus.isused.EVRESSConditioning=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 287: /* EVErrorCode */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + if( service->idPath.id[2] == 133) + { + service->exiMsg.V2G_Message.Body.CableCheckReq->DC_EVStatus.EVErrorCode=service->val.enumeration; + } else if(service->idPath.id[2] == 206) + { + service->exiMsg.V2G_Message.Body.PreChargeReq->DC_EVStatus.EVErrorCode=service->val.enumeration; + } else if(service->idPath.id[2] == 163) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->DC_EVStatus.EVErrorCode=service->val.enumeration; + } else if(service->idPath.id[2] == 245) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionReq->DC_EVStatus.EVErrorCode=service->val.enumeration; + } else if(service->idPath.id[2] == 202) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->DC_EVStatus.EVErrorCode=service->val.enumeration; + } else if(service->idPath.id[2] == 145) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->DC_EVStatus.EVErrorCode=service->val.enumeration; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 297: /* EVRESSSOC */ + + if(service->val.type == EXI_DATATYPE_NBIT_UNSIGNED_INTEGER) + { + if( service->idPath.id[2] == 133) + { + service->exiMsg.V2G_Message.Body.CableCheckReq->DC_EVStatus.EVRESSSOC=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 206) + { + service->exiMsg.V2G_Message.Body.PreChargeReq->DC_EVStatus.EVRESSSOC=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 163) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->DC_EVStatus.EVRESSSOC=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 245) + { + service->exiMsg.V2G_Message.Body.WeldingDetectionReq->DC_EVStatus.EVRESSSOC=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 202) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->DC_EVStatus.EVRESSSOC=service->val.integer.val.int8; + } else if(service->idPath.id[2] == 145) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->DC_EVStatus.EVRESSSOC=service->val.integer.val.int8; } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 329: /* FullSOC */ + + if(service->val.type == EXI_DATATYPE_NBIT_UNSIGNED_INTEGER) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->FullSOC=service->val.integer.val.int8; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->isused.FullSOC=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 256: /* BulkSOC */ + + if(service->val.type == EXI_DATATYPE_NBIT_UNSIGNED_INTEGER) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->BulkSOC=service->val.integer.val.int8; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->isused.BulkSOC=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 175: /* EVRequestedEnergyTransferType */ + + if(service->val.type == EXI_DATATYPE_ENUMERATION) + { + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->EVRequestedEnergyTransferType=service->val.enumeration; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 261: /* ChargingProfileEntryStart */ + + if(service->val.type == EXI_DATATYPE_UNSIGNED_INTEGER) + { + if(_setUnsignedInt32Value(&(service->val.integer),&(service->val.integer.val.uint32))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->ChargingProfile.ProfileEntry[service->exiMsg.V2G_Message.Body.PowerDeliveryReq->ChargingProfile.arraylen.ProfileEntry].ChargingProfileEntryStart=service->val.integer.val.uint32; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 260: /* ChargingProfileEntryMaxPower */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->ChargingProfile.ProfileEntry[service->exiMsg.V2G_Message.Body.PowerDeliveryReq->ChargingProfile.arraylen.ProfileEntry].ChargingProfileEntryMaxPower=service->val.integer.val.int16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 366: /* SAScheduleTupleID */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->ChargingProfile.SAScheduleTupleID=service->val.integer.val.int16; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 255: /* BulkChargingComplete */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->BulkChargingComplete=service->val.boolean; + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->isused.BulkChargingComplete=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 259: /* ChargingComplete */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->DC_EVPowerDeliveryParameter->ChargingComplete=service->val.boolean; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 210: /* ReadyToChargeState */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->ReadyToChargeState=service->val.boolean; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 332: /* MeterID */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if( service->idPath.id[2] == 192) + { + memcpy(service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterID.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterID.arraylen.data = service->val.str.miss.len; + + } else if(service->idPath.id[2] == 154) + { + memcpy(service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterID.data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterID.arraylen.data = service->val.str.miss.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 391: /* SigMeterReading */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + if( service->idPath.id[2] == 192) + { + memcpy(service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.SigMeterReading.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.SigMeterReading.arraylen.data = service->val.binary.len; + + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.isused.SigMeterReading=1; + + } else if(service->idPath.id[2] == 154) + { + memcpy(service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.SigMeterReading.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.SigMeterReading.arraylen.data = service->val.binary.len; + + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.isused.SigMeterReading=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 335: /* MeterStatus */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if( service->idPath.id[2] == 192) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.MeterStatus=service->val.integer.val.int16; + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.isused.MeterStatus=1; + + } else if(service->idPath.id[2] == 154) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.MeterStatus=service->val.integer.val.int16; + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.isused.MeterStatus=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 394: /* TMeter */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + + if(_setInt64Value(&(service->val.integer),&(service->val.integer.val.int64))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + + if( service->idPath.id[2] == 192) + { + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.TMeter=service->val.integer.val.int64; + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.isused.TMeter=1; + + } else if(service->idPath.id[2] == 154) + { + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.TMeter=service->val.integer.val.int64; + service->exiMsg.V2G_Message.Body.ChargingStatusRes->MeterInfo.isused.TMeter=1; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 236: /* SessionID */ + + if(service->val.type == EXI_DATATYPE_BINARY_HEX) + { + memcpy(service->exiMsg.V2G_Message.Body.MeteringReceiptReq->SessionID.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->SessionID.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 216: /* SAScheduleTupleID */ + + if(service->val.type == EXI_DATATYPE_INTEGER) + { + if(_setInt16Value(&(service->val.integer),&(service->val.integer.val.int16))) + { + service->errorCode=EXI_VALUE_RANGE_FAILED; + return -1; + } + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->SAScheduleTupleID=service->val.integer.val.int16; + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->isused.SAScheduleTupleID=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 361: /* RootCertificateID */ + + if(service->val.type == EXI_DATATYPE_STRING) + { + if( service->idPath.id[2] == 137) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationReq->ListOfRootCertificateIDs.RootCertificateID[service->exiMsg.V2G_Message.Body.CertificateInstallationReq->ListOfRootCertificateIDs.arraylen.RootCertificateID].data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.CertificateInstallationReq->ListOfRootCertificateIDs.RootCertificateID[service->exiMsg.V2G_Message.Body.CertificateInstallationReq->ListOfRootCertificateIDs.arraylen.RootCertificateID].arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.CertificateInstallationReq->ListOfRootCertificateIDs.arraylen.RootCertificateID++; + + } else if(service->idPath.id[2] == 141) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ListOfRootCertificateIDs.RootCertificateID[service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ListOfRootCertificateIDs.arraylen.RootCertificateID].data, service->val.str.miss.codepoints,service->val.str.miss.len*sizeof(uint32_t)); + service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ListOfRootCertificateIDs.RootCertificateID[service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ListOfRootCertificateIDs.arraylen.RootCertificateID].arraylen.data = service->val.str.miss.len; + + service->exiMsg.V2G_Message.Body.CertificateUpdateReq->ListOfRootCertificateIDs.arraylen.RootCertificateID++; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 169: /* DHParams */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + if( service->idPath.id[2] == 141) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateUpdateReq->DHParams.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateUpdateReq->DHParams.arraylen.data = service->val.binary.len; + + } else if(service->idPath.id[2] == 137) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationReq->DHParams.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateInstallationReq->DHParams.arraylen.data = service->val.binary.len; + } + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 196: /* OEMProvisioningCert */ + + if(service->val.type == EXI_DATATYPE_BINARY_BASE64) + { + memcpy(service->exiMsg.V2G_Message.Body.CertificateInstallationReq->OEMProvisioningCert.data, service->val.binary.data,service->val.binary.len); + service->exiMsg.V2G_Message.Body.CertificateInstallationReq->OEMProvisioningCert.arraylen.data = service->val.binary.len; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 132: /* BulkChargingComplete */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->BulkChargingComplete=service->val.boolean; + service->exiMsg.V2G_Message.Body.CurrentDemandReq->isused.BulkChargingComplete=1; + + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + case 150: /* ChargingComplete */ + + if(service->val.type == EXI_DATATYPE_BOOLEAN) + { + service->exiMsg.V2G_Message.Body.CurrentDemandReq->ChargingComplete=service->val.boolean; + } + else + { + service->errorCode=EXI_DATATYPE_FAILED; + return -1; /* wrong data type */ + } + + + break; + + + } + 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->qnameID) { + case 75: /* KeyInfo */ + service->exiMsg.V2G_Message.Header->Signature->isused.KeyInfo=1; + + break; + case 444: /* Notification */ + service->exiMsg.V2G_Message.Header->isused.Notification=1; + + break; + case 103: /* Signature */ + service->exiMsg.V2G_Message.Header->isused.Signature=1; + + break; + case 376: /* SelectedService */ + service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq->SelectedServiceList.arraylen.SelectedService++; + + break; + case 392: /* SubCertificates */ + + break; + case 291: /* EVMaximumPowerLimit */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->isused.EVMaximumPowerLimit=1; + + break; + case 285: /* EVEnergyCapacity */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->isused.EVEnergyCapacity=1; + + break; + case 286: /* EVEnergyRequest */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->DC_EVChargeParameter->isused.EVEnergyRequest=1; + + break; + case 249: /* AC_EVChargeParameter */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->isused.AC_EVChargeParameter=1; + + break; + case 267: /* DC_EVChargeParameter */ + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq->isused.DC_EVChargeParameter=1; + + break; + case 356: /* ProfileEntry */ + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->ChargingProfile.arraylen.ProfileEntry++; + + break; + case 151: /* ChargingProfile */ + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->isused.ChargingProfile=1; + + break; + case 270: /* DC_EVPowerDeliveryParameter */ + service->exiMsg.V2G_Message.Body.PowerDeliveryReq->isused.DC_EVPowerDeliveryParameter=1; + + break; + case 334: /* MeterReading */ + service->exiMsg.V2G_Message.Body.MeteringReceiptReq->MeterInfo.isused.MeterReading=1; + break; + case 174: /* EVMaximumVoltageLimit */ + service->exiMsg.V2G_Message.Body.CurrentDemandReq->isused.EVMaximumVoltageLimit=1; + + break; + case 172: /* EVMaximumCurrentLimit */ + service->exiMsg.V2G_Message.Body.CurrentDemandReq->isused.EVMaximumCurrentLimit=1; + + break; + case 173: /* EVMaximumPowerLimit */ + service->exiMsg.V2G_Message.Body.CurrentDemandReq->isused.EVMaximumPowerLimit=1; + + break; + case 213: /* RemainingTimeToFullSoC */ + service->exiMsg.V2G_Message.Body.CurrentDemandReq->isused.RemainingTimeToFullSoC=1; + + break; + case 212: /* RemainingTimeToBulkSoC */ + service->exiMsg.V2G_Message.Body.CurrentDemandReq->isused.RemainingTimeToBulkSoC=1; + + break; + case 237: /* SessionSetupReq */ + + + /* service call */ + if(sessionSetup((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.SessionSetupReq), (service->exiMsg.V2G_Message.Body.SessionSetupRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.SessionSetupRes=1; + service->exiMsg.V2G_Message.Body.isused.SessionSetupReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 224: /* ServiceDiscoveryReq */ + + + /* service call */ + if(serviceDiscovery((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.ServiceDiscoveryReq), (service->exiMsg.V2G_Message.Body.ServiceDiscoveryRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.ServiceDiscoveryRes=1; + service->exiMsg.V2G_Message.Body.isused.ServiceDiscoveryReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 220: /* ServiceDetailReq */ + + + /* service call */ + if(serviceDetail((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.ServiceDetailReq), (service->exiMsg.V2G_Message.Body.ServiceDetailRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.ServiceDetailRes=1; + service->exiMsg.V2G_Message.Body.isused.ServiceDetailReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 231: /* ServicePaymentSelectionReq */ + + + /* service call */ + if(servicePaymentSelection((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.ServicePaymentSelectionReq), (service->exiMsg.V2G_Message.Body.ServicePaymentSelectionRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.ServicePaymentSelectionRes=1; + service->exiMsg.V2G_Message.Body.isused.ServicePaymentSelectionReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 197: /* PaymentDetailsReq */ + + + /* service call */ + if(paymentDetails((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.PaymentDetailsReq), (service->exiMsg.V2G_Message.Body.PaymentDetailsRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.PaymentDetailsRes=1; + service->exiMsg.V2G_Message.Body.isused.PaymentDetailsReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 156: /* ContractAuthenticationReq */ + + + /* service call */ + if(contractAuthentication((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.ContractAuthenticationReq), (service->exiMsg.V2G_Message.Body.ContractAuthenticationRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.ContractAuthenticationRes=1; + service->exiMsg.V2G_Message.Body.isused.ContractAuthenticationReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 145: /* ChargeParameterDiscoveryReq */ + + + /* service call */ + if(chargeParameterDiscovery((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq), (service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.ChargeParameterDiscoveryRes=1; + service->exiMsg.V2G_Message.Body.isused.ChargeParameterDiscoveryReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 202: /* PowerDeliveryReq */ + + + /* service call */ + if(powerDelivery((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.PowerDeliveryReq), (service->exiMsg.V2G_Message.Body.PowerDeliveryRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.PowerDeliveryRes=1; + service->exiMsg.V2G_Message.Body.isused.PowerDeliveryReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 152: /* ChargingStatusReq */ + + + /* service call */ + if(chargingStatus((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.ChargingStatusReq), (service->exiMsg.V2G_Message.Body.ChargingStatusRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.ChargingStatusRes=1; + service->exiMsg.V2G_Message.Body.isused.ChargingStatusReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 192: /* MeteringReceiptReq */ + + + /* service call */ + if(meteringReceipt((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.MeteringReceiptReq), (service->exiMsg.V2G_Message.Body.MeteringReceiptRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.MeteringReceiptRes=1; + service->exiMsg.V2G_Message.Body.isused.MeteringReceiptReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 241: /* SessionStopReq */ + + + /* service call */ + if(sessionStop((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.SessionStopReq), (service->exiMsg.V2G_Message.Body.SessionStopRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.SessionStopRes=1; + service->exiMsg.V2G_Message.Body.isused.SessionStopReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 141: /* CertificateUpdateReq */ + + + /* service call */ + if(certificateUpdate((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.CertificateUpdateReq), (service->exiMsg.V2G_Message.Body.CertificateUpdateRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.CertificateUpdateRes=1; + service->exiMsg.V2G_Message.Body.isused.CertificateUpdateReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 137: /* CertificateInstallationReq */ + + + /* service call */ + if(certificateInstallation((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.CertificateInstallationReq), (service->exiMsg.V2G_Message.Body.CertificateInstallationRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.CertificateInstallationRes=1; + service->exiMsg.V2G_Message.Body.isused.CertificateInstallationReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 133: /* CableCheckReq */ + + + /* service call */ + if(cableCheck((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.CableCheckReq), (service->exiMsg.V2G_Message.Body.CableCheckRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.CableCheckRes=1; + service->exiMsg.V2G_Message.Body.isused.CableCheckReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 206: /* PreChargeReq */ + + + /* service call */ + if(preCharge((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.PreChargeReq), (service->exiMsg.V2G_Message.Body.PreChargeRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.PreChargeRes=1; + service->exiMsg.V2G_Message.Body.isused.PreChargeReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 163: /* CurrentDemandReq */ + + + /* service call */ + if(currentDemand((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.CurrentDemandReq), (service->exiMsg.V2G_Message.Body.CurrentDemandRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.CurrentDemandRes=1; + service->exiMsg.V2G_Message.Body.isused.CurrentDemandReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + case 245: /* WeldingDetectionReq */ + + + /* service call */ + if(weldingDetection((service->exiMsg.V2G_Message.Header),(service->exiMsg.V2G_Message.Body.WeldingDetectionReq), (service->exiMsg.V2G_Message.Body.WeldingDetectionRes))) + { + service->errorCode=EXI_SERVICE_CALL_FAILED; + return -1; + } + + /* signalize the response message */ + service->exiMsg.V2G_Message.Body.isused.WeldingDetectionRes=1; + service->exiMsg.V2G_Message.Body.isused.WeldingDetectionReq=0; + + /* serialize the response data */ + if(serialize_message(service)) + { + /* serializiation error*/ + service->errorCode= EXI_SERIALIZATION_FAILED; + return -1; + } + break; + + + } + return 0; +} + + + +static int deserializeSessionSetupReqMsg(struct EXIService* service) +{ + struct SessionSetupReqType reqMsg; + struct SessionSetupResType resMsg; + 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 deserializeServiceDetailReqMsg(struct EXIService* service) +{ + struct ServiceDetailReqType reqMsg; + struct ServiceDetailResType resMsg; + service->exiMsg.V2G_Message.Body.ServiceDetailReq = &reqMsg; + service->exiMsg.V2G_Message.Body.ServiceDetailRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializeServicePaymentSelectionReqMsg(struct EXIService* service) +{ + struct ServicePaymentSelectionReqType reqMsg; + struct ServicePaymentSelectionResType resMsg; + init_ServicePaymentSelectionReqType(&reqMsg); + + 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; + init_PaymentDetailsReqType(&reqMsg); + + service->exiMsg.V2G_Message.Body.PaymentDetailsReq = &reqMsg; + service->exiMsg.V2G_Message.Body.PaymentDetailsRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializeContractAuthenticationReqMsg(struct EXIService* service) +{ + struct ContractAuthenticationReqType reqMsg; + struct ContractAuthenticationResType resMsg; + service->exiMsg.V2G_Message.Body.ContractAuthenticationReq = &reqMsg; + service->exiMsg.V2G_Message.Body.ContractAuthenticationRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializeChargeParameterDiscoveryReqMsg(struct EXIService* service) +{ + struct ChargeParameterDiscoveryReqType reqMsg; + struct ChargeParameterDiscoveryResType resMsg; + struct DC_EVChargeParameterType dc_pev; + struct AC_EVChargeParameterType ac_pev; + struct DC_EVSEChargeParameterType dc_evse; + struct AC_EVSEChargeParameterType ac_evse; + struct SAScheduleListType tuple; + struct SalesTariffType sales1; + struct SalesTariffType sales2; + + init_AC_EVChargeParameterType(&ac_pev); + + init_ChargeParameterDiscoveryReqType(&reqMsg); + init_DC_EVSEChargeParameterType(&dc_evse); + init_AC_EVSEChargeParameterType(&ac_evse); + init_DC_EVChargeParameterType(&dc_pev); + init_SAScheduleListType(&tuple); + init_SalesTariffType(&sales1); + init_SalesTariffType(&sales2); + + reqMsg.AC_EVChargeParameter = &ac_pev; + reqMsg.DC_EVChargeParameter = &dc_pev; + resMsg.AC_EVSEChargeParameter = &ac_evse; + resMsg.DC_EVSEChargeParameter= &dc_evse; + + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryReq = &reqMsg; + service->exiMsg.V2G_Message.Body.ChargeParameterDiscoveryRes = &resMsg; + + tuple.SAScheduleTuple[0].SalesTariff = &sales1; + tuple.SAScheduleTuple[1].SalesTariff = &sales2; + resMsg.SAScheduleList = tuple; + + + + return deserializeMessage(service); +} + +static int deserializePowerDeliveryReqMsg(struct EXIService* service) +{ + struct PowerDeliveryReqType reqMsg; + struct PowerDeliveryResType resMsg; + struct DC_EVPowerDeliveryParameterType EVPowerDelivery; + + struct DC_EVSEStatusType dc_evse; + struct AC_EVSEStatusType ac_evse; + + init_DC_EVPowerDeliveryParameterType(&EVPowerDelivery); + init_PowerDeliveryReqType(&reqMsg); + + + resMsg.AC_EVSEStatus = &ac_evse; + resMsg.DC_EVSEStatus = &dc_evse; + + reqMsg.DC_EVPowerDeliveryParameter = &EVPowerDelivery; + + service->exiMsg.V2G_Message.Body.PowerDeliveryReq = &reqMsg; + service->exiMsg.V2G_Message.Body.PowerDeliveryRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializeChargingStatusReqMsg(struct EXIService* service) +{ + struct ChargingStatusReqType reqMsg; + struct ChargingStatusResType resMsg; + service->exiMsg.V2G_Message.Body.ChargingStatusReq = &reqMsg; + service->exiMsg.V2G_Message.Body.ChargingStatusRes = &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); +} + +static int deserializeCertificateUpdateReqMsg(struct EXIService* service) +{ + struct CertificateUpdateReqType reqMsg; + struct CertificateUpdateResType resMsg; + init_CertificateUpdateReqType(&reqMsg); + + service->exiMsg.V2G_Message.Body.CertificateUpdateReq = &reqMsg; + service->exiMsg.V2G_Message.Body.CertificateUpdateRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializeCertificateInstallationReqMsg(struct EXIService* service) +{ + struct CertificateInstallationReqType reqMsg; + struct CertificateInstallationResType resMsg; + init_CertificateInstallationReqType(&reqMsg); + + service->exiMsg.V2G_Message.Body.CertificateInstallationReq = &reqMsg; + service->exiMsg.V2G_Message.Body.CertificateInstallationRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializeCableCheckReqMsg(struct EXIService* service) +{ + struct CableCheckReqType reqMsg; + struct CableCheckResType resMsg; + service->exiMsg.V2G_Message.Body.CableCheckReq = &reqMsg; + service->exiMsg.V2G_Message.Body.CableCheckRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializePreChargeReqMsg(struct EXIService* service) +{ + struct PreChargeReqType reqMsg; + struct PreChargeResType resMsg; + init_PreChargeReqType(&reqMsg); + + service->exiMsg.V2G_Message.Body.PreChargeReq = &reqMsg; + service->exiMsg.V2G_Message.Body.PreChargeRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializeCurrentDemandReqMsg(struct EXIService* service) +{ + struct CurrentDemandReqType reqMsg; + struct CurrentDemandResType resMsg; + init_CurrentDemandReqType(&reqMsg); + + service->exiMsg.V2G_Message.Body.CurrentDemandReq = &reqMsg; + service->exiMsg.V2G_Message.Body.CurrentDemandRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializeWeldingDetectionReqMsg(struct EXIService* service) +{ + struct WeldingDetectionReqType reqMsg; + struct WeldingDetectionResType resMsg; + service->exiMsg.V2G_Message.Body.WeldingDetectionReq = &reqMsg; + service->exiMsg.V2G_Message.Body.WeldingDetectionRes = &resMsg; + + return deserializeMessage(service); +} + +static int deserializeSessionStopReqMsg(struct EXIService* service) +{ + struct SessionStopType reqMsg; + struct SessionStopResType resMsg; + service->exiMsg.V2G_Message.Body.SessionStopReq = &reqMsg; + service->exiMsg.V2G_Message.Body.SessionStopRes = &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; + static int derivationCounter = 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 EXI_EVENT_START_DOCUMENT: + + returnCode = exiDecodeStartDocument(&(service->inStream), &(service->stateDecode)); + + break; + case EXI_EVENT_END_DOCUMENT: + + returnCode = exiDecodeEndDocument(&(service->inStream), &(service->stateDecode)); + noEndOfDocument = 0; /* false */ + break; + break; + case EXI_EVENT_START_ELEMENT_GENERIC: + case EXI_EVENT_START_ELEMENT_GENERIC_UNDECLARED: + derivationCounter++; + case EXI_EVENT_START_ELEMENT: + returnCode = exiDecodeStartElement(&(service->inStream), &(service->stateDecode), &(service->qnameID)); + service->idPath.id[service->idPath.pos++]=service->qnameID; + + /* setup the request context*/ + if(service->qnameID==237 ) + { + return deserializeSessionSetupReqMsg(service); + } else if(service->qnameID==224) + { + return deserializeServiceDiscoveryReqMsg(service); + } else if(service->qnameID==220) + { + return deserializeServiceDetailReqMsg(service); + } else if(service->qnameID==231) + { + return deserializeServicePaymentSelectionReqMsg(service); + } else if(service->qnameID==197) + { + return deserializePaymentDetailsReqMsg(service); + } else if(service->qnameID==156) + { + return deserializeContractAuthenticationReqMsg(service); + } else if(service->qnameID==145) + { + return deserializeChargeParameterDiscoveryReqMsg(service); + } else if(service->qnameID==202) + { + return deserializePowerDeliveryReqMsg(service); + } else if(service->qnameID==152) + { + return deserializeChargingStatusReqMsg(service); + } else if(service->qnameID==192) + { + return deserializeMeteringReceiptReqMsg(service); + } else if(service->qnameID==241) + { + return deserializeSessionStopReqMsg(service); + } else if(service->qnameID==141) + { + return deserializeCertificateUpdateReqMsg(service); + } else if(service->qnameID==137) + { + return deserializeCertificateInstallationReqMsg(service); + } else if(service->qnameID==133) + { + return deserializeCableCheckReqMsg(service); + } else if(service->qnameID==206) + { + return deserializePreChargeReqMsg(service); + } else if(service->qnameID==163) + { + return deserializeCurrentDemandReqMsg(service); + } else if(service->qnameID==245) + { + return deserializeWeldingDetectionReqMsg(service); + } + + + break; + case EXI_EVENT_END_ELEMENT_UNDECLARED: + case EXI_EVENT_END_ELEMENT: + + returnCode = exiDecodeEndElement(&(service->inStream), &(service->stateDecode), &(service->qnameID)); + + if(derivationCounter==0) + returnCode = deserializeElementOrServiceCall(service); + + service->idPath.pos--; + + if(derivationCounter>0) + derivationCounter--; + + break; + case EXI_EVENT_CHARACTERS_GENERIC: + case EXI_EVENT_CHARACTERS_GENERIC_UNDECLARED: + case EXI_EVENT_CHARACTERS: + /* decode */ + returnCode = exiDecodeCharacters(&(service->inStream), &(service->stateDecode), &(service->val)); + + /* assign data to the EXI message structure; only if there was no derivation */ + if(derivationCounter==0) + returnCode = deserializeElementAttributeCharacter(service); + + break; + case EXI_EVENT_ATTRIBUTE_GENERIC: + case EXI_EVENT_ATTRIBUTE_GENERIC_UNDECLARED: + case EXI_EVENT_ATTRIBUTE_INVALID_VALUE: + case EXI_EVENT_ATTRIBUTE: + /* decode */ + returnCode = exiDecodeAttribute(&(service->inStream), &(service->stateDecode), &(service->qnameID), &(service->val)); + if(derivationCounter==0) + returnCode = deserializeElementAttributeCharacter(service); + + break; + case EXI_EVENT_ATTRIBUTE_ANY_INVALID_VALUE: + 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, uint32_t sizeInStream, uint8_t* outStream, uint32_t sizeOutStream, uint32_t* outStreamLength) +{ + struct MessageHeaderType header; + struct SignatureType signature; + + uint32_t inPos, outPos; + + exi_name_table_runtime_t runtimeTableDecode; + exi_name_table_runtime_t runtimeTableEncode; + + exi_string_table_t stringTableDecode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsDecode}; + exi_string_table_t stringTableEncode = { 0, EXI_MAX_NUMBER_OF_QNAMES, numberOfLocalStringsEncode}; + + + /* 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 decoder (read header, set initial state) */ + /* init runtime table */ + exiInitNameTableRuntime(&runtimeTableDecode); + exiInitDecoder(&(service->inStream), &(service->stateDecode), runtimeTableDecode,stringTableDecode); + + /* init encoder (write header, set initial state) */ + exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode,stringTableEncode); + + /* init uniqueID stack */ + service->idPath.pos=0; + + init_MessageHeaderType(&header); + service->exiMsg.V2G_Message.Header = &header; + init_SignatureType(&signature); + service->exiMsg.V2G_Message.Header->Signature=&signature; + + /* init EXI message */ + init_EXIDocumentType(&(service->exiMsg)); + + /* deserialize the input stream and call the corresponding service */ + if(deserializeMessage(service)) + { + /* something went wrong */ + + return -1; + + } + + /* 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, exi_bytes_t service_bytes, exi_string_ucs_t service_string, uint16_t transportHeaderOffset) +{ + + /* init byte array */ + service->val.binary = service_bytes; + + /* init string array */ + service->val.str.miss = service_string; + + + service->idPath.pos=0; + + /* init offset for transport protocol */ + 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..d403a54 --- /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.7 + * @contact Joerg.Heuer@siemens.com + * + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef V2GSERVER_H_ +#define V2GSERVER_H_ + +#include "v2g_dataTypes.h" + + +int init_v2gservice(struct EXIService* service, exi_bytes_t service_bytes, exi_string_ucs_t service_string, uint16_t transportHeaderOffset); +int messageDispatcher(struct EXIService* service, uint8_t* inStream, uint32_t sizeInStream, uint8_t* outStream, uint32_t sizeOutStream, uint32_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..38a706e --- /dev/null +++ b/src/service/v2g_serviceMethods.h @@ -0,0 +1,189 @@ + + + + +/* + * Copyright (C) 2007-2012 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.7 + * @contact Joerg.Heuer@siemens.com + * + *

Code generated by EXISeGen

+ * + ********************************************************************/ + + + #ifdef __cplusplus +extern "C" { +#endif + +#ifndef SERVICEMETHODS_H +#define SERVICEMETHODS_H + +#include "v2g_dataTypes.h" +#include "EXITypes.h" + +/** This service methods has to be implemented by the EVSE server */ +/** + * \brief This sessionSetup method is called by the service dispatcher if there was passed a sessionSetup-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct SessionSetupReqType Parameter dataset of the sessionSetup request message + * \param result struct SessionSetupResType Result dataset for the sessionSetup response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int sessionSetup(struct MessageHeaderType* header, struct SessionSetupReqType* param, struct SessionSetupResType* result); + +/** + * \brief This serviceDiscovery method is called by the service dispatcher if there was passed a serviceDiscovery-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct ServiceDiscoveryReqType Parameter dataset of the serviceDiscovery request message + * \param result struct ServiceDiscoveryResType Result dataset for the serviceDiscovery response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int serviceDiscovery(struct MessageHeaderType* header, struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result); + +/** + * \brief This serviceDetail method is called by the service dispatcher if there was passed a serviceDetail-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct ServiceDetailReqType Parameter dataset of the serviceDetail request message + * \param result struct ServiceDetailResType Result dataset for the serviceDetail response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int serviceDetail(struct MessageHeaderType* header, struct ServiceDetailReqType* param, struct ServiceDetailResType* result); + +/** + * \brief This servicePaymentSelection method is called by the service dispatcher if there was passed a servicePaymentSelection-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct ServicePaymentSelectionReqType Parameter dataset of the servicePaymentSelection request message + * \param result struct ServicePaymentSelectionResType Result dataset for the servicePaymentSelection response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int servicePaymentSelection(struct MessageHeaderType* header, struct ServicePaymentSelectionReqType* param, struct ServicePaymentSelectionResType* result); + +/** + * \brief This paymentDetails method is called by the service dispatcher if there was passed a paymentDetails-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct PaymentDetailsReqType Parameter dataset of the paymentDetails request message + * \param result struct PaymentDetailsResType Result dataset for the paymentDetails response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int paymentDetails(struct MessageHeaderType* header, struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result); + +/** + * \brief This contractAuthentication method is called by the service dispatcher if there was passed a contractAuthentication-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct ContractAuthenticationReqType Parameter dataset of the contractAuthentication request message + * \param result struct ContractAuthenticationResType Result dataset for the contractAuthentication response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int contractAuthentication(struct MessageHeaderType* header, struct ContractAuthenticationReqType* param, struct ContractAuthenticationResType* result); + +/** + * \brief This chargeParameterDiscovery method is called by the service dispatcher if there was passed a chargeParameterDiscovery-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct ChargeParameterDiscoveryReqType Parameter dataset of the chargeParameterDiscovery request message + * \param result struct ChargeParameterDiscoveryResType Result dataset for the chargeParameterDiscovery response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int chargeParameterDiscovery(struct MessageHeaderType* header, struct ChargeParameterDiscoveryReqType* param, struct ChargeParameterDiscoveryResType* result); + +/** + * \brief This powerDelivery method is called by the service dispatcher if there was passed a powerDelivery-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct PowerDeliveryReqType Parameter dataset of the powerDelivery request message + * \param result struct PowerDeliveryResType Result dataset for the powerDelivery response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int powerDelivery(struct MessageHeaderType* header, struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result); + +/** + * \brief This chargingStatus method is called by the service dispatcher if there was passed a chargingStatus-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct ChargingStatusReqType Parameter dataset of the chargingStatus request message + * \param result struct ChargingStatusResType Result dataset for the chargingStatus response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int chargingStatus(struct MessageHeaderType* header, struct ChargingStatusReqType* param, struct ChargingStatusResType* result); + +/** + * \brief This meteringReceipt method is called by the service dispatcher if there was passed a meteringReceipt-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct MeteringReceiptReqType Parameter dataset of the meteringReceipt request message + * \param result struct MeteringReceiptResType Result dataset for the meteringReceipt response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int meteringReceipt(struct MessageHeaderType* header, struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result); + +/** + * \brief This sessionStop method is called by the service dispatcher if there was passed a sessionStop-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct SessionStopType Parameter dataset of the sessionStop request message + * \param result struct SessionStopResType Result dataset for the sessionStop response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int sessionStop(struct MessageHeaderType* header, struct SessionStopType* param, struct SessionStopResType* result); + +/** + * \brief This certificateUpdate method is called by the service dispatcher if there was passed a certificateUpdate-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct CertificateUpdateReqType Parameter dataset of the certificateUpdate request message + * \param result struct CertificateUpdateResType Result dataset for the certificateUpdate response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int certificateUpdate(struct MessageHeaderType* header, struct CertificateUpdateReqType* param, struct CertificateUpdateResType* result); + +/** + * \brief This certificateInstallation method is called by the service dispatcher if there was passed a certificateInstallation-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct CertificateInstallationReqType Parameter dataset of the certificateInstallation request message + * \param result struct CertificateInstallationResType Result dataset for the certificateInstallation response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int certificateInstallation(struct MessageHeaderType* header, struct CertificateInstallationReqType* param, struct CertificateInstallationResType* result); + +/** + * \brief This cableCheck method is called by the service dispatcher if there was passed a cableCheck-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct CableCheckReqType Parameter dataset of the cableCheck request message + * \param result struct CableCheckResType Result dataset for the cableCheck response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int cableCheck(struct MessageHeaderType* header, struct CableCheckReqType* param, struct CableCheckResType* result); + +/** + * \brief This preCharge method is called by the service dispatcher if there was passed a preCharge-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct PreChargeReqType Parameter dataset of the preCharge request message + * \param result struct PreChargeResType Result dataset for the preCharge response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int preCharge(struct MessageHeaderType* header, struct PreChargeReqType* param, struct PreChargeResType* result); + +/** + * \brief This currentDemand method is called by the service dispatcher if there was passed a currentDemand-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct CurrentDemandReqType Parameter dataset of the currentDemand request message + * \param result struct CurrentDemandResType Result dataset for the currentDemand response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int currentDemand(struct MessageHeaderType* header, struct CurrentDemandReqType* param, struct CurrentDemandResType* result); + +/** + * \brief This weldingDetection method is called by the service dispatcher if there was passed a weldingDetection-based request message. + * \param header struct MessageHeaderType* Header dataset + * \param param struct WeldingDetectionReqType Parameter dataset of the weldingDetection request message + * \param result struct WeldingDetectionResType Result dataset for the weldingDetection response message + * \return 0 = 0K; -1 = ERROR (message dispatcher will return an error) */ +int weldingDetection(struct MessageHeaderType* header, struct WeldingDetectionReqType* param, struct WeldingDetectionResType* result); + + + + + + +#endif + +#ifdef __cplusplus +} +#endif