Write
APIs for packing data into a MessagePack message. More...
Detailed Description
APIs for packing data into a MessagePack message.
Function Documentation
◆ gos_msgpack_get_user_context()
| gos_result_t gos_msgpack_get_user_context | ( | const gos_msgpack_object_t * |
root_obj,
|
| void ** |
context_ptr
|
||
| ) |
Internal use only
- Parameters
-
root_objcontext_ptr
◆ gos_msgpack_set_user_context()
| gos_result_t gos_msgpack_set_user_context | ( | gos_msgpack_object_t * |
root_obj,
|
| void * |
context,
|
||
| bool |
auto_free
|
||
| ) |
Internal use only
- Parameters
-
root_objcontextauto_free
◆ 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
-
contextPreviously initialize gos_msgpack_context_t sizeNumber 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
-
contextPreviously initialize gos_msgpack_context_t dataBinary string value to write lengthLength 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
-
contextPreviously initialize gos_msgpack_context_t sizeSize of the binary string value that will be immediately follow
- Returns
- Result of function, see gos_result_t
◆ 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
-
contextPreviously initialize gos_msgpack_context_t valueBoolean 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
-
contextPreviously initialize gos_msgpack_context_t value_contextPreviously 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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value array_countNumber of entries that will go in new array within the current dictionary
- Returns
- Result of function, see gos_result_t
◆ 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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value valuebinary string value lengthLength of binary string
- 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_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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value valueBoolean value
- Returns
- Result of function, see gos_result_t
- Examples:
- dms/messages/main.c , and dms/telemetry/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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value value_contextPreviously 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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value dict_countNumber of key/value pairs that will go in new dictionary within the current dictionary
- 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_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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value valuedouble 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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value valuefloat value
- Returns
- Result of function, see gos_result_t
◆ 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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value valuesigned integer value
- Returns
- Result of function, see gos_result_t
◆ 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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value valuesigned 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
-
contextPreviously initialize gos_msgpack_context_t sizeNumber of dictionary key/values that will immediately follow
- Returns
- Result of function, see gos_result_t
◆ 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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary 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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value valuestring value
- Returns
- Result of function, see gos_result_t
◆ 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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value valueunsigned integer value
- 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_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
-
contextPreviously initialize gos_msgpack_context_t keyDictionary key of written value valueunsigned integer value
- Returns
- Result of function, see gos_result_t
◆ 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
-
contextPreviously initialize gos_msgpack_context_t valuedouble 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
-
contextPreviously initialize gos_msgpack_context_t valuefloat 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
-
contextPreviously initialize gos_msgpack_context_t valuesigned 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
-
contextPreviously initialize gos_msgpack_context_t valuesigned 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
-
contextPreviously 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
-
contextPreviously initialize gos_msgpack_context_t strString value to write
- Returns
- Result of function, see gos_result_t
◆ 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
-
contextPreviously initialize gos_msgpack_context_t sizeSize 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
-
contextPreviously initialize gos_msgpack_context_t valueunsigned integer value
- Returns
- Result of function, see gos_result_t
◆ 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
-
contextPreviously initialize gos_msgpack_context_t valueunsigned integer value
- Returns
- Result of function, see gos_result_t