From d5f9a67a361b2f7ca328912d46c023a08c7362f7 Mon Sep 17 00:00:00 2001 From: sebastiankb Date: Tue, 31 Jan 2012 10:42:32 +0000 Subject: [PATCH] OOpenV2G 0.6 init2 git-svn-id: https://svn.code.sf.net/p/openv2g/code/trunk@51 d9f2db14-54d0-4bde-b00c-16405c910529 --- src/codec/appHandCodec/appHand_EXIDecoder.c | 2 +- src/codec/appHandCodec/appHand_EXIEncoder.c | 2 +- .../appHandCodec/appHand_NameTableEntries.c | 109 ++++ .../appHandCodec/appHand_NameTableEntries.h | 41 ++ src/service/v2g_serviceDataSerialization.c | 2 +- src/test/main_codec.c | 499 ++++++++++++++++++ src/test/pev_service.c | 9 +- src/test/serviceClientDataTransmitter.h | 43 ++ 8 files changed, 697 insertions(+), 10 deletions(-) create mode 100644 src/codec/appHandCodec/appHand_NameTableEntries.c create mode 100644 src/codec/appHandCodec/appHand_NameTableEntries.h create mode 100644 src/test/main_codec.c create mode 100644 src/test/serviceClientDataTransmitter.h diff --git a/src/codec/appHandCodec/appHand_EXIDecoder.c b/src/codec/appHandCodec/appHand_EXIDecoder.c index 9249f9d..be06358 100644 --- a/src/codec/appHandCodec/appHand_EXIDecoder.c +++ b/src/codec/appHandCodec/appHand_EXIDecoder.c @@ -36,7 +36,7 @@ #include "CoderChannel.h" #include "StringTable.h" -#include "NameTableEntries.h" +#include "appHand_NameTableEntries.h" #include "MethodsBag.h" #include "EXICoder.h" diff --git a/src/codec/appHandCodec/appHand_EXIEncoder.c b/src/codec/appHandCodec/appHand_EXIEncoder.c index b2377e5..ba97e4d 100644 --- a/src/codec/appHandCodec/appHand_EXIEncoder.c +++ b/src/codec/appHandCodec/appHand_EXIEncoder.c @@ -35,7 +35,7 @@ #include "EncoderChannel.h" #include "StringTable.h" -#include "NameTableEntries.h" +#include "appHand_NameTableEntries.h" #include "MethodsBag.h" #include "EXICoder.h" diff --git a/src/codec/appHandCodec/appHand_NameTableEntries.c b/src/codec/appHandCodec/appHand_NameTableEntries.c new file mode 100644 index 0000000..515ae55 --- /dev/null +++ b/src/codec/appHandCodec/appHand_NameTableEntries.c @@ -0,0 +1,109 @@ +/* + * 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. + * 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 Daniel.Peintner.EXT@siemens.com + * @version 2012-01-13 + * @contact Joerg.Heuer@siemens.com + * + *

Code generated by EXIdizer

+ ********************************************************************/ + + + +#ifndef EXI_appHand_NAME_TABLE_ENTRIES_C +#define EXI_appHand_NAME_TABLE_ENTRIES_C + +#include "appHand_NameTableEntries.h" + + + +/* ==================================== */ +/* String Table Population */ + +#if EXI_DEBUG == EXI_DEBUG_ON +/* localName entries for URI id = 0 */ +char * localNames0[] = { + "AppProtocol", "Priority", "ProtocolNamespace", "ResponseCode", "SchemaID", + "VersionNumberMajor", "VersionNumberMinor" +}; +/* localName entries for URI id = 1 */ +char * localNames1[] = { + "base", "id", "lang", "space" +}; +/* localName entries for URI id = 2 */ +char * localNames2[] = { + "nil", "type" +}; +/* localName entries for URI id = 3 */ +char * localNames3[] = { + "ENTITIES", "ENTITY", "ID", "IDREF", "IDREFS", + "NCName", "NMTOKEN", "NMTOKENS", "NOTATION", "Name", + "QName", "anySimpleType", "anyType", "anyURI", "base64Binary", + "boolean", "byte", "date", "dateTime", "decimal", + "double", "duration", "float", "gDay", "gMonth", + "gMonthDay", "gYear", "gYearMonth", "hexBinary", "int", + "integer", "language", "long", "negativeInteger", "nonNegativeInteger", + "nonPositiveInteger", "normalizedString", "positiveInteger", "short", "string", + "time", "token", "unsignedByte", "unsignedInt", "unsignedLong", + "unsignedShort" +}; +/* localName entries for URI id = 4 */ +char * localNames4[] = { + "AppProtocolType", "idType", "priorityType", "protocolNameType", "protocolNamespaceType", + "responseCodeType", "supportedAppProtocolReq", "supportedAppProtocolRes" +}; +char * uris[] = { + "", "http://www.w3.org/XML/1998/namespace", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/2001/XMLSchema", "urn:iso:15118:2:2010:AppProtocol" +}; +#endif /*EXI_DEBUG*/ + +#if EXI_DEBUG == EXI_DEBUG_ON +struct exiNamePartition localNamePartitions[5] = { + { 7, localNames0 }, + { 4, localNames1 }, + { 2, localNames2 }, + { 46, localNames3 }, + { 8, localNames4 } +}; +#endif /*EXI_DEBUG*/ + +#if EXI_DEBUG == EXI_DEBUG_OFF +struct exiNamePartition localNamePartitions[5] = { + { 7 }, + { 4 }, + { 2 }, + { 46 }, + { 8 } +}; +#endif /*EXI_DEBUG*/ + + +#if EXI_DEBUG == EXI_DEBUG_ON +exi_name_table_prepopulated_t exiappHandNameTablePrepopulated = { 5, uris, localNamePartitions }; +#endif /*EXI_DEBUG*/ +#if EXI_DEBUG == EXI_DEBUG_OFF +exi_name_table_prepopulated_t exiappHandNameTablePrepopulated = { 5, localNamePartitions }; +#endif /*EXI_DEBUG*/ + + + + +#endif + diff --git a/src/codec/appHandCodec/appHand_NameTableEntries.h b/src/codec/appHandCodec/appHand_NameTableEntries.h new file mode 100644 index 0000000..c79dd44 --- /dev/null +++ b/src/codec/appHandCodec/appHand_NameTableEntries.h @@ -0,0 +1,41 @@ +/* + * 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. + * 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 Daniel.Peintner.EXT@siemens.com + * @version 2012-01-13 + * @contact Joerg.Heuer@siemens.com + * + *

Code generated by EXIdizer

+ ********************************************************************/ + + + +#ifndef EXI_appHand_NAME_TABLE_ENTRIES_H +#define EXI_appHand_NAME_TABLE_ENTRIES_H + +#include "EXITypes.h" + +/* ==================================== */ +/* String Table Population */ + +extern exi_name_table_prepopulated_t exiappHandNameTablePrepopulated; + +#endif + diff --git a/src/service/v2g_serviceDataSerialization.c b/src/service/v2g_serviceDataSerialization.c index 40fb59c..9633b71 100644 --- a/src/service/v2g_serviceDataSerialization.c +++ b/src/service/v2g_serviceDataSerialization.c @@ -1017,7 +1017,7 @@ static int serialize_PaymentOptionsType(struct PaymentOptionsType* type, struct } service->val.type = ENUMERATION; - service->val.enumeration=type->PaymentOption; + service->val.enumeration=type->PaymentOption[i_loop]; /* encode character PaymentOption */ if (exiEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) diff --git a/src/test/main_codec.c b/src/test/main_codec.c new file mode 100644 index 0000000..09f18e9 --- /dev/null +++ b/src/test/main_codec.c @@ -0,0 +1,499 @@ +/* + * 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. + * 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 Daniel.Peintner.EXT@siemens.com + * @version 2012-01-31 + * @contact Joerg.Heuer@siemens.com + * + *

Code generated by EXIdizer

