MessagePack macros. More...

Macros

#define MSGPACK_BOOL (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object8_t , boolean)
#define MSGPACK_INT8 (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object8_t , s)
#define MSGPACK_UINT8 (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object8_t , u)
#define MSGPACK_INT16 (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object16_t , s)
#define MSGPACK_UINT16 (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object16_t , u)
#define MSGPACK_INT32 (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object32_t , s)
#define MSGPACK_UINT32 (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object32_t , u)
#define MSGPACK_FLOAT (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object32_t , flt)
#define MSGPACK_INT64 (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object64_t , s)
#define MSGPACK_UINT64 (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object64_t , u)
#define MSGPACK_DOUBLE (obj)   _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object64_t , dbl)
#define MSGPACK_DICT (obj, key) gos_msgpack_get_dict_object (( gos_msgpack_object_dict_t *)obj, key, MSGPACK_TYPE_ANY )
#define MSGPACK_DICT_TYPE (obj, key, type) gos_msgpack_get_dict_object (( gos_msgpack_object_dict_t *)obj, key, MSGPACK_TYPE_ ## type)
#define MSGPACK_DICT_STR (obj, key)   ( gos_msgpack_object_str_t *) MSGPACK_DICT_TYPE (obj, key, STR)
#define MSGPACK_DICT_BIN (obj, key)   ( gos_msgpack_object_bin_t *) MSGPACK_DICT_TYPE (obj, key, BIN)
#define MSGPACK_DICT_DICT (obj, key)   ( gos_msgpack_object_dict_t *) MSGPACK_DICT_TYPE (obj, key, DICT)
#define MSGPACK_DICT_ARRAY (obj, key)   ( gos_msgpack_object_array_t *) MSGPACK_DICT_TYPE (obj, key, ARRAY)
#define MSGPACK_DICT_INT (obj, key) MSGPACK_DICT_TYPE (obj, key, INT_OR_UINT)
#define MSGPACK_DICT_UINT (obj, key) MSGPACK_DICT_TYPE (obj, key, INT_OR_UINT)
#define MSGPACK_ARRAY (obj, index) gos_msgpack_get_array_object (( gos_msgpack_object_array_t *)obj, index, MSGPACK_TYPE_ANY )
#define MSGPACK_ARRAY_TYPE (obj, index, type) gos_msgpack_get_array_object (( gos_msgpack_object_array_t *)obj, index, MSGPACK_TYPE_ ## type)
#define MSGPACK_ARRAY_DICT (obj, index)   ( gos_msgpack_object_dict_t *) MSGPACK_ARRAY_TYPE (obj, index, DICT)
#define MSGPACK_ARRAY_ARRAY (obj, index)   ( gos_msgpack_object_array_t *) MSGPACK_ARRAY_TYPE (obj, index, ARRAY)
#define MSGPACK_ARRAY_LENGTH (obj)   ((( gos_msgpack_object_array_t *)obj)->count)
#define MSGPACK_ARRAY_STR (obj, index)   ( gos_msgpack_object_str_t *) MSGPACK_ARRAY_TYPE (obj, index, STR)
#define MSGPACK_ARRAY_BIN (obj, index)   ( gos_msgpack_object_bin_t *) MSGPACK_ARRAY_TYPE (obj, index, BIN)
#define MSGPACK_ARRAY_INT (obj, index) MSGPACK_ARRAY_TYPE (obj, index, INT)
#define MSGPACK_ARRAY_UINT (obj, index) MSGPACK_ARRAY_TYPE (obj, index, UINT)
#define MSGPACK_STR_VALUE (obj)   ((const gos_msgpack_object_str_t *)(obj))->data
#define MSGPACK_STR_LENGTH (obj)   ((const gos_msgpack_object_str_t *)(obj))->length
#define MSGPACK_STR_CMP (obj, str) gos_msgpack_str_cmp (( gos_msgpack_object_t *)obj, str)
#define MSGPACK_BIN_VALUE (obj)   ((const gos_msgpack_object_bin_t *)(obj))->data
#define MSGPACK_BIN_LENGTH (obj)   ((const gos_msgpack_object_bin_t *)(obj))->length
#define MSGPACK_BIN_CMP (obj, mem)   memcmp( MSGPACK_BIN_VALUE (obj), mem, MSGPACK_BIN_LENGTH (obj))
#define MSGPACK_INT (obj) gos_msgpack_get_int (obj)
#define MSGPACK_UINT (obj) gos_msgpack_get_uint (obj)
#define MSGPACK_LONG (obj, buffer) gos_msgpack_get_long (obj, buffer)
#define MSGPACK_ULONG (obj, buffer) gos_msgpack_get_ulong (obj, buffer)
#define MSGPACK_STR (obj, buffer, max_length) gos_msgpack_get_str (( gos_msgpack_object_t *)obj, buffer, max_length)
#define MSGPACK_BIN (obj, mem, max_length)   memcpy(mem, MSGPACK_BIN_VALUE (obj), MIN (max_length, MSGPACK_BIN_LENGTH (obj)))
#define MSGPACK_TO_STR (obj, buffer, max_length) gos_msgpack_to_str (( gos_msgpack_object_t *)obj, buffer, max_length)
#define MSGPACK_IS_NIL (obj)   _MSGPACK_IS_(obj, NIL)
#define MSGPACK_IS_BOOL (obj)   _MSGPACK_IS_(obj, BOOL)
#define MSGPACK_IS_INT8 (obj)   _MSGPACK_IS_(obj, INT8)
#define MSGPACK_IS_UINT8 (obj)   _MSGPACK_IS_(obj, UINT8)
#define MSGPACK_IS_INT16 (obj)   _MSGPACK_IS_(obj, INT16)
#define MSGPACK_IS_UINT16 (obj)   _MSGPACK_IS_(obj, UINT16)
#define MSGPACK_IS_INT32 (obj)   _MSGPACK_IS_(obj, INT32)
#define MSGPACK_IS_UINT32 (obj)   _MSGPACK_IS_(obj, UINT32)
#define MSGPACK_IS_INT64 (obj)   _MSGPACK_IS_(obj, INT64)
#define MSGPACK_IS_UINT64 (obj)   _MSGPACK_IS_(obj, UINT64)
#define MSGPACK_IS_UINT (obj) gos_msgpack_object_is_type (( gos_msgpack_object_t *)obj, MSGPACK_TYPE_UINT )
#define MSGPACK_IS_INT (obj) gos_msgpack_object_is_type (( gos_msgpack_object_t *)obj, MSGPACK_TYPE_INT )
#define MSGPACK_IS_FLOAT (obj)   _MSGPACK_IS_(obj, FLOAT)
#define MSGPACK_IS_DOUBLE (obj)   _MSGPACK_IS_(obj, DOUBLE)
#define MSGPACK_IS_STR (obj)   _MSGPACK_IS_(obj, STR)
#define MSGPACK_IS_BIN (obj)   _MSGPACK_IS_(obj, BIN)
#define MSGPACK_IS_DICT (obj)   _MSGPACK_IS_(obj, DICT)
#define MSGPACK_IS_ARRAY (obj)   _MSGPACK_IS_(obj, ARRAY)
#define MSGPACK_NIL 0xC0
#define MSGPACK_FALSE 0xC2
#define MSGPACK_TRUE 0xC3
#define MSGPACK_INIT_WITH_BUFFER (name, _buf, _len)
#define MSGPACK_INIT_CONTEXT_WITH_BUFFER (context, _buf, _len)
#define MSGPACK_INIT_WITH_WRITER (name, _writer, _user)
#define MSGPACK_SET_WRITER (context, _writer, _user)
#define MSGPACK_BUFFER_USED (ctx)   (uint16_t)((ctx)->buffer.ptr - (ctx)->buffer.buffer)
#define MSGPACK_BUFFER_REMAINING (ctx)   (uint16_t)((ctx)->buffer.end - (ctx)->buffer.ptr)
#define MSGPACK_DICT_GET_OBJECT (dict, key) gos_msgpack_get_dict_object ((const gos_msgpack_object_dict_t *)dict, key, MSGPACK_TYPE_ANY )
#define MSGPACK_ARRAY_GET_OBJECT (array, index) gos_msgpack_get_array_object (( gos_msgpack_object_array_t *)array, index, MSGPACK_TYPE_ANY )
#define MSGPACK_FOREACH (dict_or_array, callback, arg) gos_msgpack_foreach ((const gos_msgpack_object_t *)dict_or_array, callback, arg, 0)
#define MSGPACK_FOREACH_RECURSIVE (dict_or_array, callback, arg) gos_msgpack_foreach ((const gos_msgpack_object_t *)dict_or_array, callback, arg, UINT32_MAX)
#define MSGPACK_FREE_OBJECTS (obj) gos_msgpack_free_objects (obj)

