json.c File Reference

Json module implementation file. More...

#include "json.h"
#include "json_util.h"
#include "memory.h"
#include "log_util.h"
#include "definitions.h"
#include "event.h"
#include "mcl/mcl_event.h"
Include dependency graph for json.c:

Go to the source code of this file.

Functions

static E_MCL_ERROR_CODE _add_string_field_to_object (json_t *parent_object, char *field_name, const string_t *optional_field_to_be_added, mcl_bool_t is_mandatory)
 
static E_MCL_ERROR_CODE _add_item_meta_details (item_meta_t *item_meta, json_t *root)
 
static E_MCL_ERROR_CODE _add_item_meta_payload_details (item_meta_t *item_meta, json_t *payload)
 
static E_MCL_ERROR_CODE _add_item_meta_payload (item_meta_t *item_meta, json_t *root)
 
static E_MCL_ERROR_CODE _add_time_series_value_sets (list_t *value_sets, json_t *value_set_array)
 
static E_MCL_ERROR_CODE _add_time_series_value_set (time_series_value_set_t *value_set, json_t *value_set_array)
 
static E_MCL_ERROR_CODE _add_time_series_payload_values_array (list_t *values, json_t *value_set)
 
static E_MCL_ERROR_CODE _add_time_series_payload_values_objects (time_series_value_t *value, json_t *values_array)
 
static E_MCL_ERROR_CODE _add_data_source_configuration_data_sources (list_t *data_source_list, json_t *payload_object)
 
static E_MCL_ERROR_CODE _add_data_source_configuration_data_points (list_t *data_points, json_t *data_sources_object)
 
static E_MCL_ERROR_CODE _add_event_list (list_t *event_list, json_t *event_list_array)
 
static E_MCL_ERROR_CODE _add_event (event_t *event, json_t *event_list_array)
 
E_MCL_ERROR_CODE json_from_item_meta (item_meta_t *item_meta, string_t **json_string)
 Creates item meta part of all types in json format. More...
 
E_MCL_ERROR_CODE json_from_time_series_payload (time_series_payload_t *payload, string_t **json_string)
 Creates payload part of time series in json format. More...
 
E_MCL_ERROR_CODE json_from_data_source_configuration_payload (data_source_configuration_payload_t *payload, string_t **json_string)
 Creates payload part of data source configuration in json format. More...
 
E_MCL_ERROR_CODE json_from_event_payload (list_t *event_list_payload, string_t **json_string)
 Creates payload part of event set in json format. More...
 

Detailed Description

Json module implementation file.


Date
Jul 14, 2016

Definition in file json.c.

Function Documentation

static E_MCL_ERROR_CODE _add_event_list ( list_t event_list,
json_t event_list_array 
)
static

Definition at line 154 of file json.c.

References _add_event(), ASSERT_CODE_MESSAGE, mcl_list_node_t::data, DEBUG_ENTRY, DEBUG_LEAVE, list_next(), list_reset(), MCL_NULL, and MCL_OK.

Referenced by json_from_event_payload().

Here is the call graph for this function:

Here is the caller graph for this function:

static E_MCL_ERROR_CODE _add_string_field_to_object ( json_t parent_object,
char *  field_name,
const string_t optional_field_to_be_added,
mcl_bool_t  is_mandatory 
)
static
static E_MCL_ERROR_CODE _add_time_series_payload_values_array ( list_t values,
json_t value_set 
)
static
static E_MCL_ERROR_CODE _add_time_series_value_sets ( list_t value_sets,
json_t value_set_array 
)
static

Definition at line 263 of file json.c.

References _add_time_series_value_set(), ASSERT_CODE_MESSAGE, mcl_list_node_t::data, DEBUG_ENTRY, DEBUG_LEAVE, list_next(), list_reset(), MCL_NULL, and MCL_OK.

Referenced by json_from_time_series_payload().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE json_from_data_source_configuration_payload ( data_source_configuration_payload_t payload,
string_t **  json_string 
)

Creates payload part of data source configuration in json format.

Parameters
[in]payloadPayload fields of data source configuration is stored in this struct.
[out]json_stringJson string filled with meta part of the related item.
Returns

Definition at line 104 of file json.c.

References _add_data_source_configuration_data_sources(), string_t::buffer, data_source_configuration_payload_t::configuration_id, data_source_configuration_payload_t::data_sources, DEBUG_ENTRY, DEBUG_LEAVE, JSON_OBJECT, json_util_add_string(), json_util_destroy(), json_util_initialize(), json_util_to_string(), MCL_DEBUG, MCL_NULL, MCL_OK, PAYLOAD_FIELD_CONFIGURATION_ID, payload_field_names, and string_initialize_dynamic().

Referenced by _exchange_prepare_data().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE json_from_event_payload ( list_t event_list_payload,
string_t **  json_string 
)

Creates payload part of event set in json format.

Parameters
[in]event_list_payloadPayload fields of event list is stored in this list.
[in]json_stringJson string filled with meta part of the related item.
Returns

Definition at line 129 of file json.c.

References _add_event_list(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, JSON_ARRAY, json_util_destroy(), json_util_initialize(), json_util_to_string(), MCL_DEBUG, MCL_NULL, MCL_OK, and string_initialize_dynamic().

Referenced by _exchange_prepare_data().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE json_from_item_meta ( item_meta_t item_meta,
string_t **  json_string 
)

Creates item meta part of all types in json format.

Parameters
[in]item_metaMeta fields of the item are stored in this struct.
[out]json_stringJson string filled with meta part of the related item.
Returns

Definition at line 37 of file json.c.

References _add_item_meta_details(), _add_item_meta_payload(), _add_string_field_to_object(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, JSON_OBJECT, json_util_destroy(), json_util_initialize(), json_util_to_string(), MCL_DEBUG, MCL_NULL, MCL_OK, MCL_TRUE, meta_field_names, META_FIELD_TYPE, META_FIELD_VERSION, string_initialize_dynamic(), item_meta_t::type, and item_meta_t::version.

Referenced by _exchange_prepare_data().

Here is the call graph for this function:

Here is the caller graph for this function:

E_MCL_ERROR_CODE json_from_time_series_payload ( time_series_payload_t payload,
string_t **  json_string 
)

Creates payload part of time series in json format.

Parameters
[in]payloadPayload fields of time series is stored in this struct.
[out]json_stringJson string filled with meta part of the related item.
Returns

Definition at line 76 of file json.c.

References _add_time_series_value_sets(), ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, JSON_ARRAY, json_util_destroy(), json_util_initialize(), json_util_to_string(), MCL_DEBUG, MCL_NULL, MCL_OK, string_initialize_dynamic(), and time_series_payload_t::value_sets.

Referenced by _exchange_prepare_data().

Here is the call graph for this function:

Here is the caller graph for this function: