Skip to content

Commit 2c8eaa6

Browse files
committed
ntn: Update sdk-nrf reference and use new PDN events
Use newly added PDN events for suspended and resumed PDN connection. This allows us to remove the workaround with AT monitor. Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
1 parent f165e4c commit 2c8eaa6

File tree

2 files changed

+10
-41
lines changed

2 files changed

+10
-41
lines changed

app/src/modules/ntn/ntn.c

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <modem/nrf_modem_lib.h>
1414
#include <modem/ntn.h>
1515
#include <nrf_modem_at.h>
16-
#include <modem/at_monitor.h>
1716
#include <nrf_modem_gnss.h>
1817
#include <modem/modem_info.h>
1918
#include <zephyr/task_wdt/task_wdt.h>
@@ -26,16 +25,6 @@
2625

2726
LOG_MODULE_REGISTER(ntn_module, CONFIG_APP_NTN_LOG_LEVEL);
2827

29-
/* AT monitor for network notifications.
30-
* The monitor is needed to receive notification when in the case where the modem has been
31-
* put into offline mode while keeping registration context.
32-
* In this case, the modem will send a +CEREG notification with status 1 or 5 when NTN is
33-
* re-enabled. The LTE link controller does not forward this because it is equal to the previous
34-
* registration status. To work around this, we monitor the +CEREG notification and forward it
35-
* to the NTN module when offline-while-keeping-registration mode is enabled.
36-
*/
37-
AT_MONITOR(cereg_monitor, "CEREG", cereg_mon, PAUSED);
38-
3928
/* Define channels provided by this module */
4029
ZBUS_CHAN_DEFINE(NTN_CHAN,
4130
struct ntn_msg,
@@ -210,24 +199,6 @@ static void gnss_location_work_handler(struct k_work *work)
210199

211200
/* Helper functions */
212201

213-
static void cereg_mon(const char *notif)
214-
{
215-
enum lte_lc_nw_reg_status status = atoi(notif + strlen("+CEREG: "));
216-
217-
if (status == LTE_LC_NW_REG_REGISTERED_ROAMING) {
218-
LOG_DBG("Network registration status: ROAMING");
219-
ntn_msg_publish(NTN_NETWORK_CONNECTED);
220-
LOG_DBG("Stop monitoring incoming CEREG Notifications");
221-
at_monitor_pause(&cereg_monitor);
222-
} else if (status == LTE_LC_NW_REG_REGISTERED_HOME) {
223-
/* Amari Callbox */
224-
LOG_DBG("Network registration status: HOME");
225-
ntn_msg_publish(NTN_NETWORK_CONNECTED);
226-
LOG_DBG("Stop monitoring incoming CEREG Notifications");
227-
at_monitor_pause(&cereg_monitor);
228-
}
229-
}
230-
231202
static int set_ntn_dormant_mode(void)
232203
{
233204
int err;
@@ -240,17 +211,6 @@ static int set_ntn_dormant_mode(void)
240211
return err;
241212
}
242213

243-
err = nrf_modem_at_printf("AT+CEREG=1");
244-
if (err) {
245-
LOG_ERR("AT+CEREG failed, error: %d", err);
246-
247-
return err;
248-
}
249-
250-
/* Start monitoring incoming CEREG Notifications */
251-
LOG_DBG("Start monitoring incoming CEREG Notifications");
252-
at_monitor_resume(&cereg_monitor);
253-
254214
return 0;
255215
}
256216

@@ -931,6 +891,15 @@ static void lte_lc_evt_handler(const struct lte_lc_evt *const evt)
931891
ntn_msg_publish(NTN_NETWORK_DISCONNECTED);
932892

933893
break;
894+
case LTE_LC_EVT_PDN_SUSPENDED:
895+
LOG_DBG("PDN connection suspended");
896+
ntn_msg_publish(NTN_NETWORK_DISCONNECTED);
897+
898+
break;
899+
case LTE_LC_EVT_PDN_RESUMED:
900+
LOG_DBG("PDN connection resumed");
901+
ntn_msg_publish(NTN_NETWORK_CONNECTED);
902+
934903
default:
935904
break;
936905
}

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ manifest:
1414
- name: nrf
1515
remote: ncs
1616
repo-path: sdk-nrf
17-
revision: 002c75be46c98d55ae24652cdb1c2ebb5ff43d0e
17+
revision: 2d607e644189fd91b80ec5b976d4efc556695350
1818
import: true

0 commit comments

Comments
 (0)