20 #define ITEM_TYPE "item" 21 #define ITEM_VERSION "1.0" 23 #define DOUBLE_BRACE_SIZE 2 24 #define DELIMITER_SIZE 1 29 #define ITEM_META_BASE_SIZE (sizeof("{\"type\":\""ITEM_TYPE"\",\"version\":\""ITEM_VERSION"\",\"payload\":}") - MCL_NULL_CHAR_SIZE) 32 #define ITEM_TIMESERIES_META_PAYLOAD_BASE_SIZE \ 33 (sizeof("{\"type\":\"standardTimeSeries\",\"version\":\"\",\"details\":{\"configurationId\":\"\"}}") - MCL_NULL_CHAR_SIZE) 36 #define ITEM_TIMESERIES_VALUE_BASE_SIZE (sizeof("{\"dataPointId\":\"\",\"value\":\"\",\"qualityCode\":\"\"}") - MCL_NULL_CHAR_SIZE) 39 #define ITEM_TIMESERIES_VALUE_LIST_BASE_SIZE (sizeof("{\"timestamp\":\"\",\"values\":[]}") + MCL_TIMESTAMP_LENGTH - 2 * MCL_NULL_CHAR_SIZE) 42 #define ITEM_EVENT_META_PAYLOAD_BASE_SIZE (sizeof("{\"type\":\"businessEvent\",\"version\":\"\"}") - MCL_NULL_CHAR_SIZE) 45 #define ITEM_EVENT_PAYLOAD_BASE_SIZE \ 46 (sizeof("{\"id\":\"\",\"timestamp\":\"\",\"severity\":,\"type\":\"\",\"version\":\"\",\"details\":}") + MCL_TIMESTAMP_LENGTH - 2 * MCL_NULL_CHAR_SIZE) 49 #define ITEM_EVENT_PAYLOAD_CORRELATION_ID_SIZE (sizeof(",\"correlationId\":\"\"") - MCL_NULL_CHAR_SIZE) 52 #define ITEM_EVENT_PAYLOAD_DESCRIPTION_SIZE (sizeof(",\"description\":\"\"") - MCL_NULL_CHAR_SIZE) 55 #define ITEM_FILE_META_PAYLOAD_BASE_SIZE \ 56 (sizeof("{\"type\":\"file\",\"version\":\"\",\"details\":{\"fileName\":\"\",\"creationDate\":\"\"}}") + MCL_TIMESTAMP_LENGTH - 2 * MCL_NULL_CHAR_SIZE) 59 #define ITEM_FILE_META_PAYLOAD_FILE_TYPE_SIZE (sizeof(",\"fileType\":\"\"") - MCL_NULL_CHAR_SIZE) 62 #define ITEM_CUSTOM_DATA_META_PAYLOAD_BASE_SIZE (sizeof("{\"type\":\"\",\"version\":\"\"}") - MCL_NULL_CHAR_SIZE) 65 #define ITEM_CUSTOM_DATA_META_PAYLOAD_DETAILS_SIZE (sizeof(",\"details\":") - MCL_NULL_CHAR_SIZE) 68 #define ITEM_DATA_SOURCE_CONFIGURATION_META_PAYLOAD_BASE_SIZE (sizeof("{\"type\":\"dataSourceConfiguration\",\"version\":\"\"}") - MCL_NULL_CHAR_SIZE) 71 #define ITEM_DATA_SOURCE_CONFIGURATION_PAYLOAD_BASE_SIZE (sizeof("{\"configurationId\":\"\",\"dataSources\":[]}") - MCL_NULL_CHAR_SIZE) 74 #define ITEM_DATA_SOURCE_BASE_SIZE (sizeof("{\"name\":\"\",\"description\":\"\",\"dataPoints\":[]}") - MCL_NULL_CHAR_SIZE) 77 #define ITEM_DATA_POINT_BASE_SIZE (sizeof("{\"id\":\"\",\"name\":\"\",\"description\":\"\",\"type\":\"\",\"unit\":\"\"}") - MCL_NULL_CHAR_SIZE) 80 #define ITEM_DATA_SOURCE_CONFIGURATION_PAYLOAD_CUSTOM_DATA_SIZE (sizeof(",\"customData\":") - MCL_NULL_CHAR_SIZE) 189 "standardTimeSeries",
192 "dataSourceConfiguration" 246 mcl_list_item_destroy_callback destroy_callback,
mcl_list_t *list);
332 MCL_DEBUG_ENTRY(
"void *item = <%p>, char **json_string = <%p>", item, json_string);
374 MCL_DEBUG_ENTRY(
"void *item = <%p>, char **json_string = <%p>", item, json_string);
405 MCL_DEBUG_ENTRY(
"event_t *event = <%p>, char **json_string = <%p>", event, json_string);
448 size += ((
file_t *) item)->payload->size;
472 MCL_DEBUG_ENTRY(
"const char *json_string = <%p>, mcl_size_t string_length = <%lu>, void **item = <%p>", json_string, (
long unsigned) string_length, item);
492 const char *payload_type =
MCL_NULL;
493 const char *payload_version =
MCL_NULL;
495 MCL_DEBUG_ENTRY(
"mcl_item_t *item = <%p>, mcl_json_t *root = <%p>", item, root);
521 payload_version = ((
custom_data_t *) item)->payload->version;
562 MCL_DEBUG_ENTRY(
"mcl_item_t *item = <%p>, mcl_json_t *payload = <%p>", item, payload);
612 MCL_DEBUG_ENTRY(
"event_t *event = <%p>, mcl_json_t *event_payload_array = <%p>", event, event_payload_array);
699 MCL_DEBUG_ENTRY(
"mcl_item_t *item = <%p>, mcl_json_t *root = <%p>", item, root);
729 MCL_DEBUG_ENTRY(
"data_source_configuration_t *data_source_configuration = <%p>, char **json_string = <%p>", data_source_configuration, json_string);
774 MCL_DEBUG_ENTRY(
"timeseries_t *timeseries = <%p>, char **json_string = <%p>", timeseries, json_string);
802 MCL_DEBUG_ENTRY(
"mcl_json_t *json_array = <%p>, mcl_list_t *list = <%p>, json_converter_callback callback = <%p>", json_array, list, callback);
807 for (index = 0; index < list->
count; ++index)
816 code = callback(node->
data, &json_object);
841 MCL_DEBUG_ENTRY(
"data_point_t *data_point = <%p>, mcl_json_t **json = <%p>", data_point, json);
907 MCL_DEBUG_ENTRY(
"data_source *data_source = <%p>, mcl_json_t **json = <%p>", data_source, json);
970 MCL_DEBUG_ENTRY(
"timeseries_value_t *timeseries_value = <%p>, mcl_json_t **json = <%p>", timeseries_value, json);
1006 MCL_DEBUG_ENTRY(
"timeseries_value_list_t *value_list = <%p>, mcl_json_t **json = <%p>", value_list, json);
1053 for (index = 0; index < list_count; ++index)
1074 MCL_VERBOSE_ENTRY(
"timeseries_value_list_t *timeseries_value_list = <%p>", timeseries_value_list);
1079 for (index = 0; index < list_count; ++index)
1098 MCL_VERBOSE_ENTRY(
"timeseries_value_t *timeseries_value = <%p>", timeseries_value);
1173 MCL_VERBOSE_ENTRY(
"data_source_configuration_payload_t *data_source_configuration = <%p>", data_source_configuration);
1180 for (index = 0; index < list_count; ++index)
1211 for (index = 0; index < list_count; ++index)
1366 MCL_DEBUG_ENTRY(
"timeseries_t *timeseries = <%p>, mcl_json_t *payload = <%p>", timeseries, payload);
1385 MCL_DEBUG_ENTRY(
"file_t *file = <%p>, mcl_json_t *payload = <%p>", file, payload);
1412 mcl_list_item_destroy_callback destroy_callback,
mcl_list_t *list)
1418 MCL_DEBUG_ENTRY(
"mcl_json_t *json_array = <%p>, json_parser_callback callback = <%p>, mcl_list_item_destroy_callback destroy_callback = <%p>, "\
1419 "mcl_list_t *list = <%p>", json_array, parser_callback, destroy_callback, list);
1424 for (index = 0; (
MCL_OK == code) && (index < array_size); ++index)
1435 code = parser_callback(item, &a_struct);
1446 destroy_callback(a_struct);
1458 MCL_DEBUG_ENTRY(
"mcl_json_t *json = <%p>, data_point_t **data_point = <%p>", json, data_point);
1527 MCL_DEBUG_ENTRY(
"mcl_json_t *json = <%p>, data_source_t **data_source = <%p>", json, data_source);
1592 MCL_DEBUG_ENTRY(
"mcl_json_t *json = <%p>, data_source_configuration_t **data_source_configuration = <%p>", json, data_source_configuration);
1600 &((*data_source_configuration)->payload->configuration_id));
1631 MCL_DEBUG_ENTRY(
"mcl_json_t *json = <%p>, const char *field_name = <%p>, char **string = <%p>", json, field_name,
string);
mcl_int32_t severity
Severity level.
Value of payload field details.
char * correlation_id
Parent event id.
End of meta field names enumeration.
#define ITEM_EVENT_PAYLOAD_CORRELATION_ID_SIZE
Custom event id of payload field.
mcl_list_t * values
List of timeseries values.
Data source configuration module header file.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_start_object(mcl_json_t *root, const char *object_name, mcl_json_t **json_object)
char * data_point_id
Data point id of the timeseries value.
mcl_size_t json_get_item_size(void *item)
custom_data_payload_t * payload
Payload of custom data.
Item type data source configuration.
Meta of meta field payload.
static mcl_error_t _add_item_meta_payload_file_details(file_t *file, mcl_json_t *payload)
mcl_error_t json_from_item_meta(void *item, char **json_string)
End of meta field values enumeration.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_initialize(E_MCL_JSON_TYPE json_type, mcl_json_t **root)
char * id
Agent-unique identifier of the data point.
Source type of payload field.
static mcl_error_t _add_event_to_payload_array(event_t *event, mcl_json_t *event_payload_array)
mcl_json_t * details
Event/alarm details.
static mcl_error_t _add_item_meta_payload_details(mcl_item_t *item, mcl_json_t *payload)
static mcl_error_t _add_item_meta_payload_timeseries_details(timeseries_t *timeseries, mcl_json_t *payload)
Configuration id of meta field payload details.
const char * mcl_file_versions[MCL_FILE_VERSION_END]
mcl_error_t(* json_converter_callback)(void *any_struct, mcl_json_t **json)
char * version
Version of the event/alarm type.
static mcl_error_t _json_from_timeseries_value(timeseries_value_t *timeseries_value, mcl_json_t **json)
mcl_error_t(* json_parser_callback)(mcl_json_t *json, void **any_struct)
Source id of payload field.
char * description
Event description.
file_payload_t * payload
Payload of file.
Total items of meta field details.
static mcl_size_t _item_payload_size_for_data_source_configuration(data_source_configuration_t *data_source_configuration)
Data source configuration version 1.0.
char timestamp[MCL_TIMESTAMP_LENGTH]
Time of values in yyyy-MM-ddTHH:mm:ss.SSSZ format.
Type of payload field data sources data points.
char * version
Version of custom data.
Description of payload field details.
Error code of payload field details.
mcl_json_t * details
Details of custom data.
mcl_list_t * data_points
List of data points in the data source.
#define MCL_DEBUG_ENTRY(...)
char * description
Description of the data source.
Name of payload field details.
#define ITEM_EVENT_META_PAYLOAD_BASE_SIZE
void(* mcl_list_item_destroy_callback)(void **item)
MCL_CORE_EXPORT mcl_error_t mcl_json_util_parse(const char *json_string, mcl_size_t buffer_size, mcl_json_t **root)
MCL_CORE_EXPORT mcl_error_t mcl_json_util_start_array(mcl_json_t *root, const char *array_name, mcl_json_t **json_array)
mcl_json_t * custom_data
Custom parameters for data source.
Timestamp of payload field.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_add_string(mcl_json_t *root, const char *object_name, const char *object_value)
static mcl_error_t _json_from_timeseries_value_list(timeseries_value_list_t *timeseries_value_list, mcl_json_t **json)
static mcl_error_t _fill_array_using_list(mcl_json_t *json_array, mcl_list_t *list, json_converter_callback callback)
Data source configuration module interface header file.
Description of payload field.
MCL_CORE_EXPORT mcl_size_t mcl_string_util_strlen(const char *buffer)
MCL_CORE_EXPORT mcl_error_t mcl_list_next(mcl_list_t *list, mcl_list_node_t **node)
static mcl_size_t _item_payload_size_for_data_point(data_point_t *data_point)
MCL_CORE_EXPORT void mcl_json_util_destroy(mcl_json_t **root)
mcl_list_t * value_lists
List of timeseries value lists.
char * name
Name of the data point.
event_payload_t * payload
Payload of event.
Meta field payload details.
MCL_CONNECTIVITY_EXPORT mcl_error_t mcl_data_point_initialize(mcl_data_point_t **data_point)
#define ITEM_DATA_SOURCE_CONFIGURATION_META_PAYLOAD_BASE_SIZE
static mcl_size_t _custom_data_meta_size(custom_data_t *custom_data)
Timeseries module header file.
End of payload field names enumeration.
const char * mcl_data_source_configuration_versions[MCL_DATA_SOURCE_CONFIGURATION_END]
timeseries_payload_t * payload
Payload of timeseries.
Event module interface header file.
#define ITEM_FILE_META_PAYLOAD_BASE_SIZE
char * description
Description of the data point.
MCL_CONNECTIVITY_EXPORT void mcl_data_source_destroy(mcl_data_source_t **data_source)
MCL_CONNECTIVITY_EXPORT void mcl_data_point_destroy(mcl_data_point_t **data_point)
static mcl_size_t _item_payload_size_for_event(event_t *event)
#define MCL_VERBOSE_LEAVE(...)
static mcl_error_t _json_from_data_source(data_source_t *data_source, mcl_json_t **json)
char * value
Value of the timeseries value.
Value of payload field values.
char * quality_code
Quality code of the timeseries value.
#define ITEM_DATA_SOURCE_CONFIGURATION_PAYLOAD_BASE_SIZE
static mcl_error_t _add_item_meta_payload(mcl_item_t *item, mcl_json_t *root)
static mcl_error_t _parse_and_get_string_value(mcl_json_t *json, const char *field_name, char **string)
static mcl_error_t _json_from_timeseries_payload(timeseries_t *timeseries, char **json_string)
static mcl_error_t _json_from_data_point(data_point_t *data_point, mcl_json_t **json)
MCL_CORE_EXPORT mcl_error_t mcl_list_add(mcl_list_t *list, void *data)
Message of payload field details.
#define ITEM_EVENT_PAYLOAD_DESCRIPTION_SIZE
Custom data of payload field.
Creation date of meta field details.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_get_object_item(mcl_json_t *json_parent, const char *child_name, mcl_json_t **json_child)
mcl_error_t json_parse_item(const char *json_string, mcl_size_t string_length, void **item)
Time series type of meta field payload.
static mcl_error_t _fill_list_using_json_array(mcl_json_t *json_array, json_parser_callback parser_callback, mcl_list_item_destroy_callback destroy_callback, mcl_list_t *list)
Quality code of payload field values.
data_source_configuration_payload_t * payload
Unit of payload field data sources data points.
static mcl_size_t _item_payload_size_for_timeseries_value(timeseries_value_t *timeseries_value)
Payload field data sources data points.
char * type
Type of the event.
char * unit
Measurement unit of the data point.
static mcl_error_t _add_item_meta_details(mcl_item_t *item, mcl_json_t *root)
#define ITEM_DATA_POINT_BASE_SIZE
char * name
Name of the data source.
#define ITEM_META_BASE_SIZE
static const char * payload_field_names[PAYLOAD_FIELD_NAMES_END]
MCL_CONNECTIVITY_EXPORT mcl_error_t mcl_data_source_initialize(mcl_data_source_t **data_source)
char * type
Type of the data point.
Payload field data sources.
#define ITEM_FILE_META_PAYLOAD_FILE_TYPE_SIZE
Details of payload field details.
MCL_CORE_EXPORT void mcl_list_reset(mcl_list_t *list)
mcl_json_t * custom_data
Custom parameters for the data point.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_add_item_to_array(mcl_json_t *root, mcl_json_t *object)
mcl_item_t item_base
Item base of event.
char * configuration_id
Configuration ID of timeseries.
Download link of payload field details.
#define ITEM_EVENT_PAYLOAD_BASE_SIZE
E_MCL_ITEM_TYPE type
Item type.
static mcl_error_t _json_from_event_payload(event_t *event, char **json_string)
MCL_CONNECTIVITY_EXPORT mcl_error_t mcl_data_source_configuration_initialize(E_MCL_DATA_SOURCE_CONFIGURATION_VERSION version, mcl_data_source_configuration_t **data_source_configuration)
Details of payload field.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_duplicate(const mcl_json_t *source_json, mcl_json_t **duplicated_json)
Event module header file.
char * remote_name
Remote name of file.
Custom data module header file.
Version of payload field.
Timestamp of meta field payload details.
Business event type of meta field payload.
#define ITEM_CUSTOM_DATA_META_PAYLOAD_DETAILS_SIZE
const char * mcl_timeseries_versions[MCL_TIMESERIES_VERSION_END]
static mcl_size_t _item_payload_size_for_timeseries(timeseries_t *timeseries)
static mcl_size_t _item_payload_size_for_data_source(data_source_t *data_source)
#define ITEM_TIMESERIES_VALUE_LIST_BASE_SIZE
static mcl_error_t _parse_data_source_configuration(mcl_json_t *json, data_source_configuration_t **data_source_configuration)
char * id
Unique identifier of the event.
Name of payload field data sources data points.
Correlation id of payload field.
static mcl_size_t _item_meta_size(mcl_item_t *item)
static mcl_error_t _json_from_data_source_configuration_payload(data_source_configuration_t *data_source_configuration, char **json_string)
MCL_CORE_EXPORT mcl_error_t mcl_json_util_to_string(mcl_json_t *root, char **json_string)
MCL_CONNECTIVITY_EXPORT void mcl_data_source_configuration_destroy(mcl_data_source_configuration_t **data_source_configuration)
#define ITEM_TIMESERIES_META_PAYLOAD_BASE_SIZE
static const char * meta_field_values[META_FIELD_VALUES_END]
Severity of payload field.
static const char * meta_field_names[META_FIELD_NAMES_END]
Version of payload field details.
mcl_list_t * data_sources
List of data sources definitions.
Data point id of payload field assets data sources data points.
Name of payload field data sources.
mcl_error_t json_from_item_payload(void *item, char **json_string)
Data point id of payload field values.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_get_array_item(mcl_json_t *array, int index, mcl_json_t **item)
#define ITEM_TIMESERIES_VALUE_BASE_SIZE
static mcl_size_t _item_payload_size_for_timeseries_value_list(timeseries_value_list_t *timeseries_value_list)
#define MCL_DEBUG_LEAVE(...)
char * type
Type of custom data.
const char * mcl_event_versions[MCL_EVENT_VERSION_END]
MCL_CORE_EXPORT mcl_error_t mcl_json_util_add_object(mcl_json_t *root, const char *object_name, mcl_json_t *object)
MCL_CORE_EXPORT mcl_error_t mcl_json_util_add_uint(mcl_json_t *root, const char *object_name, const mcl_size_t number)
#define MCL_VERBOSE_ENTRY(...)
#define ITEM_CUSTOM_DATA_META_PAYLOAD_BASE_SIZE
#define ITEM_DATA_SOURCE_BASE_SIZE
File type of meta field details.
File name of meta field details.
char timestamp[MCL_TIMESTAMP_LENGTH]
Creation time of the event in ISO format.
Type of meta field payload.
Data source configuration type of meta field payload.
Duration of meta field payload details.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_get_array_size(mcl_json_t *array, mcl_size_t *size)
#define ITEM_DATA_SOURCE_CONFIGURATION_PAYLOAD_CUSTOM_DATA_SIZE
static mcl_error_t _parse_data_point(mcl_json_t *json, data_point_t **data_point)
char * creation_date
Creation date of file.
MCL_JSON_NON_EXISTING_CHILD
Version of meta field payload.
mcl_uint32_t version
Item version.
char * configuration_id
Unique identifier of the configuration.
MCL_CORE_EXPORT mcl_error_t mcl_json_util_get_string(mcl_json_t *json, char **string_value)
#define DOUBLE_BRACE_SIZE
Configuration id of payload field.
static mcl_error_t _parse_data_source(mcl_json_t *json, data_source_t **data_source)
File type of meta field payload.