Skip to content

Commit 1769e44

Browse files
tokangasnordicjm
authored andcommitted
lib: lte_link_control: Add PDN suspend/resume support
Added new PDN events LTE_LC_EVT_PDN_SUSPENDED and LTE_LC_EVT_PDN_RESUMED. These events supported by the mfw_nrf9151-ntn modem firmware are used with cellular profiles to indicate when PDNs are active, but temporarily not usable. Signed-off-by: Tommi Kangas <[email protected]>
1 parent 58059df commit 1769e44

File tree

5 files changed

+61
-3
lines changed

5 files changed

+61
-3
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@ Security libraries
406406
Modem libraries
407407
---------------
408408

409-
|no_changes_yet_note|
409+
* :ref:`lte_lc_readme` library:
410+
411+
* Added support for new PDN events :c:enumerator:`LTE_LC_EVT_PDN_SUSPENDED` and :c:enumerator:`LTE_LC_EVT_PDN_RESUMED`.
410412

411413
Multiprotocol Service Layer libraries
412414
-------------------------------------

include/modem/lte_lc.h

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ enum lte_lc_evt_type {
455455
* @ref lte_lc_rai_cfg in the event.
456456
*
457457
* @note This is only supported by the following modem firmware:
458-
* - mfw_nrf91x1 >= v2.0.2
459-
* - mfw_nrf9151-ntn
458+
* - mfw_nrf91x1 >= v2.0.2
459+
* - mfw_nrf9151-ntn
460460
*/
461461
LTE_LC_EVT_RAI_UPDATE = 12,
462462
#endif /* CONFIG_LTE_LC_RAI_MODULE */
@@ -1481,6 +1481,36 @@ enum lte_lc_pdn_evt_type {
14811481
*/
14821482
LTE_LC_EVT_PDN_IPV6_DOWN,
14831483

1484+
/**
1485+
* PDN is suspended.
1486+
*
1487+
* PDNs can be suspended when cellular profiles are used. While suspended, the PDNs remain
1488+
* active, but can not be used for data transmission. PDNs associated with a cellular
1489+
* profile are suspended when the device is switched to flight mode using
1490+
* @ref LTE_LC_FUNC_MODE_OFFLINE_KEEP_REG or @ref LTE_LC_FUNC_MODE_OFFLINE_KEEP_REG_UICC_ON.
1491+
* The PDNs remain suspended when switching to a different access technology. When the
1492+
* device is switched back to the original access technology and LTE is activated, the
1493+
* associated PDNs are resumed.
1494+
*
1495+
* The associated payload is the @c lte_lc_evt.pdn member of type
1496+
* @ref lte_lc_pdn_evt in the event.
1497+
*
1498+
* @note This is only supported by the following modem firmware:
1499+
* - mfw_nrf9151-ntn
1500+
*/
1501+
LTE_LC_EVT_PDN_SUSPENDED,
1502+
1503+
/**
1504+
* PDN is resumed.
1505+
*
1506+
* The associated payload is the @c lte_lc_evt.pdn member of type
1507+
* @ref lte_lc_pdn_evt in the event.
1508+
*
1509+
* @note This is only supported by the following modem firmware:
1510+
* - mfw_nrf9151-ntn
1511+
*/
1512+
LTE_LC_EVT_PDN_RESUMED,
1513+
14841514
/**
14851515
* Network detached.
14861516
*

lib/lte_link_control/modules/pdn.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ static void parse_cgev(const char *notif)
196196
{"ME PDN DEACT ", LTE_LC_EVT_PDN_DEACTIVATED},
197197
/* +CGEV: NW PDN DEACT <cid> */
198198
{"NW PDN DEACT ", LTE_LC_EVT_PDN_DEACTIVATED},
199+
/* +CGEV: ME PDN SUSPENDED <cid> */
200+
{"ME PDN SUSPENDED ", LTE_LC_EVT_PDN_SUSPENDED},
201+
/* +CGEV: ME PDN RESUMED <cid> */
202+
{"ME PDN RESUMED ", LTE_LC_EVT_PDN_RESUMED},
199203
/* +CGEV: ME DETACH [<cp_id>] */
200204
{"ME DETACH", LTE_LC_EVT_PDN_NETWORK_DETACH},
201205
/* +CGEV: NW DETACH [<cp_id>] */
@@ -244,6 +248,8 @@ static void parse_cgev(const char *notif)
244248
case LTE_LC_EVT_PDN_DEACTIVATED:
245249
case LTE_LC_EVT_PDN_IPV6_UP:
246250
case LTE_LC_EVT_PDN_IPV6_DOWN:
251+
case LTE_LC_EVT_PDN_SUSPENDED:
252+
case LTE_LC_EVT_PDN_RESUMED:
247253
evt.pdn.cid = (int8_t)strtoul(p, &p, 10);
248254

249255
break;

samples/cellular/modem_shell/src/link/link_shell_pdn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const char *link_pdn_event_to_string(enum lte_lc_evt_type event, char *out_str_b
4141
{ LTE_LC_EVT_PDN_DEACTIVATED, "deactivated" },
4242
{ LTE_LC_EVT_PDN_IPV6_UP, "IPv6 up" },
4343
{ LTE_LC_EVT_PDN_IPV6_DOWN, "IPv6 down" },
44+
{ LTE_LC_EVT_PDN_SUSPENDED, "suspended" },
45+
{ LTE_LC_EVT_PDN_RESUMED, "resumed" },
4446
{ LTE_LC_EVT_PDN_NETWORK_DETACH, "network detach" },
4547
{ LTE_LC_EVT_PDN_APN_RATE_CONTROL_ON, "APN rate control on" },
4648
{ LTE_LC_EVT_PDN_APN_RATE_CONTROL_OFF, "APN rate control off" },

tests/lib/lte_lc_pdn/src/main.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,8 @@ static void lte_lc_event_handler(const struct lte_lc_evt *const evt)
943943
case LTE_LC_EVT_PDN_DEACTIVATED:
944944
case LTE_LC_EVT_PDN_IPV6_UP:
945945
case LTE_LC_EVT_PDN_IPV6_DOWN:
946+
case LTE_LC_EVT_PDN_SUSPENDED:
947+
case LTE_LC_EVT_PDN_RESUMED:
946948
case LTE_LC_EVT_PDN_NETWORK_DETACH:
947949
case LTE_LC_EVT_PDN_APN_RATE_CONTROL_ON:
948950
case LTE_LC_EVT_PDN_APN_RATE_CONTROL_OFF:
@@ -1388,6 +1390,22 @@ void test_lte_lc_pdn_deactivate(void)
13881390
TEST_ASSERT_EQUAL(LTE_LC_EVT_PDN_DEACTIVATED, pdn_evt.pdn.type);
13891391
}
13901392

1393+
void test_lte_lc_pdn_suspended(void)
1394+
{
1395+
on_cgev("+CGEV: ME PDN SUSPENDED " STRINGIFY(CID_0) "\r\n");
1396+
TEST_ASSERT_EQUAL(LTE_LC_EVT_PDN, pdn_evt.type);
1397+
TEST_ASSERT_EQUAL(LTE_LC_EVT_PDN_SUSPENDED, pdn_evt.pdn.type);
1398+
TEST_ASSERT_EQUAL(CID_0, pdn_evt.pdn.cid);
1399+
}
1400+
1401+
void test_lte_lc_pdn_resumed(void)
1402+
{
1403+
on_cgev("+CGEV: ME PDN RESUMED " STRINGIFY(CID_1) "\r\n");
1404+
TEST_ASSERT_EQUAL(LTE_LC_EVT_PDN, pdn_evt.type);
1405+
TEST_ASSERT_EQUAL(LTE_LC_EVT_PDN_RESUMED, pdn_evt.pdn.type);
1406+
TEST_ASSERT_EQUAL(CID_1, pdn_evt.pdn.cid);
1407+
}
1408+
13911409
void test_lte_lc_pdn_detach(void)
13921410
{
13931411
on_cgev("+CGEV: NW DETACH\r\n");

0 commit comments

Comments
 (0)