Detailed Description

MessagePack macros.

Macro Definition Documentation

MSGPACK_ARRAY

#define MSGPACK_ARRAY ( obj,
index
) gos_msgpack_get_array_object (( gos_msgpack_object_array_t *)obj, index, MSGPACK_TYPE_ANY )

Get MessagePack object at specific index of array

MSGPACK_ARRAY_ARRAY

#define MSGPACK_ARRAY_ARRAY ( obj,
index
) ( gos_msgpack_object_array_t *) MSGPACK_ARRAY_TYPE (obj, index, ARRAY)

Get MessagePack array at index with a ARRAY type, return NULL if the entry is found but the wrong type

MSGPACK_ARRAY_BIN

#define MSGPACK_ARRAY_BIN ( obj,
index
) ( gos_msgpack_object_bin_t *) MSGPACK_ARRAY_TYPE (obj, index, BIN)

Get MessagePack array at index with a BIN type, return NULL if the entry is found but the wrong type

MSGPACK_ARRAY_DICT

#define MSGPACK_ARRAY_DICT ( obj,
index
) ( gos_msgpack_object_dict_t *) MSGPACK_ARRAY_TYPE (obj, index, DICT)

Get MessagePack array at index with a DICT type, return NULL if the entry is found but the wrong type

MSGPACK_ARRAY_GET_OBJECT

