Data source module interface header file. More...
#include "mcl_connectivity/mcl_data_point.h"
Go to the source code of this file.
Typedefs | |
typedef struct mcl_data_source_t | mcl_data_source_t |
Enumerations | |
enum | E_MCL_DATA_SOURCE_PARAMETER { MCL_DATA_SOURCE_PARAMETER_NAME, MCL_DATA_SOURCE_PARAMETER_DESCRIPTION, MCL_DATA_SOURCE_PARAMETER_CUSTOM_DATA } |
Functions | |
MCL_CONNECTIVITY_EXPORT mcl_error_t | mcl_data_source_initialize (mcl_data_source_t **data_source) |
MCL_CONNECTIVITY_EXPORT mcl_error_t | mcl_data_source_set_parameter (mcl_data_source_t *data_source, E_MCL_DATA_SOURCE_PARAMETER parameter, const void *value) |
MCL_CONNECTIVITY_EXPORT mcl_error_t | mcl_data_source_add_data_point (mcl_data_source_t *data_source, mcl_data_point_t *data_point) |
MCL_CONNECTIVITY_EXPORT void | mcl_data_source_destroy (mcl_data_source_t **data_source) |
Data source module interface header file.
Data source is a logical group that holds so called data points. See mcl_connectivity/mcl_data_point.h for data point description.
This module enables the agent to initialize a data source structure using mcl_data_source_initialize function. Following initialization, the parameters of this data source can be set using mcl_data_source_set_parameter function. Then, data point(s) can be added to the data source using mcl_data_source_add_data_point function. Finally, the data source can be added to data source configuration using mcl_data_source_configuration_add_data_source function.
If the data source is added to a data source configuration, mcl_data_source_configuration_t will handle the destroy operation of the data source and the agent does not need to take any action. Otherwise, mcl_data_source_destroy function is used to destroy data source.
Check the example file "mcl_connectivity/examples/dsc_upload.c".
Definition in file mcl_data_source.h.
typedef struct mcl_data_source_t mcl_data_source_t |
Handle for data source.
Definition at line 34 of file mcl_data_source.h.
Parameters for data source.
Definition at line 39 of file mcl_data_source.h.
MCL_CONNECTIVITY_EXPORT mcl_error_t mcl_data_source_add_data_point | ( | mcl_data_source_t * | data_source, |
mcl_data_point_t * | data_point | ||
) |
This function adds data_point
to data_source
.
[in] | data_source | mcl_data_source_t object handle which data_point is added to. |
[in] | data_point | mcl_data_point_t object handle which contains data point information. |
data_source
or data_point
is null. data_source
has no space for a new data point. Definition at line 87 of file data_source.c.
References MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, and mcl_list_add().
MCL_CONNECTIVITY_EXPORT void mcl_data_source_destroy | ( | mcl_data_source_t ** | data_source | ) |
This function destroys data_source
.
[in] | data_source | Data source handle which is going to be destroyed. |
Definition at line 147 of file data_source.c.
References mcl_data_point_destroy(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, mcl_json_util_destroy(), mcl_list_destroy_with_content(), and MCL_NULL.
Referenced by _parse_data_source(), _parse_data_source_configuration(), mcl_data_source_configuration_destroy(), and mcl_data_source_initialize().
MCL_CONNECTIVITY_EXPORT mcl_error_t mcl_data_source_initialize | ( | mcl_data_source_t ** | data_source | ) |
This function creates and initializes a data struct of mcl_data_source_t.
[out] | data_source | Data source handle which is going to be initialized. |
data_source
is null. Definition at line 14 of file data_source.c.
References MCL_ASSERT_NOT_NULL, mcl_data_source_destroy(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, mcl_list_initialize(), MCL_NEW, MCL_NULL, MCL_OK, and MCL_OUT_OF_MEMORY.
Referenced by _parse_data_source().
MCL_CONNECTIVITY_EXPORT mcl_error_t mcl_data_source_set_parameter | ( | mcl_data_source_t * | data_source, |
E_MCL_DATA_SOURCE_PARAMETER | parameter, | ||
const void * | value | ||
) |
This function is used to set a parameter of a data source.
[in] | data_source | Data source to set its parameter. |
[in] | parameter | One of the parameters listed in E_MCL_DATA_SOURCE_PARAMETER. |
[in] | value | New value of the parameter . |
data_source
or value
is NULL. parameter
is invalid. Definition at line 51 of file data_source.c.
References MCL_ASSERT_NOT_NULL, MCL_DATA_SOURCE_PARAMETER_CUSTOM_DATA, MCL_DATA_SOURCE_PARAMETER_DESCRIPTION, MCL_DATA_SOURCE_PARAMETER_NAME, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, MCL_INVALID_PARAMETER, mcl_json_util_destroy(), mcl_json_util_duplicate(), and mcl_string_util_reset().