This commit is contained in:
sebastiankb 2011-04-15 12:13:20 +00:00
parent 29f61c8ee4
commit 326e0b8b1d
55 changed files with 5439 additions and 8989 deletions

View file

@ -555,7 +555,6 @@
</profile> </profile>
</scannerConfigBuildInfo> </scannerConfigBuildInfo>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration> </cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450"> <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450" moduleId="org.eclipse.cdt.core.settings" name="Release"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450" moduleId="org.eclipse.cdt.core.settings" name="Release">
@ -572,7 +571,7 @@
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.base.506532925" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.base" superClass="cdt.managedbuild.toolchain.gnu.base"> <toolChain id="cdt.managedbuild.toolchain.gnu.base.506532925" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.base" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.784544317" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.784544317" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/OpenV2G/Release}" cleanBuildTarget="clean" id="org.eclipse.cdt.build.core.internal.builder.332458815" incrementalBuildTarget="all" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/> <builder autoBuildTarget="all" buildPath="${workspace_loc:/OpenV2G/Release}" cleanBuildTarget="clean" id="org.eclipse.cdt.build.core.internal.builder.755395484" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.501212056" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> <tool id="cdt.managedbuild.tool.gnu.archiver.base.501212056" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.605628336" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"> <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.605628336" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
<option id="gnu.cpp.compiler.option.optimization.level.937286096" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> <option id="gnu.cpp.compiler.option.optimization.level.937286096" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
@ -1105,7 +1104,6 @@
</profile> </profile>
</scannerConfigBuildInfo> </scannerConfigBuildInfo>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration> </cconfiguration>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">

View file

