Skip to content

Message Structure

xxAtrain223 edited this page Jan 20, 2019 · 1 revision

EmbMessenger communicates in discreet messages, using MessagePack for encoding. Each message starts with a Message ID and ends with kEndOfMessage and the message CRC. The Message ID is used for tracking messages between host and device. kEndOfMessage marks the end of the message and the next value in the message is the CRC. The CRC is for checking the integrity of the message.

Host To Device

The Message IDs will be unique for the lifespan of the Host messenger. A message from the Host will include a Command ID and the command's parameters in the body of the message.

  • Message ID
  • Command ID
  • Command Parameter 0
  • Command Parameter 1
  • ...
  • Command Parameter N
  • kEndOfMessage
  • CRC Value

Device To Host

Messages from the device should correspond with a message from the host. A message from the Device may also include command return values.

  • Message ID
  • Command Return Value 0
  • Command Return Value 1
  • ...
  • Command Return Value N
  • kEndOfMessage
  • CRC Value

Errors

Errors should only arise from the Device, but they will be thrown as exceptions on the host. An error consists of

  • kError
  • Error Code
  • Data parameter
Clone this wiki locally