Skip to content

Commit

Permalink
lib: nrf_modem_lib: lte_net_if: Add handling of reset loop event
Browse files Browse the repository at this point in the history
Add handling of reset loop event to notify users when this occurs.

Signed-off-by: Simen S. Røstad <[email protected]>
  • Loading branch information
simensrostad authored and rlubos committed Jan 18, 2024
1 parent 55df81b commit 1615600
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions lib/nrf_modem_lib/lte_net_if/lte_net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,29 +302,33 @@ static void pdn_event_handler(uint8_t cid, enum pdn_event event, int reason)

static void lte_reg_handler(const struct lte_lc_evt *const evt)
{
if (evt->type != LTE_LC_EVT_NW_REG_STATUS) {
return;
}

switch (evt->nw_reg_status) {
case LTE_LC_NW_REG_REGISTERED_HOME:
__fallthrough;
case LTE_LC_NW_REG_REGISTERED_ROAMING:
/* Mark serving cell as available. */
LOG_DBG("Registered to serving cell");
update_has_cell(true);
break;
case LTE_LC_NW_REG_SEARCHING:
/* Searching for a new cell, do not consider this cell loss unless it
* fails (which will generate a new LTE_LC_EVT_NW_REG_STATUS event with
* an unregistered status).
*/
break;
default:
LOG_DBG("Not registered to serving cell");
/* Mark the serving cell as lost. */
update_has_cell(false);
break;
if (evt->type == LTE_LC_EVT_MODEM_EVENT && evt->modem_evt == LTE_LC_MODEM_EVT_RESET_LOOP) {
LOG_WRN("The modem has detected a reset loop. LTE network attach is now "
"restricted for the next 30 minutes.");

LOG_DBG("For more information, see the AT command documentation "
"for the %%MDMEV notification");
} else if (evt->type == LTE_LC_EVT_NW_REG_STATUS) {
switch (evt->nw_reg_status) {
case LTE_LC_NW_REG_REGISTERED_HOME:
__fallthrough;
case LTE_LC_NW_REG_REGISTERED_ROAMING:
/* Mark serving cell as available. */
LOG_DBG("Registered to serving cell");
update_has_cell(true);
break;
case LTE_LC_NW_REG_SEARCHING:
/* Searching for a new cell, do not consider this cell loss unless it
* fails (which will generate a new LTE_LC_EVT_NW_REG_STATUS event with
* an unregistered status).
*/
break;
default:
LOG_DBG("Not registered to serving cell");
/* Mark the serving cell as lost. */
update_has_cell(false);
break;
}
}
}

Expand Down

0 comments on commit 1615600

Please sign in to comment.