APIs for packing data into a MessagePack message. More...

Functions

gos_result_t gos_msgpack_write_int ( gos_msgpack_context_t *context, int32_t value)
gos_result_t gos_msgpack_write_uint ( gos_msgpack_context_t *context, uint32_t value)
gos_result_t gos_msgpack_write_long ( gos_msgpack_context_t *context, int64_t value)
gos_result_t gos_msgpack_write_ulong ( gos_msgpack_context_t *context, uint64_t value)
gos_result_t gos_msgpack_write_float ( gos_msgpack_context_t *context, float value)
gos_result_t gos_msgpack_write_double ( gos_msgpack_context_t *context, double value)
gos_result_t gos_msgpack_write_nil ( gos_msgpack_context_t *context)
gos_result_t gos_msgpack_write_bool ( gos_msgpack_context_t *context, bool value)
gos_result_t gos_msgpack_write_str ( gos_msgpack_context_t *context, const char *str)
gos_result_t gos_msgpack_write_str_marker ( gos_msgpack_context_t *context, uint32_t size)
gos_result_t gos_msgpack_write_bin ( gos_msgpack_context_t *context, const void *data, uint32_t length)
gos_result_t gos_msgpack_write_bin_marker ( gos_msgpack_context_t *context, uint32_t size)
gos_result_t gos_msgpack_write_context ( gos_msgpack_context_t *context, const gos_msgpack_context_t *value_context)
gos_result_t gos_msgpack_write_dict_marker ( gos_msgpack_context_t *context, uint32_t size)
gos_result_t gos_msgpack_write_array_marker ( gos_msgpack_context_t *context, uint32_t size)
gos_result_t gos_msgpack_write_dict_nil ( gos_msgpack_context_t *context, const char *key)
gos_result_t gos_msgpack_write_dict_bool ( gos_msgpack_context_t *context, const char *key, bool value)
gos_result_t gos_msgpack_write_dict_int ( gos_msgpack_context_t *context, const char *key, int32_t value)
gos_result_t gos_msgpack_write_dict_uint ( gos_msgpack_context_t *context, const char *key, uint32_t value)
gos_result_t gos_msgpack_write_dict_long ( gos_msgpack_context_t *context, const char *key, int64_t value)
gos_result_t gos_msgpack_write_dict_ulong ( gos_msgpack_context_t *context, const char *key, uint64_t value)
gos_result_t gos_msgpack_write_dict_float ( gos_msgpack_context_t *context, const char *key, float value)
gos_result_t gos_msgpack_write_dict_double ( gos_msgpack_context_t *context, const char *key, double value)
gos_result_t gos_msgpack_write_dict_str ( gos_msgpack_context_t *context, const char *key, const char *value)
gos_result_t gos_msgpack_write_dict_bin ( gos_msgpack_context_t *context, const char *key, const void *value, uint32_t length)
gos_result_t gos_msgpack_write_dict_dict ( gos_msgpack_context_t *context, const char *key, uint32_t dict_count)
gos_result_t gos_msgpack_write_dict_array ( gos_msgpack_context_t *context, const char *key, uint32_t array_count)
gos_result_t gos_msgpack_write_dict_context ( gos_msgpack_context_t *context, const char *key, const gos_msgpack_context_t *value_context)

Detailed Description

APIs for packing data into a MessagePack message.

Function Documentation

gos_msgpack_write_array_marker()

gos_result_t gos_msgpack_write_array_marker ( gos_msgpack_context_t * context,
uint32_t size
)

Begin packing an array (aka map)

This writes the number of values that will go into the array to the given gos_msgpack_context_t . The array values MUST be immediately written after calling this function.

The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
size Number of array values that will immediately follow
Returns
Result of function, see gos_result_t

gos_msgpack_write_bin()

gos_result_t gos_msgpack_write_bin ( gos_msgpack_context_t * context,
const void * data,
uint32_t length
)

Pack a binary string value

This packs a binary string value into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
data Binary string value to write
length Length of binary string
Returns
Result of function, see gos_result_t

gos_msgpack_write_bin_marker()

gos_result_t gos_msgpack_write_bin_marker ( gos_msgpack_context_t * context,
uint32_t size
)

Begin packing a binary string value

This writes the binary string size to the given gos_msgpack_context_t . The binary string value MUST be immediately written after calling this function. This function is useful if the binary string needs to be written in chunks.

The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
size Size of the binary string value that will be immediately follow
Returns
Result of function, see gos_result_t
Examples:
hurricane/arducam/camera.c , and hurricane/security_camera/camera.c .

gos_msgpack_write_bool()

gos_result_t gos_msgpack_write_bool ( gos_msgpack_context_t * context,
bool value
)

Pack a boolean value

This packs a boolean value into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
value Boolean value to write
Returns
Result of function, see gos_result_t
Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

gos_msgpack_write_context()

