- service implementation

- service / client example
This commit is contained in:
sebastiankb 2010-10-01 15:44:35 +00:00
parent 5de40bdd8e
commit 836d87b613
21 changed files with 11143 additions and 1058 deletions

View file

@ -32,11 +32,13 @@
<option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.294845555" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> <option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.294845555" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.773068816" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> <option id="gnu.c.compiler.option.include.paths.773068816" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/OpenV2G/src/codec}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/OpenV2G/src/codec}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/OpenV2G/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/OpenV2G/src/service}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/OpenV2G/src/service}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/OpenV2G/src/service}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/OpenV2G/src/test}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/OpenV2G/src/test}&quot;"/>
</option> </option>
<option id="gnu.c.compiler.option.warnings.pedantic.1676854851" superClass="gnu.c.compiler.option.warnings.pedantic" value="true" valueType="boolean"/> <option id="gnu.c.compiler.option.warnings.pedantic.1676854851" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="true" valueType="boolean"/>
<option id="gnu.c.compiler.option.misc.ansi.722225100" superClass="gnu.c.compiler.option.misc.ansi" value="true" valueType="boolean"/> <option id="gnu.c.compiler.option.misc.ansi.722225100" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi" value="true" valueType="boolean"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.67299528" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.67299528" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool> </tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.867726048" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"> <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.867726048" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug">
@ -472,6 +474,7 @@
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
</cconfiguration> </cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450"> <cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450" moduleId="org.eclipse.cdt.core.settings" name="Release"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450" moduleId="org.eclipse.cdt.core.settings" name="Release">
@ -930,6 +933,7 @@
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
</cconfiguration> </cconfiguration>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -59,19 +59,20 @@ const char * localNames3[] = {
}; };
/* localName entries for URI id = 4 */ /* localName entries for URI id = 4 */
const char * localNames4[] = { const char * localNames4[] = {
"ContractID", "EAmount", "EVSEID", "EVSEIMax", "EVSEMaxPhases", "ChargingProfile", "ContractID", "EAmount", "EVSEID", "EVSEIMax",
"EVSEMaxPower", "EVSEStatus", "EVSEVoltage", "EnergyProvider", "EoC", "EVSEMaxPhases", "EVSEMaxPower", "EVSEStatus", "EVSEVoltage", "EnergyProvider",
"LineLockReq", "LineLockReqType", "LineLockRes", "LineLockResType", "MeterInfo", "EoC", "LineLockReq", "LineLockReqType", "LineLockRes", "LineLockResType",
"MeteringAuthPubKey", "MeteringReceiptReq", "MeteringReceiptReqType", "MeteringReceiptRes", "MeteringReceiptResType", "MeterInfo", "MeteringAuthPubKey", "MeteringReceiptReq", "MeteringReceiptReqType", "MeteringReceiptRes",
"MeteringStatusReq", "MeteringStatusReqType", "MeteringStatusRes", "MeteringStatusResType", "PCurrent", "MeteringReceiptResType", "MeteringStatusReq", "MeteringStatusReqType", "MeteringStatusRes", "MeteringStatusResType",
"PEVID", "PEVMaxPhases", "PEVMaxPower", "PEVMaxVoltage", "PEVMinVoltage", "PCurrent", "PEVID", "PEVMaxPhases", "PEVMaxPower", "PEVMaxVoltage",
"PEVPubKey", "PEVStatus", "PaymentDetailsReq", "PaymentDetailsReqType", "PaymentDetailsRes", "PEVMinVoltage", "PEVPubKey", "PEVStatus", "PaymentDetailsReq", "PaymentDetailsReqType",
"PaymentDetailsResType", "PowerDeliveryReq", "PowerDeliveryReqType", "PowerDeliveryRes", "PowerDeliveryResType", "PaymentDetailsRes", "PaymentDetailsResType", "PowerDeliveryReq", "PowerDeliveryReqType", "PowerDeliveryRes",
"PowerDiscoveryReq", "PowerDiscoveryReqType", "PowerDiscoveryRes", "PowerDiscoveryResType", "ReqLockStatus", "PowerDeliveryResType", "PowerDiscoveryReq", "PowerDiscoveryReqType", "PowerDiscoveryRes", "PowerDiscoveryResType",
"ReqSwitchStatus", "ResponseCode", "ServiceDiscoveryReq", "ServiceDiscoveryReqType", "ServiceDiscoveryRes", "ReqLockStatus", "ReqSwitchStatus", "ResponseCode", "ServiceDiscoveryReq", "ServiceDiscoveryReqType",
"ServiceDiscoveryResType", "ServiceList", "ServicePaymentSelectionReq", "ServicePaymentSelectionReqType", "ServicePaymentSelectionRes", "ServiceDiscoveryRes", "ServiceDiscoveryResType", "ServiceList", "ServicePaymentSelectionReq", "ServicePaymentSelectionReqType",
"ServicePaymentSelectionResType", "ServiceScope", "ServiceType", "SessionSetupReq", "SessionSetupReqType", "ServicePaymentSelectionRes", "ServicePaymentSelectionResType", "ServiceScope", "ServiceType", "SessionSetupReq",
"SessionSetupRes", "SessionSetupResType", "TCurrent", "Tariff" "SessionSetupReqType", "SessionSetupRes", "SessionSetupResType", "TCurrent", "Tariff",
"TariffTable"
}; };
/* localName entries for URI id = 5 */ /* localName entries for URI id = 5 */
const char * localNames5[] = { const char * localNames5[] = {
@ -80,20 +81,20 @@ const char * localNames5[] = {
"EventList", "EventListType", "FatalError", "FaultCode", "FaultMsg", "EventList", "EventListType", "FatalError", "FaultCode", "FaultMsg",
"FloatingValueType", "MeterID", "MeterInfoType", "MeterPubKey", "MeterReading", "FloatingValueType", "MeterID", "MeterInfoType", "MeterPubKey", "MeterReading",
"MeterStatus", "Multiplier", "NotificationType", "PEVStatusType", "PowerSwitchClosed", "MeterStatus", "Multiplier", "NotificationType", "PEVStatusType", "PowerSwitchClosed",
"ProtocolVersion", "RCD", "Service", "ServiceDescriptionType", "ServiceDetails", "ProtocolVersion", "RCD", "Service", "ServiceDescriptionType", "ServiceID",
"ServiceID", "ServiceListType", "ServiceName", "ServiceScope", "ServiceSessionID", "ServiceListType", "ServiceName", "ServiceScope", "ServiceSessionID", "ServiceType",
"ServiceType", "SessionID", "SessionInformationType", "ShutDownTime", "TMeter", "SessionID", "SessionInformationType", "ShutDownTime", "TMeter", "Tariff",
"Tariff", "TariffDescrType", "TariffDescription", "TariffEntries", "TariffEntriesType", "TariffDescrType", "TariffDescription", "TariffEntries", "TariffEntriesType", "TariffEntry",
"TariffEntry", "TariffEntryType", "TariffID", "TariffPMax", "TariffStart", "TariffEntryType", "TariffID", "TariffPMax", "TariffStart", "TariffTableType",
"TariffTableType", "Unit", "Value", "contractIDType", "currencyType", "Unit", "Value", "contractIDType", "currencyType", "energyProviderType",
"energyProviderType", "eventEntryType", "evseIDType", "fatalErrorType", "faultCodeType", "eventEntryType", "evseIDType", "fatalErrorType", "faultCodeType", "lockStatusType",
"lockStatusType", "maxPhasesType", "meterIDType", "meterStatusType", "paymentOptionListType", "maxPhasesType", "meterIDType", "meterStatusType", "paymentOptionListType", "paymentOptionType",
"paymentOptionType", "pevIDType", "protocolVersionType", "pubKeyType", "rcdType", "pevIDType", "protocolVersionType", "pubKeyType", "rcdType", "responseCode_LineLockType",
"responseCode_LineLockType", "responseCode_MeteringReceiptType", "responseCode_MeteringStatusType", "responseCode_PaymentDetailsType", "responseCode_PowerDeliveryType", "responseCode_MeteringReceiptType", "responseCode_MeteringStatusType", "responseCode_PaymentDetailsType", "responseCode_PowerDeliveryType", "responseCode_PowerDiscoveryType",
"responseCode_PowerDiscoveryType", "responseCode_ServiceDiscoveryType", "responseCode_ServicePaymentSelectionType", "responseCode_SessionSetupType", "serviceDetailsType", "responseCode_ServiceDiscoveryType", "responseCode_ServicePaymentSelectionType", "responseCode_SessionSetupType", "serviceDetailsType", "serviceIDType",
"serviceIDType", "serviceNameType", "serviceScopeType", "serviceTypeType", "sessionIDType", "serviceNameType", "serviceScopeType", "serviceTypeType", "sessionIDType", "standbyType",
"standbyType", "switchStatusType", "tariffDescriptionType", "tariffIDType", "tariffStartType", "switchStatusType", "tariffDescriptionType", "tariffIDType", "tariffStartType", "timeType",
"timeType", "unitMultiplierType", "unitSymbolType" "unitMultiplierType", "unitSymbolType"
}; };
/* localName entries for URI id = 6 */ /* localName entries for URI id = 6 */
const char * localNames6[] = { const char * localNames6[] = {
@ -105,8 +106,8 @@ struct exiPartition localNamePartitions[7] = {
{ 4, localNames1 }, { 4, localNames1 },
{ 2, localNames2 }, { 2, localNames2 },
{ 46, localNames3 }, { 46, localNames3 },
{ 64, localNames4 }, { 66, localNames4 },
{ 93, localNames5 }, { 92, localNames5 },
{ 9, localNames6 } { 9, localNames6 }
}; };
const char * uris[] = { const char * uris[] = {

58
src/service/v2g_service.h Normal file
View file

@ -0,0 +1,58 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef V2G_SERVICE_H_
#define V2G_SERVICE_H_
#include "v2g_serviceDataTypes.h"
#include "../codec/EXITypes.h"
struct v2gService
{
/* in-/ out-stream */
bitstream_t inStream;
bitstream_t outStream;
/* EXI */
exi_state_t stateDecode;
exi_state_t stateEncode;
exi_event_t event;
eqname_t eqn;
exi_value_t val;
/* v2g message data structure */
struct AnonType_V2G_Message v2gMsg;
};
#endif /* V2G_SERVICE_H_ */
#ifdef __cplusplus
}
#endif

View file

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

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,105 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SERVICECLIENTSTUBS_H
#define SERVICECLIENTSTUBS_H
#include "v2g_service.h"
#include "v2g_serviceDataTypes.h"
#include "v2g_serviceClientStubs.h"
/* call sessionSetup */
int call_sessionSetup(struct v2gService* service, struct HeaderType* header, struct SessionSetupReqType* params, struct SessionSetupResType* result);
/* call serviceDiscovery */
int call_serviceDiscovery(struct v2gService* service, struct HeaderType* header, struct ServiceDiscoveryReqType* params, struct ServiceDiscoveryResType* result);
/* call selectedServicePayment */
int call_selectedServicePayment(struct v2gService* service, struct HeaderType* header, struct ServicePaymentSelectionReqType* params, struct ServicePaymentSelectionResType* result);
/* call paymentDetails */
int call_paymentDetails(struct v2gService* service, struct HeaderType* header, struct PaymentDetailsReqType* params, struct PaymentDetailsResType* result);
/* call powerDiscovery */
int call_powerDiscovery(struct v2gService* service, struct HeaderType* header, struct PowerDiscoveryReqType* params, struct PowerDiscoveryResType* result);
/* call lineLock */
int call_lineLock(struct v2gService* service, struct HeaderType* header, struct LineLockReqType* params, struct LineLockResType* result);
/* call powerDelivery */
int call_powerDelivery(struct v2gService* service, struct HeaderType* header, struct PowerDeliveryReqType* params, struct PowerDeliveryResType* result);
/* call meteringStatus */
int call_meteringStatus(struct v2gService* service, struct HeaderType* header, struct MeteringStatusResType* result);
/* call meteringReceipt */
int call_meteringReceipt(struct v2gService* service, struct HeaderType* header, struct MeteringReceiptReqType* params, struct MeteringReceiptResType* result);
/* 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);
#endif
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef V2GSERVICEDATASERIAL_H_
#define V2GSERVICEDATASERIAL_H_
#include "v2g_service.h"
int serialize_message(struct v2gService* service);
#endif /* V2GSERVICEDATASERIAL_H_ */
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,429 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#include "../codec/EXITypes.h"
#include "v2g_serviceDataTypes.h"
static void init_SessionInformationType_SessionID(struct SessionInformationType_SessionID* type)
{
type->arraylen.data=0;
}
static void init_SessionInformationType_ServiceSessionID(struct SessionInformationType_ServiceSessionID* type)
{
type->arraylen.data=0;
}
static void init_SessionInformationType_ProtocolVersion(struct SessionInformationType_ProtocolVersion* type)
{
type->arraylen.data=0;
}
static void init_SessionInformationType(struct SessionInformationType* type)
{
init_SessionInformationType_SessionID(&(type->SessionID));
init_SessionInformationType_ServiceSessionID(&(type->ServiceSessionID));
type->isused.ServiceSessionID=0;
init_SessionInformationType_ProtocolVersion(&(type->ProtocolVersion));
type->isused.ProtocolVersion=0;
}
static void init_NotificationType_FaultMsg(struct NotificationType_FaultMsg* type)
{
type->arraylen.data=0;
}
static void init_NotificationType(struct NotificationType* type)
{
type->isused.FaultCode=0;
init_NotificationType_FaultMsg(&(type->FaultMsg));
type->isused.FaultMsg=0;
type->isused.EventList=0;
}
static void init_HeaderType(struct HeaderType* type)
{
init_SessionInformationType(&(type->SessionInformation));
init_NotificationType(&(type->Notification));
type->isused.Notification=0;
}
static void init_SessionSetupReqType_PEVID(struct SessionSetupReqType_PEVID* type)
{
type->arraylen.data=0;
}
static void init_SessionSetupReqType(struct SessionSetupReqType* type)
{
init_SessionSetupReqType_PEVID(&(type->PEVID));
type->isused.PEVID=0;
}
static void init_SessionSetupResType_EVSEID(struct SessionSetupResType_EVSEID* type)
{
type->arraylen.data=0;
}
static void init_SessionSetupResType(struct SessionSetupResType* type)
{
init_SessionSetupResType_EVSEID(&(type->EVSEID));
}
static void init_ServiceDiscoveryReqType_ServiceScope(struct ServiceDiscoveryReqType_ServiceScope* type)
{
type->arraylen.data=0;
}
static void init_ServiceDiscoveryReqType(struct ServiceDiscoveryReqType* type)
{
type->isused.ServiceType=0;
init_ServiceDiscoveryReqType_ServiceScope(&(type->ServiceScope));
type->isused.ServiceScope=0;
}
static void init_ServiceDescriptionType_ServiceID(struct ServiceDescriptionType_ServiceID* type)
{
type->arraylen.data=0;
}
static void init_ServiceDescriptionType_ServiceName(struct ServiceDescriptionType_ServiceName* type)
{
type->arraylen.data=0;
}
static void init_ServiceDescriptionType_ServiceScope(struct ServiceDescriptionType_ServiceScope* type)
{
type->arraylen.data=0;
}
static void init_ServiceDescriptionType(struct ServiceDescriptionType* type)
{
init_ServiceDescriptionType_ServiceID(&(type->ServiceID));
init_ServiceDescriptionType_ServiceName(&(type->ServiceName));
type->isused.ServiceName=0;
type->isused.ServiceType=0;
init_ServiceDescriptionType_ServiceScope(&(type->ServiceScope));
type->isused.ServiceScope=0;
}
static void init_ServiceListType(struct ServiceListType* type)
{
init_ServiceDescriptionType((type->Service));
type->arraylen.Service=0;
}
static void init_ServiceDiscoveryResType(struct ServiceDiscoveryResType* type)
{
init_ServiceListType(&(type->ServiceList));
type->isused.ServiceList=0;
}
static void init_ServicePaymentSelectionReqType_PEVPubKey(struct ServicePaymentSelectionReqType_PEVPubKey* type)
{
type->arraylen.data=0;
}
static void init_ServicePaymentSelectionReqType(struct ServicePaymentSelectionReqType* type)
{
init_ServiceListType(&(type->ServiceList));
init_ServicePaymentSelectionReqType_PEVPubKey(&(type->PEVPubKey));
}
static void init_ServicePaymentSelectionResType_MeteringAuthPubKey(struct ServicePaymentSelectionResType_MeteringAuthPubKey* type)
{
type->arraylen.data=0;
}
static void init_ServicePaymentSelectionResType(struct ServicePaymentSelectionResType* type)
{
init_ServicePaymentSelectionResType_MeteringAuthPubKey(&(type->MeteringAuthPubKey));
type->isused.MeteringAuthPubKey=0;
}
static void init_PaymentDetailsReqType_ContractID(struct PaymentDetailsReqType_ContractID* type)
{
type->arraylen.data=0;
}
static void init_PaymentDetailsReqType(struct PaymentDetailsReqType* type)
{
init_PaymentDetailsReqType_ContractID(&(type->ContractID));
}
static void init_PowerDiscoveryReqType(struct PowerDiscoveryReqType* type)
{
}
static void init_PowerDiscoveryResType_EnergyProvider(struct PowerDiscoveryResType_EnergyProvider* type)
{
type->arraylen.data=0;
}
static void init_TariffTableType_Currency(struct TariffTableType_Currency* type)
{
type->arraylen.data=0;
}
static void init_TariffDescrType_TariffDescription(struct TariffDescrType_TariffDescription* type)
{
type->arraylen.data=0;
}
static void init_TariffEntryType(struct TariffEntryType* type)
{
type->isused.EPrice=0;
}
static void init_TariffEntriesType(struct TariffEntriesType* type)
{
init_TariffEntryType((type->TariffEntry));
type->arraylen.TariffEntry=0;
}
static void init_TariffDescrType(struct TariffDescrType* type)
{
init_TariffDescrType_TariffDescription(&(type->TariffDescription));
type->isused.TariffDescription=0;
init_TariffEntriesType(&(type->TariffEntries));
}
static void init_TariffTableType(struct TariffTableType* type)
{
init_TariffTableType_Currency(&(type->Currency));
init_TariffDescrType((type->Tariff));
type->arraylen.Tariff=0;
}
static void init_PowerDiscoveryResType(struct PowerDiscoveryResType* type)
{
init_PowerDiscoveryResType_EnergyProvider(&(type->EnergyProvider));
type->isused.EnergyProvider=0;
init_TariffTableType(&(type->TariffTable));
type->isused.TariffTable=0;
}
static void init_LineLockReqType(struct LineLockReqType* type)
{
}
static void init_LineLockResType(struct LineLockResType* type)
{
}
static void init_ChargingProfileType(struct ChargingProfileType* type)
{
}
static void init_PowerDeliveryReqType(struct PowerDeliveryReqType* type)
{
type->isused.Tariff=0;
init_ChargingProfileType(&(type->ChargingProfile));
type->isused.ChargingProfile=0;
}
static void init_MeteringStatusResType_EVSEID(struct MeteringStatusResType_EVSEID* type)
{
type->arraylen.data=0;
}
static void init_MeterInfoType_MeterID(struct MeterInfoType_MeterID* type)
{
type->arraylen.data=0;
}
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.MeterReading=0;
type->isused.MeterStatus=0;
type->isused.TMeter=0;
}
static void init_MeteringStatusResType(struct MeteringStatusResType* type)
{
init_MeteringStatusResType_EVSEID(&(type->EVSEID));
type->isused.PCurrent=0;
init_MeterInfoType(&(type->MeterInfo));
type->isused.MeterInfo=0;
}
static void init_MeteringReceiptReqType_PEVID(struct MeteringReceiptReqType_PEVID* type)
{
type->arraylen.data=0;
}
static void init_MeteringReceiptReqType(struct MeteringReceiptReqType* type)
{
init_MeteringReceiptReqType_PEVID(&(type->PEVID));
type->isused.PEVID=0;
type->isused.TCurrent=0;
init_MeterInfoType(&(type->MeterInfo));
}
static void init_BodyType(struct BodyType* type)
{
init_SessionSetupReqType(&(type->SessionSetupReq));
type->isused.SessionSetupReq=0;
init_SessionSetupResType(&(type->SessionSetupRes));
type->isused.SessionSetupRes=0;
init_ServiceDiscoveryReqType(&(type->ServiceDiscoveryReq));
type->isused.ServiceDiscoveryReq=0;
init_ServiceDiscoveryResType(&(type->ServiceDiscoveryRes));
type->isused.ServiceDiscoveryRes=0;
init_ServicePaymentSelectionReqType(&(type->ServicePaymentSelectionReq));
type->isused.ServicePaymentSelectionReq=0;
init_ServicePaymentSelectionResType(&(type->ServicePaymentSelectionRes));
type->isused.ServicePaymentSelectionRes=0;
init_PaymentDetailsReqType(&(type->PaymentDetailsReq));
type->isused.PaymentDetailsReq=0;
type->isused.PaymentDetailsRes=0;
init_PowerDiscoveryReqType(&(type->PowerDiscoveryReq));
type->isused.PowerDiscoveryReq=0;
init_PowerDiscoveryResType(&(type->PowerDiscoveryRes));
type->isused.PowerDiscoveryRes=0;
init_LineLockReqType(&(type->LineLockReq));
type->isused.LineLockReq=0;
init_LineLockResType(&(type->LineLockRes));
type->isused.LineLockRes=0;
init_PowerDeliveryReqType(&(type->PowerDeliveryReq));
type->isused.PowerDeliveryReq=0;
type->isused.PowerDeliveryRes=0;
type->isused.MeteringStatusReq=0;
init_MeteringStatusResType(&(type->MeteringStatusRes));
type->isused.MeteringStatusRes=0;
init_MeteringReceiptReqType(&(type->MeteringReceiptReq));
type->isused.MeteringReceiptReq=0;
type->isused.MeteringReceiptRes=0;
}
void init_AnonType_V2G_Message(struct AnonType_V2G_Message* type)
{
init_HeaderType(&(type->Header));
init_BodyType(&(type->Body));
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,43 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef V2GSERVER_H_
#define V2GSERVER_H_
#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);
#endif /* V2GSERVER_H_ */
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,64 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SERVICEMETHODS_H
#define SERVICEMETHODS_H
#include "v2g_serviceDataTypes.h"
#include "../codec/EXITypes.h"
/* service methods */
int sessionSetup(struct SessionSetupReqType* param, struct SessionSetupResType* result);
int serviceDiscovery(struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result);
int selectedServicePayment(struct ServicePaymentSelectionReqType* param, struct ServicePaymentSelectionResType* result);
int paymentDetails(struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result);
int powerDiscovery(struct PowerDiscoveryReqType* param, struct PowerDiscoveryResType* result);
int lineLock(struct LineLockReqType* param, struct LineLockResType* result);
int powerDelivery(struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result);
int meteringStatus(struct MeteringStatusReqType* param, struct MeteringStatusResType* result);
int meteringReceipt(struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result);
#endif
#ifdef __cplusplus
}
#endif

View file

@ -43,7 +43,7 @@
uint8_t data[ARRAY_SIZE_BYTES]; uint8_t data[ARRAY_SIZE_BYTES];
uint32_t codepoints[ARRAY_SIZE_STRINGS]; uint32_t codepoints[ARRAY_SIZE_STRINGS];
int main(int argc, char *argv[]) { int mainX(int argc, char *argv[]) {
int errn = 0; int errn = 0;
unsigned int i; unsigned int i;

114
src/test/main_service.c Normal file
View file

@ -0,0 +1,114 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#include "service/v2g_service.h"
#include "service/v2g_serviceDataTypes.h"
#include "service/v2g_serviceClientStubs.h"
#include "codec/EXITypes.h"
#include "codec/BitStream.h"
#include <stdlib.h>
#define MAX_BYTE_SIZE 128
#define MAX_STRING_SIZE 256
#define MAX_STREAM_SIZE 60
int main(int argc, char *argv[])
{
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*/
/* define in and out byte stream */
uint8_t inStream[MAX_STREAM_SIZE]; /* define MAX_STREAM_SIZE before */
uint8_t outStream[MAX_STREAM_SIZE]; /* define MAX_STREAM_SIZE before */
/* service data structure */
struct v2gService service;
struct HeaderType v2gHeader;
struct SessionSetupReqType sessionSetup;
struct SessionSetupResType resultSessionSetup;
/* struct PowerDiscoveryReqType powerDiscovery;
struct PowerDiscoveryResType resultPowerDiscovery;
*/
/* BINARY memory setup */
bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 };
/* STRING memory setup */
string_ucs_t string = { MAX_STRING_SIZE, string_array, 0 };
printf("+++Start V2G Client / Service Example+++\n\n");
/*******************
* Init V2G Client *
*******************/
init_v2gServiceClient(&service,bytes,string,inStream,MAX_STREAM_SIZE, outStream, MAX_STREAM_SIZE);
/*******************************
* Setup data for sessionSetup *
*******************************/
/* setup header information */
v2gHeader.SessionInformation.ServiceSessionID.arraylen.data = 0; /* no session id in the initial message -> array length = 0*/
v2gHeader.SessionInformation.ProtocolVersion.data[0]='1'; /* assign protocol version number*/
v2gHeader.SessionInformation.ProtocolVersion.arraylen.data=1; /* array string length =1 of protocol version */
v2gHeader.SessionInformation.isused.ProtocolVersion = 1; /* important: signalize, protocol version is used */
v2gHeader.isused.Notification=0; /* no notification */
/* 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 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=%ld\n",resultSessionSetup.EVSEStatus.ShutDownTime);
printf("\tTCurrent=%ld\n",resultSessionSetup.TCurrent);
printf("\n+++Terminate V2G Client / Service Example+++");
return 0;
}

69
src/test/v2g_server.c Normal file
View file

@ -0,0 +1,69 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#include "v2g_server.h"
#include "service/v2g_service.h"
#include "service/v2g_serviceDispatcher.h"
#define MAX_BYTE_SIZE 128
#define MAX_STRING_SIZE 256
#define MAX_STREAM_SIZE 60
int testV2GService(uint8_t* inStream, size_t inStreamLength, uint8_t* outStream)
{
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;
struct v2gService service;
/* BINARY memory setup */
bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 };
/* STRING memory setup */
string_ucs_t string = { MAX_STRING_SIZE, string_array, 0 };
/**********************************************
* Init V2G server and initialize array types *
* for the EXI decoding *
**********************************************/
init_v2gservice(&service, bytes, string);
/* assign the position where to read / write in the inStream / outStream */
posIn=0;
posOut=0;
/****************************************************************************
* Pass the received EXI message stream (inStream + inStreamLength) to the *
* message dispatcher. The outStream contains the response message stream. *
* posOut==length of outStream *
****************************************************************************/
messageDispatcher(&service, inStream, inStreamLength, &posIn, outStream, MAX_STREAM_SIZE, &posOut);
return 0;
}

32
src/test/v2g_server.h Normal file
View file

@ -0,0 +1,32 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#ifndef V2G_SERVER_H_
#define V2G_SERVER_H_
#include "codec/EXITypes.h"
int testV2GService(uint8_t* inStream, size_t inStreamLength, uint8_t* outStream);
#endif /* V2G_SERVER_H_ */

View file

@ -0,0 +1,40 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#include "service/v2g_serviceClientDataTransmitter.h"
#include "v2g_server.h"
#include "codec/Bitstream.h"
/* This method has to be implemented!
* Send EXI stream (outStream) to EVSE and receive response stream (inStream)*/
int serviceDataTransmitter(uint8_t* outStream, size_t outStreamLength, uint8_t* inStream)
{
/* send output stream to the underlying network to the EVSE and wait for response
* --> here provide data to the V2G server directly*/
testV2GService(outStream, outStreamLength, inStream);
return 0;
}

View file

@ -0,0 +1,93 @@
/*
* Copyright (C) 2007-2010 Siemens AG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************
*
* @author Sebastian.Kaebisch.EXT@siemens.com
* @version 0.2
* @contact Joerg.Heuer@siemens.com
*
********************************************************************/
#include "service/v2g_serviceMethods.h"
#include "service/v2g_serviceDataTypes.h"
#include <stdio.h>
int sessionSetup(struct SessionSetupReqType* param, struct SessionSetupResType* result)
{
printf("EVSE: sessionSetup called\n" );
printf("\tReceived data:\n");
printf("\t\t PEVStatus ChargerStandby=%d\n",param->PEVStatus.ChargerStandby);
printf("\t\t PEVStatus ConnectorLocked=%d\n", param->PEVStatus.ConnectorLocked);
/* Prepare data for PEV */
result->ResponseCode = OK_SessionSetup;
result->EVSEID.data[0]='E';
result->EVSEID.arraylen.data=1;
result->EVSEStatus.ConnectorLocked=0;
result->EVSEStatus.EVSEStandby=1;
result->EVSEStatus.FatalError=0;
result->EVSEStatus.PowerSwitchClosed=1;
result->EVSEStatus.RCD=1;
result->EVSEStatus.ShutDownTime=12345678L;
result->TCurrent=12345678L;
return 0;
}
int serviceDiscovery(struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result)
{
return 0;
}
int selectedServicePayment(struct ServicePaymentSelectionReqType* param, struct ServicePaymentSelectionResType* result)
{
return 0;
}
int paymentDetails(struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result)
{
return 0;
}
int powerDiscovery(struct PowerDiscoveryReqType* param, struct PowerDiscoveryResType* result)
{
return 0;
}
int lineLock(struct LineLockReqType* param, struct LineLockResType* result)
{
return 0;
}
int powerDelivery(struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result)
{
return 0;
}
int meteringStatus(struct MeteringStatusReqType* param, struct MeteringStatusResType* result)
{
return 0;
}
int meteringReceipt(struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result)
{
return 0;
}