Byte Count Coding


  • The message size and structure is set
    • Each field has a set location in the message
    • In principle the size of each field is predetermined
    • For fields that can have variable size (e.g. payload), a separate field is required where the current size is stated.

Defining Byte count coding

  • No UML here, tables or graphical presentation
  • Based on N-1 layer provided services (as any coding)
  • Message presentation as a matrix to express information flow
    • Note: message matrixes may not directly express of message boundaries so message forming have to be defined separately. Message forming may or may not depend N-1 layer service, eg. TCP requires message forming as it provides just a octet stream
  • Transferred value is based to the byte (octet) count (offset) of location in read “stream”.


  • 32 bit (4 bytes) alignment

ThingReply – Abstract Message

  1. type : Number – Message type
  2. valid : Boolean
  3. name : String
  4. distance : Real

Concrete coding

Type definitions

Number: 32 bit number, Two's Complement presentation, little-endian order.

Boolean: 8-bit allocation, bit 0 presents value.

String: Unicode character encoding, string presentation has two parts: 16-bit integer length field with little-endian presentation to express amount of characters in string and value part containing characters. Strings are padded to 32-bit alignment. Names is coding definition:

  • strlen – string lenght

Real: 64-bit IEEE 754-2008 Double precision floating-point format presentation


0 - 7 8 - 15 16 - 23 24 - 31
0 type
1 valid PADDING strlen
2 name ..
.. .. name PADDING
.. distance
.. distance


  • .. denotes that there is variable number of octets
  • distance could be put visually into one block if tools fits to it

Other examples

Last modified: 2013/07/01 14:42