gos_result_t gos_msgpack_write_context ( gos_msgpack_context_t * context,
const gos_msgpack_context_t * value_context
)

Write a previously written gos_msgpack_context_t

This writes the contents of a previously written gos_msgpack_context_t to the supplied context . The previously written context MUST have been initialized with a buffer (not a writer)

The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
value_context Previously written context to write to this context
Returns
Result of function, see gos_result_t

gos_msgpack_write_dict_array()

gos_result_t gos_msgpack_write_dict_array ( gos_msgpack_context_t * context,
const char * key,
uint32_t array_count
)

Pack a array marker into to the current dictionary

This packs a new array marker with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
array_count Number of entries that will go in new array within the current dictionary
Returns
Result of function, see gos_result_t
Examples:
dms/messages/main.c , dms/telemetry/main.c , network/http_server_stream/main.c , system/core_dump/main.c , utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

gos_msgpack_write_dict_bin()

gos_result_t gos_msgpack_write_dict_bin ( gos_msgpack_context_t * context,
const char * key,
const void * value,
uint32_t length
)

Pack a binary string into to the current dictionary

This packs a binary string value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value binary string value
length Length of binary string
Returns
Result of function, see gos_result_t
Examples:
demo/secure_element/commands.c , utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

gos_msgpack_write_dict_bool()

gos_result_t gos_msgpack_write_dict_bool ( gos_msgpack_context_t * context,
const char * key,
bool value
)

Pack a boolean to the current dictionary

This packs a boolean value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value Boolean value
Returns
Result of function, see gos_result_t
Examples:
demo/secure_element/commands.c , dms/messages/main.c , dms/telemetry/main.c , and network/http_server_stream/main.c .

gos_msgpack_write_dict_context()

gos_result_t gos_msgpack_write_dict_context ( gos_msgpack_context_t * context,
const char * key,
const gos_msgpack_context_t * value_context
)

Pack a previous written context into to the current dictionary

This packs a previously written gos_msgpack_context_t with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized. The previously written context MUST have been initialized with a buffer (not a writer)

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value_context Previously written context to write to supplied context
Returns
Result of function, see gos_result_t

gos_msgpack_write_dict_dict()

gos_result_t gos_msgpack_write_dict_dict ( gos_msgpack_context_t * context,
const char * key,
uint32_t dict_count
)

Pack a dictionary marker into to the current dictionary

This packs a new dictionary marker with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
dict_count Number of key/value pairs that will go in new dictionary within the current dictionary
Returns
Result of function, see gos_result_t
Examples:
demo/secure_element/commands.c , hurricane/security_camera/camera.c , hurricane/weatherstation/main.c , utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

gos_msgpack_write_dict_double()

gos_result_t gos_msgpack_write_dict_double ( gos_msgpack_context_t * context,
const char * key,
double value
)

Pack a double into to the current dictionary

This packs a double value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value double value
Returns
Result of function, see gos_result_t

gos_msgpack_write_dict_float()

gos_result_t gos_msgpack_write_dict_float ( gos_msgpack_context_t * context,
const char * key,
float value
)

Pack a float into to the current dictionary

This packs a float value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value float value
Returns
Result of function, see gos_result_t
Examples:
demo/3d_demo/main.c , demo/accelerometer_stream/main.c , and hurricane/security_camera/sensor.c .

gos_msgpack_write_dict_int()

gos_result_t gos_msgpack_write_dict_int ( gos_msgpack_context_t * context,
const char * key,
int32_t value
)

Pack a signed integer (8-32bits) to the current dictionary

This packs a signed integer value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value signed integer value
Returns
Result of function, see gos_result_t
Examples:
hurricane/arducam/camera.c .

gos_msgpack_write_dict_long()

gos_result_t gos_msgpack_write_dict_long ( gos_msgpack_context_t * context,
const char * key,
int64_t value
)

Pack a signed integer (8-64bits) to the current dictionary

This packs a signed integer value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value signed integer value
Returns
Result of function, see gos_result_t

gos_msgpack_write_dict_marker()

gos_result_t gos_msgpack_write_dict_marker ( gos_msgpack_context_t * context,
uint32_t size
)

Begin packing a dictionary (aka map)

This writes the number of key/values that will go into the dictionary to the given gos_msgpack_context_t . The dictionary key/values MUST be immediately written after calling this function.

The gos_msgpack_context_t should have been previously initialized.

Note
The msgpack_write_dict_xxx APIs may be used to write the dictionary key/values.
Parameters
context Previously initialize gos_msgpack_context_t
size Number of dictionary key/values that will immediately follow
Returns
Result of function, see gos_result_t
Examples:
cloud/dps_demo/main.c , demo/3d_demo/main.c , demo/accelerometer_stream/main.c , demo/secure_element/commands.c , dms/messages/main.c , dms/telemetry/main.c , hurricane/arducam/camera.c , hurricane/security_camera/camera.c , hurricane/security_camera/main.c , hurricane/security_camera/sensor.c , hurricane/weatherstation/main.c , network/http_server_stream/main.c , system/core_dump/main.c , utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

