mcl_data_source.h File Reference

Data source module interface header file. More...

Include dependency graph for mcl_data_source.h:
This graph shows which files directly or indirectly include this file:

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)
 

Detailed Description

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 Documentation

Handle for data source.

Definition at line 34 of file mcl_data_source.h.

Enumeration Type Documentation

Parameters for data source.

Enumerator
MCL_DATA_SOURCE_PARAMETER_NAME 

Data source name parameter as char*.

MCL_DATA_SOURCE_PARAMETER_DESCRIPTION 

Data source description parameter as char*.

MCL_DATA_SOURCE_PARAMETER_CUSTOM_DATA 

Data source custom data parameter as mcl_json_t*.

Definition at line 39 of file mcl_data_source.h.

Function Documentation

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.

Parameters
[in]data_sourcemcl_data_source_t object handle which data_point is added to.
[in]data_pointmcl_data_point_t object handle which contains data point information.
Returns

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().

Here is the call graph for this function:

MCL_CONNECTIVITY_EXPORT void mcl_data_source_destroy ( mcl_data_source_t **  data_source)

This function destroys data_source.

Parameters
[in]data_sourceData 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[out]data_sourceData source handle which is going to be initialized.
Returns

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]data_sourceData source to set its parameter.
[in]parameterOne of the parameters listed in E_MCL_DATA_SOURCE_PARAMETER.
[in]valueNew value of the parameter.
Returns

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().

Here is the call graph for this function: