@@ -154,183 +154,183 @@ struct modem_info_data {
154
154
const char * data_name ;
155
155
uint8_t param_index ;
156
156
uint8_t param_count ;
157
- enum at_param_type data_type ;
157
+ enum modem_info_data_type data_type ;
158
158
};
159
159
160
160
static const struct modem_info_data rsrp_data = {
161
161
.cmd = AT_CMD_CESQ ,
162
162
.data_name = RSRP_DATA_NAME ,
163
163
.param_index = RSRP_PARAM_INDEX ,
164
164
.param_count = RSRP_PARAM_COUNT ,
165
- .data_type = AT_PARAM_TYPE_NUM_INT ,
165
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
166
166
};
167
167
168
168
static const struct modem_info_data band_data = {
169
169
.cmd = AT_CMD_CURRENT_BAND ,
170
170
.data_name = CUR_BAND_DATA_NAME ,
171
171
.param_index = BAND_PARAM_INDEX ,
172
172
.param_count = BAND_PARAM_COUNT ,
173
- .data_type = AT_PARAM_TYPE_NUM_INT ,
173
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
174
174
};
175
175
176
176
static const struct modem_info_data band_sup_data = {
177
177
.cmd = AT_CMD_SUPPORTED_BAND ,
178
178
.data_name = SUP_BAND_DATA_NAME ,
179
179
.param_index = BAND_PARAM_INDEX ,
180
180
.param_count = BAND_PARAM_COUNT ,
181
- .data_type = AT_PARAM_TYPE_STRING ,
181
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
182
182
};
183
183
184
184
static const struct modem_info_data mode_data = {
185
185
.cmd = AT_CMD_CURRENT_MODE ,
186
186
.data_name = UE_MODE_DATA_NAME ,
187
187
.param_index = MODE_PARAM_INDEX ,
188
188
.param_count = MODE_PARAM_COUNT ,
189
- .data_type = AT_PARAM_TYPE_NUM_INT ,
189
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
190
190
};
191
191
192
192
static const struct modem_info_data operator_data = {
193
193
.cmd = AT_CMD_CURRENT_OP ,
194
194
.data_name = OPERATOR_DATA_NAME ,
195
195
.param_index = OPERATOR_PARAM_INDEX ,
196
196
.param_count = OPERATOR_PARAM_COUNT ,
197
- .data_type = AT_PARAM_TYPE_STRING ,
197
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
198
198
};
199
199
200
200
static const struct modem_info_data mcc_data = {
201
201
.cmd = AT_CMD_CURRENT_OP ,
202
202
.data_name = MCC_DATA_NAME ,
203
203
.param_index = OPERATOR_PARAM_INDEX ,
204
204
.param_count = OPERATOR_PARAM_COUNT ,
205
- .data_type = AT_PARAM_TYPE_NUM_INT ,
205
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
206
206
};
207
207
208
208
static const struct modem_info_data mnc_data = {
209
209
.cmd = AT_CMD_CURRENT_OP ,
210
210
.data_name = MNC_DATA_NAME ,
211
211
.param_index = OPERATOR_PARAM_INDEX ,
212
212
.param_count = OPERATOR_PARAM_COUNT ,
213
- .data_type = AT_PARAM_TYPE_NUM_INT ,
213
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
214
214
};
215
215
216
216
static const struct modem_info_data cellid_data = {
217
217
.cmd = AT_CMD_NETWORK_STATUS ,
218
218
.data_name = CELLID_DATA_NAME ,
219
219
.param_index = CELLID_PARAM_INDEX ,
220
220
.param_count = CELLID_PARAM_COUNT ,
221
- .data_type = AT_PARAM_TYPE_STRING ,
221
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
222
222
};
223
223
224
224
static const struct modem_info_data area_data = {
225
225
.cmd = AT_CMD_NETWORK_STATUS ,
226
226
.data_name = AREA_CODE_DATA_NAME ,
227
227
.param_index = AREA_CODE_PARAM_INDEX ,
228
228
.param_count = AREA_CODE_PARAM_COUNT ,
229
- .data_type = AT_PARAM_TYPE_STRING ,
229
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
230
230
};
231
231
232
232
static const struct modem_info_data ip_data = {
233
233
.cmd = AT_CMD_PDP_CONTEXT ,
234
234
.data_name = IP_ADDRESS_DATA_NAME ,
235
235
.param_index = IP_ADDRESS_PARAM_INDEX ,
236
236
.param_count = IP_ADDRESS_PARAM_COUNT ,
237
- .data_type = AT_PARAM_TYPE_STRING ,
237
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
238
238
};
239
239
240
240
static const struct modem_info_data uicc_data = {
241
241
.cmd = AT_CMD_UICC_STATE ,
242
242
.data_name = UICC_DATA_NAME ,
243
243
.param_index = UICC_PARAM_INDEX ,
244
244
.param_count = UICC_PARAM_COUNT ,
245
- .data_type = AT_PARAM_TYPE_NUM_INT ,
245
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
246
246
};
247
247
248
248
static const struct modem_info_data battery_data = {
249
249
.cmd = AT_CMD_VBAT ,
250
250
.data_name = BATTERY_DATA_NAME ,
251
251
.param_index = VBAT_PARAM_INDEX ,
252
252
.param_count = VBAT_PARAM_COUNT ,
253
- .data_type = AT_PARAM_TYPE_NUM_INT ,
253
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
254
254
};
255
255
256
256
static const struct modem_info_data temp_data = {
257
257
.cmd = AT_CMD_TEMP ,
258
258
.data_name = TEMPERATURE_DATA_NAME ,
259
259
.param_index = TEMP_PARAM_INDEX ,
260
260
.param_count = TEMP_PARAM_COUNT ,
261
- .data_type = AT_PARAM_TYPE_NUM_INT ,
261
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
262
262
};
263
263
264
264
static const struct modem_info_data fw_data = {
265
265
.cmd = AT_CMD_FW_VERSION ,
266
266
.data_name = MODEM_FW_DATA_NAME ,
267
267
.param_index = MODEM_FW_PARAM_INDEX ,
268
268
.param_count = MODEM_FW_PARAM_COUNT ,
269
- .data_type = AT_PARAM_TYPE_STRING ,
269
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
270
270
};
271
271
272
272
static const struct modem_info_data iccid_data = {
273
273
.cmd = AT_CMD_ICCID ,
274
274
.data_name = ICCID_DATA_NAME ,
275
275
.param_index = ICCID_PARAM_INDEX ,
276
276
.param_count = ICCID_PARAM_COUNT ,
277
- .data_type = AT_PARAM_TYPE_STRING ,
277
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
278
278
};
279
279
280
280
static const struct modem_info_data lte_mode_data = {
281
281
.cmd = AT_CMD_SYSTEMMODE ,
282
282
.data_name = LTE_MODE_DATA_NAME ,
283
283
.param_index = LTE_MODE_PARAM_INDEX ,
284
284
.param_count = SYSTEMMODE_PARAM_COUNT ,
285
- .data_type = AT_PARAM_TYPE_NUM_INT ,
285
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
286
286
};
287
287
288
288
static const struct modem_info_data nbiot_mode_data = {
289
289
.cmd = AT_CMD_SYSTEMMODE ,
290
290
.data_name = NBIOT_MODE_DATA_NAME ,
291
291
.param_index = NBIOT_MODE_PARAM_INDEX ,
292
292
.param_count = SYSTEMMODE_PARAM_COUNT ,
293
- .data_type = AT_PARAM_TYPE_NUM_INT ,
293
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
294
294
};
295
295
296
296
static const struct modem_info_data gps_mode_data = {
297
297
.cmd = AT_CMD_SYSTEMMODE ,
298
298
.data_name = GPS_MODE_DATA_NAME ,
299
299
.param_index = GPS_MODE_PARAM_INDEX ,
300
300
.param_count = SYSTEMMODE_PARAM_COUNT ,
301
- .data_type = AT_PARAM_TYPE_NUM_INT ,
301
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
302
302
};
303
303
304
304
static const struct modem_info_data imsi_data = {
305
305
.cmd = AT_CMD_IMSI ,
306
306
.data_name = IMSI_DATA_NAME ,
307
307
.param_index = IMSI_PARAM_INDEX ,
308
308
.param_count = IMSI_PARAM_COUNT ,
309
- .data_type = AT_PARAM_TYPE_STRING ,
309
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
310
310
};
311
311
312
312
static const struct modem_info_data imei_data = {
313
313
.cmd = AT_CMD_IMEI ,
314
314
.data_name = MODEM_IMEI_DATA_NAME ,
315
315
.param_index = MODEM_IMEI_PARAM_INDEX ,
316
316
.param_count = MODEM_IMEI_PARAM_COUNT ,
317
- .data_type = AT_PARAM_TYPE_STRING ,
317
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
318
318
};
319
319
320
320
static const struct modem_info_data date_time_data = {
321
321
.cmd = AT_CMD_DATE_TIME ,
322
322
.data_name = DATE_TIME_DATA_NAME ,
323
323
.param_index = DATE_TIME_PARAM_INDEX ,
324
324
.param_count = DATE_TIME_PARAM_COUNT ,
325
- .data_type = AT_PARAM_TYPE_STRING ,
325
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
326
326
};
327
327
328
328
static const struct modem_info_data apn_data = {
329
329
.cmd = AT_CMD_PDP_CONTEXT ,
330
330
.data_name = APN_DATA_NAME ,
331
331
.param_index = APN_PARAM_INDEX ,
332
332
.param_count = APN_PARAM_COUNT ,
333
- .data_type = AT_PARAM_TYPE_STRING ,
333
+ .data_type = MODEM_INFO_DATA_TYPE_STRING ,
334
334
};
335
335
336
336
static const struct modem_info_data * const modem_data [] = {
@@ -398,6 +398,23 @@ enum at_param_type modem_info_type_get(enum modem_info info_type)
398
398
return - EINVAL ;
399
399
}
400
400
401
+ switch (modem_data [info_type ]-> data_type ) {
402
+ case MODEM_INFO_DATA_TYPE_NUM_INT :
403
+ return AT_PARAM_TYPE_NUM_INT ;
404
+ case MODEM_INFO_DATA_TYPE_STRING :
405
+ return AT_PARAM_TYPE_STRING ;
406
+ default :
407
+ /* Unreachable. */
408
+ return AT_PARAM_TYPE_INVALID ;
409
+ }
410
+ }
411
+
412
+ enum modem_info_data_type modem_info_data_type_get (enum modem_info info_type )
413
+ {
414
+ if (info_type >= MODEM_INFO_COUNT ) {
415
+ return MODEM_INFO_DATA_TYPE_INVALID ;
416
+ }
417
+
401
418
return modem_data [info_type ]-> data_type ;
402
419
}
403
420
@@ -433,7 +450,7 @@ int modem_info_short_get(enum modem_info info, uint16_t *buf)
433
450
return - EINVAL ;
434
451
}
435
452
436
- if (modem_data [info ]-> data_type == AT_PARAM_TYPE_STRING ) {
453
+ if (modem_data [info ]-> data_type == MODEM_INFO_DATA_TYPE_STRING ) {
437
454
return - EINVAL ;
438
455
}
439
456
@@ -633,7 +650,7 @@ int modem_info_string_get(enum modem_info info, char *buf, const size_t buf_size
633
650
err = at_parser_init (& parser , recv_buf );
634
651
__ASSERT_NO_MSG (err == 0 );
635
652
636
- if (modem_data [info ]-> data_type == AT_PARAM_TYPE_NUM_INT ) {
653
+ if (modem_data [info ]-> data_type == MODEM_INFO_DATA_TYPE_NUM_INT ) {
637
654
err = at_parser_num_get (& parser ,
638
655
modem_data [info ]-> param_index ,
639
656
& param_value );
@@ -646,7 +663,7 @@ int modem_info_string_get(enum modem_info info, char *buf, const size_t buf_size
646
663
if ((len <= 0 ) || (len > buf_size )) {
647
664
return - EMSGSIZE ;
648
665
}
649
- } else if (modem_data [info ]-> data_type == AT_PARAM_TYPE_STRING ) {
666
+ } else if (modem_data [info ]-> data_type == MODEM_INFO_DATA_TYPE_STRING ) {
650
667
len = buf_size - out_buf_len ;
651
668
err = at_parser_string_get (& parser ,
652
669
modem_data [info ]-> param_index ,
@@ -685,7 +702,7 @@ static void modem_info_rsrp_subscribe_handler(const char *notif)
685
702
.data_name = RSRP_DATA_NAME ,
686
703
.param_index = RSRP_NOTIFY_PARAM_INDEX ,
687
704
.param_count = RSRP_NOTIFY_PARAM_COUNT ,
688
- .data_type = AT_PARAM_TYPE_NUM_INT ,
705
+ .data_type = MODEM_INFO_DATA_TYPE_NUM_INT ,
689
706
};
690
707
691
708
err = at_parser_init (& parser , notif );
0 commit comments