Basic Msgpack Example

Demonstrates how to use the msgpack utility

Features Demonstrated

Platforms

This app works on:

Requirements and Prerequisites

Requires a Gecko OS evaluation board, such as a WGM160P_eval.

Other Gecko OS hardware can also be used by changing the source of the logged data to suit your device.

Description

This app demonstrates using the msgpack utility.

The msgpack example data is described below in JSON format, but is MessagePack formatted in the examples:

{
   "time-ms"  : <uint64:time in ms>,
   "time-utc" : "<string: time as UTC string>",
   "tick"     : <uint32: RTOS tick count>,
   "mac"      : "<binary string: MAC address as binary string>",
   "gpio-list": [ <array:bool: gpio values> ],
   "adc-readings" : {
                  "adc-X" :
                  {
                     "format" : "<string:mV/raw>",
                     "value" : <uint32:value>
                  }
                  ...
                }
}

main.c

The main.c code brings the network up then calls the examples below one after the other.

read_write_buffer.c

This code demonstrates how to serialize/de-serialize a MessagePack buffer located in RAM.

read_write_stream.c

This code demonstrates how to serialize then de-serialize a MessagePack data stream. The stream is written to a TCP echo server. Everything that is written to the server is echoed back to the device.

Source

See: