DecoderChannel.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /*
  2. * Copyright (C) 2007-2014 Siemens AG
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*******************************************************************
  18. *
  19. * @author Daniel.Peintner.EXT@siemens.com
  20. * @version 0.9.1
  21. * @contact Joerg.Heuer@siemens.com
  22. *
  23. * <p>Code generated by EXIdizer</p>
  24. * <p>Schema: V2G_CI_MsgDef.xsd</p>
  25. *
  26. *
  27. ********************************************************************/
  28. /**
  29. * \file DecoderChannel.h
  30. * \brief EXI Decoder Channel
  31. *
  32. */
  33. #ifndef DECODER_CHANNEL_H
  34. #define DECODER_CHANNEL_H
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. #include "EXIOptions.h"
  39. #include "EXITypes.h"
  40. /**
  41. * \brief Decode byte value
  42. *
  43. * \param stream Input Stream
  44. * \param b byte (out)
  45. * \return Error-Code <> 0
  46. *
  47. */
  48. int decode(bitstream_t* stream, uint8_t* b);
  49. /**
  50. * \brief Decode boolean
  51. *
  52. * Decode a single boolean value. The value false is
  53. * represented by 0, and the value true is represented by 1.
  54. *
  55. * \param stream Input Stream
  56. * \param b boolean (out)
  57. * \return Error-Code <> 0
  58. *
  59. */
  60. int decodeBoolean(bitstream_t* stream, int* b);
  61. /**
  62. * \brief Decode n-bit unsigned integer
  63. *
  64. * Decodes and returns an n-bit unsigned integer.
  65. *
  66. * \param stream Input Stream
  67. * \param nbits Number of bits
  68. * \param uint32 Value (out)
  69. * \return Error-Code <> 0
  70. *
  71. */
  72. int decodeNBitUnsignedInteger(bitstream_t* stream, uint16_t nbits, uint32_t* uint32);
  73. /**
  74. * \brief Decode unsigned integer
  75. *
  76. * Decode an arbitrary precision non negative integer using
  77. * a sequence of octets. The most significant bit of the last
  78. * octet is set to zero to indicate sequence termination.
  79. * Only seven bits per octet are used to store the integer's value.
  80. *
  81. * \param stream Input Stream
  82. * \param iv Unsigned Integer Value (out)
  83. * \return Error-Code <> 0
  84. *
  85. */
  86. int decodeUnsignedInteger(bitstream_t* stream, exi_integer_t* iv);
  87. /**
  88. * \brief Decode unsigned integer
  89. *
  90. * Decode an arbitrary precision non negative integer using
  91. * a sequence of octets. The most significant bit of the last
  92. * octet is set to zero to indicate sequence termination.
  93. * Only seven bits per octet are used to store the integer's value.
  94. *
  95. * \param stream Input Stream
  96. * \param uint16 Unsigned Integer Value 16 bits (out)
  97. * \return Error-Code <> 0
  98. *
  99. */
  100. int decodeUnsignedInteger16(bitstream_t* stream, uint16_t* uint16);
  101. /**
  102. * \brief Decode unsigned integer
  103. *
  104. * Decode an arbitrary precision non negative integer using
  105. * a sequence of octets. The most significant bit of the last
  106. * octet is set to zero to indicate sequence termination.
  107. * Only seven bits per octet are used to store the integer's value.
  108. *
  109. * \param stream Input Stream
  110. * \param uint32 Unsigned Integer Value 32 bits (out)
  111. * \return Error-Code <> 0
  112. *
  113. */
  114. int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32);
  115. /**
  116. * \brief Decode unsigned integer
  117. *
  118. * Decode an arbitrary precision non negative integer using
  119. * a sequence of octets. The most significant bit of the last
  120. * octet is set to zero to indicate sequence termination.
  121. * Only seven bits per octet are used to store the integer's value.
  122. *
  123. * \param stream Input Stream
  124. * \param uint64 Unsigned Integer Value 64 bits (out)
  125. * \return Error-Code <> 0
  126. *
  127. */
  128. int decodeUnsignedInteger64(bitstream_t* stream, uint64_t* uint64);
  129. /**
  130. * \brief Decode integer
  131. *
  132. * Decode an arbitrary precision integer using a sign bit
  133. * followed by a sequence of octets. The most significant bit
  134. * of the last octet is set to zero to indicate sequence termination.
  135. * Only seven bits per octet are used to store the integer's value.
  136. *
  137. * \param stream Input Stream
  138. * \param iv Integer Value 64 bits (out)
  139. * \return Error-Code <> 0
  140. *
  141. */
  142. int decodeInteger(bitstream_t* stream, exi_integer_t* iv);
  143. /**
  144. * \brief Decode integer
  145. *
  146. * Decode an arbitrary precision integer using a sign bit
  147. * followed by a sequence of octets. The most significant bit
  148. * of the last octet is set to zero to indicate sequence termination.
  149. * Only seven bits per octet are used to store the integer's value.
  150. *
  151. * \param stream Input Stream
  152. * \param int16 Integer Value 16 bits (out)
  153. * \return Error-Code <> 0
  154. *
  155. */
  156. int decodeInteger16(bitstream_t* stream, int16_t* int16);
  157. /**
  158. * \brief Decode integer
  159. *
  160. * Decode an arbitrary precision integer using a sign bit
  161. * followed by a sequence of octets. The most significant bit
  162. * of the last octet is set to zero to indicate sequence termination.
  163. * Only seven bits per octet are used to store the integer's value.
  164. *
  165. * \param stream Input Stream
  166. * \param int32 Integer Value 32 bits (out)
  167. * \return Error-Code <> 0
  168. *
  169. */
  170. int decodeInteger32(bitstream_t* stream, int32_t* int32);
  171. /**
  172. * \brief Decode integer
  173. *
  174. * Decode an arbitrary precision integer using a sign bit
  175. * followed by a sequence of octets. The most significant bit
  176. * of the last octet is set to zero to indicate sequence termination.
  177. * Only seven bits per octet are used to store the integer's value.
  178. *
  179. * \param stream Input Stream
  180. * \param int64 Integer Value 64 bits (out)
  181. * \return Error-Code <> 0
  182. *
  183. */
  184. int decodeInteger64(bitstream_t* stream, int64_t* int64);
  185. /**
  186. * \brief Decode float
  187. *
  188. * Decode a Float datatype as two consecutive Integers. The
  189. * first Integer represents the mantissa of the floating point
  190. * number and the second Integer represents the base-10 exponent
  191. * of the floating point number.
  192. *
  193. * \param stream Input Stream
  194. * \param f Float Value (out)
  195. * \return Error-Code <> 0
  196. *
  197. */
  198. int decodeFloat(bitstream_t* stream, exi_float_me_t* f);
  199. /**
  200. * \brief Decode decimal
  201. *
  202. * Decode a decimal represented as a Boolean sign followed by two
  203. * Unsigned Integers. A sign value of zero (0) is used to represent
  204. * positive Decimal values and a sign value of one (1) is used to
  205. * represent negative Decimal values The first Integer represents
  206. * the integral portion of the Decimal value. The second positive
  207. * integer represents the fractional portion of the decimal with
  208. * the digits in reverse order to preserve leading zeros.
  209. *
  210. * \param stream Input Stream
  211. * \param d Decimal Value (out)
  212. * \return Error-Code <> 0
  213. *
  214. */
  215. int decodeDecimal(bitstream_t* stream, exi_decimal_t* d);
  216. /**
  217. * \brief Decode String (no length prefix)
  218. *
  219. * Decode a sequence of characters for a given length.
  220. *
  221. * \param stream Input Stream
  222. * \param len Characters length
  223. * \param s String Value (out)
  224. * \return Error-Code <> 0
  225. *
  226. */
  227. int decodeStringOnly(bitstream_t* stream, uint16_t len, exi_string_t* s);
  228. /**
  229. * \brief Decode String
  230. *
  231. * Decode a length prefixed sequence of characters.
  232. *
  233. * \param stream Input Stream
  234. * \param s String Value (out)
  235. * \return Error-Code <> 0
  236. *
  237. */
  238. int decodeString(bitstream_t* stream, exi_string_t* s);
  239. /**
  240. * \brief Decode String value
  241. *
  242. * Decode a length prefixed sequence of characters in the sense of string tables.
  243. * length == 0: local value partition hit.
  244. * length == 1: global value partition hit.
  245. * length > 1: string literal is encoded as a String with the length incremented by two
  246. *
  247. * \param stream Input Stream
  248. * \param state Codec state
  249. * \param qnameID Qualified Name ID
  250. * \param s String Value (out)
  251. * \return Error-Code <> 0
  252. *
  253. */
  254. int decodeStringValue(bitstream_t* stream, exi_state_t* state, uint16_t qnameID, exi_string_value_t* s);
  255. /**
  256. * \brief Decode Restricted characters set string value
  257. *
  258. * \param stream Input Stream
  259. * \param state Codec state
  260. * \param qnameID Qualified Name ID
  261. * \param rcs Restricted character set
  262. * \param s String Value (out)
  263. * \return Error-Code <> 0
  264. *
  265. */
  266. int decodeRCSStringValue(bitstream_t* stream, exi_state_t* state, uint16_t qnameID, exi_rcs_t* rcs, exi_string_value_t* s);
  267. /**
  268. * \brief Decode characters
  269. *
  270. * Decode a sequence of characters according to a given length.
  271. *
  272. * \param stream Input Stream
  273. * \param len Length
  274. * \param chars Characters (out)
  275. * \return Error-Code <> 0
  276. *
  277. */
  278. int decodeCharacters(bitstream_t* stream, uint16_t len, exi_string_character_t* chars);
  279. /**
  280. * \brief Decode restricted character set characters
  281. *
  282. * Decode a sequence of characters according to a given length and rcs code-length, size and set.
  283. *
  284. * \param stream Input Stream
  285. * \param len Length
  286. * \param chars Characters (out)
  287. * \param rcsCodeLength RCS code-length
  288. * \param rcsCodeLength RCS size
  289. * \param rcsCodeLength RCS set
  290. * \return Error-Code <> 0
  291. *
  292. */
  293. int decodeRCSCharacters(bitstream_t* stream, uint16_t len, exi_string_character_t* chars, uint16_t rcsCodeLength, uint16_t rcsSize, const exi_string_character_t rcsSet[]);
  294. /**
  295. * \brief Decode Binary
  296. *
  297. * Decode a binary value as a length-prefixed sequence of octets.
  298. *
  299. * \param stream Input Stream
  300. * \param bytes Bytes (out)
  301. * \return Error-Code <> 0
  302. *
  303. */
  304. int decodeBinary(bitstream_t* stream, exi_bytes_t* bytes);
  305. /**
  306. * \brief Decode Binary data
  307. *
  308. * Decode a sequence of octets.
  309. *
  310. * \param stream Input Stream
  311. * \param len Length
  312. * \param data Bytes (out)
  313. * \return Error-Code <> 0
  314. *
  315. */
  316. int decodeBytes(bitstream_t* stream, uint16_t len, uint8_t* data);
  317. /**
  318. * \brief Decode DateTime
  319. *
  320. * Decode Date-Time as sequence of values representing the
  321. * individual components of the Date-Time.
  322. *
  323. * \param stream Input Stream
  324. * \param type Datetime type
  325. * \param datetime Datetime (out)
  326. * \return Error-Code <> 0
  327. *
  328. */
  329. int decodeDateTime(bitstream_t* stream, exi_datetime_type_t type, exi_datetime_t* datetime);
  330. #ifdef __cplusplus
  331. }
  332. #endif
  333. #endif