nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches
lte_lc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef LTE_LC_H__
8#define LTE_LC_H__
9
10#include <stdbool.h>
11#include <stdint.h>
12#include <zephyr/kernel.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
58
82
99
145
206
216
217#if defined(CONFIG_LTE_LC_PSM_MODULE)
225#endif /* CONFIG_LTE_LC_PSM_MODULE */
226
227#if defined(CONFIG_LTE_LC_EDRX_MODULE)
235#endif /* CONFIG_LTE_LC_EDRX_MODULE */
236
244
253
266
267#if defined(CONFIG_LTE_LC_TAU_PRE_WARNING_MODULE)
279#endif /* CONFIG_LTE_LC_TAU_PRE_WARNING_MODULE */
280
281#if defined(CONFIG_LTE_LC_NEIGHBOR_CELL_MEAS_MODULE)
289#endif /* CONFIG_LTE_LC_NEIGHBOR_CELL_MEAS_MODULE */
290
291#if defined(CONFIG_LTE_LC_MODEM_SLEEP_MODULE)
303
311
320#endif /* CONFIG_LTE_LC_MODEM_SLEEP_MODULE */
321
329
330#if defined(CONFIG_LTE_LC_RAI_MODULE)
340#endif /* CONFIG_LTE_LC_RAI_MODULE */
341};
342
351
355 int tau;
356
359};
360
369
371 float edrx;
372
374 float ptw;
375};
376
378#define LTE_LC_CELL_TIMING_ADVANCE_MAX 20512
380#define LTE_LC_CELL_TIMING_ADVANCE_INVALID 65535
382#define LTE_LC_CELL_EARFCN_MAX 262143
384#define LTE_LC_CELL_RSRP_INVALID 255
386#define LTE_LC_CELL_RSRQ_INVALID 255
388#define LTE_LC_CELL_EUTRAN_ID_INVALID UINT32_MAX
390#define LTE_LC_CELL_EUTRAN_ID_MAX 268435455
392#define LTE_LC_CELL_TAC_INVALID UINT32_MAX
394#define LTE_LC_CELL_TIME_DIFF_INVALID 0
395
399 uint32_t earfcn;
400
407
409 uint16_t phys_cell_id;
410
416 int16_t rsrp;
417
423 int16_t rsrq;
424};
425
429 int mcc;
430
432 int mnc;
433
435 uint32_t id;
436
438 uint32_t tac;
439
441 uint32_t earfcn;
442
454
467
474
476 uint16_t phys_cell_id;
477
498 int16_t rsrp;
499
524 int16_t rsrq;
525};
526
527
555
577
588
628
648
666
685
759
772
776 uint32_t cell_id;
778 int mcc;
780 int mnc;
782 bool as_rai;
784 bool cp_rai;
785};
786
796
802
808
823
826
828 int16_t dl_pathloss;
829
850 int16_t rsrp;
851
876 int16_t rsrq;
877
889 int16_t tx_rep;
890
902 int16_t rx_rep;
903
905 int16_t phy_cid;
906
914 int16_t band;
915
928 int16_t snr;
929
941 int16_t tx_power;
942
944 int mcc;
945
947 int mnc;
948
950 uint32_t cell_id;
951};
952
1017
1033
1034
1043
1087
1103
1110
1119
1128
1137};
1138
1156
1195
1198 void (*callback)(enum lte_lc_func_mode, void *ctx);
1199 void *context;
1200};
1201
1211#define LTE_LC_ON_CFUN(name, _callback, _context) \
1212 static void _callback(enum lte_lc_func_mode, void *ctx); \
1213 STRUCT_SECTION_ITERABLE(lte_lc_cfun_cb, lte_lc_cfun_cb_##name) = { \
1214 .callback = _callback, \
1215 .context = _context, \
1216 };
1217
1222
1223 union {
1226
1229
1230#if defined(CONFIG_LTE_LC_PSM_MODULE)
1233#endif /* CONFIG_LTE_LC_PSM_MODULE */
1234
1235#if defined(CONFIG_LTE_LC_EDRX_MODULE)
1238#endif /* CONFIG_LTE_LC_EDRX_MODULE */
1239
1242
1245
1246#if defined(CONFIG_LTE_LC_MODEM_SLEEP_MODULE)
1252#endif /* CONFIG_LTE_LC_MODEM_SLEEP_MODULE */
1253
1256
1262 uint64_t time;
1263
1264#if defined(CONFIG_LTE_LC_NEIGHBOR_CELL_MEAS_MODULE)
1267#endif /* CONFIG_LTE_LC_NEIGHBOR_CELL_MEAS_MODULE */
1268
1269#if defined(CONFIG_LTE_LC_RAI_MODULE)
1272#endif /* CONFIG_LTE_LC_RAI_MODULE */
1273 };
1274};
1275
1281typedef void(*lte_lc_evt_handler_t)(const struct lte_lc_evt *const evt);
1282
1289
1300
1314
1330
1338
1346
1354
1409int lte_lc_psm_param_set(const char *rptau, const char *rat);
1410
1455int lte_lc_psm_param_set_seconds(int rptau, int rat);
1456
1478int lte_lc_psm_req(bool enable);
1479
1495int lte_lc_psm_get(int *tau, int *active_time);
1496
1524
1545int lte_lc_ptw_set(enum lte_lc_lte_mode mode, const char *ptw);
1546
1564int lte_lc_edrx_param_set(enum lte_lc_lte_mode mode, const char *edrx);
1565
1589int lte_lc_edrx_req(bool enable);
1590
1604
1615
1627 enum lte_lc_system_mode_preference preference);
1628
1640 enum lte_lc_system_mode_preference *preference);
1641
1652
1663
1675
1698
1708
1737
1750
1758
1777
1793
1804
1817
1832
1846
1862
1865#ifdef __cplusplus
1866}
1867#endif
1868
1869#endif /* LTE_LC_H__ */
static const struct event_proxy_config cfg
Definition event_proxy_def.h:28
int lte_lc_connect_async(lte_lc_evt_handler_t handler)
int lte_lc_psm_param_set_seconds(int rptau, int rat)
int lte_lc_periodic_search_set(const struct lte_lc_periodic_search_cfg *const cfg)
int lte_lc_periodic_search_clear(void)
lte_lc_ce_level
Definition lte_lc.h:650
@ LTE_LC_CE_LEVEL_2
Definition lte_lc.h:658
@ LTE_LC_CE_LEVEL_0
Definition lte_lc.h:652
@ LTE_LC_CE_LEVEL_UNKNOWN
Definition lte_lc.h:664
@ LTE_LC_CE_LEVEL_1
Definition lte_lc.h:655
@ LTE_LC_CE_LEVEL_3
Definition lte_lc.h:661
int lte_lc_ptw_set(enum lte_lc_lte_mode mode, const char *ptw)
lte_lc_modem_sleep_type
Definition lte_lc.h:557
@ LTE_LC_MODEM_SLEEP_PROPRIETARY_PSM
Definition lte_lc.h:575
@ LTE_LC_MODEM_SLEEP_RF_INACTIVITY
Definition lte_lc.h:562
@ LTE_LC_MODEM_SLEEP_LIMITED_SERVICE
Definition lte_lc.h:565
@ LTE_LC_MODEM_SLEEP_FLIGHT_MODE
Definition lte_lc.h:568
@ LTE_LC_MODEM_SLEEP_PSM
Definition lte_lc.h:559
int lte_lc_system_mode_set(enum lte_lc_system_mode mode, enum lte_lc_system_mode_preference preference)
int lte_lc_system_mode_get(enum lte_lc_system_mode *mode, enum lte_lc_system_mode_preference *preference)
lte_lc_factory_reset_type
Definition lte_lc.h:765
@ LTE_LC_FACTORY_RESET_ALL
Definition lte_lc.h:767
@ LTE_LC_FACTORY_RESET_USER
Definition lte_lc.h:770
int lte_lc_psm_param_set(const char *rptau, const char *rat)
int lte_lc_edrx_get(struct lte_lc_edrx_cfg *edrx_cfg)
int lte_lc_psm_req(bool enable)
lte_lc_func_mode
Definition lte_lc.h:153
@ LTE_LC_FUNC_MODE_RX_ONLY
Definition lte_lc.h:176
@ LTE_LC_FUNC_MODE_OFFLINE_UICC_ON
Definition lte_lc.h:204
@ LTE_LC_FUNC_MODE_OFFLINE
Definition lte_lc.h:183
@ LTE_LC_FUNC_MODE_DEACTIVATE_UICC
Definition lte_lc.h:198
@ LTE_LC_FUNC_MODE_ACTIVATE_GNSS
Definition lte_lc.h:195
@ LTE_LC_FUNC_MODE_POWER_OFF
Definition lte_lc.h:159
@ LTE_LC_FUNC_MODE_DEACTIVATE_LTE
Definition lte_lc.h:186
@ LTE_LC_FUNC_MODE_NORMAL
Definition lte_lc.h:166
@ LTE_LC_FUNC_MODE_ACTIVATE_UICC
Definition lte_lc.h:201
@ LTE_LC_FUNC_MODE_DEACTIVATE_GNSS
Definition lte_lc.h:192
@ LTE_LC_FUNC_MODE_ACTIVATE_LTE
Definition lte_lc.h:189
int lte_lc_psm_get(int *tau, int *active_time)
lte_lc_tau_triggered
Definition lte_lc.h:630
@ LTE_LC_CELL_IN_TAI_LIST
Definition lte_lc.h:636
@ LTE_LC_CELL_NOT_IN_TAI_LIST
Definition lte_lc.h:643
@ LTE_LC_CELL_UNKNOWN
Definition lte_lc.h:646
lte_lc_evt_type
Definition lte_lc.h:208
@ LTE_LC_EVT_NEIGHBOR_CELL_MEAS
Definition lte_lc.h:288
@ LTE_LC_EVT_TAU_PRE_WARNING
Definition lte_lc.h:278
@ LTE_LC_EVT_MODEM_EVENT
Definition lte_lc.h:328
@ LTE_LC_EVT_PSM_UPDATE
Definition lte_lc.h:224
@ LTE_LC_EVT_EDRX_UPDATE
Definition lte_lc.h:234
@ LTE_LC_EVT_MODEM_SLEEP_EXIT_PRE_WARNING
Definition lte_lc.h:302
@ LTE_LC_EVT_RAI_UPDATE
Definition lte_lc.h:339
@ LTE_LC_EVT_MODEM_SLEEP_ENTER
Definition lte_lc.h:319
@ LTE_LC_EVT_RRC_UPDATE
Definition lte_lc.h:243
@ LTE_LC_EVT_CELL_UPDATE
Definition lte_lc.h:252
@ LTE_LC_EVT_LTE_MODE_UPDATE
Definition lte_lc.h:265
@ LTE_LC_EVT_NW_REG_STATUS
Definition lte_lc.h:215
@ LTE_LC_EVT_MODEM_SLEEP_EXIT
Definition lte_lc.h:310
lte_lc_neighbor_search_type
Definition lte_lc.h:964
@ LTE_LC_NEIGHBOR_SEARCH_TYPE_GCI_EXTENDED_COMPLETE
Definition lte_lc.h:1015
@ LTE_LC_NEIGHBOR_SEARCH_TYPE_GCI_DEFAULT
Definition lte_lc.h:996
@ LTE_LC_NEIGHBOR_SEARCH_TYPE_GCI_EXTENDED_LIGHT
Definition lte_lc.h:1006
@ LTE_LC_NEIGHBOR_SEARCH_TYPE_EXTENDED_COMPLETE
Definition lte_lc.h:989
@ LTE_LC_NEIGHBOR_SEARCH_TYPE_DEFAULT
Definition lte_lc.h:969
@ LTE_LC_NEIGHBOR_SEARCH_TYPE_EXTENDED_LIGHT
Definition lte_lc.h:980
int lte_lc_connect(void)
int lte_lc_func_mode_get(enum lte_lc_func_mode *mode)
int lte_lc_conn_eval_params_get(struct lte_lc_conn_eval_params *params)
int lte_lc_neighbor_cell_measurement(struct lte_lc_ncellmeas_params *params)
lte_lc_energy_estimate
Definition lte_lc.h:590
@ LTE_LC_ENERGY_CONSUMPTION_EFFICIENT
Definition lte_lc.h:626
@ LTE_LC_ENERGY_CONSUMPTION_REDUCED
Definition lte_lc.h:619
@ LTE_LC_ENERGY_CONSUMPTION_NORMAL
Definition lte_lc.h:612
@ LTE_LC_ENERGY_CONSUMPTION_INCREASED
Definition lte_lc.h:605
@ LTE_LC_ENERGY_CONSUMPTION_EXCESSIVE
Definition lte_lc.h:597
lte_lc_lte_mode
Definition lte_lc.h:89
@ LTE_LC_LTE_MODE_NBIOT
Definition lte_lc.h:97
@ LTE_LC_LTE_MODE_NONE
Definition lte_lc.h:91
@ LTE_LC_LTE_MODE_LTEM
Definition lte_lc.h:94
int lte_lc_deregister_handler(lte_lc_evt_handler_t handler)
lte_lc_modem_evt
Definition lte_lc.h:687
@ LTE_LC_MODEM_EVT_NO_IMEI
Definition lte_lc.h:729
@ LTE_LC_MODEM_EVT_CE_LEVEL_3
Definition lte_lc.h:757
@ LTE_LC_MODEM_EVT_LIGHT_SEARCH_DONE
Definition lte_lc.h:699
@ LTE_LC_MODEM_EVT_SEARCH_DONE
Definition lte_lc.h:709
@ LTE_LC_MODEM_EVT_CE_LEVEL_1
Definition lte_lc.h:743
@ LTE_LC_MODEM_EVT_CE_LEVEL_2
Definition lte_lc.h:750
@ LTE_LC_MODEM_EVT_RESET_LOOP
Definition lte_lc.h:720
@ LTE_LC_MODEM_EVT_BATTERY_LOW
Definition lte_lc.h:723
@ LTE_LC_MODEM_EVT_CE_LEVEL_0
Definition lte_lc.h:736
@ LTE_LC_MODEM_EVT_OVERHEATED
Definition lte_lc.h:726
void(* lte_lc_evt_handler_t)(const struct lte_lc_evt *const evt)
Definition lte_lc.h:1281
int lte_lc_reduced_mobility_get(enum lte_lc_reduced_mobility_mode *mode)
lte_lc_rrc_mode
Definition lte_lc.h:344
@ LTE_LC_RRC_MODE_IDLE
Definition lte_lc.h:346
@ LTE_LC_RRC_MODE_CONNECTED
Definition lte_lc.h:349
lte_lc_reduced_mobility_mode
Definition lte_lc.h:671
@ LTE_LC_REDUCED_MOBILITY_DISABLED
Definition lte_lc.h:683
@ LTE_LC_REDUCED_MOBILITY_NORDIC
Definition lte_lc.h:676
@ LTE_LC_REDUCED_MOBILITY_DEFAULT
Definition lte_lc.h:673
int lte_lc_nw_reg_status_get(enum lte_lc_nw_reg_status *status)
int lte_lc_edrx_req(bool enable)
void lte_lc_register_handler(lte_lc_evt_handler_t handler)
int lte_lc_lte_mode_get(enum lte_lc_lte_mode *mode)
int lte_lc_power_off(void)
int lte_lc_neighbor_cell_measurement_cancel(void)
lte_lc_periodic_search_pattern_type
Definition lte_lc.h:1036
@ LTE_LC_PERIODIC_SEARCH_PATTERN_TABLE
Definition lte_lc.h:1041
@ LTE_LC_PERIODIC_SEARCH_PATTERN_RANGE
Definition lte_lc.h:1038
int lte_lc_proprietary_psm_req(bool enable)
int lte_lc_periodic_search_request(void)
int lte_lc_func_mode_set(enum lte_lc_func_mode mode)
int lte_lc_modem_events_disable(void)
int lte_lc_factory_reset(enum lte_lc_factory_reset_type type)
lte_lc_system_mode
Definition lte_lc.h:60
@ LTE_LC_SYSTEM_MODE_NBIOT
Definition lte_lc.h:65
@ LTE_LC_SYSTEM_MODE_LTEM_NBIOT
Definition lte_lc.h:77
@ LTE_LC_SYSTEM_MODE_NBIOT_GPS
Definition lte_lc.h:74
@ LTE_LC_SYSTEM_MODE_GPS
Definition lte_lc.h:68
@ LTE_LC_SYSTEM_MODE_LTEM
Definition lte_lc.h:62
@ LTE_LC_SYSTEM_MODE_LTEM_NBIOT_GPS
Definition lte_lc.h:80
@ LTE_LC_SYSTEM_MODE_LTEM_GPS
Definition lte_lc.h:71
int lte_lc_offline(void)
int lte_lc_edrx_param_set(enum lte_lc_lte_mode mode, const char *edrx)
lte_lc_nw_reg_status
Definition lte_lc.h:33
@ LTE_LC_NW_REG_REGISTERED_HOME
Definition lte_lc.h:38
@ LTE_LC_NW_REG_UICC_FAIL
Definition lte_lc.h:56
@ LTE_LC_NW_REG_REGISTRATION_DENIED
Definition lte_lc.h:47
@ LTE_LC_NW_REG_SEARCHING
Definition lte_lc.h:44
@ LTE_LC_NW_REG_REGISTERED_ROAMING
Definition lte_lc.h:53
@ LTE_LC_NW_REG_NOT_REGISTERED
Definition lte_lc.h:35
@ LTE_LC_NW_REG_UNKNOWN
Definition lte_lc.h:50
int lte_lc_reduced_mobility_set(enum lte_lc_reduced_mobility_mode mode)
int lte_lc_periodic_search_get(struct lte_lc_periodic_search_cfg *const cfg)
lte_lc_system_mode_preference
Definition lte_lc.h:109
@ LTE_LC_SYSTEM_MODE_PREFER_NBIOT
Definition lte_lc.h:127
@ LTE_LC_SYSTEM_MODE_PREFER_LTEM_PLMN_PRIO
Definition lte_lc.h:135
@ LTE_LC_SYSTEM_MODE_PREFER_NBIOT_PLMN_PRIO
Definition lte_lc.h:143
@ LTE_LC_SYSTEM_MODE_PREFER_LTEM
Definition lte_lc.h:119
@ LTE_LC_SYSTEM_MODE_PREFER_AUTO
Definition lte_lc.h:111
int lte_lc_modem_events_enable(void)
int lte_lc_normal(void)
uint64_t measurement_time
Definition lte_lc.h:473
uint64_t timing_advance_meas_time
Definition lte_lc.h:466
uint32_t tac
Definition lte_lc.h:438
uint16_t timing_advance
Definition lte_lc.h:453
uint32_t earfcn
Definition lte_lc.h:441
int16_t rsrq
Definition lte_lc.h:524
uint16_t phys_cell_id
Definition lte_lc.h:476
int mnc
Definition lte_lc.h:432
int16_t rsrp
Definition lte_lc.h:498
uint32_t id
Definition lte_lc.h:435
int mcc
Definition lte_lc.h:429
Definition lte_lc.h:427
uint8_t gci_cells_count
Definition lte_lc.h:550
struct lte_lc_cell current_cell
Definition lte_lc.h:534
uint8_t ncells_count
Definition lte_lc.h:540
struct lte_lc_ncell * neighbor_cells
Definition lte_lc.h:543
struct lte_lc_cell * gci_cells
Definition lte_lc.h:553
Definition lte_lc.h:529
void(* callback)(enum lte_lc_func_mode, void *ctx)
Definition lte_lc.h:1198
void * context
Definition lte_lc.h:1199
Definition lte_lc.h:1197
int16_t rsrp
Definition lte_lc.h:850
int16_t phy_cid
Definition lte_lc.h:905
int16_t tx_rep
Definition lte_lc.h:889
int16_t tx_power
Definition lte_lc.h:941
int16_t dl_pathloss
Definition lte_lc.h:828
uint32_t cell_id
Definition lte_lc.h:950
enum lte_lc_rrc_mode rrc_state
Definition lte_lc.h:795
int16_t band
Definition lte_lc.h:914
int mcc
Definition lte_lc.h:944
int16_t rx_rep
Definition lte_lc.h:902
int earfcn
Definition lte_lc.h:825
int16_t snr
Definition lte_lc.h:928
enum lte_lc_energy_estimate energy_estimate
Definition lte_lc.h:801
enum lte_lc_ce_level ce_level
Definition lte_lc.h:822
int16_t rsrq
Definition lte_lc.h:876
enum lte_lc_tau_triggered tau_trig
Definition lte_lc.h:807
int mnc
Definition lte_lc.h:947
Definition lte_lc.h:793
enum lte_lc_lte_mode mode
Definition lte_lc.h:368
float edrx
Definition lte_lc.h:371
float ptw
Definition lte_lc.h:374
Definition lte_lc.h:362
struct lte_lc_cells_info cells_info
Definition lte_lc.h:1266
uint64_t time
Definition lte_lc.h:1262
struct lte_lc_modem_sleep modem_sleep
Definition lte_lc.h:1251
struct lte_lc_edrx_cfg edrx_cfg
Definition lte_lc.h:1237
enum lte_lc_rrc_mode rrc_mode
Definition lte_lc.h:1228
enum lte_lc_modem_evt modem_evt
Definition lte_lc.h:1255
struct lte_lc_cell cell
Definition lte_lc.h:1241
enum lte_lc_lte_mode lte_mode
Definition lte_lc.h:1244
enum lte_lc_evt_type type
Definition lte_lc.h:1221
struct lte_lc_psm_cfg psm_cfg
Definition lte_lc.h:1232
enum lte_lc_nw_reg_status nw_reg_status
Definition lte_lc.h:1225
struct lte_lc_rai_cfg rai_cfg
Definition lte_lc.h:1271
Definition lte_lc.h:1219
enum lte_lc_modem_sleep_type type
Definition lte_lc.h:581
int64_t time
Definition lte_lc.h:586
Definition lte_lc.h:579
uint16_t phys_cell_id
Definition lte_lc.h:409
int16_t rsrp
Definition lte_lc.h:416
int time_diff
Definition lte_lc.h:406
uint32_t earfcn
Definition lte_lc.h:399
int16_t rsrq
Definition lte_lc.h:423
Definition lte_lc.h:397
enum lte_lc_neighbor_search_type search_type
Definition lte_lc.h:1021
uint8_t gci_count
Definition lte_lc.h:1031
Definition lte_lc.h:1019
struct lte_lc_periodic_search_pattern patterns[4]
Definition lte_lc.h:1193
uint16_t return_to_pattern
Definition lte_lc.h:1176
size_t pattern_count
Definition lte_lc.h:1190
uint16_t band_optimization
Definition lte_lc.h:1187
bool loop
Definition lte_lc.h:1165
Definition lte_lc.h:1158
struct lte_lc_periodic_search_table_cfg table
Definition lte_lc.h:1153
struct lte_lc_periodic_search_range_cfg range
Definition lte_lc.h:1150
enum lte_lc_periodic_search_pattern_type type
Definition lte_lc.h:1146
Definition lte_lc.h:1144
int16_t time_to_final_sleep
Definition lte_lc.h:1074
uint16_t final_sleep
Definition lte_lc.h:1058
int16_t pattern_end_point
Definition lte_lc.h:1085
uint16_t initial_sleep
Definition lte_lc.h:1051
Definition lte_lc.h:1045
int val_4
Definition lte_lc.h:1127
int val_2
Definition lte_lc.h:1109
int val_1
Definition lte_lc.h:1102
int val_5
Definition lte_lc.h:1136
int val_3
Definition lte_lc.h:1118
Definition lte_lc.h:1100
int active_time
Definition lte_lc.h:358
int tau
Definition lte_lc.h:355
Definition lte_lc.h:353
int mcc
Definition lte_lc.h:778
bool cp_rai
Definition lte_lc.h:784
uint32_t cell_id
Definition lte_lc.h:776
int mnc
Definition lte_lc.h:780
bool as_rai
Definition lte_lc.h:782
Definition lte_lc.h:774