mirror of
https://github.com/Martin-P/OpenV2G.git
synced 2024-11-18 12:53:58 +00:00
OpeOpenV2G 0.5 init
This commit is contained in:
parent
7ead851b9d
commit
782fc539fc
57 changed files with 31803 additions and 8047 deletions
579
src/codec/AbstractDecoderChannel.c
Normal file
579
src/codec/AbstractDecoderChannel.c
Normal file
|
@ -0,0 +1,579 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "DecoderChannel.h"
|
||||
#include "CoderChannel.h"
|
||||
#include "BitInputStream.h"
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef ABSTRACT_DECODER_CHANNEL_C
|
||||
#define ABSTRACT_DECODER_CHANNEL_C
|
||||
|
||||
/* unsigned long == 64 bits, 10 * 7bits = 70 bits */
|
||||
#define MAX_OCTETS_FOR_UNSIGNED_INTEGER_64 10
|
||||
/* unsigned int == 32 bits, 5 * 7bits = 35 bits */
|
||||
#define MAX_OCTETS_FOR_UNSIGNED_INTEGER_32 5
|
||||
|
||||
/* buffer for reading (arbitrary) large integer values */
|
||||
static unsigned int maskedOctets[MAX_OCTETS_FOR_UNSIGNED_INTEGER_64];
|
||||
|
||||
|
||||
static int _decodeUnsignedInteger(bitstream_t* stream, integer_t* iv, int negative) {
|
||||
int errn = 0;
|
||||
int i, k;
|
||||
uint8_t b;
|
||||
|
||||
for (i = 0; i < MAX_OCTETS_FOR_UNSIGNED_INTEGER_64; i++) {
|
||||
/* Read the next octet */
|
||||
errn = decode(stream, &b);
|
||||
/* If the most significant bit of the octet was 1,
|
||||
another octet is going to come */
|
||||
if (b < 128) {
|
||||
/* no more octets */
|
||||
|
||||
/* For negative values, the Unsigned Integer holds the
|
||||
* magnitude of the value minus 1 */
|
||||
|
||||
switch(i) {
|
||||
case 0: /* 7 bits */
|
||||
if (negative) {
|
||||
iv->val.int8 = - ( b + 1);
|
||||
iv->type = INTEGER_8;
|
||||
} else {
|
||||
iv->val.uint8 = b;
|
||||
iv->type = UNSIGNED_INTEGER_8;
|
||||
}
|
||||
return 0;
|
||||
case 1: /* 14 bits */
|
||||
maskedOctets[i] = b;
|
||||
iv->val.uint16 = 0;
|
||||
for (k = i; k >= 0 ; k--) {
|
||||
iv->val.uint16 = (iv->val.uint16 << 7) | maskedOctets[k];
|
||||
}
|
||||
if (negative) {
|
||||
iv->val.int16 = - ( iv->val.uint16 + 1 );
|
||||
iv->type = INTEGER_16;
|
||||
} else {
|
||||
iv->type = UNSIGNED_INTEGER_16;
|
||||
}
|
||||
return 0;
|
||||
case 2: /* 21 bits */
|
||||
case 3: /* 28 bits */
|
||||
maskedOctets[i] = b;
|
||||
iv->val.uint32 = 0;
|
||||
for (k = i; k >= 0 ; k--) {
|
||||
iv->val.uint32 = (iv->val.uint32 << 7) | maskedOctets[k];
|
||||
}
|
||||
if (negative) {
|
||||
iv->val.int32 = - ( iv->val.uint32 + 1 );
|
||||
if (iv->val.int32 <= INT16_MAX && iv->val.int32 >= INT16_MIN ) {
|
||||
iv->type = INTEGER_16;
|
||||
} else {
|
||||
iv->type = INTEGER_32;
|
||||
}
|
||||
} else {
|
||||
if (iv->val.uint32 <= UINT16_MAX) {
|
||||
iv->type = UNSIGNED_INTEGER_16;
|
||||
} else {
|
||||
iv->type = UNSIGNED_INTEGER_32;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
case 4: /* 35 bits */
|
||||
case 5: /* 42 bits */
|
||||
case 6: /* 49 bits */
|
||||
case 7: /* 56 bits */
|
||||
case 8: /* 63 bits */
|
||||
case 9: /* 70 bits */
|
||||
maskedOctets[i] = b;
|
||||
iv->val.uint64 = 0;
|
||||
for (k = i; k >= 0 ; k--) {
|
||||
iv->val.uint64 = (iv->val.uint64 << 7) | maskedOctets[k];
|
||||
}
|
||||
if (negative) {
|
||||
if (i > 8) {
|
||||
/* too large */
|
||||
return EXI_UNSUPPORTED_INTEGER_VALUE;
|
||||
}
|
||||
iv->val.int64 = - ( iv->val.uint64 + 1 );
|
||||
if (iv->val.int64 <= INT32_MAX && iv->val.int64 >= INT32_MIN ) {
|
||||
iv->type = INTEGER_32;
|
||||
} else {
|
||||
iv->type = INTEGER_64;
|
||||
}
|
||||
} else {
|
||||
if (iv->val.uint64 <= UINT32_MAX) {
|
||||
iv->type = UNSIGNED_INTEGER_32;
|
||||
/* iv->val.uint32 = iv->val.uint64;*/
|
||||
} else {
|
||||
iv->type = UNSIGNED_INTEGER_64;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
return EXI_UNSUPPORTED_INTEGER_VALUE;
|
||||
}
|
||||
} else {
|
||||
/* the 7 least significant bits hold the actual value */
|
||||
maskedOctets[i] = (b & 127);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return EXI_UNSUPPORTED_INTEGER_VALUE;
|
||||
}
|
||||
|
||||
int decodeUnsignedInteger(bitstream_t* stream, integer_t* iv) {
|
||||
return _decodeUnsignedInteger(stream, iv, 0);
|
||||
}
|
||||
|
||||
int decodeUnsignedInteger16(bitstream_t* stream, uint16_t* uint16) {
|
||||
unsigned int mShift = 0;
|
||||
int errn = 0;
|
||||
uint8_t b;
|
||||
*uint16 = 0;
|
||||
|
||||
do {
|
||||
/* 1. Read the next octet */
|
||||
errn = decode(stream, &b);
|
||||
/* 2. Multiply the value of the unsigned number represented by the 7
|
||||
* least significant
|
||||
* bits of the octet by the current multiplier and add the result to
|
||||
* the current value */
|
||||
*uint16 += (b & 127) << mShift;
|
||||
/* 3. Multiply the multiplier by 128 */
|
||||
mShift += 7;
|
||||
/* 4. If the most significant bit of the octet was 1, go back to step 1 */
|
||||
} while (errn >= 0 && (b >> 7) == 1);
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32) {
|
||||
/* 0XXXXXXX ... 1XXXXXXX 1XXXXXXX */
|
||||
unsigned int mShift = 0;
|
||||
int errn = 0;
|
||||
uint8_t b;
|
||||
*uint32 = 0;
|
||||
|
||||
do {
|
||||
/* 1. Read the next octet */
|
||||
errn = decode(stream, &b);
|
||||
/* 2. Multiply the value of the unsigned number represented by the 7
|
||||
* least significant
|
||||
* bits of the octet by the current multiplier and add the result to
|
||||
* the current value */
|
||||
*uint32 += (b & 127) << mShift;
|
||||
/* 3. Multiply the multiplier by 128 */
|
||||
mShift += 7;
|
||||
/* 4. If the most significant bit of the octet was 1, go back to step 1 */
|
||||
} while (errn >= 0 && (b >> 7) == 1);
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int decodeUnsignedInteger64(bitstream_t* stream, uint64_t* uint64) {
|
||||
unsigned int mShift = 0;
|
||||
int errn = 0;
|
||||
uint8_t b;
|
||||
*uint64 = 0L;
|
||||
|
||||
do {
|
||||
errn = decode(stream, &b);
|
||||
*uint64 += ((uint64_t) (b & 127)) << mShift;
|
||||
mShift += 7;
|
||||
} while (errn >= 0 && (b >> 7) == 1);
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
int decodeInteger(bitstream_t* stream, integer_t* iv) {
|
||||
int b;
|
||||
int errn = decodeBoolean(stream, &b);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
return _decodeUnsignedInteger(stream, iv, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int decodeInteger32(bitstream_t* stream, int32_t* int32) {
|
||||
int b;
|
||||
uint32_t uint32;
|
||||
int errn = decodeBoolean(stream, &b);
|
||||
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
if (b) {
|
||||
/* For negative values, the Unsigned Integer holds the
|
||||
* magnitude of the value minus 1 */
|
||||
errn = decodeUnsignedInteger32(stream, &uint32);
|
||||
*int32 = -(uint32 + 1);
|
||||
} else {
|
||||
/* positive */
|
||||
errn = decodeUnsignedInteger32(stream, &uint32);
|
||||
*int32 = (int32_t)(uint32);
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int decodeInteger64(bitstream_t* stream, int64_t* int64) {
|
||||
int b;
|
||||
uint64_t uint64;
|
||||
int errn = decodeBoolean(stream, &b);
|
||||
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
if (b) {
|
||||
/* For negative values, the Unsigned Integer holds the
|
||||
* magnitude of the value minus 1 */
|
||||
errn = decodeUnsignedInteger64(stream, &uint64);
|
||||
*int64 = -(uint64 + 1);
|
||||
} else {
|
||||
/* positive */
|
||||
errn = decodeUnsignedInteger64(stream, &uint64);
|
||||
*int64 = (int64_t)(uint64);
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a Float datatype as two consecutive Integers.
|
||||
* The first Integer represents the mantissa of the floating point
|
||||
* number and the second Integer represents the base-10 exponent
|
||||
* of the floating point number.
|
||||
*/
|
||||
int decodeFloat(bitstream_t* stream, float_me_t* f) {
|
||||
int errn = decodeInteger64(stream, &f->mantissa);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
return decodeInteger32(stream, &f->exponent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a decimal represented as a Boolean sign followed by two Unsigned
|
||||
* Integers. A sign value of zero (0) is used to represent positive Decimal
|
||||
* values and a sign value of one (1) is used to represent negative Decimal
|
||||
* values The first Integer represents the integral portion of the Decimal
|
||||
* value. The second positive integer represents the fractional portion of
|
||||
* the decimal with the digits in reverse order to preserve leading zeros.
|
||||
*/
|
||||
int decodeDecimal(bitstream_t* stream, decimal_t* d) {
|
||||
int errn = decodeBoolean(stream, &d->negative);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
errn = decodeUnsignedInteger(stream, &d->integral);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
errn = decodeUnsignedInteger(stream, &d->reverseFraction);
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a sequence of characters for a given length.
|
||||
*/
|
||||
int decodeStringOnly(bitstream_t* stream, uint16_t len, string_ucs_t* s) {
|
||||
if (len > s->size) {
|
||||
/* not enough space */
|
||||
return EXI_ERROR_OUT_OF_STRING_BUFFER;
|
||||
}
|
||||
decodeCharacters(stream, len, s->codepoints);
|
||||
s->len = len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a length prefixed sequence of characters.
|
||||
*/
|
||||
int decodeString(bitstream_t* stream, string_ucs_t* s) {
|
||||
int errn = decodeUnsignedInteger16(stream, &s->len);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
return decodeStringOnly(stream, s->len, s);
|
||||
}
|
||||
|
||||
int decodeStringASCII(bitstream_t* stream, string_ascii_t* s) {
|
||||
uint16_t slen;
|
||||
int errn = decodeUnsignedInteger16(stream, &slen);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
if (s->size < slen) {
|
||||
return EXI_ERROR_OUT_OF_ASCII_BUFFER;
|
||||
}
|
||||
|
||||
return decodeCharactersASCII(stream, slen, s->chars);
|
||||
|
||||
}
|
||||
|
||||
int decodeStringValue(bitstream_t* stream, string_ucs_t* s) {
|
||||
int errn = decodeUnsignedInteger16(stream, &s->len);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
switch (s->len) {
|
||||
case 0:
|
||||
/* local value partition */
|
||||
return EXI_UNSUPPORTED_STRING_TABLE_LOCAL_HIT;
|
||||
case 1:
|
||||
/* found in global value partition */
|
||||
return EXI_UNSUPPORTED_STRING_TABLE_GLOBAL_HIT;
|
||||
default:
|
||||
/* not found in global value (and local value) partition
|
||||
* ==> string literal is encoded as a String with the length
|
||||
* incremented by two */
|
||||
return decodeStringOnly(stream, ((s->len) - 2), s);
|
||||
/* After encoding the string value, it is added to both the
|
||||
* associated "local" value string table partition and the global
|
||||
* value string table partition */
|
||||
/* addValue(context, value); */
|
||||
}
|
||||
}
|
||||
|
||||
int decodeRCSStringValue(bitstream_t* stream, rcs_t* rcs, string_ucs_t* s) {
|
||||
unsigned int i;
|
||||
uint32_t cp;
|
||||
int errn = decodeUnsignedInteger16(stream, &s->len);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
switch (s->len) {
|
||||
case 0:
|
||||
/* local value partition */
|
||||
return EXI_UNSUPPORTED_STRING_TABLE_LOCAL_HIT;
|
||||
case 1:
|
||||
/* found in global value partition */
|
||||
return EXI_UNSUPPORTED_STRING_TABLE_GLOBAL_HIT;
|
||||
default:
|
||||
/* not found in global value (and local value) partition
|
||||
* ==> string literal is encoded as a String with the length
|
||||
* incremented by two */
|
||||
s->len = s->len - 2;
|
||||
|
||||
if (s->len > s->size) {
|
||||
/* not enough space */
|
||||
return EXI_ERROR_OUT_OF_STRING_BUFFER;
|
||||
}
|
||||
|
||||
for (i = 0; i < s->len && errn >= 0; i++) {
|
||||
errn = decodeNBitUnsignedInteger(stream, rcs->codingLength, &cp);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
s->codepoints[i] = rcs->codepoints[cp];
|
||||
}
|
||||
/* After encoding the string value, it is added to both the
|
||||
* associated "local" value string table partition and the global
|
||||
* value string table partition */
|
||||
/* addValue(context, value); */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a sequence of characters according to a given length.
|
||||
* Each character is represented by its UCS [ISO/IEC 10646]
|
||||
* code point encoded as an Unsigned Integer
|
||||
*/
|
||||
int decodeCharacters(bitstream_t* stream, uint16_t len, uint32_t* chars) {
|
||||
unsigned int i;
|
||||
int errn = 0;
|
||||
for (i = 0; i < len && errn >= 0; i++) {
|
||||
errn = decodeUnsignedInteger32(stream, &chars[i]);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
int decodeCharactersASCII(bitstream_t* stream, uint16_t len, char* chars) {
|
||||
unsigned int i;
|
||||
uint32_t c;
|
||||
int errn = 0;
|
||||
for (i = 0; i < len && errn >= 0; i++) {
|
||||
errn = decodeUnsignedInteger32(stream, &c);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
if (c > 127) {
|
||||
return EXI_ERROR_CONVERSION_NO_ASCII_CHARACTERS;
|
||||
}
|
||||
chars[i] = c;
|
||||
}
|
||||
chars[i] = '\0';
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decode a binary value as a length-prefixed sequence of octets.
|
||||
*/
|
||||
int decodeBinary(bitstream_t* stream, bytes_t* bytes) {
|
||||
unsigned int i;
|
||||
uint8_t b;
|
||||
int errn = decodeUnsignedInteger16(stream, &bytes->len);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
if (bytes->len > bytes->size) {
|
||||
/* not enough space */
|
||||
return EXI_ERROR_OUT_OF_BYTE_BUFFER;
|
||||
}
|
||||
|
||||
for (i = 0; i < bytes->len && errn >= 0; i++) {
|
||||
errn = decode(stream, &b);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
bytes->data[i] = (uint8_t)b;
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Date-Time as sequence of values representing the individual
|
||||
* components of the Date-Time.
|
||||
*/
|
||||
int decodeDateTime(bitstream_t* stream, datetime_type_t type, datetime_t* datetime){
|
||||
int errn;
|
||||
|
||||
datetime->type = type;
|
||||
|
||||
datetime->year = 0;
|
||||
datetime->monthDay = 0;
|
||||
datetime->time = 0;
|
||||
datetime->presenceFractionalSecs = 0;
|
||||
datetime->fractionalSecs = 0;
|
||||
datetime->presenceTimezone = 0;
|
||||
datetime->timezone = 0;
|
||||
|
||||
switch (type) {
|
||||
case gYear: /* Year, [Time-Zone] */
|
||||
errn = decodeInteger32(stream, &datetime->year);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
datetime->year += DATETIME_YEAR_OFFSET;
|
||||
break;
|
||||
case gYearMonth: /* Year, MonthDay, [TimeZone] */
|
||||
case date:
|
||||
errn = decodeInteger32(stream, &datetime->year);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
datetime->year += DATETIME_YEAR_OFFSET;
|
||||
errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY, &datetime->monthDay);
|
||||
break;
|
||||
case dateTime: /* Year, MonthDay, Time, [FractionalSecs], [TimeZone] */
|
||||
/* e.g. "0001-01-01T00:00:00.111+00:33" */
|
||||
errn = decodeInteger32(stream, &datetime->year);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
datetime->year += DATETIME_YEAR_OFFSET;
|
||||
errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY, &datetime->monthDay);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
/* Note: *no* break */
|
||||
case time: /* Time, [FractionalSecs], [TimeZone] */
|
||||
/* e.g. "12:34:56.135" */
|
||||
errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_TIME, &datetime->time);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
errn = decodeBoolean(stream, &datetime->presenceFractionalSecs);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
if (datetime->presenceFractionalSecs) {
|
||||
errn = decodeUnsignedInteger32(stream, &datetime->fractionalSecs);
|
||||
}
|
||||
break;
|
||||
case gMonth: /* MonthDay, [TimeZone] */
|
||||
/* e.g. "--12" */
|
||||
case gMonthDay: /* MonthDay, [TimeZone] */
|
||||
/* e.g. "--01-28" */
|
||||
case gDay: /* MonthDay, [TimeZone] */
|
||||
/* "---16" */
|
||||
errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY, &datetime->monthDay );
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
errn = decodeBoolean(stream, &datetime->presenceTimezone );
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
if (datetime->presenceTimezone) {
|
||||
errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_TIMEZONE, &datetime->timezone);
|
||||
datetime->timezone -= DATETIME_TIMEZONE_OFFSET_IN_MINUTES;
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
436
src/codec/AbstractEncoderChannel.c
Normal file
436
src/codec/AbstractEncoderChannel.c
Normal file
|
@ -0,0 +1,436 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "EncoderChannel.h"
|
||||
#include "CoderChannel.h"
|
||||
#include "BitOutputStream.h"
|
||||
#include "EXITypes.h"
|
||||
#include "MethodsBag.h"
|
||||
|
||||
#ifndef ABSTRACT_ENCODER_CHANNEL_C
|
||||
#define ABSTRACT_ENCODER_CHANNEL_C
|
||||
|
||||
|
||||
int encodeUnsignedInteger(bitstream_t* stream, integer_t* iv) {
|
||||
int errn = 0;
|
||||
switch(iv->type) {
|
||||
/* Unsigned Integer */
|
||||
case UNSIGNED_INTEGER_8:
|
||||
errn = encodeUnsignedInteger32(stream, iv->val.uint8);
|
||||
break;
|
||||
case UNSIGNED_INTEGER_16:
|
||||
errn = encodeUnsignedInteger32(stream, iv->val.uint16);
|
||||
break;
|
||||
case UNSIGNED_INTEGER_32:
|
||||
errn = encodeUnsignedInteger32(stream, iv->val.uint32);
|
||||
break;
|
||||
case UNSIGNED_INTEGER_64:
|
||||
errn = encodeUnsignedInteger64(stream, iv->val.uint64);
|
||||
break;
|
||||
/* (Signed) Integer */
|
||||
case INTEGER_8:
|
||||
if (iv->val.int8 < 0) {
|
||||
return EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE;
|
||||
}
|
||||
errn = encodeUnsignedInteger32(stream, iv->val.int8);
|
||||
break;
|
||||
case INTEGER_16:
|
||||
if (iv->val.int16 < 0) {
|
||||
return EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE;
|
||||
}
|
||||
errn = encodeUnsignedInteger32(stream, iv->val.int16);
|
||||
break;
|
||||
case INTEGER_32:
|
||||
if (iv->val.int32 < 0) {
|
||||
return EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE;
|
||||
}
|
||||
errn = encodeUnsignedInteger32(stream, iv->val.int32);
|
||||
break;
|
||||
case INTEGER_64:
|
||||
if (iv->val.int64 < 0) {
|
||||
return EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE;
|
||||
}
|
||||
errn = encodeUnsignedInteger64(stream, iv->val.int64);
|
||||
break;
|
||||
default:
|
||||
errn = EXI_UNSUPPORTED_INTEGER_VALUE_TYPE;
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int encodeUnsignedInteger32(bitstream_t* stream, uint32_t n) {
|
||||
int errn = 0;
|
||||
if (n < 128) {
|
||||
/* write byte as is */
|
||||
errn = encode(stream, (uint8_t) n);
|
||||
} else {
|
||||
uint8_t n7BitBlocks = numberOf7BitBlocksToRepresent(n);
|
||||
|
||||
switch (n7BitBlocks) {
|
||||
case 5:
|
||||
errn = encode(stream, (uint8_t) (128 | n));
|
||||
n = n >> 7;
|
||||
if (errn < 0) {
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
errn = encode(stream, (uint8_t) (128 | n));
|
||||
n = n >> 7;
|
||||
if (errn < 0) {
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
errn = encode(stream, (uint8_t) (128 | n));
|
||||
n = n >> 7;
|
||||
if (errn < 0) {
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
errn = encode(stream, (uint8_t) (128 | n));
|
||||
n = n >> 7;
|
||||
if (errn < 0) {
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
/* 0 .. 7 (last byte) */
|
||||
errn = encode(stream, (uint8_t) (0 | n));
|
||||
}
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int encodeUnsignedInteger64(bitstream_t* stream, uint64_t n) {
|
||||
int errn = 0;
|
||||
uint8_t lastEncode = (uint8_t) n;
|
||||
n >>= 7;
|
||||
|
||||
while (n != 0) {
|
||||
errn = encode(stream, lastEncode | 128);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
lastEncode = (uint8_t) n;
|
||||
n >>= 7;
|
||||
}
|
||||
|
||||
return encode(stream, lastEncode);
|
||||
}
|
||||
|
||||
|
||||
int encodeInteger(bitstream_t* stream, integer_t* iv) {
|
||||
int errn = 0;
|
||||
switch(iv->type) {
|
||||
/* Unsigned Integer */
|
||||
case UNSIGNED_INTEGER_8:
|
||||
errn = encodeInteger32(stream, iv->val.uint8);
|
||||
break;
|
||||
case UNSIGNED_INTEGER_16:
|
||||
errn = encodeInteger32(stream, iv->val.uint16);
|
||||
break;
|
||||
case UNSIGNED_INTEGER_32:
|
||||
errn = encodeInteger64(stream, iv->val.uint32);
|
||||
break;
|
||||
case UNSIGNED_INTEGER_64:
|
||||
errn = encodeInteger64(stream, iv->val.uint64);
|
||||
break;
|
||||
/* (Signed) Integer */
|
||||
case INTEGER_8:
|
||||
errn = encodeInteger32(stream, iv->val.int8);
|
||||
break;
|
||||
case INTEGER_16:
|
||||
errn = encodeInteger32(stream, iv->val.int16);
|
||||
break;
|
||||
case INTEGER_32:
|
||||
errn = encodeInteger32(stream, iv->val.int32);
|
||||
break;
|
||||
case INTEGER_64:
|
||||
errn = encodeInteger64(stream, iv->val.int64);
|
||||
break;
|
||||
default:
|
||||
errn = EXI_UNSUPPORTED_INTEGER_VALUE_TYPE;
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int encodeInteger32(bitstream_t* stream, int32_t n) {
|
||||
int errn;
|
||||
/* signalize sign */
|
||||
if (n < 0) {
|
||||
errn = encodeBoolean(stream, 1);
|
||||
/* For negative values, the Unsigned Integer holds the
|
||||
* magnitude of the value minus 1 */
|
||||
n = (-n) - 1;
|
||||
} else {
|
||||
errn = encodeBoolean(stream, 0);
|
||||
}
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
return encodeUnsignedInteger32(stream, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int encodeInteger64(bitstream_t* stream, int64_t n) {
|
||||
int errn;
|
||||
/* signalize sign */
|
||||
if (n < 0) {
|
||||
errn = encodeBoolean(stream, 1);
|
||||
/* For negative values, the Unsigned Integer holds the
|
||||
* magnitude of the value minus 1 */
|
||||
n = (-n) - 1;
|
||||
} else {
|
||||
errn = encodeBoolean(stream, 0);
|
||||
}
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
return encodeUnsignedInteger64(stream, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Float datatype representation is two consecutive Integers.
|
||||
* The first Integer represents the mantissa of the floating point
|
||||
* number and the second Integer represents the base-10 exponent
|
||||
* of the floating point number.
|
||||
*/
|
||||
int encodeFloat(bitstream_t* stream, float_me_t* f) {
|
||||
int errn = encodeInteger64(stream, f->mantissa);
|
||||
if (errn >= 0) {
|
||||
errn = encodeInteger32(stream, f->exponent);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a decimal represented as a Boolean sign followed by two Unsigned
|
||||
* Integers. A sign value of zero (0) is used to represent positive Decimal
|
||||
* values and a sign value of one (1) is used to represent negative Decimal
|
||||
* values The first Integer represents the integral portion of the Decimal
|
||||
* value. The second positive integer represents the fractional portion of
|
||||
* the decimal with the digits in reverse order to preserve leading zeros.
|
||||
*/
|
||||
int encodeDecimal(bitstream_t* stream, decimal_t* d) {
|
||||
/* sign, integral, reverse fractional */
|
||||
int errn = encodeBoolean(stream, d->negative);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
errn = encodeUnsignedInteger(stream, &d->integral);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
errn = encodeUnsignedInteger(stream, &d->reverseFraction);
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encode a length prefixed sequence of characters.
|
||||
*/
|
||||
int encodeASCII(bitstream_t* stream, const char* ascii) {
|
||||
int errn;
|
||||
uint32_t slen = (uint32_t) strlen(ascii);
|
||||
errn = encodeUnsignedInteger32(stream, slen);
|
||||
if (errn >= 0) {
|
||||
errn = encodeASCIICharacters(stream, ascii, slen);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
int encodeString(bitstream_t* stream, string_ucs_t* string) {
|
||||
int errn = encodeUnsignedInteger32(stream, string->len);
|
||||
if (errn >= 0) {
|
||||
errn = encodeUCSCharacters(stream, string->codepoints, string->len);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
int encodeStringValue(bitstream_t* stream, string_ucs_t* string) {
|
||||
/* encode string as string table miss */
|
||||
int errn = encodeUnsignedInteger32(stream, string->len + 2);
|
||||
if (errn >= 0) {
|
||||
errn = encodeUCSCharacters(stream, string->codepoints, string->len);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
int encodeRCSStringValue(bitstream_t* stream, rcs_t* rcs, string_ucs_t* string) {
|
||||
unsigned int i;
|
||||
uint32_t k;
|
||||
/* encode string as string table miss */
|
||||
int errn = encodeUnsignedInteger32(stream, string->len + 2);
|
||||
if (errn >= 0) {
|
||||
for (i = 0; i < string->len && errn >= 0; i++) {
|
||||
for (k = 0; k < rcs->size && errn >= 0; k++) {
|
||||
if (rcs->codepoints[k] == string->codepoints[i]) {
|
||||
errn = encodeNBitUnsignedInteger(stream, rcs->codingLength, k);
|
||||
break; /* break inner for loop */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a sequence of characters according to a given length.
|
||||
* Each character is represented by its UCS [ISO/IEC 10646]
|
||||
* code point encoded as an Unsigned Integer
|
||||
*/
|
||||
int encodeUCSCharacters(bitstream_t* stream, uint32_t* chars, uint16_t len) {
|
||||
unsigned int i;
|
||||
int errn = 0;
|
||||
for (i = 0; i < len && errn >= 0; i++) {
|
||||
errn = encodeUnsignedInteger32(stream, chars[i]);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
int encodeASCIICharacters(bitstream_t* stream, const char* chars, uint16_t len) {
|
||||
unsigned int i;
|
||||
int errn = 0;
|
||||
for (i = 0; i < len && errn >= 0; i++) {
|
||||
errn = encode(stream, chars[i]);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a binary value as a length-prefixed sequence of octets.
|
||||
*/
|
||||
int encodeBinary(bitstream_t* stream, bytes_t* bytes) {
|
||||
unsigned int i;
|
||||
int errn = encodeUnsignedInteger32(stream, bytes->len);
|
||||
|
||||
for (i = 0; i < bytes->len && errn >= 0; i++) {
|
||||
errn = encode(stream, bytes->data[i]);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a datetime representation which is a sequence of values
|
||||
* representing the individual components of the Date-Time
|
||||
*/
|
||||
int encodeDateTime(bitstream_t* stream, datetime_t* datetime) {
|
||||
int errn = 0;
|
||||
switch (datetime->type) {
|
||||
case gYear: /* Year, [Time-Zone] */
|
||||
errn = encodeInteger32(stream, datetime->year - DATETIME_YEAR_OFFSET);
|
||||
break;
|
||||
case gYearMonth: /* Year, MonthDay, [TimeZone] */
|
||||
case date: /* Year, MonthDay, [TimeZone] */
|
||||
errn = encodeInteger32(stream, datetime->year - DATETIME_YEAR_OFFSET);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
errn = encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY, datetime->monthDay);
|
||||
break;
|
||||
case dateTime: /* Year, MonthDay, Time, [FractionalSecs], [TimeZone] */
|
||||
errn = encodeInteger32(stream, datetime->year - DATETIME_YEAR_OFFSET);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
errn = encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY, datetime->monthDay);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
/* Note: *no* break */
|
||||
case time: /* Time, [FractionalSecs], [TimeZone] */
|
||||
errn = encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_TIME, datetime->time);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
if (datetime->presenceFractionalSecs) {
|
||||
encodeBoolean(stream, 1);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
encodeUnsignedInteger32(stream, datetime->fractionalSecs);
|
||||
} else {
|
||||
encodeBoolean(stream, 0);
|
||||
}
|
||||
break;
|
||||
case gMonth: /* MonthDay, [TimeZone] */
|
||||
case gMonthDay: /* MonthDay, [TimeZone] */
|
||||
case gDay: /* MonthDay, [TimeZone] */
|
||||
errn = encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY, datetime->monthDay);
|
||||
break;
|
||||
default:
|
||||
return EXI_ERROR_UNEXPECTED_DATETIME_TYPE;
|
||||
}
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
/* [TimeZone] */
|
||||
if (datetime->presenceTimezone) {
|
||||
errn = encodeBoolean(stream, 1);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_TIMEZONE, datetime->timezone
|
||||
+ DATETIME_TIMEZONE_OFFSET_IN_MINUTES);
|
||||
} else {
|
||||
encodeBoolean(stream, 0);
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,29 +19,36 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* Bit decoding functionalities
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "BitDecoderChannel.h"
|
||||
|
||||
#include "DecoderChannel.h"
|
||||
#include "BitInputStream.h"
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef BIT_DECODER_CHANNEL_C
|
||||
#define BIT_DECODER_CHANNEL_C
|
||||
|
||||
/* only the least significant 8 bits are filled properly */
|
||||
int _decode(bitstream_t* stream, uint32_t* b) {
|
||||
return readBits(stream, 8, b);
|
||||
|
||||
#if EXI_ALIGNMENT == BIT_PACKED
|
||||
|
||||
int decode(bitstream_t* stream, uint8_t* b) {
|
||||
uint32_t bb;
|
||||
int errn = readBits(stream, 8, &bb);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
if (bb > 256) {
|
||||
return EXI_ERROR_UNEXPECTED_BYTE_VALUE;
|
||||
} else {
|
||||
*b = (uint8_t)bb;
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
int decodeBoolean(bitstream_t* stream, int* b) {
|
||||
|
@ -59,230 +67,7 @@ int decodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t* uin
|
|||
}
|
||||
}
|
||||
|
||||
int decodeUnsignedInteger16(bitstream_t* stream, uint16_t* uint16) {
|
||||
unsigned int mShift = 0;
|
||||
int errn = 0;
|
||||
uint32_t b;
|
||||
*uint16 = 0;
|
||||
|
||||
do {
|
||||
/* 1. Read the next octet */
|
||||
errn = _decode(stream, &b);
|
||||
/* 2. Multiply the value of the unsigned number represented by the 7
|
||||
* least significant
|
||||
* bits of the octet by the current multiplier and add the result to
|
||||
* the current value */
|
||||
*uint16 += (b & 127) << mShift;
|
||||
/* 3. Multiply the multiplier by 128 */
|
||||
mShift += 7;
|
||||
/* 4. If the most significant bit of the octet was 1, go back to step 1 */
|
||||
} while (errn >= 0 && (b >> 7) == 1);
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32) {
|
||||
/* 0XXXXXXX ... 1XXXXXXX 1XXXXXXX */
|
||||
unsigned int mShift = 0;
|
||||
int errn = 0;
|
||||
uint32_t b;
|
||||
*uint32 = 0;
|
||||
|
||||
do {
|
||||
/* 1. Read the next octet */
|
||||
errn = _decode(stream, &b);
|
||||
/* 2. Multiply the value of the unsigned number represented by the 7
|
||||
* least significant
|
||||
* bits of the octet by the current multiplier and add the result to
|
||||
* the current value */
|
||||
*uint32 += (b & 127) << mShift;
|
||||
/* 3. Multiply the multiplier by 128 */
|
||||
mShift += 7;
|
||||
/* 4. If the most significant bit of the octet was 1, go back to step 1 */
|
||||
} while (errn >= 0 && (b >> 7) == 1);
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int decodeUnsignedInteger64(bitstream_t* stream, uint64_t* uint64) {
|
||||
unsigned int mShift = 0;
|
||||
int errn = 0;
|
||||
uint32_t b;
|
||||
*uint64 = 0L;
|
||||
|
||||
do {
|
||||
errn = _decode(stream, &b);
|
||||
*uint64 += ((uint64_t) (b & 127)) << mShift;
|
||||
mShift += 7;
|
||||
} while (errn >= 0 && (b >> 7) == 1);
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int decodeInteger32(bitstream_t* stream, int32_t* int32) {
|
||||
int b;
|
||||
uint32_t uint32;
|
||||
int errn = decodeBoolean(stream, &b);
|
||||
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
if (b) {
|
||||
/* For negative values, the Unsigned Integer holds the
|
||||
* magnitude of the value minus 1 */
|
||||
errn = decodeUnsignedInteger32(stream, &uint32);
|
||||
*int32 = -(uint32 + 1);
|
||||
} else {
|
||||
/* positive */
|
||||
errn = decodeUnsignedInteger32(stream, &uint32);
|
||||
*int32 = (int32_t)(uint32);
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int decodeInteger64(bitstream_t* stream, int64_t* int64) {
|
||||
int b;
|
||||
uint64_t uint64;
|
||||
int errn = decodeBoolean(stream, &b);
|
||||
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
if (b) {
|
||||
/* For negative values, the Unsigned Integer holds the
|
||||
* magnitude of the value minus 1 */
|
||||
errn = decodeUnsignedInteger64(stream, &uint64);
|
||||
*int64 = -(uint64 + 1);
|
||||
} else {
|
||||
/* positive */
|
||||
errn = decodeUnsignedInteger64(stream, &uint64);
|
||||
*int64 = (int64_t)(uint64);
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a Float datatype as two consecutive Integers.
|
||||
* The first Integer represents the mantissa of the floating point
|
||||
* number and the second Integer represents the base-10 exponent
|
||||
* of the floating point number.
|
||||
*/
|
||||
int decodeFloat(bitstream_t* stream, float_me_t* f) {
|
||||
int errn = decodeInteger64(stream, &f->mantissa);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
return decodeInteger32(stream, &f->exponent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a sequence of characters for a given length.
|
||||
*/
|
||||
int decodeStringOnly(bitstream_t* stream, uint16_t len, string_ucs_t* s) {
|
||||
decodeCharacters(stream, len, s->codepoints);
|
||||
s->len = len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a length prefixed sequence of characters.
|
||||
*/
|
||||
int decodeString(bitstream_t* stream, string_ucs_t* s) {
|
||||
int errn = decodeUnsignedInteger16(stream, &s->len);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
return decodeStringOnly(stream, s->len, s);
|
||||
}
|
||||
|
||||
int decodeStringValue(bitstream_t* stream, string_ucs_t* s) {
|
||||
int errn = decodeUnsignedInteger16(stream, &s->len);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
switch (s->len) {
|
||||
case 0:
|
||||
/* local value partition */
|
||||
printf("[ERROR] String local value partition hit not supported \n");
|
||||
return -2;
|
||||
case 1:
|
||||
/* found in global value partition */
|
||||
printf("[ERROR] String global value partition hit not supported \n");
|
||||
return -3;
|
||||
default:
|
||||
/* not found in global value (and local value) partition
|
||||
* ==> string literal is encoded as a String with the length
|
||||
* incremented by two */
|
||||
return decodeStringOnly(stream, ((s->len) - 2), s);
|
||||
/* After encoding the string value, it is added to both the
|
||||
* associated "local" value string table partition and the global
|
||||
* value string table partition */
|
||||
/* addValue(context, value); */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a sequence of characters according to a given length.
|
||||
* Each character is represented by its UCS [ISO/IEC 10646]
|
||||
* code point encoded as an Unsigned Integer
|
||||
*/
|
||||
int decodeCharacters(bitstream_t* stream, uint16_t len, uint32_t* chars) {
|
||||
unsigned int i;
|
||||
int errn = 0;
|
||||
for (i = 0; i < len && errn >= 0; i++) {
|
||||
errn = decodeUnsignedInteger32(stream, &chars[i]);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a binary value as a length-prefixed sequence of octets.
|
||||
*/
|
||||
int decodeBinary(bitstream_t* stream, bytes_t* bytes) {
|
||||
unsigned int i;
|
||||
uint32_t b;
|
||||
int errn = decodeUnsignedInteger16(stream, &bytes->len);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
for (i = 0; i < bytes->len && errn >= 0; i++) {
|
||||
errn = _decode(stream, &b);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
bytes->data[i] = (uint8_t)b;
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,11 +19,14 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 2011-05-23
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -102,6 +106,8 @@ int decodeStringOnly(bitstream_t* stream, uint16_t len, string_ucs_t* s);
|
|||
*/
|
||||
int decodeString(bitstream_t* stream, string_ucs_t* s);
|
||||
|
||||
int decodeStringASCII(bitstream_t* stream, string_ascii_t* s);
|
||||
|
||||
/**
|
||||
* Decode a length prefixed sequence of characters in the sense of string tables.
|
||||
* length == 0, local value partition hit
|
||||
|
@ -115,6 +121,7 @@ int decodeStringValue(bitstream_t* stream, string_ucs_t* s);
|
|||
* Decode a sequence of characters according to a given length.
|
||||
*/
|
||||
int decodeCharacters(bitstream_t* stream, uint16_t len, uint32_t* chars);
|
||||
int decodeCharactersASCII(bitstream_t* stream, uint16_t len, char* chars);
|
||||
|
||||
/**
|
||||
* Decode a binary value as a length-prefixed sequence of octets.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,54 +19,23 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "BitEncoderChannel.h"
|
||||
|
||||
|
||||
#include "EncoderChannel.h"
|
||||
#include "CoderChannel.h"
|
||||
#include "BitOutputStream.h"
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef BIT_ENCODER_CHANNEL_C
|
||||
#define BIT_ENCODER_CHANNEL_C
|
||||
|
||||
/**
|
||||
* Returns the least number of 7 bit-blocks that is needed to represent the
|
||||
* int <param>n</param>. Returns 1 if <param>n</param> is 0.
|
||||
*
|
||||
* @param n
|
||||
* integer value
|
||||
*
|
||||
*/
|
||||
uint8_t numberOf7BitBlocksToRepresent(int n) {
|
||||
/* assert (n >= 0); */
|
||||
|
||||
/* 7 bits */
|
||||
if (n < 128) {
|
||||
return 1;
|
||||
}
|
||||
/* 14 bits */
|
||||
else if (n < 16384) {
|
||||
return 2;
|
||||
}
|
||||
/* 21 bits */
|
||||
else if (n < 2097152) {
|
||||
return 3;
|
||||
}
|
||||
/* 28 bits */
|
||||
else if (n < 268435456) {
|
||||
return 4;
|
||||
}
|
||||
/* 35 bits */
|
||||
else {
|
||||
/* int, 32 bits */
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
#if EXI_ALIGNMENT == BIT_PACKED
|
||||
|
||||
|
||||
int encode(bitstream_t* stream, uint8_t b) {
|
||||
|
@ -87,192 +57,10 @@ int encodeBoolean(bitstream_t* stream, int b) {
|
|||
* b starting with the most significant, i.e. from left to right.
|
||||
*/
|
||||
int encodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t val) {
|
||||
return writeBits(stream, nbits, val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int encodeUnsignedInteger32(bitstream_t* stream, uint32_t n) {
|
||||
int errn = 0;
|
||||
if (n < 128) {
|
||||
/* write byte as is */
|
||||
errn = encode(stream, (uint8_t)n);
|
||||
} else {
|
||||
uint8_t n7BitBlocks = numberOf7BitBlocksToRepresent(n);
|
||||
|
||||
switch (n7BitBlocks) {
|
||||
case 5:
|
||||
errn = encode(stream, (uint8_t)(128 | n));
|
||||
n = n >> 7;
|
||||
if (errn < 0) {
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
errn = encode(stream, (uint8_t)(128 | n));
|
||||
n = n >> 7;
|
||||
if (errn < 0) {
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
errn = encode(stream, (uint8_t)(128 | n));
|
||||
n = n >> 7;
|
||||
if (errn < 0) {
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
errn = encode(stream, (uint8_t)(128 | n));
|
||||
n = n >> 7;
|
||||
if (errn < 0) {
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
/* 0 .. 7 (last byte) */
|
||||
errn = encode(stream, (uint8_t)(0 | n));
|
||||
}
|
||||
if (nbits > 0) {
|
||||
return writeBits(stream, nbits, val);
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int encodeUnsignedInteger64(bitstream_t* stream, uint64_t n) {
|
||||
int errn = 0;
|
||||
uint8_t lastEncode = (uint8_t) n;
|
||||
n >>= 7;
|
||||
|
||||
while (n != 0) {
|
||||
errn = encode(stream, lastEncode | 128);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
lastEncode = (uint8_t) n;
|
||||
n >>= 7;
|
||||
}
|
||||
|
||||
return encode(stream, lastEncode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int encodeInteger32(bitstream_t* stream, int32_t n) {
|
||||
int errn;
|
||||
/* signalize sign */
|
||||
if (n < 0) {
|
||||
errn = encodeBoolean(stream, 1);
|
||||
/* For negative values, the Unsigned Integer holds the
|
||||
* magnitude of the value minus 1 */
|
||||
n = (-n) - 1;
|
||||
} else {
|
||||
errn = encodeBoolean(stream, 0);
|
||||
}
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
return encodeUnsignedInteger32(stream, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int encodeInteger64(bitstream_t* stream, int64_t n) {
|
||||
int errn;
|
||||
/* signalize sign */
|
||||
if (n < 0) {
|
||||
errn = encodeBoolean(stream, 1);
|
||||
/* For negative values, the Unsigned Integer holds the
|
||||
* magnitude of the value minus 1 */
|
||||
n = (-n) - 1;
|
||||
} else {
|
||||
errn = encodeBoolean(stream, 0);
|
||||
}
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
return encodeUnsignedInteger64(stream, n);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Float datatype representation is two consecutive Integers.
|
||||
* The first Integer represents the mantissa of the floating point
|
||||
* number and the second Integer represents the base-10 exponent
|
||||
* of the floating point number.
|
||||
*/
|
||||
int encodeFloat(bitstream_t* stream, float_me_t* f) {
|
||||
int errn = encodeInteger64(stream, f->mantissa);
|
||||
if (errn >= 0) {
|
||||
errn = encodeInteger32(stream, f->exponent);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encode a length prefixed sequence of characters.
|
||||
*/
|
||||
int encodeString(bitstream_t* stream, string_ucs_t* string) {
|
||||
int errn = encodeUnsignedInteger32(stream, string->len);
|
||||
if (errn >= 0) {
|
||||
errn = encodeCharacters(stream, string->codepoints, string->len);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
int encodeStringValue(bitstream_t* stream, string_ucs_t* string) {
|
||||
/* encode string as string table miss */
|
||||
int errn = encodeUnsignedInteger32(stream, string->len+2);
|
||||
if (errn >= 0) {
|
||||
errn = encodeCharacters(stream, string->codepoints, string->len);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a sequence of characters according to a given length.
|
||||
* Each character is represented by its UCS [ISO/IEC 10646]
|
||||
* code point encoded as an Unsigned Integer
|
||||
*/
|
||||
int encodeCharacters(bitstream_t* stream, uint32_t* chars, uint16_t len) {
|
||||
unsigned int i;
|
||||
int errn = 0;
|
||||
for(i=0; i<len && errn>=0; i++) {
|
||||
errn = encodeUnsignedInteger32(stream, chars[i]);
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encode a binary value as a length-prefixed sequence of octets.
|
||||
*/
|
||||
int encodeBinary(bitstream_t* stream, bytes_t* bytes) {
|
||||
unsigned int i;
|
||||
int errn = encodeUnsignedInteger32(stream, bytes->len);
|
||||
|
||||
for(i=0; i<bytes->len && errn>=0; i++) {
|
||||
errn = encode(stream, bytes->data[i]);
|
||||
}
|
||||
return errn;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -283,6 +71,8 @@ int encodeFinish(bitstream_t* stream) {
|
|||
}
|
||||
|
||||
|
||||
#endif /* alignment */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,11 +19,14 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 2011-05-23
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -93,6 +97,7 @@ int encodeFloat(bitstream_t* stream, float_me_t* f);
|
|||
* Encode a length prefixed sequence of characters.
|
||||
*/
|
||||
int encodeString(bitstream_t* stream, string_ucs_t* string);
|
||||
int encodeASCII(bitstream_t* stream, const char* ascii);
|
||||
|
||||
/**
|
||||
* Encode a length prefixed sequence of characters in the sense of string tables
|
||||
|
@ -104,7 +109,9 @@ int encodeStringValue(bitstream_t* stream, string_ucs_t* string);
|
|||
* Each character is represented by its UCS [ISO/IEC 10646]
|
||||
* code point encoded as an Unsigned Integer
|
||||
*/
|
||||
int encodeCharacters(bitstream_t* stream, uint32_t* chars, uint16_t len);
|
||||
int encodeUCSCharacters(bitstream_t* stream, uint32_t* chars, uint16_t len);
|
||||
|
||||
int encodeASCIICharacters(bitstream_t* stream, const char* chars, uint16_t len);
|
||||
|
||||
/**
|
||||
* Encode a binary value as a length-prefixed sequence of octets.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,14 +19,13 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "EXITypes.h"
|
||||
#include "BitInputStream.h"
|
||||
|
@ -39,12 +39,22 @@ int readBuffer(bitstream_t* stream)
|
|||
int errn = 0;
|
||||
if(stream->capacity==0)
|
||||
{
|
||||
#if EXI_STREAM == BYTE_ARRAY
|
||||
if ( (*stream->pos) < stream->size ) {
|
||||
stream->buffer = stream->data[(*stream->pos)++];
|
||||
stream->capacity = BITS_IN_BYTE;
|
||||
} else {
|
||||
errn = -1;
|
||||
errn = EXI_ERROR_INPUT_STREAM_EOF;
|
||||
}
|
||||
#endif
|
||||
#if EXI_STREAM == FILE_STREAM
|
||||
stream->buffer = getc(stream->file);
|
||||
/* EOF cannot be used, 0xFF valid value */
|
||||
if ( feof(stream->file) || ferror(stream->file) ) {
|
||||
return EXI_ERROR_INPUT_STREAM_EOF;
|
||||
}
|
||||
stream->capacity = BITS_IN_BYTE;
|
||||
#endif
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,11 +19,14 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,12 +19,13 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "EXITypes.h"
|
||||
#include "BitOutputStream.h"
|
||||
|
@ -39,12 +41,19 @@ int writeBits(bitstream_t* stream, uint16_t nbits, uint32_t val) {
|
|||
stream->buffer = (stream->buffer << (nbits)) | (val & (0xff
|
||||
>> (BITS_IN_BYTE - nbits)));
|
||||
stream->capacity -= nbits;
|
||||
/* if the buffer is full write it into the data */
|
||||
/* if the buffer is full write byte */
|
||||
if (stream->capacity == 0) {
|
||||
#if EXI_STREAM == BYTE_ARRAY
|
||||
if ((*stream->pos) >= stream->size) {
|
||||
return -1;
|
||||
return EXI_ERROR_OUTPUT_STREAM_EOF;
|
||||
}
|
||||
stream->data[(*stream->pos)++] = 0xFF & stream->buffer;
|
||||
stream->data[(*stream->pos)++] = stream->buffer;
|
||||
#endif
|
||||
#if EXI_STREAM == FILE_STREAM
|
||||
if ( putc(stream->buffer, stream->file) == EOF ) {
|
||||
return EXI_ERROR_OUTPUT_STREAM_EOF;
|
||||
}
|
||||
#endif
|
||||
stream->capacity = BITS_IN_BYTE;
|
||||
stream->buffer = 0;
|
||||
}
|
||||
|
@ -56,19 +65,33 @@ int writeBits(bitstream_t* stream, uint16_t nbits, uint32_t val) {
|
|||
- stream->capacity)));
|
||||
|
||||
nbits -= stream->capacity;
|
||||
#if EXI_STREAM == BYTE_ARRAY
|
||||
if ((*stream->pos) >= stream->size) {
|
||||
return -1;
|
||||
return EXI_ERROR_OUTPUT_STREAM_EOF;
|
||||
}
|
||||
stream->data[(*stream->pos)++] = 0xFF & stream->buffer;
|
||||
stream->data[(*stream->pos)++] = stream->buffer;
|
||||
#endif
|
||||
#if EXI_STREAM == FILE_STREAM
|
||||
if ( putc(stream->buffer, stream->file) == EOF ) {
|
||||
return EXI_ERROR_OUTPUT_STREAM_EOF;
|
||||
}
|
||||
#endif
|
||||
stream->buffer = 0;
|
||||
|
||||
/* write whole bytes */
|
||||
while (nbits >= BITS_IN_BYTE) {
|
||||
nbits -= BITS_IN_BYTE;
|
||||
#if EXI_STREAM == BYTE_ARRAY
|
||||
if ((*stream->pos) >= stream->size) {
|
||||
return -1;
|
||||
return EXI_ERROR_OUTPUT_STREAM_EOF;
|
||||
}
|
||||
stream->data[(*stream->pos)++] = 0xFF & (val >> (nbits));
|
||||
stream->data[(*stream->pos)++] = (val >> (nbits));
|
||||
#endif
|
||||
#if EXI_STREAM == FILE_STREAM
|
||||
if ( putc((val >> (nbits)), stream->file) == EOF ) {
|
||||
return EXI_ERROR_OUTPUT_STREAM_EOF;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* spared bits are kept in the buffer */
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,11 +19,14 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
93
src/codec/ByteDecoderChannel.c
Normal file
93
src/codec/ByteDecoderChannel.c
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "DecoderChannel.h"
|
||||
#include "CoderChannel.h"
|
||||
#include "BitInputStream.h"
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef BYTE_DECODER_CHANNEL_C
|
||||
#define BYTE_DECODER_CHANNEL_C
|
||||
|
||||
|
||||
#if EXI_ALIGNMENT == BYTE_ALIGNMENT
|
||||
|
||||
int decode(bitstream_t* stream, uint8_t* b) {
|
||||
int errn = 0;
|
||||
#if EXI_STREAM == BYTE_ARRAY
|
||||
if ( (*stream->pos) < stream->size ) {
|
||||
*b = stream->data[(*stream->pos)++];
|
||||
} else {
|
||||
errn = EXI_ERROR_INPUT_STREAM_EOF;
|
||||
}
|
||||
#endif /* EXI_STREAM == BYTE_ARRAY */
|
||||
#if EXI_STREAM == FILE_STREAM
|
||||
*b = getc(stream->file);
|
||||
/* EOF cannot be used, 0xFF valid value */
|
||||
if ( feof(stream->file) || ferror(stream->file) ) {
|
||||
return EXI_ERROR_INPUT_STREAM_EOF;
|
||||
}
|
||||
#endif /* EXI_STREAM == FILE_STREAM */
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
int decodeBoolean(bitstream_t* stream, int* b) {
|
||||
uint8_t bb;
|
||||
int errn = decode(stream, &bb);
|
||||
*b = (bb == 0) ? 0 : 1;
|
||||
return errn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes and returns an n-bit unsigned integer using the minimum number of
|
||||
* bytes required for n bits.
|
||||
*/
|
||||
int decodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t* uint32) {
|
||||
uint16_t bitsRead = 0;
|
||||
uint8_t b;
|
||||
int errn = 0;
|
||||
*uint32 = 0;
|
||||
|
||||
while (bitsRead < nbits) {
|
||||
errn = decode(stream, &b);
|
||||
if (errn != 0) {
|
||||
return errn;
|
||||
}
|
||||
*uint32 += (b << bitsRead);
|
||||
bitsRead += 8;
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
125
src/codec/ByteEncoderChannel.c
Normal file
125
src/codec/ByteEncoderChannel.c
Normal file
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "EncoderChannel.h"
|
||||
#include "CoderChannel.h"
|
||||
#include "BitOutputStream.h"
|
||||
#include "EXITypes.h"
|
||||
#include "MethodsBag.h"
|
||||
|
||||
#ifndef BYTE_ENCODER_CHANNEL_C
|
||||
#define BYTE_ENCODER_CHANNEL_C
|
||||
|
||||
#if EXI_ALIGNMENT == BYTE_ALIGNMENT
|
||||
|
||||
|
||||
int encode(bitstream_t* stream, uint8_t b) {
|
||||
#if EXI_STREAM == BYTE_ARRAY
|
||||
if ( (*stream->pos) < stream->size ) {
|
||||
stream->data[(*stream->pos)++] = b;
|
||||
return 0;
|
||||
} else {
|
||||
return EXI_ERROR_OUTPUT_STREAM_EOF;
|
||||
}
|
||||
#endif /* EXI_STREAM == BYTE_ARRAY */
|
||||
#if EXI_STREAM == FILE_STREAM
|
||||
if ( putc(b, stream->file) == EOF ) {
|
||||
return EXI_ERROR_OUTPUT_STREAM_EOF;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
#endif /* EXI_STREAM == FILE_STREAM */
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a single boolean value. A false value is encoded as byte 0 and true
|
||||
* value is encode as byte 1.
|
||||
*/
|
||||
int encodeBoolean(bitstream_t* stream, int b) {
|
||||
uint8_t val = b ? 1 : 0;
|
||||
return encode(stream, val);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encode n-bit unsigned integer. The n least significant bits of parameter
|
||||
* b starting with the most significant, i.e. from left to right.
|
||||
*/
|
||||
int encodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t val) {
|
||||
if (nbits > 0) {
|
||||
if (nbits < 9) {
|
||||
/* 1 byte */
|
||||
encode(stream, val & 0xff);
|
||||
} else if (nbits < 17) {
|
||||
/* 2 bytes */
|
||||
encode(stream, val & 0x00ff);
|
||||
encode(stream, (val & 0xff00) >> 8);
|
||||
} else if (nbits < 25) {
|
||||
/* 3 bytes */
|
||||
encode(stream, val & 0x0000ff);
|
||||
encode(stream, (val & 0x00ff00) >> 8);
|
||||
encode(stream, (val & 0xff0000) >> 16);
|
||||
} else if (nbits < 33) {
|
||||
/* 4 bytes */
|
||||
encode(stream, val & 0x000000ff);
|
||||
encode(stream, (val & 0x0000ff00) >> 8);
|
||||
encode(stream, (val & 0x00ff0000) >> 16);
|
||||
encode(stream, (val & 0xff000000) >> 24);
|
||||
} else {
|
||||
/* TODO Currently not more than 4 Bytes allowed for NBitUnsignedInteger */
|
||||
return EXI_UNSUPPORTED_NBIT_INTEGER_LENGTH;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flush underlying bit output stream.
|
||||
*/
|
||||
int encodeFinish(bitstream_t* stream) {
|
||||
/* no pending bits in byte-aligned mode */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* alignment */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,58 +1,54 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef BYTE_STREAM_C
|
||||
#define BYTE_STREAM_C
|
||||
|
||||
int readBytesFromFile(const char * filename, uint8_t* data, uint16_t size, uint16_t pos) {
|
||||
int readBytesFromFile(const char * filename, uint8_t* data, uint32_t size, uint32_t pos) {
|
||||
FILE* f;
|
||||
int character;
|
||||
|
||||
f = fopen(filename, "rb");
|
||||
|
||||
if (f == NULL) {
|
||||
printf("\n[Error] no valid file handle !\n");
|
||||
return -1;
|
||||
return EXI_ERROR_INPUT_FILE_HANDLE;
|
||||
} else {
|
||||
/* read bytes */
|
||||
while ((character = getc(f)) != EOF) {
|
||||
if (pos >= size) {
|
||||
return -1;
|
||||
return EXI_ERROR_OUT_OF_BYTE_BUFFER;
|
||||
}
|
||||
data[pos++] = (uint8_t) character;
|
||||
/* printf("%u \n", character); */
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
@ -60,7 +56,7 @@ int readBytesFromFile(const char * filename, uint8_t* data, uint16_t size, uint1
|
|||
return pos;
|
||||
}
|
||||
|
||||
int writeBytesToFile(uint8_t* data, uint16_t len, const char * filename) {
|
||||
int writeBytesToFile(uint8_t* data, uint32_t len, const char * filename) {
|
||||
uint16_t rlen;
|
||||
FILE* f = fopen(filename, "wb+");
|
||||
|
||||
|
@ -73,7 +69,7 @@ int writeBytesToFile(uint8_t* data, uint16_t len, const char * filename) {
|
|||
if(rlen == len) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
return EXI_ERROR_OUTPUT_FILE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +1,44 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef BYTE_STREAM_H
|
||||
#define BYTE_STREAM_H
|
||||
|
||||
int writeBytesToFile(uint8_t* data, uint16_t len, const char * filename);
|
||||
int writeBytesToFile(uint8_t* data, uint32_t len, const char * filename);
|
||||
|
||||
int readBytesFromFile(const char * filename, uint8_t* data, uint16_t size, uint16_t pos);
|
||||
int readBytesFromFile(const char * filename, uint8_t* data, uint32_t size, uint32_t pos);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
48
src/codec/CoderChannel.h
Normal file
48
src/codec/CoderChannel.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef CODER_CHANNEL_H
|
||||
#define CODER_CHANNEL_H
|
||||
|
||||
/* EXI alignment mode */
|
||||
#define BIT_PACKED 1
|
||||
#define BYTE_ALIGNMENT 2
|
||||
#define EXI_ALIGNMENT BIT_PACKED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
178
src/codec/DecoderChannel.h
Normal file
178
src/codec/DecoderChannel.h
Normal file
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "EXITypes.h"
|
||||
#include "CoderChannel.h"
|
||||
|
||||
#ifndef DECODER_CHANNEL_H
|
||||
#define DECODER_CHANNEL_H
|
||||
|
||||
/**
|
||||
* Decode a byte value.
|
||||
*/
|
||||
int decode(bitstream_t* stream, uint8_t* b);
|
||||
|
||||
/**
|
||||
* Decode a single boolean value. The value false is represented by the bit
|
||||
* 0, and the value true is represented by the bit 1.
|
||||
*/
|
||||
int decodeBoolean(bitstream_t* stream, int* b);
|
||||
|
||||
/**
|
||||
* Decodes and returns an n-bit unsigned integer.
|
||||
*/
|
||||
int decodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t* uint32);
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int decodeUnsignedInteger(bitstream_t* stream, integer_t* iv);
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int decodeUnsignedInteger16(bitstream_t* stream, uint16_t* uint16);
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32);
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int decodeUnsignedInteger64(bitstream_t* stream, uint64_t* uint64);
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int decodeInteger(bitstream_t* stream, integer_t* iv);
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int decodeInteger32(bitstream_t* stream, int32_t* int32);
|
||||
|
||||
/**
|
||||
* Decode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int decodeInteger64(bitstream_t* stream, int64_t* int64);
|
||||
|
||||
/**
|
||||
* Decode a Float datatype as two consecutive Integers.
|
||||
* The first Integer represents the mantissa of the floating point
|
||||
* number and the second Integer represents the base-10 exponent
|
||||
* of the floating point number.
|
||||
*/
|
||||
int decodeFloat(bitstream_t* stream, float_me_t* f);
|
||||
|
||||
/**
|
||||
* Decode a decimal represented as a Boolean sign followed by two Unsigned
|
||||
* Integers. A sign value of zero (0) is used to represent positive Decimal
|
||||
* values and a sign value of one (1) is used to represent negative Decimal
|
||||
* values The first Integer represents the integral portion of the Decimal
|
||||
* value. The second positive integer represents the fractional portion of
|
||||
* the decimal with the digits in reverse order to preserve leading zeros.
|
||||
*/
|
||||
int decodeDecimal(bitstream_t* stream, decimal_t* d);
|
||||
|
||||
/**
|
||||
* Decode a sequence of characters for a given length.
|
||||
*/
|
||||
int decodeStringOnly(bitstream_t* stream, uint16_t len, string_ucs_t* s);
|
||||
|
||||
/**
|
||||
* Decode a length prefixed sequence of characters.
|
||||
*/
|
||||
int decodeString(bitstream_t* stream, string_ucs_t* s);
|
||||
|
||||
int decodeStringASCII(bitstream_t* stream, string_ascii_t* s);
|
||||
|
||||
/**
|
||||
* Decode a length prefixed sequence of characters in the sense of string tables.
|
||||
* length == 0, local value partition hit
|
||||
* length == 1, global value partition hit
|
||||
* --> string literal is encoded as a String with the length incremented by two
|
||||
*/
|
||||
int decodeStringValue(bitstream_t* stream, string_ucs_t* s);
|
||||
|
||||
/**
|
||||
* Restricted character set
|
||||
*/
|
||||
int decodeRCSStringValue(bitstream_t* stream, rcs_t* rcs, string_ucs_t* s);
|
||||
|
||||
/**
|
||||
* Decode a sequence of characters according to a given length.
|
||||
*/
|
||||
int decodeCharacters(bitstream_t* stream, uint16_t len, uint32_t* chars);
|
||||
int decodeCharactersASCII(bitstream_t* stream, uint16_t len, char* chars);
|
||||
|
||||
/**
|
||||
* Decode a binary value as a length-prefixed sequence of octets.
|
||||
*/
|
||||
int decodeBinary(bitstream_t* stream, bytes_t* bytes);
|
||||
|
||||
/**
|
||||
* Decode Date-Time as sequence of values representing the individual
|
||||
* components of the Date-Time.
|
||||
*/
|
||||
int decodeDateTime(bitstream_t* stream, datetime_type_t type, datetime_t* datetime);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,42 +19,38 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef EXI_CODER_C
|
||||
#define EXI_CODER_C
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "EXITypes.h"
|
||||
#include "BitInputStream.h"
|
||||
#include "BitDecoderChannel.h"
|
||||
#include "DecoderChannel.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "EXICoder.h"
|
||||
|
||||
/*
|
||||
uint16_t exiGetCurrentState(struct exiState* state) {
|
||||
return state->grammarStates[state->currentStack];
|
||||
// return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
int exiPushStack(exi_state_t* state, uint16_t newState, eqname_t* eqn) {
|
||||
if ((state->stackIndex + 1) < EXI_ELEMENT_STACK_SIZE) {
|
||||
state->grammarStack[++state->stackIndex] = newState;
|
||||
/* copy qname */
|
||||
state->elementStack[state->stackIndex].localPart = eqn->localPart;
|
||||
state->elementStack[state->stackIndex].namespaceURI = eqn->namespaceURI;
|
||||
/* qname IF set */
|
||||
if (eqn == NULL) {
|
||||
/* generic SE, UCD profile */
|
||||
} else {
|
||||
/* copy IDs */
|
||||
state->elementStack[state->stackIndex].localPart = eqn->localPart;
|
||||
state->elementStack[state->stackIndex].namespaceURI = eqn->namespaceURI;
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
return EXI_ERROR_OUT_OF_BOUNDS;
|
||||
return EXI_ERROR_OUT_OF_GRAMMAR_STACK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,5 +63,875 @@ int exiPopStack(exi_state_t* state) {
|
|||
}
|
||||
}
|
||||
|
||||
int exiHandleXsiNilTrue(exi_state_t* state) {
|
||||
switch (state->grammarStack[state->stackIndex]) {
|
||||
|
||||
}
|
||||
|
||||
return EXI_ERROR_UNEXPECTED_ATTRIBUTE_XSI_NIL;
|
||||
}
|
||||
|
||||
int exiHandleXsiType(exi_state_t* state, eqname_t* xsiType) {
|
||||
switch(xsiType->namespaceURI) {
|
||||
case 0:
|
||||
switch(xsiType->localPart) {
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch(xsiType->localPart) {
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch(xsiType->localPart) {
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch(xsiType->localPart) {
|
||||
case 0:
|
||||
/* {http://www.w3.org/2001/XMLSchema}ENTITIES */
|
||||
state->grammarStack[state->stackIndex] = 657;
|
||||
break;
|
||||
case 1:
|
||||
/* {http://www.w3.org/2001/XMLSchema}ENTITY */
|
||||
state->grammarStack[state->stackIndex] = 693;
|
||||
break;
|
||||
case 2:
|
||||
/* {http://www.w3.org/2001/XMLSchema}ID */
|
||||
state->grammarStack[state->stackIndex] = 661;
|
||||
break;
|
||||
case 3:
|
||||
/* {http://www.w3.org/2001/XMLSchema}IDREF */
|
||||
state->grammarStack[state->stackIndex] = 666;
|
||||
break;
|
||||
case 4:
|
||||
/* {http://www.w3.org/2001/XMLSchema}IDREFS */
|
||||
state->grammarStack[state->stackIndex] = 659;
|
||||
break;
|
||||
case 5:
|
||||
/* {http://www.w3.org/2001/XMLSchema}NCName */
|
||||
state->grammarStack[state->stackIndex] = 664;
|
||||
break;
|
||||
case 6:
|
||||
/* {http://www.w3.org/2001/XMLSchema}NMTOKEN */
|
||||
state->grammarStack[state->stackIndex] = 687;
|
||||
break;
|
||||
case 7:
|
||||
/* {http://www.w3.org/2001/XMLSchema}NMTOKENS */
|
||||
state->grammarStack[state->stackIndex] = 685;
|
||||
break;
|
||||
case 8:
|
||||
/* {http://www.w3.org/2001/XMLSchema}NOTATION */
|
||||
state->grammarStack[state->stackIndex] = 694;
|
||||
break;
|
||||
case 9:
|
||||
/* {http://www.w3.org/2001/XMLSchema}Name */
|
||||
state->grammarStack[state->stackIndex] = 667;
|
||||
break;
|
||||
case 10:
|
||||
/* {http://www.w3.org/2001/XMLSchema}QName */
|
||||
state->grammarStack[state->stackIndex] = 700;
|
||||
break;
|
||||
case 11:
|
||||
/* {http://www.w3.org/2001/XMLSchema}anySimpleType */
|
||||
state->grammarStack[state->stackIndex] = 673;
|
||||
break;
|
||||
case 12:
|
||||
/* {http://www.w3.org/2001/XMLSchema}anyType */
|
||||
state->grammarStack[state->stackIndex] = 702;
|
||||
break;
|
||||
case 13:
|
||||
/* {http://www.w3.org/2001/XMLSchema}anyURI */
|
||||
state->grammarStack[state->stackIndex] = 705;
|
||||
break;
|
||||
case 14:
|
||||
/* {http://www.w3.org/2001/XMLSchema}base64Binary */
|
||||
state->grammarStack[state->stackIndex] = 677;
|
||||
break;
|
||||
case 15:
|
||||
/* {http://www.w3.org/2001/XMLSchema}boolean */
|
||||
state->grammarStack[state->stackIndex] = 704;
|
||||
break;
|
||||
case 16:
|
||||
/* {http://www.w3.org/2001/XMLSchema}byte */
|
||||
state->grammarStack[state->stackIndex] = 676;
|
||||
break;
|
||||
case 17:
|
||||
/* {http://www.w3.org/2001/XMLSchema}date */
|
||||
state->grammarStack[state->stackIndex] = 710;
|
||||
break;
|
||||
case 18:
|
||||
/* {http://www.w3.org/2001/XMLSchema}dateTime */
|
||||
state->grammarStack[state->stackIndex] = 672;
|
||||
break;
|
||||
case 19:
|
||||
/* {http://www.w3.org/2001/XMLSchema}decimal */
|
||||
state->grammarStack[state->stackIndex] = 670;
|
||||
break;
|
||||
case 20:
|
||||
/* {http://www.w3.org/2001/XMLSchema}double */
|
||||
state->grammarStack[state->stackIndex] = 690;
|
||||
break;
|
||||
case 21:
|
||||
/* {http://www.w3.org/2001/XMLSchema}duration */
|
||||
state->grammarStack[state->stackIndex] = 668;
|
||||
break;
|
||||
case 22:
|
||||
/* {http://www.w3.org/2001/XMLSchema}float */
|
||||
state->grammarStack[state->stackIndex] = 706;
|
||||
break;
|
||||
case 23:
|
||||
/* {http://www.w3.org/2001/XMLSchema}gDay */
|
||||
state->grammarStack[state->stackIndex] = 678;
|
||||
break;
|
||||
case 24:
|
||||
/* {http://www.w3.org/2001/XMLSchema}gMonth */
|
||||
state->grammarStack[state->stackIndex] = 684;
|
||||
break;
|
||||
case 25:
|
||||
/* {http://www.w3.org/2001/XMLSchema}gMonthDay */
|
||||
state->grammarStack[state->stackIndex] = 692;
|
||||
break;
|
||||
case 26:
|
||||
/* {http://www.w3.org/2001/XMLSchema}gYear */
|
||||
state->grammarStack[state->stackIndex] = 699;
|
||||
break;
|
||||
case 27:
|
||||
/* {http://www.w3.org/2001/XMLSchema}gYearMonth */
|
||||
state->grammarStack[state->stackIndex] = 686;
|
||||
break;
|
||||
case 28:
|
||||
/* {http://www.w3.org/2001/XMLSchema}hexBinary */
|
||||
state->grammarStack[state->stackIndex] = 682;
|
||||
break;
|
||||
case 29:
|
||||
/* {http://www.w3.org/2001/XMLSchema}int */
|
||||
state->grammarStack[state->stackIndex] = 660;
|
||||
break;
|
||||
case 30:
|
||||
/* {http://www.w3.org/2001/XMLSchema}integer */
|
||||
state->grammarStack[state->stackIndex] = 708;
|
||||
break;
|
||||
case 31:
|
||||
/* {http://www.w3.org/2001/XMLSchema}language */
|
||||
state->grammarStack[state->stackIndex] = 674;
|
||||
break;
|
||||
case 32:
|
||||
/* {http://www.w3.org/2001/XMLSchema}long */
|
||||
state->grammarStack[state->stackIndex] = 695;
|
||||
break;
|
||||
case 33:
|
||||
/* {http://www.w3.org/2001/XMLSchema}negativeInteger */
|
||||
state->grammarStack[state->stackIndex] = 669;
|
||||
break;
|
||||
case 34:
|
||||
/* {http://www.w3.org/2001/XMLSchema}nonNegativeInteger */
|
||||
state->grammarStack[state->stackIndex] = 665;
|
||||
break;
|
||||
case 35:
|
||||
/* {http://www.w3.org/2001/XMLSchema}nonPositiveInteger */
|
||||
state->grammarStack[state->stackIndex] = 662;
|
||||
break;
|
||||
case 36:
|
||||
/* {http://www.w3.org/2001/XMLSchema}normalizedString */
|
||||
state->grammarStack[state->stackIndex] = 675;
|
||||
break;
|
||||
case 37:
|
||||
/* {http://www.w3.org/2001/XMLSchema}positiveInteger */
|
||||
state->grammarStack[state->stackIndex] = 696;
|
||||
break;
|
||||
case 38:
|
||||
/* {http://www.w3.org/2001/XMLSchema}short */
|
||||
state->grammarStack[state->stackIndex] = 683;
|
||||
break;
|
||||
case 39:
|
||||
/* {http://www.w3.org/2001/XMLSchema}string */
|
||||
state->grammarStack[state->stackIndex] = 707;
|
||||
break;
|
||||
case 40:
|
||||
/* {http://www.w3.org/2001/XMLSchema}time */
|
||||
state->grammarStack[state->stackIndex] = 703;
|
||||
break;
|
||||
case 41:
|
||||
/* {http://www.w3.org/2001/XMLSchema}token */
|
||||
state->grammarStack[state->stackIndex] = 709;
|
||||
break;
|
||||
case 42:
|
||||
/* {http://www.w3.org/2001/XMLSchema}unsignedByte */
|
||||
state->grammarStack[state->stackIndex] = 658;
|
||||
break;
|
||||
case 43:
|
||||
/* {http://www.w3.org/2001/XMLSchema}unsignedInt */
|
||||
state->grammarStack[state->stackIndex] = 681;
|
||||
break;
|
||||
case 44:
|
||||
/* {http://www.w3.org/2001/XMLSchema}unsignedLong */
|
||||
state->grammarStack[state->stackIndex] = 698;
|
||||
break;
|
||||
case 45:
|
||||
/* {http://www.w3.org/2001/XMLSchema}unsignedShort */
|
||||
state->grammarStack[state->stackIndex] = 688;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch(xsiType->localPart) {
|
||||
case 1:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}CanonicalizationMethodType */
|
||||
state->grammarStack[state->stackIndex] = 68;
|
||||
break;
|
||||
case 2:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}CryptoBinary */
|
||||
state->grammarStack[state->stackIndex] = 219;
|
||||
break;
|
||||
case 4:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}DSAKeyValueType */
|
||||
state->grammarStack[state->stackIndex] = 217;
|
||||
break;
|
||||
case 6:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}DigestMethodType */
|
||||
state->grammarStack[state->stackIndex] = 226;
|
||||
break;
|
||||
case 8:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}DigestValueType */
|
||||
state->grammarStack[state->stackIndex] = 230;
|
||||
break;
|
||||
case 12:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}HMACOutputLengthType */
|
||||
state->grammarStack[state->stackIndex] = 607;
|
||||
break;
|
||||
case 15:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}KeyInfoType */
|
||||
state->grammarStack[state->stackIndex] = 232;
|
||||
break;
|
||||
case 18:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}KeyValueType */
|
||||
state->grammarStack[state->stackIndex] = 236;
|
||||
break;
|
||||
case 20:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}ManifestType */
|
||||
state->grammarStack[state->stackIndex] = 283;
|
||||
break;
|
||||
case 24:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}ObjectType */
|
||||
state->grammarStack[state->stackIndex] = 331;
|
||||
break;
|
||||
case 27:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}PGPDataType */
|
||||
state->grammarStack[state->stackIndex] = 264;
|
||||
break;
|
||||
case 33:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}RSAKeyValueType */
|
||||
state->grammarStack[state->stackIndex] = 238;
|
||||
break;
|
||||
case 35:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}ReferenceType */
|
||||
state->grammarStack[state->stackIndex] = 286;
|
||||
break;
|
||||
case 37:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}RetrievalMethodType */
|
||||
state->grammarStack[state->stackIndex] = 242;
|
||||
break;
|
||||
case 39:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}SPKIDataType */
|
||||
state->grammarStack[state->stackIndex] = 271;
|
||||
break;
|
||||
case 44:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}SignatureMethodType */
|
||||
state->grammarStack[state->stackIndex] = 604;
|
||||
break;
|
||||
case 46:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}SignaturePropertiesType */
|
||||
state->grammarStack[state->stackIndex] = 614;
|
||||
break;
|
||||
case 48:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}SignaturePropertyType */
|
||||
state->grammarStack[state->stackIndex] = 617;
|
||||
break;
|
||||
case 49:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}SignatureType */
|
||||
state->grammarStack[state->stackIndex] = 597;
|
||||
break;
|
||||
case 51:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}SignatureValueType */
|
||||
state->grammarStack[state->stackIndex] = 611;
|
||||
break;
|
||||
case 53:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}SignedInfoType */
|
||||
state->grammarStack[state->stackIndex] = 600;
|
||||
break;
|
||||
case 55:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}TransformType */
|
||||
state->grammarStack[state->stackIndex] = 248;
|
||||
break;
|
||||
case 57:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}TransformsType */
|
||||
state->grammarStack[state->stackIndex] = 246;
|
||||
break;
|
||||
case 61:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}X509DataType */
|
||||
state->grammarStack[state->stackIndex] = 253;
|
||||
break;
|
||||
case 64:
|
||||
/* {http://www.w3.org/2000/09/xmldsig#}X509IssuerSerialType */
|
||||
state->grammarStack[state->stackIndex] = 255;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
switch(xsiType->localPart) {
|
||||
case 4:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}CableCheckReqType */
|
||||
state->grammarStack[state->stackIndex] = 49;
|
||||
break;
|
||||
case 6:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}CableCheckResType */
|
||||
state->grammarStack[state->stackIndex] = 60;
|
||||
break;
|
||||
case 8:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}CertificateInstallationReqType */
|
||||
state->grammarStack[state->stackIndex] = 73;
|
||||
break;
|
||||
case 10:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}CertificateInstallationResType */
|
||||
state->grammarStack[state->stackIndex] = 76;
|
||||
break;
|
||||
case 12:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}CertificateUpdateReqType */
|
||||
state->grammarStack[state->stackIndex] = 91;
|
||||
break;
|
||||
case 14:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}CertificateUpdateResType */
|
||||
state->grammarStack[state->stackIndex] = 95;
|
||||
break;
|
||||
case 17:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ChargeParameterDiscoveryReqType */
|
||||
state->grammarStack[state->stackIndex] = 105;
|
||||
break;
|
||||
case 19:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ChargeParameterDiscoveryResType */
|
||||
state->grammarStack[state->stackIndex] = 121;
|
||||
break;
|
||||
case 24:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ContractAuthenticationReqType */
|
||||
state->grammarStack[state->stackIndex] = 177;
|
||||
break;
|
||||
case 26:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ContractAuthenticationResType */
|
||||
state->grammarStack[state->stackIndex] = 180;
|
||||
break;
|
||||
case 34:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}CurrentDemandReqType */
|
||||
state->grammarStack[state->stackIndex] = 182;
|
||||
break;
|
||||
case 36:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}CurrentDemandResType */
|
||||
state->grammarStack[state->stackIndex] = 197;
|
||||
break;
|
||||
case 53:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}LineLockReqType */
|
||||
state->grammarStack[state->stackIndex] = 277;
|
||||
break;
|
||||
case 55:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}LineLockResType */
|
||||
state->grammarStack[state->stackIndex] = 280;
|
||||
break;
|
||||
case 58:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}MeteringReceiptReqType */
|
||||
state->grammarStack[state->stackIndex] = 293;
|
||||
break;
|
||||
case 60:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}MeteringReceiptResType */
|
||||
state->grammarStack[state->stackIndex] = 318;
|
||||
break;
|
||||
case 62:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}MeteringStatusReqType */
|
||||
state->grammarStack[state->stackIndex] = 321;
|
||||
break;
|
||||
case 64:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}MeteringStatusResType */
|
||||
state->grammarStack[state->stackIndex] = 323;
|
||||
break;
|
||||
case 76:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}PaymentDetailsReqType */
|
||||
state->grammarStack[state->stackIndex] = 338;
|
||||
break;
|
||||
case 78:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}PaymentDetailsResType */
|
||||
state->grammarStack[state->stackIndex] = 341;
|
||||
break;
|
||||
case 81:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}PowerDeliveryReqType */
|
||||
state->grammarStack[state->stackIndex] = 345;
|
||||
break;
|
||||
case 83:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}PowerDeliveryResType */
|
||||
state->grammarStack[state->stackIndex] = 482;
|
||||
break;
|
||||
case 85:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}PreChargeReqType */
|
||||
state->grammarStack[state->stackIndex] = 485;
|
||||
break;
|
||||
case 87:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}PreChargeResType */
|
||||
state->grammarStack[state->stackIndex] = 491;
|
||||
break;
|
||||
case 97:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ServiceDetailReqType */
|
||||
state->grammarStack[state->stackIndex] = 523;
|
||||
break;
|
||||
case 99:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ServiceDetailResType */
|
||||
state->grammarStack[state->stackIndex] = 525;
|
||||
break;
|
||||
case 101:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ServiceDiscoveryReqType */
|
||||
state->grammarStack[state->stackIndex] = 545;
|
||||
break;
|
||||
case 103:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ServiceDiscoveryResType */
|
||||
state->grammarStack[state->stackIndex] = 548;
|
||||
break;
|
||||
case 107:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ServicePaymentSelectionReqType */
|
||||
state->grammarStack[state->stackIndex] = 586;
|
||||
break;
|
||||
case 109:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}ServicePaymentSelectionResType */
|
||||
state->grammarStack[state->stackIndex] = 589;
|
||||
break;
|
||||
case 115:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}SessionSetupReqType */
|
||||
state->grammarStack[state->stackIndex] = 591;
|
||||
break;
|
||||
case 117:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}SessionSetupResType */
|
||||
state->grammarStack[state->stackIndex] = 593;
|
||||
break;
|
||||
case 122:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}TerminateChargingReqType */
|
||||
state->grammarStack[state->stackIndex] = 622;
|
||||
break;
|
||||
case 124:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}TerminateChargingResType */
|
||||
state->grammarStack[state->stackIndex] = 624;
|
||||
break;
|
||||
case 127:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}WeldingDetectionReqType */
|
||||
state->grammarStack[state->stackIndex] = 648;
|
||||
break;
|
||||
case 129:
|
||||
/* {urn:iso:15118:2:2010:MsgBody}WeldingDetectionResType */
|
||||
state->grammarStack[state->stackIndex] = 650;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
switch(xsiType->localPart) {
|
||||
case 1:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}AC_EVSEChargeParameterType */
|
||||
state->grammarStack[state->stackIndex] = 3;
|
||||
break;
|
||||
case 3:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}AC_EVSEStatusType */
|
||||
state->grammarStack[state->stackIndex] = 5;
|
||||
break;
|
||||
case 5:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}AC_PEVChargeParameterType */
|
||||
state->grammarStack[state->stackIndex] = 33;
|
||||
break;
|
||||
case 7:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}AC_PEVPowerDeliveryParameterType */
|
||||
state->grammarStack[state->stackIndex] = 46;
|
||||
break;
|
||||
case 9:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}AC_PEVStatusType */
|
||||
state->grammarStack[state->stackIndex] = 35;
|
||||
break;
|
||||
case 10:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}AC_rcdType */
|
||||
state->grammarStack[state->stackIndex] = 15;
|
||||
break;
|
||||
case 14:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}CertificateChainType */
|
||||
state->grammarStack[state->stackIndex] = 79;
|
||||
break;
|
||||
case 20:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ChargingProfileType */
|
||||
state->grammarStack[state->stackIndex] = 348;
|
||||
break;
|
||||
case 23:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_BulkChargingCompleteType */
|
||||
state->grammarStack[state->stackIndex] = 214;
|
||||
break;
|
||||
case 24:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_ChargingCompleteType */
|
||||
state->grammarStack[state->stackIndex] = 216;
|
||||
break;
|
||||
case 26:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_EVSEChargeParameterType */
|
||||
state->grammarStack[state->stackIndex] = 165;
|
||||
break;
|
||||
case 28:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_EVSEStatusCodeType */
|
||||
state->grammarStack[state->stackIndex] = 67;
|
||||
break;
|
||||
case 29:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_EVSEStatusType */
|
||||
state->grammarStack[state->stackIndex] = 64;
|
||||
break;
|
||||
case 31:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_PEVChargeParameterType */
|
||||
state->grammarStack[state->stackIndex] = 109;
|
||||
break;
|
||||
case 33:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_PEVPowerDeliveryParameterType */
|
||||
state->grammarStack[state->stackIndex] = 211;
|
||||
break;
|
||||
case 34:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_PEVReadyType */
|
||||
state->grammarStack[state->stackIndex] = 55;
|
||||
break;
|
||||
case 36:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_PEVStatusCodeType */
|
||||
state->grammarStack[state->stackIndex] = 57;
|
||||
break;
|
||||
case 37:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_PEVStatusType */
|
||||
state->grammarStack[state->stackIndex] = 51;
|
||||
break;
|
||||
case 38:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}DC_protocolVersionType */
|
||||
state->grammarStack[state->stackIndex] = 119;
|
||||
break;
|
||||
case 42:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}EPriceType */
|
||||
state->grammarStack[state->stackIndex] = 697;
|
||||
break;
|
||||
case 45:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}EVSEChargeParameterType */
|
||||
state->grammarStack[state->stackIndex] = 663;
|
||||
break;
|
||||
case 63:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}EVSEStatusType */
|
||||
state->grammarStack[state->stackIndex] = 691;
|
||||
break;
|
||||
case 64:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}EVSESupportedEnergyTransferType */
|
||||
state->grammarStack[state->stackIndex] = 516;
|
||||
break;
|
||||
case 69:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}FloatingValueType */
|
||||
state->grammarStack[state->stackIndex] = 21;
|
||||
break;
|
||||
case 73:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}MeterInfoType */
|
||||
state->grammarStack[state->stackIndex] = 301;
|
||||
break;
|
||||
case 78:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}NotificationType */
|
||||
state->grammarStack[state->stackIndex] = 637;
|
||||
break;
|
||||
case 80:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}PEVChargeParameterType */
|
||||
state->grammarStack[state->stackIndex] = 656;
|
||||
break;
|
||||
case 93:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}PEVPowerDeliveryParameterType */
|
||||
state->grammarStack[state->stackIndex] = 655;
|
||||
break;
|
||||
case 97:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}PEVRequestedEnergyTransferType */
|
||||
state->grammarStack[state->stackIndex] = 107;
|
||||
break;
|
||||
case 101:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}PEVStatusType */
|
||||
state->grammarStack[state->stackIndex] = 679;
|
||||
break;
|
||||
case 102:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}PMaxType */
|
||||
state->grammarStack[state->stackIndex] = 142;
|
||||
break;
|
||||
case 106:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ProfileEntryType */
|
||||
state->grammarStack[state->stackIndex] = 350;
|
||||
break;
|
||||
case 109:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}SecurityType */
|
||||
state->grammarStack[state->stackIndex] = 643;
|
||||
break;
|
||||
case 113:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ServiceCertificateType */
|
||||
state->grammarStack[state->stackIndex] = 495;
|
||||
break;
|
||||
case 115:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ServiceChargeType */
|
||||
state->grammarStack[state->stackIndex] = 512;
|
||||
break;
|
||||
case 117:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ServiceCustomType */
|
||||
state->grammarStack[state->stackIndex] = 517;
|
||||
break;
|
||||
case 119:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ServiceDetailsType */
|
||||
state->grammarStack[state->stackIndex] = 521;
|
||||
break;
|
||||
case 122:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ServiceInternetType */
|
||||
state->grammarStack[state->stackIndex] = 534;
|
||||
break;
|
||||
case 125:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ServiceRCSType */
|
||||
state->grammarStack[state->stackIndex] = 538;
|
||||
break;
|
||||
case 129:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ServiceTagListType */
|
||||
state->grammarStack[state->stackIndex] = 553;
|
||||
break;
|
||||
case 130:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ServiceTagType */
|
||||
state->grammarStack[state->stackIndex] = 497;
|
||||
break;
|
||||
case 131:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ServiceType */
|
||||
state->grammarStack[state->stackIndex] = 689;
|
||||
break;
|
||||
case 133:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}SessionInformationType */
|
||||
state->grammarStack[state->stackIndex] = 631;
|
||||
break;
|
||||
case 138:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}SubCertificatesType */
|
||||
state->grammarStack[state->stackIndex] = 82;
|
||||
break;
|
||||
case 141:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}TariffDescrType */
|
||||
state->grammarStack[state->stackIndex] = 130;
|
||||
break;
|
||||
case 144:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}TariffEntriesType */
|
||||
state->grammarStack[state->stackIndex] = 136;
|
||||
break;
|
||||
case 146:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}TariffEntryType */
|
||||
state->grammarStack[state->stackIndex] = 138;
|
||||
break;
|
||||
case 150:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}TariffTableType */
|
||||
state->grammarStack[state->stackIndex] = 126;
|
||||
break;
|
||||
case 153:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}certificateType */
|
||||
state->grammarStack[state->stackIndex] = 75;
|
||||
break;
|
||||
case 154:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}challengeSignatureType */
|
||||
state->grammarStack[state->stackIndex] = 680;
|
||||
break;
|
||||
case 155:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}contractIDType */
|
||||
state->grammarStack[state->stackIndex] = 90;
|
||||
break;
|
||||
case 156:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}currencyType */
|
||||
state->grammarStack[state->stackIndex] = 128;
|
||||
break;
|
||||
case 157:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}ePriceType */
|
||||
state->grammarStack[state->stackIndex] = 144;
|
||||
break;
|
||||
case 158:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}encryptionPrivateKeyType */
|
||||
state->grammarStack[state->stackIndex] = 88;
|
||||
break;
|
||||
case 159:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}energyProviderType */
|
||||
state->grammarStack[state->stackIndex] = 124;
|
||||
break;
|
||||
case 160:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}evseIDType */
|
||||
state->grammarStack[state->stackIndex] = 297;
|
||||
break;
|
||||
case 161:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}faultCodeType */
|
||||
state->grammarStack[state->stackIndex] = 639;
|
||||
break;
|
||||
case 162:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}faultMsgType */
|
||||
state->grammarStack[state->stackIndex] = 641;
|
||||
break;
|
||||
case 163:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}genChallengeType */
|
||||
state->grammarStack[state->stackIndex] = 179;
|
||||
break;
|
||||
case 164:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}lockStatusType */
|
||||
state->grammarStack[state->stackIndex] = 11;
|
||||
break;
|
||||
case 165:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}maxPhasesType */
|
||||
state->grammarStack[state->stackIndex] = 32;
|
||||
break;
|
||||
case 166:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}messageSignatureType */
|
||||
state->grammarStack[state->stackIndex] = 671;
|
||||
break;
|
||||
case 167:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}meterIDType */
|
||||
state->grammarStack[state->stackIndex] = 303;
|
||||
break;
|
||||
case 168:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}meterSignatureType */
|
||||
state->grammarStack[state->stackIndex] = 315;
|
||||
break;
|
||||
case 169:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}meterStatusType */
|
||||
state->grammarStack[state->stackIndex] = 310;
|
||||
break;
|
||||
case 170:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}paymentOptionType */
|
||||
state->grammarStack[state->stackIndex] = 531;
|
||||
break;
|
||||
case 171:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}paymentOptionsType */
|
||||
state->grammarStack[state->stackIndex] = 529;
|
||||
break;
|
||||
case 172:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}percentValueType */
|
||||
state->grammarStack[state->stackIndex] = 59;
|
||||
break;
|
||||
case 173:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}pevIDType */
|
||||
state->grammarStack[state->stackIndex] = 295;
|
||||
break;
|
||||
case 174:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}protocolVersionType */
|
||||
state->grammarStack[state->stackIndex] = 635;
|
||||
break;
|
||||
case 175:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}pubKeyType */
|
||||
state->grammarStack[state->stackIndex] = 85;
|
||||
break;
|
||||
case 176:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}responseCodeType */
|
||||
state->grammarStack[state->stackIndex] = 62;
|
||||
break;
|
||||
case 177:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}retryCounterType */
|
||||
state->grammarStack[state->stackIndex] = 104;
|
||||
break;
|
||||
case 178:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}serviceCategoryType */
|
||||
state->grammarStack[state->stackIndex] = 503;
|
||||
break;
|
||||
case 179:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}serviceIDType */
|
||||
state->grammarStack[state->stackIndex] = 499;
|
||||
break;
|
||||
case 180:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}serviceNameType */
|
||||
state->grammarStack[state->stackIndex] = 501;
|
||||
break;
|
||||
case 181:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}serviceScopeType */
|
||||
state->grammarStack[state->stackIndex] = 505;
|
||||
break;
|
||||
case 182:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}sessionIDType */
|
||||
state->grammarStack[state->stackIndex] = 299;
|
||||
break;
|
||||
case 183:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}signaturePrivateKeyType */
|
||||
state->grammarStack[state->stackIndex] = 99;
|
||||
break;
|
||||
case 184:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}standbyType */
|
||||
state->grammarStack[state->stackIndex] = 7;
|
||||
break;
|
||||
case 185:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}switchStatusType */
|
||||
state->grammarStack[state->stackIndex] = 13;
|
||||
break;
|
||||
case 186:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}tariffDescriptionType */
|
||||
state->grammarStack[state->stackIndex] = 134;
|
||||
break;
|
||||
case 187:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}tariffIDType */
|
||||
state->grammarStack[state->stackIndex] = 132;
|
||||
break;
|
||||
case 188:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}tariffStartType */
|
||||
state->grammarStack[state->stackIndex] = 140;
|
||||
break;
|
||||
case 189:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}timeType */
|
||||
state->grammarStack[state->stackIndex] = 17;
|
||||
break;
|
||||
case 190:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}unitMultiplierType */
|
||||
state->grammarStack[state->stackIndex] = 23;
|
||||
break;
|
||||
case 191:
|
||||
/* {urn:iso:15118:2:2010:MsgDataTypes}unitSymbolType */
|
||||
state->grammarStack[state->stackIndex] = 25;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
switch(xsiType->localPart) {
|
||||
case 1:
|
||||
/* {urn:iso:15118:2:2010:MsgDef}BodyBaseType */
|
||||
state->grammarStack[state->stackIndex] = 701;
|
||||
break;
|
||||
case 3:
|
||||
/* {urn:iso:15118:2:2010:MsgDef}BodyType */
|
||||
state->grammarStack[state->stackIndex] = 646;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
switch(xsiType->localPart) {
|
||||
case 0:
|
||||
/* {urn:iso:15118:2:2010:MsgHeader}MessageHeaderType */
|
||||
state->grammarStack[state->stackIndex] = 629;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* RUNTIME RULES
|
||||
* each rule has 2 ids and counts backwards from -1, -2, ...
|
||||
* 1) StartTagContent (e.g., -1, -3, -5, ...)
|
||||
* 2) ElementContent (e.g., -2, -4, -6)
|
||||
*
|
||||
*/
|
||||
|
||||
int exiIsStartContent(int16_t ruleID) {
|
||||
return (ruleID % 2 != 0);
|
||||
}
|
||||
|
||||
int exiMoveToElementContentRule(exi_state_t* state) {
|
||||
int16_t currentID = state->grammarStack[state->stackIndex];
|
||||
switch (currentID) {
|
||||
|
||||
}
|
||||
|
||||
if (currentID < 0) {
|
||||
if( exiIsStartContent(currentID) ) {
|
||||
state->grammarStack[state->stackIndex] = currentID - 1;
|
||||
}
|
||||
} else {
|
||||
return EXI_ERROR_UNEXPECTED_ATTRIBUTE_MOVE_TO_CONTENT_RULE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,11 +19,14 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -30,19 +34,29 @@ extern "C" {
|
|||
#ifndef EXI_CODER_H
|
||||
#define EXI_CODER_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
#define IS_STRICT 1
|
||||
#define DOCUMENT 0
|
||||
#define DOC_CONTENT 1
|
||||
#define DOC_END 2
|
||||
#define UR_TYPE_GRAMMAR_0 71
|
||||
#define UR_TYPE_GRAMMAR_1 654
|
||||
|
||||
|
||||
/* uint16_t exiGetCurrentState(struct exiState* state); */
|
||||
|
||||
int exiPushStack(exi_state_t* state, uint16_t newState, eqname_t* eqn);
|
||||
|
||||
int exiPopStack(exi_state_t* state);
|
||||
|
||||
int exiHandleXsiNilTrue(exi_state_t* state);
|
||||
|
||||
int exiHandleXsiType(exi_state_t* state, eqname_t* xsiType);
|
||||
|
||||
int exiIsStartContent(int16_t ruleID);
|
||||
|
||||
int exiMoveToElementContentRule(exi_state_t* state);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,11 +19,14 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -32,7 +36,7 @@ extern "C" {
|
|||
|
||||
#include "EXITypes.h"
|
||||
|
||||
int exiInitDecoder(bitstream_t* stream, exi_state_t* state);
|
||||
int exiInitDecoder(bitstream_t* stream, exi_state_t* state, exi_name_table_runtime_t runtimeTable);
|
||||
|
||||
int exiDecodeNextEvent(bitstream_t* stream, exi_state_t* state,
|
||||
exi_event_t* nextEvent);
|
||||
|
@ -41,20 +45,38 @@ int exiDecodeStartDocument(bitstream_t* stream, exi_state_t* state);
|
|||
|
||||
int exiDecodeEndDocument(bitstream_t* stream, exi_state_t* state);
|
||||
|
||||
int exiDecodeStartElement(bitstream_t* stream, exi_state_t* state,
|
||||
eqname_t* se);
|
||||
int
|
||||
exiDecodeStartElement(bitstream_t* stream, exi_state_t* state,
|
||||
eqname_t* se);
|
||||
|
||||
int exiDecodeStartElementGeneric(bitstream_t* stream, exi_state_t* state,
|
||||
eqname_t* se);
|
||||
qname_t* qname);
|
||||
|
||||
int exiDecodeEndElement(bitstream_t* stream, exi_state_t* state,
|
||||
eqname_t* ee);
|
||||
int exiDecodeEndElement(bitstream_t* stream, exi_state_t* state, eqname_t* ee);
|
||||
|
||||
int exiDecodeEndElementUndeclared(bitstream_t* stream, exi_state_t* state, eqname_t* ee);
|
||||
|
||||
int exiDecodeCharacters(bitstream_t* stream, exi_state_t* state,
|
||||
exi_value_t* val);
|
||||
|
||||
int exiDecodeAttribute(bitstream_t* stream, exi_state_t* state,
|
||||
eqname_t* at, exi_value_t* val);
|
||||
int exiDecodeCharactersGeneric(bitstream_t* stream, exi_state_t* state,
|
||||
exi_value_t* val);
|
||||
|
||||
int exiDecodeCharactersGenericUndeclared(bitstream_t* stream, exi_state_t* state,
|
||||
exi_value_t* val);
|
||||
|
||||
|
||||
int exiDecodeAttribute(bitstream_t* stream, exi_state_t* state, eqname_t* at,
|
||||
exi_value_t* val);
|
||||
|
||||
int exiDecodeAttributeXsiNil(bitstream_t* stream, exi_state_t* state,
|
||||
exi_value_t* val);
|
||||
|
||||
int exiDecodeAttributeXsiType(bitstream_t* stream, exi_state_t* state,
|
||||
exi_value_t* val);
|
||||
|
||||
int exiDecodeAttributeGenericUndeclared(bitstream_t* stream, exi_state_t* state, qname_t* at,
|
||||
exi_value_t* val);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,11 +19,14 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -30,22 +34,22 @@ extern "C" {
|
|||
#ifndef EXI_ENCODER_H
|
||||
#define EXI_ENCODER_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
int exiInitEncoder(bitstream_t* stream, exi_state_t* state);
|
||||
int exiInitEncoder(bitstream_t* stream, exi_state_t* state, exi_name_table_runtime_t runtimeTable);
|
||||
|
||||
int exiEncodeStartDocument(bitstream_t* stream, exi_state_t* state);
|
||||
|
||||
int exiEncodeEndDocument(bitstream_t* stream, exi_state_t* state);
|
||||
|
||||
int exiEncodeStartElement(bitstream_t* stream, exi_state_t* state,
|
||||
int
|
||||
exiEncodeStartElement(bitstream_t* stream, exi_state_t* state,
|
||||
eqname_t* se);
|
||||
|
||||
int exiEncodeEndElement(bitstream_t* stream, exi_state_t* state, eqname_t* ee);
|
||||
int exiEncodeStartElementGeneric(bitstream_t* stream, exi_state_t* state,
|
||||
string_ascii_t* namespaceURI, string_ascii_t* localName);
|
||||
|
||||
int exiEncodeEndElement(bitstream_t* stream, exi_state_t* state);
|
||||
|
||||
int exiEncodeCharacters(bitstream_t* stream, exi_state_t* state,
|
||||
exi_value_t* val);
|
||||
|
@ -53,6 +57,12 @@ int exiEncodeCharacters(bitstream_t* stream, exi_state_t* state,
|
|||
int exiEncodeAttribute(bitstream_t* stream, exi_state_t* state, eqname_t* at,
|
||||
exi_value_t* val);
|
||||
|
||||
int exiEncodeAttributeXsiNil(bitstream_t* stream, exi_state_t* state,
|
||||
exi_value_t* val);
|
||||
|
||||
int exiEncodeAttributeXsiType(bitstream_t* stream, exi_state_t* state,
|
||||
exi_value_t* val);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,34 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "EXIHeaderDecoder.h"
|
||||
#include "BitInputStream.h"
|
||||
#include "BitDecoderChannel.h"
|
||||
#include "DecoderChannel.h"
|
||||
|
||||
#ifndef EXI_HEADER_DECODER_C
|
||||
#define EXI_HEADER_DECODER_C
|
||||
|
@ -41,10 +42,10 @@ int readEXIHeader(bitstream_t* stream) {
|
|||
}
|
||||
if(header == '$') {
|
||||
/* we do not support "EXI Cookie" */
|
||||
errn = -1;
|
||||
errn = EXI_UNSUPPORTED_HEADER_COOKIE;
|
||||
} else if ( header & 0x20 ) {
|
||||
/* we do not support "Presence Bit for EXI Options" */
|
||||
errn = -2;
|
||||
errn = EXI_UNSUPPORTED_HEADER_OPTIONS;
|
||||
} else {
|
||||
/* Yes, a *simple* header */
|
||||
errn = 0;
|
||||
|
|
|
@ -1,34 +1,36 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef EXI_HEADER_DECODER_H
|
||||
|
|
|
@ -1,40 +1,41 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "EXIHeaderEncoder.h"
|
||||
#include "BitOutputStream.h"
|
||||
#include "BitEncoderChannel.h"
|
||||
#include "EncoderChannel.h"
|
||||
|
||||
#ifndef EXI_HEADER_ENCODER_C
|
||||
#define EXI_HEADER_ENCODER_C
|
||||
|
||||
int writeEXIHeader(bitstream_t* stream) {
|
||||
return writeBits(stream, 8, 144);
|
||||
return writeBits(stream, 8, 128);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,34 +1,36 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef EXI_HEADER_ENCODER_H
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,31 +19,44 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifndef EXI_TYPES_H
|
||||
#define EXI_TYPES_H
|
||||
|
||||
#define BITS_IN_BYTE 8
|
||||
|
||||
#define DATETIME_YEAR_OFFSET 2000
|
||||
#define DATETIME_NUMBER_BITS_MONTHDAY 9
|
||||
#define DATETIME_NUMBER_BITS_TIME 17
|
||||
#define DATETIME_NUMBER_BITS_TIMEZONE 11
|
||||
#define DATETIME_MONTH_MULTIPLICATOR 32
|
||||
#define DATETIME_TIMEZONE_OFFSET_IN_MINUTES 896
|
||||
|
||||
#define UINT_MAX_VALUE 65535
|
||||
|
||||
#define EXI_ELEMENT_STACK_SIZE 16
|
||||
/* EXI stream */
|
||||
#define BYTE_ARRAY 1
|
||||
#define FILE_STREAM 2
|
||||
#define EXI_STREAM BYTE_ARRAY
|
||||
/*#define EXI_STREAM FILE_STREAM*/
|
||||
|
||||
/* EXI automaton methods prefixes such as "inline" etc. */
|
||||
#ifndef EXI_MPFX
|
||||
#define EXI_MPFX
|
||||
#endif
|
||||
#define EXI_ELEMENT_STACK_SIZE 16
|
||||
|
||||
#define FLOAT_EXPONENT_SPECIAL_VALUES -16384
|
||||
#define FLOAT_MANTISSA_INFINITY 1
|
||||
|
@ -50,15 +64,94 @@ extern "C" {
|
|||
#define FLOAT_MANTISSA_NOT_A_NUMBER 0
|
||||
|
||||
typedef struct {
|
||||
/* Integer Array */
|
||||
uint16_t size; /* array size */
|
||||
#if EXI_STREAM == BYTE_ARRAY
|
||||
/* Byte Array */
|
||||
uint32_t size; /* array size */
|
||||
uint8_t* data; /* int data array */
|
||||
uint16_t* pos; /* next position in array */
|
||||
uint32_t* pos; /* next position in array */
|
||||
#endif
|
||||
#if EXI_STREAM == FILE_STREAM
|
||||
/* FILE */
|
||||
FILE *file;
|
||||
#endif
|
||||
/* Current byte buffer & its remaining bit capacity */
|
||||
uint8_t buffer;
|
||||
uint16_t capacity;
|
||||
uint8_t capacity;
|
||||
} bitstream_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
/* Binary */
|
||||
BINARY_BASE64,
|
||||
BINARY_HEX,
|
||||
/* Boolean */
|
||||
BOOLEAN,
|
||||
BOOLEAN_FACET,
|
||||
/* Decimal */
|
||||
DECIMAL,
|
||||
/* Float & Double */
|
||||
FLOAT,
|
||||
/* N-Bit Unsigned Integer */
|
||||
NBIT_UNSIGNED_INTEGER,
|
||||
/* Unsigned Integer */
|
||||
UNSIGNED_INTEGER,
|
||||
/* (Signed) Integer */
|
||||
INTEGER,
|
||||
/* Datetime */
|
||||
DATETIME,
|
||||
/* String */
|
||||
STRING,
|
||||
/* Restricted Character Set String */
|
||||
RCS_STRING,
|
||||
/* Enumeration */
|
||||
ENUMERATION,
|
||||
/* List */
|
||||
LIST
|
||||
} exi_datatype_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
/* Unsigned Integer */
|
||||
UNSIGNED_INTEGER_8,
|
||||
UNSIGNED_INTEGER_16,
|
||||
UNSIGNED_INTEGER_32,
|
||||
UNSIGNED_INTEGER_64,
|
||||
/* (Signed) Integer */
|
||||
INTEGER_8,
|
||||
INTEGER_16,
|
||||
INTEGER_32,
|
||||
INTEGER_64
|
||||
} exi_integer_type_t;
|
||||
|
||||
typedef enum {
|
||||
START_DOCUMENT,
|
||||
END_DOCUMENT,
|
||||
START_ELEMENT,
|
||||
START_ELEMENT_GENERIC,
|
||||
START_ELEMENT_GENERIC_UNDECLARED,
|
||||
END_ELEMENT,
|
||||
END_ELEMENT_UNDECLARED,
|
||||
CHARACTERS,
|
||||
CHARACTERS_GENERIC,
|
||||
CHARACTERS_GENERIC_UNDECLARED,
|
||||
ATTRIBUTE_XSI_TYPE,
|
||||
ATTRIBUTE_XSI_NIL,
|
||||
ATTRIBUTE,
|
||||
ATTRIBUTE_GENERIC,
|
||||
ATTRIBUTE_INVALID_VALUE,
|
||||
ATTRIBUTE_ANY_INVALID_VALUE,
|
||||
ATTRIBUTE_GENERIC_UNDECLARED,
|
||||
/* error state */
|
||||
ERROR
|
||||
} exi_event_t;
|
||||
|
||||
|
||||
/* differ datetime types */
|
||||
typedef enum {
|
||||
gYear, gYearMonth, date, dateTime, gMonth, gMonthDay, gDay, time
|
||||
} datetime_type_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* Bytes Size and array container */
|
||||
uint16_t size;
|
||||
|
@ -76,6 +169,40 @@ typedef struct {
|
|||
uint16_t len;
|
||||
} string_ucs_t;
|
||||
|
||||
/* Restricted Characeter Set */
|
||||
typedef struct {
|
||||
/* size and UCS character codep*/
|
||||
uint16_t size;
|
||||
/* rcs codepoints */
|
||||
uint32_t* codepoints;
|
||||
/* character coding length*/
|
||||
uint8_t codingLength; /* less than 256 characters */
|
||||
} rcs_t;
|
||||
|
||||
/* ASCII strings */
|
||||
typedef struct {
|
||||
/* size of String array */
|
||||
uint16_t size;
|
||||
char* chars;
|
||||
/* current length can be retrieved by calling strlen(chars)*/
|
||||
} string_ascii_t;
|
||||
|
||||
typedef struct {
|
||||
exi_integer_type_t type;
|
||||
union {
|
||||
/* unsigned values */
|
||||
int8_t int8;
|
||||
int16_t int16;
|
||||
int32_t int32;
|
||||
int32_t int64;
|
||||
/* (signed) values */
|
||||
uint8_t uint8;
|
||||
uint16_t uint16;
|
||||
uint32_t uint32;
|
||||
uint64_t uint64;
|
||||
} val;
|
||||
} integer_t;
|
||||
|
||||
typedef struct {
|
||||
/* range of the mantissa is -(2^63) to 2^63-1 */
|
||||
int64_t mantissa;
|
||||
|
@ -83,102 +210,211 @@ typedef struct {
|
|||
int32_t exponent; /* base-10 */
|
||||
} float_me_t;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* Binary */
|
||||
BINARY_BASE64, BINARY_HEX,
|
||||
/* Boolean */
|
||||
BOOLEAN,
|
||||
/* Decimal */
|
||||
DECIMAL,
|
||||
/* Float */
|
||||
FLOAT, DOUBLE,
|
||||
/* N-Bit Integer */
|
||||
NBIT_INTEGER_32, NBIT_INTEGER_64, NBIT_INTEGER_BIG,
|
||||
/* Unsigned Integer */
|
||||
UNSIGNED_INTEGER_16, UNSIGNED_INTEGER_32, UNSIGNED_INTEGER_64, UNSIGNED_INTEGER_BIG,
|
||||
/* (Signed) Integer */
|
||||
INTEGER_16, INTEGER_32, INTEGER_64, INTEGER_BIG,
|
||||
/* Datetime */
|
||||
DATETIME,
|
||||
/* String */
|
||||
STRING,
|
||||
/* Enumeration */
|
||||
ENUMERATION,
|
||||
/* List */
|
||||
LIST
|
||||
} exi_datatype_t;
|
||||
typedef struct {
|
||||
/* a sign value */
|
||||
int negative;
|
||||
/* represents the integral portion of the Decimal */
|
||||
integer_t integral;
|
||||
/* represents the fractional portion of the Decimal with the digits in reverse order to preserve leading zeros */
|
||||
integer_t reverseFraction;
|
||||
} decimal_t;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* datetime type */
|
||||
datetime_type_t type;
|
||||
/* values */
|
||||
int32_t year;
|
||||
uint32_t monthDay;
|
||||
uint32_t time;
|
||||
int presenceFractionalSecs;
|
||||
uint32_t fractionalSecs;
|
||||
int presenceTimezone;
|
||||
uint32_t timezone;
|
||||
} datetime_t;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
START_DOCUMENT,
|
||||
END_DOCUMENT,
|
||||
START_ELEMENT,
|
||||
START_ELEMENT_GENERIC, /* not supported yet */
|
||||
END_ELEMENT,
|
||||
CHARACTERS,
|
||||
CHARACTERS_GENERIC, /* not supported yet */
|
||||
ATTRIBUTE,
|
||||
ATTRIBUTE_GENERIC, /* not supported yet */
|
||||
/* error state */
|
||||
ERROR
|
||||
} exi_event_t;
|
||||
|
||||
/* TODO list support */
|
||||
typedef struct {
|
||||
/* List container with memory size */
|
||||
uint16_t size;
|
||||
uint8_t* data;
|
||||
/* list item type */
|
||||
exi_datatype_t type;
|
||||
/* number of items */
|
||||
uint16_t len;
|
||||
/* List container with memory size */
|
||||
uint16_t size;
|
||||
uint8_t* data;
|
||||
} list_t;
|
||||
|
||||
|
||||
/* efficient ID qname */
|
||||
typedef struct {
|
||||
uint16_t namespaceURI;
|
||||
uint16_t localPart;
|
||||
} eqname_t;
|
||||
|
||||
typedef struct {
|
||||
/* stack of grammar states and elements */
|
||||
uint16_t grammarStack [EXI_ELEMENT_STACK_SIZE];
|
||||
eqname_t elementStack [EXI_ELEMENT_STACK_SIZE];
|
||||
/* ascii qname */
|
||||
typedef struct {
|
||||
string_ascii_t namespaceURI;
|
||||
string_ascii_t localName;
|
||||
} qname_t;
|
||||
|
||||
/* ==================================== */
|
||||
/* LocalName Entries */
|
||||
struct exiNamePartition {
|
||||
/* length of array */
|
||||
uint16_t len;
|
||||
/* array of string entries */
|
||||
char** names;
|
||||
};
|
||||
|
||||
typedef struct exiNameTablePrepopulated {
|
||||
/* length of both arrays (uris & localNames) */
|
||||
uint16_t len;
|
||||
/* URI entries*/
|
||||
char** uris;
|
||||
/* localName entries divided by URI */
|
||||
struct exiNamePartition * localNames;
|
||||
} exi_name_table_prepopulated_t;
|
||||
|
||||
|
||||
#define EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_CHARACTERS 500
|
||||
#define EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_ENTRIES 25
|
||||
#define EXI_RESERVED_NUMBER_URI_PARTITION_ENTRIES 5
|
||||
#define EXI_RESERVED_NUMBER_LOCALNAME_PARTITION_ENTRIES 10
|
||||
|
||||
typedef enum {
|
||||
URI_PARTITION,
|
||||
LOCALNAME_PARTITION
|
||||
} exi_name_partition_type_t;
|
||||
|
||||
typedef struct {
|
||||
char* uri;
|
||||
uint16_t uriID;
|
||||
} exi_uri_partition_t;
|
||||
|
||||
typedef struct {
|
||||
char* localName;
|
||||
uint16_t localNameID;
|
||||
uint16_t uriID;
|
||||
} exi_localname_partition_t;
|
||||
|
||||
typedef struct {
|
||||
exi_name_partition_type_t namePartitionType;
|
||||
struct
|
||||
{
|
||||
exi_uri_partition_t uriPartition;
|
||||
exi_localname_partition_t localNamePartition;
|
||||
} entry;
|
||||
} exi_name_partition_t;
|
||||
|
||||
typedef struct exiNameTableRuntime {
|
||||
/* maximum number of characters in the name partitions entries PLUS null terminators */
|
||||
char characters[EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_CHARACTERS + EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_ENTRIES];
|
||||
uint16_t numberOfUsedCharacters; /* initially zero <= EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_CHARACTERS */
|
||||
/* maximum number of name partitions entries. Name partitions entries consist in all uri, and local-name partition entries */
|
||||
exi_name_partition_t namePartitionsEntries[EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_ENTRIES];
|
||||
/* uint16_t numberOfUsedNamePartitions; */ /* initially zero */
|
||||
/* added entries */
|
||||
uint16_t addedUriEntries; /* initially zero */
|
||||
uint16_t addedLocalNameEntries; /* initially zero */
|
||||
} exi_name_table_runtime_t;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* stack of grammar states */
|
||||
int16_t grammarStack[EXI_ELEMENT_STACK_SIZE];
|
||||
/* stack of grammar elements */
|
||||
eqname_t elementStack[EXI_ELEMENT_STACK_SIZE];
|
||||
uint16_t stackIndex;
|
||||
/* event-code */
|
||||
uint32_t eventCode;
|
||||
/* string table entries */
|
||||
exi_name_table_prepopulated_t nameTablePrepopulated;
|
||||
exi_name_table_runtime_t nameTableRuntime;
|
||||
} exi_state_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
/* type of value */
|
||||
exi_datatype_t type;
|
||||
|
||||
/* base types */
|
||||
int boolean;
|
||||
integer_t integer;
|
||||
|
||||
/*uint16_t uint8;
|
||||
uint16_t uint16;
|
||||
uint32_t uint32;
|
||||
uint64_t uint64;
|
||||
int8_t int8;
|
||||
int16_t int16;
|
||||
int32_t int32;
|
||||
int64_t int64;
|
||||
int64_t int64;*/
|
||||
|
||||
uint32_t enumeration;
|
||||
|
||||
/* Bytes, Strings and Lists are not native types anymore */
|
||||
bytes_t binary;
|
||||
string_ucs_t string;
|
||||
float_me_t float_me;
|
||||
decimal_t decimal;
|
||||
datetime_t datetime;
|
||||
list_t list;
|
||||
eqname_t eqname;
|
||||
} exi_value_t;
|
||||
|
||||
|
||||
/*
|
||||
* ERROR-Codes
|
||||
*/
|
||||
# define EXI_ERROR_OUT_OF_BOUNDS -100
|
||||
#define EXI_ERROR_INPUT_STREAM_EOF -10
|
||||
#define EXI_ERROR_OUTPUT_STREAM_EOF -11
|
||||
#define EXI_ERROR_INPUT_FILE_HANDLE -12
|
||||
#define EXI_ERROR_OUTPUT_FILE -13
|
||||
|
||||
# define EXI_ERROR_UNKOWN_EVENT_CODE -110
|
||||
#define EXI_ERROR_OUT_OF_BOUNDS -100
|
||||
#define EXI_ERROR_OUT_OF_STRING_BUFFER -101
|
||||
#define EXI_ERROR_OUT_OF_ASCII_BUFFER -102
|
||||
#define EXI_ERROR_OUT_OF_BYTE_BUFFER -103
|
||||
#define EXI_ERROR_OUT_OF_GRAMMAR_STACK -104
|
||||
|
||||
#define EXI_ERROR_UNKOWN_EVENT -109
|
||||
#define EXI_ERROR_UNKOWN_EVENT_CODE -110
|
||||
#define EXI_ERROR_UNEXPECTED_EVENT_LEVEL1 -111
|
||||
#define EXI_ERROR_UNEXPECTED_EVENT_LEVEL2 -112
|
||||
|
||||
#define EXI_ERROR_UNEXPECTED_START_DOCUMENT -113
|
||||
#define EXI_ERROR_UNEXPECTED_END_DOCUMENT -114
|
||||
#define EXI_ERROR_UNEXPECTED_START_ELEMENT -115
|
||||
#define EXI_ERROR_UNEXPECTED_START_ELEMENT_GENERIC -116
|
||||
#define EXI_ERROR_UNEXPECTED_END_ELEMENT -117
|
||||
#define EXI_ERROR_UNEXPECTED_CHARACTERS -118
|
||||
#define EXI_ERROR_UNEXPECTED_ATTRIBUTE -119
|
||||
#define EXI_ERROR_UNEXPECTED_ATTRIBUTE_XSI_TYPE -120
|
||||
#define EXI_ERROR_UNEXPECTED_ATTRIBUTE_XSI_NIL -121
|
||||
#define EXI_ERROR_UNEXPECTED_GRAMMAR_ID -122
|
||||
#define EXI_ERROR_UNEXPECTED_ATTRIBUTE_MOVE_TO_CONTENT_RULE -123
|
||||
|
||||
|
||||
#define EXI_UNSUPPORTED_STRING_TABLE_LOCAL_HIT -130
|
||||
#define EXI_UNSUPPORTED_STRING_TABLE_GLOBAL_HIT -131
|
||||
#define EXI_UNSUPPORTED_NBIT_INTEGER_LENGTH -132
|
||||
#define EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS -133
|
||||
#define EXI_UNSUPPORTED_INTEGER_VALUE_TYPE -134
|
||||
#define EXI_UNSUPPORTED_INTEGER_VALUE -135
|
||||
#define EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE -136
|
||||
#define EXI_UNSUPPORTED_LIST_VALUE_TYPE -137
|
||||
#define EXI_UNSUPPORTED_HEADER_COOKIE -138
|
||||
#define EXI_UNSUPPORTED_HEADER_OPTIONS -139
|
||||
|
||||
#define EXI_ERROR_UNEXPECTED_BYTE_VALUE -200
|
||||
#define EXI_ERROR_UNEXPECTED_DATETIME_TYPE -201
|
||||
|
||||
#define EXI_ERROR_CONVERSION_NO_ASCII_CHARACTERS -300
|
||||
#define EXI_ERROR_CONVERSION_TYPE_TO_STRING -301
|
||||
|
||||
#endif
|
||||
|
||||
|
|
180
src/codec/EncoderChannel.h
Normal file
180
src/codec/EncoderChannel.h
Normal file
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
#ifndef ENCODER_CHANNEL_H
|
||||
#define ENCODER_CHANNEL_H
|
||||
|
||||
/**
|
||||
* Encode a byte value.
|
||||
*/
|
||||
int encode(bitstream_t* stream, uint8_t b);
|
||||
|
||||
/**
|
||||
* Encode a single boolean value. A false value is encoded as 0 and true
|
||||
* value is encode as 1.
|
||||
*/
|
||||
int encodeBoolean(bitstream_t* stream, int b);
|
||||
|
||||
|
||||
/**
|
||||
* Encode n-bit unsigned integer. The n least significant bits of parameter
|
||||
* b starting with the most significant, i.e. from left to right.
|
||||
*/
|
||||
int encodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t val);
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int encodeUnsignedInteger(bitstream_t* stream, integer_t* iv);
|
||||
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int encodeUnsignedInteger32(bitstream_t* stream, uint32_t n);
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision non negative integer using a sequence of
|
||||
* octets. The most significant bit of the last octet is set to zero to
|
||||
* indicate sequence termination. Only seven bits per octet are used to
|
||||
* store the integer's value.
|
||||
*/
|
||||
int encodeUnsignedInteger64(bitstream_t* stream, uint64_t n);
|
||||
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision integer using a sign boolean followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int encodeInteger(bitstream_t* stream, integer_t* iv);
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision integer using a sign boolean followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int encodeInteger32(bitstream_t* stream, int32_t n);
|
||||
|
||||
/**
|
||||
* Encode an arbitrary precision integer using a sign bit followed by a
|
||||
* sequence of octets. The most significant bit of the last octet is set to
|
||||
* zero to indicate sequence termination. Only seven bits per octet are used
|
||||
* to store the integer's value.
|
||||
*/
|
||||
int encodeInteger64(bitstream_t* stream, int64_t n);
|
||||
|
||||
/**
|
||||
* Encode a Float datatype as two consecutive Integers.
|
||||
* The first Integer represents the mantissa of the floating point
|
||||
* number and the second Integer represents the base-10 exponent
|
||||
* of the floating point number.
|
||||
*/
|
||||
int encodeFloat(bitstream_t* stream, float_me_t* f);
|
||||
|
||||
/**
|
||||
* Encode a decimal represented as a Boolean sign followed by two Unsigned
|
||||
* Integers. A sign value of zero (0) is used to represent positive Decimal
|
||||
* values and a sign value of one (1) is used to represent negative Decimal
|
||||
* values The first Integer represents the integral portion of the Decimal
|
||||
* value. The second positive integer represents the fractional portion of
|
||||
* the decimal with the digits in reverse order to preserve leading zeros.
|
||||
*/
|
||||
int encodeDecimal(bitstream_t* stream, decimal_t* d);
|
||||
|
||||
/**
|
||||
* Encode a length prefixed sequence of characters.
|
||||
*/
|
||||
int encodeString(bitstream_t* stream, string_ucs_t* string);
|
||||
int encodeASCII(bitstream_t* stream, const char* ascii);
|
||||
|
||||
/**
|
||||
* Encode a length prefixed sequence of characters in the sense of string tables
|
||||
*/
|
||||
int encodeStringValue(bitstream_t* stream, string_ucs_t* string);
|
||||
|
||||
/**
|
||||
* Restricted character set
|
||||
*/
|
||||
int encodeRCSStringValue(bitstream_t* stream, rcs_t* rcs, string_ucs_t* string);
|
||||
|
||||
/**
|
||||
* Encode a sequence of characters according to a given length.
|
||||
* Each character is represented by its UCS [ISO/IEC 10646]
|
||||
* code point encoded as an Unsigned Integer
|
||||
*/
|
||||
int encodeUCSCharacters(bitstream_t* stream, uint32_t* chars, uint16_t len);
|
||||
|
||||
int encodeASCIICharacters(bitstream_t* stream, const char* chars, uint16_t len);
|
||||
|
||||
/**
|
||||
* Encode a binary value as a length-prefixed sequence of octets.
|
||||
*/
|
||||
int encodeBinary(bitstream_t* stream, bytes_t* bytes);
|
||||
|
||||
/**
|
||||
* Encode a datetime representation which is a sequence of values
|
||||
* representing the individual components of the Date-Time
|
||||
*/
|
||||
int encodeDateTime(bitstream_t* stream, datetime_t* datetime);
|
||||
|
||||
/**
|
||||
* Flush underlying bit output stream
|
||||
*/
|
||||
int encodeFinish(bitstream_t* stream);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
106
src/codec/MethodsBag.c
Normal file
106
src/codec/MethodsBag.c
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef METHODS_BAG_C
|
||||
#define METHODS_BAG_C
|
||||
|
||||
#include "MethodsBag.h"
|
||||
#include "EXITypes.h"
|
||||
|
||||
static const int smallLengths[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4,
|
||||
4, 4, 4 };
|
||||
|
||||
int exiGetCodingLength(uint32_t characteristics, uint16_t* codingLength) {
|
||||
if (characteristics < 17) {
|
||||
*codingLength = smallLengths[characteristics];
|
||||
return 0;
|
||||
} else if (characteristics < 33) {
|
||||
/* 17 .. 32 */
|
||||
*codingLength = 5;
|
||||
return 0;
|
||||
} else if (characteristics < 65) {
|
||||
/* 33 .. 64 */
|
||||
*codingLength = 6;
|
||||
return 0;
|
||||
} else if (characteristics < 129) {
|
||||
/* 65 .. 128 */
|
||||
*codingLength = 7;
|
||||
return 0;
|
||||
} else if (characteristics < 257) {
|
||||
/* 129 .. 256 */
|
||||
*codingLength = 8;
|
||||
return 0;
|
||||
} else if (characteristics < 513) {
|
||||
/* 257 .. 512 */
|
||||
*codingLength = 9;
|
||||
return 0;
|
||||
} else if (characteristics < 1025) {
|
||||
/* 513 .. 1024 */
|
||||
*codingLength = 10;
|
||||
return 0;
|
||||
} else {
|
||||
/*
|
||||
return (int) Math.ceil(Math.log((double) (characteristics))
|
||||
/ Math.log(2.0)); */
|
||||
return EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint8_t numberOf7BitBlocksToRepresent(uint32_t n) {
|
||||
/* assert (n >= 0); */
|
||||
|
||||
/* 7 bits */
|
||||
if (n < 128) {
|
||||
return 1;
|
||||
}
|
||||
/* 14 bits */
|
||||
else if (n < 16384) {
|
||||
return 2;
|
||||
}
|
||||
/* 21 bits */
|
||||
else if (n < 2097152) {
|
||||
return 3;
|
||||
}
|
||||
/* 28 bits */
|
||||
else if (n < 268435456) {
|
||||
return 4;
|
||||
}
|
||||
/* 35 bits */
|
||||
else {
|
||||
/* int, 32 bits */
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
59
src/codec/MethodsBag.h
Normal file
59
src/codec/MethodsBag.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef METHODS_BAG_H
|
||||
#define METHODS_BAG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Returns the number of bits to identify the characteristics.
|
||||
*
|
||||
* @param characteristics
|
||||
* @param codingLength (return value)
|
||||
*
|
||||
*/
|
||||
int exiGetCodingLength(uint32_t characteristics, uint16_t* codingLength);
|
||||
|
||||
/**
|
||||
* Returns the least number of 7 bit-blocks that is needed to represent the
|
||||
* int <param>n</param>. Returns 1 if <param>n</param> is 0.
|
||||
*
|
||||
* @param n
|
||||
* integer value
|
||||
*
|
||||
*/
|
||||
uint8_t numberOf7BitBlocksToRepresent(uint32_t n);
|
||||
|
||||
|
||||
#endif
|
||||
|
185
src/codec/NameTableEntries.c
Normal file
185
src/codec/NameTableEntries.c
Normal file
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef NAME_TABLE_ENTRIES_C
|
||||
#define NAME_TABLE_ENTRIES_C
|
||||
|
||||
#include "NameTableEntries.h"
|
||||
|
||||
|
||||
|
||||
/* ==================================== */
|
||||
/* String Table Population */
|
||||
|
||||
/* localName entries for URI id = 0 */
|
||||
char * localNames0[] = {
|
||||
"Algorithm", "Encoding", "Id", "MimeType", "Target",
|
||||
"Type", "URI"
|
||||
};
|
||||
/* localName entries for URI id = 1 */
|
||||
char * localNames1[] = {
|
||||
"base", "id", "lang", "space"
|
||||
};
|
||||
/* localName entries for URI id = 2 */
|
||||
char * localNames2[] = {
|
||||
"nil", "type"
|
||||
};
|
||||
/* localName entries for URI id = 3 */
|
||||
char * localNames3[] = {
|
||||
"ENTITIES", "ENTITY", "ID", "IDREF", "IDREFS",
|
||||
"NCName", "NMTOKEN", "NMTOKENS", "NOTATION", "Name",
|
||||
"QName", "anySimpleType", "anyType", "anyURI", "base64Binary",
|
||||
"boolean", "byte", "date", "dateTime", "decimal",
|
||||
"double", "duration", "float", "gDay", "gMonth",
|
||||
"gMonthDay", "gYear", "gYearMonth", "hexBinary", "int",
|
||||
"integer", "language", "long", "negativeInteger", "nonNegativeInteger",
|
||||
"nonPositiveInteger", "normalizedString", "positiveInteger", "short", "string",
|
||||
"time", "token", "unsignedByte", "unsignedInt", "unsignedLong",
|
||||
"unsignedShort"
|
||||
};
|
||||
/* localName entries for URI id = 4 */
|
||||
char * localNames4[] = {
|
||||
"CanonicalizationMethod", "CanonicalizationMethodType", "CryptoBinary", "DSAKeyValue", "DSAKeyValueType",
|
||||
"DigestMethod", "DigestMethodType", "DigestValue", "DigestValueType", "Exponent",
|
||||
"G", "HMACOutputLength", "HMACOutputLengthType", "J", "KeyInfo",
|
||||
"KeyInfoType", "KeyName", "KeyValue", "KeyValueType", "Manifest",
|
||||
"ManifestType", "MgmtData", "Modulus", "Object", "ObjectType",
|
||||
"P", "PGPData", "PGPDataType", "PGPKeyID", "PGPKeyPacket",
|
||||
"PgenCounter", "Q", "RSAKeyValue", "RSAKeyValueType", "Reference",
|
||||
"ReferenceType", "RetrievalMethod", "RetrievalMethodType", "SPKIData", "SPKIDataType",
|
||||
"SPKISexp", "Seed", "Signature", "SignatureMethod", "SignatureMethodType",
|
||||
"SignatureProperties", "SignaturePropertiesType", "SignatureProperty", "SignaturePropertyType", "SignatureType",
|
||||
"SignatureValue", "SignatureValueType", "SignedInfo", "SignedInfoType", "Transform",
|
||||
"TransformType", "Transforms", "TransformsType", "X509CRL", "X509Certificate",
|
||||
"X509Data", "X509DataType", "X509IssuerName", "X509IssuerSerial", "X509IssuerSerialType",
|
||||
"X509SKI", "X509SerialNumber", "X509SubjectName", "XPath", "Y"
|
||||
|
||||
};
|
||||
/* localName entries for URI id = 5 */
|
||||
char * localNames5[] = {
|
||||
"AC_EVSEStatus", "AC_PEVStatus", "BulkChargingComplete", "CableCheckReq", "CableCheckReqType",
|
||||
"CableCheckRes", "CableCheckResType", "CertificateInstallationReq", "CertificateInstallationReqType", "CertificateInstallationRes",
|
||||
"CertificateInstallationResType", "CertificateUpdateReq", "CertificateUpdateReqType", "CertificateUpdateRes", "CertificateUpdateResType",
|
||||
"ChargeCurrentRequest", "ChargeParameterDiscoveryReq", "ChargeParameterDiscoveryReqType", "ChargeParameterDiscoveryRes", "ChargeParameterDiscoveryResType",
|
||||
"ChargeService", "ChargingComplete", "ChargingProfile", "ContractAuthenticationReq", "ContractAuthenticationReqType",
|
||||
"ContractAuthenticationRes", "ContractAuthenticationResType", "ContractEncryptionCert", "ContractEncryptionCertChain", "ContractEncryptionPrivateKey",
|
||||
"ContractID", "ContractSignatureCertChain", "ContractSignaturePrivateKey", "CurrentDemandReq", "CurrentDemandReqType",
|
||||
"CurrentDemandRes", "CurrentDemandResType", "CurrentDifferential", "DC_EVSEStatus", "DC_PEVStatus",
|
||||
"EVSECurrentLimitAchieved", "EVSEID", "EVSEMaxPower", "EVSEMaximumCurrentLimit", "EVSEMaximumPowerLimit",
|
||||
"EVSEMaximumVoltageLimit", "EVSEPowerLimitAchieved", "EVSEPresentCurrent", "EVSEPresentVoltage", "EVSEVoltageLimitAchieved",
|
||||
"EnergyProvider", "GenChallenge", "LineLockReq", "LineLockReqType", "LineLockRes",
|
||||
"LineLockResType", "MeterInfo", "MeteringReceiptReq", "MeteringReceiptReqType", "MeteringReceiptRes",
|
||||
"MeteringReceiptResType", "MeteringStatusReq", "MeteringStatusReqType", "MeteringStatusRes", "MeteringStatusResType",
|
||||
"OEMProvisioningCert", "PCurrent", "PEVDemandCurrent", "PEVID", "PEVMaximumCurrentLimit",
|
||||
"PEVMaximumPowerLimit", "PEVMaximumVoltageLimit", "PEVRESSVoltage", "PEVRequestedEnergyTransferType", "PEVTargetVoltage",
|
||||
"PaymentDetailsReq", "PaymentDetailsReqType", "PaymentDetailsRes", "PaymentDetailsResType", "PaymentOptions",
|
||||
"PowerDeliveryReq", "PowerDeliveryReqType", "PowerDeliveryRes", "PowerDeliveryResType", "PreChargeReq",
|
||||
"PreChargeReqType", "PreChargeRes", "PreChargeResType", "ReceiptSignature", "RemainingTimeToBulkSoC",
|
||||
"RemainingTimeToFullSoC", "ReqLockStatus", "ReqSwitchStatus", "ResponseCode", "RetryCounter",
|
||||
"SelectedPaymentOption", "ServiceDetailReq", "ServiceDetailReqType", "ServiceDetailRes", "ServiceDetailResType",
|
||||
"ServiceDiscoveryReq", "ServiceDiscoveryReqType", "ServiceDiscoveryRes", "ServiceDiscoveryResType", "ServiceID",
|
||||
"ServiceList", "ServicePaymentSelectionReq", "ServicePaymentSelectionReqType", "ServicePaymentSelectionRes", "ServicePaymentSelectionResType",
|
||||
"ServiceScope", "ServiceTag", "ServiceType", "SessionID", "SessionSetupReq",
|
||||
"SessionSetupReqType", "SessionSetupRes", "SessionSetupResType", "TCurrent", "Tariff",
|
||||
"TariffTable", "TerminateChargingReq", "TerminateChargingReqType", "TerminateChargingRes", "TerminateChargingResType",
|
||||
"VoltageDifferential", "WeldingDetectionReq", "WeldingDetectionReqType", "WeldingDetectionRes", "WeldingDetectionResType",
|
||||
"v2g_Service"
|
||||
};
|
||||
/* localName entries for URI id = 6 */
|
||||
char * localNames6[] = {
|
||||
"AC_EVSEChargeParameter", "AC_EVSEChargeParameterType", "AC_EVSEStatus", "AC_EVSEStatusType", "AC_PEVChargeParameter",
|
||||
"AC_PEVChargeParameterType", "AC_PEVPowerDeliveryParameter", "AC_PEVPowerDeliveryParameterType", "AC_PEVStatus", "AC_PEVStatusType",
|
||||
"AC_rcdType", "BulkChargingComplete", "BulkSOC", "Certificate", "CertificateChainType",
|
||||
"CertificateInstall", "CertificateUpdate", "ChargingComplete", "ChargingProfileEntryMaxPower", "ChargingProfileEntryStart",
|
||||
"ChargingProfileType", "ConnectorLocked", "Currency", "DC_BulkChargingCompleteType", "DC_ChargingCompleteType",
|
||||
"DC_EVSEChargeParameter", "DC_EVSEChargeParameterType", "DC_EVSEStatus", "DC_EVSEStatusCodeType", "DC_EVSEStatusType",
|
||||
"DC_PEVChargeParameter", "DC_PEVChargeParameterType", "DC_PEVPowerDeliveryParameter", "DC_PEVPowerDeliveryParameterType", "DC_PEVReadyType",
|
||||
"DC_PEVStatus", "DC_PEVStatusCodeType", "DC_PEVStatusType", "DC_protocolVersionType", "EAmount",
|
||||
"EPrice", "EPriceMultiplier", "EPriceType", "EPriceUnit", "EVSEChargeParameter",
|
||||
"EVSEChargeParameterType", "EVSECurrentRegulationTolerance", "EVSEEnergyToBeDelivered", "EVSEMaxCurrent", "EVSEMaxPhases",
|
||||
"EVSEMaxVoltage", "EVSEMaximumCurrentLimit", "EVSEMaximumPowerLimit", "EVSEMaximumVoltageLimit", "EVSEMinCurrent",
|
||||
"EVSEMinVoltage", "EVSEMinimumCurrentLimit", "EVSEMinimumVoltageLimit", "EVSEPeakCurrentRipple", "EVSEProtocolVersion",
|
||||
"EVSEStandby", "EVSEStatus", "EVSEStatusCode", "EVSEStatusType", "EVSESupportedEnergyTransferType",
|
||||
"EnergyTransferType", "EoC", "FaultCode", "FaultMsg", "FloatingValueType",
|
||||
"FreeService", "FullSOC", "MeterID", "MeterInfoType", "MeterPubKey",
|
||||
"MeterReading", "MeterStatus", "Multiplier", "NotificationType", "PEVChargeParameter",
|
||||
"PEVChargeParameterType", "PEVEnergyCapacity", "PEVEnergyRequest", "PEVMaxCurrent", "PEVMaxPhases",
|
||||
"PEVMaxPower", "PEVMaxVoltage", "PEVMaximumCurrentLimit", "PEVMaximumPowerLimit", "PEVMaximumVoltageLimit",
|
||||
"PEVMinCurrent", "PEVMinVoltage", "PEVPowerDeliveryParameter", "PEVPowerDeliveryParameterType", "PEVProtocolVersion",
|
||||
"PEVRESSSOC", "PEVReady", "PEVRequestedEnergyTransferType", "PEVStandby", "PEVStatus",
|
||||
"PEVStatusCode", "PEVStatusType", "PMaxType", "PaymentOption", "PowerSwitchClosed",
|
||||
"ProfileEntry", "ProfileEntryType", "ProtocolVersion", "RCD", "SecurityType",
|
||||
"Service", "ServiceCategory", "ServiceCertificate", "ServiceCertificateType", "ServiceCharge",
|
||||
"ServiceChargeType", "ServiceCustom", "ServiceCustomType", "ServiceDetails", "ServiceDetailsType",
|
||||
"ServiceID", "ServiceInternet", "ServiceInternetType", "ServiceName", "ServiceRCS",
|
||||
"ServiceRCSType", "ServiceScope", "ServiceSessionID", "ServiceTag", "ServiceTagListType",
|
||||
"ServiceTagType", "ServiceType", "SessionID", "SessionInformationType", "ShutDownTime",
|
||||
"SigMeterReading", "StopCharging", "SubCertificates", "SubCertificatesType", "TMeter",
|
||||
"Tariff", "TariffDescrType", "TariffDescription", "TariffEntries", "TariffEntriesType",
|
||||
"TariffEntry", "TariffEntryType", "TariffID", "TariffPMax", "TariffStart",
|
||||
"TariffTableType", "Unit", "Value", "certificateType", "challengeSignatureType",
|
||||
"contractIDType", "currencyType", "ePriceType", "encryptionPrivateKeyType", "energyProviderType",
|
||||
"evseIDType", "faultCodeType", "faultMsgType", "genChallengeType", "lockStatusType",
|
||||
"maxPhasesType", "messageSignatureType", "meterIDType", "meterSignatureType", "meterStatusType",
|
||||
"paymentOptionType", "paymentOptionsType", "percentValueType", "pevIDType", "protocolVersionType",
|
||||
"pubKeyType", "responseCodeType", "retryCounterType", "serviceCategoryType", "serviceIDType",
|
||||
"serviceNameType", "serviceScopeType", "sessionIDType", "signaturePrivateKeyType", "standbyType",
|
||||
"switchStatusType", "tariffDescriptionType", "tariffIDType", "tariffStartType", "timeType",
|
||||
"unitMultiplierType", "unitSymbolType"
|
||||
};
|
||||
/* localName entries for URI id = 7 */
|
||||
char * localNames7[] = {
|
||||
"Body", "BodyBaseType", "BodyElement", "BodyType", "Header",
|
||||
"V2G_Message"
|
||||
};
|
||||
/* localName entries for URI id = 8 */
|
||||
char * localNames8[] = {
|
||||
"MessageHeaderType", "Notification", "Security", "SessionInformation"
|
||||
};
|
||||
struct exiNamePartition localNamePartitions[9] = {
|
||||
{ 7, localNames0 },
|
||||
{ 4, localNames1 },
|
||||
{ 2, localNames2 },
|
||||
{ 46, localNames3 },
|
||||
{ 70, localNames4 },
|
||||
{ 131, localNames5 },
|
||||
{ 192, localNames6 },
|
||||
{ 6, localNames7 },
|
||||
{ 4, localNames8 }
|
||||
};
|
||||
char * uris[] = {
|
||||
"", "http://www.w3.org/XML/1998/namespace", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/2000/09/xmldsig#", "urn:iso:15118:2:2010:MsgBody", "urn:iso:15118:2:2010:MsgDataTypes", "urn:iso:15118:2:2010:MsgDef", "urn:iso:15118:2:2010:MsgHeader"
|
||||
};
|
||||
exi_name_table_prepopulated_t nameTablePrepopulated = { 9, uris, localNamePartitions };
|
||||
|
||||
|
||||
exi_name_table_prepopulated_t nameTablePrepopulated;
|
||||
|
||||
#endif
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,43 +19,23 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef STRING_TABLE_ENTRIES_H
|
||||
#define STRING_TABLE_ENTRIES_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* ==================================== */
|
||||
/* String Table Structures */
|
||||
|
||||
struct exiPartition {
|
||||
/* length of array */
|
||||
uint16_t len;
|
||||
/* array of string entries */
|
||||
const char** entries;
|
||||
};
|
||||
|
||||
struct exiStringTable {
|
||||
/* length of both arrays (uris & localNames) */
|
||||
uint16_t len;
|
||||
/* URI entries*/
|
||||
const char** uris;
|
||||
/* localName entries divided by URI */
|
||||
struct exiPartition * localNames;
|
||||
};
|
||||
#ifndef NAME_TABLE_ENTRIES_H
|
||||
#define NAME_TABLE_ENTRIES_H
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
/* ==================================== */
|
||||
/* String Table Population */
|
||||
|
||||
extern struct exiStringTable stringTable;
|
||||
extern exi_name_table_prepopulated_t nameTablePrepopulated;
|
||||
|
||||
#endif
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,91 +19,219 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef STRING_TABLE_C
|
||||
#define STRING_TABLE_C
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "StringTable.h"
|
||||
#include "NameTableEntries.h"
|
||||
|
||||
#include "StringTableEntries.h"
|
||||
|
||||
#include "assert.h"
|
||||
|
||||
int exiGetUri(uint16_t uriID, const char** uri) {
|
||||
if ( uriID < stringTable.len ) {
|
||||
*uri = stringTable.uris[uriID];
|
||||
int exiGetUri(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t uriID,
|
||||
const char** uri) {
|
||||
if (uriID < prepopulatedTable->len) {
|
||||
*uri = prepopulatedTable->uris[uriID];
|
||||
} else {
|
||||
int i = 0;
|
||||
uriID -= prepopulatedTable->len;
|
||||
for(i=0; i<(runtimeTable->addedUriEntries+runtimeTable->addedLocalNameEntries); i++) {
|
||||
if ( runtimeTable->namePartitionsEntries[i].namePartitionType == URI_PARTITION ) {
|
||||
if (uriID == 0) {
|
||||
*uri = runtimeTable->namePartitionsEntries[i].entry.uriPartition.uri;
|
||||
return 0;
|
||||
}
|
||||
uriID--;
|
||||
}
|
||||
}
|
||||
|
||||
return EXI_ERROR_OUT_OF_BOUNDS;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exiGetUriLength(uint16_t* uriLength) {
|
||||
*uriLength = stringTable.len;
|
||||
int exiGetUriSize(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t* uriLength) {
|
||||
*uriLength = prepopulatedTable->len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int exiGetUriID(const char* uri, uint16_t* uriID) {
|
||||
/* 0 ... Success, 1 ... Miss, -1 ... Error */
|
||||
int exiGetUriID(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, const char* uri,
|
||||
uint16_t* uriID) {
|
||||
unsigned int i;
|
||||
for(i=0; i<stringTable.len; i++) {
|
||||
if ( strcmp ( uri, stringTable.uris[i] ) == 0 ) {
|
||||
for (i = 0; i < prepopulatedTable->len; i++) {
|
||||
if (strcmp(uri, prepopulatedTable->uris[i]) == 0) {
|
||||
*uriID = i;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
if (runtimeTable->addedUriEntries > 0) {
|
||||
*uriID = prepopulatedTable->len - 1;
|
||||
for(i=0; i< (runtimeTable->addedUriEntries + runtimeTable->addedLocalNameEntries); i++) {
|
||||
if ( runtimeTable->namePartitionsEntries[i].namePartitionType == URI_PARTITION ) {
|
||||
*uriID = *uriID + 1;
|
||||
if (strcmp(uri, runtimeTable->namePartitionsEntries[i].entry.uriPartition.uri) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* no URI ID found */
|
||||
return +1;
|
||||
}
|
||||
|
||||
|
||||
int exiGetLocalName(uint16_t uriID, uint16_t localNameID, const char** localName) {
|
||||
if ( uriID < stringTable.len ) {
|
||||
if ( localNameID < stringTable.localNames[uriID].len ) {
|
||||
*localName = stringTable.localNames[uriID].entries[localNameID];
|
||||
int exiGetLocalName(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t uriID,
|
||||
uint16_t localNameID, const char** localName) {
|
||||
int i;
|
||||
if (uriID < prepopulatedTable->len) {
|
||||
if (localNameID < prepopulatedTable->localNames[uriID].len) {
|
||||
*localName = prepopulatedTable->localNames[uriID].names[localNameID];
|
||||
return 0;
|
||||
} else {
|
||||
localNameID -= prepopulatedTable->localNames[uriID].len;
|
||||
}
|
||||
}
|
||||
|
||||
/* runtime tables */
|
||||
for(i=0; i<(runtimeTable->addedLocalNameEntries+runtimeTable->addedUriEntries); i++) {
|
||||
if ( runtimeTable->namePartitionsEntries[i].namePartitionType == LOCALNAME_PARTITION &&
|
||||
runtimeTable->namePartitionsEntries[i].entry.localNamePartition.uriID == uriID ) {
|
||||
if (localNameID == 0) {
|
||||
*localName = runtimeTable->namePartitionsEntries[i].entry.localNamePartition.localName;
|
||||
return 0;
|
||||
}
|
||||
localNameID--;
|
||||
}
|
||||
}
|
||||
|
||||
return EXI_ERROR_OUT_OF_BOUNDS;
|
||||
}
|
||||
|
||||
int exiGetLocalNameSize(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable,
|
||||
uint16_t uriID, uint16_t* localNameLength) {
|
||||
*localNameLength = 0;
|
||||
/* 1. pre-populated entries*/
|
||||
if (uriID < prepopulatedTable->len) {
|
||||
(*localNameLength) += prepopulatedTable->localNames[uriID].len;
|
||||
} else {
|
||||
/* range check */
|
||||
if (uriID >= ( prepopulatedTable->len + runtimeTable->addedUriEntries )) {
|
||||
return EXI_ERROR_OUT_OF_BOUNDS;
|
||||
}
|
||||
} else {
|
||||
return EXI_ERROR_OUT_OF_BOUNDS;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exiGetLocalNameLength(uint16_t uriID, uint16_t* localNameLength) {
|
||||
if ( uriID < stringTable.len ) {
|
||||
*localNameLength = stringTable.localNames[uriID].len;
|
||||
} else {
|
||||
return EXI_ERROR_OUT_OF_BOUNDS;
|
||||
/* 2. runtime entries */
|
||||
if (runtimeTable->addedLocalNameEntries > 0 ) {
|
||||
int i;
|
||||
for(i=0; i<(runtimeTable->addedUriEntries+runtimeTable->addedLocalNameEntries); i++) {
|
||||
if ( runtimeTable->namePartitionsEntries[i].namePartitionType == LOCALNAME_PARTITION &&
|
||||
runtimeTable->namePartitionsEntries[i].entry.localNamePartition.uriID == uriID ) {
|
||||
(*localNameLength)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exiGetLocalNameID(uint16_t uriID, const char* localName, uint16_t* localNameID) {
|
||||
/* 0 ... Success, 1 ... Miss, -1 ... Error */
|
||||
int exiGetLocalNameID(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t uriID,
|
||||
const char* localName, uint16_t* localNameID) {
|
||||
unsigned int i;
|
||||
if ( uriID < stringTable.len ) {
|
||||
if (uriID < prepopulatedTable->len) {
|
||||
/* pre-populated names */
|
||||
/* TODO binary search */
|
||||
for(i=0; i<stringTable.localNames[uriID].len; i++) {
|
||||
if ( strcmp ( localName, stringTable.localNames[uriID].entries[i] ) == 0 ) {
|
||||
for (i = 0; i < prepopulatedTable->localNames[uriID].len; i++) {
|
||||
if (strcmp(localName, prepopulatedTable->localNames[uriID].names[i]) == 0) {
|
||||
*localNameID = i;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* runtime names */
|
||||
for (i = 0; i < (runtimeTable->addedUriEntries + runtimeTable->addedLocalNameEntries); i++) {
|
||||
if (runtimeTable->namePartitionsEntries[i].namePartitionType == LOCALNAME_PARTITION &&
|
||||
strcmp(localName, runtimeTable->namePartitionsEntries[i].entry.localNamePartition.localName ) == 0) {
|
||||
*localNameID = runtimeTable->namePartitionsEntries[i].entry.localNamePartition.localNameID;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* no localName ID found */
|
||||
return +1;
|
||||
} else if (uriID == prepopulatedTable->len) {
|
||||
/* UCD profile */
|
||||
/* no localName ID found */
|
||||
return +1;
|
||||
} else {
|
||||
return EXI_ERROR_OUT_OF_BOUNDS;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
/* inline */
|
||||
static int _max(int a, int b) {
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
int exiInitNameTableRuntime(exi_name_table_runtime_t* runtimeTable) {
|
||||
runtimeTable->numberOfUsedCharacters = 0;
|
||||
runtimeTable->addedLocalNameEntries = 0;
|
||||
runtimeTable->addedUriEntries = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int exiAddUri(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, char* uri) {
|
||||
if (runtimeTable->addedUriEntries < EXI_RESERVED_NUMBER_URI_PARTITION_ENTRIES
|
||||
|| runtimeTable->addedUriEntries
|
||||
< (EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_ENTRIES - _max(
|
||||
runtimeTable->addedLocalNameEntries,
|
||||
EXI_RESERVED_NUMBER_LOCALNAME_PARTITION_ENTRIES))) {
|
||||
uint16_t index = runtimeTable->addedUriEntries + runtimeTable->addedLocalNameEntries;
|
||||
int charsIndex = runtimeTable->numberOfUsedCharacters+runtimeTable->addedUriEntries+runtimeTable->addedLocalNameEntries;
|
||||
runtimeTable->namePartitionsEntries[index].namePartitionType = URI_PARTITION;
|
||||
strcpy(runtimeTable->characters+charsIndex, uri);
|
||||
runtimeTable->namePartitionsEntries[index].entry.uriPartition.uri = runtimeTable->characters+charsIndex;
|
||||
runtimeTable->namePartitionsEntries[index].entry.uriPartition.uriID = prepopulatedTable->len + runtimeTable->addedUriEntries;
|
||||
runtimeTable->addedUriEntries++;
|
||||
runtimeTable->numberOfUsedCharacters += strlen(uri);
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int exiAddLocalName(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t uriID,
|
||||
char* localName) {
|
||||
if (runtimeTable->addedUriEntries < EXI_RESERVED_NUMBER_LOCALNAME_PARTITION_ENTRIES
|
||||
|| runtimeTable->addedLocalNameEntries
|
||||
< (EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_ENTRIES - _max(
|
||||
runtimeTable->addedUriEntries,
|
||||
EXI_RESERVED_NUMBER_URI_PARTITION_ENTRIES))) {
|
||||
uint16_t index = runtimeTable->addedUriEntries + runtimeTable->addedLocalNameEntries;
|
||||
int charsIndex = runtimeTable->numberOfUsedCharacters+runtimeTable->addedUriEntries+runtimeTable->addedLocalNameEntries;
|
||||
uint16_t localNameID;
|
||||
int errn = exiGetLocalNameSize(prepopulatedTable, runtimeTable, uriID, &localNameID);
|
||||
if (errn < 0) {
|
||||
return errn;
|
||||
}
|
||||
|
||||
runtimeTable->namePartitionsEntries[index].namePartitionType = LOCALNAME_PARTITION;
|
||||
strcpy(runtimeTable->characters+charsIndex, localName);
|
||||
runtimeTable->namePartitionsEntries[index].entry.localNamePartition.localName = runtimeTable->characters+charsIndex;
|
||||
runtimeTable->namePartitionsEntries[index].entry.localNamePartition.localNameID = localNameID;
|
||||
runtimeTable->namePartitionsEntries[index].entry.localNamePartition.uriID = uriID;
|
||||
runtimeTable->addedLocalNameEntries++;
|
||||
runtimeTable->numberOfUsedCharacters += strlen(localName);
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -18,11 +19,14 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -32,21 +36,31 @@ extern "C" {
|
|||
|
||||
#include "EXITypes.h"
|
||||
|
||||
int exiGetUri(uint16_t uriID, const char** uri);
|
||||
int exiGetUri(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t uriID, const char** uri);
|
||||
|
||||
int exiGetUriLength(uint16_t* uriLength);
|
||||
int exiGetUriSize(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t* uriLength);
|
||||
|
||||
int exiGetUriID(const char* uri, uint16_t* uriID);
|
||||
/* 0 ... Success, 1 ... Miss, -1 ... Error */
|
||||
int exiGetUriID(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, const char* uri, uint16_t* uriID);
|
||||
|
||||
int exiGetLocalName(uint16_t uriID, uint16_t localNameID, const char** localName);
|
||||
int exiGetLocalName(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t uriID, uint16_t localNameID, const char** localName);
|
||||
|
||||
int exiGetLocalNameLength(uint16_t uriID, uint16_t* localNameLength);
|
||||
int exiGetLocalNameSize(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t uriID, uint16_t* localNameLength);
|
||||
|
||||
int exiGetLocalNameID(uint16_t uriID, const char* localName, uint16_t* localNameID);
|
||||
/* 0 ... Success, 1 ... Miss, -1 ... Error */
|
||||
int exiGetLocalNameID(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t uriID, const char* localName, uint16_t* localNameID);
|
||||
|
||||
/* inits counter et cetera */
|
||||
int exiInitNameTableRuntime(exi_name_table_runtime_t* runtimeTable);
|
||||
|
||||
/* add runtime URI entry */
|
||||
int exiAddUri(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, char* uri);
|
||||
|
||||
/* add runtime local-name entry */
|
||||
int exiAddLocalName(exi_name_table_prepopulated_t* prepopulatedTable, exi_name_table_runtime_t* runtimeTable, uint16_t uriID, char* localName);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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 Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#ifndef STRING_TABLE_ENTRIES_C
|
||||
#define STRING_TABLE_ENTRIES_C
|
||||
|
||||
#include "StringTableEntries.h"
|
||||
|
||||
|
||||
/* ==================================== */
|
||||
/* String Table Population */
|
||||
|
||||
/* localName entries for URI id = 0 */
|
||||
const char * localNames0[] = {
|
||||
NULL
|
||||
};
|
||||
/* localName entries for URI id = 1 */
|
||||
const char * localNames1[] = {
|
||||
"base", "id", "lang", "space"
|
||||
};
|
||||
/* localName entries for URI id = 2 */
|
||||
const char * localNames2[] = {
|
||||
"nil", "type"
|
||||
};
|
||||
/* localName entries for URI id = 3 */
|
||||
const char * localNames3[] = {
|
||||
"ENTITIES", "ENTITY", "ID", "IDREF", "IDREFS",
|
||||
"NCName", "NMTOKEN", "NMTOKENS", "NOTATION", "Name",
|
||||
"QName", "anySimpleType", "anyType", "anyURI", "base64Binary",
|
||||
"boolean", "byte", "date", "dateTime", "decimal",
|
||||
"double", "duration", "float", "gDay", "gMonth",
|
||||
"gMonthDay", "gYear", "gYearMonth", "hexBinary", "int",
|
||||
"integer", "language", "long", "negativeInteger", "nonNegativeInteger",
|
||||
"nonPositiveInteger", "normalizedString", "positiveInteger", "short", "string",
|
||||
"time", "token", "unsignedByte", "unsignedInt", "unsignedLong",
|
||||
"unsignedShort"
|
||||
};
|
||||
/* localName entries for URI id = 4 */
|
||||
const char * localNames4[] = {
|
||||
"CableCheckReq", "CableCheckReqType", "CableCheckRes", "CableCheckResType", "ChargeParameterDiscoveryReq",
|
||||
"ChargeParameterDiscoveryReqType", "ChargeParameterDiscoveryRes", "ChargeParameterDiscoveryResType", "ChargingMode", "ContractID",
|
||||
"CurrentDemandReq", "CurrentDemandReqType", "CurrentDemandRes", "CurrentDemandResType", "CurrentDifferential",
|
||||
"EAmount", "EVSEID", "EVSEMaxCurrent", "EVSEMaxPhases", "EVSEMaxPower",
|
||||
"EVSEMaxVoltage", "EVSEMinCurrent", "EVSEMinVoltage", "EVSEPresentCurrent", "EVSEPresentVoltage",
|
||||
"EVSEStatus", "EnergyProvider", "EoC", "LineLockReq", "LineLockReqType",
|
||||
"LineLockRes", "LineLockResType", "MeterInfo", "MeteringReceiptReq", "MeteringReceiptReqType",
|
||||
"MeteringReceiptRes", "MeteringReceiptResType", "MeteringStatusReq", "MeteringStatusReqType", "MeteringStatusRes",
|
||||
"MeteringStatusResType", "PCurrent", "PEVDemandCurrent", "PEVID", "PEVMaxCurrent",
|
||||
"PEVMaxPhases", "PEVMaxPower", "PEVMaxVoltage", "PEVMinCurrent", "PEVMinVoltage",
|
||||
"PEVStatus", "PEVTargetVoltage", "PaymentDetailsReq", "PaymentDetailsReqType", "PaymentDetailsRes",
|
||||
"PaymentDetailsResType", "PowerDeliveryReq", "PowerDeliveryReqType", "PowerDeliveryRes", "PowerDeliveryResType",
|
||||
"PreChargeReq", "PreChargeReqType", "PreChargeRes", "PreChargeResType", "ReqLockStatus",
|
||||
"ReqSwitchStatus", "ResponseCode", "ServiceDiscoveryReq", "ServiceDiscoveryReqType", "ServiceDiscoveryRes",
|
||||
"ServiceDiscoveryResType", "ServiceList", "ServicePaymentSelectionReq", "ServicePaymentSelectionReqType", "ServicePaymentSelectionRes",
|
||||
"ServicePaymentSelectionResType", "ServiceScope", "ServiceType", "SessionSetupReq", "SessionSetupReqType",
|
||||
"SessionSetupRes", "SessionSetupResType", "TCurrent", "Tariff", "TariffTable",
|
||||
"TerminateChargingReq", "TerminateChargingReqType", "TerminateChargingRes", "TerminateChargingResType", "VoltageDifferential",
|
||||
"WeldingDetectionReq", "WeldingDetectionReqType", "WeldingDetectionRes", "WeldingDetectionResType"
|
||||
};
|
||||
/* localName entries for URI id = 5 */
|
||||
const char * localNames5[] = {
|
||||
"ChargerStandby", "ChargingProfileEntryMaxPower", "ChargingProfileEntryStart", "ChargingProfileType", "ConnectorLocked",
|
||||
"Currency", "EPrice", "EVSEMalfunction", "EVSEStandby", "EVSEStatusType",
|
||||
"Event", "EventList", "EventListType", "FatalError", "FaultCode",
|
||||
"FaultMsg", "FloatingValueType", "MeterID", "MeterInfoType", "MeterReading",
|
||||
"MeterStatus", "Multiplier", "NotificationType", "PEVStatusType", "PowerSwitchClosed",
|
||||
"ProtocolVersion", "RCD", "ReadyToCharge", "Service", "ServiceDescriptionType",
|
||||
"ServiceID", "ServiceListType", "ServiceName", "ServiceScope", "ServiceSessionID",
|
||||
"ServiceType", "SessionID", "SessionInformationType", "ShutDownTime", "StopCharging",
|
||||
"TMeter", "Tariff", "TariffDescrType", "TariffDescription", "TariffEntries",
|
||||
"TariffEntriesType", "TariffEntry", "TariffEntryType", "TariffID", "TariffPMax",
|
||||
"TariffStart", "TariffTableType", "Unit", "Value", "chargingModeType",
|
||||
"contractIDType", "currencyType", "energyProviderType", "eventEntryType", "evseIDType",
|
||||
"fatalErrorType", "faultCodeType", "lockStatusType", "maxPhasesType", "meterIDType",
|
||||
"meterStatusType", "paymentOptionListType", "paymentOptionType", "pevIDType", "protocolVersionType",
|
||||
"pubKeyType", "rcdType", "responseCode_CableCheckType", "responseCode_ChargeParameterDiscoveryType", "responseCode_CurrentDemandType",
|
||||
"responseCode_LineLockType", "responseCode_MeteringReceiptType", "responseCode_MeteringStatusType", "responseCode_PaymentDetailsType", "responseCode_PowerDeliveryType",
|
||||
"responseCode_PreChargeType", "responseCode_ServiceDiscoveryType", "responseCode_ServicePaymentSelectionType", "responseCode_SessionSetupType", "responseCode_TerminateChargingType",
|
||||
"responseCode_WeldingDetectionType", "serviceDetailsType", "serviceIDType", "serviceNameType", "serviceScopeType",
|
||||
"serviceTypeType", "sessionIDType", "standbyType", "switchStatusType", "tariffDescriptionType",
|
||||
"tariffIDType", "tariffStartType", "timeType", "unitMultiplierType", "unitSymbolType"
|
||||
|
||||
};
|
||||
/* localName entries for URI id = 6 */
|
||||
const char * localNames6[] = {
|
||||
"Body", "BodyBaseType", "BodyElement", "BodyType", "Header",
|
||||
"V2G_Message"
|
||||
};
|
||||
/* localName entries for URI id = 7 */
|
||||
const char * localNames7[] = {
|
||||
"HeaderType", "Notification", "SessionInformation"
|
||||
};
|
||||
struct exiPartition localNamePartitions[8] = {
|
||||
{ 0, localNames0 },
|
||||
{ 4, localNames1 },
|
||||
{ 2, localNames2 },
|
||||
{ 46, localNames3 },
|
||||
{ 94, localNames4 },
|
||||
{ 100, localNames5 },
|
||||
{ 6, localNames6 },
|
||||
{ 3, localNames7 }
|
||||
};
|
||||
const char * uris[] = {
|
||||
"", "http://www.w3.org/XML/1998/namespace", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/2001/XMLSchema", "urn:iso:15118:2:2010:eval1.0:MsgBody", "urn:iso:15118:2:2010:eval1.0:MsgDataTypes", "urn:iso:15118:2:2010:eval1.0:MsgDef", "urn:iso:15118:2:2010:eval1.0:MsgHeader"
|
||||
};
|
||||
struct exiStringTable stringTable = { 8, uris, localNamePartitions };
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,34 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "BitDecoderChannel.h"
|
||||
#include "DecoderChannel.h"
|
||||
#include "BitInputStream.h"
|
||||
#include "EXITypes.h"
|
||||
|
||||
|
@ -45,11 +46,12 @@ int toUCSString(char* chars, string_ucs_t* s) {
|
|||
}
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
return EXI_ERROR_OUT_OF_STRING_BUFFER;
|
||||
}
|
||||
}
|
||||
|
||||
/* Note: fails if string contains non ASCII characters */
|
||||
/* Note A: fails if string contains non ASCII characters */
|
||||
/* Note B: causes harm if char array is not sufficiently long */
|
||||
int toASCIIString(string_ucs_t* string, char* outASCII) {
|
||||
unsigned int i;
|
||||
for(i=0; i<string->len; i++) {
|
||||
|
|
|
@ -1,27 +1,31 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
********************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.4
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
* Copyright (C) 2007-2010 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
|
@ -18,7 +18,7 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Sebastian.Kaebisch.EXT@siemens.com
|
||||
* @version 0.2
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
@ -62,10 +62,15 @@ struct EXIService
|
|||
/* error code */
|
||||
uint8_t errorCode;
|
||||
|
||||
/* offset for transport header data */
|
||||
/* offset for transported header data */
|
||||
uint16_t transportHeaderOffset;
|
||||
};
|
||||
|
||||
enum responseMessages
|
||||
{
|
||||
has_to_be_filled
|
||||
};
|
||||
|
||||
/* define error codes (TODO: define precise error codes) */
|
||||
#define EXI_NON_VALID_MESSAGE 0x01
|
||||
#define EXI_SERIALIZATION_FAILED 0x02
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
* Copyright (C) 2007-2010 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
|
@ -19,7 +19,7 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Sebastian.Kaebisch.EXT@siemens.com
|
||||
* @version 0.2
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -22,9 +22,11 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Sebastian.Kaebisch.EXT@siemens.com
|
||||
* @version 0.3.2
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXISeGen</p>
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
@ -47,7 +49,7 @@ extern "C" {
|
|||
* \param params struct SessionSetupReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct SessionSetupResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_sessionSetup(struct EXIService* service, struct HeaderType* header, struct SessionSetupReqType* params, struct SessionSetupResType* result);
|
||||
int call_sessionSetup(struct EXIService* service, struct MessageHeaderType* header, struct SessionSetupReqType* params, struct SessionSetupResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -59,7 +61,19 @@ extern "C" {
|
|||
* \param params struct ServiceDiscoveryReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct ServiceDiscoveryResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_serviceDiscovery(struct EXIService* service, struct HeaderType* header, struct ServiceDiscoveryReqType* params, struct ServiceDiscoveryResType* result);
|
||||
int call_serviceDiscovery(struct EXIService* service, struct MessageHeaderType* header, struct ServiceDiscoveryReqType* params, struct ServiceDiscoveryResType* result);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Calls the remote serviceDetail method
|
||||
* \param service struct EXIService* Service data structure (has to be initialized before)
|
||||
* \param header struct HeaderType* Header data structure
|
||||
* \param params struct ServiceDetailReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct ServiceDetailResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_serviceDetail(struct EXIService* service, struct MessageHeaderType* header, struct ServiceDetailReqType* params, struct ServiceDetailResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -71,7 +85,7 @@ extern "C" {
|
|||
* \param params struct ServicePaymentSelectionReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct ServicePaymentSelectionResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_selectedServicePayment(struct EXIService* service, struct HeaderType* header, struct ServicePaymentSelectionReqType* params, struct ServicePaymentSelectionResType* result);
|
||||
int call_selectedServicePayment(struct EXIService* service, struct MessageHeaderType* header, struct ServicePaymentSelectionReqType* params, struct ServicePaymentSelectionResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -83,7 +97,19 @@ extern "C" {
|
|||
* \param params struct PaymentDetailsReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct PaymentDetailsResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_paymentDetails(struct EXIService* service, struct HeaderType* header, struct PaymentDetailsReqType* params, struct PaymentDetailsResType* result);
|
||||
int call_paymentDetails(struct EXIService* service, struct MessageHeaderType* header, struct PaymentDetailsReqType* params, struct PaymentDetailsResType* result);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Calls the remote contractAuthentication method
|
||||
* \param service struct EXIService* Service data structure (has to be initialized before)
|
||||
* \param header struct HeaderType* Header data structure
|
||||
* \param params struct ContractAuthenticationReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct ContractAuthenticationResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_contractAuthentication(struct EXIService* service, struct MessageHeaderType* header, struct ContractAuthenticationReqType* params, struct ContractAuthenticationResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -95,7 +121,7 @@ extern "C" {
|
|||
* \param params struct ChargeParameterDiscoveryReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct ChargeParameterDiscoveryResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_chargeParameterDiscovery(struct EXIService* service, struct HeaderType* header, struct ChargeParameterDiscoveryReqType* params, struct ChargeParameterDiscoveryResType* result);
|
||||
int call_chargeParameterDiscovery(struct EXIService* service, struct MessageHeaderType* header, struct ChargeParameterDiscoveryReqType* params, struct ChargeParameterDiscoveryResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -107,7 +133,7 @@ extern "C" {
|
|||
* \param params struct LineLockReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct LineLockResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_lineLock(struct EXIService* service, struct HeaderType* header, struct LineLockReqType* params, struct LineLockResType* result);
|
||||
int call_lineLock(struct EXIService* service, struct MessageHeaderType* header, struct LineLockReqType* params, struct LineLockResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -119,7 +145,7 @@ extern "C" {
|
|||
* \param params struct PowerDeliveryReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct PowerDeliveryResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_powerDelivery(struct EXIService* service, struct HeaderType* header, struct PowerDeliveryReqType* params, struct PowerDeliveryResType* result);
|
||||
int call_powerDelivery(struct EXIService* service, struct MessageHeaderType* header, struct PowerDeliveryReqType* params, struct PowerDeliveryResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -128,9 +154,10 @@ extern "C" {
|
|||
* \brief Calls the remote meteringStatus method
|
||||
* \param service struct EXIService* Service data structure (has to be initialized before)
|
||||
* \param header struct HeaderType* Header data structure
|
||||
* \param result struct MeteringStatusResType* Contains the response data from the server
|
||||
* \param params struct MeteringStatusReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct MeteringStatusResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_meteringStatus(struct EXIService* service, struct HeaderType* header, struct MeteringStatusResType* result);
|
||||
int call_meteringStatus(struct EXIService* service, struct MessageHeaderType* header, struct MeteringStatusReqType* params, struct MeteringStatusResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -142,7 +169,31 @@ extern "C" {
|
|||
* \param params struct MeteringReceiptReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct MeteringReceiptResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_meteringReceipt(struct EXIService* service, struct HeaderType* header, struct MeteringReceiptReqType* params, struct MeteringReceiptResType* result);
|
||||
int call_meteringReceipt(struct EXIService* service, struct MessageHeaderType* header, struct MeteringReceiptReqType* params, struct MeteringReceiptResType* result);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Calls the remote certificateUpdate method
|
||||
* \param service struct EXIService* Service data structure (has to be initialized before)
|
||||
* \param header struct HeaderType* Header data structure
|
||||
* \param params struct CertificateUpdateReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct CertificateUpdateResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_certificateUpdate(struct EXIService* service, struct MessageHeaderType* header, struct CertificateUpdateReqType* params, struct CertificateUpdateResType* result);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Calls the remote certificateInstallation method
|
||||
* \param service struct EXIService* Service data structure (has to be initialized before)
|
||||
* \param header struct HeaderType* Header data structure
|
||||
* \param params struct CertificateInstallationReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct CertificateInstallationResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_certificateInstallation(struct EXIService* service, struct MessageHeaderType* header, struct CertificateInstallationReqType* params, struct CertificateInstallationResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -154,7 +205,7 @@ extern "C" {
|
|||
* \param params struct CableCheckReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct CableCheckResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_cableCheck(struct EXIService* service, struct HeaderType* header, struct CableCheckReqType* params, struct CableCheckResType* result);
|
||||
int call_cableCheck(struct EXIService* service, struct MessageHeaderType* header, struct CableCheckReqType* params, struct CableCheckResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -166,7 +217,7 @@ extern "C" {
|
|||
* \param params struct PreChargeReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct PreChargeResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_preCharge(struct EXIService* service, struct HeaderType* header, struct PreChargeReqType* params, struct PreChargeResType* result);
|
||||
int call_preCharge(struct EXIService* service, struct MessageHeaderType* header, struct PreChargeReqType* params, struct PreChargeResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -178,7 +229,7 @@ extern "C" {
|
|||
* \param params struct CurrentDemandReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct CurrentDemandResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_currentDemand(struct EXIService* service, struct HeaderType* header, struct CurrentDemandReqType* params, struct CurrentDemandResType* result);
|
||||
int call_currentDemand(struct EXIService* service, struct MessageHeaderType* header, struct CurrentDemandReqType* params, struct CurrentDemandResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -190,7 +241,7 @@ extern "C" {
|
|||
* \param params struct WeldingDetectionReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct WeldingDetectionResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_weldingDetection(struct EXIService* service, struct HeaderType* header, struct WeldingDetectionReqType* params, struct WeldingDetectionResType* result);
|
||||
int call_weldingDetection(struct EXIService* service, struct MessageHeaderType* header, struct WeldingDetectionReqType* params, struct WeldingDetectionResType* result);
|
||||
|
||||
|
||||
|
||||
|
@ -202,7 +253,7 @@ extern "C" {
|
|||
* \param params struct TerminateChargingReqType* Request data for the server (has to be set up before)
|
||||
* \param result struct TerminateChargingResType* Contains the response data from the server
|
||||
* \return 0 = 0K; -1 = ERROR */
|
||||
int call_terminateCharging(struct EXIService* service, struct HeaderType* header, struct TerminateChargingReqType* params, struct TerminateChargingResType* result);
|
||||
int call_terminateCharging(struct EXIService* service, struct MessageHeaderType* header, struct TerminateChargingReqType* params, struct TerminateChargingResType* result);
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,9 +19,11 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Sebastian.Kaebisch.EXT@siemens.com
|
||||
* @version 0.3.2
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXISeGen</p>
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
@ -51,7 +53,7 @@ static void init_SessionInformationType(struct SessionInformationType* type)
|
|||
|
||||
}
|
||||
|
||||
static void init_service_string(struct service_string* type)
|
||||
static void init_faultMsgType(struct faultMsgType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
|
@ -60,17 +62,121 @@ static void init_service_string(struct service_string* type)
|
|||
static void init_NotificationType(struct NotificationType* type)
|
||||
{
|
||||
type->isused.FaultCode=0;
|
||||
init_service_string(&(type->FaultMsg));
|
||||
type->isused.FaultMsg=0;
|
||||
type->isused.EventList=0;
|
||||
init_faultMsgType(&(type->FaultMsg));
|
||||
type->isused.FaultMsg=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_HeaderType(struct HeaderType* type)
|
||||
static void init_service_string(struct service_string* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_CanonicalizationMethodType(struct CanonicalizationMethodType* type)
|
||||
{
|
||||
init_service_string(&(type->attr_Algorithm));
|
||||
|
||||
}
|
||||
|
||||
static void init_SignatureMethodType(struct SignatureMethodType* type)
|
||||
{
|
||||
init_service_string(&(type->attr_Algorithm));
|
||||
|
||||
}
|
||||
|
||||
static void init_DigestMethodType(struct DigestMethodType* type)
|
||||
{
|
||||
init_service_string(&(type->attr_Algorithm));
|
||||
|
||||
}
|
||||
|
||||
static void init_DigestValueType(struct DigestValueType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_ReferenceType(struct ReferenceType* type)
|
||||
{
|
||||
init_DigestMethodType(&(type->DigestMethod));
|
||||
init_DigestValueType(&(type->DigestValue));
|
||||
init_service_string(&(type->attr_URI));
|
||||
|
||||
}
|
||||
|
||||
static void init_SignedInfoType(struct SignedInfoType* type)
|
||||
{
|
||||
|
||||
init_CanonicalizationMethodType(&(type->CanonicalizationMethod));
|
||||
init_SignatureMethodType(&(type->SignatureMethod));
|
||||
|
||||
|
||||
init_ReferenceType(&(type->Reference));
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void init_SignatureValueType(struct SignatureValueType* type)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void init_X509IssuerSerialType(struct X509IssuerSerialType* type)
|
||||
{
|
||||
init_service_string(&(type->X509IssuerName));
|
||||
|
||||
}
|
||||
|
||||
static void init_service_byte(struct service_byte* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_X509DataType(struct X509DataType* type)
|
||||
{
|
||||
init_X509IssuerSerialType(&(type->X509IssuerSerial));
|
||||
init_service_byte(&(type->X509SKI));
|
||||
init_service_string(&(type->X509SubjectName));
|
||||
init_service_byte(&(type->X509Certificate));
|
||||
init_service_byte(&(type->X509CRL));
|
||||
|
||||
}
|
||||
|
||||
static void init_KeyInfoType(struct KeyInfoType* type)
|
||||
{
|
||||
init_X509DataType(&(type->X509Data));
|
||||
init_service_string(&(type->attr_Id));
|
||||
|
||||
}
|
||||
|
||||
static void init_SignatureType(struct SignatureType* type)
|
||||
{
|
||||
/*
|
||||
init_SignedInfoType(&(type->SignedInfo));
|
||||
init_SignatureValueType(&(type->SignatureValue));
|
||||
init_KeyInfoType(&(type->KeyInfo));
|
||||
type->isused.KeyInfo=0;
|
||||
init_service_string(&(type->attr_Id));
|
||||
*/
|
||||
}
|
||||
|
||||
static void init_SecurityType(struct SecurityType* type)
|
||||
{
|
||||
init_SignatureType(type->Signature);
|
||||
type->isused.Signature=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_MessageHeaderType(struct MessageHeaderType* type)
|
||||
{
|
||||
init_SessionInformationType(&(type->SessionInformation));
|
||||
init_NotificationType(&(type->Notification));
|
||||
type->isused.Notification=0;
|
||||
type->isused.Notification=0;
|
||||
init_SecurityType(&(type->Security));
|
||||
type->isused.Security=0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -83,7 +189,7 @@ static void init_pevIDType(struct pevIDType* type)
|
|||
static void init_SessionSetupReqType(struct SessionSetupReqType* type)
|
||||
{
|
||||
init_pevIDType(&(type->PEVID));
|
||||
type->isused.PEVID=0;
|
||||
type->isused.PEVID=0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -95,7 +201,7 @@ static void init_evseIDType(struct evseIDType* type)
|
|||
|
||||
static void init_SessionSetupResType(struct SessionSetupResType* type)
|
||||
{
|
||||
init_evseIDType(&(type->EVSEID));
|
||||
init_evseIDType(&(type->EVSEID));
|
||||
|
||||
}
|
||||
|
||||
|
@ -106,10 +212,17 @@ static void init_serviceScopeType(struct serviceScopeType* type)
|
|||
}
|
||||
|
||||
static void init_ServiceDiscoveryReqType(struct ServiceDiscoveryReqType* type)
|
||||
{
|
||||
type->isused.ServiceType=0;
|
||||
{
|
||||
init_serviceScopeType(&(type->ServiceScope));
|
||||
type->isused.ServiceScope=0;
|
||||
type->isused.ServiceScope=0;
|
||||
type->isused.ServiceType=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_PaymentOptionsType(struct PaymentOptionsType* type)
|
||||
{
|
||||
|
||||
type->arraylen.PaymentOption=0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -125,24 +238,30 @@ static void init_serviceNameType(struct serviceNameType* type)
|
|||
|
||||
}
|
||||
|
||||
static void init_ServiceDescriptionType(struct ServiceDescriptionType* type)
|
||||
static void init_ServiceTagType(struct ServiceTagType* type)
|
||||
{
|
||||
init_serviceIDType(&(type->ServiceID));
|
||||
init_serviceNameType(&(type->ServiceName));
|
||||
type->isused.ServiceName=0;
|
||||
type->isused.ServiceType=0;
|
||||
type->isused.ServiceCategory=0;
|
||||
init_serviceScopeType(&(type->ServiceScope));
|
||||
type->isused.ServiceScope=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_ServiceListType(struct ServiceListType* type)
|
||||
static void init_ServiceChargeType(struct ServiceChargeType* type)
|
||||
{
|
||||
init_ServiceTagType(&(type->ServiceTag));
|
||||
|
||||
}
|
||||
|
||||
static void init_ServiceTagListType(struct ServiceTagListType* type)
|
||||
{
|
||||
int i_loop;
|
||||
|
||||
for(i_loop=0; i_loop<8;i_loop++)
|
||||
for(i_loop=0; i_loop<32;i_loop++)
|
||||
{
|
||||
init_ServiceDescriptionType(&(type->Service[i_loop]));
|
||||
init_ServiceTagType(&(type->Service[i_loop]));
|
||||
}
|
||||
|
||||
type->arraylen.Service=0;
|
||||
|
@ -151,14 +270,58 @@ static void init_ServiceListType(struct ServiceListType* type)
|
|||
|
||||
static void init_ServiceDiscoveryResType(struct ServiceDiscoveryResType* type)
|
||||
{
|
||||
init_ServiceListType(&(type->ServiceList));
|
||||
init_PaymentOptionsType(&(type->PaymentOptions));
|
||||
init_ServiceChargeType(&(type->ChargeService));
|
||||
init_ServiceTagListType(&(type->ServiceList));
|
||||
type->isused.ServiceList=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_ServicePaymentSelectionReqType(struct ServicePaymentSelectionReqType* type)
|
||||
static void init_ServiceDetailReqType(struct ServiceDetailReqType* type)
|
||||
{
|
||||
init_ServiceListType(&(type->ServiceList));
|
||||
init_serviceIDType(&(type->ServiceID));
|
||||
|
||||
}
|
||||
|
||||
static void init_ServiceCertificateType(struct ServiceCertificateType* type)
|
||||
{
|
||||
init_ServiceTagType(&(type->ServiceTag));
|
||||
|
||||
}
|
||||
|
||||
static void init_ServiceCustomType(struct ServiceCustomType* type)
|
||||
{
|
||||
init_ServiceTagType(&(type->ServiceTag));
|
||||
|
||||
}
|
||||
|
||||
static void init_ServiceRCSType(struct ServiceRCSType* type)
|
||||
{
|
||||
init_ServiceTagType(&(type->ServiceTag));
|
||||
|
||||
}
|
||||
|
||||
static void init_ServiceInternetType(struct ServiceInternetType* type)
|
||||
{
|
||||
init_ServiceTagType(&(type->ServiceTag));
|
||||
|
||||
}
|
||||
|
||||
static void init_ServiceDetailResType(struct ServiceDetailResType* type)
|
||||
{
|
||||
init_ServiceTagType(&(type->ServiceTag));
|
||||
init_PaymentOptionsType(&(type->PaymentOptions));
|
||||
type->isused.ServiceCharge=0;
|
||||
type->isused.ServiceCertificate=0;
|
||||
type->isused.ServiceCustom=0;
|
||||
type->isused.ServiceRCS=0;
|
||||
type->isused.ServiceInternet=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_ServicePaymentSelectionReqType(struct ServicePaymentSelectionReqType* type)
|
||||
{
|
||||
init_ServiceTagListType(&(type->ServiceList));
|
||||
|
||||
}
|
||||
|
||||
|
@ -168,14 +331,77 @@ static void init_contractIDType(struct contractIDType* type)
|
|||
|
||||
}
|
||||
|
||||
static void init_certificateType(struct certificateType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_SubCertificatesType(struct SubCertificatesType* type)
|
||||
{
|
||||
int i_loop;
|
||||
|
||||
for(i_loop=0; i_loop<5;i_loop++)
|
||||
{
|
||||
init_certificateType(&(type->Certificate[i_loop]));
|
||||
}
|
||||
|
||||
type->arraylen.Certificate=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_CertificateChainType(struct CertificateChainType* type)
|
||||
{
|
||||
init_certificateType(&(type->Certificate));
|
||||
init_SubCertificatesType(&(type->SubCertificates));
|
||||
type->isused.SubCertificates=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_PaymentDetailsReqType(struct PaymentDetailsReqType* type)
|
||||
{
|
||||
init_contractIDType(&(type->ContractID));
|
||||
init_contractIDType(&(type->ContractID));
|
||||
init_CertificateChainType(&(type->ContractSignatureCertChain));
|
||||
|
||||
}
|
||||
|
||||
static void init_genChallengeType(struct genChallengeType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_PaymentDetailsResType(struct PaymentDetailsResType* type)
|
||||
{
|
||||
init_genChallengeType(&(type->GenChallenge));
|
||||
|
||||
}
|
||||
|
||||
static void init_ContractAuthenticationReqType(struct ContractAuthenticationReqType* type)
|
||||
{
|
||||
init_genChallengeType(&(type->GenChallenge));
|
||||
|
||||
}
|
||||
|
||||
static void init_AC_PEVChargeParameterType(struct AC_PEVChargeParameterType* type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void init_DC_PEVChargeParameterType(struct DC_PEVChargeParameterType* type)
|
||||
{
|
||||
type->isused.PEVMaximumPowerLimit=0;
|
||||
type->isused.PEVEnergyCapacity=0;
|
||||
type->isused.PEVEnergyRequest=0;
|
||||
type->isused.FullSOC=0;
|
||||
type->isused.BulkSOC=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_ChargeParameterDiscoveryReqType(struct ChargeParameterDiscoveryReqType* type)
|
||||
{
|
||||
{
|
||||
type->isused.AC_PEVChargeParameter=0;
|
||||
type->isused.DC_PEVChargeParameter=0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -185,20 +411,15 @@ static void init_energyProviderType(struct energyProviderType* type)
|
|||
|
||||
}
|
||||
|
||||
static void init_currencyType(struct currencyType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_tariffDescriptionType(struct tariffDescriptionType* type)
|
||||
static void init_ePriceType(struct ePriceType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_TariffEntryType(struct TariffEntryType* type)
|
||||
{
|
||||
{
|
||||
init_ePriceType(&(type->EPrice));
|
||||
type->isused.EPrice=0;
|
||||
|
||||
}
|
||||
|
@ -217,8 +438,7 @@ static void init_TariffEntriesType(struct TariffEntriesType* type)
|
|||
}
|
||||
|
||||
static void init_TariffDescrType(struct TariffDescrType* type)
|
||||
{
|
||||
init_tariffDescriptionType(&(type->TariffDescription));
|
||||
{
|
||||
type->isused.TariffDescription=0;
|
||||
init_TariffEntriesType(&(type->TariffEntries));
|
||||
|
||||
|
@ -227,23 +447,188 @@ static void init_TariffDescrType(struct TariffDescrType* type)
|
|||
static void init_TariffTableType(struct TariffTableType* type)
|
||||
{
|
||||
int i_loop;
|
||||
|
||||
init_currencyType(&(type->Currency));
|
||||
|
||||
for(i_loop=0; i_loop<6;i_loop++)
|
||||
{
|
||||
init_TariffDescrType(&(type->Tariff[i_loop]));
|
||||
}
|
||||
|
||||
type->arraylen.Tariff=0;
|
||||
type->arraylen.Tariff=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_AC_EVSEChargeParameterType(struct AC_EVSEChargeParameterType* type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void init_DC_EVSEChargeParameterType(struct DC_EVSEChargeParameterType* type)
|
||||
{
|
||||
type->isused.EVSEMaximumPowerLimit=0;
|
||||
type->isused.EVSECurrentRegulationTolerance=0;
|
||||
type->isused.EVSEEnergyToBeDelivered=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_ChargeParameterDiscoveryResType(struct ChargeParameterDiscoveryResType* type)
|
||||
{
|
||||
{
|
||||
init_energyProviderType(&(type->EnergyProvider));
|
||||
type->isused.EnergyProvider=0;
|
||||
init_TariffTableType(&(type->TariffTable));
|
||||
type->isused.TariffTable=0;
|
||||
type->isused.TariffTable=0;
|
||||
type->isused.AC_EVSEChargeParameter=0;
|
||||
type->isused.DC_EVSEChargeParameter=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_ChargingProfileType(struct ChargingProfileType* type)
|
||||
{
|
||||
|
||||
type->arraylen.ProfileEntry=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_AC_PEVPowerDeliveryParameterType(struct AC_PEVPowerDeliveryParameterType* type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void init_DC_PEVPowerDeliveryParameterType(struct DC_PEVPowerDeliveryParameterType* type)
|
||||
{
|
||||
type->isused.BulkChargingComplete=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_PowerDeliveryReqType(struct PowerDeliveryReqType* type)
|
||||
{
|
||||
type->isused.Tariff=0;
|
||||
init_ChargingProfileType(&(type->ChargingProfile));
|
||||
type->isused.ChargingProfile=0;
|
||||
type->isused.AC_PEVPowerDeliveryParameter=0;
|
||||
type->isused.DC_PEVPowerDeliveryParameter=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_PowerDeliveryResType(struct PowerDeliveryResType* type)
|
||||
{
|
||||
type->isused.AC_EVSEStatus=0;
|
||||
type->isused.DC_EVSEStatus=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_MeteringStatusReqType(struct MeteringStatusReqType* type)
|
||||
{
|
||||
type->isused.AC_PEVStatus=0;
|
||||
type->isused.DC_PEVStatus=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_meterIDType(struct meterIDType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_pubKeyType(struct pubKeyType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_MeterInfoType(struct MeterInfoType* type)
|
||||
{
|
||||
init_meterIDType(&(type->MeterID));
|
||||
type->isused.MeterID=0;
|
||||
init_pubKeyType(&(type->MeterPubKey));
|
||||
type->isused.MeterPubKey=0;
|
||||
type->isused.MeterReading=0;
|
||||
type->isused.SigMeterReading=0;
|
||||
type->isused.MeterStatus=0;
|
||||
type->isused.TMeter=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_MeteringStatusResType(struct MeteringStatusResType* type)
|
||||
{
|
||||
init_evseIDType(&(type->EVSEID));
|
||||
type->isused.PCurrent=0;
|
||||
init_MeterInfoType(&(type->MeterInfo));
|
||||
type->isused.MeterInfo=0;
|
||||
type->isused.AC_EVSEStatus=0;
|
||||
type->isused.DC_EVSEStatus=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_meterSignatureType(struct meterSignatureType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_MeteringReceiptReqType(struct MeteringReceiptReqType* type)
|
||||
{
|
||||
init_pevIDType(&(type->PEVID));
|
||||
type->isused.PEVID=0;
|
||||
init_evseIDType(&(type->EVSEID));
|
||||
init_sessionIDType(&(type->SessionID));
|
||||
init_MeterInfoType(&(type->MeterInfo));
|
||||
type->isused.TCurrent=0;
|
||||
init_meterSignatureType(&(type->ReceiptSignature));
|
||||
type->isused.AC_PEVStatus=0;
|
||||
type->isused.DC_PEVStatus=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_MeteringReceiptResType(struct MeteringReceiptResType* type)
|
||||
{
|
||||
type->isused.AC_EVSEStatus=0;
|
||||
type->isused.DC_EVSEStatus=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_CertificateUpdateReqType(struct CertificateUpdateReqType* type)
|
||||
{
|
||||
init_CertificateChainType(&(type->ContractSignatureCertChain));
|
||||
init_certificateType(&(type->ContractEncryptionCert));
|
||||
init_contractIDType(&(type->ContractID));
|
||||
|
||||
}
|
||||
|
||||
static void init_signaturePrivateKeyType(struct signaturePrivateKeyType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_encryptionPrivateKeyType(struct encryptionPrivateKeyType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_CertificateUpdateResType(struct CertificateUpdateResType* type)
|
||||
{
|
||||
init_CertificateChainType(&(type->ContractSignatureCertChain));
|
||||
init_signaturePrivateKeyType(&(type->ContractSignaturePrivateKey));
|
||||
init_CertificateChainType(&(type->ContractEncryptionCertChain));
|
||||
init_encryptionPrivateKeyType(&(type->ContractEncryptionPrivateKey));
|
||||
init_contractIDType(&(type->ContractID));
|
||||
|
||||
}
|
||||
|
||||
static void init_CertificateInstallationReqType(struct CertificateInstallationReqType* type)
|
||||
{
|
||||
init_certificateType(&(type->OEMProvisioningCert));
|
||||
|
||||
}
|
||||
|
||||
static void init_CertificateInstallationResType(struct CertificateInstallationResType* type)
|
||||
{
|
||||
init_CertificateChainType(&(type->ContractSignatureCertChain));
|
||||
init_pubKeyType(&(type->ContractSignaturePrivateKey));
|
||||
init_CertificateChainType(&(type->ContractEncryptionCertChain));
|
||||
init_encryptionPrivateKeyType(&(type->ContractEncryptionPrivateKey));
|
||||
init_contractIDType(&(type->ContractID));
|
||||
|
||||
}
|
||||
|
||||
|
@ -257,51 +642,6 @@ static void init_LineLockResType(struct LineLockResType* type)
|
|||
|
||||
}
|
||||
|
||||
static void init_PowerDeliveryReqType(struct PowerDeliveryReqType* type)
|
||||
{
|
||||
type->isused.Tariff=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_PowerDeliveryResType(struct PowerDeliveryResType* type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void init_meterIDType(struct meterIDType* type)
|
||||
{
|
||||
type->arraylen.data=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_MeterInfoType(struct MeterInfoType* type)
|
||||
{
|
||||
init_meterIDType(&(type->MeterID));
|
||||
type->isused.MeterID=0;
|
||||
type->isused.MeterReading=0;
|
||||
type->isused.MeterStatus=0;
|
||||
type->isused.TMeter=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_MeteringStatusResType(struct MeteringStatusResType* type)
|
||||
{
|
||||
init_evseIDType(&(type->EVSEID));
|
||||
type->isused.PCurrent=0;
|
||||
init_MeterInfoType(&(type->MeterInfo));
|
||||
type->isused.MeterInfo=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_MeteringReceiptReqType(struct MeteringReceiptReqType* type)
|
||||
{
|
||||
init_pevIDType(&(type->PEVID));
|
||||
type->isused.PEVID=0;
|
||||
type->isused.TCurrent=0;
|
||||
init_MeterInfoType(&(type->MeterInfo));
|
||||
|
||||
}
|
||||
|
||||
static void init_CableCheckReqType(struct CableCheckReqType* type)
|
||||
{
|
||||
|
||||
|
@ -313,7 +653,7 @@ static void init_CableCheckResType(struct CableCheckResType* type)
|
|||
}
|
||||
|
||||
static void init_PreChargeReqType(struct PreChargeReqType* type)
|
||||
{
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
@ -323,12 +663,21 @@ static void init_PreChargeResType(struct PreChargeResType* type)
|
|||
}
|
||||
|
||||
static void init_CurrentDemandReqType(struct CurrentDemandReqType* type)
|
||||
{
|
||||
{
|
||||
type->isused.PEVMaximumVoltageLimit=0;
|
||||
type->isused.PEVMaximumCurrentLimit=0;
|
||||
type->isused.PEVMaximumPowerLimit=0;
|
||||
type->isused.BulkChargingComplete=0;
|
||||
type->isused.RemainingTimeToFullSoC=0;
|
||||
type->isused.RemainingTimeToBulkSoC=0;
|
||||
|
||||
}
|
||||
|
||||
static void init_CurrentDemandResType(struct CurrentDemandResType* type)
|
||||
{
|
||||
{
|
||||
type->isused.EVSEMaximumVoltageLimit=0;
|
||||
type->isused.EVSEMaximumCurrentLimit=0;
|
||||
type->isused.EVSEMaximumPowerLimit=0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -348,7 +697,7 @@ static void init_TerminateChargingReqType(struct TerminateChargingReqType* type
|
|||
}
|
||||
|
||||
static void init_TerminateChargingResType(struct TerminateChargingResType* type)
|
||||
{
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
@ -358,20 +707,28 @@ static void init_BodyType(struct BodyType* type)
|
|||
type->isused.SessionSetupRes=0;
|
||||
type->isused.ServiceDiscoveryReq=0;
|
||||
type->isused.ServiceDiscoveryRes=0;
|
||||
type->isused.ServiceDetailReq=0;
|
||||
type->isused.ServiceDetailRes=0;
|
||||
type->isused.ServicePaymentSelectionReq=0;
|
||||
type->isused.ServicePaymentSelectionRes=0;
|
||||
type->isused.PaymentDetailsReq=0;
|
||||
type->isused.PaymentDetailsRes=0;
|
||||
type->isused.ContractAuthenticationReq=0;
|
||||
type->isused.ContractAuthenticationRes=0;
|
||||
type->isused.ChargeParameterDiscoveryReq=0;
|
||||
type->isused.ChargeParameterDiscoveryRes=0;
|
||||
type->isused.LineLockReq=0;
|
||||
type->isused.LineLockRes=0;
|
||||
type->isused.PowerDeliveryReq=0;
|
||||
type->isused.PowerDeliveryRes=0;
|
||||
type->isused.MeteringStatusReq=0;
|
||||
type->isused.MeteringStatusRes=0;
|
||||
type->isused.MeteringReceiptReq=0;
|
||||
type->isused.MeteringReceiptRes=0;
|
||||
type->isused.CertificateUpdateReq=0;
|
||||
type->isused.CertificateUpdateRes=0;
|
||||
type->isused.CertificateInstallationReq=0;
|
||||
type->isused.CertificateInstallationRes=0;
|
||||
type->isused.LineLockReq=0;
|
||||
type->isused.LineLockRes=0;
|
||||
type->isused.CableCheckReq=0;
|
||||
type->isused.CableCheckRes=0;
|
||||
type->isused.PreChargeReq=0;
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 Siemens AG
|
||||
* Copyright (C) 2007-2010 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
|
@ -18,7 +18,7 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Sebastian.Kaebisch.EXT@siemens.com
|
||||
* @version 0.2
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
|
|
@ -22,9 +22,11 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Sebastian.Kaebisch.EXT@siemens.com
|
||||
* @version 0.3.2
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXISeGen</p>
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
@ -39,33 +41,41 @@ extern "C" {
|
|||
#include "EXITypes.h"
|
||||
|
||||
/* This service methods has to be implemented by the EVSE server */
|
||||
int sessionSetup(struct SessionSetupReqType* param, struct SessionSetupResType* result);
|
||||
int sessionSetup(struct MessageHeaderType* header, struct SessionSetupReqType* param, struct SessionSetupResType* result);
|
||||
|
||||
int serviceDiscovery(struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result);
|
||||
int serviceDiscovery(struct MessageHeaderType* header, struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result);
|
||||
|
||||
int selectedServicePayment(struct ServicePaymentSelectionReqType* param, struct ServicePaymentSelectionResType* result);
|
||||
int serviceDetail(struct MessageHeaderType* header, struct ServiceDetailReqType* param, struct ServiceDetailResType* result);
|
||||
|
||||
int paymentDetails(struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result);
|
||||
int selectedServicePayment(struct MessageHeaderType* header, struct ServicePaymentSelectionReqType* param, struct ServicePaymentSelectionResType* result);
|
||||
|
||||
int chargeParameterDiscovery(struct ChargeParameterDiscoveryReqType* param, struct ChargeParameterDiscoveryResType* result);
|
||||
int paymentDetails(struct MessageHeaderType* header, struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result);
|
||||
|
||||
int lineLock(struct LineLockReqType* param, struct LineLockResType* result);
|
||||
int contractAuthentication(struct MessageHeaderType* header, struct ContractAuthenticationReqType* param, struct ContractAuthenticationResType* result);
|
||||
|
||||
int powerDelivery(struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result);
|
||||
int chargeParameterDiscovery(struct MessageHeaderType* header, struct ChargeParameterDiscoveryReqType* param, struct ChargeParameterDiscoveryResType* result);
|
||||
|
||||
int meteringStatus(struct MeteringStatusReqType* param, struct MeteringStatusResType* result);
|
||||
int powerDelivery(struct MessageHeaderType* header, struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result);
|
||||
|
||||
int meteringReceipt(struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result);
|
||||
int meteringStatus(struct MessageHeaderType* header, struct MeteringStatusReqType* param, struct MeteringStatusResType* result);
|
||||
|
||||
int cableCheck(struct CableCheckReqType* param, struct CableCheckResType* result);
|
||||
int meteringReceipt(struct MessageHeaderType* header, struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result);
|
||||
|
||||
int preCharge(struct PreChargeReqType* param, struct PreChargeResType* result);
|
||||
int certificateUpdate(struct MessageHeaderType* header, struct CertificateUpdateReqType* param, struct CertificateUpdateResType* result);
|
||||
|
||||
int currentDemand(struct CurrentDemandReqType* param, struct CurrentDemandResType* result);
|
||||
int certificateInstallation(struct MessageHeaderType* header, struct CertificateInstallationReqType* param, struct CertificateInstallationResType* result);
|
||||
|
||||
int weldingDetection(struct WeldingDetectionReqType* param, struct WeldingDetectionResType* result);
|
||||
int lineLock(struct MessageHeaderType* header, struct LineLockReqType* param, struct LineLockResType* result);
|
||||
|
||||
int terminateCharging(struct TerminateChargingReqType* param, struct TerminateChargingResType* result);
|
||||
int cableCheck(struct MessageHeaderType* header, struct CableCheckReqType* param, struct CableCheckResType* result);
|
||||
|
||||
int preCharge(struct MessageHeaderType* header, struct PreChargeReqType* param, struct PreChargeResType* result);
|
||||
|
||||
int currentDemand(struct MessageHeaderType* header, struct CurrentDemandReqType* param, struct CurrentDemandResType* result);
|
||||
|
||||
int weldingDetection(struct MessageHeaderType* header, struct WeldingDetectionReqType* param, struct WeldingDetectionResType* result);
|
||||
|
||||
int terminateCharging(struct MessageHeaderType* header, struct TerminateChargingReqType* param, struct TerminateChargingResType* result);
|
||||
|
||||
|
||||
|
||||
|
|
87
src/test/evse_server.c
Normal file
87
src/test/evse_server.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#include "evse_server.h"
|
||||
#include "v2g_service.h"
|
||||
#include "v2g_serviceDispatcher.h"
|
||||
#include "v2gtp.h"
|
||||
|
||||
#define MAX_BYTE_SIZE 64
|
||||
#define MAX_STRING_SIZE 64
|
||||
#define MAX_STREAM_SIZE 100
|
||||
|
||||
int testV2GService(uint8_t* inStream, uint16_t inStreamLength, uint8_t* outStream, uint16_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*/
|
||||
|
||||
|
||||
uint16_t exiMsgLength;
|
||||
|
||||
struct EXIService 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 as well as the offset *
|
||||
* for the transportation header *
|
||||
**********************************************/
|
||||
|
||||
init_v2gservice(&service, bytes, string, V2GTP_HEADER_LENGTH);
|
||||
|
||||
/* check, if the DoIP header is correct and determine payload */
|
||||
if(read_v2gtpHeader(inStream,inStreamLength, &exiMsgLength))
|
||||
{
|
||||
/* v2gtp header not correct */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Pass the received EXI message stream (inStream + exiMsgLength) to the *
|
||||
* v2g message dispatcher. The outStream contains the response message *
|
||||
* stream. *
|
||||
****************************************************************************/
|
||||
|
||||
if(messageDispatcher(&service, inStream, exiMsgLength, outStream, MAX_STREAM_SIZE, outStreamLength))
|
||||
{
|
||||
/* an error occured */
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* write v2gtp header */
|
||||
write_v2gtpHeader(outStream, outStreamLength, V2GTP_EXI_TYPE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
33
src/test/evse_server.h
Normal file
33
src/test/evse_server.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#ifndef V2G_SERVER_H_
|
||||
#define V2G_SERVER_H_
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
int testV2GService(uint8_t* inStream, uint16_t inStreamLength, uint8_t* outStream,uint16_t* outStreamLength);
|
||||
|
||||
#endif /* V2G_SERVER_H_ */
|
569
src/test/evse_serviceMethods.c
Normal file
569
src/test/evse_serviceMethods.c
Normal file
|
@ -0,0 +1,569 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#include "v2g_serviceMethods.h"
|
||||
#include "v2g_serviceDataTypes.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int sessionSetup(struct MessageHeaderType* header, struct SessionSetupReqType* param, struct SessionSetupResType* result)
|
||||
{
|
||||
|
||||
printf("EVSE: sessionSetup called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
printf("\t\t Header SessionID=%d\n",header->SessionInformation.SessionID.data[0]);
|
||||
printf("\t\t PEVID=%d\n",param->PEVID.data[0]);
|
||||
|
||||
header->SessionInformation.SessionID.data[0] = 10;
|
||||
header->SessionInformation.SessionID.arraylen.data=1;
|
||||
|
||||
/* Prepare data for PEV */
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->EVSEID.data[0]=1;
|
||||
result->EVSEID.arraylen.data=1;
|
||||
result->TCurrent=12345678;
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int serviceDiscovery(struct MessageHeaderType* header, struct ServiceDiscoveryReqType* param, struct ServiceDiscoveryResType* result)
|
||||
{
|
||||
printf("EVSE: serviceDiscovery called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
|
||||
printf("\t\t ServiceType=%d\n", param->ServiceType);
|
||||
|
||||
result->isused.ServiceList=0;
|
||||
result->ResponseCode= OK_responseCodeType;
|
||||
result->ChargeService.ServiceTag.ServiceID.data[0]=1;
|
||||
result->ChargeService.ServiceTag.ServiceID.arraylen.data=1;
|
||||
|
||||
result->ChargeService.ServiceTag.isused.ServiceName=0;
|
||||
result->ChargeService.ServiceTag.isused.ServiceCategory=0;
|
||||
result->ChargeService.ServiceTag.isused.ServiceScope=0;
|
||||
|
||||
result->ChargeService.FreeService = 1;
|
||||
result->PaymentOptions.PaymentOption[0] = ExternalPayment_paymentOptionType; /* only free of charge yet ;-) */
|
||||
result->PaymentOptions.arraylen.PaymentOption=1;
|
||||
result->ChargeService.EnergyTransferType = DC_core_EVSESupportedEnergyTransferType;
|
||||
|
||||
result->isused.ServiceList=0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int selectedServicePayment(struct MessageHeaderType* header, struct ServicePaymentSelectionReqType* param, struct ServicePaymentSelectionResType* result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int paymentDetails(struct MessageHeaderType* header, struct PaymentDetailsReqType* param, struct PaymentDetailsResType* result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int chargeParameterDiscovery(struct MessageHeaderType* header, struct ChargeParameterDiscoveryReqType* param, struct ChargeParameterDiscoveryResType* result)
|
||||
{
|
||||
struct FloatingValueType f;
|
||||
|
||||
printf("EVSE: chargeParameterDiscovery called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
printf("\t\t PEVRequestedEnergyTransferType=%d\n",param->PEVRequestedEnergyTransferType);
|
||||
|
||||
/* check,if DC or AC is requested */
|
||||
if(param->PEVRequestedEnergyTransferType==DC_core_PEVRequestedEnergyTransferType || param->isused.DC_PEVChargeParameter==1)
|
||||
{
|
||||
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->DC_PEVChargeParameter->DC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t PEVReady=%d\n", param->DC_PEVChargeParameter->DC_PEVStatus.PEVReady);
|
||||
printf("\t\t\t PEVRESSSOC=%d\n", param->DC_PEVChargeParameter->DC_PEVStatus.PEVRESSSOC);
|
||||
printf("\t\t\t PEVStatusCode=%d\n", param->DC_PEVChargeParameter->DC_PEVStatus.PEVStatusCode);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->DC_PEVChargeParameter->DC_PEVStatus.ConnectorLocked);
|
||||
|
||||
printf("\t\t PEVMaximumCurrentLimit=%d\n", param->DC_PEVChargeParameter->PEVMaximumCurrentLimit.Value);
|
||||
printf("\t\t PEVMaximumPowerLimit=%d\n", param->DC_PEVChargeParameter->PEVMaximumPowerLimit.Value);
|
||||
printf("\t\t PEVMaximumVoltageLimit=%d\n", param->DC_PEVChargeParameter->PEVMaximumVoltageLimit.Value);
|
||||
printf("\t\t PEVEnergyCapacity=%d\n", param->DC_PEVChargeParameter->PEVEnergyCapacity.Value);
|
||||
printf("\t\t PEVEnergyRequest=%d\n", param->DC_PEVChargeParameter->PEVEnergyRequest.Value);
|
||||
printf("\t\t FullSOC=%d\n", param->DC_PEVChargeParameter->FullSOC);
|
||||
printf("\t\t BulkSOC=%d\n", param->DC_PEVChargeParameter->BulkSOC);
|
||||
printf("\t\t PEVProtocolVersion=%d\n", param->DC_PEVChargeParameter->PEVProtocolVersion);
|
||||
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->isused.EnergyProvider=0;
|
||||
result->isused.TariffTable=0;
|
||||
|
||||
|
||||
result->isused.DC_EVSEChargeParameter = 1;
|
||||
result->isused.AC_EVSEChargeParameter = 0;
|
||||
result->DC_EVSEChargeParameter->DC_EVSEStatus.EVSEStandby = 1;
|
||||
result->DC_EVSEChargeParameter->DC_EVSEStatus.EVSEStatusCode = IsolationMonitoringActive_DC_EVSEStatusCodeType;
|
||||
|
||||
f.Multiplier = 0;
|
||||
f.Unit = A_unitSymbolType;
|
||||
f.Value = 100;
|
||||
|
||||
result->DC_EVSEChargeParameter->EVSEMaximumCurrentLimit=f;
|
||||
|
||||
f.Unit = W_unitSymbolType;
|
||||
f.Value = 200;
|
||||
|
||||
result->DC_EVSEChargeParameter->EVSEMaximumPowerLimit=f;
|
||||
result->DC_EVSEChargeParameter->isused.EVSEMaximumPowerLimit=1;
|
||||
|
||||
f.Unit = V_unitSymbolType;
|
||||
f.Value = 300;
|
||||
|
||||
result->DC_EVSEChargeParameter->EVSEMaximumVoltageLimit=f;
|
||||
|
||||
f.Unit = A_unitSymbolType;
|
||||
f.Value = 400;
|
||||
|
||||
result->DC_EVSEChargeParameter->EVSEMinimumCurrentLimit=f;
|
||||
|
||||
f.Unit = V_unitSymbolType;
|
||||
f.Value = 500;
|
||||
|
||||
result->DC_EVSEChargeParameter->EVSEMinimumVoltageLimit=f;
|
||||
|
||||
f.Unit = A_unitSymbolType;
|
||||
f.Value = 600;
|
||||
|
||||
result->DC_EVSEChargeParameter->EVSECurrentRegulationTolerance=f;
|
||||
result->DC_EVSEChargeParameter->isused.EVSECurrentRegulationTolerance=1;
|
||||
|
||||
f.Unit = V_unitSymbolType;
|
||||
f.Value = 700;
|
||||
|
||||
result->DC_EVSEChargeParameter->EVSEPeakCurrentRipple=f;
|
||||
|
||||
f.Unit = A_unitSymbolType;
|
||||
f.Value = 800;
|
||||
|
||||
result->DC_EVSEChargeParameter->EVSEEnergyToBeDelivered=f;
|
||||
result->DC_EVSEChargeParameter->isused.EVSEEnergyToBeDelivered=1;
|
||||
|
||||
result->DC_EVSEChargeParameter->EVSEProtocolVersion=12;
|
||||
|
||||
} else { /* AC related */
|
||||
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->AC_PEVChargeParameter->AC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->AC_PEVChargeParameter->AC_PEVStatus.ConnectorLocked);
|
||||
|
||||
|
||||
printf("\t\t EAmount=%d\n", param->AC_PEVChargeParameter->EAmount.Value);
|
||||
printf("\t\t EoC=%d\n", param->AC_PEVChargeParameter->EoC);
|
||||
printf("\t\t PEVMaxCurrent=%d\n", param->AC_PEVChargeParameter->PEVMaxCurrent.Value);
|
||||
printf("\t\t PEVMaxPhases=%d\n", param->AC_PEVChargeParameter->PEVMaxPhases);
|
||||
printf("\t\t PEVMaxPower=%d\n", param->AC_PEVChargeParameter->PEVMaxPower.Value);
|
||||
printf("\t\t PEVMaxVoltage=%d\n", param->AC_PEVChargeParameter->PEVMaxVoltage.Value);
|
||||
printf("\t\t PEVMinCurrent=%d\n", param->AC_PEVChargeParameter->PEVMinCurrent.Value);
|
||||
printf("\t\t PEVMinVoltage=%d\n", param->AC_PEVChargeParameter->PEVMinVoltage.Value);
|
||||
|
||||
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->isused.EnergyProvider=0;
|
||||
result->isused.TariffTable=0;
|
||||
|
||||
|
||||
result->isused.AC_EVSEChargeParameter = 1;
|
||||
result->isused.DC_EVSEChargeParameter = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
result->AC_EVSEChargeParameter->AC_EVSEStatus.ConnectorLocked=1;
|
||||
result->AC_EVSEChargeParameter->AC_EVSEStatus.EVSEStandby=1;
|
||||
result->AC_EVSEChargeParameter->AC_EVSEStatus.PowerSwitchClosed=1;
|
||||
result->AC_EVSEChargeParameter->AC_EVSEStatus.RCD=1;
|
||||
result->AC_EVSEChargeParameter->AC_EVSEStatus.ShutDownTime=12345;
|
||||
result->AC_EVSEChargeParameter->AC_EVSEStatus.StopCharging=1;
|
||||
|
||||
|
||||
f.Multiplier = 0;
|
||||
f.Unit = A_unitSymbolType;
|
||||
f.Value = 100;
|
||||
|
||||
result->AC_EVSEChargeParameter->EVSEMaxCurrent=f;
|
||||
result->AC_EVSEChargeParameter->EVSEMaxPhases=3;
|
||||
|
||||
f.Unit = V_unitSymbolType;
|
||||
f.Value = 200;
|
||||
result->AC_EVSEChargeParameter->EVSEMaxVoltage=f;
|
||||
|
||||
f.Unit = A_unitSymbolType;
|
||||
f.Value = 300;
|
||||
result->AC_EVSEChargeParameter->EVSEMinCurrent=f;
|
||||
|
||||
f.Unit = V_unitSymbolType;
|
||||
f.Value = 400;
|
||||
result->AC_EVSEChargeParameter->EVSEMinVoltage=f;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lineLock(struct MessageHeaderType* header, struct LineLockReqType* param, struct LineLockResType* result)
|
||||
{
|
||||
printf("EVSE: lineLock called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->AC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->AC_PEVStatus.ConnectorLocked);
|
||||
printf("\t\t ReqLockStatus=%d\n", param->ReqLockStatus);
|
||||
|
||||
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->AC_EVSEStatus.ConnectorLocked=1;
|
||||
result->AC_EVSEStatus.EVSEStandby=1;
|
||||
result->AC_EVSEStatus.PowerSwitchClosed=1;
|
||||
result->AC_EVSEStatus.RCD=1;
|
||||
result->AC_EVSEStatus.ShutDownTime=12345;
|
||||
result->AC_EVSEStatus.StopCharging=1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int powerDelivery(struct MessageHeaderType* header, struct PowerDeliveryReqType* param, struct PowerDeliveryResType* result)
|
||||
{
|
||||
printf("EVSE: powerDelivery called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
printf("\t\t\t ReqSwitchStatus=%d\n", param->ReqSwitchStatus);
|
||||
|
||||
|
||||
if(param->isused.DC_PEVPowerDeliveryParameter)
|
||||
{
|
||||
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->DC_PEVPowerDeliveryParameter->DC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t PEVReady=%d\n", param->DC_PEVPowerDeliveryParameter->DC_PEVStatus.PEVReady);
|
||||
printf("\t\t\t PEVRESSSOC=%d\n", param->DC_PEVPowerDeliveryParameter->DC_PEVStatus.PEVRESSSOC);
|
||||
printf("\t\t\t PEVStatusCode=%d\n", param->DC_PEVPowerDeliveryParameter->DC_PEVStatus.PEVStatusCode);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->DC_PEVPowerDeliveryParameter->DC_PEVStatus.ConnectorLocked);
|
||||
printf("\t\t BulkChargingComplete=%d\n", param->DC_PEVPowerDeliveryParameter->BulkChargingComplete);
|
||||
printf("\t\t ChargingComplete=%d\n", param->DC_PEVPowerDeliveryParameter->ChargingComplete);
|
||||
|
||||
result->ResponseCode = FAILED_NotReady_responseCodeType;
|
||||
result->DC_EVSEStatus->EVSEStandby =1;
|
||||
result->DC_EVSEStatus->EVSEStatusCode = IsolationMonitoringActive_DC_EVSEStatusCodeType;
|
||||
result->isused.DC_EVSEStatus=1;
|
||||
result->isused.AC_EVSEStatus=0;
|
||||
} else {
|
||||
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->AC_PEVPowerDeliveryParameter->AC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->AC_PEVPowerDeliveryParameter->AC_PEVStatus.ConnectorLocked);
|
||||
|
||||
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->AC_EVSEStatus->ConnectorLocked=1;
|
||||
result->AC_EVSEStatus->EVSEStandby=1;
|
||||
result->AC_EVSEStatus->PowerSwitchClosed=1;
|
||||
result->AC_EVSEStatus->RCD=1;
|
||||
result->AC_EVSEStatus->ShutDownTime=12345;
|
||||
result->AC_EVSEStatus->StopCharging=1;
|
||||
|
||||
|
||||
result->isused.AC_EVSEStatus=1;
|
||||
result->isused.DC_EVSEStatus=0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int meteringStatus(struct MessageHeaderType* header, struct MeteringStatusReqType* param, struct MeteringStatusResType* result)
|
||||
{
|
||||
printf("EVSE: meteringStatus called\n" );
|
||||
|
||||
if(param->isused.AC_PEVStatus==1)
|
||||
{
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->AC_PEVStatus->PEVStandby);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->AC_PEVStatus->ConnectorLocked);
|
||||
}
|
||||
|
||||
|
||||
result->ResponseCode=OK_responseCodeType;
|
||||
result->EVSEID.data[0]=1;
|
||||
result->EVSEID.arraylen.data=1;
|
||||
result->isused.AC_EVSEStatus=1;
|
||||
result->isused.DC_EVSEStatus=0;
|
||||
result->AC_EVSEStatus->ConnectorLocked=1;
|
||||
result->AC_EVSEStatus->EVSEStandby=1;
|
||||
result->AC_EVSEStatus->PowerSwitchClosed=1;
|
||||
result->AC_EVSEStatus->RCD=1;
|
||||
result->AC_EVSEStatus->ShutDownTime=12345;
|
||||
result->AC_EVSEStatus->StopCharging=1;
|
||||
result->TCurrent=12345678;
|
||||
result->EVSEMaxPower.Multiplier = 2;
|
||||
result->EVSEMaxPower.Unit = A_unitSymbolType;
|
||||
result->EVSEMaxPower.Value = 400;
|
||||
|
||||
result->isused.MeterInfo=1;
|
||||
result->MeterInfo.MeterID.arraylen.data=1;
|
||||
result->MeterInfo.MeterID.data[0]=2;
|
||||
result->MeterInfo.MeterReading.Multiplier = 0;
|
||||
result->MeterInfo.MeterReading.Unit = A_unitSymbolType;
|
||||
result->MeterInfo.MeterReading.Value = 500;
|
||||
result->MeterInfo.MeterStatus = 4321;
|
||||
result->MeterInfo.TMeter =123456789;
|
||||
result->MeterInfo.isused.MeterID=1;
|
||||
result->MeterInfo.isused.MeterReading = 1;
|
||||
result->MeterInfo.isused.MeterStatus=1;
|
||||
result->MeterInfo.isused.TMeter=1;
|
||||
|
||||
result->isused.PCurrent=1;
|
||||
result->PCurrent.Value=4321;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int meteringReceipt(struct MessageHeaderType* header, struct MeteringReceiptReqType* param, struct MeteringReceiptResType* result)
|
||||
{
|
||||
|
||||
printf("EVSE: meteringReceipt called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
|
||||
if(param->isused.AC_PEVStatus)
|
||||
{
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->AC_PEVStatus->PEVStandby);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->AC_PEVStatus->ConnectorLocked);
|
||||
}
|
||||
|
||||
printf("\t\t TCurrent=%d\n", param->TCurrent);
|
||||
printf("\t\t Tariff=%d\n", param->Tariff);
|
||||
printf("\t\t MeterInfo.MeterStatus=%d\n", param->MeterInfo.MeterStatus);
|
||||
printf("\t\t MeterInfo.MeterID=%d\n", param->MeterInfo.MeterID.data[0]);
|
||||
printf("\t\t MeterInfo.isused.MeterReading=%d\n", param->MeterInfo.isused.MeterReading);
|
||||
printf("\t\t MeterReading.Value=%d\n", param->MeterInfo.MeterReading.Value);
|
||||
printf("\t\t MeterInfo.TMeter=%d\n", param->MeterInfo.TMeter);
|
||||
if(param->Tariff==12)
|
||||
printf("\t\t Tariff==Green_charge_tariffIDType\n");
|
||||
result->ResponseCode = 0;
|
||||
|
||||
result->isused.AC_EVSEStatus=1;
|
||||
result->isused.DC_EVSEStatus=0;
|
||||
result->AC_EVSEStatus->ConnectorLocked=1;
|
||||
result->AC_EVSEStatus->EVSEStandby=1;
|
||||
result->AC_EVSEStatus->PowerSwitchClosed=1;
|
||||
result->AC_EVSEStatus->RCD=1;
|
||||
result->AC_EVSEStatus->ShutDownTime=12345;
|
||||
result->AC_EVSEStatus->StopCharging=1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cableCheck(struct MessageHeaderType* header, struct CableCheckReqType* param, struct CableCheckResType* result)
|
||||
{
|
||||
printf("EVSE: cableCheck called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
|
||||
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->DC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t PEVReady=%d\n", param->DC_PEVStatus.PEVReady);
|
||||
printf("\t\t\t PEVRESSSOC=%d\n", param->DC_PEVStatus.PEVRESSSOC);
|
||||
printf("\t\t\t PEVStatusCode=%d\n", param->DC_PEVStatus.PEVStatusCode);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->DC_PEVStatus.ConnectorLocked);
|
||||
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->DC_EVSEStatus.EVSEStandby = 1;
|
||||
result->DC_EVSEStatus.EVSEStatusCode = IsolationMonitoringActive_DC_EVSEStatusCodeType;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int preCharge(struct MessageHeaderType* header, struct PreChargeReqType* param, struct PreChargeResType* result)
|
||||
{
|
||||
struct FloatingValueType float_type;
|
||||
|
||||
|
||||
printf("EVSE: preCharge called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->DC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t PEVReady=%d\n", param->DC_PEVStatus.PEVReady);
|
||||
printf("\t\t\t PEVRESSSOC=%d\n", param->DC_PEVStatus.PEVRESSSOC);
|
||||
printf("\t\t\t PEVStatusCode=%d\n", param->DC_PEVStatus.PEVStatusCode);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->DC_PEVStatus.ConnectorLocked);
|
||||
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->DC_EVSEStatus.EVSEStandby = 1;
|
||||
result->DC_EVSEStatus.EVSEStatusCode = IsolationMonitoringActive_DC_EVSEStatusCodeType;
|
||||
|
||||
float_type.Multiplier = 0;
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 100;
|
||||
result->EVSEPresentVoltage = float_type;
|
||||
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int currentDemand(struct MessageHeaderType* header, struct CurrentDemandReqType* param, struct CurrentDemandResType* result)
|
||||
{
|
||||
|
||||
struct FloatingValueType f;
|
||||
|
||||
printf("EVSE: currentDemand called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->DC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t PEVReady=%d\n", param->DC_PEVStatus.PEVReady);
|
||||
printf("\t\t\t PEVRESSSOC=%d\n", param->DC_PEVStatus.PEVRESSSOC);
|
||||
printf("\t\t\t PEVStatusCode=%d\n", param->DC_PEVStatus.PEVStatusCode);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->DC_PEVStatus.ConnectorLocked);
|
||||
|
||||
printf("\t\t ChargeCurrentRequest=%d\n", param->ChargeCurrentRequest.Value);
|
||||
printf("\t\t PEVMaximumVoltageLimit=%d\n", param->PEVMaximumVoltageLimit.Value);
|
||||
printf("\t\t PEVMaximumPowerLimit=%d\n", param->PEVMaximumPowerLimit.Value);
|
||||
printf("\t\t PEVMaximumCurrentLimit=%d\n", param->PEVMaximumCurrentLimit.Value);
|
||||
printf("\t\t BulkChargingComplete=%d\n", param->BulkChargingComplete);
|
||||
printf("\t\t ChargingComplete=%d\n", param->ChargingComplete);
|
||||
printf("\t\t RemainingTimeToFullSoC=%d\n", param->RemainingTimeToFullSoC.Value);
|
||||
printf("\t\t RemainingTimeToBulkSoC=%d\n", param->RemainingTimeToBulkSoC.Value);
|
||||
|
||||
printf("\t\t PEVTargetVoltage=%d\n", param->PEVTargetVoltage.Value);
|
||||
printf("\t\t CurrentDifferential=%d\n", param->CurrentDifferential.Value);
|
||||
|
||||
printf("\t\t VoltageDifferential=%d\n", param->VoltageDifferential.Value);
|
||||
|
||||
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->DC_EVSEStatus.EVSEStandby = 1;
|
||||
result->DC_EVSEStatus.EVSEStatusCode = IsolationMonitoringActive_DC_EVSEStatusCodeType;
|
||||
|
||||
f.Multiplier = 0;
|
||||
f.Unit = V_unitSymbolType;
|
||||
f.Value = 100;
|
||||
|
||||
result->EVSEPresentVoltage=f;
|
||||
|
||||
f.Unit = A_unitSymbolType;
|
||||
f.Value = 200;
|
||||
|
||||
result->EVSEPresentCurrent=f;
|
||||
|
||||
result->EVSECurrentLimitAchieved=1;
|
||||
|
||||
result->EVSEVoltageLimitAchieved=0;
|
||||
|
||||
result->EVSEPowerLimitAchieved=1;
|
||||
|
||||
f.Unit = V_unitSymbolType;
|
||||
f.Value = 300;
|
||||
|
||||
result->EVSEMaximumVoltageLimit=f;
|
||||
result->isused.EVSEMaximumVoltageLimit=1;
|
||||
|
||||
f.Unit = A_unitSymbolType;
|
||||
f.Value = 400;
|
||||
|
||||
result->EVSEMaximumCurrentLimit=f;
|
||||
result->isused.EVSEMaximumCurrentLimit=1;
|
||||
|
||||
f.Unit = W_unitSymbolType;
|
||||
f.Value = 500;
|
||||
|
||||
result->EVSEMaximumPowerLimit=f;
|
||||
result->isused.EVSEMaximumPowerLimit=1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int weldingDetection(struct MessageHeaderType* header, struct WeldingDetectionReqType* param, struct WeldingDetectionResType* result)
|
||||
{
|
||||
|
||||
printf("EVSE: weldingDetection called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->DC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t PEVReady=%d\n", param->DC_PEVStatus.PEVReady);
|
||||
printf("\t\t\t PEVRESSSOC=%d\n", param->DC_PEVStatus.PEVRESSSOC);
|
||||
printf("\t\t\t PEVStatusCode=%d\n", param->DC_PEVStatus.PEVStatusCode);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->DC_PEVStatus.ConnectorLocked);
|
||||
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->DC_EVSEStatus.EVSEStandby = 1;
|
||||
result->DC_EVSEStatus.EVSEStatusCode = IsolationMonitoringActive_DC_EVSEStatusCodeType;
|
||||
result->EVSEPresentVoltage.Value = 123;
|
||||
result->EVSEPresentVoltage.Unit = V_unitSymbolType;
|
||||
result->EVSEPresentVoltage.Multiplier = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int terminateCharging(struct MessageHeaderType* header, struct TerminateChargingReqType* param, struct TerminateChargingResType* result)
|
||||
{
|
||||
|
||||
printf("EVSE: terminateCharging called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
printf("\t\t PEVStatus:\n\t\t\t PEVStandby=%d\n",param->DC_PEVStatus.PEVStandby);
|
||||
printf("\t\t\t PEVReady=%d\n", param->DC_PEVStatus.PEVReady);
|
||||
printf("\t\t\t PEVRESSSOC=%d\n", param->DC_PEVStatus.PEVRESSSOC);
|
||||
printf("\t\t\t PEVStatusCode=%d\n", param->DC_PEVStatus.PEVStatusCode);
|
||||
printf("\t\t\t ConnectorLocked=%d\n", param->DC_PEVStatus.ConnectorLocked);
|
||||
|
||||
|
||||
result->ResponseCode = OK_responseCodeType;
|
||||
result->EVSEPresentVoltage.Value = 123;
|
||||
result->EVSEPresentVoltage.Unit = V_unitSymbolType;
|
||||
result->EVSEPresentVoltage.Multiplier = 0;
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int serviceDetail(struct MessageHeaderType* header, struct ServiceDetailReqType* param, struct ServiceDetailResType* result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int contractAuthentication(struct MessageHeaderType* header, struct ContractAuthenticationReqType* param, struct ContractAuthenticationResType* result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int certificateUpdate(struct MessageHeaderType* header, struct CertificateUpdateReqType* param, struct CertificateUpdateResType* result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int certificateInstallation(struct MessageHeaderType* header, struct CertificateInstallationReqType* param, struct CertificateInstallationResType* result)
|
||||
{
|
||||
|
||||
printf("EVSE: certificateInstallation called\n" );
|
||||
printf("\tReceived data:\n");
|
||||
printf("\t\t\t OEMProvisioningCert=%d\n", param->OEMProvisioningCert.data[0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
43
src/test/main.c
Normal file
43
src/test/main.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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 Daniel.Peintner.EXT@siemens.com
|
||||
* @author Sebastian.Kaebisch.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Switch for sample programs: EXI codec only or for entire V2G service</p>
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
/* EXI codec only */
|
||||
/* return main_codec(argc, argv); */
|
||||
|
||||
|
||||
/* V2G client / service example scenario */
|
||||
return main_service(argc, argv);
|
||||
|
||||
}
|
||||
|
34
src/test/main.h
Normal file
34
src/test/main.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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 Daniel.Peintner.EXT@siemens.com
|
||||
* @author Sebastian.Kaebisch.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#ifndef MAIN_H_
|
||||
#define MAIN_H_
|
||||
|
||||
int main_codec(int argc, char *argv[]);
|
||||
int main_service(int argc, char *argv[]);
|
||||
|
||||
#endif
|
259
src/test/main_codec.old
Normal file
259
src/test/main_codec.old
Normal file
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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 Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Sample program to illustrate how to read an EXI stream and
|
||||
* directly write it again to an output</p>
|
||||
*
|
||||
* <p>e.g., data/test/sessionSetupReq.xml.exi out/test/sessionSetupReq.xml.exi</p>
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "EXIDecoder.h"
|
||||
#include "StringTable.h"
|
||||
#include "EXIEncoder.h"
|
||||
#include "EXITypes.h"
|
||||
#include "ByteStream.h"
|
||||
|
||||
#define BUFFER_SIZE 1000
|
||||
|
||||
#define ARRAY_SIZE_BYTES 100
|
||||
#define ARRAY_SIZE_STRINGS 100
|
||||
|
||||
/* avoids warning: initializer element is not computable at load time */
|
||||
uint8_t bufferIn[BUFFER_SIZE];
|
||||
uint8_t bufferOut[BUFFER_SIZE];
|
||||
uint8_t data[ARRAY_SIZE_BYTES];
|
||||
uint32_t codepoints[ARRAY_SIZE_STRINGS];
|
||||
|
||||
int main_codec(int argc, char *argv[]) {
|
||||
|
||||
int errn = 0;
|
||||
unsigned int i;
|
||||
|
||||
bitstream_t iStream, oStream;
|
||||
uint16_t posDecode;
|
||||
uint16_t posEncode;
|
||||
|
||||
/* EXI set-up */
|
||||
exi_state_t stateDecode;
|
||||
exi_state_t stateEncode;
|
||||
exi_event_t event;
|
||||
eqname_t eqn;
|
||||
exi_value_t val;
|
||||
|
||||
/* BINARY memory setup */
|
||||
bytes_t bytes = { ARRAY_SIZE_BYTES, data, 0 };
|
||||
|
||||
/* STRING memory setup */
|
||||
string_ucs_t string = { ARRAY_SIZE_STRINGS, codepoints, 0 };
|
||||
|
||||
const char * localName;
|
||||
const char * namespaceURI;
|
||||
|
||||
int noEndOfDocument = 1; /* true */
|
||||
|
||||
if (argc != 3) {
|
||||
printf("Usage: %s exiInput exiOutput\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* input pos */
|
||||
posDecode = 0;
|
||||
|
||||
/* parse EXI stream to internal byte structures */
|
||||
readBytesFromFile(argv[1], bufferIn, BUFFER_SIZE, posDecode);
|
||||
|
||||
/* setup input stream */
|
||||
iStream.size = BUFFER_SIZE;
|
||||
iStream.data = bufferIn;
|
||||
iStream.pos = &posDecode;
|
||||
iStream.buffer = 0;
|
||||
iStream.capacity = 0;
|
||||
|
||||
/* setup output stream */
|
||||
posEncode = 0;
|
||||
oStream.size = BUFFER_SIZE;
|
||||
oStream.data = bufferOut;
|
||||
oStream.pos = &posEncode;
|
||||
oStream.buffer = 0;
|
||||
oStream.capacity = 8;
|
||||
|
||||
val.binary = bytes;
|
||||
val.string = string;
|
||||
|
||||
/* init decoder (read header, set initial state) */
|
||||
exiInitDecoder(&iStream, &stateDecode);
|
||||
|
||||
/* init encoder (write header, set initial state) */
|
||||
exiInitEncoder(&oStream, &stateEncode);
|
||||
|
||||
printf("[DECODE] >>> EXI >>> [ENCODE] \n");
|
||||
|
||||
do {
|
||||
if (errn < 0) {
|
||||
printf("[Encode-ERROR] %d \n", errn);
|
||||
return errn;
|
||||
}
|
||||
|
||||
errn = exiDecodeNextEvent(&iStream, &stateDecode, &event);
|
||||
if (errn < 0) {
|
||||
printf("[Decode-ERROR] %d \n", errn);
|
||||
return errn;
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
case START_DOCUMENT:
|
||||
/* decode */
|
||||
errn = exiDecodeStartDocument(&iStream, &stateDecode);
|
||||
if (errn < 0) {
|
||||
printf("[Decode-ERROR] %d \n", errn);
|
||||
return errn;
|
||||
}
|
||||
printf(">> START_DOCUMENT \n");
|
||||
/* encode */
|
||||
errn = exiEncodeStartDocument(&oStream, &stateEncode);
|
||||
break;
|
||||
case END_DOCUMENT:
|
||||
/* decode */
|
||||
errn = exiDecodeEndDocument(&iStream, &stateDecode);
|
||||
if (errn < 0) {
|
||||
printf("[Decode-ERROR] %d \n", errn);
|
||||
return errn;
|
||||
}
|
||||
printf(">> END_DOCUMENT \n");
|
||||
/* encode */
|
||||
errn = exiEncodeEndDocument(&oStream, &stateEncode);
|
||||
/* signalize end of document */
|
||||
noEndOfDocument = 0; /* false */
|
||||
break;
|
||||
case START_ELEMENT:
|
||||
/* decode */
|
||||
errn = exiDecodeStartElement(&iStream, &stateDecode, &eqn);
|
||||
if (errn < 0) {
|
||||
printf("[Decode-ERROR] %d \n", errn);
|
||||
return errn;
|
||||
}
|
||||
|
||||
/* EVSEStatus
|
||||
* if(eqn.localPart=1 && eqn.namespaceURI=3) {
|
||||
|
||||
send CAN message...
|
||||
|
||||
/* ResponseCode
|
||||
} else if(eqn.localPart=2 && eqn.namespaceURI=3) {
|
||||
|
||||
send CAN message...
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
} */
|
||||
|
||||
exiGetLocalName(eqn.namespaceURI, eqn.localPart, &localName);
|
||||
exiGetUri(eqn.namespaceURI, &namespaceURI);
|
||||
printf(">> SE {%s}%s \n", namespaceURI, localName);
|
||||
/*fflush(stdout); */
|
||||
|
||||
|
||||
/* encode */
|
||||
errn = exiEncodeStartElement(&oStream, &stateEncode, &eqn);
|
||||
break;
|
||||
|
||||
case START_ELEMENT_GENERIC:
|
||||
/* unknown element */
|
||||
|
||||
/* read the element content as usual (element name, value, type, etc.) */
|
||||
|
||||
break;
|
||||
|
||||
case END_ELEMENT:
|
||||
/* decode */
|
||||
errn = exiDecodeEndElement(&iStream, &stateDecode, &eqn);
|
||||
if (errn < 0) {
|
||||
printf("[Decode-ERROR] %d \n", errn);
|
||||
return errn;
|
||||
}
|
||||
exiGetLocalName(eqn.namespaceURI, eqn.localPart, &localName);
|
||||
exiGetUri(eqn.namespaceURI, &namespaceURI);
|
||||
printf("<< EE {%s}%s \n", namespaceURI, localName);
|
||||
/* encode */
|
||||
errn = exiEncodeEndElement(&oStream, &stateEncode, &eqn);
|
||||
break;
|
||||
|
||||
case CHARACTERS:
|
||||
/* decode */
|
||||
errn = exiDecodeCharacters(&iStream, &stateDecode, &val);
|
||||
if (errn < 0) {
|
||||
printf("[Decode-ERROR] %d \n", errn);
|
||||
return errn;
|
||||
}
|
||||
if (val.type == INTEGER_BIG) {
|
||||
printf(" CH int64 : %ld \n", (long int)val.int64);
|
||||
} else if (val.type == BINARY_BASE64 || val.type == BINARY_HEX) {
|
||||
printf(" CH Binary (len == %d) : ", val.binary.len);
|
||||
for(i=0; i<val.binary.len; i++) {
|
||||
printf(" [%d]", val.binary.data[i]);
|
||||
}
|
||||
printf("\n");
|
||||
} else if (val.type == BOOLEAN) {
|
||||
printf(" CH Boolean : %d \n", val.boolean);
|
||||
} else if (val.type == STRING) {
|
||||
printf(" CH String (len==%d) : '", val.string.len);
|
||||
for(i=0;i<val.string.len; i++) {
|
||||
printf("%c", (char)val.string.codepoints[i]);
|
||||
}
|
||||
printf("'\n");
|
||||
} else {
|
||||
printf(" CH ?? \n");
|
||||
}
|
||||
/* encode */
|
||||
errn = exiEncodeCharacters(&oStream, &stateEncode, &val);
|
||||
break;
|
||||
case ATTRIBUTE:
|
||||
/* decode */
|
||||
errn = exiDecodeAttribute(&iStream, &stateDecode, &eqn, &val);
|
||||
if (errn < 0) {
|
||||
printf("[Decode-ERROR] %d \n", errn);
|
||||
return errn;
|
||||
}
|
||||
exiGetLocalName(eqn.namespaceURI, eqn.localPart, &localName);
|
||||
exiGetUri(eqn.namespaceURI, &namespaceURI);
|
||||
printf(" AT {%s}%s \n", namespaceURI, localName);
|
||||
/* encode */
|
||||
errn = exiEncodeAttribute(&oStream, &stateEncode, &eqn, &val);
|
||||
break;
|
||||
default:
|
||||
/* ERROR */
|
||||
return -1;
|
||||
}
|
||||
|
||||
} while (noEndOfDocument);
|
||||
|
||||
/* write to file */
|
||||
writeBytesToFile(oStream.data, posEncode, argv[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
951
src/test/pev_service.c
Normal file
951
src/test/pev_service.c
Normal file
|
@ -0,0 +1,951 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "v2g_service.h"
|
||||
#include "v2g_serviceDataTypes.h"
|
||||
#include "v2g_serviceClientStubs.h"
|
||||
#include "EXITypes.h"
|
||||
#include "v2gtp.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_BYTE_SIZE 128
|
||||
#define MAX_STRING_SIZE 256
|
||||
#define MAX_STREAM_SIZE 100
|
||||
|
||||
|
||||
static void printErrorMessage(struct EXIService* service);
|
||||
static void printDCEVSEStatus(struct DC_EVSEStatusType* status);
|
||||
static void printACEVSEStatus(struct AC_EVSEStatusType* status);
|
||||
static void printASCIIString(uint32_t* string, uint32_t len);
|
||||
|
||||
|
||||
static int ac_charging()
|
||||
{
|
||||
|
||||
|
||||
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 */
|
||||
|
||||
/* define offset variable for transport header data */
|
||||
uint16_t transportHeaderOffset;
|
||||
|
||||
|
||||
/* service data structure for AC*/
|
||||
struct EXIService service;
|
||||
struct MessageHeaderType v2gHeader;
|
||||
struct SessionSetupReqType sessionSetup;
|
||||
struct SessionSetupResType resultSessionSetup;
|
||||
struct ServiceDiscoveryReqType serviceDiscovery;
|
||||
struct ServiceDiscoveryResType resultServiceDiscovery;
|
||||
struct ChargeParameterDiscoveryReqType powerDiscovery;
|
||||
struct ChargeParameterDiscoveryResType resultPowerDiscovery;
|
||||
struct LineLockReqType lineLock;
|
||||
struct LineLockResType resultLineLock;
|
||||
struct PowerDeliveryReqType powerDelivery;
|
||||
struct PowerDeliveryResType resultPowerDelivery;
|
||||
struct MeteringStatusReqType meteringStatus;
|
||||
struct MeteringStatusResType resultMeteringStatus;
|
||||
struct MeteringReceiptReqType meteringReceipt;
|
||||
struct MeteringReceiptResType resultMeteringReceipt;
|
||||
|
||||
|
||||
struct AC_PEVStatusType pevStatus;
|
||||
struct AC_EVSEStatusType evseStatus;
|
||||
struct AC_PEVChargeParameterType pevChargeParameter;
|
||||
struct AC_EVSEChargeParameterType evseChargeParameter;
|
||||
struct AC_PEVPowerDeliveryParameterType pevPowerDelivery;
|
||||
|
||||
|
||||
struct FloatingValueType float_type; /* test float type*/
|
||||
|
||||
/* BINARY memory setup */
|
||||
bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 };
|
||||
|
||||
/* STRING memory setup */
|
||||
string_ucs_t string = { MAX_STRING_SIZE, string_array, 0 };
|
||||
|
||||
/* setup offset for DoIP header (otherwise set
|
||||
* transportHeaderOffset=0 if no transfer protocol is used)*/
|
||||
transportHeaderOffset = V2GTP_HEADER_LENGTH;
|
||||
|
||||
|
||||
/*******************
|
||||
* Init V2G Client *
|
||||
*******************/
|
||||
|
||||
init_v2gServiceClient(&service,bytes,string,inStream,MAX_STREAM_SIZE, outStream, MAX_STREAM_SIZE, transportHeaderOffset);
|
||||
|
||||
|
||||
/*******************************
|
||||
* Setup data for sessionSetup *
|
||||
*******************************/
|
||||
|
||||
/* setup header information */
|
||||
v2gHeader.SessionInformation.SessionID.data[0] = 0; /* sessionID is always '0' at the beginning (the response contains the valid sessionID)*/
|
||||
v2gHeader.SessionInformation.SessionID.arraylen.data = 1; /* no session id in the initial message -> array length = 0*/
|
||||
v2gHeader.SessionInformation.ProtocolVersion.data[0]='1'; /* assign protocol version number*/
|
||||
v2gHeader.SessionInformation.ProtocolVersion.arraylen.data=1; /* array string length =1 of protocol version */
|
||||
v2gHeader.SessionInformation.isused.ProtocolVersion = 1; /* important: optional elements have to be set used (=1) or not used (=0) */
|
||||
v2gHeader.SessionInformation.isused.ServiceSessionID = 0; /* service session is not used */
|
||||
v2gHeader.isused.Notification=0; /* no notification */
|
||||
v2gHeader.isused.Security=0; /* no security */
|
||||
|
||||
/* setup sessionSetup parameter */
|
||||
sessionSetup.isused.PEVID=1; /* PEVID is transported */
|
||||
sessionSetup.PEVID.arraylen.data=1;
|
||||
sessionSetup.PEVID.data[0]=10;
|
||||
|
||||
|
||||
printf("PEV: call EVSE sessionSetup\n");
|
||||
|
||||
/*********************
|
||||
* Call sessionSetup *
|
||||
*********************/
|
||||
if(call_sessionSetup(&service,&v2gHeader, &sessionSetup,&resultSessionSetup))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* show result of the answer message of EVSE sessionSetup */
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tHeader SessionID=%d\n",v2gHeader.SessionInformation.SessionID.data[0]);
|
||||
printf("\tResponseCode=%d\n",resultSessionSetup.ResponseCode);
|
||||
printf("\tEVSEID=%d\n", resultSessionSetup.EVSEID.data[0]);
|
||||
printf("\tTCurrent=%d\n",resultSessionSetup.TCurrent);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************
|
||||
* Setup data for serviceDiscovery *
|
||||
*******************************************/
|
||||
|
||||
serviceDiscovery.isused.ServiceType=1;
|
||||
serviceDiscovery.ServiceType = PEVRechargeCharge_serviceCategoryType;
|
||||
serviceDiscovery.isused.ServiceScope=0;
|
||||
|
||||
|
||||
printf("PEV: call EVSE serviceDiscovery\n");
|
||||
|
||||
/*************************
|
||||
* Call serviceDiscovery *
|
||||
*************************/
|
||||
if(call_serviceDiscovery(&service,&v2gHeader, &serviceDiscovery,&resultServiceDiscovery))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* show result of the answer message of EVSE sessionSetup */
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\t Header SessionID=%d\n",v2gHeader.SessionInformation.SessionID.data[0]);
|
||||
printf("\t ResponseCode=%d\n",resultServiceDiscovery.ResponseCode);
|
||||
printf("\t ServiceID=%d\n", resultServiceDiscovery.ChargeService.ServiceTag.ServiceID.data[0]);
|
||||
printf("\t PaymentOption=%d\n", resultServiceDiscovery.PaymentOptions.PaymentOption[0]);
|
||||
printf("\t EnergyTransferType=%d\n", resultServiceDiscovery.ChargeService.EnergyTransferType);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************
|
||||
* Setup data for chargeParameterDiscovery *
|
||||
*******************************************/
|
||||
|
||||
powerDiscovery.PEVRequestedEnergyTransferType = AC_three_phase_core_PEVRequestedEnergyTransferType;
|
||||
|
||||
/* setup PEVStatus */
|
||||
pevStatus.ConnectorLocked = 1;
|
||||
pevStatus.PEVStandby = 1;
|
||||
|
||||
pevChargeParameter.AC_PEVStatus = pevStatus;
|
||||
|
||||
|
||||
float_type.Multiplier = 0;
|
||||
float_type.Unit = W_unitSymbolType;
|
||||
float_type.Value = 100;
|
||||
|
||||
pevChargeParameter.EAmount = float_type;
|
||||
|
||||
pevChargeParameter.EoC = 89;
|
||||
|
||||
float_type.Unit = A_unitSymbolType;
|
||||
float_type.Value = 200;
|
||||
|
||||
pevChargeParameter.PEVMaxCurrent= float_type;
|
||||
|
||||
pevChargeParameter.PEVMaxPhases= 3;
|
||||
|
||||
float_type.Unit = W_unitSymbolType;
|
||||
float_type.Value = 300;
|
||||
|
||||
pevChargeParameter.PEVMaxPower= float_type;
|
||||
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 400;
|
||||
|
||||
pevChargeParameter.PEVMaxVoltage=float_type;
|
||||
|
||||
float_type.Unit = A_unitSymbolType;
|
||||
float_type.Value = 500;
|
||||
|
||||
pevChargeParameter.PEVMinCurrent=float_type;
|
||||
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 600;
|
||||
|
||||
pevChargeParameter.PEVMinVoltage = float_type;
|
||||
|
||||
powerDiscovery.AC_PEVChargeParameter = &pevChargeParameter;
|
||||
powerDiscovery.isused.AC_PEVChargeParameter = 1; /* we use here DC based charging parameters */
|
||||
powerDiscovery.isused.DC_PEVChargeParameter = 0;
|
||||
|
||||
|
||||
resultPowerDiscovery.AC_EVSEChargeParameter = &evseChargeParameter; /* we expect DC-based parameters from the evse*/
|
||||
|
||||
/*********************************
|
||||
* Call chargeParameterDiscovery *
|
||||
*********************************/
|
||||
printf("\nPEV: call EVSE chargeParameterDiscovery\n");
|
||||
|
||||
if(call_chargeParameterDiscovery(&service,&v2gHeader,&powerDiscovery,&resultPowerDiscovery))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE sessionSetup*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\t\t Header SessionID=%d\n",v2gHeader.SessionInformation.SessionID.data[0]);
|
||||
printf("\tResponseCode=%d\n",resultPowerDiscovery.ResponseCode);
|
||||
printACEVSEStatus(&(resultPowerDiscovery.AC_EVSEChargeParameter->AC_EVSEStatus));
|
||||
|
||||
printf("\t EVSEMaxCurrent=%d\n",resultPowerDiscovery.AC_EVSEChargeParameter->EVSEMaxCurrent.Value);
|
||||
printf("\t EVSEMaxPhases=%d\n",resultPowerDiscovery.AC_EVSEChargeParameter->EVSEMaxPhases);
|
||||
printf("\t EVSEMaxVoltage=%d\n",resultPowerDiscovery.AC_EVSEChargeParameter->EVSEMaxVoltage.Value);
|
||||
printf("\t EVSEMinimumCurrentLimit=%d\n",resultPowerDiscovery.AC_EVSEChargeParameter->EVSEMinCurrent.Value);
|
||||
|
||||
printf("\t EVSEMinVoltage=%d\n",resultPowerDiscovery.AC_EVSEChargeParameter->EVSEMinVoltage.Value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************
|
||||
* Setup data for lineLock *
|
||||
*********************************/
|
||||
|
||||
lineLock.AC_PEVStatus = pevStatus;
|
||||
lineLock.ReqLockStatus = 1;
|
||||
|
||||
/***********************
|
||||
* Call lineLock *
|
||||
***********************/
|
||||
printf("\nPEV: call EVSE lineLock\n");
|
||||
|
||||
if(call_lineLock(&service,&v2gHeader,&lineLock,&resultLineLock))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE sessionSetup*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultLineLock.ResponseCode);
|
||||
printACEVSEStatus(&resultLineLock.AC_EVSEStatus);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************
|
||||
* Setup data for powerDelivery *
|
||||
*********************************/
|
||||
|
||||
powerDelivery.ReqSwitchStatus = 1;
|
||||
powerDelivery.isused.Tariff = 0;
|
||||
powerDelivery.isused.ChargingProfile= 0;
|
||||
|
||||
powerDelivery.isused.DC_PEVPowerDeliveryParameter=0;
|
||||
powerDelivery.isused.AC_PEVPowerDeliveryParameter=1;
|
||||
pevPowerDelivery.AC_PEVStatus = pevStatus;
|
||||
|
||||
|
||||
powerDelivery.AC_PEVPowerDeliveryParameter = &pevPowerDelivery;
|
||||
|
||||
resultPowerDelivery.AC_EVSEStatus = &evseStatus; /* we expect the AC-based EVSE status */
|
||||
|
||||
/***********************
|
||||
* Call powerDelivery *
|
||||
***********************/
|
||||
printf("\nPEV: call EVSE powerDelivery\n");
|
||||
|
||||
if(call_powerDelivery(&service,&v2gHeader,&powerDelivery,&resultPowerDelivery))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE sessionSetup*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultPowerDelivery.ResponseCode);
|
||||
printACEVSEStatus(&evseStatus);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/********************
|
||||
* Call meterStatus *
|
||||
********************/
|
||||
|
||||
meteringStatus.AC_PEVStatus = &pevStatus;
|
||||
meteringStatus.isused.AC_PEVStatus=1;
|
||||
meteringStatus.isused.DC_PEVStatus=0;
|
||||
|
||||
resultMeteringStatus.AC_EVSEStatus = &evseStatus;
|
||||
|
||||
printf("\nPEV: call EVSE meterStatus\n");
|
||||
|
||||
if(call_meteringStatus(&service,&v2gHeader,&meteringStatus,&resultMeteringStatus))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultPowerDiscovery.ResponseCode);
|
||||
printACEVSEStatus(resultMeteringStatus.AC_EVSEStatus);
|
||||
printf("\tEVSEID=%d\n",resultMeteringStatus.EVSEID.data[0]);
|
||||
printf("\tEVSEMaxPower=%d\n",resultMeteringStatus.EVSEMaxPower.Value);
|
||||
printf("\tisused.MeterInfo=%d\n", resultMeteringStatus.isused.MeterInfo);
|
||||
printf("\t\tMeterInfo.MeterID=%d\n", resultMeteringStatus.MeterInfo.MeterID.data[0]);
|
||||
printf("\t\tMeterInfo.MeterReading.Value=%d\n", resultMeteringStatus.MeterInfo.MeterReading.Value);
|
||||
printf("\t\tMeterInfo.MeterStatus=%d\n", resultMeteringStatus.MeterInfo.MeterStatus);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************
|
||||
* Setup data for meteringReceipt *
|
||||
*********************************/
|
||||
|
||||
meteringReceipt.PEVID.arraylen.data=1;
|
||||
meteringReceipt.PEVID.data[0]=10;
|
||||
meteringReceipt.isused.PEVID=1;
|
||||
|
||||
meteringReceipt.AC_PEVStatus = &pevStatus;
|
||||
meteringReceipt.isused.AC_PEVStatus =1;
|
||||
meteringReceipt.isused.DC_PEVStatus =0;
|
||||
meteringReceipt.TCurrent = 12345;
|
||||
meteringReceipt.isused.TCurrent = 1;
|
||||
meteringReceipt.Tariff = 12;
|
||||
meteringReceipt.MeterInfo.MeterStatus = 2;
|
||||
meteringReceipt.MeterInfo.isused.MeterStatus = 1;
|
||||
|
||||
|
||||
meteringReceipt.MeterInfo.MeterID.arraylen.data=1;
|
||||
meteringReceipt.MeterInfo.MeterID.data[0]=3;
|
||||
meteringReceipt.MeterInfo.isused.MeterID = 1;
|
||||
|
||||
meteringReceipt.MeterInfo.MeterReading.Multiplier = 0;
|
||||
meteringReceipt.MeterInfo.MeterReading.Unit = A_unitSymbolType;
|
||||
meteringReceipt.MeterInfo.MeterReading.Value = 500;
|
||||
meteringReceipt.MeterInfo.isused.MeterReading = 1;
|
||||
|
||||
meteringReceipt.MeterInfo.TMeter =123456789;
|
||||
meteringReceipt.MeterInfo.isused.TMeter = 1;
|
||||
|
||||
|
||||
resultMeteringReceipt.AC_EVSEStatus = &evseStatus;
|
||||
|
||||
/***********************
|
||||
* Call meteringReceipt *
|
||||
***********************/
|
||||
printf("\nPEV: call EVSE meteringReceipt\n");
|
||||
|
||||
|
||||
|
||||
if(call_meteringReceipt(&service,&v2gHeader,&meteringReceipt,&resultMeteringReceipt))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* show result of the answer message of EVSE sessionSetup*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultMeteringReceipt.ResponseCode);
|
||||
printACEVSEStatus(resultMeteringReceipt.AC_EVSEStatus);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dc_charging()
|
||||
{
|
||||
|
||||
|
||||
|
||||
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 */
|
||||
|
||||
|
||||
|
||||
/* define offset variable for transport header data */
|
||||
uint16_t transportHeaderOffset;
|
||||
|
||||
|
||||
/* service data structure for DC*/
|
||||
struct EXIService service;
|
||||
struct MessageHeaderType v2gHeader;
|
||||
struct SessionSetupReqType sessionSetup;
|
||||
struct SessionSetupResType resultSessionSetup;
|
||||
struct ServiceDiscoveryReqType serviceDiscovery;
|
||||
struct ServiceDiscoveryResType resultServiceDiscovery;
|
||||
struct ChargeParameterDiscoveryReqType powerDiscovery;
|
||||
struct ChargeParameterDiscoveryResType resultPowerDiscovery;
|
||||
struct CableCheckReqType cableCheck;
|
||||
struct CableCheckResType resultCableCheck;
|
||||
struct PowerDeliveryReqType powerDelivery;
|
||||
struct PowerDeliveryResType resultPowerDelivery;
|
||||
struct PreChargeReqType preCharge;
|
||||
struct PreChargeResType resultPreCharge;
|
||||
struct CurrentDemandReqType currentDemand;
|
||||
struct CurrentDemandResType resultCurrentDemand;
|
||||
struct WeldingDetectionReqType weldingDetection;
|
||||
struct WeldingDetectionResType resultWeldingDetection;
|
||||
struct TerminateChargingReqType terminateCharging;
|
||||
struct TerminateChargingResType resultTerminateCharging;
|
||||
|
||||
struct DC_PEVStatusType pevStatus;
|
||||
struct DC_EVSEStatusType evseStatus;
|
||||
struct DC_PEVChargeParameterType pevChargeParameter;
|
||||
struct DC_EVSEChargeParameterType evseChargeParameter;
|
||||
struct DC_PEVPowerDeliveryParameterType pevPowerDelivery;
|
||||
|
||||
|
||||
struct FloatingValueType float_type; /* test float type*/
|
||||
|
||||
/* BINARY memory setup */
|
||||
bytes_t bytes = { MAX_BYTE_SIZE, byte_array, 0 };
|
||||
|
||||
/* STRING memory setup */
|
||||
string_ucs_t string = { MAX_STRING_SIZE, string_array, 0 };
|
||||
|
||||
/* setup offset for DoIP header (otherwise set
|
||||
* transportHeaderOffset=0 if no transfer protocol is used)*/
|
||||
transportHeaderOffset = V2GTP_HEADER_LENGTH;
|
||||
|
||||
|
||||
/*******************
|
||||
* Init V2G Client *
|
||||
*******************/
|
||||
|
||||
init_v2gServiceClient(&service,bytes,string,inStream,MAX_STREAM_SIZE, outStream, MAX_STREAM_SIZE, transportHeaderOffset);
|
||||
|
||||
|
||||
/*******************************
|
||||
* Setup data for sessionSetup *
|
||||
*******************************/
|
||||
|
||||
/* setup header information */
|
||||
v2gHeader.SessionInformation.SessionID.data[0] = 0; /* sessionID is always '0' at the beginning (the response contains the valid sessionID)*/
|
||||
v2gHeader.SessionInformation.SessionID.arraylen.data = 1; /* no session id in the initial message -> array length = 0*/
|
||||
v2gHeader.SessionInformation.ProtocolVersion.data[0]='1'; /* assign protocol version number*/
|
||||
v2gHeader.SessionInformation.ProtocolVersion.arraylen.data=1; /* array string length =1 of protocol version */
|
||||
v2gHeader.SessionInformation.isused.ProtocolVersion = 1; /* important: optional elements have to be set used (=1) or not used (=0) */
|
||||
v2gHeader.SessionInformation.isused.ServiceSessionID = 0; /* service session is not used */
|
||||
v2gHeader.isused.Notification=0; /* no notification */
|
||||
v2gHeader.isused.Security=0; /* no security */
|
||||
|
||||
/* setup sessionSetup parameter */
|
||||
sessionSetup.isused.PEVID=1; /* PEVID is transported */
|
||||
sessionSetup.PEVID.arraylen.data=1;
|
||||
sessionSetup.PEVID.data[0]=10;
|
||||
|
||||
|
||||
printf("PEV: call EVSE sessionSetup\n");
|
||||
|
||||
/*********************
|
||||
* Call sessionSetup *
|
||||
*********************/
|
||||
if(call_sessionSetup(&service,&v2gHeader, &sessionSetup,&resultSessionSetup))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* show result of the answer message of EVSE sessionSetup */
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tHeader SessionID=%d\n",v2gHeader.SessionInformation.SessionID.data[0]);
|
||||
printf("\tResponseCode=%d\n",resultSessionSetup.ResponseCode);
|
||||
printf("\tEVSEID=%d\n", resultSessionSetup.EVSEID.data[0]);
|
||||
printf("\tTCurrent=%d\n",resultSessionSetup.TCurrent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************
|
||||
* Setup data for serviceDiscovery *
|
||||
*******************************************/
|
||||
|
||||
serviceDiscovery.isused.ServiceType=1;
|
||||
serviceDiscovery.ServiceType = PEVRechargeCharge_serviceCategoryType;
|
||||
serviceDiscovery.isused.ServiceScope=0;
|
||||
|
||||
|
||||
printf("PEV: call EVSE serviceDiscovery\n");
|
||||
|
||||
/*************************
|
||||
* Call serviceDiscovery *
|
||||
*************************/
|
||||
if(call_serviceDiscovery(&service,&v2gHeader, &serviceDiscovery,&resultServiceDiscovery))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* show result of the answer message of EVSE sessionSetup */
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\t Header SessionID=%d\n",v2gHeader.SessionInformation.SessionID.data[0]);
|
||||
printf("\t ResponseCode=%d\n",resultServiceDiscovery.ResponseCode);
|
||||
printf("\t ServiceID=%d\n", resultServiceDiscovery.ChargeService.ServiceTag.ServiceID.data[0]);
|
||||
printf("\t PaymentOption=%d\n", resultServiceDiscovery.PaymentOptions.PaymentOption[0]);
|
||||
printf("\t EnergyTransferType=%d\n", resultServiceDiscovery.ChargeService.EnergyTransferType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************
|
||||
* Setup data for chargeParameterDiscovery *
|
||||
*******************************************/
|
||||
|
||||
powerDiscovery.PEVRequestedEnergyTransferType = DC_core_PEVRequestedEnergyTransferType;
|
||||
|
||||
/* setup PEVStatus */
|
||||
pevStatus.ConnectorLocked = 1;
|
||||
pevStatus.PEVRESSSOC = 89;
|
||||
pevStatus.PEVReady = 1;
|
||||
pevStatus.PEVStandby = 1;
|
||||
pevStatus.PEVStatusCode = PEVCabinConditioning_DC_PEVStatusCodeType;
|
||||
|
||||
pevChargeParameter.DC_PEVStatus = pevStatus;
|
||||
|
||||
|
||||
float_type.Multiplier = 0;
|
||||
float_type.Unit = A_unitSymbolType;
|
||||
float_type.Value = 100;
|
||||
|
||||
pevChargeParameter.PEVMaximumCurrentLimit = float_type;
|
||||
|
||||
float_type.Unit = W_unitSymbolType;
|
||||
float_type.Value = 200;
|
||||
|
||||
pevChargeParameter.PEVMaximumPowerLimit = float_type;
|
||||
pevChargeParameter.isused.PEVMaximumPowerLimit = 1;
|
||||
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 300;
|
||||
|
||||
pevChargeParameter.PEVMaximumVoltageLimit= float_type;
|
||||
|
||||
float_type.Unit = W_s_unitSymbolType;
|
||||
float_type.Value = 400;
|
||||
|
||||
pevChargeParameter.PEVEnergyCapacity= float_type;
|
||||
pevChargeParameter.isused.PEVEnergyCapacity = 1;
|
||||
|
||||
float_type.Unit = W_s_unitSymbolType;
|
||||
float_type.Value = 500;
|
||||
|
||||
pevChargeParameter.PEVEnergyRequest= float_type;
|
||||
pevChargeParameter.isused.PEVEnergyRequest = 1;
|
||||
|
||||
pevChargeParameter.FullSOC=0;
|
||||
pevChargeParameter.isused.FullSOC = 1;
|
||||
|
||||
pevChargeParameter.BulkSOC=100;
|
||||
pevChargeParameter.isused.BulkSOC = 1;
|
||||
|
||||
pevChargeParameter.PEVProtocolVersion = 12;
|
||||
|
||||
powerDiscovery.DC_PEVChargeParameter = &pevChargeParameter;
|
||||
powerDiscovery.isused.DC_PEVChargeParameter = 1; /* we use here DC based charging parameters */
|
||||
powerDiscovery.isused.AC_PEVChargeParameter = 0;
|
||||
|
||||
resultPowerDiscovery.DC_EVSEChargeParameter = &evseChargeParameter; /* we expect DC-based parameters from the evse*/
|
||||
|
||||
/*********************************
|
||||
* Call chargeParameterDiscovery *
|
||||
*********************************/
|
||||
printf("\nPEV: call EVSE chargeParameterDiscovery\n");
|
||||
|
||||
if(call_chargeParameterDiscovery(&service,&v2gHeader,&powerDiscovery,&resultPowerDiscovery))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE sessionSetup*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\t\t Header SessionID=%d\n",v2gHeader.SessionInformation.SessionID.data[0]);
|
||||
printf("\tResponseCode=%d\n",resultPowerDiscovery.ResponseCode);
|
||||
printDCEVSEStatus(&(resultPowerDiscovery.DC_EVSEChargeParameter->DC_EVSEStatus));
|
||||
printf("\tEVSEMaximumCurrentLimit=%d\n",resultPowerDiscovery.DC_EVSEChargeParameter->EVSEMaximumCurrentLimit.Value);
|
||||
printf("\tEVSEMaximumPowerLimit=%d\n",resultPowerDiscovery.DC_EVSEChargeParameter->EVSEMaximumPowerLimit.Value);
|
||||
printf("\tEVSEMaximumVoltageLimit=%d\n",resultPowerDiscovery.DC_EVSEChargeParameter->EVSEMaximumVoltageLimit.Value);
|
||||
printf("\tEVSEMinimumCurrentLimit=%d\n",resultPowerDiscovery.DC_EVSEChargeParameter->EVSEMinimumCurrentLimit.Value);
|
||||
|
||||
printf("\tEVSEMinimumVoltageLimit=%d\n",resultPowerDiscovery.DC_EVSEChargeParameter->EVSEMinimumVoltageLimit.Value);
|
||||
printf("\tEVSECurrentRegulationTolerance=%d\n",resultPowerDiscovery.DC_EVSEChargeParameter->EVSECurrentRegulationTolerance.Value);
|
||||
printf("\tEVSEPeakCurrentRipple=%d\n",resultPowerDiscovery.DC_EVSEChargeParameter->EVSEPeakCurrentRipple.Value);
|
||||
printf("\tEVSEEnergyToBeDelivered=%d\n",resultPowerDiscovery.DC_EVSEChargeParameter->EVSEEnergyToBeDelivered.Value);
|
||||
printf("\tEVSEProtocolVersion=%d\n",resultPowerDiscovery.DC_EVSEChargeParameter->EVSEProtocolVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************
|
||||
* Call cableCheck *
|
||||
***********************/
|
||||
printf("\nPEV: call EVSE cableCheck\n");
|
||||
|
||||
cableCheck.DC_PEVStatus =pevStatus;
|
||||
|
||||
|
||||
|
||||
if(call_cableCheck(&service,&v2gHeader,&cableCheck,&resultCableCheck))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE powerDiscovery*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultCableCheck.ResponseCode);
|
||||
printDCEVSEStatus(&(resultCableCheck.DC_EVSEStatus));
|
||||
}
|
||||
|
||||
|
||||
/***********************
|
||||
* Call preCharge *
|
||||
***********************/
|
||||
printf("\nPEV: call EVSE preCharge\n");
|
||||
|
||||
preCharge.DC_PEVStatus =pevStatus;
|
||||
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 100;
|
||||
preCharge.PEVRESSVoltage = float_type;
|
||||
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 200;
|
||||
preCharge.PEVTargetVoltage = float_type;
|
||||
|
||||
float_type.Unit = A_unitSymbolType;
|
||||
float_type.Value = 300;
|
||||
preCharge.PEVTargetVoltage = float_type;
|
||||
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 400;
|
||||
preCharge.PEVTargetVoltage = float_type;
|
||||
|
||||
|
||||
|
||||
if(call_preCharge(&service,&v2gHeader,&preCharge,&resultPreCharge))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE powerDiscovery*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultPreCharge.ResponseCode);
|
||||
printDCEVSEStatus(&resultPreCharge.DC_EVSEStatus);
|
||||
printf("\tVoltageOutput=%d\n",resultPreCharge.EVSEPresentVoltage.Value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************
|
||||
* Setup data for powerDelivery *
|
||||
*********************************/
|
||||
|
||||
powerDelivery.ReqSwitchStatus = 1;
|
||||
powerDelivery.isused.Tariff = 0;
|
||||
powerDelivery.isused.ChargingProfile= 0;
|
||||
|
||||
powerDelivery.isused.DC_PEVPowerDeliveryParameter=1;
|
||||
powerDelivery.isused.AC_PEVPowerDeliveryParameter=0;
|
||||
pevPowerDelivery.DC_PEVStatus = pevStatus;
|
||||
pevPowerDelivery.BulkChargingComplete = 1;
|
||||
pevPowerDelivery.isused.BulkChargingComplete = 1;
|
||||
pevPowerDelivery.ChargingComplete = 0;
|
||||
|
||||
powerDelivery.DC_PEVPowerDeliveryParameter = &pevPowerDelivery;
|
||||
|
||||
resultPowerDelivery.DC_EVSEStatus = &evseStatus; /* we expect the DC-based EVSE status */
|
||||
|
||||
/***********************
|
||||
* Call powerDelivery *
|
||||
***********************/
|
||||
printf("\nPEV: call EVSE powerDelivery\n");
|
||||
|
||||
if(call_powerDelivery(&service,&v2gHeader,&powerDelivery,&resultPowerDelivery))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE sessionSetup*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultPowerDelivery.ResponseCode);
|
||||
printDCEVSEStatus(resultPowerDelivery.DC_EVSEStatus);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************
|
||||
* Call currentDemand *
|
||||
***********************/
|
||||
printf("\nPEV: call EVSE currentDemand\n");
|
||||
|
||||
currentDemand.DC_PEVStatus = pevStatus;
|
||||
|
||||
float_type.Unit = A_unitSymbolType;
|
||||
float_type.Value = 100;
|
||||
|
||||
currentDemand.ChargeCurrentRequest = float_type;
|
||||
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 200;
|
||||
|
||||
currentDemand.PEVMaximumVoltageLimit = float_type;
|
||||
currentDemand.isused.PEVMaximumVoltageLimit = 1;
|
||||
|
||||
float_type.Unit = W_unitSymbolType;
|
||||
float_type.Value = 300;
|
||||
|
||||
currentDemand.PEVMaximumPowerLimit = float_type;
|
||||
currentDemand.isused.PEVMaximumPowerLimit = 1;
|
||||
|
||||
float_type.Unit = A_unitSymbolType;
|
||||
float_type.Value = 400;
|
||||
|
||||
currentDemand.PEVMaximumCurrentLimit = float_type;
|
||||
currentDemand.isused.PEVMaximumCurrentLimit = 1;
|
||||
|
||||
currentDemand.BulkChargingComplete = 1;
|
||||
currentDemand.isused.BulkChargingComplete = 1;
|
||||
|
||||
currentDemand.ChargingComplete = 0;
|
||||
|
||||
float_type.Unit = s_unitSymbolType;
|
||||
float_type.Value = 500;
|
||||
|
||||
currentDemand.RemainingTimeToFullSoC = float_type;
|
||||
currentDemand.isused.RemainingTimeToFullSoC = 1;
|
||||
|
||||
float_type.Unit = s_unitSymbolType;
|
||||
float_type.Value = 600;
|
||||
|
||||
currentDemand.RemainingTimeToBulkSoC = float_type;
|
||||
currentDemand.isused.RemainingTimeToBulkSoC = 1;
|
||||
|
||||
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 700;
|
||||
|
||||
currentDemand.PEVTargetVoltage = float_type;
|
||||
|
||||
float_type.Unit = A_unitSymbolType;
|
||||
float_type.Value = 800;
|
||||
|
||||
currentDemand.CurrentDifferential = float_type;
|
||||
|
||||
float_type.Unit = V_unitSymbolType;
|
||||
float_type.Value = 900;
|
||||
|
||||
currentDemand.VoltageDifferential = float_type;
|
||||
|
||||
|
||||
if(call_currentDemand(&service,&v2gHeader,¤tDemand,&resultCurrentDemand))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE powerDiscovery*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultCurrentDemand.ResponseCode);
|
||||
printDCEVSEStatus(&resultCurrentDemand.DC_EVSEStatus);
|
||||
printf("\tResponseCode=%d\n",resultCurrentDemand.ResponseCode);
|
||||
printDCEVSEStatus(&(resultCurrentDemand.DC_EVSEStatus));
|
||||
printf("\t EVSEPresentVoltage=%d\n",resultCurrentDemand.EVSEPresentVoltage.Value);
|
||||
printf("\t EVSEPresentCurrent=%d\n",resultCurrentDemand.EVSEPresentCurrent.Value);
|
||||
printf("\t EVSECurrentLimitAchieved=%d\n",resultCurrentDemand.EVSECurrentLimitAchieved);
|
||||
printf("\t EVSEVoltageLimitAchieved=%d\n",resultCurrentDemand.EVSEVoltageLimitAchieved);
|
||||
|
||||
printf("\t EVSEPowerLimitAchieved=%d\n",resultCurrentDemand.EVSEPowerLimitAchieved);
|
||||
printf("\t EVSEMaximumVoltageLimit=%d\n",resultCurrentDemand.EVSEMaximumVoltageLimit.Value);
|
||||
printf("\t EVSEMaximumCurrentLimit=%d\n",resultCurrentDemand.EVSEMaximumCurrentLimit.Value);
|
||||
printf("\t EVSEMaximumPowerLimit=%d\n",resultCurrentDemand.EVSEMaximumPowerLimit.Value);
|
||||
|
||||
}
|
||||
|
||||
/***********************
|
||||
* Call weldingDetection *
|
||||
***********************/
|
||||
|
||||
printf("\nPEV: call EVSE weldingDetection\n");
|
||||
weldingDetection.DC_PEVStatus =pevStatus;
|
||||
|
||||
if(call_weldingDetection(&service,&v2gHeader,&weldingDetection,&resultWeldingDetection))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE powerDiscovery*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultWeldingDetection.ResponseCode);
|
||||
printDCEVSEStatus(&resultWeldingDetection.DC_EVSEStatus);
|
||||
printf("\tEVSEPresentVoltage=%d\n",resultWeldingDetection.EVSEPresentVoltage.Value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************
|
||||
* Call terminateCharging*
|
||||
*************************/
|
||||
printf("\nPEV: call EVSE terminateCharging\n");
|
||||
terminateCharging.DC_PEVStatus =pevStatus;
|
||||
|
||||
if(call_terminateCharging(&service,&v2gHeader,&terminateCharging,&resultTerminateCharging))
|
||||
{
|
||||
printErrorMessage(&service);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* show result of the answer message of EVSE powerDiscovery*/
|
||||
printf("PEV: received response message from EVSE\n");
|
||||
printf("\tResponseCode=%d\n",resultTerminateCharging.ResponseCode);
|
||||
printf("\tEVSEPresentVoltage=%d\n",resultTerminateCharging.EVSEPresentVoltage.Value);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main_service()
|
||||
{
|
||||
printf("+++ Start V2G client / service example for AC charging +++\n\n");
|
||||
|
||||
ac_charging();
|
||||
|
||||
printf("\n+++Terminate V2G Client / Service example for AC charging +++\n");
|
||||
printf("Please press enter for DC charging!\n");
|
||||
fflush(stdout);
|
||||
getchar();
|
||||
|
||||
printf("+++ Start V2G client / service example for DC charging +++\n\n");
|
||||
|
||||
dc_charging();
|
||||
|
||||
printf("\n+++Terminate V2G client / service example for DC charging +++");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void printACEVSEStatus(struct AC_EVSEStatusType* status)
|
||||
{
|
||||
printf("\tEVSEStatus:\n\t\tConnectorLocked=%d\n",status->ConnectorLocked);
|
||||
printf("\t\tEVSEStandby=%d\n",status->EVSEStandby);
|
||||
printf("\t\tPowerSwitchClosed=%d\n",status->PowerSwitchClosed);
|
||||
printf("\t\tRCD=%d\n",status->RCD);
|
||||
printf("\t\tShutDownTime=%d\n",status->ShutDownTime);
|
||||
printf("\t\tStopCharging=%d\n",status->StopCharging);
|
||||
}
|
||||
|
||||
static void printDCEVSEStatus(struct DC_EVSEStatusType* status)
|
||||
{
|
||||
printf("\tEVSEStatus:\n\t\tEVSEStandby=%d\n",status->EVSEStandby);
|
||||
printf("\t\tEVSEStatusCode=%d\n",status->EVSEStatusCode);
|
||||
|
||||
}
|
||||
|
||||
static void printErrorMessage(struct EXIService* service)
|
||||
{
|
||||
if(service->errorCode==EXI_NON_VALID_MESSAGE)
|
||||
{
|
||||
printf("PEV did not send a valid V2G message!\n");
|
||||
}
|
||||
else if(service->errorCode==EXI_SERIALIZATION_FAILED)
|
||||
{
|
||||
printf("EVSE error: Could not serialize the response message\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void printASCIIString(uint32_t* string, uint32_t len) {
|
||||
unsigned int i;
|
||||
for(i=0; i<len; i++) {
|
||||
printf("%c",(char)string[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
47
src/test/serviceClientDataTransmitter.c
Normal file
47
src/test/serviceClientDataTransmitter.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2011 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.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#include "v2g_serviceClientDataTransmitter.h"
|
||||
#include "evse_server.h"
|
||||
#include "v2gtp.h"
|
||||
|
||||
/* This method has to be implemented!
|
||||
* Send EXI stream (outStream) to EVSE and receive response stream (inStream)*/
|
||||
int serviceDataTransmitter(uint8_t* outStream, uint16_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*/
|
||||
|
||||
uint16_t inStreamLength = 0;
|
||||
uint16_t payloadLength = 0;
|
||||
|
||||
/* setup v2gtp header information; outStreamLength==payloadLength*/
|
||||
write_v2gtpHeader(outStream,&outStreamLength,V2GTP_EXI_TYPE);
|
||||
|
||||
/* send data to EVSE server (add v2g offset)*/
|
||||
testV2GService(outStream, outStreamLength, inStream, &inStreamLength);
|
||||
|
||||
return read_v2gtpHeader(inStream,inStreamLength, &payloadLength);
|
||||
}
|
98
src/transport/v2gtp.c
Normal file
98
src/transport/v2gtp.c
Normal file
|
@ -0,0 +1,98 @@
|
|||
|
||||
/*
|
||||
* Copyright (C) 2007-2011 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.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
/*
|
||||
* This file implements the v2gtp header writer and reader.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "v2gtp.h"
|
||||
|
||||
|
||||
int write_v2gtpHeader(uint8_t* outStream, uint16_t* outStreamLength, uint16_t payloadType)
|
||||
{
|
||||
|
||||
/* write v2gtp version number 1=byte */
|
||||
outStream[0]=V2GTP_VERSION;
|
||||
|
||||
/* write inverse v2gtp version */
|
||||
outStream[1]=V2GTP_VERSION_INV;
|
||||
|
||||
|
||||
/* write payload type */
|
||||
outStream[2] = (uint8_t)(payloadType & 0xFF);
|
||||
outStream[3] = (uint8_t)(payloadType >> 8 & 0xFF);
|
||||
|
||||
/* write payload length */
|
||||
outStream[4] = (uint8_t)(*outStreamLength & 0xFF);
|
||||
outStream[5] = (uint8_t)(*outStreamLength>>8 & 0xFF);
|
||||
outStream[6] = (uint8_t)(*outStreamLength>>16 & 0xFF);
|
||||
outStream[7] = (uint8_t)(*outStreamLength>>24 & 0xFF);
|
||||
|
||||
/* here, the outStream length have to be resized by the v2gtp offset*/
|
||||
*outStreamLength += V2GTP_HEADER_LENGTH;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int read_v2gtpHeader(uint8_t* inStream, uint16_t inStreamLength, uint16_t* payloadLength)
|
||||
{
|
||||
uint16_t payloadType=0;
|
||||
|
||||
|
||||
/* check, if we support this v2gtp version */
|
||||
if(inStream[0]!=V2GTP_VERSION && inStream[1]!=V2GTP_VERSION_INV)
|
||||
return -1;
|
||||
|
||||
|
||||
/* check, if we support this payload type*/
|
||||
payloadType = inStream[3];
|
||||
payloadType = (payloadType << 8 | inStream[2]);
|
||||
|
||||
if(payloadType != V2GTP_EXI_TYPE)
|
||||
return -1;
|
||||
|
||||
|
||||
/* determine payload length*/
|
||||
*payloadLength = inStream[7];
|
||||
*payloadLength = (*payloadLength << 8 | inStream[6]);
|
||||
*payloadLength = (*payloadLength << 16 | inStream[5]);
|
||||
*payloadLength = (*payloadLength << 24 | inStream[4]);
|
||||
|
||||
if((*payloadLength+V2GTP_HEADER_LENGTH)!=inStreamLength)
|
||||
return -1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
54
src/transport/v2gtp.h
Normal file
54
src/transport/v2gtp.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
/*
|
||||
* Copyright (C) 2007-2011 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.5
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef V2GTP_H_
|
||||
#define V2GTP_H_
|
||||
|
||||
/* generic V2GTP header length */
|
||||
#define V2GTP_HEADER_LENGTH 8
|
||||
|
||||
/* define V2GTP Version */
|
||||
#define V2GTP_VERSION 0x01
|
||||
#define V2GTP_VERSION_INV 0xFE
|
||||
|
||||
/* define V2GTP payload types*/
|
||||
#define V2GTP_EXI_TYPE 0x8001
|
||||
|
||||
|
||||
|
||||
int write_v2gtpHeader(uint8_t* outStream, uint16_t* outStreamLength, uint16_t payloadType);
|
||||
|
||||
int read_v2gtpHeader(uint8_t* inStream, uint16_t inStreamLength, uint16_t* payloadLength);
|
||||
|
||||
#endif /* V2GTP_H_ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue