nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches

◆ json_common_impact_data_add()

int json_common_impact_data_add ( cJSON *  parent,
struct cloud_data_impact data,
enum json_common_op_code  op,
const char *  object_label,
cJSON **  parent_ref 
)

#include <applications/asset_tracker_v2/src/cloud/cloud_codec/json_common.h>

Encode and add Impact data to the parent object.

Parameters
[out]parentPointer to object that the encoded data is added to.
[in]dataPointer to data that is to be encoded.
[in]opOperation that is to be carried out.
[in]object_labelName of the encoded object.
[out]parent_refReference to an unallocated parent object pointer. Used when getting the pointer to the encoded data object when setting JSON_COMMON_GET_POINTER_TO_OBJECT as the opcode. The cJSON object pointed to after this function call must be manually freed after use.
Returns
0 on success. -ENODATA if the passed in data is not valid. Otherwise a negative error code is returned.