gos_msgpack_write_dict_nil()

gos_result_t gos_msgpack_write_dict_nil ( gos_msgpack_context_t * context,
const char * key
)

Pack a NULL to the current dictionary

This packs a NULL value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
Returns
Result of function, see gos_result_t

gos_msgpack_write_dict_str()

gos_result_t gos_msgpack_write_dict_str ( gos_msgpack_context_t * context,
const char * key,
const char * value
)

Pack a string into to the current dictionary

This packs a string value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value string value
Returns
Result of function, see gos_result_t
Examples:
cloud/dps_demo/main.c , demo/secure_element/commands.c , dms/messages/main.c , dms/telemetry/main.c , hurricane/security_camera/camera.c , hurricane/security_camera/main.c , hurricane/weatherstation/main.c , network/http_server_stream/main.c , utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

gos_msgpack_write_dict_uint()

gos_result_t gos_msgpack_write_dict_uint ( gos_msgpack_context_t * context,
const char * key,
uint32_t value
)

Pack an unsigned integer (8-32bits) to the current dictionary

This packs an unsigned integer value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value unsigned integer value
Returns
Result of function, see gos_result_t
Examples:
demo/3d_demo/main.c , demo/accelerometer_stream/main.c , hurricane/security_camera/camera.c , system/core_dump/main.c , utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

gos_msgpack_write_dict_ulong()

gos_result_t gos_msgpack_write_dict_ulong ( gos_msgpack_context_t * context,
const char * key,
uint64_t value
)

Pack an unsigned integer (8-64bits) to the current dictionary

This packs an unsigned integer value with the corresponding dictionary key into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

gos_msgpack_write_dict_marker() MUST have been previously called to specify the dictionary.

Parameters
context Previously initialize gos_msgpack_context_t
key Dictionary key of written value
value unsigned integer value
Returns
Result of function, see gos_result_t
Examples:
dms/messages/main.c , network/http_server_stream/main.c , system/core_dump/main.c , utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

gos_msgpack_write_double()

gos_result_t gos_msgpack_write_double ( gos_msgpack_context_t * context,
double value
)

Pack a double

This packs the supplied double into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
value double value
Returns
Result of function, see gos_result_t

gos_msgpack_write_float()

gos_result_t gos_msgpack_write_float ( gos_msgpack_context_t * context,
float value
)

Pack a float

This packs the float into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
value float value
Returns
Result of function, see gos_result_t

gos_msgpack_write_int()

gos_result_t gos_msgpack_write_int ( gos_msgpack_context_t * context,
int32_t value
)

Pack a signed integer (8-32bits)

This packs the supplied integer into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
value signed integer value
Returns
Result of function, see gos_result_t

gos_msgpack_write_long()

gos_result_t gos_msgpack_write_long ( gos_msgpack_context_t * context,
int64_t value
)

Pack a signed long integer (8-64bits)

This packs the supplied integer into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
value signed integer value
Returns
Result of function, see gos_result_t

gos_msgpack_write_nil()

gos_result_t gos_msgpack_write_nil ( gos_msgpack_context_t * context )

Pack a NULL

This packs a NULL value into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
Returns
Result of function, see gos_result_t

gos_msgpack_write_str()

gos_result_t gos_msgpack_write_str ( gos_msgpack_context_t * context,
const char * str
)

Pack a string value

This packs a string value into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
str String value to write
Returns
Result of function, see gos_result_t
Examples:
hurricane/security_camera/camera.c , and system/core_dump/main.c .

gos_msgpack_write_str_marker()

gos_result_t gos_msgpack_write_str_marker ( gos_msgpack_context_t * context,
uint32_t size
)

Begin packing a string value

This writes the string size to the given gos_msgpack_context_t . The string value MUST be immediately written after calling this function. This function is useful if the string needs to be written in chunks.

The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
size Size of the string value that will be immediately follow
Returns
Result of function, see gos_result_t

gos_msgpack_write_uint()

gos_result_t gos_msgpack_write_uint ( gos_msgpack_context_t * context,
uint32_t value
)

Pack an unsigned integer (8-32bits)

This packs the supplied integer into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
value unsigned integer value
Returns
Result of function, see gos_result_t
Examples:
network/http_server_stream/main.c .

gos_msgpack_write_ulong()

gos_result_t gos_msgpack_write_ulong ( gos_msgpack_context_t * context,
uint64_t value
)

Pack an unsigned long integer (8-64bits)

This packs the supplied integer into the given gos_msgpack_context_t . The gos_msgpack_context_t should have been previously initialized.

Parameters
context Previously initialize gos_msgpack_context_t
value unsigned integer value
Returns
Result of function, see gos_result_t