#define MSGPACK_ARRAY_GET_OBJECT ( array,
index
) gos_msgpack_get_array_object (( gos_msgpack_object_array_t *)array, index, MSGPACK_TYPE_ANY )

Return the object a the corresponding index in an array

See also
gos_msgpack_get_array_object() for more info
Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_ARRAY_INT

#define MSGPACK_ARRAY_INT ( obj,
index
) MSGPACK_ARRAY_TYPE (obj, index, INT)

Get MessagePack array at index with a signed integer (unsigned and bool included) type, return NULL if the entry is found but the wrong type

MSGPACK_ARRAY_LENGTH

#define MSGPACK_ARRAY_LENGTH ( obj ) ((( gos_msgpack_object_array_t *)obj)->count)

Return the number of entries in an array

Examples:
network/http_server_stream/main.c .

MSGPACK_ARRAY_STR

#define MSGPACK_ARRAY_STR ( obj,
index
) ( gos_msgpack_object_str_t *) MSGPACK_ARRAY_TYPE (obj, index, STR)

Get MessagePack array at index with a STR type, return NULL if the entry is found but the wrong type

Examples:
network/http_server_stream/main.c .

MSGPACK_ARRAY_TYPE

#define MSGPACK_ARRAY_TYPE ( obj,
index,
type
) gos_msgpack_get_array_object (( gos_msgpack_object_array_t *)obj, index, MSGPACK_TYPE_ ## type)

Get MessagePack array at index with a specific type, return NULL if the entry is found but the wrong type

MSGPACK_ARRAY_UINT

#define MSGPACK_ARRAY_UINT ( obj,
index
) MSGPACK_ARRAY_TYPE (obj, index, UINT)

Get MessagePack array at index with a unsigned integer (signed and bool included) type, return NULL if the entry is found but the wrong type

MSGPACK_BIN

#define MSGPACK_BIN ( obj,
mem,
max_length
) memcpy(mem, MSGPACK_BIN_VALUE (obj), MIN (max_length, MSGPACK_BIN_LENGTH (obj)))

