nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches
modem_info.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef ZEPHYR_INCLUDE_MODEM_INFO_H_
8#define ZEPHYR_INCLUDE_MODEM_INFO_H_
9
10#ifdef CONFIG_CJSON_LIB
11#include <cJSON.h>
12#endif
13
14#include <modem/at_params.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
29#define MODEM_INFO_MAX_RESPONSE_SIZE 100
30
32#define MODEM_INFO_JSON_STRING_SIZE 512
33
35#define MODEM_INFO_FWVER_SIZE 41
36
38#define BAND_UNAVAILABLE 0
39
43#define MODEM_INFO_SHORT_OP_NAME_SIZE 65
44
46#define SNR_UNAVAILABLE 127
47
49#define SNR_OFFSET_VAL 24
50
81#define RSRP_IDX_TO_DBM(rsrp) ((rsrp) < 0 ? (rsrp) - 140 : (rsrp) - 141)
82
118#define RSRQ_IDX_TO_DB(rsrq) ((rsrq) < 0 ? \
119 (((float)(rsrq) - 39) * 0.5f) : \
120 ((rsrq) < 35 ? \
121 (((float)(rsrq) - 40) * 0.5f) : \
122 (((float)(rsrq) - 41) * 0.5f)))
123
125typedef void (*rsrp_cb_t)(char rsrp_value);
126
153
161
182
184struct sim_param {
188};
189
195 const char *board;
196 const char *app_version;
197 const char *app_name;
198};
199
206
213
214
223
232
243
251
265int modem_info_string_get(enum modem_info info, char *buf,
266 const size_t buf_size);
279int modem_info_short_get(enum modem_info info, uint16_t *buf);
280
289int modem_info_name_get(enum modem_info info, char *name);
290
300
311
326int modem_info_get_fw_uuid(char *buf, size_t buf_size);
327
342int modem_info_get_fw_version(char *buf, size_t buf_size);
343
358int modem_info_get_hw_version(char *buf, uint8_t buf_size);
359
374int modem_info_get_svn(char *buf, size_t buf_size);
375
387
398
410
426int modem_info_get_connectivity_stats(int *tx_kbytes, int *rx_kbytes);
427
438
448int modem_info_get_operator(char *buf, size_t buf_size);
449
459int modem_info_get_snr(int *val);
460
463#ifdef __cplusplus
464}
465#endif
466
467#endif /* ZEPHYR_INCLUDE_MODEM_INFO_H_ */
Store a list of AT command/response parameters.
at_param_type
Parameter types that can be stored.
Definition at_params.h:37
#define MODEM_INFO_MAX_RESPONSE_SIZE
Definition modem_info.h:29
int modem_info_get_fw_version(char *buf, size_t buf_size)
Obtain the short software identification.
int modem_info_get_current_band(uint8_t *val)
Obtain the current band.
int modem_info_name_get(enum modem_info info, char *name)
Request the name of a modem information data type.
int modem_info_get_fw_uuid(char *buf, size_t buf_size)
Obtain the UUID of the modem firmware build.
int modem_info_get_hw_version(char *buf, uint8_t buf_size)
Obtain the hardware version string.
int modem_info_params_get(struct modem_param_info *modem_param)
Obtain the modem parameters.
int modem_info_rsrp_register(rsrp_cb_t cb)
Initialize the subscription of RSRP values.
int modem_info_params_init(struct modem_param_info *modem_param)
Initialize the structure that stores modem information.
int modem_info_get_rsrp(int *val)
Obtain the RSRP.
int modem_info_init(void)
Initialize the modem information module.
int modem_info_short_get(enum modem_info info, uint16_t *buf)
Request the current modem status of any predefined information value as a short.
modem_info
LTE link information data.
Definition modem_info.h:128
@ MODEM_INFO_IMSI
Definition modem_info.h:147
@ MODEM_INFO_AREA_CODE
Definition modem_info.h:132
@ MODEM_INFO_GPS_MODE
Definition modem_info.h:146
@ MODEM_INFO_MCC
Definition modem_info.h:135
@ MODEM_INFO_CUR_BAND
Definition modem_info.h:130
@ MODEM_INFO_DATE_TIME
Definition modem_info.h:149
@ MODEM_INFO_UE_MODE
Definition modem_info.h:133
@ MODEM_INFO_NBIOT_MODE
Definition modem_info.h:145
@ MODEM_INFO_IMEI
Definition modem_info.h:148
@ MODEM_INFO_BATTERY
Definition modem_info.h:140
@ MODEM_INFO_FW_VERSION
Definition modem_info.h:142
@ MODEM_INFO_RSRP
Definition modem_info.h:129
@ MODEM_INFO_COUNT
Definition modem_info.h:151
@ MODEM_INFO_IP_ADDRESS
Definition modem_info.h:138
@ MODEM_INFO_SUP_BAND
Definition modem_info.h:131
@ MODEM_INFO_CELLID
Definition modem_info.h:137
@ MODEM_INFO_APN
Definition modem_info.h:150
@ MODEM_INFO_UICC
Definition modem_info.h:139
@ MODEM_INFO_ICCID
Definition modem_info.h:143
@ MODEM_INFO_TEMP
Definition modem_info.h:141
@ MODEM_INFO_OPERATOR
Definition modem_info.h:134
@ MODEM_INFO_LTE_MODE
Definition modem_info.h:144
@ MODEM_INFO_MNC
Definition modem_info.h:136
int modem_info_get_batt_voltage(int *val)
Obtain the battery voltage.
int modem_info_get_svn(char *buf, size_t buf_size)
Obtain the modem Software Version Number (SVN).
int modem_info_connectivity_stats_init(void)
Initialize collection of connectivity statistics.
int modem_info_connectivity_stats_disable(void)
Disable collection of connectivity statistics.
int modem_info_get_operator(char *buf, size_t buf_size)
Obtain the operator name.
void(* rsrp_cb_t)(char rsrp_value)
RSRP event handler function prototype.
Definition modem_info.h:125
int modem_info_get_connectivity_stats(int *tx_kbytes, int *rx_kbytes)
Obtain the connectivity statistics.
int modem_info_get_temperature(int *val)
Obtain the internal temperature.
int modem_info_get_snr(int *val)
Obtain the signal-to-noise ratio.
int modem_info_string_get(enum modem_info info, char *buf, const size_t buf_size)
Request the current modem status of any predefined information value as a string.
enum at_param_type modem_info_type_get(enum modem_info info)
Request the data type of the current modem information type.
const char * app_version
Definition modem_info.h:196
const char * app_name
Definition modem_info.h:197
struct lte_param battery
Definition modem_info.h:193
struct lte_param modem_fw
Definition modem_info.h:192
struct lte_param imei
Definition modem_info.h:194
const char * board
Definition modem_info.h:195
Device parameters.
Definition modem_info.h:191
uint16_t value
Definition modem_info.h:156
char value_string[100]
Definition modem_info.h:157
enum modem_info type
Definition modem_info.h:159
char * data_name
Definition modem_info.h:158
LTE parameter data.
Definition modem_info.h:155
struct device_param device
Definition modem_info.h:204
struct network_param network
Definition modem_info.h:202
struct sim_param sim
Definition modem_info.h:203
Modem parameters.
Definition modem_info.h:201
struct lte_param current_band
Definition modem_info.h:164
struct lte_param date_time
Definition modem_info.h:176
struct lte_param lte_mode
Definition modem_info.h:173
struct lte_param area_code
Definition modem_info.h:166
struct lte_param ue_mode
Definition modem_info.h:172
struct lte_param nbiot_mode
Definition modem_info.h:174
struct lte_param mcc
Definition modem_info.h:168
struct lte_param apn
Definition modem_info.h:177
struct lte_param ip_address
Definition modem_info.h:171
struct lte_param mnc
Definition modem_info.h:169
struct lte_param cellid_hex
Definition modem_info.h:170
struct lte_param current_operator
Definition modem_info.h:167
struct lte_param rsrp
Definition modem_info.h:178
double cellid_dec
Definition modem_info.h:180
struct lte_param gps_mode
Definition modem_info.h:175
struct lte_param sup_band
Definition modem_info.h:165
Network parameters.
Definition modem_info.h:163
struct lte_param imsi
Definition modem_info.h:187
struct lte_param uicc
Definition modem_info.h:185
struct lte_param iccid
Definition modem_info.h:186
SIM card parameters.
Definition modem_info.h:184