+ ********************************************************************/ + + + +/******************************************************************* + * + *

Sample program to illustrate how to read an EXI stream and + * directly write it again to an output

+ * + *

e.g., data/test/sessionSetupReq.xml.exi out/test/sessionSetupReq.xml.exi

+ ********************************************************************/ + +#include +#include + +#include "EXIDecoder.h" +#include "StringTable.h" +#include "EXIEncoder.h" +#include "EXITypes.h" +#include "ByteStream.h" + +#define DEBUG 1 + +#if EXI_STREAM == BYTE_ARRAY +/* 64 kilobytes = 65 536 bytes */ +/* 1 megabyte = 1 048 576 bytes*/ +#define BUFFER_SIZE 1048576 +uint8_t bufferIn[BUFFER_SIZE]; +uint8_t bufferOut[BUFFER_SIZE]; +#endif /* EXI_STREAM == BYTE_ARRAY */ + +/* avoids warning: initializer element is not computable at load time */ +#define ARRAY_SIZE_BYTES 300 +uint8_t bytesData[ARRAY_SIZE_BYTES]; +#define ARRAY_SIZE_STRINGS 30000 +uint32_t codepoints[ARRAY_SIZE_STRINGS]; +#define ARRAY_SIZE_STRINGS_ASCII 150 +char charsNamespaceURI[ARRAY_SIZE_STRINGS_ASCII]; +char charsLocalName[ARRAY_SIZE_STRINGS_ASCII]; + +void debugValue(exi_value_t* val) ; + +int main_codec(int argc, char *argv[]) { + + int errn = 0; + + bitstream_t iStream, oStream; + uint32_t posDecode; + uint32_t posEncode; + + /* EXI set-up */ + exi_state_t stateDecode; + exi_state_t stateEncode; + exi_event_t event; + eqname_t eqn; /* efficient qname */ + qname_t qn; /* ascii qname */ + exi_value_t val; + + exi_name_table_runtime_t runtimeTableDecode; + exi_name_table_runtime_t runtimeTableEncode; + + /* BINARY memory setup */ + bytes_t bytes = { ARRAY_SIZE_BYTES, bytesData, 0 }; + + const char * localName; + const char * namespaceURI; + int noEndOfDocument = 1; /* true */ + + /* STRING memory setup */ + string_ucs_t string = { ARRAY_SIZE_STRINGS, codepoints, 0 }; + string_ascii_t stringNamespaceURI = { ARRAY_SIZE_STRINGS_ASCII, charsNamespaceURI }; + string_ascii_t stringLocalName = { ARRAY_SIZE_STRINGS_ASCII, charsLocalName }; + qn.namespaceURI = stringNamespaceURI; + qn.localName = stringLocalName; + + if (argc != 3) { + printf("Usage: %s exiInput exiOutput\n", argv[0]); + return -1; + } + + /* input pos */ + posDecode = 0; + +#if EXI_STREAM == BYTE_ARRAY + /* parse EXI stream to internal byte structures */ + errn = readBytesFromFile(argv[1], bufferIn, BUFFER_SIZE, posDecode); + if (errn < 0) { + printf("Problems while reading file into buffer\n"); + return errn; + } +#endif /* EXI_STREAM == BYTE_ARRAY */ + + /* setup input stream */ +#if EXI_STREAM == BYTE_ARRAY + iStream.size = BUFFER_SIZE; + iStream.data = bufferIn; + iStream.pos = &posDecode; +#endif /* EXI_STREAM == BYTE_ARRAY */ +#if EXI_STREAM == FILE_STREAM + iStream.file = fopen(argv[1],"rb"); +#endif /* EXI_STREAM == FILE_STREAM */ + + iStream.buffer = 0; + iStream.capacity = 0; + + /* setup output stream */ + posEncode = 0; +#if EXI_STREAM == BYTE_ARRAY + oStream.size = BUFFER_SIZE; + oStream.data = bufferOut; + oStream.pos = &posEncode; +#endif +#if EXI_STREAM == FILE_STREAM + oStream.file = fopen(argv[2],"wb"); +#endif /* EXI_STREAM == FILE_STREAM */ + oStream.buffer = 0; + oStream.capacity = 8; + + val.binary = bytes; + val.string = string; + + /* init decoder (read header, set initial state) */ + /* init runtime table */ + errn = exiInitNameTableRuntime(&runtimeTableDecode); + exiInitDecoder(&iStream, &stateDecode, runtimeTableDecode); + + /* init encoder (write header, set initial state) */ + errn = exiInitNameTableRuntime(&runtimeTableEncode); + exiInitEncoder(&oStream, &stateEncode, runtimeTableEncode); + + if (DEBUG) { + printf("[DECODE] >>> EXI >>> [ENCODE] \n"); + } + + do { + if (errn < 0) { + if (DEBUG) { + printf("[Encode-ERROR] %d \n", errn); + } + return errn; + } + + errn = exiDecodeNextEvent(&iStream, &stateDecode, &event); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR] %d \n", errn); + } + return errn; + } + + switch (event) { + case START_DOCUMENT: + /* decode */ + errn = exiDecodeStartDocument(&iStream, &stateDecode); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-SD] %d \n", errn); + } + return errn; + } + if (DEBUG) { + printf(">> START_DOCUMENT \n"); + } + /* encode */ + errn = exiEncodeStartDocument(&oStream, &stateEncode); + break; + case END_DOCUMENT: + /* decode */ + errn = exiDecodeEndDocument(&iStream, &stateDecode); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-ED] %d \n", errn); + } + return errn; + } + if (DEBUG) { + printf(">> END_DOCUMENT \n"); + } + /* encode */ + errn = exiEncodeEndDocument(&oStream, &stateEncode); + /* signalize end of document */ + noEndOfDocument = 0; /* false */ + break; + case START_ELEMENT: + /* decode */ + errn = exiDecodeStartElement(&iStream, &stateDecode, &eqn); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-SE] %d \n", errn); + } + return errn; + } + if (DEBUG) { + exiGetLocalName(&(stateDecode.nameTablePrepopulated), &(stateDecode.nameTableRuntime), eqn.namespaceURI, eqn.localPart, &localName); + exiGetUri(&(stateDecode.nameTablePrepopulated), &(stateDecode.nameTableRuntime), eqn.namespaceURI, &namespaceURI); + printf(">> SE {%s}%s \n", namespaceURI, localName); + } + /* encode */ + errn = exiEncodeStartElement(&oStream, &stateEncode, &eqn); + break; + case START_ELEMENT_GENERIC: + /* decode */ + errn = exiDecodeStartElementGeneric(&iStream, &stateDecode, &qn); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-SEgen] %d \n", errn); + } + return errn; + } + if (DEBUG) { + printf(">> SE_Gen {%s}%s \n", stringNamespaceURI.chars, stringLocalName.chars); + } + /* encode */ + errn = exiEncodeStartElementGeneric(&oStream, &stateEncode, + &stringNamespaceURI, &stringLocalName); + break; + case END_ELEMENT: + /* decode */ + errn = exiDecodeEndElement(&iStream, &stateDecode, &eqn); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-EE] %d \n", errn); + } + return errn; + } + if (DEBUG) { + printf("<< EE \n"); + } + /* encode */ + errn = exiEncodeEndElement(&oStream, &stateEncode); + break; + case END_ELEMENT_UNDECLARED: + /* decode */ + errn = exiDecodeEndElementUndeclared(&iStream, &stateDecode, &eqn); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-EE-Undecl] %d \n", errn); + } + return errn; + } + if (DEBUG) { + printf("<< EEundecl \n"); + } + /* encode */ + errn = exiEncodeEndElement(&oStream, &stateEncode); + break; + case CHARACTERS: + /* decode */ + errn = exiDecodeCharacters(&iStream, &stateDecode, &val); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-CH] %d \n", errn); + } + return errn; + } + if (DEBUG) { + debugValue(&val); + } + /* encode */ + errn = exiEncodeCharacters(&oStream, &stateEncode, &val); + break; + case CHARACTERS_GENERIC: + /* decode */ + errn = exiDecodeCharactersGeneric(&iStream, &stateDecode, &val); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-CHgen] %d \n", errn); + } + return errn; + } + if (DEBUG) { + debugValue(&val); + } + /* encode */ + errn = exiEncodeCharacters(&oStream, &stateEncode, &val); + break; + case CHARACTERS_GENERIC_UNDECLARED: + /* decode */ + errn = exiDecodeCharactersGenericUndeclared(&iStream, &stateDecode, &val); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-CHgenUndecl] %d \n", errn); + } + return errn; + } + if (DEBUG) { + debugValue(&val); + } + /* encode */ + errn = exiEncodeCharacters(&oStream, &stateEncode, &val); + break; + case ATTRIBUTE: + /* decode */ + errn = exiDecodeAttribute(&iStream, &stateDecode, &eqn, &val); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-AT] %d \n", errn); + } + return errn; + } + if (DEBUG) { + exiGetLocalName(&(stateDecode.nameTablePrepopulated), &(stateDecode.nameTableRuntime), eqn.namespaceURI, eqn.localPart, &localName); + exiGetUri(&(stateDecode.nameTablePrepopulated), &(stateDecode.nameTableRuntime), eqn.namespaceURI, &namespaceURI); + printf(" AT {%s}%s \n", namespaceURI, localName); + debugValue(&val); + } + /* encode */ + errn = exiEncodeAttribute(&oStream, &stateEncode, &eqn, &val); + break; + case ATTRIBUTE_XSI_NIL: + /* decode */ + errn = exiDecodeAttributeXsiNil(&iStream, &stateDecode, &val); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-AT-NIL] %d \n", errn); + } + return errn; + } + if (DEBUG) { + printf(" AT {xsi}nil == %i \n", val.boolean); + } + /* encode */ + errn = exiEncodeAttributeXsiNil(&oStream, &stateEncode, &val); + break; + case ATTRIBUTE_XSI_TYPE: + /* decode */ + errn = exiDecodeAttributeXsiType(&iStream, &stateDecode, &val); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-AT-TYPE] %d \n", errn); + } + return errn; + } + if (DEBUG) { + exiGetLocalName(&(stateDecode.nameTablePrepopulated), &(stateDecode.nameTableRuntime), val.eqname.namespaceURI, val.eqname.localPart, &localName); + exiGetUri(&(stateDecode.nameTablePrepopulated), &(stateDecode.nameTableRuntime), val.eqname.namespaceURI, &namespaceURI); + printf(" AT {type}type == {%s}%s \n", namespaceURI, localName); + } + /* encode */ + errn = exiEncodeAttributeXsiType(&oStream, &stateEncode, &val); + break; + case ATTRIBUTE_GENERIC_UNDECLARED: + /* decode */ + errn = exiDecodeAttributeGenericUndeclared(&iStream, &stateDecode, &qn, &val); + if (errn < 0) { + if (DEBUG) { + printf("[Decode-ERROR-ATgenUnd] %d \n", errn); + } + return errn; + } + if (DEBUG) { + /* exiGetLocalName(&(stateDecode.nameTablePrepopulated), &(stateDecode.nameTableRuntime), eqn.namespaceURI, eqn.localPart, &localName); + exiGetUri(&(stateDecode.nameTablePrepopulated), &(stateDecode.nameTableRuntime), eqn.namespaceURI, &namespaceURI); */ + printf(" AT {%s}%s \n", qn.namespaceURI.chars, qn.localName.chars); + debugValue(&val); + } + /* encode */ + errn = exiEncodeAttribute(&oStream, &stateEncode, &eqn, &val); + break; + default: + /* ERROR */ + if (DEBUG) { + printf("[Unknown-Event] %d \n", event); + } + return EXI_ERROR_UNKOWN_EVENT; + } + + } while (noEndOfDocument); + +#if EXI_STREAM == BYTE_ARRAY + /* write to file */ + writeBytesToFile(oStream.data, posEncode, argv[2]); +#endif +#if EXI_STREAM == FILE_STREAM + fclose(iStream.file); + fclose(oStream.file); +#endif + + return 0; +} + +static int _setInt32Value(integer_t* iv, int32_t* int32) { + int errn = 0; + switch(iv->type) { + /* Unsigned Integer */ + case UNSIGNED_INTEGER_8: + *int32 = iv->val.uint8; + break; + case UNSIGNED_INTEGER_16: + *int32 = iv->val.uint16; + break; + case UNSIGNED_INTEGER_32: + if (iv->val.uint32 <= 2147483647) { + *int32 = iv->val.uint32; + } else { + errn = EXI_UNSUPPORTED_INTEGER_VALUE; + } + break; + case UNSIGNED_INTEGER_64: + errn = EXI_UNSUPPORTED_INTEGER_VALUE; + break; + /* (Signed) Integer */ + case INTEGER_8: + *int32 = iv->val.int8; + break; + case INTEGER_16: + *int32 = iv->val.int16; + break; + case INTEGER_32: + *int32 = iv->val.int32; + break; + case INTEGER_64: + errn = EXI_UNSUPPORTED_INTEGER_VALUE; + } + return errn; +} + + +void debugValue(exi_value_t* val) { + int i; + switch(val->type) { + case INTEGER: + switch(val->integer.type) { + /* Unsigned Integer */ + case UNSIGNED_INTEGER_8: + printf(" Value uint8 : %d \n", val->integer.val.uint8); + break; + case UNSIGNED_INTEGER_16: + printf(" Value uint16 : %d \n", val->integer.val.uint16); + break; + case UNSIGNED_INTEGER_32: + printf(" Value uint32 : %d \n", val->integer.val.uint32); + break; + case UNSIGNED_INTEGER_64: + printf(" Value uint64 : %ld \n", (long unsigned int) val->integer.val.uint64); + break; + /* (Signed) Integer */ + case INTEGER_8: + printf(" Value int8 : %d \n", val->integer.val.int8); + break; + case INTEGER_16: + printf(" Value int16 : %d \n", val->integer.val.int16); + break; + case INTEGER_32: + printf(" Value int32 : %d \n", val->integer.val.int32); + break; + case INTEGER_64: + printf(" Value int64 : %ld \n", (long int) val->integer.val.int64); + break; + } + break; + case BINARY_BASE64: + case BINARY_HEX: + printf(" Value Binary (len == %d) : ", val->binary.len); + for (i = 0; i < val->binary.len; i++) { + printf(" [%d]", val->binary.data[i]); + } + printf("\n"); + break; + case BOOLEAN: + printf(" Value Boolean : %d \n", val->boolean); + break; + case STRING: + printf(" Value String (len==%d) : '", val->string.len); + for (i = 0; i < val->string.len; i++) { + printf("%c", (char) val->string.codepoints[i]); + } + printf("'\n"); + break; + default: + printf(" Value ?? \n"); + } +} + diff --git a/src/test/pev_service.c b/src/test/pev_service.c index 9c3d41b..2056872 100644 --- a/src/test/pev_service.c +++ b/src/test/pev_service.c @@ -34,7 +34,6 @@ #include "appHand_dataTypes.h" - /* includes V2GTP */ #include "v2gtp.h" @@ -699,6 +698,7 @@ static int dc_charging() *******************************************/ serviceDiscovery.isused.ServiceCategory=1; + /* we are only interested in charging */ serviceDiscovery.ServiceCategory = EVCharging_serviceCategoryType; serviceDiscovery.isused.ServiceScope=0; @@ -1205,11 +1205,6 @@ static int dc_charging() printf("\t EVSEMaximumPowerLimit=%d\n",resultCurrentDemand.EVSEMaximumPowerLimit.Value); } - - - - - /*********************************** * Setup data for weldingDetection * ***********************************/ @@ -1323,7 +1318,7 @@ int main_service() getchar(); printf("+++ Start V2G client / service example for AC charging +++\n\n"); - ac_charging(); + ac_charging(); printf("\n+++Terminate V2G Client / Service example for AC charging +++\n"); printf("Please press enter for DC charging!\n"); diff --git a/src/test/serviceClientDataTransmitter.h b/src/test/serviceClientDataTransmitter.h new file mode 100644 index 0000000..36142d5 --- /dev/null +++ b/src/test/serviceClientDataTransmitter.h @@ -0,0 +1,43 @@ + +/* + * 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.6 + * @contact Joerg.Heuer@siemens.com + * + ********************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef SERVICECLIENTDATATRANSMITTER_H_ +#define SERVICECLIENTDATATRANSMITTER_H_ + +#include +/* + * This method sends EXI stream (outStream) to the EVSE and receives a response stream (inStream)*/ +int serviceDataTransmitter(uint8_t* outStream, uint16_t outStreamLength, uint8_t* inStream); + +#endif /* V2G_SERVICECLIENTDATATRANSMITTER_H_ */ + +#ifdef __cplusplus +} +#endif