Copy BIN obj contents to buffer

Examples:
demo/secure_element/commands.c .

MSGPACK_BIN_CMP

#define MSGPACK_BIN_CMP ( obj,
mem
) memcmp( MSGPACK_BIN_VALUE (obj), mem, MSGPACK_BIN_LENGTH (obj))

Compare binary MessagePack object to another binary value

MSGPACK_BIN_LENGTH

#define MSGPACK_BIN_LENGTH ( obj ) ((const gos_msgpack_object_bin_t *)(obj))->length

MSGPACK_BIN_VALUE

#define MSGPACK_BIN_VALUE ( obj ) ((const gos_msgpack_object_bin_t *)(obj))->data

MSGPACK_BOOL

#define MSGPACK_BOOL ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object8_t , boolean)

Get MessagePack object as boolean

Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_BUFFER_REMAINING

#define MSGPACK_BUFFER_REMAINING ( ctx ) (uint16_t)((ctx)->buffer.end - (ctx)->buffer.ptr)

Return the number of data buffer bytes unused (i.e. available) by a gos_msgpack_context_t

Parameters
ctx gos_msgpack_context_t initialized with a data buffer

MSGPACK_BUFFER_USED

#define MSGPACK_BUFFER_USED ( ctx ) (uint16_t)((ctx)->buffer.ptr - (ctx)->buffer.buffer)

MSGPACK_DICT

Get MessagePack object with specific key in dictionary (aka map)

Examples:
demo/3d_demo/main.c , and demo/accelerometer_stream/main.c .

MSGPACK_DICT_ARRAY

#define MSGPACK_DICT_ARRAY ( obj,
key
) ( gos_msgpack_object_array_t *) MSGPACK_DICT_TYPE (obj, key, ARRAY)

Get MessagePack dictionary entry with a ARRAY type, return NULL if the entry is found but the wrong type

MSGPACK_DICT_BIN

#define MSGPACK_DICT_BIN ( obj,
key
) ( gos_msgpack_object_bin_t *) MSGPACK_DICT_TYPE (obj, key, BIN)

Get MessagePack dictionary entry with a BIN type, return NULL if the entry is found but the wrong type

Examples:
demo/secure_element/commands.c .

MSGPACK_DICT_DICT

#define MSGPACK_DICT_DICT ( obj,
key
) ( gos_msgpack_object_dict_t *) MSGPACK_DICT_TYPE (obj, key, DICT)

Get MessagePack dictionary entry with a DICT type, return NULL if the entry is found but the wrong type

Examples:
hurricane/security_camera/camera.c , and hurricane/security_camera/main.c .

MSGPACK_DICT_GET_OBJECT

#define MSGPACK_DICT_GET_OBJECT ( dict,
key
) gos_msgpack_get_dict_object ((const gos_msgpack_object_dict_t *)dict, key, MSGPACK_TYPE_ANY )

Return an object for the corresponding key in a dictionary

See also
gos_msgpack_get_dict_object for more info
Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_DICT_INT

#define MSGPACK_DICT_INT ( obj,
key
) MSGPACK_DICT_TYPE (obj, key, INT_OR_UINT)

Get MessagePack dictionary entry with an signed integer (unsigned and bool included) type. Use MSGPACK_DICT_TYPE(obj, key, INT) if you specifically need a signed integer. return NULL if the entry is found but the wrong type

Examples:
hurricane/arducam/camera.c , and hurricane/security_camera/camera.c .

MSGPACK_DICT_STR

#define MSGPACK_DICT_STR ( obj,
key
) ( gos_msgpack_object_str_t *) MSGPACK_DICT_TYPE (obj, key, STR)

Get MessagePack dictionary entry with a STR type, return NULL if the entry is found but the wrong type

Examples:
demo/3d_demo/main.c , demo/accelerometer_stream/main.c , demo/secure_element/commands.c , hurricane/security_camera/main.c , and network/http_server_stream/main.c .

MSGPACK_DICT_TYPE

#define MSGPACK_DICT_TYPE ( obj,
key,
type
) gos_msgpack_get_dict_object (( gos_msgpack_object_dict_t *)obj, key, MSGPACK_TYPE_ ## type)

Get MessagePack dictionary entry with a specific type, return NULL if the entry is found but the wrong type

MSGPACK_DICT_UINT

#define MSGPACK_DICT_UINT ( obj,
key
) MSGPACK_DICT_TYPE (obj, key, INT_OR_UINT)

Get MessagePack dictionary entry with a unsigned integer (signed and bool included) type, Use MSGPACK_DICT_TYPE(obj, key, UINT) if you specifically need an unsigned integer. return NULL if the entry is found but the wrong type

MSGPACK_DOUBLE

#define MSGPACK_DOUBLE ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object64_t , dbl)

Get MessagePack object as double

MSGPACK_FALSE

#define MSGPACK_FALSE   0xC2

Raw value of a MessagePack FALSE boolean typed object

MSGPACK_FLOAT

#define MSGPACK_FLOAT ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object32_t , flt)

Get MessagePack object as float

MSGPACK_FOREACH

#define MSGPACK_FOREACH ( dict_or_array,
callback,
arg
) gos_msgpack_foreach ((const gos_msgpack_object_t *)dict_or_array, callback, arg, 0)

Non-recursively iterate the key/value pairs of a dictionary or entries in array

See also
gos_msgpack_foreach() for more info

MSGPACK_FOREACH_RECURSIVE

#define MSGPACK_FOREACH_RECURSIVE ( dict_or_array,
callback,
arg
) gos_msgpack_foreach ((const gos_msgpack_object_t *)dict_or_array, callback, arg, UINT32_MAX)

Recursively iterate the key/value pairs of a dictionary or entries in array

See also
gos_msgpack_foreach() for more info
Examples:
cloud/dps_demo/main.c , and dms/messages/main.c .

MSGPACK_FREE_OBJECTS

#define MSGPACK_FREE_OBJECTS ( obj ) gos_msgpack_free_objects (obj)

De-allocate all objects assoicated with supplied object

See also
gos_msgpack_free_objects() for more info
Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_INIT_CONTEXT_WITH_BUFFER

#define MSGPACK_INIT_CONTEXT_WITH_BUFFER ( context,
_buf,
_len
)
Value:
(context)->buffer.buffer = (uint8_t*)_buf; \
(context)->buffer.ptr = (uint8_t*)_buf; \
(context)->buffer.end = (uint8_t*)_buf + _len; \
(context)->writer = NULL; \
(context)->flags = 0; \
(context)->user = NULL

Declare and initialize a gos_msgpack_context_t with the supplied buffer

Parameters
context Pointer to gos_msgpack_context_t being initialized
_buf Data buffer to initialize context with
_len Length of supplied data buffer

MSGPACK_INIT_WITH_BUFFER

#define MSGPACK_INIT_WITH_BUFFER ( name,
_buf,
_len
)
Value:
{ \
. buffer .buffer = _buf, \
.buffer.ptr = _buf, \
.buffer.end = _buf + _len, \
.writer = NULL, \
.flags = 0, \
.user = NULL \
}
uint8_t * buffer
buffer to hold 'packed' message data
Definition: gos_msgpack.h:692
Definition: gos_msgpack.h:688

Declare and initialize a gos_msgpack_context_t with the supplied buffer

Parameters
name The variable name of gos_msgpack_context_t being declared
_buf Data buffer to initialize context with
_len Length of supplied data buffer
Examples:
demo/secure_element/commands.c , hurricane/security_camera/camera.c , hurricane/security_camera/main.c , and utility/msgpack/read_write_buffer.c .

MSGPACK_INIT_WITH_WRITER

#define MSGPACK_INIT_WITH_WRITER ( name,
_writer,
_user
)
Value:
{ \
. writer = _writer, \
.user = _user, \
.flags = 0, \
.buffer.buffer = NULL, \
.buffer.ptr = NULL \
}
gos_msgpack_writer_t writer
Data writer, see gos_msgpack_writer_t.
Definition: gos_msgpack.h:696
Definition: gos_msgpack.h:688

Declare and initialize a gos_msgpack_context_t with the supplied gos_msgpack_writer_t

Parameters
name The variable name of gos_msgpack_context_t being declared
_writer MessagePack data writer, see gos_msgpack_writer_t
_user Optional user argument given to the data writer
Examples:
system/core_dump/main.c , and utility/msgpack/read_write_stream.c .

MSGPACK_INT

#define MSGPACK_INT ( obj ) gos_msgpack_get_int (obj)

Get MessagePack object as a signed 32bit value

See also
gos_gos_msgpack_get_int() for more info
Examples:
hurricane/arducam/camera.c , and hurricane/security_camera/camera.c .

MSGPACK_INT16

#define MSGPACK_INT16 ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object16_t , s)

Get MessagePack object as signed 16bit

See also
MSGPACK_INT() to automatically determine the integer bit size

MSGPACK_INT32

#define MSGPACK_INT32 ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object32_t , s)

Get MessagePack object as signed 32bit

See also
MSGPACK_INT() to automatically determine the integer bit size

MSGPACK_INT64

#define MSGPACK_INT64 ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object64_t , s)

Get MessagePack object as signed 64bit

See also
MSGPACK_LONG() to automatically determine the integer bit size

MSGPACK_INT8

#define MSGPACK_INT8 ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object8_t , s)

Get MessagePack object as signed 8bit

See also
MSGPACK_INT() to automatically determine the integer bit size

MSGPACK_IS_ARRAY

#define MSGPACK_IS_ARRAY ( obj ) _MSGPACK_IS_(obj, ARRAY)

Return true if MessagePack object is an array

Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_IS_BIN

#define MSGPACK_IS_BIN ( obj ) _MSGPACK_IS_(obj, BIN)

Return true if MessagePack object is a binary string

Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_IS_BOOL

#define MSGPACK_IS_BOOL ( obj ) _MSGPACK_IS_(obj, BOOL)

Return true if MessagePack object is a boolean

Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_IS_DICT

#define MSGPACK_IS_DICT ( obj ) _MSGPACK_IS_(obj, DICT)

Return true if MessagePack object is a dictionary (aka map)

Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_IS_DOUBLE

#define MSGPACK_IS_DOUBLE ( obj ) _MSGPACK_IS_(obj, DOUBLE)

Return true if MessagePack object is a double

MSGPACK_IS_FLOAT

#define MSGPACK_IS_FLOAT ( obj ) _MSGPACK_IS_(obj, FLOAT)

Return true if MessagePack object is a float

MSGPACK_IS_INT

Return true if MessagePack object is an signed integer

MSGPACK_IS_INT16

#define MSGPACK_IS_INT16 ( obj ) _MSGPACK_IS_(obj, INT16)

Return true if MessagePack object is a signed 16bit integer

MSGPACK_IS_INT32

#define MSGPACK_IS_INT32 ( obj ) _MSGPACK_IS_(obj, INT32)

Return true if MessagePack object is a signed 32bit integer

MSGPACK_IS_INT64

#define MSGPACK_IS_INT64 ( obj ) _MSGPACK_IS_(obj, INT64)

Return true if MessagePack object is a signed 64bit integer

MSGPACK_IS_INT8

#define MSGPACK_IS_INT8 ( obj ) _MSGPACK_IS_(obj, INT8)

Return true if MessagePack object is a signed 8bit integer

MSGPACK_IS_NIL

#define MSGPACK_IS_NIL ( obj ) _MSGPACK_IS_(obj, NIL)

Return true if MessagePack object is a NIL (i.e. NULL value)

MSGPACK_IS_STR

#define MSGPACK_IS_STR ( obj ) _MSGPACK_IS_(obj, STR)

Return true if MessagePack object is a string

Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_IS_UINT

Return true if MessagePack object is an unsigned integer

MSGPACK_IS_UINT16

#define MSGPACK_IS_UINT16 ( obj ) _MSGPACK_IS_(obj, UINT16)

Return true if MessagePack object is an unsigned 16bit integer

MSGPACK_IS_UINT32

#define MSGPACK_IS_UINT32 ( obj ) _MSGPACK_IS_(obj, UINT32)

Return true if MessagePack object is an unsigned 32bit integer

MSGPACK_IS_UINT64

#define MSGPACK_IS_UINT64 ( obj ) _MSGPACK_IS_(obj, UINT64)

Return true if MessagePack object is an unsigned 64bit integer

MSGPACK_IS_UINT8

#define MSGPACK_IS_UINT8 ( obj ) _MSGPACK_IS_(obj, UINT8)

Return true if MessagePack object is an unsigned 8bit integer

MSGPACK_LONG

#define MSGPACK_LONG ( obj,
buffer
) gos_msgpack_get_long (obj, buffer)

Get MessagePack object as a signed 64bit value

See also
gos_gos_msgpack_get_int() for more info

MSGPACK_NIL

#define MSGPACK_NIL   0xC0

Raw value of a MessagePack NIL typed object

MSGPACK_SET_WRITER

#define MSGPACK_SET_WRITER ( context,
_writer,
_user
)
Value:
context->writer = _writer; \
context->user = _user; \
context->buffer.buffer = NULL; \
context->buffer.ptr = NULL

Configure the given gos_msgpack_context_t with a gos_msgpack_writer_t

Parameters
context Pointer to previously declared/allocated gos_msgpack_context_t
_writer MessagePack data writer, see gos_msgpack_writer_t
_user Optional user argument given to the data writer

MSGPACK_STR

MSGPACK_STR_CMP

#define MSGPACK_STR_CMP ( obj,
str
) gos_msgpack_str_cmp (( gos_msgpack_object_t *)obj, str)

Compare string MessagePack object to another string

MSGPACK_STR_LENGTH

#define MSGPACK_STR_LENGTH ( obj ) ((const gos_msgpack_object_str_t *)(obj))->length

Get MessagePack object string length

MSGPACK_STR_VALUE

#define MSGPACK_STR_VALUE ( obj ) ((const gos_msgpack_object_str_t *)(obj))->data

Get string MessagePack object's string value

Note
The string value is NOT null-terminated
See also
MSGPACK_STR()

MSGPACK_TO_STR

#define MSGPACK_TO_STR ( obj,
buffer,
max_length
) gos_msgpack_to_str (( gos_msgpack_object_t *)obj, buffer, max_length)

Convert an object to a string and add to buffer

Note
The buffer must be at least 32 bytes
Examples:
cloud/dps_demo/main.c , dms/messages/main.c , and hurricane/security_camera/main.c .

MSGPACK_TRUE

#define MSGPACK_TRUE   0xC3

Raw value of a MessagePack TRUE boolean typed object

MSGPACK_UINT

#define MSGPACK_UINT ( obj ) gos_msgpack_get_uint (obj)

Get MessagePack object as an unsigned 32bit value

See also
gos_gos_msgpack_get_int() for more info
Examples:
demo/3d_demo/main.c , demo/accelerometer_stream/main.c , utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .

MSGPACK_UINT16

#define MSGPACK_UINT16 ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object16_t , u)

Get MessagePack object as unsigned 16bit

See also
MSGPACK_UINT() to automatically determine the integer bit size

MSGPACK_UINT32

#define MSGPACK_UINT32 ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object32_t , u)

Get MessagePack object as unsigned 32bit

See also
MSGPACK_UINT() to automatically determine the integer bit size

MSGPACK_UINT64

#define MSGPACK_UINT64 ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object64_t , u)

Get MessagePack object as unsigned 64bit

See also
MSGPACK_ULONG() to automatically determine the integer bit size

MSGPACK_UINT8

#define MSGPACK_UINT8 ( obj ) _MSGPACK_GET_OBJ_VALUE_(obj, gos_msgpack_object8_t , u)

Get MessagePack object as unsigned 8bit

See also
MSGPACK_UINT() to automatically determine the integer bit size

MSGPACK_ULONG

#define MSGPACK_ULONG ( obj,
buffer
) gos_msgpack_get_ulong (obj, buffer)

Get MessagePack object as an unsigned 64bit value

See also
gos_gos_msgpack_get_int() for more info
Examples:
utility/msgpack/read_write_buffer.c , and utility/msgpack/read_write_stream.c .