json.c File Reference

Json module implementation file. More...

Include dependency graph for json.c:

Go to the source code of this file.

Macros

#define ITEM_TYPE   "item"
 
#define ITEM_VERSION   "1.0"
 
#define DOUBLE_BRACE_SIZE   2
 
#define DELIMITER_SIZE   1
 
#define ITEM_META_BASE_SIZE   (sizeof("{\"type\":\""ITEM_TYPE"\",\"version\":\""ITEM_VERSION"\",\"payload\":}") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_TIMESERIES_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"standardTimeSeries\",\"version\":\"\",\"details\":{\"configurationId\":\"\"}}") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_TIMESERIES_VALUE_BASE_SIZE   (sizeof("{\"dataPointId\":\"\",\"value\":\"\",\"qualityCode\":\"\"}") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_TIMESERIES_VALUE_LIST_BASE_SIZE   (sizeof("{\"timestamp\":\"\",\"values\":[]}") + MCL_TIMESTAMP_LENGTH - 2 * MCL_NULL_CHAR_SIZE)
 
#define ITEM_EVENT_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"businessEvent\",\"version\":\"\"}") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_EVENT_PAYLOAD_BASE_SIZE   (sizeof("{\"id\":\"\",\"timestamp\":\"\",\"severity\":,\"type\":\"\",\"version\":\"\",\"details\":}") + MCL_TIMESTAMP_LENGTH - 2 * MCL_NULL_CHAR_SIZE)
 
#define ITEM_EVENT_PAYLOAD_CORRELATION_ID_SIZE   (sizeof(",\"correlationId\":\"\"") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_EVENT_PAYLOAD_DESCRIPTION_SIZE   (sizeof(",\"description\":\"\"") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_FILE_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"file\",\"version\":\"\",\"details\":{\"fileName\":\"\",\"creationDate\":\"\"}}") + MCL_TIMESTAMP_LENGTH - 2 * MCL_NULL_CHAR_SIZE)
 
#define ITEM_FILE_META_PAYLOAD_FILE_TYPE_SIZE   (sizeof(",\"fileType\":\"\"") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_CUSTOM_DATA_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"\",\"version\":\"\"}") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_CUSTOM_DATA_META_PAYLOAD_DETAILS_SIZE   (sizeof(",\"details\":") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_DATA_SOURCE_CONFIGURATION_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"dataSourceConfiguration\",\"version\":\"\"}") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_DATA_SOURCE_CONFIGURATION_PAYLOAD_BASE_SIZE   (sizeof("{\"configurationId\":\"\",\"dataSources\":[]}") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_DATA_SOURCE_BASE_SIZE   (sizeof("{\"name\":\"\",\"description\":\"\",\"dataPoints\":[]}") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_DATA_POINT_BASE_SIZE   (sizeof("{\"id\":\"\",\"name\":\"\",\"description\":\"\",\"type\":\"\",\"unit\":\"\"}") - MCL_NULL_CHAR_SIZE)
 
#define ITEM_DATA_SOURCE_CONFIGURATION_PAYLOAD_CUSTOM_DATA_SIZE   (sizeof(",\"customData\":") - MCL_NULL_CHAR_SIZE)
 

Typedefs

typedef mcl_error_t(* json_converter_callback) (void *any_struct, mcl_json_t **json)
 
typedef mcl_error_t(* json_parser_callback) (mcl_json_t *json, void **any_struct)
 

Enumerations

enum  E_META_FIELD_NAMES {
  META_FIELD_TYPE, META_FIELD_VERSION, META_FIELD_PAYLOAD_META, META_FIELD_PAYLOAD,
  META_FIELD_PAYLOAD_TYPE, META_FIELD_PAYLOAD_VERSION, META_FIELD_PAYLOAD_DETAILS, META_FIELD_PAYLOAD_DETAILS_CONFIGURATION_ID,
  META_FIELD_DETAILS, META_FIELD_PAYLOAD_DETAILS_FILE_NAME, META_FIELD_PAYLOAD_DETAILS_FILE_TYPE, META_FIELD_PAYLOAD_DETAILS_CREATION_DATE,
  META_FIELD_DETAILS_TOTAL_ITEMS, META_FIELD_PAYLOAD_DETAILS_TIMESTAMP, META_FIELD_PAYLOAD_DETAILS_DURATION, META_FIELD_NAMES_END
}
 
