/src/open5gs/lib/sbi/openapi/model/mdt_configuration.c
Line | Count | Source |
1 | | |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include "mdt_configuration.h" |
6 | | |
7 | | OpenAPI_mdt_configuration_t *OpenAPI_mdt_configuration_create( |
8 | | OpenAPI_job_type_e job_type, |
9 | | OpenAPI_report_type_mdt_e report_type, |
10 | | OpenAPI_area_scope_t *area_scope, |
11 | | OpenAPI_list_t *measurement_lte_list, |
12 | | OpenAPI_list_t *measurement_nr_list, |
13 | | OpenAPI_list_t *sensor_measurement_list, |
14 | | OpenAPI_list_t *sensor_measurement_lte_list, |
15 | | OpenAPI_list_t *reporting_trigger_list, |
16 | | OpenAPI_report_interval_mdt_e report_interval, |
17 | | OpenAPI_report_interval_nr_mdt_e report_interval_nr, |
18 | | OpenAPI_report_amount_mdt_e report_amount, |
19 | | OpenAPI_list_t* report_amount_per_measurement_lte, |
20 | | OpenAPI_list_t* report_amount_per_measurement_nr, |
21 | | bool is_event_threshold_rsrp, |
22 | | int event_threshold_rsrp, |
23 | | bool is_mn_only_ind, |
24 | | int mn_only_ind, |
25 | | bool is_event_threshold_rsrp_nr, |
26 | | int event_threshold_rsrp_nr, |
27 | | bool is_event_threshold_rsrq, |
28 | | int event_threshold_rsrq, |
29 | | bool is_event_threshold_rsrq_nr, |
30 | | int event_threshold_rsrq_nr, |
31 | | OpenAPI_list_t *event_list, |
32 | | OpenAPI_logging_interval_mdt_e logging_interval, |
33 | | OpenAPI_logging_interval_nr_mdt_e logging_interval_nr, |
34 | | OpenAPI_logging_duration_mdt_e logging_duration, |
35 | | OpenAPI_logging_duration_nr_mdt_e logging_duration_nr, |
36 | | OpenAPI_positioning_method_mdt_e positioning_method, |
37 | | OpenAPI_list_t *add_positioning_method_list, |
38 | | OpenAPI_collection_period_rmm_lte_mdt_e collection_period_rmm_lte, |
39 | | OpenAPI_collection_period_rmm_nr_mdt_e collection_period_rmm_nr, |
40 | | OpenAPI_measurement_period_lte_mdt_e measurement_period_lte, |
41 | | OpenAPI_list_t *mdt_allowed_plmn_id_list, |
42 | | OpenAPI_list_t *mbsfn_area_list, |
43 | | OpenAPI_list_t *inter_freq_target_list, |
44 | | bool is_event_threshold_sinr_nr, |
45 | | int event_threshold_sinr_nr, |
46 | | OpenAPI_bluetooth_measurement_t *bluetooth_measurement_nr, |
47 | | OpenAPI_bluetooth_measurement_t *bluetooth_measurement_lte, |
48 | | OpenAPI_wlan_measurement_t *wlan_measurement_nr, |
49 | | OpenAPI_wlan_measurement_t *wlan_measurement_lte, |
50 | | OpenAPI_list_t *slice_area_scope |
51 | | ) |
52 | 0 | { |
53 | 0 | OpenAPI_mdt_configuration_t *mdt_configuration_local_var = ogs_malloc(sizeof(OpenAPI_mdt_configuration_t)); |
54 | 0 | ogs_assert(mdt_configuration_local_var); |
55 | | |
56 | 0 | mdt_configuration_local_var->job_type = job_type; |
57 | 0 | mdt_configuration_local_var->report_type = report_type; |
58 | 0 | mdt_configuration_local_var->area_scope = area_scope; |
59 | 0 | mdt_configuration_local_var->measurement_lte_list = measurement_lte_list; |
60 | 0 | mdt_configuration_local_var->measurement_nr_list = measurement_nr_list; |
61 | 0 | mdt_configuration_local_var->sensor_measurement_list = sensor_measurement_list; |
62 | 0 | mdt_configuration_local_var->sensor_measurement_lte_list = sensor_measurement_lte_list; |
63 | 0 | mdt_configuration_local_var->reporting_trigger_list = reporting_trigger_list; |
64 | 0 | mdt_configuration_local_var->report_interval = report_interval; |
65 | 0 | mdt_configuration_local_var->report_interval_nr = report_interval_nr; |
66 | 0 | mdt_configuration_local_var->report_amount = report_amount; |
67 | 0 | mdt_configuration_local_var->report_amount_per_measurement_lte = report_amount_per_measurement_lte; |
68 | 0 | mdt_configuration_local_var->report_amount_per_measurement_nr = report_amount_per_measurement_nr; |
69 | 0 | mdt_configuration_local_var->is_event_threshold_rsrp = is_event_threshold_rsrp; |
70 | 0 | mdt_configuration_local_var->event_threshold_rsrp = event_threshold_rsrp; |
71 | 0 | mdt_configuration_local_var->is_mn_only_ind = is_mn_only_ind; |
72 | 0 | mdt_configuration_local_var->mn_only_ind = mn_only_ind; |
73 | 0 | mdt_configuration_local_var->is_event_threshold_rsrp_nr = is_event_threshold_rsrp_nr; |
74 | 0 | mdt_configuration_local_var->event_threshold_rsrp_nr = event_threshold_rsrp_nr; |
75 | 0 | mdt_configuration_local_var->is_event_threshold_rsrq = is_event_threshold_rsrq; |
76 | 0 | mdt_configuration_local_var->event_threshold_rsrq = event_threshold_rsrq; |
77 | 0 | mdt_configuration_local_var->is_event_threshold_rsrq_nr = is_event_threshold_rsrq_nr; |
78 | 0 | mdt_configuration_local_var->event_threshold_rsrq_nr = event_threshold_rsrq_nr; |
79 | 0 | mdt_configuration_local_var->event_list = event_list; |
80 | 0 | mdt_configuration_local_var->logging_interval = logging_interval; |
81 | 0 | mdt_configuration_local_var->logging_interval_nr = logging_interval_nr; |
82 | 0 | mdt_configuration_local_var->logging_duration = logging_duration; |
83 | 0 | mdt_configuration_local_var->logging_duration_nr = logging_duration_nr; |
84 | 0 | mdt_configuration_local_var->positioning_method = positioning_method; |
85 | 0 | mdt_configuration_local_var->add_positioning_method_list = add_positioning_method_list; |
86 | 0 | mdt_configuration_local_var->collection_period_rmm_lte = collection_period_rmm_lte; |
87 | 0 | mdt_configuration_local_var->collection_period_rmm_nr = collection_period_rmm_nr; |
88 | 0 | mdt_configuration_local_var->measurement_period_lte = measurement_period_lte; |
89 | 0 | mdt_configuration_local_var->mdt_allowed_plmn_id_list = mdt_allowed_plmn_id_list; |
90 | 0 | mdt_configuration_local_var->mbsfn_area_list = mbsfn_area_list; |
91 | 0 | mdt_configuration_local_var->inter_freq_target_list = inter_freq_target_list; |
92 | 0 | mdt_configuration_local_var->is_event_threshold_sinr_nr = is_event_threshold_sinr_nr; |
93 | 0 | mdt_configuration_local_var->event_threshold_sinr_nr = event_threshold_sinr_nr; |
94 | 0 | mdt_configuration_local_var->bluetooth_measurement_nr = bluetooth_measurement_nr; |
95 | 0 | mdt_configuration_local_var->bluetooth_measurement_lte = bluetooth_measurement_lte; |
96 | 0 | mdt_configuration_local_var->wlan_measurement_nr = wlan_measurement_nr; |
97 | 0 | mdt_configuration_local_var->wlan_measurement_lte = wlan_measurement_lte; |
98 | 0 | mdt_configuration_local_var->slice_area_scope = slice_area_scope; |
99 | |
|
100 | 0 | return mdt_configuration_local_var; |
101 | 0 | } |
102 | | |
103 | | void OpenAPI_mdt_configuration_free(OpenAPI_mdt_configuration_t *mdt_configuration) |
104 | 0 | { |
105 | 0 | OpenAPI_lnode_t *node = NULL; |
106 | |
|
107 | 0 | if (NULL == mdt_configuration) { |
108 | 0 | return; |
109 | 0 | } |
110 | 0 | if (mdt_configuration->area_scope) { |
111 | 0 | OpenAPI_area_scope_free(mdt_configuration->area_scope); |
112 | 0 | mdt_configuration->area_scope = NULL; |
113 | 0 | } |
114 | 0 | if (mdt_configuration->measurement_lte_list) { |
115 | 0 | OpenAPI_list_free(mdt_configuration->measurement_lte_list); |
116 | 0 | mdt_configuration->measurement_lte_list = NULL; |
117 | 0 | } |
118 | 0 | if (mdt_configuration->measurement_nr_list) { |
119 | 0 | OpenAPI_list_free(mdt_configuration->measurement_nr_list); |
120 | 0 | mdt_configuration->measurement_nr_list = NULL; |
121 | 0 | } |
122 | 0 | if (mdt_configuration->sensor_measurement_list) { |
123 | 0 | OpenAPI_list_free(mdt_configuration->sensor_measurement_list); |
124 | 0 | mdt_configuration->sensor_measurement_list = NULL; |
125 | 0 | } |
126 | 0 | if (mdt_configuration->sensor_measurement_lte_list) { |
127 | 0 | OpenAPI_list_free(mdt_configuration->sensor_measurement_lte_list); |
128 | 0 | mdt_configuration->sensor_measurement_lte_list = NULL; |
129 | 0 | } |
130 | 0 | if (mdt_configuration->reporting_trigger_list) { |
131 | 0 | OpenAPI_list_free(mdt_configuration->reporting_trigger_list); |
132 | 0 | mdt_configuration->reporting_trigger_list = NULL; |
133 | 0 | } |
134 | 0 | if (mdt_configuration->report_amount_per_measurement_lte) { |
135 | 0 | OpenAPI_list_for_each(mdt_configuration->report_amount_per_measurement_lte, node) { |
136 | 0 | OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; |
137 | 0 | ogs_free(localKeyValue->key); |
138 | 0 | OpenAPI_map_free(localKeyValue); |
139 | 0 | } |
140 | 0 | OpenAPI_list_free(mdt_configuration->report_amount_per_measurement_lte); |
141 | 0 | mdt_configuration->report_amount_per_measurement_lte = NULL; |
142 | 0 | } |
143 | 0 | if (mdt_configuration->report_amount_per_measurement_nr) { |
144 | 0 | OpenAPI_list_for_each(mdt_configuration->report_amount_per_measurement_nr, node) { |
145 | 0 | OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; |
146 | 0 | ogs_free(localKeyValue->key); |
147 | 0 | OpenAPI_map_free(localKeyValue); |
148 | 0 | } |
149 | 0 | OpenAPI_list_free(mdt_configuration->report_amount_per_measurement_nr); |
150 | 0 | mdt_configuration->report_amount_per_measurement_nr = NULL; |
151 | 0 | } |
152 | 0 | if (mdt_configuration->event_list) { |
153 | 0 | OpenAPI_list_free(mdt_configuration->event_list); |
154 | 0 | mdt_configuration->event_list = NULL; |
155 | 0 | } |
156 | 0 | if (mdt_configuration->add_positioning_method_list) { |
157 | 0 | OpenAPI_list_free(mdt_configuration->add_positioning_method_list); |
158 | 0 | mdt_configuration->add_positioning_method_list = NULL; |
159 | 0 | } |
160 | 0 | if (mdt_configuration->mdt_allowed_plmn_id_list) { |
161 | 0 | OpenAPI_list_for_each(mdt_configuration->mdt_allowed_plmn_id_list, node) { |
162 | 0 | OpenAPI_plmn_id_free(node->data); |
163 | 0 | } |
164 | 0 | OpenAPI_list_free(mdt_configuration->mdt_allowed_plmn_id_list); |
165 | 0 | mdt_configuration->mdt_allowed_plmn_id_list = NULL; |
166 | 0 | } |
167 | 0 | if (mdt_configuration->mbsfn_area_list) { |
168 | 0 | OpenAPI_list_for_each(mdt_configuration->mbsfn_area_list, node) { |
169 | 0 | OpenAPI_mbsfn_area_free(node->data); |
170 | 0 | } |
171 | 0 | OpenAPI_list_free(mdt_configuration->mbsfn_area_list); |
172 | 0 | mdt_configuration->mbsfn_area_list = NULL; |
173 | 0 | } |
174 | 0 | if (mdt_configuration->inter_freq_target_list) { |
175 | 0 | OpenAPI_list_for_each(mdt_configuration->inter_freq_target_list, node) { |
176 | 0 | OpenAPI_inter_freq_target_info_free(node->data); |
177 | 0 | } |
178 | 0 | OpenAPI_list_free(mdt_configuration->inter_freq_target_list); |
179 | 0 | mdt_configuration->inter_freq_target_list = NULL; |
180 | 0 | } |
181 | 0 | if (mdt_configuration->bluetooth_measurement_nr) { |
182 | 0 | OpenAPI_bluetooth_measurement_free(mdt_configuration->bluetooth_measurement_nr); |
183 | 0 | mdt_configuration->bluetooth_measurement_nr = NULL; |
184 | 0 | } |
185 | 0 | if (mdt_configuration->bluetooth_measurement_lte) { |
186 | 0 | OpenAPI_bluetooth_measurement_free(mdt_configuration->bluetooth_measurement_lte); |
187 | 0 | mdt_configuration->bluetooth_measurement_lte = NULL; |
188 | 0 | } |
189 | 0 | if (mdt_configuration->wlan_measurement_nr) { |
190 | 0 | OpenAPI_wlan_measurement_free(mdt_configuration->wlan_measurement_nr); |
191 | 0 | mdt_configuration->wlan_measurement_nr = NULL; |
192 | 0 | } |
193 | 0 | if (mdt_configuration->wlan_measurement_lte) { |
194 | 0 | OpenAPI_wlan_measurement_free(mdt_configuration->wlan_measurement_lte); |
195 | 0 | mdt_configuration->wlan_measurement_lte = NULL; |
196 | 0 | } |
197 | 0 | if (mdt_configuration->slice_area_scope) { |
198 | 0 | OpenAPI_list_for_each(mdt_configuration->slice_area_scope, node) { |
199 | 0 | OpenAPI_slice_scope_per_plmn_free(node->data); |
200 | 0 | } |
201 | 0 | OpenAPI_list_free(mdt_configuration->slice_area_scope); |
202 | 0 | mdt_configuration->slice_area_scope = NULL; |
203 | 0 | } |
204 | 0 | ogs_free(mdt_configuration); |
205 | 0 | } |
206 | | |
207 | | cJSON *OpenAPI_mdt_configuration_convertToJSON(OpenAPI_mdt_configuration_t *mdt_configuration) |
208 | 0 | { |
209 | 0 | cJSON *item = NULL; |
210 | 0 | OpenAPI_lnode_t *node = NULL; |
211 | |
|
212 | 0 | if (mdt_configuration == NULL) { |
213 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [MdtConfiguration]"); |
214 | 0 | return NULL; |
215 | 0 | } |
216 | | |
217 | 0 | item = cJSON_CreateObject(); |
218 | 0 | if (mdt_configuration->job_type == OpenAPI_job_type_NULL) { |
219 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [job_type]"); |
220 | 0 | return NULL; |
221 | 0 | } |
222 | 0 | if (cJSON_AddStringToObject(item, "jobType", OpenAPI_job_type_ToString(mdt_configuration->job_type)) == NULL) { |
223 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [job_type]"); |
224 | 0 | goto end; |
225 | 0 | } |
226 | | |
227 | 0 | if (mdt_configuration->report_type != OpenAPI_report_type_mdt_NULL) { |
228 | 0 | if (cJSON_AddStringToObject(item, "reportType", OpenAPI_report_type_mdt_ToString(mdt_configuration->report_type)) == NULL) { |
229 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_type]"); |
230 | 0 | goto end; |
231 | 0 | } |
232 | 0 | } |
233 | | |
234 | 0 | if (mdt_configuration->area_scope) { |
235 | 0 | cJSON *area_scope_local_JSON = OpenAPI_area_scope_convertToJSON(mdt_configuration->area_scope); |
236 | 0 | if (area_scope_local_JSON == NULL) { |
237 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [area_scope]"); |
238 | 0 | goto end; |
239 | 0 | } |
240 | 0 | cJSON_AddItemToObject(item, "areaScope", area_scope_local_JSON); |
241 | 0 | if (item->child == NULL) { |
242 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [area_scope]"); |
243 | 0 | goto end; |
244 | 0 | } |
245 | 0 | } |
246 | | |
247 | 0 | if (mdt_configuration->measurement_lte_list != OpenAPI_measurement_lte_for_mdt_NULL) { |
248 | 0 | cJSON *measurement_lte_listList = cJSON_AddArrayToObject(item, "measurementLteList"); |
249 | 0 | if (measurement_lte_listList == NULL) { |
250 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_lte_list]"); |
251 | 0 | goto end; |
252 | 0 | } |
253 | 0 | OpenAPI_list_for_each(mdt_configuration->measurement_lte_list, node) { |
254 | 0 | if (cJSON_AddStringToObject(measurement_lte_listList, "", OpenAPI_measurement_lte_for_mdt_ToString((intptr_t)node->data)) == NULL) { |
255 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_lte_list]"); |
256 | 0 | goto end; |
257 | 0 | } |
258 | 0 | } |
259 | 0 | } |
260 | | |
261 | 0 | if (mdt_configuration->measurement_nr_list != OpenAPI_measurement_nr_for_mdt_NULL) { |
262 | 0 | cJSON *measurement_nr_listList = cJSON_AddArrayToObject(item, "measurementNrList"); |
263 | 0 | if (measurement_nr_listList == NULL) { |
264 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_nr_list]"); |
265 | 0 | goto end; |
266 | 0 | } |
267 | 0 | OpenAPI_list_for_each(mdt_configuration->measurement_nr_list, node) { |
268 | 0 | if (cJSON_AddStringToObject(measurement_nr_listList, "", OpenAPI_measurement_nr_for_mdt_ToString((intptr_t)node->data)) == NULL) { |
269 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_nr_list]"); |
270 | 0 | goto end; |
271 | 0 | } |
272 | 0 | } |
273 | 0 | } |
274 | | |
275 | 0 | if (mdt_configuration->sensor_measurement_list != OpenAPI_sensor_measurement_NULL) { |
276 | 0 | cJSON *sensor_measurement_listList = cJSON_AddArrayToObject(item, "sensorMeasurementList"); |
277 | 0 | if (sensor_measurement_listList == NULL) { |
278 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [sensor_measurement_list]"); |
279 | 0 | goto end; |
280 | 0 | } |
281 | 0 | OpenAPI_list_for_each(mdt_configuration->sensor_measurement_list, node) { |
282 | 0 | if (cJSON_AddStringToObject(sensor_measurement_listList, "", OpenAPI_sensor_measurement_ToString((intptr_t)node->data)) == NULL) { |
283 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [sensor_measurement_list]"); |
284 | 0 | goto end; |
285 | 0 | } |
286 | 0 | } |
287 | 0 | } |
288 | | |
289 | 0 | if (mdt_configuration->sensor_measurement_lte_list != OpenAPI_sensor_measurement_NULL) { |
290 | 0 | cJSON *sensor_measurement_lte_listList = cJSON_AddArrayToObject(item, "sensorMeasurementLteList"); |
291 | 0 | if (sensor_measurement_lte_listList == NULL) { |
292 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [sensor_measurement_lte_list]"); |
293 | 0 | goto end; |
294 | 0 | } |
295 | 0 | OpenAPI_list_for_each(mdt_configuration->sensor_measurement_lte_list, node) { |
296 | 0 | if (cJSON_AddStringToObject(sensor_measurement_lte_listList, "", OpenAPI_sensor_measurement_ToString((intptr_t)node->data)) == NULL) { |
297 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [sensor_measurement_lte_list]"); |
298 | 0 | goto end; |
299 | 0 | } |
300 | 0 | } |
301 | 0 | } |
302 | | |
303 | 0 | if (mdt_configuration->reporting_trigger_list != OpenAPI_reporting_trigger_NULL) { |
304 | 0 | cJSON *reporting_trigger_listList = cJSON_AddArrayToObject(item, "reportingTriggerList"); |
305 | 0 | if (reporting_trigger_listList == NULL) { |
306 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [reporting_trigger_list]"); |
307 | 0 | goto end; |
308 | 0 | } |
309 | 0 | OpenAPI_list_for_each(mdt_configuration->reporting_trigger_list, node) { |
310 | 0 | if (cJSON_AddStringToObject(reporting_trigger_listList, "", OpenAPI_reporting_trigger_ToString((intptr_t)node->data)) == NULL) { |
311 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [reporting_trigger_list]"); |
312 | 0 | goto end; |
313 | 0 | } |
314 | 0 | } |
315 | 0 | } |
316 | | |
317 | 0 | if (mdt_configuration->report_interval != OpenAPI_report_interval_mdt_NULL) { |
318 | 0 | if (cJSON_AddStringToObject(item, "reportInterval", OpenAPI_report_interval_mdt_ToString(mdt_configuration->report_interval)) == NULL) { |
319 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_interval]"); |
320 | 0 | goto end; |
321 | 0 | } |
322 | 0 | } |
323 | | |
324 | 0 | if (mdt_configuration->report_interval_nr != OpenAPI_report_interval_nr_mdt_NULL) { |
325 | 0 | if (cJSON_AddStringToObject(item, "reportIntervalNr", OpenAPI_report_interval_nr_mdt_ToString(mdt_configuration->report_interval_nr)) == NULL) { |
326 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_interval_nr]"); |
327 | 0 | goto end; |
328 | 0 | } |
329 | 0 | } |
330 | | |
331 | 0 | if (mdt_configuration->report_amount != OpenAPI_report_amount_mdt_NULL) { |
332 | 0 | if (cJSON_AddStringToObject(item, "reportAmount", OpenAPI_report_amount_mdt_ToString(mdt_configuration->report_amount)) == NULL) { |
333 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount]"); |
334 | 0 | goto end; |
335 | 0 | } |
336 | 0 | } |
337 | | |
338 | 0 | if (mdt_configuration->report_amount_per_measurement_lte != OpenAPI_report_amount_mdt_NULL) { |
339 | 0 | cJSON *report_amount_per_measurement_lte = cJSON_AddObjectToObject(item, "reportAmountPerMeasurementLte"); |
340 | 0 | if (report_amount_per_measurement_lte == NULL) { |
341 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount_per_measurement_lte]"); |
342 | 0 | goto end; |
343 | 0 | } |
344 | 0 | cJSON *localMapObject = report_amount_per_measurement_lte; |
345 | 0 | if (mdt_configuration->report_amount_per_measurement_lte) { |
346 | 0 | OpenAPI_list_for_each(mdt_configuration->report_amount_per_measurement_lte, node) { |
347 | 0 | OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; |
348 | 0 | if (localKeyValue == NULL) { |
349 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount_per_measurement_lte]"); |
350 | 0 | goto end; |
351 | 0 | } |
352 | 0 | if (localKeyValue->key == NULL) { |
353 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount_per_measurement_lte]"); |
354 | 0 | goto end; |
355 | 0 | } |
356 | 0 | if (cJSON_AddStringToObject(localMapObject, localKeyValue->key, OpenAPI_report_amount_mdt_ToString((intptr_t)localKeyValue->value)) == NULL) { |
357 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount_per_measurement_lte]"); |
358 | 0 | goto end; |
359 | 0 | } |
360 | 0 | } |
361 | 0 | } |
362 | 0 | } |
363 | | |
364 | 0 | if (mdt_configuration->report_amount_per_measurement_nr != OpenAPI_report_amount_mdt_NULL) { |
365 | 0 | cJSON *report_amount_per_measurement_nr = cJSON_AddObjectToObject(item, "reportAmountPerMeasurementNr"); |
366 | 0 | if (report_amount_per_measurement_nr == NULL) { |
367 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount_per_measurement_nr]"); |
368 | 0 | goto end; |
369 | 0 | } |
370 | 0 | cJSON *localMapObject = report_amount_per_measurement_nr; |
371 | 0 | if (mdt_configuration->report_amount_per_measurement_nr) { |
372 | 0 | OpenAPI_list_for_each(mdt_configuration->report_amount_per_measurement_nr, node) { |
373 | 0 | OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; |
374 | 0 | if (localKeyValue == NULL) { |
375 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount_per_measurement_nr]"); |
376 | 0 | goto end; |
377 | 0 | } |
378 | 0 | if (localKeyValue->key == NULL) { |
379 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount_per_measurement_nr]"); |
380 | 0 | goto end; |
381 | 0 | } |
382 | 0 | if (cJSON_AddStringToObject(localMapObject, localKeyValue->key, OpenAPI_report_amount_mdt_ToString((intptr_t)localKeyValue->value)) == NULL) { |
383 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [report_amount_per_measurement_nr]"); |
384 | 0 | goto end; |
385 | 0 | } |
386 | 0 | } |
387 | 0 | } |
388 | 0 | } |
389 | | |
390 | 0 | if (mdt_configuration->is_event_threshold_rsrp) { |
391 | 0 | if (cJSON_AddNumberToObject(item, "eventThresholdRsrp", mdt_configuration->event_threshold_rsrp) == NULL) { |
392 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_threshold_rsrp]"); |
393 | 0 | goto end; |
394 | 0 | } |
395 | 0 | } |
396 | | |
397 | 0 | if (mdt_configuration->is_mn_only_ind) { |
398 | 0 | if (cJSON_AddBoolToObject(item, "mnOnlyInd", mdt_configuration->mn_only_ind) == NULL) { |
399 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [mn_only_ind]"); |
400 | 0 | goto end; |
401 | 0 | } |
402 | 0 | } |
403 | | |
404 | 0 | if (mdt_configuration->is_event_threshold_rsrp_nr) { |
405 | 0 | if (cJSON_AddNumberToObject(item, "eventThresholdRsrpNr", mdt_configuration->event_threshold_rsrp_nr) == NULL) { |
406 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_threshold_rsrp_nr]"); |
407 | 0 | goto end; |
408 | 0 | } |
409 | 0 | } |
410 | | |
411 | 0 | if (mdt_configuration->is_event_threshold_rsrq) { |
412 | 0 | if (cJSON_AddNumberToObject(item, "eventThresholdRsrq", mdt_configuration->event_threshold_rsrq) == NULL) { |
413 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_threshold_rsrq]"); |
414 | 0 | goto end; |
415 | 0 | } |
416 | 0 | } |
417 | | |
418 | 0 | if (mdt_configuration->is_event_threshold_rsrq_nr) { |
419 | 0 | if (cJSON_AddNumberToObject(item, "eventThresholdRsrqNr", mdt_configuration->event_threshold_rsrq_nr) == NULL) { |
420 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_threshold_rsrq_nr]"); |
421 | 0 | goto end; |
422 | 0 | } |
423 | 0 | } |
424 | | |
425 | 0 | if (mdt_configuration->event_list != OpenAPI_event_for_mdt_NULL) { |
426 | 0 | cJSON *event_listList = cJSON_AddArrayToObject(item, "eventList"); |
427 | 0 | if (event_listList == NULL) { |
428 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_list]"); |
429 | 0 | goto end; |
430 | 0 | } |
431 | 0 | OpenAPI_list_for_each(mdt_configuration->event_list, node) { |
432 | 0 | if (cJSON_AddStringToObject(event_listList, "", OpenAPI_event_for_mdt_ToString((intptr_t)node->data)) == NULL) { |
433 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_list]"); |
434 | 0 | goto end; |
435 | 0 | } |
436 | 0 | } |
437 | 0 | } |
438 | | |
439 | 0 | if (mdt_configuration->logging_interval != OpenAPI_logging_interval_mdt_NULL) { |
440 | 0 | if (cJSON_AddStringToObject(item, "loggingInterval", OpenAPI_logging_interval_mdt_ToString(mdt_configuration->logging_interval)) == NULL) { |
441 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [logging_interval]"); |
442 | 0 | goto end; |
443 | 0 | } |
444 | 0 | } |
445 | | |
446 | 0 | if (mdt_configuration->logging_interval_nr != OpenAPI_logging_interval_nr_mdt_NULL) { |
447 | 0 | if (cJSON_AddStringToObject(item, "loggingIntervalNr", OpenAPI_logging_interval_nr_mdt_ToString(mdt_configuration->logging_interval_nr)) == NULL) { |
448 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [logging_interval_nr]"); |
449 | 0 | goto end; |
450 | 0 | } |
451 | 0 | } |
452 | | |
453 | 0 | if (mdt_configuration->logging_duration != OpenAPI_logging_duration_mdt_NULL) { |
454 | 0 | if (cJSON_AddStringToObject(item, "loggingDuration", OpenAPI_logging_duration_mdt_ToString(mdt_configuration->logging_duration)) == NULL) { |
455 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [logging_duration]"); |
456 | 0 | goto end; |
457 | 0 | } |
458 | 0 | } |
459 | | |
460 | 0 | if (mdt_configuration->logging_duration_nr != OpenAPI_logging_duration_nr_mdt_NULL) { |
461 | 0 | if (cJSON_AddStringToObject(item, "loggingDurationNr", OpenAPI_logging_duration_nr_mdt_ToString(mdt_configuration->logging_duration_nr)) == NULL) { |
462 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [logging_duration_nr]"); |
463 | 0 | goto end; |
464 | 0 | } |
465 | 0 | } |
466 | | |
467 | 0 | if (mdt_configuration->positioning_method != OpenAPI_positioning_method_mdt_NULL) { |
468 | 0 | if (cJSON_AddStringToObject(item, "positioningMethod", OpenAPI_positioning_method_mdt_ToString(mdt_configuration->positioning_method)) == NULL) { |
469 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [positioning_method]"); |
470 | 0 | goto end; |
471 | 0 | } |
472 | 0 | } |
473 | | |
474 | 0 | if (mdt_configuration->add_positioning_method_list != OpenAPI_positioning_method_mdt_NULL) { |
475 | 0 | cJSON *add_positioning_method_listList = cJSON_AddArrayToObject(item, "addPositioningMethodList"); |
476 | 0 | if (add_positioning_method_listList == NULL) { |
477 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [add_positioning_method_list]"); |
478 | 0 | goto end; |
479 | 0 | } |
480 | 0 | OpenAPI_list_for_each(mdt_configuration->add_positioning_method_list, node) { |
481 | 0 | if (cJSON_AddStringToObject(add_positioning_method_listList, "", OpenAPI_positioning_method_mdt_ToString((intptr_t)node->data)) == NULL) { |
482 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [add_positioning_method_list]"); |
483 | 0 | goto end; |
484 | 0 | } |
485 | 0 | } |
486 | 0 | } |
487 | | |
488 | 0 | if (mdt_configuration->collection_period_rmm_lte != OpenAPI_collection_period_rmm_lte_mdt_NULL) { |
489 | 0 | if (cJSON_AddStringToObject(item, "collectionPeriodRmmLte", OpenAPI_collection_period_rmm_lte_mdt_ToString(mdt_configuration->collection_period_rmm_lte)) == NULL) { |
490 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [collection_period_rmm_lte]"); |
491 | 0 | goto end; |
492 | 0 | } |
493 | 0 | } |
494 | | |
495 | 0 | if (mdt_configuration->collection_period_rmm_nr != OpenAPI_collection_period_rmm_nr_mdt_NULL) { |
496 | 0 | if (cJSON_AddStringToObject(item, "collectionPeriodRmmNr", OpenAPI_collection_period_rmm_nr_mdt_ToString(mdt_configuration->collection_period_rmm_nr)) == NULL) { |
497 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [collection_period_rmm_nr]"); |
498 | 0 | goto end; |
499 | 0 | } |
500 | 0 | } |
501 | | |
502 | 0 | if (mdt_configuration->measurement_period_lte != OpenAPI_measurement_period_lte_mdt_NULL) { |
503 | 0 | if (cJSON_AddStringToObject(item, "measurementPeriodLte", OpenAPI_measurement_period_lte_mdt_ToString(mdt_configuration->measurement_period_lte)) == NULL) { |
504 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [measurement_period_lte]"); |
505 | 0 | goto end; |
506 | 0 | } |
507 | 0 | } |
508 | | |
509 | 0 | if (mdt_configuration->mdt_allowed_plmn_id_list) { |
510 | 0 | cJSON *mdt_allowed_plmn_id_listList = cJSON_AddArrayToObject(item, "mdtAllowedPlmnIdList"); |
511 | 0 | if (mdt_allowed_plmn_id_listList == NULL) { |
512 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [mdt_allowed_plmn_id_list]"); |
513 | 0 | goto end; |
514 | 0 | } |
515 | 0 | OpenAPI_list_for_each(mdt_configuration->mdt_allowed_plmn_id_list, node) { |
516 | 0 | cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data); |
517 | 0 | if (itemLocal == NULL) { |
518 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [mdt_allowed_plmn_id_list]"); |
519 | 0 | goto end; |
520 | 0 | } |
521 | 0 | cJSON_AddItemToArray(mdt_allowed_plmn_id_listList, itemLocal); |
522 | 0 | } |
523 | 0 | } |
524 | | |
525 | 0 | if (mdt_configuration->mbsfn_area_list) { |
526 | 0 | cJSON *mbsfn_area_listList = cJSON_AddArrayToObject(item, "mbsfnAreaList"); |
527 | 0 | if (mbsfn_area_listList == NULL) { |
528 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [mbsfn_area_list]"); |
529 | 0 | goto end; |
530 | 0 | } |
531 | 0 | OpenAPI_list_for_each(mdt_configuration->mbsfn_area_list, node) { |
532 | 0 | cJSON *itemLocal = OpenAPI_mbsfn_area_convertToJSON(node->data); |
533 | 0 | if (itemLocal == NULL) { |
534 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [mbsfn_area_list]"); |
535 | 0 | goto end; |
536 | 0 | } |
537 | 0 | cJSON_AddItemToArray(mbsfn_area_listList, itemLocal); |
538 | 0 | } |
539 | 0 | } |
540 | | |
541 | 0 | if (mdt_configuration->inter_freq_target_list) { |
542 | 0 | cJSON *inter_freq_target_listList = cJSON_AddArrayToObject(item, "interFreqTargetList"); |
543 | 0 | if (inter_freq_target_listList == NULL) { |
544 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [inter_freq_target_list]"); |
545 | 0 | goto end; |
546 | 0 | } |
547 | 0 | OpenAPI_list_for_each(mdt_configuration->inter_freq_target_list, node) { |
548 | 0 | cJSON *itemLocal = OpenAPI_inter_freq_target_info_convertToJSON(node->data); |
549 | 0 | if (itemLocal == NULL) { |
550 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [inter_freq_target_list]"); |
551 | 0 | goto end; |
552 | 0 | } |
553 | 0 | cJSON_AddItemToArray(inter_freq_target_listList, itemLocal); |
554 | 0 | } |
555 | 0 | } |
556 | | |
557 | 0 | if (mdt_configuration->is_event_threshold_sinr_nr) { |
558 | 0 | if (cJSON_AddNumberToObject(item, "eventThresholdSinrNr", mdt_configuration->event_threshold_sinr_nr) == NULL) { |
559 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [event_threshold_sinr_nr]"); |
560 | 0 | goto end; |
561 | 0 | } |
562 | 0 | } |
563 | | |
564 | 0 | if (mdt_configuration->bluetooth_measurement_nr) { |
565 | 0 | cJSON *bluetooth_measurement_nr_local_JSON = OpenAPI_bluetooth_measurement_convertToJSON(mdt_configuration->bluetooth_measurement_nr); |
566 | 0 | if (bluetooth_measurement_nr_local_JSON == NULL) { |
567 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [bluetooth_measurement_nr]"); |
568 | 0 | goto end; |
569 | 0 | } |
570 | 0 | cJSON_AddItemToObject(item, "bluetoothMeasurementNr", bluetooth_measurement_nr_local_JSON); |
571 | 0 | if (item->child == NULL) { |
572 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [bluetooth_measurement_nr]"); |
573 | 0 | goto end; |
574 | 0 | } |
575 | 0 | } |
576 | | |
577 | 0 | if (mdt_configuration->bluetooth_measurement_lte) { |
578 | 0 | cJSON *bluetooth_measurement_lte_local_JSON = OpenAPI_bluetooth_measurement_convertToJSON(mdt_configuration->bluetooth_measurement_lte); |
579 | 0 | if (bluetooth_measurement_lte_local_JSON == NULL) { |
580 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [bluetooth_measurement_lte]"); |
581 | 0 | goto end; |
582 | 0 | } |
583 | 0 | cJSON_AddItemToObject(item, "bluetoothMeasurementLte", bluetooth_measurement_lte_local_JSON); |
584 | 0 | if (item->child == NULL) { |
585 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [bluetooth_measurement_lte]"); |
586 | 0 | goto end; |
587 | 0 | } |
588 | 0 | } |
589 | | |
590 | 0 | if (mdt_configuration->wlan_measurement_nr) { |
591 | 0 | cJSON *wlan_measurement_nr_local_JSON = OpenAPI_wlan_measurement_convertToJSON(mdt_configuration->wlan_measurement_nr); |
592 | 0 | if (wlan_measurement_nr_local_JSON == NULL) { |
593 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [wlan_measurement_nr]"); |
594 | 0 | goto end; |
595 | 0 | } |
596 | 0 | cJSON_AddItemToObject(item, "wlanMeasurementNr", wlan_measurement_nr_local_JSON); |
597 | 0 | if (item->child == NULL) { |
598 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [wlan_measurement_nr]"); |
599 | 0 | goto end; |
600 | 0 | } |
601 | 0 | } |
602 | | |
603 | 0 | if (mdt_configuration->wlan_measurement_lte) { |
604 | 0 | cJSON *wlan_measurement_lte_local_JSON = OpenAPI_wlan_measurement_convertToJSON(mdt_configuration->wlan_measurement_lte); |
605 | 0 | if (wlan_measurement_lte_local_JSON == NULL) { |
606 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [wlan_measurement_lte]"); |
607 | 0 | goto end; |
608 | 0 | } |
609 | 0 | cJSON_AddItemToObject(item, "wlanMeasurementLte", wlan_measurement_lte_local_JSON); |
610 | 0 | if (item->child == NULL) { |
611 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [wlan_measurement_lte]"); |
612 | 0 | goto end; |
613 | 0 | } |
614 | 0 | } |
615 | | |
616 | 0 | if (mdt_configuration->slice_area_scope) { |
617 | 0 | cJSON *slice_area_scopeList = cJSON_AddArrayToObject(item, "sliceAreaScope"); |
618 | 0 | if (slice_area_scopeList == NULL) { |
619 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [slice_area_scope]"); |
620 | 0 | goto end; |
621 | 0 | } |
622 | 0 | OpenAPI_list_for_each(mdt_configuration->slice_area_scope, node) { |
623 | 0 | cJSON *itemLocal = OpenAPI_slice_scope_per_plmn_convertToJSON(node->data); |
624 | 0 | if (itemLocal == NULL) { |
625 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed [slice_area_scope]"); |
626 | 0 | goto end; |
627 | 0 | } |
628 | 0 | cJSON_AddItemToArray(slice_area_scopeList, itemLocal); |
629 | 0 | } |
630 | 0 | } |
631 | | |
632 | 0 | end: |
633 | 0 | return item; |
634 | 0 | } |
635 | | |
636 | | OpenAPI_mdt_configuration_t *OpenAPI_mdt_configuration_parseFromJSON(cJSON *mdt_configurationJSON) |
637 | 0 | { |
638 | 0 | OpenAPI_mdt_configuration_t *mdt_configuration_local_var = NULL; |
639 | 0 | OpenAPI_lnode_t *node = NULL; |
640 | 0 | cJSON *job_type = NULL; |
641 | 0 | OpenAPI_job_type_e job_typeVariable = 0; |
642 | 0 | cJSON *report_type = NULL; |
643 | 0 | OpenAPI_report_type_mdt_e report_typeVariable = 0; |
644 | 0 | cJSON *area_scope = NULL; |
645 | 0 | OpenAPI_area_scope_t *area_scope_local_nonprim = NULL; |
646 | 0 | cJSON *measurement_lte_list = NULL; |
647 | 0 | OpenAPI_list_t *measurement_lte_listList = NULL; |
648 | 0 | cJSON *measurement_nr_list = NULL; |
649 | 0 | OpenAPI_list_t *measurement_nr_listList = NULL; |
650 | 0 | cJSON *sensor_measurement_list = NULL; |
651 | 0 | OpenAPI_list_t *sensor_measurement_listList = NULL; |
652 | 0 | cJSON *sensor_measurement_lte_list = NULL; |
653 | 0 | OpenAPI_list_t *sensor_measurement_lte_listList = NULL; |
654 | 0 | cJSON *reporting_trigger_list = NULL; |
655 | 0 | OpenAPI_list_t *reporting_trigger_listList = NULL; |
656 | 0 | cJSON *report_interval = NULL; |
657 | 0 | OpenAPI_report_interval_mdt_e report_intervalVariable = 0; |
658 | 0 | cJSON *report_interval_nr = NULL; |
659 | 0 | OpenAPI_report_interval_nr_mdt_e report_interval_nrVariable = 0; |
660 | 0 | cJSON *report_amount = NULL; |
661 | 0 | OpenAPI_report_amount_mdt_e report_amountVariable = 0; |
662 | 0 | cJSON *report_amount_per_measurement_lte = NULL; |
663 | 0 | OpenAPI_list_t *report_amount_per_measurement_lteList = NULL; |
664 | 0 | cJSON *report_amount_per_measurement_nr = NULL; |
665 | 0 | OpenAPI_list_t *report_amount_per_measurement_nrList = NULL; |
666 | 0 | cJSON *event_threshold_rsrp = NULL; |
667 | 0 | cJSON *mn_only_ind = NULL; |
668 | 0 | cJSON *event_threshold_rsrp_nr = NULL; |
669 | 0 | cJSON *event_threshold_rsrq = NULL; |
670 | 0 | cJSON *event_threshold_rsrq_nr = NULL; |
671 | 0 | cJSON *event_list = NULL; |
672 | 0 | OpenAPI_list_t *event_listList = NULL; |
673 | 0 | cJSON *logging_interval = NULL; |
674 | 0 | OpenAPI_logging_interval_mdt_e logging_intervalVariable = 0; |
675 | 0 | cJSON *logging_interval_nr = NULL; |
676 | 0 | OpenAPI_logging_interval_nr_mdt_e logging_interval_nrVariable = 0; |
677 | 0 | cJSON *logging_duration = NULL; |
678 | 0 | OpenAPI_logging_duration_mdt_e logging_durationVariable = 0; |
679 | 0 | cJSON *logging_duration_nr = NULL; |
680 | 0 | OpenAPI_logging_duration_nr_mdt_e logging_duration_nrVariable = 0; |
681 | 0 | cJSON *positioning_method = NULL; |
682 | 0 | OpenAPI_positioning_method_mdt_e positioning_methodVariable = 0; |
683 | 0 | cJSON *add_positioning_method_list = NULL; |
684 | 0 | OpenAPI_list_t *add_positioning_method_listList = NULL; |
685 | 0 | cJSON *collection_period_rmm_lte = NULL; |
686 | 0 | OpenAPI_collection_period_rmm_lte_mdt_e collection_period_rmm_lteVariable = 0; |
687 | 0 | cJSON *collection_period_rmm_nr = NULL; |
688 | 0 | OpenAPI_collection_period_rmm_nr_mdt_e collection_period_rmm_nrVariable = 0; |
689 | 0 | cJSON *measurement_period_lte = NULL; |
690 | 0 | OpenAPI_measurement_period_lte_mdt_e measurement_period_lteVariable = 0; |
691 | 0 | cJSON *mdt_allowed_plmn_id_list = NULL; |
692 | 0 | OpenAPI_list_t *mdt_allowed_plmn_id_listList = NULL; |
693 | 0 | cJSON *mbsfn_area_list = NULL; |
694 | 0 | OpenAPI_list_t *mbsfn_area_listList = NULL; |
695 | 0 | cJSON *inter_freq_target_list = NULL; |
696 | 0 | OpenAPI_list_t *inter_freq_target_listList = NULL; |
697 | 0 | cJSON *event_threshold_sinr_nr = NULL; |
698 | 0 | cJSON *bluetooth_measurement_nr = NULL; |
699 | 0 | OpenAPI_bluetooth_measurement_t *bluetooth_measurement_nr_local_nonprim = NULL; |
700 | 0 | cJSON *bluetooth_measurement_lte = NULL; |
701 | 0 | OpenAPI_bluetooth_measurement_t *bluetooth_measurement_lte_local_nonprim = NULL; |
702 | 0 | cJSON *wlan_measurement_nr = NULL; |
703 | 0 | OpenAPI_wlan_measurement_t *wlan_measurement_nr_local_nonprim = NULL; |
704 | 0 | cJSON *wlan_measurement_lte = NULL; |
705 | 0 | OpenAPI_wlan_measurement_t *wlan_measurement_lte_local_nonprim = NULL; |
706 | 0 | cJSON *slice_area_scope = NULL; |
707 | 0 | OpenAPI_list_t *slice_area_scopeList = NULL; |
708 | 0 | job_type = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "jobType"); |
709 | 0 | if (!job_type) { |
710 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [job_type]"); |
711 | 0 | goto end; |
712 | 0 | } |
713 | 0 | if (!cJSON_IsString(job_type)) { |
714 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [job_type]"); |
715 | 0 | goto end; |
716 | 0 | } |
717 | 0 | job_typeVariable = OpenAPI_job_type_FromString(job_type->valuestring); |
718 | |
|
719 | 0 | report_type = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportType"); |
720 | 0 | if (report_type) { |
721 | 0 | if (!cJSON_IsString(report_type)) { |
722 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_type]"); |
723 | 0 | goto end; |
724 | 0 | } |
725 | 0 | report_typeVariable = OpenAPI_report_type_mdt_FromString(report_type->valuestring); |
726 | 0 | } |
727 | | |
728 | 0 | area_scope = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "areaScope"); |
729 | 0 | if (area_scope) { |
730 | 0 | area_scope_local_nonprim = OpenAPI_area_scope_parseFromJSON(area_scope); |
731 | 0 | if (!area_scope_local_nonprim) { |
732 | 0 | ogs_error("OpenAPI_area_scope_parseFromJSON failed [area_scope]"); |
733 | 0 | goto end; |
734 | 0 | } |
735 | 0 | } |
736 | | |
737 | 0 | measurement_lte_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "measurementLteList"); |
738 | 0 | if (measurement_lte_list) { |
739 | 0 | cJSON *measurement_lte_list_local = NULL; |
740 | 0 | if (!cJSON_IsArray(measurement_lte_list)) { |
741 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_lte_list]"); |
742 | 0 | goto end; |
743 | 0 | } |
744 | | |
745 | 0 | measurement_lte_listList = OpenAPI_list_create(); |
746 | |
|
747 | 0 | cJSON_ArrayForEach(measurement_lte_list_local, measurement_lte_list) { |
748 | 0 | OpenAPI_measurement_lte_for_mdt_e localEnum = OpenAPI_measurement_lte_for_mdt_NULL; |
749 | 0 | if (!cJSON_IsString(measurement_lte_list_local)) { |
750 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_lte_list]"); |
751 | 0 | goto end; |
752 | 0 | } |
753 | 0 | localEnum = OpenAPI_measurement_lte_for_mdt_FromString(measurement_lte_list_local->valuestring); |
754 | 0 | if (!localEnum) { |
755 | 0 | ogs_info("Enum value \"%s\" for field \"measurement_lte_list\" is not supported. Ignoring it ...", |
756 | 0 | measurement_lte_list_local->valuestring); |
757 | 0 | } else { |
758 | 0 | OpenAPI_list_add(measurement_lte_listList, (void *)localEnum); |
759 | 0 | } |
760 | 0 | } |
761 | 0 | if (measurement_lte_listList->count == 0) { |
762 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed: Expected measurement_lte_listList to not be empty (after ignoring unsupported enum values)."); |
763 | 0 | goto end; |
764 | 0 | } |
765 | 0 | } |
766 | | |
767 | 0 | measurement_nr_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "measurementNrList"); |
768 | 0 | if (measurement_nr_list) { |
769 | 0 | cJSON *measurement_nr_list_local = NULL; |
770 | 0 | if (!cJSON_IsArray(measurement_nr_list)) { |
771 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_nr_list]"); |
772 | 0 | goto end; |
773 | 0 | } |
774 | | |
775 | 0 | measurement_nr_listList = OpenAPI_list_create(); |
776 | |
|
777 | 0 | cJSON_ArrayForEach(measurement_nr_list_local, measurement_nr_list) { |
778 | 0 | OpenAPI_measurement_nr_for_mdt_e localEnum = OpenAPI_measurement_nr_for_mdt_NULL; |
779 | 0 | if (!cJSON_IsString(measurement_nr_list_local)) { |
780 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_nr_list]"); |
781 | 0 | goto end; |
782 | 0 | } |
783 | 0 | localEnum = OpenAPI_measurement_nr_for_mdt_FromString(measurement_nr_list_local->valuestring); |
784 | 0 | if (!localEnum) { |
785 | 0 | ogs_info("Enum value \"%s\" for field \"measurement_nr_list\" is not supported. Ignoring it ...", |
786 | 0 | measurement_nr_list_local->valuestring); |
787 | 0 | } else { |
788 | 0 | OpenAPI_list_add(measurement_nr_listList, (void *)localEnum); |
789 | 0 | } |
790 | 0 | } |
791 | 0 | if (measurement_nr_listList->count == 0) { |
792 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed: Expected measurement_nr_listList to not be empty (after ignoring unsupported enum values)."); |
793 | 0 | goto end; |
794 | 0 | } |
795 | 0 | } |
796 | | |
797 | 0 | sensor_measurement_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "sensorMeasurementList"); |
798 | 0 | if (sensor_measurement_list) { |
799 | 0 | cJSON *sensor_measurement_list_local = NULL; |
800 | 0 | if (!cJSON_IsArray(sensor_measurement_list)) { |
801 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [sensor_measurement_list]"); |
802 | 0 | goto end; |
803 | 0 | } |
804 | | |
805 | 0 | sensor_measurement_listList = OpenAPI_list_create(); |
806 | |
|
807 | 0 | cJSON_ArrayForEach(sensor_measurement_list_local, sensor_measurement_list) { |
808 | 0 | OpenAPI_sensor_measurement_e localEnum = OpenAPI_sensor_measurement_NULL; |
809 | 0 | if (!cJSON_IsString(sensor_measurement_list_local)) { |
810 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [sensor_measurement_list]"); |
811 | 0 | goto end; |
812 | 0 | } |
813 | 0 | localEnum = OpenAPI_sensor_measurement_FromString(sensor_measurement_list_local->valuestring); |
814 | 0 | if (!localEnum) { |
815 | 0 | ogs_info("Enum value \"%s\" for field \"sensor_measurement_list\" is not supported. Ignoring it ...", |
816 | 0 | sensor_measurement_list_local->valuestring); |
817 | 0 | } else { |
818 | 0 | OpenAPI_list_add(sensor_measurement_listList, (void *)localEnum); |
819 | 0 | } |
820 | 0 | } |
821 | 0 | if (sensor_measurement_listList->count == 0) { |
822 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed: Expected sensor_measurement_listList to not be empty (after ignoring unsupported enum values)."); |
823 | 0 | goto end; |
824 | 0 | } |
825 | 0 | } |
826 | | |
827 | 0 | sensor_measurement_lte_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "sensorMeasurementLteList"); |
828 | 0 | if (sensor_measurement_lte_list) { |
829 | 0 | cJSON *sensor_measurement_lte_list_local = NULL; |
830 | 0 | if (!cJSON_IsArray(sensor_measurement_lte_list)) { |
831 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [sensor_measurement_lte_list]"); |
832 | 0 | goto end; |
833 | 0 | } |
834 | | |
835 | 0 | sensor_measurement_lte_listList = OpenAPI_list_create(); |
836 | |
|
837 | 0 | cJSON_ArrayForEach(sensor_measurement_lte_list_local, sensor_measurement_lte_list) { |
838 | 0 | OpenAPI_sensor_measurement_e localEnum = OpenAPI_sensor_measurement_NULL; |
839 | 0 | if (!cJSON_IsString(sensor_measurement_lte_list_local)) { |
840 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [sensor_measurement_lte_list]"); |
841 | 0 | goto end; |
842 | 0 | } |
843 | 0 | localEnum = OpenAPI_sensor_measurement_FromString(sensor_measurement_lte_list_local->valuestring); |
844 | 0 | if (!localEnum) { |
845 | 0 | ogs_info("Enum value \"%s\" for field \"sensor_measurement_lte_list\" is not supported. Ignoring it ...", |
846 | 0 | sensor_measurement_lte_list_local->valuestring); |
847 | 0 | } else { |
848 | 0 | OpenAPI_list_add(sensor_measurement_lte_listList, (void *)localEnum); |
849 | 0 | } |
850 | 0 | } |
851 | 0 | if (sensor_measurement_lte_listList->count == 0) { |
852 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed: Expected sensor_measurement_lte_listList to not be empty (after ignoring unsupported enum values)."); |
853 | 0 | goto end; |
854 | 0 | } |
855 | 0 | } |
856 | | |
857 | 0 | reporting_trigger_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportingTriggerList"); |
858 | 0 | if (reporting_trigger_list) { |
859 | 0 | cJSON *reporting_trigger_list_local = NULL; |
860 | 0 | if (!cJSON_IsArray(reporting_trigger_list)) { |
861 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [reporting_trigger_list]"); |
862 | 0 | goto end; |
863 | 0 | } |
864 | | |
865 | 0 | reporting_trigger_listList = OpenAPI_list_create(); |
866 | |
|
867 | 0 | cJSON_ArrayForEach(reporting_trigger_list_local, reporting_trigger_list) { |
868 | 0 | OpenAPI_reporting_trigger_e localEnum = OpenAPI_reporting_trigger_NULL; |
869 | 0 | if (!cJSON_IsString(reporting_trigger_list_local)) { |
870 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [reporting_trigger_list]"); |
871 | 0 | goto end; |
872 | 0 | } |
873 | 0 | localEnum = OpenAPI_reporting_trigger_FromString(reporting_trigger_list_local->valuestring); |
874 | 0 | if (!localEnum) { |
875 | 0 | ogs_info("Enum value \"%s\" for field \"reporting_trigger_list\" is not supported. Ignoring it ...", |
876 | 0 | reporting_trigger_list_local->valuestring); |
877 | 0 | } else { |
878 | 0 | OpenAPI_list_add(reporting_trigger_listList, (void *)localEnum); |
879 | 0 | } |
880 | 0 | } |
881 | 0 | if (reporting_trigger_listList->count == 0) { |
882 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed: Expected reporting_trigger_listList to not be empty (after ignoring unsupported enum values)."); |
883 | 0 | goto end; |
884 | 0 | } |
885 | 0 | } |
886 | | |
887 | 0 | report_interval = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportInterval"); |
888 | 0 | if (report_interval) { |
889 | 0 | if (!cJSON_IsString(report_interval)) { |
890 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_interval]"); |
891 | 0 | goto end; |
892 | 0 | } |
893 | 0 | report_intervalVariable = OpenAPI_report_interval_mdt_FromString(report_interval->valuestring); |
894 | 0 | } |
895 | | |
896 | 0 | report_interval_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportIntervalNr"); |
897 | 0 | if (report_interval_nr) { |
898 | 0 | if (!cJSON_IsString(report_interval_nr)) { |
899 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_interval_nr]"); |
900 | 0 | goto end; |
901 | 0 | } |
902 | 0 | report_interval_nrVariable = OpenAPI_report_interval_nr_mdt_FromString(report_interval_nr->valuestring); |
903 | 0 | } |
904 | | |
905 | 0 | report_amount = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportAmount"); |
906 | 0 | if (report_amount) { |
907 | 0 | if (!cJSON_IsString(report_amount)) { |
908 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_amount]"); |
909 | 0 | goto end; |
910 | 0 | } |
911 | 0 | report_amountVariable = OpenAPI_report_amount_mdt_FromString(report_amount->valuestring); |
912 | 0 | } |
913 | | |
914 | 0 | report_amount_per_measurement_lte = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportAmountPerMeasurementLte"); |
915 | 0 | if (report_amount_per_measurement_lte) { |
916 | 0 | cJSON *report_amount_per_measurement_lte_local_map = NULL; |
917 | 0 | if (!cJSON_IsObject(report_amount_per_measurement_lte) && !cJSON_IsNull(report_amount_per_measurement_lte)) { |
918 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_amount_per_measurement_lte]"); |
919 | 0 | goto end; |
920 | 0 | } |
921 | 0 | if (cJSON_IsObject(report_amount_per_measurement_lte)) { |
922 | 0 | report_amount_per_measurement_lteList = OpenAPI_list_create(); |
923 | 0 | OpenAPI_map_t *localMapKeyPair = NULL; |
924 | 0 | cJSON_ArrayForEach(report_amount_per_measurement_lte_local_map, report_amount_per_measurement_lte) { |
925 | 0 | cJSON *localMapObject = report_amount_per_measurement_lte_local_map; |
926 | 0 | if (!cJSON_IsString(localMapObject)) { |
927 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_amount_per_measurement_lte]"); |
928 | 0 | goto end; |
929 | 0 | } |
930 | 0 | localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), (void *)OpenAPI_report_amount_mdt_FromString(localMapObject->string)); |
931 | 0 | if (localMapKeyPair == NULL) { |
932 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_amount_per_measurement_lte]"); |
933 | 0 | goto end; |
934 | 0 | } |
935 | 0 | OpenAPI_list_add(report_amount_per_measurement_lteList, localMapKeyPair); |
936 | 0 | } |
937 | 0 | } |
938 | 0 | } |
939 | | |
940 | 0 | report_amount_per_measurement_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "reportAmountPerMeasurementNr"); |
941 | 0 | if (report_amount_per_measurement_nr) { |
942 | 0 | cJSON *report_amount_per_measurement_nr_local_map = NULL; |
943 | 0 | if (!cJSON_IsObject(report_amount_per_measurement_nr) && !cJSON_IsNull(report_amount_per_measurement_nr)) { |
944 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_amount_per_measurement_nr]"); |
945 | 0 | goto end; |
946 | 0 | } |
947 | 0 | if (cJSON_IsObject(report_amount_per_measurement_nr)) { |
948 | 0 | report_amount_per_measurement_nrList = OpenAPI_list_create(); |
949 | 0 | OpenAPI_map_t *localMapKeyPair = NULL; |
950 | 0 | cJSON_ArrayForEach(report_amount_per_measurement_nr_local_map, report_amount_per_measurement_nr) { |
951 | 0 | cJSON *localMapObject = report_amount_per_measurement_nr_local_map; |
952 | 0 | if (!cJSON_IsString(localMapObject)) { |
953 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_amount_per_measurement_nr]"); |
954 | 0 | goto end; |
955 | 0 | } |
956 | 0 | localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), (void *)OpenAPI_report_amount_mdt_FromString(localMapObject->string)); |
957 | 0 | if (localMapKeyPair == NULL) { |
958 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [report_amount_per_measurement_nr]"); |
959 | 0 | goto end; |
960 | 0 | } |
961 | 0 | OpenAPI_list_add(report_amount_per_measurement_nrList, localMapKeyPair); |
962 | 0 | } |
963 | 0 | } |
964 | 0 | } |
965 | | |
966 | 0 | event_threshold_rsrp = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventThresholdRsrp"); |
967 | 0 | if (event_threshold_rsrp) { |
968 | 0 | if (!cJSON_IsNumber(event_threshold_rsrp)) { |
969 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_threshold_rsrp]"); |
970 | 0 | goto end; |
971 | 0 | } |
972 | 0 | } |
973 | | |
974 | 0 | mn_only_ind = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "mnOnlyInd"); |
975 | 0 | if (mn_only_ind) { |
976 | 0 | if (!cJSON_IsBool(mn_only_ind)) { |
977 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [mn_only_ind]"); |
978 | 0 | goto end; |
979 | 0 | } |
980 | 0 | } |
981 | | |
982 | 0 | event_threshold_rsrp_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventThresholdRsrpNr"); |
983 | 0 | if (event_threshold_rsrp_nr) { |
984 | 0 | if (!cJSON_IsNumber(event_threshold_rsrp_nr)) { |
985 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_threshold_rsrp_nr]"); |
986 | 0 | goto end; |
987 | 0 | } |
988 | 0 | } |
989 | | |
990 | 0 | event_threshold_rsrq = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventThresholdRsrq"); |
991 | 0 | if (event_threshold_rsrq) { |
992 | 0 | if (!cJSON_IsNumber(event_threshold_rsrq)) { |
993 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_threshold_rsrq]"); |
994 | 0 | goto end; |
995 | 0 | } |
996 | 0 | } |
997 | | |
998 | 0 | event_threshold_rsrq_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventThresholdRsrqNr"); |
999 | 0 | if (event_threshold_rsrq_nr) { |
1000 | 0 | if (!cJSON_IsNumber(event_threshold_rsrq_nr)) { |
1001 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_threshold_rsrq_nr]"); |
1002 | 0 | goto end; |
1003 | 0 | } |
1004 | 0 | } |
1005 | | |
1006 | 0 | event_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventList"); |
1007 | 0 | if (event_list) { |
1008 | 0 | cJSON *event_list_local = NULL; |
1009 | 0 | if (!cJSON_IsArray(event_list)) { |
1010 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_list]"); |
1011 | 0 | goto end; |
1012 | 0 | } |
1013 | | |
1014 | 0 | event_listList = OpenAPI_list_create(); |
1015 | |
|
1016 | 0 | cJSON_ArrayForEach(event_list_local, event_list) { |
1017 | 0 | OpenAPI_event_for_mdt_e localEnum = OpenAPI_event_for_mdt_NULL; |
1018 | 0 | if (!cJSON_IsString(event_list_local)) { |
1019 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_list]"); |
1020 | 0 | goto end; |
1021 | 0 | } |
1022 | 0 | localEnum = OpenAPI_event_for_mdt_FromString(event_list_local->valuestring); |
1023 | 0 | if (!localEnum) { |
1024 | 0 | ogs_info("Enum value \"%s\" for field \"event_list\" is not supported. Ignoring it ...", |
1025 | 0 | event_list_local->valuestring); |
1026 | 0 | } else { |
1027 | 0 | OpenAPI_list_add(event_listList, (void *)localEnum); |
1028 | 0 | } |
1029 | 0 | } |
1030 | 0 | if (event_listList->count == 0) { |
1031 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed: Expected event_listList to not be empty (after ignoring unsupported enum values)."); |
1032 | 0 | goto end; |
1033 | 0 | } |
1034 | 0 | } |
1035 | | |
1036 | 0 | logging_interval = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "loggingInterval"); |
1037 | 0 | if (logging_interval) { |
1038 | 0 | if (!cJSON_IsString(logging_interval)) { |
1039 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [logging_interval]"); |
1040 | 0 | goto end; |
1041 | 0 | } |
1042 | 0 | logging_intervalVariable = OpenAPI_logging_interval_mdt_FromString(logging_interval->valuestring); |
1043 | 0 | } |
1044 | | |
1045 | 0 | logging_interval_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "loggingIntervalNr"); |
1046 | 0 | if (logging_interval_nr) { |
1047 | 0 | if (!cJSON_IsString(logging_interval_nr)) { |
1048 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [logging_interval_nr]"); |
1049 | 0 | goto end; |
1050 | 0 | } |
1051 | 0 | logging_interval_nrVariable = OpenAPI_logging_interval_nr_mdt_FromString(logging_interval_nr->valuestring); |
1052 | 0 | } |
1053 | | |
1054 | 0 | logging_duration = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "loggingDuration"); |
1055 | 0 | if (logging_duration) { |
1056 | 0 | if (!cJSON_IsString(logging_duration)) { |
1057 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [logging_duration]"); |
1058 | 0 | goto end; |
1059 | 0 | } |
1060 | 0 | logging_durationVariable = OpenAPI_logging_duration_mdt_FromString(logging_duration->valuestring); |
1061 | 0 | } |
1062 | | |
1063 | 0 | logging_duration_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "loggingDurationNr"); |
1064 | 0 | if (logging_duration_nr) { |
1065 | 0 | if (!cJSON_IsString(logging_duration_nr)) { |
1066 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [logging_duration_nr]"); |
1067 | 0 | goto end; |
1068 | 0 | } |
1069 | 0 | logging_duration_nrVariable = OpenAPI_logging_duration_nr_mdt_FromString(logging_duration_nr->valuestring); |
1070 | 0 | } |
1071 | | |
1072 | 0 | positioning_method = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "positioningMethod"); |
1073 | 0 | if (positioning_method) { |
1074 | 0 | if (!cJSON_IsString(positioning_method)) { |
1075 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [positioning_method]"); |
1076 | 0 | goto end; |
1077 | 0 | } |
1078 | 0 | positioning_methodVariable = OpenAPI_positioning_method_mdt_FromString(positioning_method->valuestring); |
1079 | 0 | } |
1080 | | |
1081 | 0 | add_positioning_method_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "addPositioningMethodList"); |
1082 | 0 | if (add_positioning_method_list) { |
1083 | 0 | cJSON *add_positioning_method_list_local = NULL; |
1084 | 0 | if (!cJSON_IsArray(add_positioning_method_list)) { |
1085 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [add_positioning_method_list]"); |
1086 | 0 | goto end; |
1087 | 0 | } |
1088 | | |
1089 | 0 | add_positioning_method_listList = OpenAPI_list_create(); |
1090 | |
|
1091 | 0 | cJSON_ArrayForEach(add_positioning_method_list_local, add_positioning_method_list) { |
1092 | 0 | OpenAPI_positioning_method_mdt_e localEnum = OpenAPI_positioning_method_mdt_NULL; |
1093 | 0 | if (!cJSON_IsString(add_positioning_method_list_local)) { |
1094 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [add_positioning_method_list]"); |
1095 | 0 | goto end; |
1096 | 0 | } |
1097 | 0 | localEnum = OpenAPI_positioning_method_mdt_FromString(add_positioning_method_list_local->valuestring); |
1098 | 0 | if (!localEnum) { |
1099 | 0 | ogs_info("Enum value \"%s\" for field \"add_positioning_method_list\" is not supported. Ignoring it ...", |
1100 | 0 | add_positioning_method_list_local->valuestring); |
1101 | 0 | } else { |
1102 | 0 | OpenAPI_list_add(add_positioning_method_listList, (void *)localEnum); |
1103 | 0 | } |
1104 | 0 | } |
1105 | 0 | if (add_positioning_method_listList->count == 0) { |
1106 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed: Expected add_positioning_method_listList to not be empty (after ignoring unsupported enum values)."); |
1107 | 0 | goto end; |
1108 | 0 | } |
1109 | 0 | } |
1110 | | |
1111 | 0 | collection_period_rmm_lte = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "collectionPeriodRmmLte"); |
1112 | 0 | if (collection_period_rmm_lte) { |
1113 | 0 | if (!cJSON_IsString(collection_period_rmm_lte)) { |
1114 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [collection_period_rmm_lte]"); |
1115 | 0 | goto end; |
1116 | 0 | } |
1117 | 0 | collection_period_rmm_lteVariable = OpenAPI_collection_period_rmm_lte_mdt_FromString(collection_period_rmm_lte->valuestring); |
1118 | 0 | } |
1119 | | |
1120 | 0 | collection_period_rmm_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "collectionPeriodRmmNr"); |
1121 | 0 | if (collection_period_rmm_nr) { |
1122 | 0 | if (!cJSON_IsString(collection_period_rmm_nr)) { |
1123 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [collection_period_rmm_nr]"); |
1124 | 0 | goto end; |
1125 | 0 | } |
1126 | 0 | collection_period_rmm_nrVariable = OpenAPI_collection_period_rmm_nr_mdt_FromString(collection_period_rmm_nr->valuestring); |
1127 | 0 | } |
1128 | | |
1129 | 0 | measurement_period_lte = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "measurementPeriodLte"); |
1130 | 0 | if (measurement_period_lte) { |
1131 | 0 | if (!cJSON_IsString(measurement_period_lte)) { |
1132 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [measurement_period_lte]"); |
1133 | 0 | goto end; |
1134 | 0 | } |
1135 | 0 | measurement_period_lteVariable = OpenAPI_measurement_period_lte_mdt_FromString(measurement_period_lte->valuestring); |
1136 | 0 | } |
1137 | | |
1138 | 0 | mdt_allowed_plmn_id_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "mdtAllowedPlmnIdList"); |
1139 | 0 | if (mdt_allowed_plmn_id_list) { |
1140 | 0 | cJSON *mdt_allowed_plmn_id_list_local = NULL; |
1141 | 0 | if (!cJSON_IsArray(mdt_allowed_plmn_id_list)) { |
1142 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [mdt_allowed_plmn_id_list]"); |
1143 | 0 | goto end; |
1144 | 0 | } |
1145 | | |
1146 | 0 | mdt_allowed_plmn_id_listList = OpenAPI_list_create(); |
1147 | |
|
1148 | 0 | cJSON_ArrayForEach(mdt_allowed_plmn_id_list_local, mdt_allowed_plmn_id_list) { |
1149 | 0 | if (!cJSON_IsObject(mdt_allowed_plmn_id_list_local)) { |
1150 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [mdt_allowed_plmn_id_list]"); |
1151 | 0 | goto end; |
1152 | 0 | } |
1153 | 0 | OpenAPI_plmn_id_t *mdt_allowed_plmn_id_listItem = OpenAPI_plmn_id_parseFromJSON(mdt_allowed_plmn_id_list_local); |
1154 | 0 | if (!mdt_allowed_plmn_id_listItem) { |
1155 | 0 | ogs_error("No mdt_allowed_plmn_id_listItem"); |
1156 | 0 | goto end; |
1157 | 0 | } |
1158 | 0 | OpenAPI_list_add(mdt_allowed_plmn_id_listList, mdt_allowed_plmn_id_listItem); |
1159 | 0 | } |
1160 | 0 | } |
1161 | | |
1162 | 0 | mbsfn_area_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "mbsfnAreaList"); |
1163 | 0 | if (mbsfn_area_list) { |
1164 | 0 | cJSON *mbsfn_area_list_local = NULL; |
1165 | 0 | if (!cJSON_IsArray(mbsfn_area_list)) { |
1166 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [mbsfn_area_list]"); |
1167 | 0 | goto end; |
1168 | 0 | } |
1169 | | |
1170 | 0 | mbsfn_area_listList = OpenAPI_list_create(); |
1171 | |
|
1172 | 0 | cJSON_ArrayForEach(mbsfn_area_list_local, mbsfn_area_list) { |
1173 | 0 | if (!cJSON_IsObject(mbsfn_area_list_local)) { |
1174 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [mbsfn_area_list]"); |
1175 | 0 | goto end; |
1176 | 0 | } |
1177 | 0 | OpenAPI_mbsfn_area_t *mbsfn_area_listItem = OpenAPI_mbsfn_area_parseFromJSON(mbsfn_area_list_local); |
1178 | 0 | if (!mbsfn_area_listItem) { |
1179 | 0 | ogs_error("No mbsfn_area_listItem"); |
1180 | 0 | goto end; |
1181 | 0 | } |
1182 | 0 | OpenAPI_list_add(mbsfn_area_listList, mbsfn_area_listItem); |
1183 | 0 | } |
1184 | 0 | } |
1185 | | |
1186 | 0 | inter_freq_target_list = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "interFreqTargetList"); |
1187 | 0 | if (inter_freq_target_list) { |
1188 | 0 | cJSON *inter_freq_target_list_local = NULL; |
1189 | 0 | if (!cJSON_IsArray(inter_freq_target_list)) { |
1190 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [inter_freq_target_list]"); |
1191 | 0 | goto end; |
1192 | 0 | } |
1193 | | |
1194 | 0 | inter_freq_target_listList = OpenAPI_list_create(); |
1195 | |
|
1196 | 0 | cJSON_ArrayForEach(inter_freq_target_list_local, inter_freq_target_list) { |
1197 | 0 | if (!cJSON_IsObject(inter_freq_target_list_local)) { |
1198 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [inter_freq_target_list]"); |
1199 | 0 | goto end; |
1200 | 0 | } |
1201 | 0 | OpenAPI_inter_freq_target_info_t *inter_freq_target_listItem = OpenAPI_inter_freq_target_info_parseFromJSON(inter_freq_target_list_local); |
1202 | 0 | if (!inter_freq_target_listItem) { |
1203 | 0 | ogs_error("No inter_freq_target_listItem"); |
1204 | 0 | goto end; |
1205 | 0 | } |
1206 | 0 | OpenAPI_list_add(inter_freq_target_listList, inter_freq_target_listItem); |
1207 | 0 | } |
1208 | 0 | } |
1209 | | |
1210 | 0 | event_threshold_sinr_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "eventThresholdSinrNr"); |
1211 | 0 | if (event_threshold_sinr_nr) { |
1212 | 0 | if (!cJSON_IsNumber(event_threshold_sinr_nr)) { |
1213 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [event_threshold_sinr_nr]"); |
1214 | 0 | goto end; |
1215 | 0 | } |
1216 | 0 | } |
1217 | | |
1218 | 0 | bluetooth_measurement_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "bluetoothMeasurementNr"); |
1219 | 0 | if (bluetooth_measurement_nr) { |
1220 | 0 | bluetooth_measurement_nr_local_nonprim = OpenAPI_bluetooth_measurement_parseFromJSON(bluetooth_measurement_nr); |
1221 | 0 | if (!bluetooth_measurement_nr_local_nonprim) { |
1222 | 0 | ogs_error("OpenAPI_bluetooth_measurement_parseFromJSON failed [bluetooth_measurement_nr]"); |
1223 | 0 | goto end; |
1224 | 0 | } |
1225 | 0 | } |
1226 | | |
1227 | 0 | bluetooth_measurement_lte = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "bluetoothMeasurementLte"); |
1228 | 0 | if (bluetooth_measurement_lte) { |
1229 | 0 | bluetooth_measurement_lte_local_nonprim = OpenAPI_bluetooth_measurement_parseFromJSON(bluetooth_measurement_lte); |
1230 | 0 | if (!bluetooth_measurement_lte_local_nonprim) { |
1231 | 0 | ogs_error("OpenAPI_bluetooth_measurement_parseFromJSON failed [bluetooth_measurement_lte]"); |
1232 | 0 | goto end; |
1233 | 0 | } |
1234 | 0 | } |
1235 | | |
1236 | 0 | wlan_measurement_nr = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "wlanMeasurementNr"); |
1237 | 0 | if (wlan_measurement_nr) { |
1238 | 0 | wlan_measurement_nr_local_nonprim = OpenAPI_wlan_measurement_parseFromJSON(wlan_measurement_nr); |
1239 | 0 | if (!wlan_measurement_nr_local_nonprim) { |
1240 | 0 | ogs_error("OpenAPI_wlan_measurement_parseFromJSON failed [wlan_measurement_nr]"); |
1241 | 0 | goto end; |
1242 | 0 | } |
1243 | 0 | } |
1244 | | |
1245 | 0 | wlan_measurement_lte = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "wlanMeasurementLte"); |
1246 | 0 | if (wlan_measurement_lte) { |
1247 | 0 | wlan_measurement_lte_local_nonprim = OpenAPI_wlan_measurement_parseFromJSON(wlan_measurement_lte); |
1248 | 0 | if (!wlan_measurement_lte_local_nonprim) { |
1249 | 0 | ogs_error("OpenAPI_wlan_measurement_parseFromJSON failed [wlan_measurement_lte]"); |
1250 | 0 | goto end; |
1251 | 0 | } |
1252 | 0 | } |
1253 | | |
1254 | 0 | slice_area_scope = cJSON_GetObjectItemCaseSensitive(mdt_configurationJSON, "sliceAreaScope"); |
1255 | 0 | if (slice_area_scope) { |
1256 | 0 | cJSON *slice_area_scope_local = NULL; |
1257 | 0 | if (!cJSON_IsArray(slice_area_scope)) { |
1258 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [slice_area_scope]"); |
1259 | 0 | goto end; |
1260 | 0 | } |
1261 | | |
1262 | 0 | slice_area_scopeList = OpenAPI_list_create(); |
1263 | |
|
1264 | 0 | cJSON_ArrayForEach(slice_area_scope_local, slice_area_scope) { |
1265 | 0 | if (!cJSON_IsObject(slice_area_scope_local)) { |
1266 | 0 | ogs_error("OpenAPI_mdt_configuration_parseFromJSON() failed [slice_area_scope]"); |
1267 | 0 | goto end; |
1268 | 0 | } |
1269 | 0 | OpenAPI_slice_scope_per_plmn_t *slice_area_scopeItem = OpenAPI_slice_scope_per_plmn_parseFromJSON(slice_area_scope_local); |
1270 | 0 | if (!slice_area_scopeItem) { |
1271 | 0 | ogs_error("No slice_area_scopeItem"); |
1272 | 0 | goto end; |
1273 | 0 | } |
1274 | 0 | OpenAPI_list_add(slice_area_scopeList, slice_area_scopeItem); |
1275 | 0 | } |
1276 | 0 | } |
1277 | | |
1278 | 0 | mdt_configuration_local_var = OpenAPI_mdt_configuration_create ( |
1279 | 0 | job_typeVariable, |
1280 | 0 | report_type ? report_typeVariable : 0, |
1281 | 0 | area_scope ? area_scope_local_nonprim : NULL, |
1282 | 0 | measurement_lte_list ? measurement_lte_listList : NULL, |
1283 | 0 | measurement_nr_list ? measurement_nr_listList : NULL, |
1284 | 0 | sensor_measurement_list ? sensor_measurement_listList : NULL, |
1285 | 0 | sensor_measurement_lte_list ? sensor_measurement_lte_listList : NULL, |
1286 | 0 | reporting_trigger_list ? reporting_trigger_listList : NULL, |
1287 | 0 | report_interval ? report_intervalVariable : 0, |
1288 | 0 | report_interval_nr ? report_interval_nrVariable : 0, |
1289 | 0 | report_amount ? report_amountVariable : 0, |
1290 | 0 | report_amount_per_measurement_lte ? report_amount_per_measurement_lteList : NULL, |
1291 | 0 | report_amount_per_measurement_nr ? report_amount_per_measurement_nrList : NULL, |
1292 | 0 | event_threshold_rsrp ? true : false, |
1293 | 0 | event_threshold_rsrp ? event_threshold_rsrp->valuedouble : 0, |
1294 | 0 | mn_only_ind ? true : false, |
1295 | 0 | mn_only_ind ? mn_only_ind->valueint : 0, |
1296 | 0 | event_threshold_rsrp_nr ? true : false, |
1297 | 0 | event_threshold_rsrp_nr ? event_threshold_rsrp_nr->valuedouble : 0, |
1298 | 0 | event_threshold_rsrq ? true : false, |
1299 | 0 | event_threshold_rsrq ? event_threshold_rsrq->valuedouble : 0, |
1300 | 0 | event_threshold_rsrq_nr ? true : false, |
1301 | 0 | event_threshold_rsrq_nr ? event_threshold_rsrq_nr->valuedouble : 0, |
1302 | 0 | event_list ? event_listList : NULL, |
1303 | 0 | logging_interval ? logging_intervalVariable : 0, |
1304 | 0 | logging_interval_nr ? logging_interval_nrVariable : 0, |
1305 | 0 | logging_duration ? logging_durationVariable : 0, |
1306 | 0 | logging_duration_nr ? logging_duration_nrVariable : 0, |
1307 | 0 | positioning_method ? positioning_methodVariable : 0, |
1308 | 0 | add_positioning_method_list ? add_positioning_method_listList : NULL, |
1309 | 0 | collection_period_rmm_lte ? collection_period_rmm_lteVariable : 0, |
1310 | 0 | collection_period_rmm_nr ? collection_period_rmm_nrVariable : 0, |
1311 | 0 | measurement_period_lte ? measurement_period_lteVariable : 0, |
1312 | 0 | mdt_allowed_plmn_id_list ? mdt_allowed_plmn_id_listList : NULL, |
1313 | 0 | mbsfn_area_list ? mbsfn_area_listList : NULL, |
1314 | 0 | inter_freq_target_list ? inter_freq_target_listList : NULL, |
1315 | 0 | event_threshold_sinr_nr ? true : false, |
1316 | 0 | event_threshold_sinr_nr ? event_threshold_sinr_nr->valuedouble : 0, |
1317 | 0 | bluetooth_measurement_nr ? bluetooth_measurement_nr_local_nonprim : NULL, |
1318 | 0 | bluetooth_measurement_lte ? bluetooth_measurement_lte_local_nonprim : NULL, |
1319 | 0 | wlan_measurement_nr ? wlan_measurement_nr_local_nonprim : NULL, |
1320 | 0 | wlan_measurement_lte ? wlan_measurement_lte_local_nonprim : NULL, |
1321 | 0 | slice_area_scope ? slice_area_scopeList : NULL |
1322 | 0 | ); |
1323 | |
|
1324 | 0 | return mdt_configuration_local_var; |
1325 | 0 | end: |
1326 | 0 | if (area_scope_local_nonprim) { |
1327 | 0 | OpenAPI_area_scope_free(area_scope_local_nonprim); |
1328 | 0 | area_scope_local_nonprim = NULL; |
1329 | 0 | } |
1330 | 0 | if (measurement_lte_listList) { |
1331 | 0 | OpenAPI_list_free(measurement_lte_listList); |
1332 | 0 | measurement_lte_listList = NULL; |
1333 | 0 | } |
1334 | 0 | if (measurement_nr_listList) { |
1335 | 0 | OpenAPI_list_free(measurement_nr_listList); |
1336 | 0 | measurement_nr_listList = NULL; |
1337 | 0 | } |
1338 | 0 | if (sensor_measurement_listList) { |
1339 | 0 | OpenAPI_list_free(sensor_measurement_listList); |
1340 | 0 | sensor_measurement_listList = NULL; |
1341 | 0 | } |
1342 | 0 | if (sensor_measurement_lte_listList) { |
1343 | 0 | OpenAPI_list_free(sensor_measurement_lte_listList); |
1344 | 0 | sensor_measurement_lte_listList = NULL; |
1345 | 0 | } |
1346 | 0 | if (reporting_trigger_listList) { |
1347 | 0 | OpenAPI_list_free(reporting_trigger_listList); |
1348 | 0 | reporting_trigger_listList = NULL; |
1349 | 0 | } |
1350 | 0 | if (report_amount_per_measurement_lteList) { |
1351 | 0 | OpenAPI_list_for_each(report_amount_per_measurement_lteList, node) { |
1352 | 0 | OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; |
1353 | 0 | ogs_free(localKeyValue->key); |
1354 | 0 | OpenAPI_map_free(localKeyValue); |
1355 | 0 | } |
1356 | 0 | OpenAPI_list_free(report_amount_per_measurement_lteList); |
1357 | 0 | report_amount_per_measurement_lteList = NULL; |
1358 | 0 | } |
1359 | 0 | if (report_amount_per_measurement_nrList) { |
1360 | 0 | OpenAPI_list_for_each(report_amount_per_measurement_nrList, node) { |
1361 | 0 | OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; |
1362 | 0 | ogs_free(localKeyValue->key); |
1363 | 0 | OpenAPI_map_free(localKeyValue); |
1364 | 0 | } |
1365 | 0 | OpenAPI_list_free(report_amount_per_measurement_nrList); |
1366 | 0 | report_amount_per_measurement_nrList = NULL; |
1367 | 0 | } |
1368 | 0 | if (event_listList) { |
1369 | 0 | OpenAPI_list_free(event_listList); |
1370 | 0 | event_listList = NULL; |
1371 | 0 | } |
1372 | 0 | if (add_positioning_method_listList) { |
1373 | 0 | OpenAPI_list_free(add_positioning_method_listList); |
1374 | 0 | add_positioning_method_listList = NULL; |
1375 | 0 | } |
1376 | 0 | if (mdt_allowed_plmn_id_listList) { |
1377 | 0 | OpenAPI_list_for_each(mdt_allowed_plmn_id_listList, node) { |
1378 | 0 | OpenAPI_plmn_id_free(node->data); |
1379 | 0 | } |
1380 | 0 | OpenAPI_list_free(mdt_allowed_plmn_id_listList); |
1381 | 0 | mdt_allowed_plmn_id_listList = NULL; |
1382 | 0 | } |
1383 | 0 | if (mbsfn_area_listList) { |
1384 | 0 | OpenAPI_list_for_each(mbsfn_area_listList, node) { |
1385 | 0 | OpenAPI_mbsfn_area_free(node->data); |
1386 | 0 | } |
1387 | 0 | OpenAPI_list_free(mbsfn_area_listList); |
1388 | 0 | mbsfn_area_listList = NULL; |
1389 | 0 | } |
1390 | 0 | if (inter_freq_target_listList) { |
1391 | 0 | OpenAPI_list_for_each(inter_freq_target_listList, node) { |
1392 | 0 | OpenAPI_inter_freq_target_info_free(node->data); |
1393 | 0 | } |
1394 | 0 | OpenAPI_list_free(inter_freq_target_listList); |
1395 | 0 | inter_freq_target_listList = NULL; |
1396 | 0 | } |
1397 | 0 | if (bluetooth_measurement_nr_local_nonprim) { |
1398 | 0 | OpenAPI_bluetooth_measurement_free(bluetooth_measurement_nr_local_nonprim); |
1399 | 0 | bluetooth_measurement_nr_local_nonprim = NULL; |
1400 | 0 | } |
1401 | 0 | if (bluetooth_measurement_lte_local_nonprim) { |
1402 | 0 | OpenAPI_bluetooth_measurement_free(bluetooth_measurement_lte_local_nonprim); |
1403 | 0 | bluetooth_measurement_lte_local_nonprim = NULL; |
1404 | 0 | } |
1405 | 0 | if (wlan_measurement_nr_local_nonprim) { |
1406 | 0 | OpenAPI_wlan_measurement_free(wlan_measurement_nr_local_nonprim); |
1407 | 0 | wlan_measurement_nr_local_nonprim = NULL; |
1408 | 0 | } |
1409 | 0 | if (wlan_measurement_lte_local_nonprim) { |
1410 | 0 | OpenAPI_wlan_measurement_free(wlan_measurement_lte_local_nonprim); |
1411 | 0 | wlan_measurement_lte_local_nonprim = NULL; |
1412 | 0 | } |
1413 | 0 | if (slice_area_scopeList) { |
1414 | 0 | OpenAPI_list_for_each(slice_area_scopeList, node) { |
1415 | 0 | OpenAPI_slice_scope_per_plmn_free(node->data); |
1416 | 0 | } |
1417 | 0 | OpenAPI_list_free(slice_area_scopeList); |
1418 | 0 | slice_area_scopeList = NULL; |
1419 | 0 | } |
1420 | 0 | return NULL; |
1421 | 0 | } |
1422 | | |
1423 | | OpenAPI_mdt_configuration_t *OpenAPI_mdt_configuration_copy(OpenAPI_mdt_configuration_t *dst, OpenAPI_mdt_configuration_t *src) |
1424 | 0 | { |
1425 | 0 | cJSON *item = NULL; |
1426 | 0 | char *content = NULL; |
1427 | |
|
1428 | 0 | ogs_assert(src); |
1429 | 0 | item = OpenAPI_mdt_configuration_convertToJSON(src); |
1430 | 0 | if (!item) { |
1431 | 0 | ogs_error("OpenAPI_mdt_configuration_convertToJSON() failed"); |
1432 | 0 | return NULL; |
1433 | 0 | } |
1434 | | |
1435 | 0 | content = cJSON_Print(item); |
1436 | 0 | cJSON_Delete(item); |
1437 | |
|
1438 | 0 | if (!content) { |
1439 | 0 | ogs_error("cJSON_Print() failed"); |
1440 | 0 | return NULL; |
1441 | 0 | } |
1442 | | |
1443 | 0 | item = cJSON_Parse(content); |
1444 | 0 | ogs_free(content); |
1445 | 0 | if (!item) { |
1446 | 0 | ogs_error("cJSON_Parse() failed"); |
1447 | 0 | return NULL; |
1448 | 0 | } |
1449 | | |
1450 | 0 | OpenAPI_mdt_configuration_free(dst); |
1451 | 0 | dst = OpenAPI_mdt_configuration_parseFromJSON(item); |
1452 | 0 | cJSON_Delete(item); |
1453 | |
|
1454 | 0 | return dst; |
1455 | 0 | } |
1456 | | |