30 DEBUG_ENTRY(
"const char *version = <%p>, data_source_configuration_t **data_source_configuration = <%p>", version, data_source_configuration)
35 MCL_NEW(*data_source_configuration);
38 (*data_source_configuration)->meta.content_id =
MCL_NULL;
39 (*data_source_configuration)->meta.type =
MCL_NULL;
40 (*data_source_configuration)->meta.version =
MCL_NULL;
41 (*data_source_configuration)->meta.details.routing =
MCL_NULL;
42 (*data_source_configuration)->meta.payload.type =
MCL_NULL;
43 (*data_source_configuration)->meta.payload.version =
MCL_NULL;
44 (*data_source_configuration)->payload.configuration_id =
MCL_NULL;
45 (*data_source_configuration)->payload.data_sources =
MCL_NULL;
63 DEBUG_ENTRY(
"mcl_data_source_configuration_t *data_source_configuration = <%p>, const char *name = <%p>, const char *description = <%p>, mcl_json_t *custom_data = <%p>, mcl_data_source_t **data_source = <%p>",
64 data_source_configuration, name, description, custom_data, data_source)
77 (*data_source)->description =
MCL_NULL;
78 (*data_source)->data_points =
MCL_NULL;
79 (*data_source)->custom_data =
MCL_NULL;
100 ok = ok && (MCL_OK == (code =
list_add(data_source_configuration->payload.data_sources, *data_source)));
105 MCL_DEBUG(
"String or list initialize operation(s) has been failed! Clearing strings.");
116 DEBUG_ENTRY(
"mcl_data_source_t *data_source = <%p>, const char *id = <%p>, const char *name = <%p>, const char *description = <%p>, const char *type = <%p>, const char *unit = <%p>, mcl_json_t *custom_data = <%p>",
117 data_source,
id, name, description, type, unit, custom_data)
164 ok = ok && (MCL_OK == (code =
list_add(data_source->data_points, data_point)));
169 MCL_DEBUG(
"String or list initialize operation(s) has been failed! Clearing strings.");
179 DEBUG_ENTRY(
"mcl_data_source_configuration_t *data_source_configuration = <%p>, char **id = <%p>", data_source_configuration,
id)
187 code =
string_initialize(data_source_configuration->payload.configuration_id, &configuration_id_local);
190 *
id = configuration_id_local->
buffer;
201 DEBUG_ENTRY(
"data_source_configuration_t **data_source_configuration = <%p>", data_source_configuration)
203 if (
MCL_NULL != *data_source_configuration)
208 string_destroy(&((*data_source_configuration)->meta.payload.type));
209 string_destroy(&((*data_source_configuration)->meta.payload.version));
210 string_destroy(&((*data_source_configuration)->payload.configuration_id));
212 MCL_FREE(*data_source_configuration);
220 DEBUG_ENTRY(
"const char *version = <%p>, data_source_configuration_t *data_source_configuration = <%p>", version, data_source_configuration)
241 DEBUG_ENTRY(
"data_source_configuration_t *data_source_configuration = <%p>", data_source_configuration)
255 DEBUG_ENTRY(
"data_source_t **data_source = <%p>", data_source)
268 DEBUG_ENTRY(
"data_point_t **data_point = <%p>", data_point)
struct mcl_json_t mcl_json_t
This struct is used for json handling.
void string_destroy(string_t **string)
Destroys the allocated resources of the string.
Data source configuration module header file.
void data_source_configuration_destroy(data_source_configuration_t **data_source_configuration)
Memory module header file.
string_t * name
Name of the data point.
struct mcl_data_source_configuration_t mcl_data_source_configuration_t
Json util module header file.
list_t * data_sources
List of data sources definitions.
E_MCL_ERROR_CODE string_initialize_new(const char *value, mcl_size_t value_length, string_t **string)
Initializes a new string_t object with the given value and length.
char * buffer
Buffer of string handle.
This struct is used for building data_source_configuration.data_points structure. ...
#define ASSERT_NOT_NULL(argument)
#define MCL_FALSE
MCL bool type.
Log utility module header file.
Data source configuration module interface header file.
E_MCL_ERROR_CODE list_initialize(list_t **list)
Initializes the list.
Current version of meta field.
E_MCL_ERROR_CODE
MCL Error code definitions. Every function returning an error code uses this enum values...
void json_util_destroy(json_t **root)
This function destroys root.
E_MCL_ERROR_CODE mcl_data_source_configuration_add_data_point(mcl_data_source_t *data_source, const char *id, const char *name, const char *description, const char *type, const char *unit, mcl_json_t *custom_data)
data_source_configuration_payload_t payload
Payload of data_source_configuration.
string_t * type
Type of data point.
static void _destroy_data_point(data_point_t **data_point)
E_MCL_ERROR_CODE mcl_data_source_configuration_get_id(mcl_data_source_configuration_t *data_source_configuration, char **id)
E_MCL_ERROR_CODE random_generate_guid(string_t **guid)
Generates random guid.
#define ASSERT_CODE_MESSAGE(condition, return_code,...)
Definitions module header file.
static void _destroy_data_source(data_source_t **data_source)
static E_MCL_ERROR_CODE _initialize_payload(data_source_configuration_t *data_source_configuration)
E_MCL_ERROR_CODE string_initialize(const string_t *other, string_t **string)
Initializes an string_t object with another one.
item_meta_t meta
Meta of data source configuration.
mcl_json_t * custom_data
Custom data.
string_t meta_field_values[META_FIELD_VALUES_END]
E_MCL_ERROR_CODE json_util_duplicate(const json_t *source_json, mcl_bool_t with_children, json_t **duplicated_json)
This function duplicates source_json as duplicated_json.
This struct is used for building data_source_configuration.data_source structure. ...
string_t * description
Description of the data point.
void list_destroy_with_content(list_t **list, list_item_destroy_callback callback)
To destroy the list and its items with a given callback function.
E_MCL_ERROR_CODE string_initialize_static(const char *value, mcl_size_t value_length, string_t **string)
Initializes a static string_t object with the given value and length.
E_MCL_ERROR_CODE data_source_configuration_initialize(const char *version, data_source_configuration_t **data_source_configuration)
string_t * unit
Measurement unit of the data point.
Random module header file.
E_MCL_ERROR_CODE list_add(list_t *list, void *data)
Adds a new list item.
string_t * configuration_id
Unique identifier of the configuration.
mcl_list_item_destroy_callback list_item_destroy_callback
Data source configuration type of meta field payload.
static E_MCL_ERROR_CODE _initialize_meta(const char *version, data_source_configuration_t *data_source_configuration)
struct mcl_data_source_t mcl_data_source_t
E_MCL_ERROR_CODE mcl_data_source_configuration_add_data_source(mcl_data_source_configuration_t *data_source_configuration, const char *name, const char *description, mcl_json_t *custom_data, mcl_data_source_t **data_source)
string_t * id
Agent-unique identifier of the data point.