enum  E_META_FIELD_VALUES {
  META_FIELD_PAYLOAD_TYPE_TIME_SERIES, META_FIELD_PAYLOAD_TYPE_BUSINESS_EVENT, META_FIELD_PAYLOAD_TYPE_FILE, META_FIELD_PAYLOAD_TYPE_DATA_SOURCE_CONFIGURATION,
  META_FIELD_VALUES_END
}
 
enum  E_PAYLOAD_FIELD_NAMES {
  PAYLOAD_FIELD_TIMESTAMP, PAYLOAD_FIELD_VALUES, PAYLOAD_FIELD_VALUES_DATA_POINT_ID, PAYLOAD_FIELD_VALUES_VALUE,
  PAYLOAD_FIELD_VALUES_QUALITY_CODE, PAYLOAD_FIELD_ID, PAYLOAD_FIELD_CUSTOM_EVENT_ID, PAYLOAD_FIELD_CORRELATION_ID,
  PAYLOAD_FIELD_SOURCE_TYPE, PAYLOAD_FIELD_SOURCE_ID, PAYLOAD_FIELD_SEVERITY, PAYLOAD_FIELD_DESCRIPTION,
  PAYLOAD_FIELD_STATUS, PAYLOAD_FIELD_TYPE, PAYLOAD_FIELD_VERSION, PAYLOAD_FIELD_CUSTOM_DATA,
  PAYLOAD_FIELD_DETAILS, PAYLOAD_FIELD_DETAILS_MESSAGE, PAYLOAD_FIELD_DETAILS_ERROR_CODE, PAYLOAD_FIELD_DETAILS_DETAILS,
  PAYLOAD_FIELD_DETAILS_VALUE, PAYLOAD_FIELD_DETAILS_DOWNLOAD_LINK, PAYLOAD_FIELD_DETAILS_NAME, PAYLOAD_FIELD_DETAILS_VERSION,
  PAYLOAD_FIELD_DETAILS_DESCRIPTION, PAYLOAD_FIELD_CONFIGURATION_ID, PAYLOAD_FIELD_DATA_SOURCES, PAYLOAD_FIELD_DATA_SOURCES_NAME,
  PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS, PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_ID, PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_NAME, PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_TYPE,
  PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_UNIT, PAYLOAD_FIELD_NAMES_END
}
 

Functions

static mcl_error_t _fill_array_using_list (mcl_json_t *json_array, mcl_list_t *list, json_converter_callback callback)
 
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)
 
static mcl_error_t _add_item_meta_payload (mcl_item_t *item, mcl_json_t *root)
 
static mcl_error_t _add_item_meta_payload_details (mcl_item_t *item, mcl_json_t *payload)
 
static mcl_error_t _add_item_meta_details (mcl_item_t *item, mcl_json_t *root)
 
static mcl_error_t _add_event_to_payload_array (event_t *event, mcl_json_t *event_payload_array)
 
static mcl_error_t _json_from_event_payload (event_t *event, char **json_string)
 
static mcl_error_t _json_from_data_source_configuration_payload (data_source_configuration_t *data_source_configuration, char **json_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)
 
static mcl_error_t _json_from_data_source (data_source_t *data_source, mcl_json_t **json)
 
static mcl_error_t _json_from_timeseries_value (timeseries_value_t *timeseries_value, mcl_json_t **json)
 
static mcl_error_t _json_from_timeseries_value_list (timeseries_value_list_t *timeseries_value_list, mcl_json_t **json)
 
static mcl_size_t _item_meta_size (mcl_item_t *item)
 
static mcl_size_t _custom_data_meta_size (custom_data_t *custom_data)
 
static mcl_size_t _item_payload_size_for_timeseries (timeseries_t *timeseries)
 
static mcl_size_t _item_payload_size_for_timeseries_value_list (timeseries_value_list_t *timeseries_value_list)
 
static mcl_size_t _item_payload_size_for_timeseries_value (timeseries_value_t *timeseries_value)
 
static mcl_size_t _item_payload_size_for_event (event_t *event)
 
static mcl_size_t _item_payload_size_for_data_source_configuration (data_source_configuration_t *data_source_configuration)
 
static mcl_size_t _item_payload_size_for_data_source (data_source_t *data_source)
 
static mcl_size_t _item_payload_size_for_data_point (data_point_t *data_point)
 
static mcl_error_t _add_item_meta_payload_timeseries_details (timeseries_t *timeseries, mcl_json_t *payload)
 
static mcl_error_t _add_item_meta_payload_file_details (file_t *file, mcl_json_t *payload)
 
static mcl_error_t _parse_and_get_string_value (mcl_json_t *json, const char *field_name, char **string)
 
static mcl_error_t _parse_data_point (mcl_json_t *json, data_point_t **data_point)
 
static mcl_error_t _parse_data_source (mcl_json_t *json, data_source_t **data_source)
 
static mcl_error_t _parse_data_source_configuration (mcl_json_t *json, data_source_configuration_t **data_source_configuration)
 
mcl_error_t json_from_item_meta (void *item, char **json_string)
 
mcl_error_t json_from_item_payload (void *item, char **json_string)
 
mcl_size_t json_get_item_size (void *item)
 
mcl_error_t json_parse_item (const char *json_string, mcl_size_t string_length, void **item)
 

Variables

static const char * meta_field_names [META_FIELD_NAMES_END]
 
static const char * meta_field_values [META_FIELD_VALUES_END]
 
static const char * payload_field_names [PAYLOAD_FIELD_NAMES_END]
 

Detailed Description

Json module implementation file.

Definition in file json.c.

Macro Definition Documentation

#define ITEM_CUSTOM_DATA_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"\",\"version\":\"\"}") - MCL_NULL_CHAR_SIZE)

Definition at line 62 of file json.c.

Referenced by _custom_data_meta_size().

#define ITEM_CUSTOM_DATA_META_PAYLOAD_DETAILS_SIZE   (sizeof(",\"details\":") - MCL_NULL_CHAR_SIZE)

Definition at line 65 of file json.c.

Referenced by _custom_data_meta_size().

#define ITEM_DATA_POINT_BASE_SIZE   (sizeof("{\"id\":\"\",\"name\":\"\",\"description\":\"\",\"type\":\"\",\"unit\":\"\"}") - MCL_NULL_CHAR_SIZE)

Definition at line 77 of file json.c.

Referenced by _item_payload_size_for_data_point().

#define ITEM_DATA_SOURCE_BASE_SIZE   (sizeof("{\"name\":\"\",\"description\":\"\",\"dataPoints\":[]}") - MCL_NULL_CHAR_SIZE)

Definition at line 74 of file json.c.

Referenced by _item_payload_size_for_data_source().

#define ITEM_DATA_SOURCE_CONFIGURATION_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"dataSourceConfiguration\",\"version\":\"\"}") - MCL_NULL_CHAR_SIZE)

Definition at line 68 of file json.c.

Referenced by _item_meta_size().

#define ITEM_DATA_SOURCE_CONFIGURATION_PAYLOAD_BASE_SIZE   (sizeof("{\"configurationId\":\"\",\"dataSources\":[]}") - MCL_NULL_CHAR_SIZE)

Definition at line 71 of file json.c.

Referenced by _item_payload_size_for_data_source_configuration().

#define ITEM_DATA_SOURCE_CONFIGURATION_PAYLOAD_CUSTOM_DATA_SIZE   (sizeof(",\"customData\":") - MCL_NULL_CHAR_SIZE)

Definition at line 80 of file json.c.

Referenced by _item_payload_size_for_data_point(), and _item_payload_size_for_data_source().

#define ITEM_EVENT_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"businessEvent\",\"version\":\"\"}") - MCL_NULL_CHAR_SIZE)

Definition at line 42 of file json.c.

Referenced by _item_meta_size().

#define ITEM_EVENT_PAYLOAD_BASE_SIZE   (sizeof("{\"id\":\"\",\"timestamp\":\"\",\"severity\":,\"type\":\"\",\"version\":\"\",\"details\":}") + MCL_TIMESTAMP_LENGTH - 2 * MCL_NULL_CHAR_SIZE)

Definition at line 45 of file json.c.

Referenced by _item_payload_size_for_event().

#define ITEM_EVENT_PAYLOAD_CORRELATION_ID_SIZE   (sizeof(",\"correlationId\":\"\"") - MCL_NULL_CHAR_SIZE)

Definition at line 49 of file json.c.

Referenced by _item_payload_size_for_event().

#define ITEM_EVENT_PAYLOAD_DESCRIPTION_SIZE   (sizeof(",\"description\":\"\"") - MCL_NULL_CHAR_SIZE)

Definition at line 52 of file json.c.

Referenced by _item_payload_size_for_event().

#define ITEM_FILE_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"file\",\"version\":\"\",\"details\":{\"fileName\":\"\",\"creationDate\":\"\"}}") + MCL_TIMESTAMP_LENGTH - 2 * MCL_NULL_CHAR_SIZE)

Definition at line 55 of file json.c.

Referenced by _item_meta_size().

#define ITEM_FILE_META_PAYLOAD_FILE_TYPE_SIZE   (sizeof(",\"fileType\":\"\"") - MCL_NULL_CHAR_SIZE)

Definition at line 59 of file json.c.

Referenced by _item_meta_size().

#define ITEM_META_BASE_SIZE   (sizeof("{\"type\":\""ITEM_TYPE"\",\"version\":\""ITEM_VERSION"\",\"payload\":}") - MCL_NULL_CHAR_SIZE)

Definition at line 29 of file json.c.

Referenced by _item_meta_size().

#define ITEM_TIMESERIES_META_PAYLOAD_BASE_SIZE   (sizeof("{\"type\":\"standardTimeSeries\",\"version\":\"\",\"details\":{\"configurationId\":\"\"}}") - MCL_NULL_CHAR_SIZE)

Definition at line 32 of file json.c.

Referenced by _item_meta_size().

#define ITEM_TIMESERIES_VALUE_BASE_SIZE   (sizeof("{\"dataPointId\":\"\",\"value\":\"\",\"qualityCode\":\"\"}") - MCL_NULL_CHAR_SIZE)

Definition at line 36 of file json.c.

Referenced by _item_payload_size_for_timeseries_value().

#define ITEM_TIMESERIES_VALUE_LIST_BASE_SIZE   (sizeof("{\"timestamp\":\"\",\"values\":[]}") + MCL_TIMESTAMP_LENGTH - 2 * MCL_NULL_CHAR_SIZE)

Definition at line 39 of file json.c.

Referenced by _item_payload_size_for_timeseries_value_list().

#define ITEM_TYPE   "item"

Definition at line 20 of file json.c.

Referenced by json_from_item_meta().

#define ITEM_VERSION   "1.0"

Definition at line 21 of file json.c.

Referenced by json_from_item_meta().

Typedef Documentation

typedef mcl_error_t(* json_converter_callback) (void *any_struct, mcl_json_t **json)

Definition at line 236 of file json.c.

typedef mcl_error_t(* json_parser_callback) (mcl_json_t *json, void **any_struct)

Definition at line 239 of file json.c.

Enumeration Type Documentation

This is used with meta_field_names array to get the related string. ex: meta_field_names[META_FIELD_TYPE] returns the string of "type".

Enumerator
META_FIELD_TYPE 

Type of meta field.

META_FIELD_VERSION 

Version of meta field.

META_FIELD_PAYLOAD_META 

Meta of meta field payload.

META_FIELD_PAYLOAD 

Meta field payload.

META_FIELD_PAYLOAD_TYPE 

Type of meta field payload.

META_FIELD_PAYLOAD_VERSION 

Version of meta field payload.

META_FIELD_PAYLOAD_DETAILS 

Meta field payload details.

META_FIELD_PAYLOAD_DETAILS_CONFIGURATION_ID 

Configuration id of meta field payload details.

META_FIELD_DETAILS 

Meta field details.

META_FIELD_PAYLOAD_DETAILS_FILE_NAME 

File name of meta field details.

META_FIELD_PAYLOAD_DETAILS_FILE_TYPE 

File type of meta field details.

META_FIELD_PAYLOAD_DETAILS_CREATION_DATE 

Creation date of meta field details.

META_FIELD_DETAILS_TOTAL_ITEMS 

Total items of meta field details.

META_FIELD_PAYLOAD_DETAILS_TIMESTAMP 

Timestamp of meta field payload details.

META_FIELD_PAYLOAD_DETAILS_DURATION 

Duration of meta field payload details.

META_FIELD_NAMES_END 

End of meta field names enumeration.

Definition at line 86 of file json.c.

This is used with meta_field_values array to get the related string. ex: meta_field_values[META_FIELD_TYPE_ITEM] returns the string of "item". Please refer to the MindConnectAPI Specifications for detailed info.

Enumerator
META_FIELD_PAYLOAD_TYPE_TIME_SERIES 

Time series type of meta field payload.

META_FIELD_PAYLOAD_TYPE_BUSINESS_EVENT 

Business event type of meta field payload.

META_FIELD_PAYLOAD_TYPE_FILE 

File type of meta field payload.

META_FIELD_PAYLOAD_TYPE_DATA_SOURCE_CONFIGURATION 

Data source configuration type of meta field payload.

META_FIELD_VALUES_END 

End of meta field values enumeration.

Definition at line 111 of file json.c.

This is used with payload_field_names to get the related string. ex: payload_field_names[PAYLOAD_FIELD_TIMESTAMP] returns the string of "timeStamp".

Enumerator
PAYLOAD_FIELD_TIMESTAMP 

Timestamp of payload field.

PAYLOAD_FIELD_VALUES 

Payload field values.

PAYLOAD_FIELD_VALUES_DATA_POINT_ID 

Data point id of payload field values.

PAYLOAD_FIELD_VALUES_VALUE 

Value of payload field values.

PAYLOAD_FIELD_VALUES_QUALITY_CODE 

Quality code of payload field values.

PAYLOAD_FIELD_ID 

Payload field id.

PAYLOAD_FIELD_CUSTOM_EVENT_ID 

Custom event id of payload field.

PAYLOAD_FIELD_CORRELATION_ID 

Correlation id of payload field.

PAYLOAD_FIELD_SOURCE_TYPE 

Source type of payload field.

PAYLOAD_FIELD_SOURCE_ID 

Source id of payload field.

PAYLOAD_FIELD_SEVERITY 

Severity of payload field.

PAYLOAD_FIELD_DESCRIPTION 

Description of payload field.

PAYLOAD_FIELD_STATUS 

Status of payload field.

PAYLOAD_FIELD_TYPE 

Type of payload field.

PAYLOAD_FIELD_VERSION 

Version of payload field.

PAYLOAD_FIELD_CUSTOM_DATA 

Custom data of payload field.

PAYLOAD_FIELD_DETAILS 

Details of payload field.

PAYLOAD_FIELD_DETAILS_MESSAGE 

Message of payload field details.

PAYLOAD_FIELD_DETAILS_ERROR_CODE 

Error code of payload field details.

PAYLOAD_FIELD_DETAILS_DETAILS 

Details of payload field details.

PAYLOAD_FIELD_DETAILS_VALUE 

Value of payload field details.

PAYLOAD_FIELD_DETAILS_DOWNLOAD_LINK 

Download link of payload field details.

PAYLOAD_FIELD_DETAILS_NAME 

Name of payload field details.

PAYLOAD_FIELD_DETAILS_VERSION 

Version of payload field details.

PAYLOAD_FIELD_DETAILS_DESCRIPTION 

Description of payload field details.

PAYLOAD_FIELD_CONFIGURATION_ID 

Configuration id of payload field.

PAYLOAD_FIELD_DATA_SOURCES 

Payload field data sources.

PAYLOAD_FIELD_DATA_SOURCES_NAME 

Name of payload field data sources.

PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS 

Payload field data sources data points.

PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_ID 

Data point id of payload field assets data sources data points.

PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_NAME 

Name of payload field data sources data points.

PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_TYPE 

Type of payload field data sources data points.

PAYLOAD_FIELD_DATA_SOURCES_DATA_POINTS_UNIT 

Unit of payload field data sources data points.

PAYLOAD_FIELD_NAMES_END 

End of payload field names enumeration.

Definition at line 124 of file json.c.

Function Documentation

static mcl_error_t _add_item_meta_details ( mcl_item_t item,
mcl_json_t root 
)
static
static mcl_error_t _add_item_meta_payload_timeseries_details ( timeseries_t timeseries,
mcl_json_t payload 
)
static
static mcl_error_t _fill_array_using_list ( mcl_json_t json_array,
mcl_list_t list,
json_converter_callback  callback 
)
static
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 
)
static

Definition at line 1411 of file json.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, mcl_json_util_get_array_item(), mcl_json_util_get_array_size(), mcl_list_add(), MCL_NULL, and MCL_OK.

Referenced by _parse_data_source(), and _parse_data_source_configuration().

Here is the call graph for this function:

Here is the caller graph for this function:

static mcl_size_t _item_payload_size_for_timeseries ( timeseries_t timeseries)
static
static mcl_size_t _item_payload_size_for_timeseries_value ( timeseries_value_t timeseries_value)
static

Definition at line 1094 of file json.c.

References timeseries_value_t::data_point_id, ITEM_TIMESERIES_VALUE_BASE_SIZE, mcl_string_util_strlen(), MCL_VERBOSE_ENTRY, MCL_VERBOSE_LEAVE, timeseries_value_t::quality_code, and timeseries_value_t::value.

Referenced by _item_payload_size_for_timeseries_value_list().

Here is the call graph for this function:

Here is the caller graph for this function:

static mcl_size_t _item_payload_size_for_timeseries_value_list ( timeseries_value_list_t timeseries_value_list)
static
static mcl_error_t _json_from_event_payload ( event_t event,
char **  json_string 
)
static

Definition at line 399 of file json.c.

References _add_event_to_payload_array(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_JSON_ARRAY, mcl_json_util_destroy(), mcl_json_util_initialize(), mcl_json_util_to_string(), MCL_NULL, and MCL_OK.

Referenced by json_from_item_payload().

Here is the call graph for this function:

Here is the caller graph for this function:

static mcl_error_t _json_from_timeseries_payload ( timeseries_t timeseries,
char **  json_string 
)
static
static mcl_error_t _parse_and_get_string_value ( mcl_json_t json,
const char *  field_name,
char **  string 
)
static

Definition at line 1626 of file json.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, mcl_json_util_get_object_item(), mcl_json_util_get_string(), and MCL_OK.

Referenced by _parse_data_point(), _parse_data_source(), and _parse_data_source_configuration().

Here is the call graph for this function:

Here is the caller graph for this function:

mcl_error_t json_from_item_meta ( void *  item,
char **  json_string 
)

This function creates json representation of an item meta.

Parameters
[in]itemMCL item (Event, Timeseries, etc.).
[out]json_stringJson string representation of item meta.
Returns

Definition at line 326 of file json.c.

References _add_item_meta_details(), _add_item_meta_payload(), ITEM_TYPE, ITEM_VERSION, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_JSON_OBJECT, mcl_json_util_add_string(), mcl_json_util_destroy(), mcl_json_util_initialize(), mcl_json_util_to_string(), MCL_NULL, MCL_OK, meta_field_names, META_FIELD_TYPE, and META_FIELD_VERSION.

Referenced by _add_item_meta_json().

Here is the call graph for this function:

Here is the caller graph for this function:

mcl_error_t json_from_item_payload ( void *  item,
char **  json_string 
)

This function creates json representation of an item payload in a json array.

Parameters
[in]itemItem which will be used to create json string.
[out]json_stringJson string representation of item payload.
Returns

Definition at line 370 of file json.c.

References _json_from_data_source_configuration_payload(), _json_from_event_payload(), _json_from_timeseries_payload(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FAIL, MCL_ITEM_TYPE_DATA_SOURCE_CONFIGURATION, MCL_ITEM_TYPE_EVENT, and MCL_ITEM_TYPE_TIMESERIES.

Referenced by _add_item_payload().

Here is the call graph for this function:

Here is the caller graph for this function:

mcl_size_t json_get_item_size ( void *  item)

This function calculates the item size.

Parameters
[in]itemItem to calculate its size.
Returns
Size of the item.

Definition at line 429 of file json.c.

References _item_meta_size(), _item_payload_size_for_data_source_configuration(), _item_payload_size_for_event(), _item_payload_size_for_timeseries(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_ITEM_TYPE_CUSTOM_DATA, MCL_ITEM_TYPE_DATA_SOURCE_CONFIGURATION, MCL_ITEM_TYPE_EVENT, MCL_ITEM_TYPE_FILE, and MCL_ITEM_TYPE_TIMESERIES.

Referenced by multipart_get_tuple_size().

Here is the call graph for this function:

Here is the caller graph for this function:

mcl_error_t json_parse_item ( const char *  json_string,
mcl_size_t  string_length,
void **  item 
)

This function parses json representation of an item to its struct (Currently, only for data source configuration).

Parameters
[in]json_stringJson string.
[in]string_lengthLength of json string.
[out]itemItem struct.
Returns

Definition at line 467 of file json.c.

References _parse_data_source_configuration(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, mcl_json_util_destroy(), mcl_json_util_parse(), MCL_NULL, and MCL_OK.

Referenced by connectivity_processor_get_data_source_configuration().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const char* meta_field_names[META_FIELD_NAMES_END]
static
Initial value:
=
{
"type",
"version",
"meta",
"payload",
"type",
"version",
"details",
"configurationId",
"details",
"fileName",
"fileType",
"creationDate",
"totalItems",
"timestamp",
"duration"
}

Meta field names.

Definition at line 165 of file json.c.

Referenced by _add_item_meta_payload(), _add_item_meta_payload_details(), _add_item_meta_payload_file_details(), _add_item_meta_payload_timeseries_details(), and json_from_item_meta().

const char* meta_field_values[META_FIELD_VALUES_END]
static
Initial value:
=
{
"standardTimeSeries",
"businessEvent",
"file",
"dataSourceConfiguration"
}

Meta field values.

Definition at line 187 of file json.c.

Referenced by _add_item_meta_payload().