@ -17,10 +17,6 @@
<key>org.eclipse.cdt.make.core.append_environment</key> <key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value> <value>true</value>
</dictionary> </dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key> <key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value> <value></value>
@ -31,11 +27,7 @@
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key> <key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/OpenV2G/Release}</value> <value>${workspace_loc:/OpenV2G/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.contents</key> <key>org.eclipse.cdt.make.core.contents</key>
@ -53,10 +45,6 @@
<key>org.eclipse.cdt.make.core.enableFullBuild</key> <key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value> <value>true</value>
</dictionary> </dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key> <key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value> <value>true</value>

View file

@ -1,13 +1,13 @@
------------------------------------------------------------------------- -------------------------------------------------------------------------
OpenV2G - an open source project implementing the basic functionality of the ISO IEC 15118 vehicle to grid (V2G) communication interface OpenV2G - an open source project implementing the basic functionality of the ISO IEC 15118 vehicle to grid (V2G) communication interface
Version 0.4, released April 14, 2011 Version 0.3, released October 27, 2010
http://openv2g.sourceforge.net/ http://openv2g.sourceforge.net/
Please report bugs via the SourceForge bug tracking system at http://sourceforge.net/tracker/?group_id=350113. Please report bugs via the SourceForge bug tracking system at http://sourceforge.net/tracker/?group_id=350113.
Thank you. Thank you.
Copyright (C) 2007-2011 Siemens AG Copyright (C) 2007-2010 Siemens AG
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU Lesser General Public License as published
@ -22,25 +22,6 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------
CHANGES from version 0.3.1:
-------------------------------------------------------------------------
* adaption of V2G schema changes
* supporting of DC messages
* example program showing the message sequence of AC charging and
DC charging
* bug-fixes
-------------------------------------------------------------------------
CHANGES from version 0.3:
-------------------------------------------------------------------------
* Bug-fixes
* reduced memory usage
* some type changes in the EXI codec and V2G service:
** struct v2gService->struct EXIService in v2g_service.h
** size_t->uint16_t in v2g_serviceClientDataTransmitter.h and doIP.h
* renaming of some enumeration values in v2g_serviceDataTypes.h
------------------------------------------------------------------------- -------------------------------------------------------------------------
CHANGES from version 0.2.2: CHANGES from version 0.2.2:
------------------------------------------------------------------------- -------------------------------------------------------------------------

View file

@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ns0:V2G_Message xmlns:ns0="urn:iso:15118:2:2010:eval1.0:MsgDef" xmlns:ns1="urn:iso:15118:2:2010:eval1.0:MsgBody" <ns3:V2G_Message xmlns:ns1="urn:iso:15118:2:2010:MsgBody"
xmlns:ns2="urn:iso:15118:2:2010:eval1.0:MsgDataTypes" xmlns:ns2="urn:iso:15118:2:2010:MsgDataTypes"
xmlns:ns3="urn:iso:15118:2:2010:eval1.0:MsgHeader" xmlns:ns3="urn:iso:15118:2:2010:MsgDef"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:iso:15118:2:2010:eval1.0:MsgDef V2G_CI_MsgDef.xsd"> xsi:schemaLocation="urn:iso:15118:2:2010:MsgDef V2G_CI_MsgDef.xsd">
<ns0:Header> <ns3:Header>
<ns3:SessionInformation> <ns3:SessionInformation>
<ns2:SessionID>3031323334353637</ns2:SessionID> <ns2:SessionID>3031323334353637</ns2:SessionID>
<ns2:ProtocolVersion>1</ns2:ProtocolVersion> <ns2:ProtocolVersion>1</ns2:ProtocolVersion>
</ns3:SessionInformation> </ns3:SessionInformation>
</ns0:Header> </ns3:Header>
<ns0:Body> <ns3:Body>
<ns1:SessionSetupReq> <ns1:SessionSetupReq>
<ns1:PEVStatus> <ns1:PEVStatus>
<ns2:ConnectorLocked>0</ns2:ConnectorLocked> <ns2:ConnectorLocked>0</ns2:ConnectorLocked>
<ns2:ChargerStandby>1</ns2:ChargerStandby> <ns2:ChargerStandby>1</ns2:ChargerStandby>
<ns2:ReadyToCharge>false</ns2:ReadyToCharge>
</ns1:PEVStatus> </ns1:PEVStatus>
</ns1:SessionSetupReq> </ns1:SessionSetupReq>
</ns0:Body> </ns3:Body>
</ns0:V2G_Message> </ns3:V2G_Message>

Binary file not shown.

View file

@ -1,32 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ns0:V2G_Message xmlns:ns0="urn:iso:15118:2:2010:eval1.0:MsgDef" <v2gci_d:V2G_Message xmlns:v2gci_d="urn:iso:15118:2:2010:MsgDef"
xmlns:ns1="urn:iso:15118:2:2010:eval1.0:MsgBody" xmlns:v2gci_t="urn:iso:15118:2:2010:MsgDataTypes"
xmlns:ns2="urn:iso:15118:2:2010:eval1.0:MsgDataTypes" xmlns:ns0="urn:iso:15118:2:2010:MsgBody"
xmlns:ns3="urn:iso:15118:2:2010:eval1.0:MsgHeader" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:15118:2:2010:MsgDef V2G_CI_MsgDef.xsd">
xsi:schemaLocation="urn:iso:15118:2:2010:eval1.0:MsgDef V2G_CI_MsgDef.xsd"> <v2gci_d:Header>
<ns0:Header> <v2gci_d:SessionInformation>
<ns3:SessionInformation> <v2gci_t:SessionID>0Fb80Fb80Fb80Fb8</v2gci_t:SessionID>
<ns2:SessionID>0Fb80Fb80Fb80Fb8</ns2:SessionID> <v2gci_t:ProtocolVersion>1</v2gci_t:ProtocolVersion>
<ns2:ProtocolVersion>1</ns2:ProtocolVersion> </v2gci_d:SessionInformation>
</ns3:SessionInformation> </v2gci_d:Header>
</ns0:Header> <v2gci_d:Body>
<ns0:Body> <ns0:SessionSetupRes>
<ns1:SessionSetupRes> <ns0:ResponseCode>OK_SessionSetup</ns0:ResponseCode>
<ns1:ResponseCode>OK_SessionSetup</ns1:ResponseCode> <ns0:EVSEID>54</ns0:EVSEID>
<ns1:EVSEID>54</ns1:EVSEID> <ns0:EVSEStatus>
<ns1:EVSEStatus> <v2gci_t:FatalError>0</v2gci_t:FatalError>
<ns2:FatalError>0</ns2:FatalError> <v2gci_t:EVSEStandby>1</v2gci_t:EVSEStandby>
<ns2:EVSEStandby>1</ns2:EVSEStandby> <v2gci_t:ConnectorLocked>1</v2gci_t:ConnectorLocked>
<ns2:ConnectorLocked>1</ns2:ConnectorLocked> <v2gci_t:PowerSwitchClosed>0</v2gci_t:PowerSwitchClosed>
<ns2:PowerSwitchClosed>0</ns2:PowerSwitchClosed> <v2gci_t:RCD>1</v2gci_t:RCD>
<ns2:RCD>1</ns2:RCD> <v2gci_t:ShutDownTime>123456789</v2gci_t:ShutDownTime>
<ns2:ShutDownTime>123456789</ns2:ShutDownTime> </ns0:EVSEStatus>
<ns2:ChargerStandby>1</ns2:ChargerStandby> <ns0:TCurrent>123456789</ns0:TCurrent>
<ns2:EVSEMalfunction>false</ns2:EVSEMalfunction> </ns0:SessionSetupRes>
<ns2:StopCharging>true</ns2:StopCharging> </v2gci_d:Body>
</ns1:EVSEStatus> </v2gci_d:V2G_Message>
<ns1:TCurrent>123456789</ns1:TCurrent>
</ns1:SessionSetupRes>
</ns0:Body>
</ns0:V2G_Message>

View file

@ -1 +1 @@
<EFBFBD>Ø@}À}À}À}ÂTjVk¼ê)Y®ó  <EFBFBD>˜@}À}À}À}Âc<>TjVk¼é+5Þt

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
* Bit decoding functionalities * Bit decoding functionalities
@ -38,59 +38,36 @@
#ifndef BIT_DECODER_CHANNEL_C #ifndef BIT_DECODER_CHANNEL_C
#define BIT_DECODER_CHANNEL_C #define BIT_DECODER_CHANNEL_C
/* only the least significant 8 bits are filled properly */ int decode(bitstream_t* stream, uint8_t* b) {
int _decode(bitstream_t* stream, uint32_t* b) {
return readBits(stream, 8, b); return readBits(stream, 8, b);
} }
int decodeBoolean(bitstream_t* stream, int* b) { int decodeBoolean(bitstream_t* stream, int* b) {
uint32_t ub; uint8_t ub;
int errn = readBits(stream, 1, &ub); int errn = readBits(stream, 1, &ub);
*b = (ub == 0) ? 0 : 1; *b = (ub == 0) ? 0 : 1;
return errn; return errn;
} }
int decodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t* uint32) { int decodeNBitUnsignedInteger(bitstream_t* stream, size_t nbits, uint8_t* uint8) {
if (nbits == 0) { if (nbits == 0) {
*uint32 = 0; *uint8 = 0;
return 0; return 0;
} else { } else {
return readBits(stream, nbits, uint32); return readBits(stream, nbits, uint8);
} }
} }
int decodeUnsignedInteger16(bitstream_t* stream, uint16_t* uint16) {
unsigned int mShift = 0;
int errn = 0;
uint32_t b;
*uint16 = 0;
do {
/* 1. Read the next octet */
errn = _decode(stream, &b);
/* 2. Multiply the value of the unsigned number represented by the 7
* least significant
* bits of the octet by the current multiplier and add the result to
* the current value */
*uint16 += (b & 127) << mShift;
/* 3. Multiply the multiplier by 128 */
mShift += 7;
/* 4. If the most significant bit of the octet was 1, go back to step 1 */
} while (errn >= 0 && (b >> 7) == 1);
return errn;
}
int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32) { int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32) {
/* 0XXXXXXX ... 1XXXXXXX 1XXXXXXX */ /* 0XXXXXXX ... 1XXXXXXX 1XXXXXXX */
unsigned int mShift = 0; unsigned int mShift = 0;
int errn = 0; int errn = 0;
uint32_t b; uint8_t b;
*uint32 = 0; *uint32 = 0;
do { do {
/* 1. Read the next octet */ /* 1. Read the next octet */
errn = _decode(stream, &b); errn = decode(stream, &b);
/* 2. Multiply the value of the unsigned number represented by the 7 /* 2. Multiply the value of the unsigned number represented by the 7
* least significant * least significant
* bits of the octet by the current multiplier and add the result to * bits of the octet by the current multiplier and add the result to
@ -113,11 +90,11 @@ int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32) {
int decodeUnsignedInteger64(bitstream_t* stream, uint64_t* uint64) { int decodeUnsignedInteger64(bitstream_t* stream, uint64_t* uint64) {
unsigned int mShift = 0; unsigned int mShift = 0;
int errn = 0; int errn = 0;
uint32_t b; uint8_t b;
*uint64 = 0L; *uint64 = 0L;
do { do {
errn = _decode(stream, &b); errn = decode(stream, &b);
*uint64 += ((uint64_t) (b & 127)) << mShift; *uint64 += ((uint64_t) (b & 127)) << mShift;
mShift += 7; mShift += 7;
} while (errn >= 0 && (b >> 7) == 1); } while (errn >= 0 && (b >> 7) == 1);
@ -200,7 +177,7 @@ int decodeFloat(bitstream_t* stream, float_me_t* f) {
/** /**
* Decode a sequence of characters for a given length. * Decode a sequence of characters for a given length.
*/ */
int decodeStringOnly(bitstream_t* stream, uint16_t len, string_ucs_t* s) { int decodeStringOnly(bitstream_t* stream, size_t len, string_ucs_t* s) {
decodeCharacters(stream, len, s->codepoints); decodeCharacters(stream, len, s->codepoints);
s->len = len; s->len = len;
return 0; return 0;
@ -210,7 +187,7 @@ int decodeStringOnly(bitstream_t* stream, uint16_t len, string_ucs_t* s) {
* Decode a length prefixed sequence of characters. * Decode a length prefixed sequence of characters.
*/ */
int decodeString(bitstream_t* stream, string_ucs_t* s) { int decodeString(bitstream_t* stream, string_ucs_t* s) {
int errn = decodeUnsignedInteger16(stream, &s->len); int errn = decodeUnsignedInteger32(stream, &s->len);
if (errn < 0) { if (errn < 0) {
return errn; return errn;
} }
@ -218,7 +195,7 @@ int decodeString(bitstream_t* stream, string_ucs_t* s) {
} }
int decodeStringValue(bitstream_t* stream, string_ucs_t* s) { int decodeStringValue(bitstream_t* stream, string_ucs_t* s) {
int errn = decodeUnsignedInteger16(stream, &s->len); int errn = decodeUnsignedInteger32(stream, &s->len);
if (errn < 0) { if (errn < 0) {
return errn; return errn;
} }
@ -249,14 +226,11 @@ int decodeStringValue(bitstream_t* stream, string_ucs_t* s) {
* Each character is represented by its UCS [ISO/IEC 10646] * Each character is represented by its UCS [ISO/IEC 10646]
* code point encoded as an Unsigned Integer * code point encoded as an Unsigned Integer
*/ */
int decodeCharacters(bitstream_t* stream, uint16_t len, uint32_t* chars) { int decodeCharacters(bitstream_t* stream, size_t len, uint32_t* chars) {
unsigned int i; unsigned int i;
int errn = 0; int errn = 0;
for (i = 0; i < len && errn >= 0; i++) { for (i = 0; i < len && errn >= 0; i++) {
errn = decodeUnsignedInteger32(stream, &chars[i]); errn = decodeUnsignedInteger32(stream, &chars[i]);
if (errn < 0) {
return errn;
}
} }
return errn; return errn;
@ -267,18 +241,13 @@ int decodeCharacters(bitstream_t* stream, uint16_t len, uint32_t* chars) {
*/ */
int decodeBinary(bitstream_t* stream, bytes_t* bytes) { int decodeBinary(bitstream_t* stream, bytes_t* bytes) {
unsigned int i; unsigned int i;
uint32_t b; int errn = decodeUnsignedInteger32(stream, &bytes->len);
int errn = decodeUnsignedInteger16(stream, &bytes->len);
if (errn < 0) { if (errn < 0) {
return errn; return errn;
} }
for (i = 0; i < bytes->len && errn >= 0; i++) { for (i = 0; i < bytes->len && errn >= 0; i++) {
errn = _decode(stream, &b); errn = decode(stream, &bytes->data[i]);
if (errn < 0) {
return errn;
}
bytes->data[i] = (uint8_t)b;
} }
return errn; return errn;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -41,15 +41,7 @@ int decodeBoolean(bitstream_t* stream, int* b);
/** /**
* Decodes and returns an n-bit unsigned integer. * Decodes and returns an n-bit unsigned integer.
*/ */
int decodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t* uint32); int decodeNBitUnsignedInteger(bitstream_t* stream, size_t nbits, uint8_t* uint8);
/**
* Decode an arbitrary precision non negative integer using a sequence of
* octets. The most significant bit of the last octet is set to zero to
* indicate sequence termination. Only seven bits per octet are used to
* store the integer's value.
*/
int decodeUnsignedInteger16(bitstream_t* stream, uint16_t* uint16);
/** /**
* Decode an arbitrary precision non negative integer using a sequence of * Decode an arbitrary precision non negative integer using a sequence of
@ -91,12 +83,6 @@ int decodeInteger64(bitstream_t* stream, int64_t* int64);
*/ */
int decodeFloat(bitstream_t* stream, float_me_t* f); int decodeFloat(bitstream_t* stream, float_me_t* f);
/**
* Decode a sequence of characters for a given length.
*/
int decodeStringOnly(bitstream_t* stream, uint16_t len, string_ucs_t* s);
/** /**
* Decode a length prefixed sequence of characters. * Decode a length prefixed sequence of characters.
*/ */
@ -114,7 +100,7 @@ int decodeStringValue(bitstream_t* stream, string_ucs_t* s);
/** /**
* Decode a sequence of characters according to a given length. * Decode a sequence of characters according to a given length.
*/ */
int decodeCharacters(bitstream_t* stream, uint16_t len, uint32_t* chars); int decodeCharacters(bitstream_t* stream, size_t len, uint32_t* chars);
/** /**
* Decode a binary value as a length-prefixed sequence of octets. * Decode a binary value as a length-prefixed sequence of octets.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -86,7 +86,7 @@ int encodeBoolean(bitstream_t* stream, int b) {
* Encode n-bit unsigned integer. The n least significant bits of parameter * Encode n-bit unsigned integer. The n least significant bits of parameter
* b starting with the most significant, i.e. from left to right. * b starting with the most significant, i.e. from left to right.
*/ */
int encodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t val) { int encodeNBitUnsignedInteger(bitstream_t* stream, size_t nbits, uint8_t val) {
return writeBits(stream, nbits, val); return writeBits(stream, nbits, val);
} }
@ -252,7 +252,7 @@ int encodeStringValue(bitstream_t* stream, string_ucs_t* string) {
* Each character is represented by its UCS [ISO/IEC 10646] * Each character is represented by its UCS [ISO/IEC 10646]
* code point encoded as an Unsigned Integer * code point encoded as an Unsigned Integer
*/ */
int encodeCharacters(bitstream_t* stream, uint32_t* chars, uint16_t len) { int encodeCharacters(bitstream_t* stream, uint32_t* chars, size_t len) {
unsigned int i; unsigned int i;
int errn = 0; int errn = 0;
for(i=0; i<len && errn>=0; i++) { for(i=0; i<len && errn>=0; i++) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -45,7 +45,7 @@ int encodeBoolean(bitstream_t* stream, int b);
* Encode n-bit unsigned integer. The n least significant bits of parameter * Encode n-bit unsigned integer. The n least significant bits of parameter
* b starting with the most significant, i.e. from left to right. * b starting with the most significant, i.e. from left to right.
*/ */
int encodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t val); int encodeNBitUnsignedInteger(bitstream_t* stream, size_t nbits, uint8_t val);
/** /**
@ -104,7 +104,7 @@ int encodeStringValue(bitstream_t* stream, string_ucs_t* string);
* Each character is represented by its UCS [ISO/IEC 10646] * Each character is represented by its UCS [ISO/IEC 10646]
* code point encoded as an Unsigned Integer * code point encoded as an Unsigned Integer
*/ */
int encodeCharacters(bitstream_t* stream, uint32_t* chars, uint16_t len); int encodeCharacters(bitstream_t* stream, uint32_t* chars, size_t len);
/** /**
* Encode a binary value as a length-prefixed sequence of octets. * Encode a binary value as a length-prefixed sequence of octets.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -49,7 +49,7 @@ int readBuffer(bitstream_t* stream)
return errn; return errn;
} }
int readBits(bitstream_t* stream, uint16_t num_bits, uint32_t* b) int readBits(bitstream_t* stream, size_t num_bits, uint8_t* b)
{ {
int errn = readBuffer(stream); int errn = readBuffer(stream);
if (errn < 0) { if (errn < 0) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -32,7 +32,7 @@ extern "C" {
#ifndef BIT_INPUT_STREAM_H #ifndef BIT_INPUT_STREAM_H
#define BIT_INPUT_STREAM_H #define BIT_INPUT_STREAM_H
int readBits(bitstream_t* stream, uint16_t num_bits, uint32_t* b); int readBits(bitstream_t* stream, size_t num_bits, uint8_t* b);
int flush(); int flush();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -32,7 +32,7 @@
#define BIT_OUTPUT_STREAM_C #define BIT_OUTPUT_STREAM_C
/* NOTE: nbits <= 8 */ /* NOTE: nbits <= 8 */
int writeBits(bitstream_t* stream, uint16_t nbits, uint32_t val) { int writeBits(bitstream_t* stream, size_t nbits, uint8_t val) {
/* is there enough space in the buffer */ /* is there enough space in the buffer */
if (nbits <= stream->capacity) { if (nbits <= stream->capacity) {
/* all bits fit into the current buffer */ /* all bits fit into the current buffer */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -34,7 +34,7 @@ extern "C" {
#ifndef BIT_OUTPUT_STREAM_H #ifndef BIT_OUTPUT_STREAM_H
#define BIT_OUTPUT_STREAM_H #define BIT_OUTPUT_STREAM_H
int writeBits(bitstream_t* stream, uint16_t nbits, uint32_t bits); int writeBits(bitstream_t* stream, size_t nbits, uint8_t bits);
/* flush output */ /* flush output */
int flush(bitstream_t* stream); int flush(bitstream_t* stream);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -36,7 +36,7 @@
#ifndef BYTE_STREAM_C #ifndef BYTE_STREAM_C
#define BYTE_STREAM_C #define BYTE_STREAM_C
int readBytesFromFile(const char * filename, uint8_t* data, uint16_t size, uint16_t pos) { int readBytesFromFile(const char * filename, uint8_t* data, size_t size, size_t pos) {
FILE* f; FILE* f;
int character; int character;
@ -60,8 +60,8 @@ int readBytesFromFile(const char * filename, uint8_t* data, uint16_t size, uint1
return pos; return pos;
} }
int writeBytesToFile(uint8_t* data, uint16_t len, const char * filename) { int writeBytesToFile(uint8_t* data, size_t len, const char * filename) {
uint16_t rlen; size_t rlen;
FILE* f = fopen(filename, "wb+"); FILE* f = fopen(filename, "wb+");
if (f == NULL) { if (f == NULL) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -34,9 +34,9 @@ extern "C" {
#ifndef BYTE_STREAM_H #ifndef BYTE_STREAM_H
#define BYTE_STREAM_H #define BYTE_STREAM_H
int writeBytesToFile(uint8_t* data, uint16_t len, const char * filename); int writeBytesToFile(uint8_t* data, size_t len, const char * filename);
int readBytesFromFile(const char * filename, uint8_t* data, uint16_t size, uint16_t pos); int readBytesFromFile(const char * filename, uint8_t* data, size_t size, size_t pos);
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -39,13 +39,13 @@
#include "EXICoder.h" #include "EXICoder.h"
/* /*
uint16_t exiGetCurrentState(struct exiState* state) { size_t exiGetCurrentState(struct exiState* state) {
return state->grammarStates[state->currentStack]; return state->grammarStates[state->currentStack];
// return 0; // return 0;
} }
*/ */
int exiPushStack(exi_state_t* state, uint16_t newState, eqname_t* eqn) { int exiPushStack(exi_state_t* state, size_t newState, eqname_t* eqn) {
if ((state->stackIndex + 1) < EXI_ELEMENT_STACK_SIZE) { if ((state->stackIndex + 1) < EXI_ELEMENT_STACK_SIZE) {
state->grammarStack[++state->stackIndex] = newState; state->grammarStack[++state->stackIndex] = newState;
/* copy qname */ /* copy qname */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -37,9 +37,9 @@ extern "C" {
#include "EXITypes.h" #include "EXITypes.h"
/* uint16_t exiGetCurrentState(struct exiState* state); */ /* size_t exiGetCurrentState(struct exiState* state); */
int exiPushStack(exi_state_t* state, uint16_t newState, eqname_t* eqn); int exiPushStack(exi_state_t* state, size_t newState, eqname_t* eqn);
int exiPopStack(exi_state_t* state); int exiPopStack(exi_state_t* state);

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -44,9 +44,6 @@ int exiDecodeEndDocument(bitstream_t* stream, exi_state_t* state);
int exiDecodeStartElement(bitstream_t* stream, exi_state_t* state, int exiDecodeStartElement(bitstream_t* stream, exi_state_t* state,
eqname_t* se); eqname_t* se);
int exiDecodeStartElementGeneric(bitstream_t* stream, exi_state_t* state,
eqname_t* se);
int exiDecodeEndElement(bitstream_t* stream, exi_state_t* state, int exiDecodeEndElement(bitstream_t* stream, exi_state_t* state,
eqname_t* ee); eqname_t* ee);

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -34,7 +34,7 @@
#define EXI_HEADER_DECODER_C #define EXI_HEADER_DECODER_C
int readEXIHeader(bitstream_t* stream) { int readEXIHeader(bitstream_t* stream) {
uint32_t header = 0; uint8_t header;
int errn = readBits(stream, 8, &header); int errn = readBits(stream, 8, &header);
if (errn < 0) { if (errn < 0) {
return errn; return errn;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -35,8 +35,6 @@ extern "C" {
#define BITS_IN_BYTE 8 #define BITS_IN_BYTE 8
#define UINT_MAX_VALUE 65535
#define EXI_ELEMENT_STACK_SIZE 16 #define EXI_ELEMENT_STACK_SIZE 16
/* EXI automaton methods prefixes such as "inline" etc. */ /* EXI automaton methods prefixes such as "inline" etc. */
@ -51,29 +49,29 @@ extern "C" {
typedef struct { typedef struct {
/* Integer Array */ /* Integer Array */
uint16_t size; /* array size */ size_t size; /* array size */
uint8_t* data; /* int data array */ uint8_t* data; /* int data array */
uint16_t* pos; /* next position in array */ size_t* pos; /* next position in array */
/* Current byte buffer & its remaining bit capacity */ /* Current byte buffer & its remaining bit capacity */
uint8_t buffer; uint8_t buffer;
uint16_t capacity; size_t capacity;
} bitstream_t; } bitstream_t;
typedef struct { typedef struct {
/* Bytes Size and array container */ /* Bytes Size and array container */
uint16_t size; size_t size;
uint8_t* data; uint8_t* data;
/* current length (len <= size) */ /* current length (len <= size) */
uint16_t len; size_t len;
} bytes_t; } bytes_t;
/* Universal Character Set (UCS) strings */ /* Universal Character Set (UCS) strings */
typedef struct { typedef struct {
/* UCS size and UCS character container*/ /* UCS size and UCS character container*/
uint16_t size; size_t size;
uint32_t* codepoints; uint32_t* codepoints;
/* current length == number of code-points, (len <= size) */ /* current length == number of code-points, (len <= size) */
uint16_t len; size_t len;
} string_ucs_t; } string_ucs_t;
typedef struct { typedef struct {
@ -129,27 +127,27 @@ typedef enum
/* TODO list support */ /* TODO list support */
typedef struct { typedef struct {
/* List container with memory size */ /* List container with memory size */
uint16_t size; size_t size;
uint8_t* data; uint8_t* data;
/* list item type */ /* list item type */
exi_datatype_t type; exi_datatype_t type;
/* number of items */ /* number of items */
uint16_t len; size_t len;
} list_t; } list_t;
typedef struct { typedef struct {
uint16_t namespaceURI; unsigned int namespaceURI;
uint16_t localPart; unsigned int localPart;
} eqname_t; } eqname_t;
typedef struct { typedef struct {
/* stack of grammar states and elements */ /* stack of grammar states and elements */
uint16_t grammarStack [EXI_ELEMENT_STACK_SIZE]; size_t grammarStack [EXI_ELEMENT_STACK_SIZE];
eqname_t elementStack [EXI_ELEMENT_STACK_SIZE]; eqname_t elementStack [EXI_ELEMENT_STACK_SIZE];
uint16_t stackIndex; size_t stackIndex;
/* event-code */ /* event-code */
uint32_t eventCode; uint8_t eventCode;
} exi_state_t; } exi_state_t;
@ -159,16 +157,16 @@ typedef struct {
/* base types */ /* base types */
int boolean; int boolean;
int8_t int8;
uint8_t uint8;
uint32_t uint32; uint32_t uint32;
uint64_t uint64;
int32_t int32; int32_t int32;
int64_t int64; int64_t int64;
uint32_t enumeration; uint8_t enumeration;
/* Bytes, Strings and Lists are not native types anymore */ /* Bytes, Strings and Lists are not native types anymore */
bytes_t binary; bytes_t binary;
string_ucs_t string; string_ucs_t string;
float_me_t float_me;
list_t list; list_t list;
} exi_value_t; } exi_value_t;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -32,12 +32,15 @@
#include <stdlib.h> #include <stdlib.h>
#include "StringTable.h" #include "StringTable.h"
#include "EXITypes.h"
#include "BitInputStream.h"
#include "BitDecoderChannel.h"
#include "StringTableEntries.h" #include "StringTableEntries.h"
#include "assert.h" #include "assert.h"
int exiGetUri(uint16_t uriID, const char** uri) { int exiGetUri(size_t uriID, const char** uri) {
if ( uriID < stringTable.len ) { if ( uriID < stringTable.len ) {
*uri = stringTable.uris[uriID]; *uri = stringTable.uris[uriID];
} else { } else {
@ -47,13 +50,13 @@ int exiGetUri(uint16_t uriID, const char** uri) {
return 0; return 0;
} }
int exiGetUriLength(uint16_t* uriLength) { int exiGetUriLength(size_t* uriLength) {
*uriLength = stringTable.len; *uriLength = stringTable.len;
return 0; return 0;
} }
int exiGetUriID(const char* uri, uint16_t* uriID) { int exiGetUriID(const char* uri, size_t* uriID) {
unsigned int i; unsigned int i;
for(i=0; i<stringTable.len; i++) { for(i=0; i<stringTable.len; i++) {
if ( strcmp ( uri, stringTable.uris[i] ) == 0 ) { if ( strcmp ( uri, stringTable.uris[i] ) == 0 ) {
@ -65,7 +68,7 @@ int exiGetUriID(const char* uri, uint16_t* uriID) {
} }
int exiGetLocalName(uint16_t uriID, uint16_t localNameID, const char** localName) { int exiGetLocalName(size_t uriID, size_t localNameID, const char** localName) {
if ( uriID < stringTable.len ) { if ( uriID < stringTable.len ) {
if ( localNameID < stringTable.localNames[uriID].len ) { if ( localNameID < stringTable.localNames[uriID].len ) {
*localName = stringTable.localNames[uriID].entries[localNameID]; *localName = stringTable.localNames[uriID].entries[localNameID];
@ -78,7 +81,7 @@ int exiGetLocalName(uint16_t uriID, uint16_t localNameID, const char** localName
return 0; return 0;
} }
int exiGetLocalNameLength(uint16_t uriID, uint16_t* localNameLength) { int exiGetLocalNameLength(size_t uriID, size_t* localNameLength) {
if ( uriID < stringTable.len ) { if ( uriID < stringTable.len ) {
*localNameLength = stringTable.localNames[uriID].len; *localNameLength = stringTable.localNames[uriID].len;
} else { } else {
@ -88,7 +91,7 @@ int exiGetLocalNameLength(uint16_t uriID, uint16_t* localNameLength) {
return 0; return 0;
} }
int exiGetLocalNameID(uint16_t uriID, const char* localName, uint16_t* localNameID) { int exiGetLocalNameID(size_t uriID, const char* localName, size_t* localNameID) {
unsigned int i; unsigned int i;
if ( uriID < stringTable.len ) { if ( uriID < stringTable.len ) {
/* TODO binary search */ /* TODO binary search */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -32,17 +32,17 @@ extern "C" {
#include "EXITypes.h" #include "EXITypes.h"
int exiGetUri(uint16_t uriID, const char** uri); int exiGetUri(size_t uriID, const char** uri);
int exiGetUriLength(uint16_t* uriLength); int exiGetUriLength(size_t* uriLength);
int exiGetUriID(const char* uri, uint16_t* uriID); int exiGetUriID(const char* uri, size_t* uriID);
int exiGetLocalName(uint16_t uriID, uint16_t localNameID, const char** localName); int exiGetLocalName(size_t uriID, size_t localNameID, const char** localName);
int exiGetLocalNameLength(uint16_t uriID, uint16_t* localNameLength); int exiGetLocalNameLength(size_t uriID, size_t* localNameLength);
int exiGetLocalNameID(uint16_t uriID, const char* localName, uint16_t* localNameID); int exiGetLocalNameID(size_t uriID, const char* localName, size_t* localNameID);
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -59,73 +59,61 @@ const char * localNames3[] = {
}; };
/* localName entries for URI id = 4 */ /* localName entries for URI id = 4 */
const char * localNames4[] = { const char * localNames4[] = {
"CableCheckReq", "CableCheckReqType", "CableCheckRes", "CableCheckResType", "ChargeParameterDiscoveryReq", "ChargingProfile", "ContractID", "EAmount", "EVSEID", "EVSEIMax",
"ChargeParameterDiscoveryReqType", "ChargeParameterDiscoveryRes", "ChargeParameterDiscoveryResType", "ChargingMode", "ContractID", "EVSEMaxPhases", "EVSEMaxPower", "EVSEStatus", "EVSEVoltage", "EnergyProvider",
"CurrentDemandReq", "CurrentDemandReqType", "CurrentDemandRes", "CurrentDemandResType", "CurrentDifferential", "EoC", "LineLockReq", "LineLockReqType", "LineLockRes", "LineLockResType",
"EAmount", "EVSEID", "EVSEMaxCurrent", "EVSEMaxPhases", "EVSEMaxPower", "MeterInfo", "MeteringAuthPubKey", "MeteringReceiptReq", "MeteringReceiptReqType", "MeteringReceiptRes",
"EVSEMaxVoltage", "EVSEMinCurrent", "EVSEMinVoltage", "EVSEPresentCurrent", "EVSEPresentVoltage", "MeteringReceiptResType", "MeteringStatusReq", "MeteringStatusReqType", "MeteringStatusRes", "MeteringStatusResType",
"EVSEStatus", "EnergyProvider", "EoC", "LineLockReq", "LineLockReqType", "PCurrent", "PEVID", "PEVMaxPhases", "PEVMaxPower", "PEVMaxVoltage",
"LineLockRes", "LineLockResType", "MeterInfo", "MeteringReceiptReq", "MeteringReceiptReqType", "PEVMinVoltage", "PEVPubKey", "PEVStatus", "PaymentDetailsReq", "PaymentDetailsReqType",
"MeteringReceiptRes", "MeteringReceiptResType", "MeteringStatusReq", "MeteringStatusReqType", "MeteringStatusRes", "PaymentDetailsRes", "PaymentDetailsResType", "PowerDeliveryReq", "PowerDeliveryReqType", "PowerDeliveryRes",
"MeteringStatusResType", "PCurrent", "PEVDemandCurrent", "PEVID", "PEVMaxCurrent", "PowerDeliveryResType", "PowerDiscoveryReq", "PowerDiscoveryReqType", "PowerDiscoveryRes", "PowerDiscoveryResType",
"PEVMaxPhases", "PEVMaxPower", "PEVMaxVoltage", "PEVMinCurrent", "PEVMinVoltage", "ReqLockStatus", "ReqSwitchStatus", "ResponseCode", "ServiceDiscoveryReq", "ServiceDiscoveryReqType",
"PEVStatus", "PEVTargetVoltage", "PaymentDetailsReq", "PaymentDetailsReqType", "PaymentDetailsRes", "ServiceDiscoveryRes", "ServiceDiscoveryResType", "ServiceList", "ServicePaymentSelectionReq", "ServicePaymentSelectionReqType",
"PaymentDetailsResType", "PowerDeliveryReq", "PowerDeliveryReqType", "PowerDeliveryRes", "PowerDeliveryResType", "ServicePaymentSelectionRes", "ServicePaymentSelectionResType", "ServiceScope", "ServiceType", "SessionSetupReq",
"PreChargeReq", "PreChargeReqType", "PreChargeRes", "PreChargeResType", "ReqLockStatus", "SessionSetupReqType", "SessionSetupRes", "SessionSetupResType", "TCurrent", "Tariff",
"ReqSwitchStatus", "ResponseCode", "ServiceDiscoveryReq", "ServiceDiscoveryReqType", "ServiceDiscoveryRes", "TariffTable"
"ServiceDiscoveryResType", "ServiceList", "ServicePaymentSelectionReq", "ServicePaymentSelectionReqType", "ServicePaymentSelectionRes",
"ServicePaymentSelectionResType", "ServiceScope", "ServiceType", "SessionSetupReq", "SessionSetupReqType",
"SessionSetupRes", "SessionSetupResType", "TCurrent", "Tariff", "TariffTable",
"TerminateChargingReq", "TerminateChargingReqType", "TerminateChargingRes", "TerminateChargingResType", "VoltageDifferential",
"WeldingDetectionReq", "WeldingDetectionReqType", "WeldingDetectionRes", "WeldingDetectionResType"
}; };
/* localName entries for URI id = 5 */ /* localName entries for URI id = 5 */
const char * localNames5[] = { const char * localNames5[] = {
"ChargerStandby", "ChargingProfileEntryMaxPower", "ChargingProfileEntryStart", "ChargingProfileType", "ConnectorLocked", "ChargerStandby", "ChargingProfileEntryMaxPower", "ChargingProfileEntryStart", "ChargingProfileType", "ConnectorLocked",
"Currency", "EPrice", "EVSEMalfunction", "EVSEStandby", "EVSEStatusType", "Currency", "EPrice", "EVSEStandby", "EVSEStatusType", "Event",
"Event", "EventList", "EventListType", "FatalError", "FaultCode", "EventList", "EventListType", "FatalError", "FaultCode", "FaultMsg",
"FaultMsg", "FloatingValueType", "MeterID", "MeterInfoType", "MeterReading", "FloatingValueType", "MeterID", "MeterInfoType", "MeterReading", "MeterStatus",
"MeterStatus", "Multiplier", "NotificationType", "PEVStatusType", "PowerSwitchClosed", "Multiplier", "NotificationType", "PEVStatusType", "PowerSwitchClosed", "ProtocolVersion",
"ProtocolVersion", "RCD", "ReadyToCharge", "Service", "ServiceDescriptionType", "RCD", "Service", "ServiceDescriptionType", "ServiceID", "ServiceListType",
"ServiceID", "ServiceListType", "ServiceName", "ServiceScope", "ServiceSessionID", "ServiceName", "ServiceScope", "ServiceSessionID", "ServiceType", "SessionID",
"ServiceType", "SessionID", "SessionInformationType", "ShutDownTime", "StopCharging", "SessionInformationType", "ShutDownTime", "TMeter", "Tariff", "TariffDescrType",
"TMeter", "Tariff", "TariffDescrType", "TariffDescription", "TariffEntries", "TariffDescription", "TariffEntries", "TariffEntriesType", "TariffEntry", "TariffEntryType",
"TariffEntriesType", "TariffEntry", "TariffEntryType", "TariffID", "TariffPMax", "TariffID", "TariffPMax", "TariffStart", "TariffTableType", "Unit",
"TariffStart", "TariffTableType", "Unit", "Value", "chargingModeType", "Value", "contractIDType", "currencyType", "energyProviderType", "eventEntryType",
"contractIDType", "currencyType", "energyProviderType", "eventEntryType", "evseIDType", "evseIDType", "fatalErrorType", "faultCodeType", "lockStatusType", "maxPhasesType",
"fatalErrorType", "faultCodeType", "lockStatusType", "maxPhasesType", "meterIDType", "meterIDType", "meterStatusType", "paymentOptionListType", "paymentOptionType", "pevIDType",
"meterStatusType", "paymentOptionListType", "paymentOptionType", "pevIDType", "protocolVersionType", "protocolVersionType", "pubKeyType", "rcdType", "responseCode_LineLockType", "responseCode_MeteringReceiptType",
"pubKeyType", "rcdType", "responseCode_CableCheckType", "responseCode_ChargeParameterDiscoveryType", "responseCode_CurrentDemandType", "responseCode_MeteringStatusType", "responseCode_PaymentDetailsType", "responseCode_PowerDeliveryType", "responseCode_PowerDiscoveryType", "responseCode_ServiceDiscoveryType",
"responseCode_LineLockType", "responseCode_MeteringReceiptType", "responseCode_MeteringStatusType", "responseCode_PaymentDetailsType", "responseCode_PowerDeliveryType", "responseCode_ServicePaymentSelectionType", "responseCode_SessionSetupType", "serviceDetailsType", "serviceIDType", "serviceNameType",
"responseCode_PreChargeType", "responseCode_ServiceDiscoveryType", "responseCode_ServicePaymentSelectionType", "responseCode_SessionSetupType", "responseCode_TerminateChargingType", "serviceScopeType", "serviceTypeType", "sessionIDType", "standbyType", "switchStatusType",
"responseCode_WeldingDetectionType", "serviceDetailsType", "serviceIDType", "serviceNameType", "serviceScopeType", "tariffDescriptionType", "tariffIDType", "tariffStartType", "timeType", "unitMultiplierType",
"serviceTypeType", "sessionIDType", "standbyType", "switchStatusType", "tariffDescriptionType", "unitSymbolType"
"tariffIDType", "tariffStartType", "timeType", "unitMultiplierType", "unitSymbolType"
}; };
/* localName entries for URI id = 6 */ /* localName entries for URI id = 6 */
const char * localNames6[] = { const char * localNames6[] = {
"Body", "BodyBaseType", "BodyElement", "BodyType", "Header", "Body", "BodyBaseType", "BodyElement", "BodyType", "Header",
"V2G_Message" "HeaderType", "Notification", "SessionInformation", "V2G_Message"
}; };
/* localName entries for URI id = 7 */ struct exiPartition localNamePartitions[7] = {
const char * localNames7[] = {
"HeaderType", "Notification", "SessionInformation"
};
struct exiPartition localNamePartitions[8] = {
{ 0, localNames0 }, { 0, localNames0 },
{ 4, localNames1 }, { 4, localNames1 },
{ 2, localNames2 }, { 2, localNames2 },
{ 46, localNames3 }, { 46, localNames3 },
{ 94, localNames4 }, { 66, localNames4 },
{ 100, localNames5 }, { 91, localNames5 },
{ 6, localNames6 }, { 9, localNames6 }
{ 3, localNames7 }
}; };
const char * uris[] = { const 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:eval1.0:MsgBody", "urn:iso:15118:2:2010:eval1.0:MsgDataTypes", "urn:iso:15118:2:2010:eval1.0:MsgDef", "urn:iso:15118:2:2010:eval1.0:MsgHeader" "", "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:MsgBody", "urn:iso:15118:2:2010:MsgDataTypes", "urn:iso:15118:2:2010:MsgDef"
}; };
struct exiStringTable stringTable = { 8, uris, localNamePartitions }; struct exiStringTable stringTable = { 7, uris, localNamePartitions };

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -36,14 +36,14 @@
struct exiPartition { struct exiPartition {
/* length of array */ /* length of array */
uint16_t len; size_t len;
/* array of string entries */ /* array of string entries */
const char** entries; const char** entries;
}; };
struct exiStringTable { struct exiStringTable {
/* length of both arrays (uris & localNames) */ /* length of both arrays (uris & localNames) */
uint16_t len; size_t len;
/* URI entries*/ /* URI entries*/
const char** uris; const char** uris;
/* localName entries divided by URI */ /* localName entries divided by URI */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/

View file

@ -1,79 +1,79 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * 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 * by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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 * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifndef EXI_SERVICE_H_ #ifndef V2G_SERVICE_H_
#define EXI_SERVICE_H_ #define V2G_SERVICE_H_
#include "v2g_serviceDataTypes.h" #include "v2g_serviceDataTypes.h"
#include "EXITypes.h" #include "EXITypes.h"
struct uniqueIDPath struct uniqueIDPath
{ {
int id[10]; int id[10];
size_t pos; size_t pos;
}; };
struct EXIService struct v2gService
{ {
/* in-/ out-stream */ /* in-/ out-stream */
bitstream_t inStream; bitstream_t inStream;
bitstream_t outStream; bitstream_t outStream;
/* EXI */ /* EXI */
exi_state_t stateDecode; exi_state_t stateDecode;
exi_state_t stateEncode; exi_state_t stateEncode;
exi_event_t event; exi_event_t event;
eqname_t eqn; eqname_t eqn;
exi_value_t val; exi_value_t val;
/* v2g message data structure */ /* v2g message data structure */
struct EXIDocumentType exiMsg; struct AnonType_V2G_Message v2gMsg;
/* unique id for ambiguous elements */ /* unique id for ambiguous elements */
struct uniqueIDPath idPath; struct uniqueIDPath idPath;
/* error code */ /* error code */
uint8_t errorCode; uint8_t errorCode;
/* offset for transport header data */ /* offset for transport header data */
uint16_t transportHeaderOffset; uint16_t transportHeaderOffset;
}; };
/* define error codes (TODO: define precise error codes) */ /* define error codes (TODO: define precise error codes) */
#define EXI_NON_VALID_MESSAGE 0x01 #define V2G_NON_VALID_MESSAGE 0x01
#define EXI_SERIALIZATION_FAILED 0x02 #define V2G_SERIALIZATION_FAILED 0x02
#define EXI_UNKNOWN_ERROR 0xFF #define V2G_UNKNOWN_ERROR 0xFF
#endif /* EXI_SERVICE_H_ */ #endif /* V2G_SERVICE_H_ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -1,44 +1,44 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * 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 * by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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 * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifndef V2G_SERVICECLIENTDATATRANSMITTER_H_ #ifndef V2G_SERVICECLIENTDATATRANSMITTER_H_
#define V2G_SERVICECLIENTDATATRANSMITTER_H_ #define V2G_SERVICECLIENTDATATRANSMITTER_H_
#include "EXITypes.h" #include "EXITypes.h"
/* This method has to be implemented! /* This method has to be implemented!
* This method sends EXI stream (outStream) to the EVSE and receives response stream (inStream)*/ * 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); int serviceDataTransmitter(uint8_t* outStream, size_t outStreamLength, uint8_t* inStream);
#endif /* V2G_SERVICECLIENTDATATRANSMITTER_H_ */ #endif /* V2G_SERVICECLIENTDATATRANSMITTER_H_ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -22,7 +22,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.3.2 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -40,176 +40,63 @@ extern "C" {
#include "v2g_serviceDataTypes.h" #include "v2g_serviceDataTypes.h"
#include "v2g_serviceClientStubs.h" #include "v2g_serviceClientStubs.h"
/** /* call sessionSetup */
* \brief Calls the remote sessionSetup method int call_sessionSetup(struct v2gService* service, struct HeaderType* header, struct SessionSetupReqType* params, struct SessionSetupResType* result);
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* Header data structure
* \param params struct SessionSetupReqType* Request data for the server (has to be set up before)
* \param result struct SessionSetupResType* Contains the response data from the server
* \return 0 = 0K; -1 = ERROR */
int call_sessionSetup(struct EXIService* service, struct HeaderType* header, struct SessionSetupReqType* params, struct SessionSetupResType* result);
/** /* call serviceDiscovery */
* \brief Calls the remote serviceDiscovery method int call_serviceDiscovery(struct v2gService* service, struct HeaderType* header, struct ServiceDiscoveryReqType* params, struct ServiceDiscoveryResType* result);
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* Header data structure
* \param params struct ServiceDiscoveryReqType* Request data for the server (has to be set up before)
* \param result struct ServiceDiscoveryResType* Contains the response data from the server
* \return 0 = 0K; -1 = ERROR */
int call_serviceDiscovery(struct EXIService* service, struct HeaderType* header, struct ServiceDiscoveryReqType* params, struct ServiceDiscoveryResType* result);
/** /* call selectedServicePayment */
* \brief Calls the remote selectedServicePayment method int call_selectedServicePayment(struct v2gService* service, struct HeaderType* header, struct ServicePaymentSelectionReqType* params, struct ServicePaymentSelectionResType* result);
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* Header data structure
* \param params struct ServicePaymentSelectionReqType* Request data for the server (has to be set up before)
* \param result struct ServicePaymentSelectionResType* Contains the response data from the server
* \return 0 = 0K; -1 = ERROR */
int call_selectedServicePayment(struct EXIService* service, struct HeaderType* header, struct ServicePaymentSelectionReqType* params, struct ServicePaymentSelectionResType* result);
/** /* call paymentDetails */
* \brief Calls the remote paymentDetails method int call_paymentDetails(struct v2gService* service, struct HeaderType* header, struct PaymentDetailsReqType* params, struct PaymentDetailsResType* result);
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* Header data structure
* \param params struct PaymentDetailsReqType* Request data for the server (has to be set up before)
* \param result struct PaymentDetailsResType* Contains the response data from the server
* \return 0 = 0K; -1 = ERROR */
int call_paymentDetails(struct EXIService* service, struct HeaderType* header, struct PaymentDetailsReqType* params, struct PaymentDetailsResType* result);
/** /* call powerDiscovery */
* \brief Calls the remote chargeParameterDiscovery method int call_powerDiscovery(struct v2gService* service, struct HeaderType* header, struct PowerDiscoveryReqType* params, struct PowerDiscoveryResType* result);
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* 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 call_chargeParameterDiscovery(struct EXIService* service, struct HeaderType* header, struct ChargeParameterDiscoveryReqType* params, struct ChargeParameterDiscoveryResType* result);
/** /* call lineLock */
* \brief Calls the remote lineLock method int call_lineLock(struct v2gService* service, struct HeaderType* header, struct LineLockReqType* params, struct LineLockResType* result);
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* Header data structure
* \param params struct LineLockReqType* Request data for the server (has to be set up before)
* \param result struct LineLockResType* Contains the response data from the server
* \return 0 = 0K; -1 = ERROR */
int call_lineLock(struct EXIService* service, struct HeaderType* header, struct LineLockReqType* params, struct LineLockResType* result);
/** /* call powerDelivery */
* \brief Calls the remote powerDelivery method int call_powerDelivery(struct v2gService* service, struct HeaderType* header, struct PowerDeliveryReqType* params, struct PowerDeliveryResType* result);
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* Header data structure
* \param params struct PowerDeliveryReqType* Request data for the server (has to be set up before)
* \param result struct PowerDeliveryResType* Contains the response data from the server
* \return 0 = 0K; -1 = ERROR */
int call_powerDelivery(struct EXIService* service, struct HeaderType* header, struct PowerDeliveryReqType* params, struct PowerDeliveryResType* result);
/** /* call meteringStatus */
* \brief Calls the remote meteringStatus method int call_meteringStatus(struct v2gService* service, struct HeaderType* header, struct MeteringStatusResType* result);
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* Header data structure
* \param result struct MeteringStatusResType* Contains the response data from the server
* \return 0 = 0K; -1 = ERROR */
int call_meteringStatus(struct EXIService* service, struct HeaderType* header, struct MeteringStatusResType* result);
/** /* call meteringReceipt */
* \brief Calls the remote meteringReceipt method int call_meteringReceipt(struct v2gService* service, struct HeaderType* header, struct MeteringReceiptReqType* params, struct MeteringReceiptResType* result);
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* Header data structure
* \param params struct MeteringReceiptReqType* Request data for the server (has to be set up before)
* \param result struct MeteringReceiptResType* Contains the response data from the server
* \return 0 = 0K; -1 = ERROR */
int call_meteringReceipt(struct EXIService* service, struct HeaderType* header, struct MeteringReceiptReqType* params, struct MeteringReceiptResType* result);
/**
* \brief Calls the remote cableCheck method
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* 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 call_cableCheck(struct EXIService* service, struct HeaderType* header, struct CableCheckReqType* params, struct CableCheckResType* result);
/**
* \brief Calls the remote preCharge method
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* 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 call_preCharge(struct EXIService* service, struct HeaderType* header, struct PreChargeReqType* params, struct PreChargeResType* result);
/**
* \brief Calls the remote currentDemand method
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* 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 call_currentDemand(struct EXIService* service, struct HeaderType* header, struct CurrentDemandReqType* params, struct CurrentDemandResType* result);
/**
* \brief Calls the remote weldingDetection method
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* 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 call_weldingDetection(struct EXIService* service, struct HeaderType* header, struct WeldingDetectionReqType* params, struct WeldingDetectionResType* result);
/**
* \brief Calls the remote terminateCharging method
* \param service struct EXIService* Service data structure (has to be initialized before)
* \param header struct HeaderType* Header data structure
* \param params struct TerminateChargingReqType* Request data for the server (has to be set up before)
* \param result struct TerminateChargingResType* Contains the response data from the server
* \return 0 = 0K; -1 = ERROR */
int call_terminateCharging(struct EXIService* service, struct HeaderType* header, struct TerminateChargingReqType* params, struct TerminateChargingResType* result);
/* Initialize the v2g client */ /* Initialize the v2g client */
int init_v2gServiceClient(struct EXIService* service, bytes_t bytes, string_ucs_t string, uint8_t* inStream, size_t max_inStream_size, uint8_t* outStream, size_t max_outStream_size, uint16_t transportHeaderOffset); int init_v2gServiceClient(struct v2gService* service, bytes_t bytes, string_ucs_t string, uint8_t* inStream, size_t max_inStream_size, uint8_t* outStream, size_t max_outStream_size, uint16_t transportHeaderOffset);
#endif #endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef V2GSERVICEDATASERIAL_H_
#define V2GSERVICEDATASERIAL_H_
#include "v2g_service.h"
int serialize_message(struct v2gService* service);
#endif /* V2GSERVICEDATASERIAL_H_ */
#ifdef __cplusplus
}
#endif

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -19,7 +19,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.3.2 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -29,13 +29,19 @@
#include "v2g_serviceDataTypes.h" #include "v2g_serviceDataTypes.h"
static void init_sessionIDType(struct sessionIDType* type) static void init_SessionInformationType_SessionID(struct SessionInformationType_SessionID* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
} }
static void init_protocolVersionType(struct protocolVersionType* type) static void init_SessionInformationType_ServiceSessionID(struct SessionInformationType_ServiceSessionID* type)
{
type->arraylen.data=0;
}
static void init_SessionInformationType_ProtocolVersion(struct SessionInformationType_ProtocolVersion* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
@ -43,15 +49,15 @@ static void init_protocolVersionType(struct protocolVersionType* type)
static void init_SessionInformationType(struct SessionInformationType* type) static void init_SessionInformationType(struct SessionInformationType* type)
{ {
init_sessionIDType(&(type->SessionID)); init_SessionInformationType_SessionID(&(type->SessionID));
init_sessionIDType(&(type->ServiceSessionID)); init_SessionInformationType_ServiceSessionID(&(type->ServiceSessionID));
type->isused.ServiceSessionID=0; type->isused.ServiceSessionID=0;
init_protocolVersionType(&(type->ProtocolVersion)); init_SessionInformationType_ProtocolVersion(&(type->ProtocolVersion));
type->isused.ProtocolVersion=0; type->isused.ProtocolVersion=0;
} }
static void init_service_string(struct service_string* type) static void init_NotificationType_FaultMsg(struct NotificationType_FaultMsg* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
@ -60,7 +66,7 @@ static void init_service_string(struct service_string* type)
static void init_NotificationType(struct NotificationType* type) static void init_NotificationType(struct NotificationType* type)
{ {
type->isused.FaultCode=0; type->isused.FaultCode=0;
init_service_string(&(type->FaultMsg)); init_NotificationType_FaultMsg(&(type->FaultMsg));
type->isused.FaultMsg=0; type->isused.FaultMsg=0;
type->isused.EventList=0; type->isused.EventList=0;
@ -74,7 +80,7 @@ static void init_HeaderType(struct HeaderType* type)
} }
static void init_pevIDType(struct pevIDType* type) static void init_SessionSetupReqType_PEVID(struct SessionSetupReqType_PEVID* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
@ -82,12 +88,12 @@ static void init_pevIDType(struct pevIDType* type)
static void init_SessionSetupReqType(struct SessionSetupReqType* type) static void init_SessionSetupReqType(struct SessionSetupReqType* type)
{ {
init_pevIDType(&(type->PEVID)); init_SessionSetupReqType_PEVID(&(type->PEVID));
type->isused.PEVID=0; type->isused.PEVID=0;
} }
static void init_evseIDType(struct evseIDType* type) static void init_SessionSetupResType_EVSEID(struct SessionSetupResType_EVSEID* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
@ -95,11 +101,11 @@ static void init_evseIDType(struct evseIDType* type)
static void init_SessionSetupResType(struct SessionSetupResType* type) static void init_SessionSetupResType(struct SessionSetupResType* type)
{ {
init_evseIDType(&(type->EVSEID)); init_SessionSetupResType_EVSEID(&(type->EVSEID));
} }
static void init_serviceScopeType(struct serviceScopeType* type) static void init_ServiceDiscoveryReqType_ServiceScope(struct ServiceDiscoveryReqType_ServiceScope* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
@ -108,18 +114,24 @@ static void init_serviceScopeType(struct serviceScopeType* type)
static void init_ServiceDiscoveryReqType(struct ServiceDiscoveryReqType* type) static void init_ServiceDiscoveryReqType(struct ServiceDiscoveryReqType* type)
{ {
type->isused.ServiceType=0; type->isused.ServiceType=0;
init_serviceScopeType(&(type->ServiceScope)); init_ServiceDiscoveryReqType_ServiceScope(&(type->ServiceScope));
type->isused.ServiceScope=0; type->isused.ServiceScope=0;
} }
static void init_serviceIDType(struct serviceIDType* type) static void init_ServiceDescriptionType_ServiceID(struct ServiceDescriptionType_ServiceID* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
} }
static void init_serviceNameType(struct serviceNameType* type) static void init_ServiceDescriptionType_ServiceName(struct ServiceDescriptionType_ServiceName* type)
{
type->arraylen.data=0;
}
static void init_ServiceDescriptionType_ServiceScope(struct ServiceDescriptionType_ServiceScope* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
@ -127,11 +139,11 @@ static void init_serviceNameType(struct serviceNameType* type)
static void init_ServiceDescriptionType(struct ServiceDescriptionType* type) static void init_ServiceDescriptionType(struct ServiceDescriptionType* type)
{ {
init_serviceIDType(&(type->ServiceID)); init_ServiceDescriptionType_ServiceID(&(type->ServiceID));
init_serviceNameType(&(type->ServiceName)); init_ServiceDescriptionType_ServiceName(&(type->ServiceName));
type->isused.ServiceName=0; type->isused.ServiceName=0;
type->isused.ServiceType=0; type->isused.ServiceType=0;
init_serviceScopeType(&(type->ServiceScope)); init_ServiceDescriptionType_ServiceScope(&(type->ServiceScope));
type->isused.ServiceScope=0; type->isused.ServiceScope=0;
} }
@ -156,13 +168,33 @@ static void init_ServiceDiscoveryResType(struct ServiceDiscoveryResType* type)
} }
static void init_ServicePaymentSelectionReqType(struct ServicePaymentSelectionReqType* type) static void init_ServicePaymentSelectionReqType_PEVPubKey(struct ServicePaymentSelectionReqType_PEVPubKey* type)
{ {
init_ServiceListType(&(type->ServiceList)); type->arraylen.data=0;
} }
static void init_contractIDType(struct contractIDType* type) static void init_ServicePaymentSelectionReqType(struct ServicePaymentSelectionReqType* type)
{
init_ServiceListType(&(type->ServiceList));
init_ServicePaymentSelectionReqType_PEVPubKey(&(type->PEVPubKey));
}
static void init_ServicePaymentSelectionResType_MeteringAuthPubKey(struct ServicePaymentSelectionResType_MeteringAuthPubKey* type)
{
type->arraylen.data=0;
}
static void init_ServicePaymentSelectionResType(struct ServicePaymentSelectionResType* type)
{
init_ServicePaymentSelectionResType_MeteringAuthPubKey(&(type->MeteringAuthPubKey));
type->isused.MeteringAuthPubKey=0;
}
static void init_PaymentDetailsReqType_ContractID(struct PaymentDetailsReqType_ContractID* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
@ -170,28 +202,28 @@ static void init_contractIDType(struct contractIDType* type)
static void init_PaymentDetailsReqType(struct PaymentDetailsReqType* type) static void init_PaymentDetailsReqType(struct PaymentDetailsReqType* type)
{ {
init_contractIDType(&(type->ContractID)); init_PaymentDetailsReqType_ContractID(&(type->ContractID));
} }
static void init_ChargeParameterDiscoveryReqType(struct ChargeParameterDiscoveryReqType* type) static void init_PowerDiscoveryReqType(struct PowerDiscoveryReqType* type)
{ {
} }
static void init_energyProviderType(struct energyProviderType* type) static void init_PowerDiscoveryResType_EnergyProvider(struct PowerDiscoveryResType_EnergyProvider* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
} }
static void init_currencyType(struct currencyType* type) static void init_TariffTableType_Currency(struct TariffTableType_Currency* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
} }
static void init_tariffDescriptionType(struct tariffDescriptionType* type) static void init_TariffDescrType_TariffDescription(struct TariffDescrType_TariffDescription* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
@ -218,7 +250,7 @@ static void init_TariffEntriesType(struct TariffEntriesType* type)
static void init_TariffDescrType(struct TariffDescrType* type) static void init_TariffDescrType(struct TariffDescrType* type)
{ {
init_tariffDescriptionType(&(type->TariffDescription)); init_TariffDescrType_TariffDescription(&(type->TariffDescription));
type->isused.TariffDescription=0; type->isused.TariffDescription=0;
init_TariffEntriesType(&(type->TariffEntries)); init_TariffEntriesType(&(type->TariffEntries));
@ -228,7 +260,7 @@ static void init_TariffTableType(struct TariffTableType* type)
{ {
int i_loop; int i_loop;
init_currencyType(&(type->Currency)); init_TariffTableType_Currency(&(type->Currency));
for(i_loop=0; i_loop<6;i_loop++) for(i_loop=0; i_loop<6;i_loop++)
{ {
init_TariffDescrType(&(type->Tariff[i_loop])); init_TariffDescrType(&(type->Tariff[i_loop]));
@ -238,9 +270,9 @@ static void init_TariffTableType(struct TariffTableType* type)
} }
static void init_ChargeParameterDiscoveryResType(struct ChargeParameterDiscoveryResType* type) static void init_PowerDiscoveryResType(struct PowerDiscoveryResType* type)
{ {
init_energyProviderType(&(type->EnergyProvider)); init_PowerDiscoveryResType_EnergyProvider(&(type->EnergyProvider));
type->isused.EnergyProvider=0; type->isused.EnergyProvider=0;
init_TariffTableType(&(type->TariffTable)); init_TariffTableType(&(type->TariffTable));
type->isused.TariffTable=0; type->isused.TariffTable=0;
@ -257,18 +289,26 @@ static void init_LineLockResType(struct LineLockResType* type)
} }
static void init_PowerDeliveryReqType(struct PowerDeliveryReqType* type) static void init_ChargingProfileType(struct ChargingProfileType* type)
{
type->isused.Tariff=0;
}
static void init_PowerDeliveryResType(struct PowerDeliveryResType* type)
{ {
} }
static void init_meterIDType(struct meterIDType* type) static void init_PowerDeliveryReqType(struct PowerDeliveryReqType* type)
{
type->isused.Tariff=0;
init_ChargingProfileType(&(type->ChargingProfile));
type->isused.ChargingProfile=0;
}
static void init_MeteringStatusResType_EVSEID(struct MeteringStatusResType_EVSEID* type)
{
type->arraylen.data=0;
}
static void init_MeterInfoType_MeterID(struct MeterInfoType_MeterID* type)
{ {
type->arraylen.data=0; type->arraylen.data=0;
@ -276,7 +316,7 @@ static void init_meterIDType(struct meterIDType* type)
static void init_MeterInfoType(struct MeterInfoType* type) static void init_MeterInfoType(struct MeterInfoType* type)
{ {
init_meterIDType(&(type->MeterID)); init_MeterInfoType_MeterID(&(type->MeterID));
type->isused.MeterID=0; type->isused.MeterID=0;
type->isused.MeterReading=0; type->isused.MeterReading=0;
type->isused.MeterStatus=0; type->isused.MeterStatus=0;
@ -286,113 +326,67 @@ static void init_MeterInfoType(struct MeterInfoType* type)
static void init_MeteringStatusResType(struct MeteringStatusResType* type) static void init_MeteringStatusResType(struct MeteringStatusResType* type)
{ {
init_evseIDType(&(type->EVSEID)); init_MeteringStatusResType_EVSEID(&(type->EVSEID));
type->isused.PCurrent=0; type->isused.PCurrent=0;
init_MeterInfoType(&(type->MeterInfo)); init_MeterInfoType(&(type->MeterInfo));
type->isused.MeterInfo=0; type->isused.MeterInfo=0;
} }
static void init_MeteringReceiptReqType_PEVID(struct MeteringReceiptReqType_PEVID* type)
{
type->arraylen.data=0;
}
static void init_MeteringReceiptReqType(struct MeteringReceiptReqType* type) static void init_MeteringReceiptReqType(struct MeteringReceiptReqType* type)
{ {
init_pevIDType(&(type->PEVID)); init_MeteringReceiptReqType_PEVID(&(type->PEVID));
type->isused.PEVID=0; type->isused.PEVID=0;
type->isused.TCurrent=0; type->isused.TCurrent=0;
init_MeterInfoType(&(type->MeterInfo)); init_MeterInfoType(&(type->MeterInfo));
} }
static void init_CableCheckReqType(struct CableCheckReqType* type)
{
}
static void init_CableCheckResType(struct CableCheckResType* type)
{
}
static void init_PreChargeReqType(struct PreChargeReqType* type)
{
}
static void init_PreChargeResType(struct PreChargeResType* type)
{
}
static void init_CurrentDemandReqType(struct CurrentDemandReqType* type)
{
}
static void init_CurrentDemandResType(struct CurrentDemandResType* type)
{
}
static void init_WeldingDetectionReqType(struct WeldingDetectionReqType* type)
{
}
static void init_WeldingDetectionResType(struct WeldingDetectionResType* type)
{
}
static void init_TerminateChargingReqType(struct TerminateChargingReqType* type)
{
}
static void init_TerminateChargingResType(struct TerminateChargingResType* type)
{
}
static void init_BodyType(struct BodyType* type) static void init_BodyType(struct BodyType* type)
{ {
type->isused.SessionSetupReq=0; init_SessionSetupReqType(&(type->SessionSetupReq));
type->isused.SessionSetupRes=0; type->isused.SessionSetupReq=0;
type->isused.ServiceDiscoveryReq=0; init_SessionSetupResType(&(type->SessionSetupRes));
type->isused.ServiceDiscoveryRes=0; type->isused.SessionSetupRes=0;
type->isused.ServicePaymentSelectionReq=0; init_ServiceDiscoveryReqType(&(type->ServiceDiscoveryReq));
type->isused.ServicePaymentSelectionRes=0; type->isused.ServiceDiscoveryReq=0;
init_ServiceDiscoveryResType(&(type->ServiceDiscoveryRes));
type->isused.ServiceDiscoveryRes=0;
init_ServicePaymentSelectionReqType(&(type->ServicePaymentSelectionReq));
type->isused.ServicePaymentSelectionReq=0;
init_ServicePaymentSelectionResType(&(type->ServicePaymentSelectionRes));
type->isused.ServicePaymentSelectionRes=0;
init_PaymentDetailsReqType(&(type->PaymentDetailsReq));
type->isused.PaymentDetailsReq=0; type->isused.PaymentDetailsReq=0;
type->isused.PaymentDetailsRes=0; type->isused.PaymentDetailsRes=0;
type->isused.ChargeParameterDiscoveryReq=0; init_PowerDiscoveryReqType(&(type->PowerDiscoveryReq));
type->isused.ChargeParameterDiscoveryRes=0; type->isused.PowerDiscoveryReq=0;
type->isused.LineLockReq=0; init_PowerDiscoveryResType(&(type->PowerDiscoveryRes));
type->isused.LineLockRes=0; type->isused.PowerDiscoveryRes=0;
init_LineLockReqType(&(type->LineLockReq));
type->isused.LineLockReq=0;
init_LineLockResType(&(type->LineLockRes));
type->isused.LineLockRes=0;
init_PowerDeliveryReqType(&(type->PowerDeliveryReq));
type->isused.PowerDeliveryReq=0; type->isused.PowerDeliveryReq=0;
type->isused.PowerDeliveryRes=0; type->isused.PowerDeliveryRes=0;
type->isused.MeteringStatusReq=0; type->isused.MeteringStatusReq=0;
type->isused.MeteringStatusRes=0; init_MeteringStatusResType(&(type->MeteringStatusRes));
type->isused.MeteringStatusRes=0;
init_MeteringReceiptReqType(&(type->MeteringReceiptReq));
type->isused.MeteringReceiptReq=0; type->isused.MeteringReceiptReq=0;
type->isused.MeteringReceiptRes=0; type->isused.MeteringReceiptRes=0;
type->isused.CableCheckReq=0;
type->isused.CableCheckRes=0;
type->isused.PreChargeReq=0;
type->isused.PreChargeRes=0;
type->isused.CurrentDemandReq=0;
type->isused.CurrentDemandRes=0;
type->isused.WeldingDetectionReq=0;
type->isused.WeldingDetectionRes=0;
type->isused.TerminateChargingReq=0;
type->isused.TerminateChargingRes=0;
} }
void init_AnonType_V2G_Message(struct AnonType_V2G_Message* type)
static void init_AnonType_V2G_Message(struct AnonType_V2G_Message* type) {
{ init_HeaderType(&(type->Header));
init_BodyType(&(type->Body)); init_BodyType(&(type->Body));
} }
static void init_EXIDocumentType(struct EXIDocumentType* type)
{
init_AnonType_V2G_Message(&(type->V2G_Message));
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,43 +1,43 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * 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 * by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 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 * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifndef V2GSERVER_H_ #ifndef V2GSERVER_H_
#define V2GSERVER_H_ #define V2GSERVER_H_
#include "v2g_serviceDataTypes.h" #include "v2g_serviceDataTypes.h"
int init_v2gservice(struct EXIService* service,bytes_t bytes, string_ucs_t string, uint16_t transportHeaderOffset); int init_v2gservice(struct v2gService* service,bytes_t bytes, string_ucs_t string, uint16_t transportHeaderOffset);
int messageDispatcher(struct EXIService* service, uint8_t* inStream, uint16_t sizeInStream, uint8_t* outStream, uint16_t sizeOutStream, uint16_t* outPos); int messageDispatcher(struct v2gService* service, uint8_t* inStream, size_t sizeInStream, uint8_t* outStream, size_t sizeOutStream, size_t* outPos);
#endif /* V2GSERVER_H_ */ #endif /* V2GSERVER_H_ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -3,7 +3,7 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -22,7 +22,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.3.2 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -47,7 +47,7 @@ int selectedServicePayment(struct ServicePaymentSelectionReqType* param, struct
int paymentDetails(struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result); int paymentDetails(struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result);
int chargeParameterDiscovery(struct ChargeParameterDiscoveryReqType* param, struct ChargeParameterDiscoveryResType* result); int powerDiscovery(struct PowerDiscoveryReqType* param, struct PowerDiscoveryResType* result);
int lineLock(struct LineLockReqType* param, struct LineLockResType* result); int lineLock(struct LineLockReqType* param, struct LineLockResType* result);
@ -56,16 +56,6 @@ int powerDelivery(struct PowerDeliveryReqType* param, struct PowerDeliveryResTyp
int meteringStatus(struct MeteringStatusReqType* param, struct MeteringStatusResType* result); int meteringStatus(struct MeteringStatusReqType* param, struct MeteringStatusResType* result);
int meteringReceipt(struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result); int meteringReceipt(struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result);
int cableCheck(struct CableCheckReqType* param, struct CableCheckResType* result);
int preCharge(struct PreChargeReqType* param, struct PreChargeResType* result);
int currentDemand(struct CurrentDemandReqType* param, struct CurrentDemandResType* result);
int weldingDetection(struct WeldingDetectionReqType* param, struct WeldingDetectionResType* result);
int terminateCharging(struct TerminateChargingReqType* param, struct TerminateChargingResType* result);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -19,7 +19,7 @@
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
* <p>Switch for sample programs: EXI codec only or for entire V2G service</p> * <p>Switch for sample programs: EXI codec only or for entire V2G service</p>
@ -33,8 +33,7 @@
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
/* EXI codec only */ /* EXI codec only */
/* return main_codec(argc, argv);*/ /*return main_codec(argc, argv);*/
/* V2G client / service example scenario */ /* V2G client / service example scenario */
return main_service(argc, argv); return main_service(argc, argv);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -19,7 +19,7 @@
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Daniel.Peintner.EXT@siemens.com * @author Daniel.Peintner.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
* <p>Sample program to illustrate how to read an EXI stream and * <p>Sample program to illustrate how to read an EXI stream and
@ -36,10 +36,10 @@
#include "EXITypes.h" #include "EXITypes.h"
#include "ByteStream.h" #include "ByteStream.h"
#define BUFFER_SIZE 1000 #define BUFFER_SIZE 100
#define ARRAY_SIZE_BYTES 100 #define ARRAY_SIZE_BYTES 50
#define ARRAY_SIZE_STRINGS 100 #define ARRAY_SIZE_STRINGS 50
/* avoids warning: initializer element is not computable at load time */ /* avoids warning: initializer element is not computable at load time */
uint8_t bufferIn[BUFFER_SIZE]; uint8_t bufferIn[BUFFER_SIZE];
@ -53,8 +53,8 @@ int main_codec(int argc, char *argv[]) {
unsigned int i; unsigned int i;
bitstream_t iStream, oStream; bitstream_t iStream, oStream;
uint16_t posDecode; size_t posDecode;
uint16_t posEncode; size_t posEncode;
/* EXI set-up */ /* EXI set-up */
exi_state_t stateDecode; exi_state_t stateDecode;
@ -66,7 +66,7 @@ int main_codec(int argc, char *argv[]) {
/* BINARY memory setup */ /* BINARY memory setup */
bytes_t bytes = { ARRAY_SIZE_BYTES, data, 0 }; bytes_t bytes = { ARRAY_SIZE_BYTES, data, 0 };
/* STRING memory setup */ /* STRING memory setuo */
string_ucs_t string = { ARRAY_SIZE_STRINGS, codepoints, 0 }; string_ucs_t string = { ARRAY_SIZE_STRINGS, codepoints, 0 };
const char * localName; const char * localName;
@ -182,7 +182,7 @@ int main_codec(int argc, char *argv[]) {
return errn; return errn;
} }
if (val.type == INTEGER_BIG) { if (val.type == INTEGER_BIG) {
printf(" CH int64 : %ld \n", (long int)val.int64); printf(" CH int64 : %lld \n", val.int64);
} else if (val.type == BINARY_BASE64 || val.type == BINARY_HEX) { } else if (val.type == BINARY_BASE64 || val.type == BINARY_HEX) {
printf(" CH Binary (len == %d) : ", val.binary.len); printf(" CH Binary (len == %d) : ", val.binary.len);
for(i=0; i<val.binary.len; i++) { for(i=0; i<val.binary.len; i++) {
@ -224,7 +224,7 @@ int main_codec(int argc, char *argv[]) {
} while (noEndOfDocument); } while (noEndOfDocument);
/* write to file */ /* write to file */
writeBytesToFile(oStream.data, posEncode, argv[2]); writeBytesToFile(oStream.data, iStream.size, argv[2]);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -37,309 +37,10 @@
#define MAX_STRING_SIZE 256 #define MAX_STRING_SIZE 256
#define MAX_STREAM_SIZE 60 #define MAX_STREAM_SIZE 60
static uint8_t byte_array[MAX_BYTE_SIZE]; /* define MAX_BYTE_SIZE before*/ static void printErrorMessage(struct v2gService* service);
static uint32_t string_array[MAX_STRING_SIZE]; /* define MAX_STRING_SIZE before*/
static void printEVSEStatus(struct EVSEStatusType* status); int main_service(int argc, char *argv[])
static void printErrorMessage(struct EXIService* service);
static int ac_charging()
{ {
/* define in and out byte stream */
uint8_t inStream[MAX_STREAM_SIZE]; /* define MAX_STREAM_SIZE before */
uint8_t outStream[MAX_STREAM_SIZE]; /* define MAX_STREAM_SIZE before */
/* define offset variable for transport header data */
uint16_t transportHeaderOffset;
/* service data structure */
struct EXIService service;
struct HeaderType v2gHeader;
struct SessionSetupReqType sessionSetup;
struct SessionSetupResType resultSessionSetup;
struct ChargeParameterDiscoveryReqType powerDiscovery;
struct ChargeParameterDiscoveryResType resultPowerDiscovery;
struct LineLockReqType lineLock;
struct LineLockResType resultLineLock;
struct PowerDeliveryReqType powerDelivery;
struct PowerDeliveryResType resultPowerDelivery;
struct MeteringStatusResType resultMeteringStatus;
struct MeteringReceiptReqType meteringReceipt;
struct MeteringReceiptResType resultMeteringReceipt;
struct FloatingValueType float_type; /* test float type*/
/* BINARY memory setup */
bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 };
/* STRING memory setup */
string_ucs_t string = { MAX_STRING_SIZE, string_array, 0 };
/* setup offset for DoIP header (otherwise set
* transportHeaderOffset=0 if no transfer protocol is used)*/
transportHeaderOffset = DOIP_HEADER_LENGTH;
/*******************
* Init V2G Client *
*******************/
init_v2gServiceClient(&service,bytes,string,inStream,MAX_STREAM_SIZE, outStream, MAX_STREAM_SIZE, transportHeaderOffset);
/*******************************
* Setup data for sessionSetup *
*******************************/
/* setup header information */
v2gHeader.SessionInformation.SessionID.arraylen.data = 0; /* no session id in the initial message -> array length = 0*/
v2gHeader.SessionInformation.ProtocolVersion.data[0]='1'; /* assign protocol version number*/
v2gHeader.SessionInformation.ProtocolVersion.arraylen.data=1; /* array string length =1 of protocol version */
v2gHeader.SessionInformation.isused.ProtocolVersion = 1; /* important: optional elements have to be set used (=1) or not used (=0) */
v2gHeader.SessionInformation.isused.ServiceSessionID = 0; /* service session is not used */
v2gHeader.isused.Notification=0; /* no notification */
/* setup sessionSetup parameter */
sessionSetup.isused.PEVID=1; /* PEVID is transported */
sessionSetup.PEVID.arraylen.data=1;
sessionSetup.PEVID.data[0]=10;
sessionSetup.PEVStatus.ChargerStandby=0; /* charger standby = true */
sessionSetup.PEVStatus.ConnectorLocked=0; /* connector locked = false */
sessionSetup.PEVStatus.ReadyToCharge=0; /* ReadyToCharge = false */
printf("PEV: call EVSE sessionSetup\n");
/*********************
* Call sessionSetup *
*********************/
if(call_sessionSetup(&service,&v2gHeader,&sessionSetup,&resultSessionSetup))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE sessionSetup */
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d (OK)\n",resultSessionSetup.ResponseCode);
printf("\tEVSEID=%d\n", resultSessionSetup.EVSEID.data[0]);
printEVSEStatus(&resultSessionSetup.EVSEStatus);
printf("\tTCurrent=%d\n",resultSessionSetup.TCurrent);
}
/*******************************************
* Setup data for chargeParameterDiscovery *
*******************************************/
powerDiscovery.PEVStatus.ChargerStandby = 1;
powerDiscovery.PEVStatus.ConnectorLocked = 0;
powerDiscovery.PEVStatus.ReadyToCharge=0;
powerDiscovery.ChargingMode = AC_charging_chargingModeType;
powerDiscovery.EoC = 12345678;
float_type.Multiplier = 0;
float_type.Unit = J_unitSymbolType;
float_type.Value = 100;
powerDiscovery.EAmount = float_type;
powerDiscovery.PEVMaxPhases = 3;
float_type.Unit = W_unitSymbolType;
float_type.Value = 600;
powerDiscovery.PEVMaxPower = float_type;
float_type.Unit = V_unitSymbolType;
float_type.Value = 1000;
powerDiscovery.PEVMaxVoltage = float_type;
float_type.Value = 200;
powerDiscovery.PEVMinVoltage = float_type;
/* only required for DC */
float_type.Unit = A_unitSymbolType;
float_type.Value = 200;
powerDiscovery.PEVMaxCurrent = float_type;
powerDiscovery.PEVMinCurrent = float_type;
/*********************************
* Call chargeParameterDiscovery *
*********************************/
printf("\nPEV: call EVSE chargeParameterDiscovery\n");
if(call_chargeParameterDiscovery(&service,&v2gHeader,&powerDiscovery,&resultPowerDiscovery))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE sessionSetup*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultPowerDiscovery.ResponseCode);
printEVSEStatus(&resultPowerDiscovery.EVSEStatus);
printf("\tEVSEMaxVoltage=%d\n",resultPowerDiscovery.EVSEMaxVoltage.Value);
/*printf("\tEVSEMaxCurrent=%d\n",resultPowerDiscovery.EVSEMaxCurrent.Value);*/
printf("\tEVSEMaxPhases=%d\n",resultPowerDiscovery.EVSEMaxPhases);
/*printf("\tEnergyProvider=%d\n",resultPowerDiscovery.EnergyProvider.data[0]);*/
}
/*********************************
* Setup data for lineLock *
*********************************/
lineLock.PEVStatus.ChargerStandby = 1;
lineLock.PEVStatus.ConnectorLocked = 1;
lineLock.PEVStatus.ReadyToCharge = 1;
lineLock.ReqLockStatus = 1;
/***********************
* Call lineLock *
***********************/
printf("\nPEV: call EVSE lineLock\n");
if(call_lineLock(&service,&v2gHeader,&lineLock,&resultLineLock))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE sessionSetup*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultLineLock.ResponseCode);
printEVSEStatus(&resultLineLock.EVSEStatus);
}
/*********************************
* Setup data for powerDelivery *
*********************************/
powerDelivery.PEVStatus = lineLock.PEVStatus; /* PEV status, taken from lineLock */
/*powerDelivery.isused.Tariff = 0;
powerDelivery.Tariff = Green_charge_tariffIDType;*/
/***********************
* Call powerDelivery *
***********************/
printf("\nPEV: call EVSE powerDelivery\n");
if(call_powerDelivery(&service,&v2gHeader,&powerDelivery,&resultPowerDelivery))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE sessionSetup*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultPowerDelivery.ResponseCode);
}
/********************
* Call meterStatus *
********************/
printf("\nPEV: call EVSE meterStatus\n");
if(call_meteringStatus(&service,&v2gHeader,&resultMeteringStatus))
{
printErrorMessage(&service);
}
else
{
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultPowerDiscovery.ResponseCode);
printEVSEStatus(&resultPowerDiscovery.EVSEStatus);
printf("\tEVSEID=%d\n",resultMeteringStatus.EVSEID.data[0]);
printf("\tEVSEMaxPower=%d\n",resultMeteringStatus.EVSEMaxPower.Value);
printf("\tisused.MeterInfo=%d\n", resultMeteringStatus.isused.MeterInfo);
printf("\t\tMeterInfo.MeterID=%d\n", resultMeteringStatus.MeterInfo.MeterID.data[0]);
printf("\t\tMeterInfo.MeterReading.Value=%d\n", resultMeteringStatus.MeterInfo.MeterReading.Value);
printf("\t\tMeterInfo.MeterStatus=%d\n", resultMeteringStatus.MeterInfo.MeterStatus);
/* printf("\t\tMeterInfo.TMeter=%d\n", resultMeteringStatus.MeterInfo.TMeter);*/
/* printf("\t\tisused.PCurrent=%d\n", resultMeteringStatus.isused.PCurrent);
printf("\t\tPCurrent=%d\n", resultMeteringStatus.PCurrent.Value);*/
}
/*********************************
* Setup data for meteringReceipt *
*********************************/
meteringReceipt.PEVID.arraylen.data=1;
meteringReceipt.PEVID.data[0]=10;
meteringReceipt.isused.PEVID=1;
meteringReceipt.PEVStatus = powerDelivery.PEVStatus; /* PEV status, taken from sessionSetup */
meteringReceipt.TCurrent = 12345;
meteringReceipt.isused.TCurrent = 1;
meteringReceipt.Tariff = Green_charge_tariffIDType;
meteringReceipt.MeterInfo.MeterStatus = 2;
meteringReceipt.MeterInfo.isused.MeterStatus = 1;
meteringReceipt.MeterInfo.MeterID.arraylen.data=1;
meteringReceipt.MeterInfo.MeterID.data[0]=3;
meteringReceipt.MeterInfo.isused.MeterID = 1;
meteringReceipt.MeterInfo.MeterReading.Multiplier = 0;
meteringReceipt.MeterInfo.MeterReading.Unit = A_unitSymbolType;
meteringReceipt.MeterInfo.MeterReading.Value = 500;
meteringReceipt.MeterInfo.isused.MeterReading = 1;
meteringReceipt.MeterInfo.TMeter =123456789;
meteringReceipt.MeterInfo.isused.TMeter = 1;
/***********************
* Call meteringReceipt *
***********************/
printf("\nPEV: call EVSE meteringReceipt\n");
if(call_meteringReceipt(&service,&v2gHeader,&meteringReceipt,&resultMeteringReceipt))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE sessionSetup*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultMeteringReceipt.ResponseCode);
}
return 0;
}
static int dc_charging()
{
static uint8_t byte_array[MAX_BYTE_SIZE]; /* define MAX_BYTE_SIZE before*/ static uint8_t byte_array[MAX_BYTE_SIZE]; /* define MAX_BYTE_SIZE before*/
static uint32_t string_array[MAX_STRING_SIZE]; /* define MAX_STRING_SIZE before*/ static uint32_t string_array[MAX_STRING_SIZE]; /* define MAX_STRING_SIZE before*/
@ -353,31 +54,15 @@ static int dc_charging()
/* service data structure */ /* service data structure */
struct EXIService service; struct v2gService service;
struct HeaderType v2gHeader; struct HeaderType v2gHeader;
struct SessionSetupReqType sessionSetup; struct SessionSetupReqType sessionSetup;
struct SessionSetupResType resultSessionSetup; struct SessionSetupResType resultSessionSetup;
struct ChargeParameterDiscoveryReqType powerDiscovery; /*struct PowerDiscoveryReqType powerDiscovery;
struct ChargeParameterDiscoveryResType resultPowerDiscovery; struct PowerDiscoveryResType resultPowerDiscovery; */
struct CableCheckReqType cableCheck;
struct CableCheckResType resultCableCheck;
struct PowerDeliveryReqType powerDelivery;
struct PowerDeliveryResType resultPowerDelivery;
struct PreChargeReqType preCharge;
struct PreChargeResType resultPreCharge;
struct CurrentDemandReqType currentDemand;
struct CurrentDemandResType resultCurrentDemand;
struct WeldingDetectionReqType weldingDetection;
struct WeldingDetectionResType resultWeldingDetection;
struct TerminateChargingReqType terminateCharging;
struct TerminateChargingResType resultTerminateCharging;
struct FloatingValueType float_type; /* test float type*/
/* BINARY memory setup */ /* BINARY memory setup */
bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 }; bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 };
@ -389,6 +74,8 @@ static int dc_charging()
transportHeaderOffset = DOIP_HEADER_LENGTH; transportHeaderOffset = DOIP_HEADER_LENGTH;
printf("+++Start V2G Client / Service Example+++\n\n");
/******************* /*******************
* Init V2G Client * * Init V2G Client *
*******************/ *******************/
@ -396,26 +83,22 @@ static int dc_charging()
init_v2gServiceClient(&service,bytes,string,inStream,MAX_STREAM_SIZE, outStream, MAX_STREAM_SIZE, transportHeaderOffset); init_v2gServiceClient(&service,bytes,string,inStream,MAX_STREAM_SIZE, outStream, MAX_STREAM_SIZE, transportHeaderOffset);
/******************************* /*******************************
* Setup data for sessionSetup * * Setup data for sessionSetup *
*******************************/ *******************************/
/* setup header information */ /* setup header information */
v2gHeader.SessionInformation.SessionID.arraylen.data = 0; /* no session id in the initial message -> array length = 0*/ v2gHeader.SessionInformation.SessionID.arraylen.data = 0; /* no session id in the initial message -> array length = 0*/
v2gHeader.SessionInformation.ProtocolVersion.data[0]='1'; /* assign protocol version number*/ v2gHeader.SessionInformation.ProtocolVersion.data[0]='1'; /* assign protocol version number*/
v2gHeader.SessionInformation.ProtocolVersion.arraylen.data=1; /* array string length =1 of protocol version */ v2gHeader.SessionInformation.ProtocolVersion.arraylen.data=1; /* array string length =1 of protocol version */
v2gHeader.SessionInformation.isused.ProtocolVersion = 1; /* important: optional elements have to be set used (=1) or not used (=0) */ v2gHeader.SessionInformation.isused.ProtocolVersion = 1; /* important: signalize, protocol version is used */
v2gHeader.SessionInformation.isused.ServiceSessionID = 0; /* service session is not used */
v2gHeader.isused.Notification=0; /* no notification */ v2gHeader.isused.Notification=0; /* no notification */
/* setup sessionSetup parameter */ /* setup sessionSetup parameter */
sessionSetup.isused.PEVID=1; /* no PEVID is transported */ sessionSetup.isused.PEVID=1; /* no PEVID is transported */
sessionSetup.PEVID.arraylen.data=1; sessionSetup.PEVStatus.ChargerStandby=1; /* charger standby = true */
sessionSetup.PEVID.data[0]=10;
sessionSetup.PEVStatus.ChargerStandby=0; /* charger standby = true */
sessionSetup.PEVStatus.ConnectorLocked=0; /* connector locked = false */ sessionSetup.PEVStatus.ConnectorLocked=0; /* connector locked = false */
printf("PEV: call EVSE sessionSetup\n"); printf("PEV: call EVSE sessionSetup\n");
/********************* /*********************
@ -427,280 +110,31 @@ static int dc_charging()
} }
else else
{ {
/* show result of the answer message of EVSE sessionSetup */ /* show result of the answer message of EVSE sessionSetup*/
printf("PEV: received response message from EVSE\n"); printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultSessionSetup.ResponseCode); printf("\tResponseCode=%d\n",resultSessionSetup.ResponseCode);
printf("\tEVSEID=%d\n", resultSessionSetup.EVSEID.data[0]); printf("\tEVSEID=%d\n", resultSessionSetup.EVSEID.data[0]);
printEVSEStatus(&resultSessionSetup.EVSEStatus); printf("\tEVSEStatus:\n\t\tConnectorLocked=%d\n",resultSessionSetup.EVSEStatus.ConnectorLocked);
printf("\t\tEVSEStandby=%d\n",resultSessionSetup.EVSEStatus.EVSEStandby);
printf("\t\tFatalError=%d\n",resultSessionSetup.EVSEStatus.FatalError);
printf("\t\tPowerSwitchClosed=%d\n",resultSessionSetup.EVSEStatus.PowerSwitchClosed);
printf("\t\tRCD=%d\n",resultSessionSetup.EVSEStatus.RCD);
printf("\t\tShutDownTime=%d\n",resultSessionSetup.EVSEStatus.ShutDownTime);
printf("\tTCurrent=%d\n",resultSessionSetup.TCurrent); printf("\tTCurrent=%d\n",resultSessionSetup.TCurrent);
} }
printf("\n+++Terminate V2G Client / Service Example+++");
/*******************************************
* Setup data for chargeParameterDiscovery *
*******************************************/
powerDiscovery.PEVStatus = sessionSetup.PEVStatus; /* PEV status, taken from sessionSetup */
powerDiscovery.EoC = 4321;
powerDiscovery.ChargingMode = DC_charging_chargingModeType;
float_type.Multiplier = 2;
float_type.Unit = A_unitSymbolType;
float_type.Value = 700;
float_type.Multiplier = 0;
float_type.Unit = J_unitSymbolType;
float_type.Value = 100;
powerDiscovery.EAmount = float_type;
powerDiscovery.PEVMaxPhases = 3;
float_type.Unit = W_unitSymbolType;
float_type.Value = 600;
powerDiscovery.PEVMaxPower = float_type;
float_type.Unit = V_unitSymbolType;
float_type.Value = 1000;
powerDiscovery.PEVMaxVoltage = float_type;
float_type.Value = 200;
powerDiscovery.PEVMinVoltage = float_type;
float_type.Unit = A_unitSymbolType;
float_type.Value = 800;
powerDiscovery.PEVMaxCurrent = float_type;
float_type.Value = 150;
powerDiscovery.PEVMinCurrent = float_type;
/*********************************
* Call chargeParameterDiscovery *
*********************************/
printf("\nPEV: call EVSE chargeParameterDiscovery\n");
if(call_chargeParameterDiscovery(&service,&v2gHeader,&powerDiscovery,&resultPowerDiscovery))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE sessionSetup*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultPowerDiscovery.ResponseCode);
printEVSEStatus(&resultPowerDiscovery.EVSEStatus);
printf("\tEVSEMaxVoltage=%d\n",resultPowerDiscovery.EVSEMaxVoltage.Value);
printf("\tEVSEMaxCurrent=%d\n",resultPowerDiscovery.EVSEMaxCurrent.Value);
printf("\tEVSEMinCurrent=%d\n",resultPowerDiscovery.EVSEMinCurrent.Value);
printf("\tEVSEMaxPhases=%d\n",resultPowerDiscovery.EVSEMaxPhases);
/*printf("\tEnergyProvider=%d\n",resultPowerDiscovery.EnergyProvider.data[0]);*/
}
/***********************
* Call cableCheck *
***********************/
printf("\nPEV: call EVSE cableCheck\n");
cableCheck.PEVStatus.ChargerStandby = 1;
cableCheck.PEVStatus.ConnectorLocked = 1;
cableCheck.PEVStatus.ReadyToCharge = 1;
if(call_cableCheck(&service,&v2gHeader,&cableCheck,&resultCableCheck))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE powerDiscovery*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultCableCheck.ResponseCode);
printEVSEStatus(&resultCableCheck.EVSEStatus);
}
/*********************************
* Setup data for powerDelivery *
*********************************/
powerDelivery.PEVStatus = cableCheck.PEVStatus; /* PEV status, taken from sessionSetup */
powerDelivery.isused.Tariff = 0;
/*powerDelivery.Tariff = Green_charge_tariffIDType;*/
/***********************
* Call powerDelivery *
***********************/
printf("\nPEV: call EVSE powerDelivery\n");
if(call_powerDelivery(&service,&v2gHeader,&powerDelivery,&resultPowerDelivery))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE sessionSetup*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultPowerDelivery.ResponseCode);
printEVSEStatus(&resultPowerDelivery.EVSEStatus);
}
/***********************
* Call preCharge *
***********************/
printf("\nPEV: call EVSE preCharge\n");
preCharge.PEVStatus = cableCheck.PEVStatus;
float_type.Unit = A_unitSymbolType;
float_type.Value = 400;
preCharge.PEVDemandCurrent = float_type;
float_type.Unit = V_unitSymbolType;
float_type.Value = 700;
preCharge.PEVTargetVoltage = float_type;
float_type.Value = 300;
preCharge.VoltageDifferential = float_type;
if(call_preCharge(&service,&v2gHeader,&preCharge,&resultPreCharge))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE powerDiscovery*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultPreCharge.ResponseCode);
printEVSEStatus(&resultPreCharge.EVSEStatus);
printf("\tEVSEPresentVoltage=%d\n",resultPreCharge.EVSEPresentVoltage.Value);
}
/***********************
* Call currentDemand *
***********************/
printf("\nPEV: call EVSE currentDemand\n");
currentDemand.PEVStatus = powerDelivery.PEVStatus;
float_type.Unit = A_unitSymbolType;
float_type.Value = 44;
currentDemand.CurrentDifferential = float_type;
float_type.Value = 40;
currentDemand.PEVDemandCurrent = float_type;
float_type.Unit = V_unitSymbolType;
float_type.Value = 300;
currentDemand.VoltageDifferential = float_type;
float_type.Value = 700;
preCharge.PEVTargetVoltage = float_type;
currentDemand.PEVTargetVoltage = float_type;
if(call_currentDemand(&service,&v2gHeader,&currentDemand,&resultCurrentDemand))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE powerDiscovery*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultCurrentDemand.ResponseCode);
printEVSEStatus(&resultCurrentDemand.EVSEStatus);
printf("\tEVSEPresentVoltage.Value=%d\n",resultCurrentDemand.EVSEPresentVoltage.Value);
printf("\tEVSEPresentCurrent.Value=%d\n",resultCurrentDemand.EVSEPresentCurrent.Value);
}
/***********************
* Call weldingDetection *
***********************/
printf("\nPEV: call EVSE weldingDetection\n");
weldingDetection.PEVStatus = powerDelivery.PEVStatus;
if(call_weldingDetection(&service,&v2gHeader,&weldingDetection,&resultWeldingDetection))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE powerDiscovery*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultWeldingDetection.ResponseCode);
printEVSEStatus(&resultWeldingDetection.EVSEStatus);
printf("\tEVSEPresentVoltage=%d\n",resultWeldingDetection.EVSEPresentVoltage.Value);
}
/*************************
* Call terminateCharging*
*************************/
printf("\nPEV: call EVSE terminateCharging\n");
terminateCharging.PEVStatus = sessionSetup.PEVStatus;
if(call_terminateCharging(&service,&v2gHeader,&terminateCharging,&resultTerminateCharging))
{
printErrorMessage(&service);
}
else
{
/* show result of the answer message of EVSE powerDiscovery*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultTerminateCharging.ResponseCode);
printEVSEStatus(&resultWeldingDetection.EVSEStatus);
printf("\tEVSEPresentVoltage.Value=%d\n",resultTerminateCharging.EVSEPresentVoltage.Value);
}
return 0; return 0;
} }
int main_service() static void printErrorMessage(struct v2gService* service)
{ {
printf("+++ Start V2G client / service example for AC charging +++\n\n"); if(service->errorCode==V2G_NON_VALID_MESSAGE)
ac_charging();
printf("\n+++Terminate V2G Client / Service example for AC charging +++\n");
printf("Please press enter for DC charging!\n");
fflush(stdout);
getchar();
printf("+++ Start V2G client / service example for DC charging +++\n\n");
dc_charging();
printf("\n+++Terminate V2G client / service example for DC charging +++");
return 0;
}
static void printEVSEStatus(struct EVSEStatusType* status)
{
printf("\tEVSEStatus:\n\t\tConnectorLocked=%d\n",status->ConnectorLocked);
printf("\t\tEVSEStandby=%d\n",status->EVSEStandby);
printf("\t\tFatalError=%d\n",status->FatalError);
printf("\t\tPowerSwitchClosed=%d\n",status->PowerSwitchClosed);
printf("\t\tRCD=%d\n",status->RCD);
printf("\t\tChargerStandby=%d\n",status->ChargerStandby);
printf("\t\tEVSEMalfunction=%d\n",status->EVSEMalfunction);
printf("\t\tShutDownTime=%d\n",status->ShutDownTime);
}
static void printErrorMessage(struct EXIService* service)
{
if(service->errorCode==EXI_NON_VALID_MESSAGE)
{ {
printf("PEV did not send a valid V2G message!\n"); printf("PEV did not send a valid V2G message!\n");
} }
else if(service->errorCode==EXI_SERIALIZATION_FAILED) else if(service->errorCode==V2G_SERIALIZATION_FAILED)
{ {
printf("EVSE error: Could not serialize the response message\n"); printf("EVSE error: Could not serialize the response message\n");
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -32,15 +32,15 @@
#define MAX_STRING_SIZE 256 #define MAX_STRING_SIZE 256
#define MAX_STREAM_SIZE 60 #define MAX_STREAM_SIZE 60
int testV2GService(uint8_t* inStream, uint16_t inStreamLength, uint8_t* outStream, uint16_t* outStreamLength) int testV2GService(uint8_t* inStream, size_t inStreamLength, uint8_t* outStream, size_t* outStreamLength)
{ {
static uint8_t byte_array[MAX_BYTE_SIZE]; /* define MAX_BYTE_SIZE before*/ static uint8_t byte_array[MAX_BYTE_SIZE]; /* define MAX_BYTE_SIZE before*/
static uint32_t string_array[MAX_STRING_SIZE]; /* define MAX_STRING_SIZE before*/ static uint32_t string_array[MAX_STRING_SIZE]; /* define MAX_STRING_SIZE before*/
uint16_t exiMsgLength; size_t exiMsgLength;
struct EXIService service; struct v2gService service;
/* BINARY memory setup */ /* BINARY memory setup */
bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 }; bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 };

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -28,6 +28,6 @@
#include "EXITypes.h" #include "EXITypes.h"
int testV2GService(uint8_t* inStream, uint16_t inStreamLength, uint8_t* outStream,uint16_t* outStreamLength); int testV2GService(uint8_t* inStream, size_t inStreamLength, uint8_t* outStream,size_t* outStreamLength);
#endif /* V2G_SERVER_H_ */ #endif /* V2G_SERVER_H_ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -29,13 +29,13 @@
/* This method has to be implemented! /* This method has to be implemented!
* Send EXI stream (outStream) to EVSE and receive response stream (inStream)*/ * Send EXI stream (outStream) to EVSE and receive response stream (inStream)*/
int serviceDataTransmitter(uint8_t* outStream, uint16_t outStreamLength, uint8_t* inStream) int serviceDataTransmitter(uint8_t* outStream, size_t outStreamLength, uint8_t* inStream)
{ {
/* send output stream to the underlying network to the EVSE and wait for response /* send output stream to the underlying network to the EVSE and wait for response
* --> here provide data to the V2G server directly*/ * --> here provide data to the V2G server directly*/
uint16_t inStreamLength = 0; size_t inStreamLength = 0;
uint16_t payloadLength = 0; size_t payloadLength = 0;
/* setup DoIP header information; outStreamLength==payloadLength*/ /* setup DoIP header information; outStreamLength==payloadLength*/
write_doIPHeader(outStream,&outStreamLength,DOIP_EXI_TYPE); write_doIPHeader(outStream,&outStreamLength,DOIP_EXI_TYPE);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -18,7 +18,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -31,27 +31,26 @@
int sessionSetup(struct SessionSetupReqType* param, struct SessionSetupResType* result) int sessionSetup(struct SessionSetupReqType* param, struct SessionSetupResType* result)
{ {
printf("EVSE: sessionSetup called\n" ); printf("EVSE: sessionSetup called\n" );
printf("\tReceived data:\n"); printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby); printf("\t\t PEVStatus ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked); printf("\t\t PEVStatus ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
/* Prepare data for PEV */ /* Prepare data for PEV */
result->ResponseCode = OK_SessionSetup_responseCode_SessionSetupType; result->ResponseCode = OK_SessionSetup;
result->EVSEID.data[0]=1; result->EVSEID.data[0]='E';
result->EVSEID.arraylen.data=1; result->EVSEID.arraylen.data=1;
result->EVSEStatus.ConnectorLocked=0; result->EVSEStatus.ConnectorLocked=0;
result->EVSEStatus.EVSEStandby=1; result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.FatalError=0; result->EVSEStatus.FatalError=0;
result->EVSEStatus.PowerSwitchClosed=1; result->EVSEStatus.PowerSwitchClosed=1;
result->EVSEStatus.RCD=1; result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345678; result->EVSEStatus.ShutDownTime=12345678L;
result->EVSEStatus.ChargerStandby = 1; result->TCurrent=12345678L;
result->EVSEStatus.EVSEMalfunction = 0;
result->TCurrent=12345678;
return 0; return 0;
} }
int serviceDiscovery(struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result) int serviceDiscovery(struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result)
@ -69,309 +68,28 @@ int paymentDetails(struct PaymentDetailsReqType* param, struct PaymentDetailsRes
return 0; return 0;
} }
int chargeParameterDiscovery(struct ChargeParameterDiscoveryReqType* param, struct ChargeParameterDiscoveryResType* result) int powerDiscovery(struct PowerDiscoveryReqType* param, struct PowerDiscoveryResType* result)
{ {
printf("EVSE: chargeParameterDiscovery called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
if(param->ChargingMode==AC_charging_chargingModeType)
printf("\t\t ChargingMode=AC_charging\n");
else
printf("\t\t ChargingMode=DC_charging\n");
printf("\t\t Eoc=%d\n", param->EoC);
printf("\t\t EAmount=%d\n", param->EAmount.Value);
printf("\t\t PEVMaxPower=%d\n", param->PEVMaxPower.Value);
printf("\t\t PEVMaxPhases=%d\n", param->PEVMaxPhases);
printf("\t\t PEVMaxVoltage=%d\n", param->PEVMaxVoltage.Value);
printf("\t\t PEVMinVoltage=%d\n", param->PEVMinVoltage.Value);
if(param->ChargingMode==DC_charging_chargingModeType)
{
printf("\t\t PEVMaxCurrent=%d\n", param->PEVMaxCurrent.Value);
printf("\t\t PEVMinCurrent=%d\n", param->PEVMinCurrent.Value);
}
result->ResponseCode = 0;
result->EVSEStatus.ConnectorLocked=0;
result->EVSEStatus.FatalError=0;
result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.PowerSwitchClosed=0;
result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345;
result->EVSEStatus.ChargerStandby = 1;
result->EVSEStatus.EVSEMalfunction = 0;
result->EVSEMaxVoltage.Multiplier = 0;
result->EVSEMaxVoltage.Unit = V_unitSymbolType;
result->EVSEMaxVoltage.Value = 950;
result->EVSEMaxPhases = 3;
/* only for DC charging */
result->EVSEMaxCurrent.Multiplier = 0;
result->EVSEMaxCurrent.Unit = A_unitSymbolType;
result->EVSEMaxCurrent.Value = 10;
result->EVSEMinCurrent.Multiplier = 0;
result->EVSEMinCurrent.Unit = A_unitSymbolType;
result->EVSEMinCurrent.Value = 2;
result->isused.EnergyProvider=0;
/*result->EnergyProvider.arraylen.data=1;
result->EnergyProvider.data[0]=11; */
result->isused.TariffTable = 0;
return 0; return 0;
} }
int lineLock(struct LineLockReqType* param, struct LineLockResType* result) int lineLock(struct LineLockReqType* param, struct LineLockResType* result)
{ {
printf("EVSE: lineLock called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
printf("\t\t ReqLockStatus=%d\n", param->ReqLockStatus);
result->ResponseCode = 0;
result->EVSEStatus.ConnectorLocked=0;
result->EVSEStatus.FatalError=0;
result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.PowerSwitchClosed=1;
result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345;
result->EVSEStatus.ChargerStandby = 1;
result->EVSEStatus.EVSEMalfunction = 0;
return 0; return 0;
} }
int powerDelivery(struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result) int powerDelivery(struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result)
{ {
printf("EVSE: powerDelivery called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
result->ResponseCode=0;
result->EVSEStatus.ConnectorLocked=0;
result->EVSEStatus.FatalError=0;
result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.PowerSwitchClosed=1;
result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345;
result->EVSEStatus.ChargerStandby = 1;
result->EVSEStatus.EVSEMalfunction = 0;
return 0; return 0;
} }
int meteringStatus(struct MeteringStatusReqType* param, struct MeteringStatusResType* result) int meteringStatus(struct MeteringStatusReqType* param, struct MeteringStatusResType* result)
{ {
printf("EVSE: meteringStatus called\n" );
result->ResponseCode=1;
result->EVSEID.data[0]=1;
result->EVSEID.arraylen.data=1;
result->EVSEStatus.ConnectorLocked=1;
result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.FatalError=0;
result->EVSEStatus.PowerSwitchClosed=1;
result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345678;
result->EVSEStatus.EVSEMalfunction = 0;
result->EVSEStatus.ChargerStandby = 1;
result->TCurrent=12345678;
result->EVSEMaxPower.Multiplier = 2;
result->EVSEMaxPower.Unit = A_unitSymbolType;
result->EVSEMaxPower.Value = 400;
result->isused.MeterInfo=1;
result->MeterInfo.MeterID.arraylen.data=1;
result->MeterInfo.MeterID.data[0]=2;
result->MeterInfo.MeterReading.Multiplier = 0;
result->MeterInfo.MeterReading.Unit = A_unitSymbolType;
result->MeterInfo.MeterReading.Value = 500;
result->MeterInfo.MeterStatus = 4321;
result->MeterInfo.TMeter =123456789;
result->MeterInfo.isused.MeterID=1;
result->MeterInfo.isused.MeterReading = 1;
result->MeterInfo.isused.MeterStatus=1;
result->MeterInfo.isused.TMeter=1;
result->isused.PCurrent=1;
result->PCurrent.Value=4321;
return 0; return 0;
} }
int meteringReceipt(struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result) int meteringReceipt(struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result)
{ {
printf("EVSE: meteringReceipt called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
printf("\t\t TCurrent=%d\n", param->TCurrent);
printf("\t\t MeterInfo.MeterStatus=%d\n", param->MeterInfo.MeterStatus);
printf("\t\t MeterInfo.MeterID=%d\n", param->MeterInfo.MeterID.data[0]);
printf("\t\t MeterInfo.isused.MeterReading=%d\n", param->MeterInfo.isused.MeterReading);
printf("\t\t MeterReading.Value=%d\n", param->MeterInfo.MeterReading.Value);
printf("\t\t MeterInfo.TMeter=%d\n", param->MeterInfo.TMeter);
if(param->Tariff==Green_charge_tariffIDType)
printf("\t\t Tariff==Green_charge_tariffIDType\n");
result->ResponseCode = 0;
return 0; return 0;
} }
int cableCheck(struct CableCheckReqType* param, struct CableCheckResType* result)
{
printf("EVSE: cableCheck called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
result->EVSEStatus.ConnectorLocked=1;
result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.FatalError=0;
result->EVSEStatus.PowerSwitchClosed=1;
result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345678;
result->EVSEStatus.EVSEMalfunction = 0;
result->EVSEStatus.ChargerStandby = 1;
result->ResponseCode = OK_responseCode_CableCheckType;
return 0;
}
int preCharge(struct PreChargeReqType* param, struct PreChargeResType* result)
{
struct FloatingValueType float_type;
float_type.Multiplier = 0;
float_type.Unit = V_unitSymbolType;
printf("EVSE: currentDemand called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
printf("\t\t PEVDemandCurrent=%d\n",param->PEVDemandCurrent.Value);
printf("\t\t PEVTargetVoltage=%d\n", param->PEVTargetVoltage.Value);
result->ResponseCode=OK_responseCode_CurrentDemandType;
result->EVSEStatus.ConnectorLocked=1;
result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.FatalError=0;
result->EVSEStatus.PowerSwitchClosed=1;
result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345678;
result->EVSEStatus.ChargerStandby=1;
result->EVSEStatus.EVSEMalfunction=0;
result->EVSEStatus.StopCharging=0;
float_type.Value = 800;
result->EVSEPresentVoltage = float_type;
return 0;
}
int currentDemand(struct CurrentDemandReqType* param, struct CurrentDemandResType* result)
{
struct FloatingValueType float_type;
float_type.Multiplier = 0;
printf("EVSE: currentDemand called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
printf("\t\t PEVDemandCurrent=%d\n",param->PEVDemandCurrent.Value);
printf("\t\t PEVTargetVoltage=%d\n", param->PEVTargetVoltage.Value);
result->EVSEStatus.ConnectorLocked=1;
result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.FatalError=0;
result->EVSEStatus.PowerSwitchClosed=1;
result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345678;
result->EVSEStatus.ChargerStandby=1;
result->EVSEStatus.EVSEMalfunction=0;
result->EVSEStatus.StopCharging=0;
result->ResponseCode=OK_responseCode_CurrentDemandType;
float_type.Unit = A_unitSymbolType;
float_type.Value = 40;
result->EVSEPresentCurrent = float_type;
float_type.Unit = V_unitSymbolType;
float_type.Value = 700;
result->EVSEPresentVoltage = float_type;
return 0;
}
int weldingDetection(struct WeldingDetectionReqType* param, struct WeldingDetectionResType* result)
{
struct FloatingValueType float_type;
float_type.Multiplier = 0;
float_type.Unit = V_unitSymbolType;
float_type.Value = 0;
printf("EVSE: weldingDetection called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
result->ResponseCode = OK_responseCode_WeldingDetectionType;
result->EVSEStatus.ConnectorLocked=1;
result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.FatalError=0;
result->EVSEStatus.PowerSwitchClosed=1;
result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345678;
result->EVSEStatus.ChargerStandby=1;
result->EVSEStatus.EVSEMalfunction=0;
result->EVSEStatus.StopCharging=0;
result->EVSEPresentVoltage=float_type;
return 0;
}
int terminateCharging(struct TerminateChargingReqType* param, struct TerminateChargingResType* result)
{
struct FloatingValueType float_type;
float_type.Multiplier = 0;
float_type.Unit = V_unitSymbolType;
float_type.Value =0;
printf("EVSE: terminateCharging called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus:\n\t\t\t ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t\t ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
printf("\t\t\t ReadyToCharge=%d\n", param->PEVStatus.ReadyToCharge);
result->EVSEPresentVoltage = float_type;
result->ResponseCode = OK_responseCode_TerminateChargingType;
return 0;
}

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -19,7 +19,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -39,7 +39,7 @@
#include "doIP.h" #include "doIP.h"
int write_doIPNack(uint8_t* outStream, uint16_t* outStreamLength, uint8_t nackCode) int write_doIPNack(uint8_t* outStream, uint32_t* outStreamLength, uint8_t nackCode)
{ {
/* if(outStreamLength<DOIP_HEADER_LENGTH+1) /* if(outStreamLength<DOIP_HEADER_LENGTH+1)
return -1;*/ return -1;*/
@ -53,7 +53,7 @@ int write_doIPNack(uint8_t* outStream, uint16_t* outStreamLength, uint8_t nackCo
return 0; return 0;
} }
int write_doIPHeader(uint8_t* outStream, uint16_t* outStreamLength, uint16_t payloadType) int write_doIPHeader(uint8_t* outStream, uint32_t* outStreamLength, uint16_t payloadType)
{ {
/* write DoIP version number 1=byte */ /* write DoIP version number 1=byte */
@ -79,7 +79,7 @@ int write_doIPHeader(uint8_t* outStream, uint16_t* outStreamLength, uint16_t pay
return 0; return 0;
} }
int read_doIPHeader(uint8_t* inStream, uint16_t inStreamLength, uint16_t* payloadLength) int read_doIPHeader(uint8_t* inStream, size_t inStreamLength, uint32_t* payloadLength)
{ {
uint16_t payloadType=0; uint16_t payloadType=0;

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2007-2011 Siemens AG * Copyright (C) 2007-2010 Siemens AG
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU Lesser General Public License as published
@ -19,7 +19,7 @@
/******************************************************************* /*******************************************************************
* *
* @author Sebastian.Kaebisch.EXT@siemens.com * @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.4 * @version 0.3
* @contact Joerg.Heuer@siemens.com * @contact Joerg.Heuer@siemens.com
* *
********************************************************************/ ********************************************************************/
@ -55,11 +55,11 @@ extern "C" {
/* DoIP methods */ /* DoIP methods */
int write_doIPNack(uint8_t* outStream, uint16_t* outStreamLength, uint8_t nackCode); int write_doIPNack(uint8_t* outStream, uint32_t* outStreamLength, uint8_t nackCode);
int write_doIPHeader(uint8_t* outStream, uint16_t* outStreamLength, uint16_t payloadType); int write_doIPHeader(uint8_t* outStream, uint32_t* outStreamLength, uint16_t payloadType);
int read_doIPHeader(uint8_t* inStream, uint16_t inStreamLength, uint16_t* payloadLength); int read_doIPHeader(uint8_t* inStream, size_t inStreamLength, uint32_t* payloadLength);
#endif /* DOIP_H_ */ #endif /* DOIP_H_ */