nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
json_common.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
11#ifndef JSON_COMMON_H__
12#define JSON_COMMON_H__
13
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <zephyr/kernel.h>
25#include <cJSON.h>
26
27#include "cloud_codec.h"
28#include "json_protocol_names.h"
29
44
57
74 struct cloud_data_modem_static *data,
75 enum json_common_op_code op,
76 const char *object_label,
77 cJSON **parent_ref);
78
95 struct cloud_data_modem_dynamic *data,
96 enum json_common_op_code op,
97 const char *object_label,
98 cJSON **parent_ref);
99
116 struct cloud_data_sensors *data,
117 enum json_common_op_code op,
118 const char *object_label,
119 cJSON **parent_ref);
120
137 struct cloud_data_gnss *data,
138 enum json_common_op_code op,
139 const char *object_label,
140 cJSON **parent_ref);
141
157int json_common_ui_data_add(cJSON *parent,
158 struct cloud_data_ui *data,
159 enum json_common_op_code op,
160 const char *object_label,
161 cJSON **parent_ref);
162
179 struct cloud_data_impact *data,
180 enum json_common_op_code op,
181 const char *object_label,
182 cJSON **parent_ref);
183
197 struct cloud_data_neighbor_cells *data,
198 enum json_common_op_code op);
199
200#if defined(CONFIG_LOCATION_METHOD_WIFI)
215 enum json_common_op_code op);
216#endif
217
231 struct cloud_data_agnss_request *data,
232 enum json_common_op_code op);
233
245
262 struct cloud_data_battery *data,
263 enum json_common_op_code op,
264 const char *object_label,
265 cJSON **parent_ref);
266
276int json_common_config_add(cJSON *parent, struct cloud_data_cfg *data, const char *object_label);
277
285void json_common_config_get(cJSON *parent, struct cloud_data_cfg *data);
286
300int json_common_batch_data_add(cJSON *parent, enum json_common_buffer_type type, void *buf,
301 size_t buf_count, const char *object_label);
302
303#ifdef __cplusplus
304}
305#endif
309#endif /* JSON_COMMON_H__ */
void json_common_config_get(cJSON *parent, struct cloud_data_cfg *data)
Extract configuration values from parent object.
int json_common_agnss_request_data_add(cJSON *parent, struct cloud_data_agnss_request *data, enum json_common_op_code op)
Encode and add A-GNSS request data to the parent object.
int json_common_config_add(cJSON *parent, struct cloud_data_cfg *data, const char *object_label)
Encode and add configuration data to the parent object.
int json_common_modem_dynamic_data_add(cJSON *parent, struct cloud_data_modem_dynamic *data, enum json_common_op_code op, const char *object_label, cJSON **parent_ref)
Encode and add dynamic modem data to the parent object.
int json_common_gnss_data_add(cJSON *parent, struct cloud_data_gnss *data, enum json_common_op_code op, const char *object_label, cJSON **parent_ref)
Encode and add GNSS data to the parent object.
int json_common_wifi_ap_data_add(cJSON *parent, struct cloud_data_wifi_access_points *data, enum json_common_op_code op)
Encode and add wifi survey data to the parent object.
int json_common_ui_data_add(cJSON *parent, struct cloud_data_ui *data, enum json_common_op_code op, const char *object_label, cJSON **parent_ref)
Encode and add User Interface data to the parent object.
int json_common_impact_data_add(cJSON *parent, struct cloud_data_impact *data, enum json_common_op_code op, const char *object_label, cJSON **parent_ref)
Encode and add Impact data to the parent object.
int json_common_battery_data_add(cJSON *parent, struct cloud_data_battery *data, enum json_common_op_code op, const char *object_label, cJSON **parent_ref)
Encode and add battery data to the parent object.
int json_common_pgps_request_data_add(cJSON *parent, struct cloud_data_pgps_request *data)
Encode and add P-GPS request data to the parent object.
int json_common_modem_static_data_add(cJSON *parent, struct cloud_data_modem_static *data, enum json_common_op_code op, const char *object_label, cJSON **parent_ref)
Encode and add static modem data to the parent object.
json_common_buffer_type
Type of data to be handled by the respective API. Used to signify what data structure that is passed ...
Definition json_common.h:33
@ JSON_COMMON_SENSOR
Definition json_common.h:39
@ JSON_COMMON_MODEM_STATIC
Definition json_common.h:36
@ JSON_COMMON_IMPACT
Definition json_common.h:35
@ JSON_COMMON_GNSS
Definition json_common.h:38
@ JSON_COMMON_COUNT
Definition json_common.h:42
@ JSON_COMMON_UI
Definition json_common.h:34
@ JSON_COMMON_MODEM_DYNAMIC
Definition json_common.h:37
@ JSON_COMMON_BATTERY
Definition json_common.h:40
int json_common_sensor_data_add(cJSON *parent, struct cloud_data_sensors *data, enum json_common_op_code op, const char *object_label, cJSON **parent_ref)
Encode and add environmental sensor data to the parent object.
int json_common_batch_data_add(cJSON *parent, enum json_common_buffer_type type, void *buf, size_t buf_count, const char *object_label)
Encode all queued entries in the passed in buffer and add it to the parent object as an array.
int json_common_neighbor_cells_data_add(cJSON *parent, struct cloud_data_neighbor_cells *data, enum json_common_op_code op)
Encode and add neighbor cell data to the parent object.
json_common_op_code
Operation to be carried out with the passed in data.
Definition json_common.h:46
@ JSON_COMMON_ADD_DATA_TO_OBJECT
Definition json_common.h:53
@ JSON_COMMON_GET_POINTER_TO_OBJECT
Definition json_common.h:55
@ JSON_COMMON_ADD_DATA_TO_ARRAY
Definition json_common.h:51
@ JSON_COMMON_INVALID
Definition json_common.h:47
Definition cloud_codec.h:258
Structure containing battery data published to cloud.
Definition cloud_codec.h:47
Definition cloud_codec.h:103
Structure containing GNSS data published to cloud.
Definition cloud_codec.h:78
Definition cloud_codec.h:127
Definition cloud_codec.h:170
Definition cloud_codec.h:153
Definition cloud_codec.h:217
Definition cloud_codec.h:272
Definition cloud_codec.h:136
Definition cloud_codec.h:197
Definition cloud_codec.h:229