0.3 release zum testen

git-svn-id: https://svn.code.sf.net/p/openv2g/code/trunk@22 d9f2db14-54d0-4bde-b00c-16405c910529
This commit is contained in:
sebastiankb 2010-10-27 13:02:01 +00:00
parent 3e4a8426d8
commit 12bd32bd8a
49 changed files with 3100 additions and 2861 deletions

2054
.cproject

File diff suppressed because it is too large Load diff

138
.project
View file

@ -1,69 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OpenV2G</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/OpenV2G/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OpenV2G</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/OpenV2G/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View file

@ -1,6 +1,6 @@
-------------------------------------------------------------------------
OpenV2G - an open source project implementing the basic functionality of the ISO IEC 15118 vehicle to grid (V2G) communication interface
Version 0.2.1, released October 7, 2010
Version 0.3, released October 27, 2010
http://openv2g.sourceforge.net/
Please report bugs via the SourceForge bug tracking system at http://sourceforge.net/tracker/?group_id=350113.
@ -22,6 +22,22 @@ 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/>.
-------------------------------------------------------------------------
CHANGES from version 0.2.2:
-------------------------------------------------------------------------
* Bug-fixes
* first DoIP implementation
* V2G message error handling
* adaption of V2G schema changes
* code optimizations
-------------------------------------------------------------------------
CHANGES from version 0.2.1:
-------------------------------------------------------------------------
* Bug-fixes
* adaption of V2G schema changes
* some code optimizations
-------------------------------------------------------------------------
CHANGES from version 0.2:
-------------------------------------------------------------------------

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
* Bit decoding functionalities

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -79,22 +79,22 @@ const char * localNames5[] = {
"ChargerStandby", "ChargingProfileEntryMaxPower", "ChargingProfileEntryStart", "ChargingProfileType", "ConnectorLocked",
"Currency", "EPrice", "EVSEStandby", "EVSEStatusType", "Event",
"EventList", "EventListType", "FatalError", "FaultCode", "FaultMsg",
"FloatingValueType", "MeterID", "MeterInfoType", "MeterPubKey", "MeterReading",
"MeterStatus", "Multiplier", "NotificationType", "PEVStatusType", "PowerSwitchClosed",
"ProtocolVersion", "RCD", "Service", "ServiceDescriptionType", "ServiceID",
"ServiceListType", "ServiceName", "ServiceScope", "ServiceSessionID", "ServiceType",
"SessionID", "SessionInformationType", "ShutDownTime", "TMeter", "Tariff",
"TariffDescrType", "TariffDescription", "TariffEntries", "TariffEntriesType", "TariffEntry",
"TariffEntryType", "TariffID", "TariffPMax", "TariffStart", "TariffTableType",
"Unit", "Value", "contractIDType", "currencyType", "energyProviderType",
"eventEntryType", "evseIDType", "fatalErrorType", "faultCodeType", "lockStatusType",
"maxPhasesType", "meterIDType", "meterStatusType", "paymentOptionListType", "paymentOptionType",
"pevIDType", "protocolVersionType", "pubKeyType", "rcdType", "responseCode_LineLockType",
"responseCode_MeteringReceiptType", "responseCode_MeteringStatusType", "responseCode_PaymentDetailsType", "responseCode_PowerDeliveryType", "responseCode_PowerDiscoveryType",
"responseCode_ServiceDiscoveryType", "responseCode_ServicePaymentSelectionType", "responseCode_SessionSetupType", "serviceDetailsType", "serviceIDType",
"serviceNameType", "serviceScopeType", "serviceTypeType", "sessionIDType", "standbyType",
"switchStatusType", "tariffDescriptionType", "tariffIDType", "tariffStartType", "timeType",
"unitMultiplierType", "unitSymbolType"
"FloatingValueType", "MeterID", "MeterInfoType", "MeterReading", "MeterStatus",
"Multiplier", "NotificationType", "PEVStatusType", "PowerSwitchClosed", "ProtocolVersion",
"RCD", "Service", "ServiceDescriptionType", "ServiceID", "ServiceListType",
"ServiceName", "ServiceScope", "ServiceSessionID", "ServiceType", "SessionID",
"SessionInformationType", "ShutDownTime", "TMeter", "Tariff", "TariffDescrType",
"TariffDescription", "TariffEntries", "TariffEntriesType", "TariffEntry", "TariffEntryType",
"TariffID", "TariffPMax", "TariffStart", "TariffTableType", "Unit",
"Value", "contractIDType", "currencyType", "energyProviderType", "eventEntryType",
"evseIDType", "fatalErrorType", "faultCodeType", "lockStatusType", "maxPhasesType",
"meterIDType", "meterStatusType", "paymentOptionListType", "paymentOptionType", "pevIDType",
"protocolVersionType", "pubKeyType", "rcdType", "responseCode_LineLockType", "responseCode_MeteringReceiptType",
"responseCode_MeteringStatusType", "responseCode_PaymentDetailsType", "responseCode_PowerDeliveryType", "responseCode_PowerDiscoveryType", "responseCode_ServiceDiscoveryType",
"responseCode_ServicePaymentSelectionType", "responseCode_SessionSetupType", "serviceDetailsType", "serviceIDType", "serviceNameType",
"serviceScopeType", "serviceTypeType", "sessionIDType", "standbyType", "switchStatusType",
"tariffDescriptionType", "tariffIDType", "tariffStartType", "timeType", "unitMultiplierType",
"unitSymbolType"
};
/* localName entries for URI id = 6 */
const char * localNames6[] = {
@ -107,7 +107,7 @@ struct exiPartition localNamePartitions[7] = {
{ 2, localNames2 },
{ 46, localNames3 },
{ 66, localNames4 },
{ 92, localNames5 },
{ 91, localNames5 },
{ 9, localNames6 }
};
const char * uris[] = {

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -58,9 +58,19 @@ struct v2gService
/* unique id for ambiguous elements */
struct uniqueIDPath idPath;
/* error code */
uint8_t errorCode;
/* offset for transport header data */
uint16_t transportHeaderOffset;
};
/* define error codes (TODO: define precise error codes) */
#define V2G_NON_VALID_MESSAGE 0x01
#define V2G_SERIALIZATION_FAILED 0x02
#define V2G_UNKNOWN_ERROR 0xFF
#endif /* V2G_SERVICE_H_ */

View file

@ -19,7 +19,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -20,7 +20,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -46,7 +46,7 @@ int call_sessionSetup(struct v2gService* service, struct HeaderType* header, str
service->idPath.pos=0;
/* init outStream data structure */
posEncode = 0;
posEncode = service->transportHeaderOffset;
service->outStream.pos = &posEncode;
service->outStream.buffer = 0;
service->outStream.capacity = 8;
@ -55,7 +55,7 @@ int call_sessionSetup(struct v2gService* service, struct HeaderType* header, str
exiInitEncoder(&(service->outStream), &(service->stateEncode));
/* init inStream data structure */
posDecode = 0;
posDecode = service->transportHeaderOffset;
service->inStream.pos = &posDecode;
service->inStream.buffer=0;
service->inStream.capacity=0;
@ -71,14 +71,15 @@ int call_sessionSetup(struct v2gService* service, struct HeaderType* header, str
service->v2gMsg.Body.isused.SessionSetupReq=1;
/* encode data to exi stream*/
if(serialize_message(service)<0)
if(serialize_message(service))
{
return -1;
}
/* send data to server and wait for the response message */
if(serviceDataTransmitter(service->outStream.data, *(service->outStream.pos), service->inStream.data)<0)
service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
if(service->errorCode)
{
return -1;
}
@ -109,7 +110,7 @@ int call_serviceDiscovery(struct v2gService* service, struct HeaderType* header,
service->idPath.pos=0;
/* init outStream data structure */
posEncode = 0;
posEncode = service->transportHeaderOffset;
service->outStream.pos = &posEncode;
service->outStream.buffer = 0;
service->outStream.capacity = 8;
@ -118,7 +119,7 @@ int call_serviceDiscovery(struct v2gService* service, struct HeaderType* header,
exiInitEncoder(&(service->outStream), &(service->stateEncode));
/* init inStream data structure */
posDecode = 0;
posDecode = service->transportHeaderOffset;
service->inStream.pos = &posDecode;
service->inStream.buffer=0;
service->inStream.capacity=0;
@ -134,14 +135,15 @@ int call_serviceDiscovery(struct v2gService* service, struct HeaderType* header,
service->v2gMsg.Body.isused.ServiceDiscoveryReq=1;
/* encode data to exi stream*/
if(serialize_message(service)<0)
if(serialize_message(service))
{
return -1;
}
/* send data to server and wait for the response message */
if(serviceDataTransmitter(service->outStream.data, *(service->outStream.pos), service->inStream.data)<0)
service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
if(service->errorCode)
{
return -1;
}
@ -172,7 +174,7 @@ int call_selectedServicePayment(struct v2gService* service, struct HeaderType* h
service->idPath.pos=0;
/* init outStream data structure */
posEncode = 0;
posEncode = service->transportHeaderOffset;
service->outStream.pos = &posEncode;
service->outStream.buffer = 0;
service->outStream.capacity = 8;
@ -181,7 +183,7 @@ int call_selectedServicePayment(struct v2gService* service, struct HeaderType* h
exiInitEncoder(&(service->outStream), &(service->stateEncode));
/* init inStream data structure */
posDecode = 0;
posDecode = service->transportHeaderOffset;
service->inStream.pos = &posDecode;
service->inStream.buffer=0;
service->inStream.capacity=0;
@ -197,14 +199,15 @@ int call_selectedServicePayment(struct v2gService* service, struct HeaderType* h
service->v2gMsg.Body.isused.ServicePaymentSelectionReq=1;
/* encode data to exi stream*/
if(serialize_message(service)<0)
if(serialize_message(service))
{
return -1;
}
/* send data to server and wait for the response message */
if(serviceDataTransmitter(service->outStream.data, *(service->outStream.pos), service->inStream.data)<0)
service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
if(service->errorCode)
{
return -1;
}
@ -235,7 +238,7 @@ int call_paymentDetails(struct v2gService* service, struct HeaderType* header, s
service->idPath.pos=0;
/* init outStream data structure */
posEncode = 0;
posEncode = service->transportHeaderOffset;
service->outStream.pos = &posEncode;
service->outStream.buffer = 0;
service->outStream.capacity = 8;
@ -244,7 +247,7 @@ int call_paymentDetails(struct v2gService* service, struct HeaderType* header, s
exiInitEncoder(&(service->outStream), &(service->stateEncode));
/* init inStream data structure */
posDecode = 0;
posDecode = service->transportHeaderOffset;
service->inStream.pos = &posDecode;
service->inStream.buffer=0;
service->inStream.capacity=0;
@ -260,14 +263,15 @@ int call_paymentDetails(struct v2gService* service, struct HeaderType* header, s
service->v2gMsg.Body.isused.PaymentDetailsReq=1;
/* encode data to exi stream*/
if(serialize_message(service)<0)
if(serialize_message(service))
{
return -1;
}
/* send data to server and wait for the response message */
if(serviceDataTransmitter(service->outStream.data, *(service->outStream.pos), service->inStream.data)<0)
service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
if(service->errorCode)
{
return -1;
}
@ -298,7 +302,7 @@ int call_powerDiscovery(struct v2gService* service, struct HeaderType* header, s
service->idPath.pos=0;
/* init outStream data structure */
posEncode = 0;
posEncode = service->transportHeaderOffset;
service->outStream.pos = &posEncode;
service->outStream.buffer = 0;
service->outStream.capacity = 8;
@ -307,7 +311,7 @@ int call_powerDiscovery(struct v2gService* service, struct HeaderType* header, s
exiInitEncoder(&(service->outStream), &(service->stateEncode));
/* init inStream data structure */
posDecode = 0;
posDecode = service->transportHeaderOffset;
service->inStream.pos = &posDecode;
service->inStream.buffer=0;
service->inStream.capacity=0;
@ -323,14 +327,15 @@ int call_powerDiscovery(struct v2gService* service, struct HeaderType* header, s
service->v2gMsg.Body.isused.PowerDiscoveryReq=1;
/* encode data to exi stream*/
if(serialize_message(service)<0)
if(serialize_message(service))
{
return -1;
}
/* send data to server and wait for the response message */
if(serviceDataTransmitter(service->outStream.data, *(service->outStream.pos), service->inStream.data)<0)
service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
if(service->errorCode)
{
return -1;
}
@ -361,7 +366,7 @@ int call_lineLock(struct v2gService* service, struct HeaderType* header, struct
service->idPath.pos=0;
/* init outStream data structure */
posEncode = 0;
posEncode = service->transportHeaderOffset;
service->outStream.pos = &posEncode;
service->outStream.buffer = 0;
service->outStream.capacity = 8;
@ -370,7 +375,7 @@ int call_lineLock(struct v2gService* service, struct HeaderType* header, struct
exiInitEncoder(&(service->outStream), &(service->stateEncode));
/* init inStream data structure */
posDecode = 0;
posDecode = service->transportHeaderOffset;
service->inStream.pos = &posDecode;
service->inStream.buffer=0;
service->inStream.capacity=0;
@ -386,14 +391,15 @@ int call_lineLock(struct v2gService* service, struct HeaderType* header, struct
service->v2gMsg.Body.isused.LineLockReq=1;
/* encode data to exi stream*/
if(serialize_message(service)<0)
if(serialize_message(service))
{
return -1;
}
/* send data to server and wait for the response message */
if(serviceDataTransmitter(service->outStream.data, *(service->outStream.pos), service->inStream.data)<0)
service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
if(service->errorCode)
{
return -1;
}
@ -424,7 +430,7 @@ int call_powerDelivery(struct v2gService* service, struct HeaderType* header, st
service->idPath.pos=0;
/* init outStream data structure */
posEncode = 0;
posEncode = service->transportHeaderOffset;
service->outStream.pos = &posEncode;
service->outStream.buffer = 0;
service->outStream.capacity = 8;
@ -433,7 +439,7 @@ int call_powerDelivery(struct v2gService* service, struct HeaderType* header, st
exiInitEncoder(&(service->outStream), &(service->stateEncode));
/* init inStream data structure */
posDecode = 0;
posDecode = service->transportHeaderOffset;
service->inStream.pos = &posDecode;
service->inStream.buffer=0;
service->inStream.capacity=0;
@ -449,14 +455,15 @@ int call_powerDelivery(struct v2gService* service, struct HeaderType* header, st
service->v2gMsg.Body.isused.PowerDeliveryReq=1;
/* encode data to exi stream*/
if(serialize_message(service)<0)
if(serialize_message(service))
{
return -1;
}
/* send data to server and wait for the response message */
if(serviceDataTransmitter(service->outStream.data, *(service->outStream.pos), service->inStream.data)<0)
service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
if(service->errorCode)
{
return -1;
}
@ -487,7 +494,7 @@ int call_meteringStatus(struct v2gService* service, struct HeaderType* header, s
service->idPath.pos=0;
/* init outStream data structure */
posEncode = 0;
posEncode = service->transportHeaderOffset;
service->outStream.pos = &posEncode;
service->outStream.buffer = 0;
service->outStream.capacity = 8;
@ -496,7 +503,7 @@ int call_meteringStatus(struct v2gService* service, struct HeaderType* header, s
exiInitEncoder(&(service->outStream), &(service->stateEncode));
/* init inStream data structure */
posDecode = 0;
posDecode = service->transportHeaderOffset;
service->inStream.pos = &posDecode;
service->inStream.buffer=0;
service->inStream.capacity=0;
@ -511,14 +518,15 @@ int call_meteringStatus(struct v2gService* service, struct HeaderType* header, s
service->v2gMsg.Body.isused.MeteringStatusReq=1;
/* encode data to exi stream*/
if(serialize_message(service)<0)
if(serialize_message(service))
{
return -1;
}
/* send data to server and wait for the response message */
if(serviceDataTransmitter(service->outStream.data, *(service->outStream.pos), service->inStream.data)<0)
service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
if(service->errorCode)
{
return -1;
}
@ -549,7 +557,7 @@ int call_meteringReceipt(struct v2gService* service, struct HeaderType* header,
service->idPath.pos=0;
/* init outStream data structure */
posEncode = 0;
posEncode = service->transportHeaderOffset;
service->outStream.pos = &posEncode;
service->outStream.buffer = 0;
service->outStream.capacity = 8;
@ -558,7 +566,7 @@ int call_meteringReceipt(struct v2gService* service, struct HeaderType* header,
exiInitEncoder(&(service->outStream), &(service->stateEncode));
/* init inStream data structure */
posDecode = 0;
posDecode = service->transportHeaderOffset;
service->inStream.pos = &posDecode;
service->inStream.buffer=0;
service->inStream.capacity=0;
@ -574,14 +582,15 @@ int call_meteringReceipt(struct v2gService* service, struct HeaderType* header,
service->v2gMsg.Body.isused.MeteringReceiptReq=1;
/* encode data to exi stream*/
if(serialize_message(service)<0)
if(serialize_message(service))
{
return -1;
}
/* send data to server and wait for the response message */
if(serviceDataTransmitter(service->outStream.data, *(service->outStream.pos), service->inStream.data)<0)
service->errorCode=serviceDataTransmitter(service->outStream.data, (*(service->outStream.pos)-service->transportHeaderOffset), service->inStream.data);
if(service->errorCode)
{
return -1;
}
@ -650,7 +659,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.MeteringReceiptRes.ResponseCode=service->val.enumeration;
} else if(service->idPath.id[1] == 61)
} else if(service->idPath.id[2] == 61)
{
service->v2gMsg.Body.SessionSetupRes.ResponseCode=service->val.enumeration;
@ -669,6 +678,10 @@ static int deserializeElementCharacter(struct v2gService* service)
/* array copy and array length assignment */
memcpy(service->v2gMsg.Body.SessionSetupRes.EVSEID.data, service->val.binary.data,service->val.binary.len);
service->v2gMsg.Body.SessionSetupRes.EVSEID.arraylen.data = service->val.binary.len;
/* array copy and array length assignment */
memcpy(service->v2gMsg.Body.MeteringStatusRes.EVSEID.data, service->val.binary.data,service->val.binary.len);
service->v2gMsg.Body.MeteringStatusRes.EVSEID.arraylen.data = service->val.binary.len;
}
else
@ -678,9 +691,9 @@ static int deserializeElementCharacter(struct v2gService* service)
break;
case 63: /*TCurrent*/
if(service->val.type == INTEGER_64)
if(service->val.type == INTEGER_32)
{
service->v2gMsg.Body.SessionSetupRes.TCurrent=service->val.int64;
service->v2gMsg.Body.SessionSetupRes.TCurrent=service->val.int32;
}
else
{
@ -738,7 +751,7 @@ static int deserializeElementCharacter(struct v2gService* service)
break;
case 5:
switch(service->eqn.localPart) {
case 35: /*SessionID*/
case 34: /*SessionID*/
if(service->val.type == BINARY_HEX)
{
@ -753,7 +766,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 33: /*ServiceSessionID*/
case 32: /*ServiceSessionID*/
if(service->val.type == BINARY_HEX)
{
@ -770,7 +783,7 @@ static int deserializeElementCharacter(struct v2gService* service)
/* is used */
service->v2gMsg.Header.SessionInformation.isused.ServiceSessionID=1;
break;
case 25: /*ProtocolVersion*/
case 24: /*ProtocolVersion*/
if(service->val.type == STRING)
{
@ -834,7 +847,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.LineLockRes.EVSEStatus.FatalError=service->val.boolean;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEStatus.FatalError=service->val.boolean;
@ -861,7 +874,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.LineLockRes.EVSEStatus.EVSEStandby=service->val.boolean;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEStatus.EVSEStandby=service->val.boolean;
@ -888,7 +901,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.LineLockRes.EVSEStatus.ConnectorLocked=service->val.boolean;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEStatus.ConnectorLocked=service->val.boolean;
@ -900,7 +913,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 24: /*PowerSwitchClosed*/
case 23: /*PowerSwitchClosed*/
if(service->val.type == BOOLEAN)
{
if(service->idPath.id[2] == 61)
@ -915,7 +928,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.LineLockRes.EVSEStatus.PowerSwitchClosed=service->val.boolean;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEStatus.PowerSwitchClosed=service->val.boolean;
@ -927,7 +940,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 26: /*RCD*/
case 25: /*RCD*/
if(service->val.type == BOOLEAN)
{
if(service->idPath.id[2] == 61)
@ -942,7 +955,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.LineLockRes.EVSEStatus.RCD=service->val.boolean;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEStatus.RCD=service->val.boolean;
@ -954,24 +967,24 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 37: /*ShutDownTime*/
if(service->val.type == INTEGER_64)
case 36: /*ShutDownTime*/
if(service->val.type == INTEGER_32)
{
if(service->idPath.id[2] == 61)
{
service->v2gMsg.Body.SessionSetupRes.EVSEStatus.ShutDownTime=service->val.int64;
service->v2gMsg.Body.SessionSetupRes.EVSEStatus.ShutDownTime=service->val.int32;
} else if(service->idPath.id[2] == 43)
{
service->v2gMsg.Body.PowerDiscoveryRes.EVSEStatus.ShutDownTime=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryRes.EVSEStatus.ShutDownTime=service->val.int32;
} else if(service->idPath.id[2] == 13)
{
service->v2gMsg.Body.LineLockRes.EVSEStatus.ShutDownTime=service->val.int64;
service->v2gMsg.Body.LineLockRes.EVSEStatus.ShutDownTime=service->val.int32;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEStatus.ShutDownTime=service->val.int64;
service->v2gMsg.Body.MeteringStatusRes.EVSEStatus.ShutDownTime=service->val.int32;
}
}
@ -981,7 +994,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 29: /*ServiceID*/
case 28: /*ServiceID*/
if(service->val.type == BINARY_HEX)
{
@ -996,7 +1009,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 31: /*ServiceName*/
case 30: /*ServiceName*/
if(service->val.type == STRING)
{
@ -1014,7 +1027,7 @@ static int deserializeElementCharacter(struct v2gService* service)
/* is used */
service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.Service[service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.arraylen.Service].isused.ServiceName=1;
break;
case 34: /*ServiceType*/
case 33: /*ServiceType*/
if(service->val.type == ENUMERATION)
{
service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.Service[service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.arraylen.Service].ServiceType=service->val.enumeration;
@ -1027,7 +1040,7 @@ static int deserializeElementCharacter(struct v2gService* service)
/* is used */
service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.Service[service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.arraylen.Service].isused.ServiceType=1;
break;
case 32: /*ServiceScope*/
case 31: /*ServiceScope*/
if(service->val.type == STRING)
{
@ -1045,7 +1058,7 @@ static int deserializeElementCharacter(struct v2gService* service)
/* is used */
service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.Service[service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.arraylen.Service].isused.ServiceScope=1;
break;
case 21: /*Multiplier*/
case 20: /*Multiplier*/
if(service->val.type == ENUMERATION)
{
if(service->idPath.id[3] == 2)
@ -1076,7 +1089,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEMaxPower.Multiplier=service->val.enumeration;
} else if(service->idPath.id[2] == 25)
} else if(service->idPath.id[3] == 25)
{
service->v2gMsg.Body.MeteringStatusRes.PCurrent.Multiplier=service->val.enumeration;
@ -1084,15 +1097,15 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryMaxPower.Multiplier=service->val.enumeration;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterReading.Multiplier=service->val.enumeration;
} else if(service->idPath.id[7] == 47)
} else if(service->idPath.id[7] == 46)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Multiplier=service->val.enumeration;
} else if(service->idPath.id[6] == 6)
} else if(service->idPath.id[7] == 6)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Multiplier=service->val.enumeration;
@ -1104,7 +1117,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 50: /*Unit*/
case 49: /*Unit*/
if(service->val.type == ENUMERATION)
{
if(service->idPath.id[3] == 2)
@ -1135,7 +1148,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEMaxPower.Unit=service->val.enumeration;
} else if(service->idPath.id[2] == 25)
} else if(service->idPath.id[3] == 25)
{
service->v2gMsg.Body.MeteringStatusRes.PCurrent.Unit=service->val.enumeration;
@ -1143,15 +1156,15 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryMaxPower.Unit=service->val.enumeration;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterReading.Unit=service->val.enumeration;
} else if(service->idPath.id[7] == 47)
} else if(service->idPath.id[7] == 46)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Unit=service->val.enumeration;
} else if(service->idPath.id[6] == 6)
} else if(service->idPath.id[7] == 6)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Unit=service->val.enumeration;
@ -1163,56 +1176,56 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 51: /*Value*/
if(service->val.type == INTEGER_64)
case 50: /*Value*/
if(service->val.type == INTEGER_32)
{
if(service->idPath.id[3] == 2)
{
service->v2gMsg.Body.PowerDiscoveryReq.EAmount.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryReq.EAmount.Value=service->val.int32;
} else if(service->idPath.id[3] == 28)
{
service->v2gMsg.Body.PowerDiscoveryReq.PEVMaxPower.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryReq.PEVMaxPower.Value=service->val.int32;
} else if(service->idPath.id[3] == 29)
{
service->v2gMsg.Body.PowerDiscoveryReq.PEVMaxVoltage.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryReq.PEVMaxVoltage.Value=service->val.int32;
} else if(service->idPath.id[3] == 30)
{
service->v2gMsg.Body.PowerDiscoveryReq.PEVMinVoltage.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryReq.PEVMinVoltage.Value=service->val.int32;
} else if(service->idPath.id[3] == 8)
{
service->v2gMsg.Body.PowerDiscoveryRes.EVSEVoltage.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryRes.EVSEVoltage.Value=service->val.int32;
} else if(service->idPath.id[3] == 4)
{
service->v2gMsg.Body.PowerDiscoveryRes.EVSEIMax.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryRes.EVSEIMax.Value=service->val.int32;
} else if(service->idPath.id[3] == 6)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEMaxPower.Value=service->val.int64;
service->v2gMsg.Body.MeteringStatusRes.EVSEMaxPower.Value=service->val.int32;
} else if(service->idPath.id[2] == 25)
} else if(service->idPath.id[3] == 25)
{
service->v2gMsg.Body.MeteringStatusRes.PCurrent.Value=service->val.int64;
service->v2gMsg.Body.MeteringStatusRes.PCurrent.Value=service->val.int32;
} else if(service->idPath.id[2] == 37)
{
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryMaxPower.Value=service->val.int64;
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryMaxPower.Value=service->val.int32;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterReading.Value=service->val.int64;
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterReading.Value=service->val.int32;
} else if(service->idPath.id[7] == 47)
} else if(service->idPath.id[7] == 46)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Value=service->val.int32;
} else if(service->idPath.id[6] == 6)
} else if(service->idPath.id[7] == 6)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Value=service->val.int32;
}
}
@ -1222,18 +1235,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 48: /*TariffStart*/
if(service->val.type == UNSIGNED_INTEGER_32)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffStart=service->val.uint32;
}
else
{
return -1; /* wrong data type */
}
break;
case 46: /*TariffID*/
case 45: /*TariffID*/
if(service->val.type == ENUMERATION)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffID=service->val.enumeration;
@ -1244,7 +1246,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 41: /*TariffDescription*/
case 40: /*TariffDescription*/
if(service->val.type == STRING)
{
@ -1262,31 +1264,14 @@ static int deserializeElementCharacter(struct v2gService* service)
/* is used */
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].isused.TariffDescription=1;
break;
case 18: /*MeterPubKey*/
if(service->val.type == BINARY_HEX)
{
/* array copy and array length assignment */
memcpy(service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterPubKey.data, service->val.binary.data,service->val.binary.len);
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterPubKey.arraylen.data = service->val.binary.len;
}
else
{
return -1; /* wrong data type */
}
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterPubKey=1;
break;
case 20: /*MeterStatus*/
case 19: /*MeterStatus*/
if(service->val.type == INTEGER_16)
{
if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterStatus=service->val.int32;
} else if(service->idPath.id[1] == 17)
} else if(service->idPath.id[2] == 17)
{
service->v2gMsg.Body.MeteringReceiptReq.MeterInfo.MeterStatus=service->val.int32;
@ -1300,16 +1285,16 @@ static int deserializeElementCharacter(struct v2gService* service)
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterStatus=1;
break;
case 38: /*TMeter*/
if(service->val.type == INTEGER_64)
case 37: /*TMeter*/
if(service->val.type == INTEGER_32)
{
if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.TMeter=service->val.int64;
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.TMeter=service->val.int32;
} else if(service->idPath.id[1] == 17)
} else if(service->idPath.id[2] == 17)
{
service->v2gMsg.Body.MeteringReceiptReq.MeterInfo.TMeter=service->val.int64;
service->v2gMsg.Body.MeteringReceiptReq.MeterInfo.TMeter=service->val.int32;
}
}
@ -1415,12 +1400,12 @@ static int deserializeElement(struct v2gService* service)
}
break;case 5:
switch(service->eqn.localPart) {
case 33:/* ServiceSessionID */
case 32:/* ServiceSessionID */
/* is used */
service->v2gMsg.Header.SessionInformation.isused.ServiceSessionID=1;
break;
case 25:/* ProtocolVersion */
case 24:/* ProtocolVersion */
/* is used */
service->v2gMsg.Header.SessionInformation.isused.ProtocolVersion=1;
@ -1440,17 +1425,17 @@ static int deserializeElement(struct v2gService* service)
/* is used */
service->v2gMsg.Header.Notification.isused.EventList=1;
break;
case 31:/* ServiceName */
case 30:/* ServiceName */
/* is used */
service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.Service[service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.arraylen.Service].isused.ServiceName=1;
break;
case 34:/* ServiceType */
case 33:/* ServiceType */
/* is used */
service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.Service[service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.arraylen.Service].isused.ServiceType=1;
break;
case 32:/* ServiceScope */
case 31:/* ServiceScope */
/* is used */
service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.Service[service->v2gMsg.Body.ServiceDiscoveryRes.ServiceList.arraylen.Service].isused.ServiceScope=1;
@ -1460,7 +1445,7 @@ static int deserializeElement(struct v2gService* service)
/* is used */
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].isused.EPrice=1;
break;
case 41:/* TariffDescription */
case 40:/* TariffDescription */
/* is used */
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].isused.TariffDescription=1;
@ -1470,22 +1455,17 @@ static int deserializeElement(struct v2gService* service)
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterID=1;
break;
case 18:/* MeterPubKey */
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterPubKey=1;
break;
case 19:/* MeterReading */
case 18:/* MeterReading */
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterReading=1;
break;
case 20:/* MeterStatus */
case 19:/* MeterStatus */
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterStatus=1;
break;
case 38:/* TMeter */
case 37:/* TMeter */
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.TMeter=1;
@ -1514,49 +1494,49 @@ static int deserializeElement(struct v2gService* service)
static int deserializeMessage(struct v2gService* service)
{
int noEndOfDocument = 1; /* true */
int errno=0;
int returnCode=0;
do {
exiDecodeNextEvent(&(service->inStream), &(service->stateDecode), &(service->event));
if (errno < 0) {
printf("[ERROR] %d \n", errno);
return errno;
if (returnCode < 0) {
printf("[ERROR] %d \n", returnCode);
return returnCode;
}
switch (service->event) {
case START_DOCUMENT:
errno = exiDecodeStartDocument(&(service->inStream), &(service->stateDecode));
returnCode = exiDecodeStartDocument(&(service->inStream), &(service->stateDecode));
break;
case END_DOCUMENT:
errno = exiDecodeEndDocument(&(service->inStream), &(service->stateDecode));
returnCode = exiDecodeEndDocument(&(service->inStream), &(service->stateDecode));
noEndOfDocument = 0; /* false */
break;
case START_ELEMENT:
errno = exiDecodeStartElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
returnCode = exiDecodeStartElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
service->idPath.id[service->idPath.pos++]=service->eqn.localPart;
break;
case END_ELEMENT:
errno = exiDecodeEndElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
returnCode = exiDecodeEndElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
service->idPath.pos--;
errno = deserializeElement(service);
returnCode = deserializeElement(service);
break;
case CHARACTERS:
/* decode */
errno = exiDecodeCharacters(&(service->inStream), &(service->stateDecode), &(service->val));
returnCode = exiDecodeCharacters(&(service->inStream), &(service->stateDecode), &(service->val));
/* assign character data to the v2g message structure */
errno = deserializeElementCharacter(service);
returnCode = deserializeElementCharacter(service);
break;
case ATTRIBUTE:
/* decode */
/* errno = exiDecodeAttribute(&isStream, &stateDecode, &eqn, &val); */
/* returnCode = exiDecodeAttribute(&isStream, &stateDecode, &eqn, &val); */
break;
default:
/* ERROR */
@ -1571,7 +1551,7 @@ static int deserializeMessage(struct v2gService* service)
/* Initialize the v2g client */
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)
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)
{
/* init byte array */
@ -1587,6 +1567,8 @@ static int deserializeMessage(struct v2gService* service)
service->outStream.data=outStream;
service->outStream.size=max_outStream_size;
/* init offset for transport protocoll */
service->transportHeaderOffset=transportHeaderOffset;
return 0;
}

View file

@ -22,7 +22,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -96,7 +96,7 @@ extern "C" {
/* Initialize the v2g client */
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);
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

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -19,7 +19,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -314,18 +314,10 @@ static void init_MeterInfoType_MeterID(struct MeterInfoType_MeterID* type)
}
static void init_MeterInfoType_MeterPubKey(struct MeterInfoType_MeterPubKey* type)
{
type->arraylen.data=0;
}
static void init_MeterInfoType(struct MeterInfoType* type)
{
init_MeterInfoType_MeterID(&(type->MeterID));
type->isused.MeterID=0;
init_MeterInfoType_MeterPubKey(&(type->MeterPubKey));
type->isused.MeterPubKey=0;
type->isused.MeterID=0;
type->isused.MeterReading=0;
type->isused.MeterStatus=0;
type->isused.TMeter=0;

View file

@ -19,7 +19,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -128,18 +128,12 @@ enum unitSymbolType
F,
g,
h,
H,
Hz,
Hz_1,
J,
J_s,
kg_J,
min,
N,
C,
ohm,
Pa,
rad,
s,
S,
s_1,
@ -243,6 +237,7 @@ struct selection_SessionInformationType
unsigned int ServiceSessionID:1;
unsigned int ProtocolVersion:1;
};
struct arraylen_SessionInformationType_ProtocolVersion
@ -274,6 +269,7 @@ struct selection_NotificationType
unsigned int FaultMsg:1;
unsigned int EventList:1;
};
struct arraylen_NotificationType_FaultMsg
@ -379,6 +375,7 @@ struct selection_BodyType
unsigned int MeteringReceiptReq:1;
unsigned int MeteringReceiptRes:1;
};
struct arraylen_SessionSetupResType_EVSEID
@ -402,7 +399,7 @@ struct EVSEStatusType
int ConnectorLocked;
int PowerSwitchClosed;
int RCD;
int64_t ShutDownTime;
int32_t ShutDownTime;
};
@ -412,7 +409,7 @@ struct SessionSetupResType
enum responseCode_SessionSetupType ResponseCode;
struct SessionSetupResType_EVSEID EVSEID;
struct EVSEStatusType EVSEStatus;
int64_t TCurrent;
int32_t TCurrent;
};
@ -620,7 +617,7 @@ struct FloatingValueType
{
enum unitMultiplierType Multiplier;
enum unitSymbolType Unit;
int64_t Value;
int32_t Value;
};
@ -628,10 +625,10 @@ struct FloatingValueType
struct PowerDiscoveryReqType
{
struct PEVStatusType PEVStatus;
int64_t EoC;
int32_t EoC;
struct FloatingValueType EAmount;
struct FloatingValueType PEVMaxPower;
int32_t PEVMaxPhases;
int16_t PEVMaxPhases;
struct FloatingValueType PEVMaxVoltage;
struct FloatingValueType PEVMinVoltage;
@ -657,6 +654,7 @@ struct selection_PowerDiscoveryResType
unsigned int EnergyProvider:1;
unsigned int TariffTable:1;
};
struct arraylen_TariffTableType_Currency
@ -691,6 +689,7 @@ struct selection_TariffDescrType
{
unsigned int TariffDescription:1;
};
struct selection_TariffEntryType
@ -753,7 +752,7 @@ struct PowerDiscoveryResType
struct EVSEStatusType EVSEStatus;
struct FloatingValueType EVSEVoltage;
struct FloatingValueType EVSEIMax;
int32_t EVSEMaxPhases;
int16_t EVSEMaxPhases;
struct PowerDiscoveryResType_EnergyProvider EnergyProvider;
struct TariffTableType TariffTable;
struct selection_PowerDiscoveryResType isused;
@ -786,7 +785,7 @@ struct selection_PowerDeliveryReqType
struct ChargingProfileType
{
int64_t ChargingProfileEntryStart;
int32_t ChargingProfileEntryStart;
struct FloatingValueType ChargingProfileEntryMaxPower;
@ -833,8 +832,8 @@ struct MeteringStatusResType_EVSEID
struct selection_MeteringStatusResType
{
unsigned int PCurrent:1;
unsigned int MeterInfo:1;
unsigned int PCurrent:1;
unsigned int MeterInfo:1;
};
@ -856,7 +855,6 @@ struct MeterInfoType_MeterID
struct selection_MeterInfoType
{
unsigned int MeterID:1;
unsigned int MeterPubKey:1;
unsigned int MeterReading:1;
unsigned int MeterStatus:1;
unsigned int TMeter:1;
@ -864,27 +862,12 @@ struct selection_MeterInfoType
};
struct arraylen_MeterInfoType_MeterPubKey
{
size_t data;
};
struct MeterInfoType_MeterPubKey
{
uint8_t data[64];
struct arraylen_MeterInfoType_MeterPubKey arraylen;
};
struct MeterInfoType
{
struct MeterInfoType_MeterID MeterID;
struct MeterInfoType_MeterPubKey MeterPubKey;
struct FloatingValueType MeterReading;
int32_t MeterStatus;
int64_t TMeter;
int16_t MeterStatus;
int32_t TMeter;
struct selection_MeterInfoType isused;
};
@ -894,7 +877,7 @@ struct MeteringStatusResType
enum responseCode_MeteringStatusType ResponseCode;
struct MeteringStatusResType_EVSEID EVSEID;
struct EVSEStatusType EVSEStatus;
int64_t TCurrent;
int32_t TCurrent;
struct FloatingValueType EVSEMaxPower;
struct FloatingValueType PCurrent;
struct MeterInfoType MeterInfo;
@ -928,7 +911,7 @@ struct MeteringReceiptReqType
{
struct MeteringReceiptReqType_PEVID PEVID;
struct PEVStatusType PEVStatus;
int64_t TCurrent;
int32_t TCurrent;
enum tariffIDType Tariff;
struct MeterInfoType MeterInfo;
struct selection_MeteringReceiptReqType isused;

View file

@ -21,7 +21,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -128,9 +128,9 @@ static int deserializeElementCharacter(struct v2gService* service)
break;
case 10: /*EoC*/
if(service->val.type == INTEGER_64)
if(service->val.type == INTEGER_32)
{
service->v2gMsg.Body.PowerDiscoveryReq.EoC=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryReq.EoC=service->val.int32;
}
else
{
@ -185,9 +185,9 @@ static int deserializeElementCharacter(struct v2gService* service)
service->v2gMsg.Body.PowerDeliveryReq.isused.Tariff=1;
break;
case 63: /*TCurrent*/
if(service->val.type == INTEGER_64)
if(service->val.type == INTEGER_32)
{
service->v2gMsg.Body.MeteringReceiptReq.TCurrent=service->val.int64;
service->v2gMsg.Body.MeteringReceiptReq.TCurrent=service->val.int32;
}
else
{
@ -201,7 +201,7 @@ static int deserializeElementCharacter(struct v2gService* service)
break;
case 5:
switch(service->eqn.localPart) {
case 35: /*SessionID*/
case 34: /*SessionID*/
if(service->val.type == BINARY_HEX)
{
@ -216,7 +216,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 33: /*ServiceSessionID*/
case 32: /*ServiceSessionID*/
if(service->val.type == BINARY_HEX)
{
@ -233,7 +233,7 @@ static int deserializeElementCharacter(struct v2gService* service)
/* is used */
service->v2gMsg.Header.SessionInformation.isused.ServiceSessionID=1;
break;
case 25: /*ProtocolVersion*/
case 24: /*ProtocolVersion*/
if(service->val.type == STRING)
{
@ -312,7 +312,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.PowerDeliveryReq.PEVStatus.ConnectorLocked=service->val.boolean;
} else if(service->idPath.id[1] == 17)
} else if(service->idPath.id[2] == 17)
{
service->v2gMsg.Body.MeteringReceiptReq.PEVStatus.ConnectorLocked=service->val.boolean;
@ -343,7 +343,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.PowerDeliveryReq.PEVStatus.ChargerStandby=service->val.boolean;
} else if(service->idPath.id[1] == 17)
} else if(service->idPath.id[2] == 17)
{
service->v2gMsg.Body.MeteringReceiptReq.PEVStatus.ChargerStandby=service->val.boolean;
@ -355,7 +355,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 21: /*Multiplier*/
case 20: /*Multiplier*/
if(service->val.type == ENUMERATION)
{
if(service->idPath.id[3] == 2)
@ -386,7 +386,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEMaxPower.Multiplier=service->val.enumeration;
} else if(service->idPath.id[2] == 25)
} else if(service->idPath.id[3] == 25)
{
service->v2gMsg.Body.MeteringStatusRes.PCurrent.Multiplier=service->val.enumeration;
@ -394,15 +394,15 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryMaxPower.Multiplier=service->val.enumeration;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterReading.Multiplier=service->val.enumeration;
} else if(service->idPath.id[7] == 47)
} else if(service->idPath.id[7] == 46)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Multiplier=service->val.enumeration;
} else if(service->idPath.id[6] == 6)
} else if(service->idPath.id[7] == 6)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Multiplier=service->val.enumeration;
@ -414,7 +414,7 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 50: /*Unit*/
case 49: /*Unit*/
if(service->val.type == ENUMERATION)
{
if(service->idPath.id[3] == 2)
@ -445,7 +445,7 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEMaxPower.Unit=service->val.enumeration;
} else if(service->idPath.id[2] == 25)
} else if(service->idPath.id[3] == 25)
{
service->v2gMsg.Body.MeteringStatusRes.PCurrent.Unit=service->val.enumeration;
@ -453,15 +453,15 @@ static int deserializeElementCharacter(struct v2gService* service)
{
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryMaxPower.Unit=service->val.enumeration;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterReading.Unit=service->val.enumeration;
} else if(service->idPath.id[7] == 47)
} else if(service->idPath.id[7] == 46)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Unit=service->val.enumeration;
} else if(service->idPath.id[6] == 6)
} else if(service->idPath.id[7] == 6)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Unit=service->val.enumeration;
@ -473,56 +473,56 @@ static int deserializeElementCharacter(struct v2gService* service)
}
break;
case 51: /*Value*/
if(service->val.type == INTEGER_64)
case 50: /*Value*/
if(service->val.type == INTEGER_32)
{
if(service->idPath.id[3] == 2)
{
service->v2gMsg.Body.PowerDiscoveryReq.EAmount.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryReq.EAmount.Value=service->val.int32;
} else if(service->idPath.id[3] == 28)
{
service->v2gMsg.Body.PowerDiscoveryReq.PEVMaxPower.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryReq.PEVMaxPower.Value=service->val.int32;
} else if(service->idPath.id[3] == 29)
{
service->v2gMsg.Body.PowerDiscoveryReq.PEVMaxVoltage.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryReq.PEVMaxVoltage.Value=service->val.int32;
} else if(service->idPath.id[3] == 30)
{
service->v2gMsg.Body.PowerDiscoveryReq.PEVMinVoltage.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryReq.PEVMinVoltage.Value=service->val.int32;
} else if(service->idPath.id[3] == 8)
{
service->v2gMsg.Body.PowerDiscoveryRes.EVSEVoltage.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryRes.EVSEVoltage.Value=service->val.int32;
} else if(service->idPath.id[3] == 4)
{
service->v2gMsg.Body.PowerDiscoveryRes.EVSEIMax.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryRes.EVSEIMax.Value=service->val.int32;
} else if(service->idPath.id[3] == 6)
{
service->v2gMsg.Body.MeteringStatusRes.EVSEMaxPower.Value=service->val.int64;
service->v2gMsg.Body.MeteringStatusRes.EVSEMaxPower.Value=service->val.int32;
} else if(service->idPath.id[2] == 25)
} else if(service->idPath.id[3] == 25)
{
service->v2gMsg.Body.MeteringStatusRes.PCurrent.Value=service->val.int64;
service->v2gMsg.Body.MeteringStatusRes.PCurrent.Value=service->val.int32;
} else if(service->idPath.id[2] == 37)
{
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryMaxPower.Value=service->val.int64;
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryMaxPower.Value=service->val.int32;
} else if(service->idPath.id[1] == 23)
} else if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterReading.Value=service->val.int64;
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterReading.Value=service->val.int32;
} else if(service->idPath.id[7] == 47)
} else if(service->idPath.id[7] == 46)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].TariffPMax.Value=service->val.int32;
} else if(service->idPath.id[6] == 6)
} else if(service->idPath.id[7] == 6)
{
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Value=service->val.int64;
service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.TariffEntry[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.Tariff[service->v2gMsg.Body.PowerDiscoveryRes.TariffTable.arraylen.Tariff].TariffEntries.arraylen.TariffEntry].EPrice.Value=service->val.int32;
}
}
@ -533,9 +533,9 @@ static int deserializeElementCharacter(struct v2gService* service)
break;
case 2: /*ChargingProfileEntryStart*/
if(service->val.type == INTEGER_64)
if(service->val.type == INTEGER_32)
{
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryStart=service->val.int64;
service->v2gMsg.Body.PowerDeliveryReq.ChargingProfile.ChargingProfileEntryStart=service->val.int32;
}
else
{
@ -561,31 +561,14 @@ static int deserializeElementCharacter(struct v2gService* service)
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterID=1;
break;
case 18: /*MeterPubKey*/
if(service->val.type == BINARY_HEX)
{
/* array copy and array length assignment */
memcpy(service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterPubKey.data, service->val.binary.data,service->val.binary.len);
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterPubKey.arraylen.data = service->val.binary.len;
}
else
{
return -1; /* wrong data type */
}
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterPubKey=1;
break;
case 20: /*MeterStatus*/
case 19: /*MeterStatus*/
if(service->val.type == INTEGER_16)
{
if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.MeterStatus=service->val.int32;
} else if(service->idPath.id[1] == 17)
} else if(service->idPath.id[2] == 17)
{
service->v2gMsg.Body.MeteringReceiptReq.MeterInfo.MeterStatus=service->val.int32;
@ -599,16 +582,16 @@ static int deserializeElementCharacter(struct v2gService* service)
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterStatus=1;
break;
case 38: /*TMeter*/
if(service->val.type == INTEGER_64)
case 37: /*TMeter*/
if(service->val.type == INTEGER_32)
{
if(service->idPath.id[2] == 23)
{
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.TMeter=service->val.int64;
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.TMeter=service->val.int32;
} else if(service->idPath.id[1] == 17)
} else if(service->idPath.id[2] == 17)
{
service->v2gMsg.Body.MeteringReceiptReq.MeterInfo.TMeter=service->val.int64;
service->v2gMsg.Body.MeteringReceiptReq.MeterInfo.TMeter=service->val.int32;
}
}
@ -676,6 +659,15 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
case 59:/* SessionSetupReq */
/* test, if data length is unequal to the expected payload */
if((service->inStream.size)!= *(service->inStream.pos))
{
service->errorCode = V2G_NON_VALID_MESSAGE;
return -1;
}
/* service call */
sessionSetup(&(service->v2gMsg.Body.SessionSetupReq), &(service->v2gMsg.Body.SessionSetupRes));
@ -683,7 +675,11 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
service->v2gMsg.Body.isused.SessionSetupRes=1;
/* serialize the response data */
serialize_message(service);
if(serialize_message(service))
{
/* serializiation error*/
service->errorCode= V2G_SERIALIZATION_FAILED;
}
@ -691,6 +687,15 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
case 48:/* ServiceDiscoveryReq */
/* test, if data length is unequal to the expected payload */
if((service->inStream.size)!= *(service->inStream.pos))
{
service->errorCode = V2G_NON_VALID_MESSAGE;
return -1;
}
/* service call */
serviceDiscovery(&(service->v2gMsg.Body.ServiceDiscoveryReq), &(service->v2gMsg.Body.ServiceDiscoveryRes));
@ -698,7 +703,11 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
service->v2gMsg.Body.isused.ServiceDiscoveryRes=1;
/* serialize the response data */
serialize_message(service);
if(serialize_message(service))
{
/* serializiation error*/
service->errorCode= V2G_SERIALIZATION_FAILED;
}
@ -706,6 +715,15 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
case 53:/* ServicePaymentSelectionReq */
/* test, if data length is unequal to the expected payload */
if((service->inStream.size)!= *(service->inStream.pos))
{
service->errorCode = V2G_NON_VALID_MESSAGE;
return -1;
}
/* service call */
selectedServicePayment(&(service->v2gMsg.Body.ServicePaymentSelectionReq), &(service->v2gMsg.Body.ServicePaymentSelectionRes));
@ -713,7 +731,11 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
service->v2gMsg.Body.isused.ServicePaymentSelectionRes=1;
/* serialize the response data */
serialize_message(service);
if(serialize_message(service))
{
/* serializiation error*/
service->errorCode= V2G_SERIALIZATION_FAILED;
}
@ -721,6 +743,15 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
case 33:/* PaymentDetailsReq */
/* test, if data length is unequal to the expected payload */
if((service->inStream.size)!= *(service->inStream.pos))
{
service->errorCode = V2G_NON_VALID_MESSAGE;
return -1;
}
/* service call */
paymentDetails(&(service->v2gMsg.Body.PaymentDetailsReq), &(service->v2gMsg.Body.PaymentDetailsRes));
@ -728,7 +759,11 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
service->v2gMsg.Body.isused.PaymentDetailsRes=1;
/* serialize the response data */
serialize_message(service);
if(serialize_message(service))
{
/* serializiation error*/
service->errorCode= V2G_SERIALIZATION_FAILED;
}
@ -736,6 +771,15 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
case 41:/* PowerDiscoveryReq */
/* test, if data length is unequal to the expected payload */
if((service->inStream.size)!= *(service->inStream.pos))
{
service->errorCode = V2G_NON_VALID_MESSAGE;
return -1;
}
/* service call */
powerDiscovery(&(service->v2gMsg.Body.PowerDiscoveryReq), &(service->v2gMsg.Body.PowerDiscoveryRes));
@ -743,7 +787,11 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
service->v2gMsg.Body.isused.PowerDiscoveryRes=1;
/* serialize the response data */
serialize_message(service);
if(serialize_message(service))
{
/* serializiation error*/
service->errorCode= V2G_SERIALIZATION_FAILED;
}
@ -751,6 +799,15 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
case 11:/* LineLockReq */
/* test, if data length is unequal to the expected payload */
if((service->inStream.size)!= *(service->inStream.pos))
{
service->errorCode = V2G_NON_VALID_MESSAGE;
return -1;
}
/* service call */
lineLock(&(service->v2gMsg.Body.LineLockReq), &(service->v2gMsg.Body.LineLockRes));
@ -758,7 +815,11 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
service->v2gMsg.Body.isused.LineLockRes=1;
/* serialize the response data */
serialize_message(service);
if(serialize_message(service))
{
/* serializiation error*/
service->errorCode= V2G_SERIALIZATION_FAILED;
}
@ -766,6 +827,15 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
case 37:/* PowerDeliveryReq */
/* test, if data length is unequal to the expected payload */
if((service->inStream.size)!= *(service->inStream.pos))
{
service->errorCode = V2G_NON_VALID_MESSAGE;
return -1;
}
/* service call */
powerDelivery(&(service->v2gMsg.Body.PowerDeliveryReq), &(service->v2gMsg.Body.PowerDeliveryRes));
@ -773,7 +843,11 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
service->v2gMsg.Body.isused.PowerDeliveryRes=1;
/* serialize the response data */
serialize_message(service);
if(serialize_message(service))
{
/* serializiation error*/
service->errorCode= V2G_SERIALIZATION_FAILED;
}
@ -781,6 +855,15 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
case 21:/* MeteringStatusReq */
/* test, if data length is unequal to the expected payload */
if((service->inStream.size)!= *(service->inStream.pos))
{
service->errorCode = V2G_NON_VALID_MESSAGE;
return -1;
}
/* service call */
meteringStatus(&(service->v2gMsg.Body.MeteringStatusReq), &(service->v2gMsg.Body.MeteringStatusRes));
@ -788,7 +871,11 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
service->v2gMsg.Body.isused.MeteringStatusRes=1;
/* serialize the response data */
serialize_message(service);
if(serialize_message(service))
{
/* serializiation error*/
service->errorCode= V2G_SERIALIZATION_FAILED;
}
@ -796,6 +883,15 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
case 17:/* MeteringReceiptReq */
/* test, if data length is unequal to the expected payload */
if((service->inStream.size)!= *(service->inStream.pos))
{
service->errorCode = V2G_NON_VALID_MESSAGE;
return -1;
}
/* service call */
meteringReceipt(&(service->v2gMsg.Body.MeteringReceiptReq), &(service->v2gMsg.Body.MeteringReceiptRes));
@ -803,7 +899,11 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
service->v2gMsg.Body.isused.MeteringReceiptRes=1;
/* serialize the response data */
serialize_message(service);
if(serialize_message(service))
{
/* serializiation error*/
service->errorCode= V2G_SERIALIZATION_FAILED;
}
@ -812,13 +912,13 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
break;
case 5:
switch(service->eqn.localPart) {
case 33:/* ServiceSessionID */
case 32:/* ServiceSessionID */
/* is used */
service->v2gMsg.Header.SessionInformation.isused.ServiceSessionID=1;
break;
case 25:/* ProtocolVersion */
case 24:/* ProtocolVersion */
/* is used */
@ -848,25 +948,19 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterID=1;
break;
case 18:/* MeterPubKey */
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterPubKey=1;
break;
case 19:/* MeterReading */
case 18:/* MeterReading */
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterReading=1;
break;
case 20:/* MeterStatus */
case 19:/* MeterStatus */
/* is used */
service->v2gMsg.Body.MeteringStatusRes.MeterInfo.isused.MeterStatus=1;
break;
case 38:/* TMeter */
case 37:/* TMeter */
/* is used */
@ -897,49 +991,55 @@ static int deserializeElementOrServiceCall(struct v2gService* service)
static int deserializeMessage(struct v2gService* service)
{
int noEndOfDocument = 1; /* true */
int errno=0;
int returnCode=0;
do {
exiDecodeNextEvent(&(service->inStream), &(service->stateDecode), &(service->event));
if (errno < 0) {
printf("[ERROR] %d \n", errno);
return errno;
if (returnCode)
{
if(service->errorCode==0)
{
service->errorCode= V2G_NON_VALID_MESSAGE;
}
return returnCode;
}
switch (service->event) {
case START_DOCUMENT:
errno = exiDecodeStartDocument(&(service->inStream), &(service->stateDecode));
returnCode = exiDecodeStartDocument(&(service->inStream), &(service->stateDecode));
break;
case END_DOCUMENT:
errno = exiDecodeEndDocument(&(service->inStream), &(service->stateDecode));
returnCode = exiDecodeEndDocument(&(service->inStream), &(service->stateDecode));
noEndOfDocument = 0; /* false */
break;
case START_ELEMENT:
errno = exiDecodeStartElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
returnCode = exiDecodeStartElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
service->idPath.id[service->idPath.pos++]=service->eqn.localPart;
break;
case END_ELEMENT:
errno = exiDecodeEndElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
errno = deserializeElementOrServiceCall(service);
returnCode = exiDecodeEndElement(&(service->inStream), &(service->stateDecode), &(service->eqn));
returnCode = deserializeElementOrServiceCall(service);
service->idPath.pos--;
break;
case CHARACTERS:
/* decode */
errno = exiDecodeCharacters(&(service->inStream), &(service->stateDecode), &(service->val));
returnCode = exiDecodeCharacters(&(service->inStream), &(service->stateDecode), &(service->val));
/* assign data to the v2g message structure */
errno = deserializeElementCharacter(service);
returnCode = deserializeElementCharacter(service);
break;
case ATTRIBUTE:
/* decode */
/* errno = exiDecodeAttribute(&isStream, &stateDecode, &eqn, &val); */
/* returnCode = exiDecodeAttribute(&isStream, &stateDecode, &eqn, &val); */
break;
default:
/* ERROR */
@ -956,28 +1056,30 @@ static int deserializeMessage(struct v2gService* service)
* Takes the EXI stream, invokes the called service method, and provides the response EXI stream
* @return 0 = 0K; -1 = ERROR
*/
int messageDispatcher(struct v2gService* service, uint8_t* inStream, size_t sizeInStream, size_t* inPos, uint8_t* outStream, size_t sizeOutStream, size_t* outPos)
int messageDispatcher(struct v2gService* service, uint8_t* inStream, size_t sizeInStream, uint8_t* outStream, size_t sizeOutStream, size_t* outStreamLength)
{
int responseCode;
size_t inPos, outPos;
/* assign inStream data to service v2g structure */
inPos = service->transportHeaderOffset;
service->inStream.data = inStream;
service->inStream.size = sizeInStream;
service->inStream.pos = inPos;
service->inStream.size = sizeInStream+inPos;
service->inStream.pos = &inPos;
service->inStream.buffer=0;
service->inStream.capacity=0;
/* assign outStream data to service v2g structure */
outPos=service->transportHeaderOffset;
service->outStream.data = outStream;
service->outStream.size = sizeOutStream;
service->outStream.pos = outPos;
service->outStream.pos = &outPos;
service->outStream.buffer=0;
service->outStream.capacity=8;
/* clear error code */
service->errorCode = 0;
/* init EXI decoder (read header, set initial state) */
exiInitDecoder(&(service->inStream), &(service->stateDecode));
@ -992,30 +1094,24 @@ int messageDispatcher(struct v2gService* service, uint8_t* inStream, size_t size
init_AnonType_V2G_Message(&(service->v2gMsg));
/* deserialize the input stream and call the corresponding service */
responseCode = deserializeMessage(service);
if(responseCode<0)
if(deserializeMessage(service))
{
/* an error occurred */
return -1;
} else if(responseCode==1)
{
return 0;
return -1; /* something went wrong */
}
/* determine payload size (without transport offset) */
outPos -= service->transportHeaderOffset;
*outStreamLength = outPos;
return 0;
}
/**
* Init the service
* @return 0 = 0K; -1 = ERROR
*/
int init_v2gservice(struct v2gService* service, bytes_t bytes, string_ucs_t string)
int init_v2gservice(struct v2gService* service, bytes_t bytes, string_ucs_t string, uint16_t transportHeaderOffset)
{
/* init byte array */
@ -1024,6 +1120,8 @@ int init_v2gservice(struct v2gService* service, bytes_t bytes, string_ucs_t stri
/* init string array */
service->val.string = string;
/* init offset for transport protocoll */
service->transportHeaderOffset=transportHeaderOffset;
return 0;
}

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -33,8 +33,8 @@ extern "C" {
#include "v2g_serviceDataTypes.h"
int init_v2gservice(struct v2gService* service,bytes_t bytes, string_ucs_t string);
int messageDispatcher(struct v2gService* service, uint8_t* inStream, size_t sizeInStream, size_t* inPos, uint8_t* outStream, size_t sizeOutStream, size_t* outPos);
int init_v2gservice(struct v2gService* service,bytes_t bytes, string_ucs_t string, uint16_t transportHeaderOffset);
int messageDispatcher(struct v2gService* service, uint8_t* inStream, size_t sizeInStream, uint8_t* outStream, size_t sizeOutStream, size_t* outPos);
#endif /* V2GSERVER_H_ */

View file

@ -22,7 +22,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/

View file

@ -19,10 +19,10 @@
*
* @author Daniel.Peintner.EXT@siemens.com
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
* <p>Switch for sample programs: EXI codec only or for entire service</p>
* <p>Switch for sample programs: EXI codec only or for entire V2G service</p>
*
********************************************************************/
@ -33,12 +33,10 @@
int main(int argc, char *argv[]) {
/* EXI codec only */
/* return main_codec(argc, argv);*/
/*return main_codec(argc, argv);*/
/* V2G client / service example scenario */
return main_service(argc, argv);
/* network example 1 */
/* return main_network_1(argc, argv); */
}

View file

@ -19,7 +19,7 @@
*
* @author Daniel.Peintner.EXT@siemens.com
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
*
@ -30,6 +30,5 @@
int main_codec(int argc, char *argv[]);
int main_service(int argc, char *argv[]);
int main_network_1(int argc, char *argv[]);
#endif

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Daniel.Peintner.EXT@siemens.com
* @version 0.1
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
* <p>Sample program to illustrate how to read an EXI stream and
@ -47,7 +47,7 @@ uint8_t bufferOut[BUFFER_SIZE];
uint8_t data[ARRAY_SIZE_BYTES];
uint32_t codepoints[ARRAY_SIZE_STRINGS];
int mainX(int argc, char *argv[]) {
int main_codec(int argc, char *argv[]) {
int errn = 0;
unsigned int i;

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -29,6 +29,7 @@
#include "v2g_serviceDataTypes.h"
#include "v2g_serviceClientStubs.h"
#include "EXITypes.h"
#include "doIP.h"
#include <stdio.h>
@ -36,6 +37,8 @@
#define MAX_STRING_SIZE 256
#define MAX_STREAM_SIZE 60
static void printErrorMessage(struct v2gService* service);
int main_service(int argc, char *argv[])
{
@ -46,14 +49,19 @@ int main_service(int argc, char *argv[])
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 v2gService service;
struct HeaderType v2gHeader;
struct SessionSetupReqType sessionSetup;
struct SessionSetupResType resultSessionSetup;
/* struct PowerDiscoveryReqType powerDiscovery;
struct PowerDiscoveryResType resultPowerDiscovery;
*/
/*struct PowerDiscoveryReqType powerDiscovery;
struct PowerDiscoveryResType resultPowerDiscovery; */
/* BINARY memory setup */
bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 };
@ -61,6 +69,9 @@ int main_service(int argc, char *argv[])
/* 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;
printf("+++Start V2G Client / Service Example+++\n\n");
@ -69,7 +80,7 @@ int main_service(int argc, char *argv[])
* Init V2G Client *
*******************/
init_v2gServiceClient(&service,bytes,string,inStream,MAX_STREAM_SIZE, outStream, MAX_STREAM_SIZE);
init_v2gServiceClient(&service,bytes,string,inStream,MAX_STREAM_SIZE, outStream, MAX_STREAM_SIZE, transportHeaderOffset);
/*******************************
* Setup data for sessionSetup *
@ -82,32 +93,50 @@ int main_service(int argc, char *argv[])
v2gHeader.SessionInformation.isused.ProtocolVersion = 1; /* important: signalize, protocol version is used */
v2gHeader.isused.Notification=0; /* no notification */
/* setup sessionSetup parameters */
/* setup sessionSetup parameter */
sessionSetup.isused.PEVID=1; /* no PEVID is transported */
sessionSetup.PEVStatus.ChargerStandby=1; /* charger standby = true */
sessionSetup.PEVStatus.ConnectorLocked=0; /* connector locked = false */
printf("PEV: call EVSE sessionSetup\n");
/*********************
* Call sessionSetup *
*********************/
call_sessionSetup(&service,&v2gHeader,&sessionSetup,&resultSessionSetup);
/* show results of the answer message of EVSE sessionSetup*/
printf("PEV: received response message from EVSE\n");
printf("\tResponseCode=%d\n",resultSessionSetup.ResponseCode);
printf("\tEVSEID=%d\n", resultSessionSetup.EVSEID.data[0]);
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=%lld\n",resultSessionSetup.EVSEStatus.ShutDownTime);
printf("\tTCurrent=%lld\n",resultSessionSetup.TCurrent);
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\n",resultSessionSetup.ResponseCode);
printf("\tEVSEID=%d\n", resultSessionSetup.EVSEID.data[0]);
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("\n+++Terminate V2G Client / Service Example+++");
return 0;
}
static void printErrorMessage(struct v2gService* service)
{
if(service->errorCode==V2G_NON_VALID_MESSAGE)
{
printf("PEV did not send a valid V2G message!\n");
}
else if(service->errorCode==V2G_SERIALIZATION_FAILED)
{
printf("EVSE error: Could not serialize the response message\n");
}
}

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
@ -26,18 +26,19 @@
#include "v2g_server.h"
#include "v2g_service.h"
#include "v2g_serviceDispatcher.h"
#include "doIP.h"
#define MAX_BYTE_SIZE 128
#define MAX_STRING_SIZE 256
#define MAX_STREAM_SIZE 60
/* Simple EVSE server implementation */
int testV2GService(uint8_t* inStream, size_t inStreamLength, uint8_t* outStream)
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 uint32_t string_array[MAX_STRING_SIZE]; /* define MAX_STRING_SIZE before*/
size_t posIn, posOut;
size_t exiMsgLength;
struct v2gService service;
@ -49,22 +50,41 @@ int testV2GService(uint8_t* inStream, size_t inStreamLength, uint8_t* outStream)
/**********************************************
* Init V2G server and initialize array types *
* for the EXI decoding *
* for the EXI decoding as well as the offset *
* for the transportation header *
**********************************************/
init_v2gservice(&service, bytes, string);
init_v2gservice(&service, bytes, string, DOIP_HEADER_LENGTH);
/* assign the position where to read / write in the inStream / outStream */
posIn=0;
posOut=0;
/* check, if the DoIP header is correct and determine payload */
if(read_doIPHeader(inStream,inStreamLength, &exiMsgLength))
{
/* DoIP header not correct */
write_doIPNack(outStream, outStreamLength, service.errorCode);
return -1;
}
/****************************************************************************
* Pass the received EXI message stream (inStream + inStreamLength) to the *
* message dispatcher. The outStream contains the response message stream. *
* posOut==length of outStream *
* Pass the received EXI message stream (inStream + exiMsgLength) to the *
* v2g message dispatcher. The outStream contains the response message *
* stream. *
****************************************************************************/
messageDispatcher(&service, inStream, inStreamLength, &posIn, outStream, MAX_STREAM_SIZE, &posOut);
if(messageDispatcher(&service, inStream, exiMsgLength, outStream, MAX_STREAM_SIZE, outStreamLength))
{
/* write DoIP failure */
write_doIPNack(outStream, outStreamLength, service.errorCode);
}
else
{
/* write DoIP header */
write_doIPHeader(outStream, outStreamLength, DOIP_EXI_TYPE);
}
return 0;
}

View file

@ -18,15 +18,16 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#ifndef V2G_SERVER_H_
#define V2G_SERVER_H_
#include "EXITypes.h"
int testV2GService(uint8_t* inStream, size_t inStreamLength, uint8_t* outStream);
int testV2GService(uint8_t* inStream, size_t inStreamLength, uint8_t* outStream,size_t* outStreamLength);
#endif /* V2G_SERVER_H_ */

View file

@ -18,14 +18,14 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#include "v2g_serviceClientDataTransmitter.h"
#include "v2g_server.h"
#include "doip.h"
/* This method has to be implemented!
* Send EXI stream (outStream) to EVSE and receive response stream (inStream)*/
@ -34,7 +34,14 @@ int serviceDataTransmitter(uint8_t* outStream, size_t outStreamLength, uint8_t*
/* send output stream to the underlying network to the EVSE and wait for response
* --> here provide data to the V2G server directly*/
testV2GService(outStream, outStreamLength, inStream);
size_t inStreamLength = 0;
size_t payloadLength = 0;
return 0;
/* setup DoIP header information; outStreamLength==payloadLength*/
write_doIPHeader(outStream,&outStreamLength,DOIP_EXI_TYPE);
/* send data to EVSE server (add DoIP offset)*/
testV2GService(outStream, outStreamLength, inStream, &inStreamLength);
return read_doIPHeader(inStream,inStreamLength, &payloadLength);
}

View file

@ -18,7 +18,7 @@
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2.2
* @version 0.3
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/