Skip to content

Commit

Permalink
lib: lte_link_control: deprecate reduced mobility
Browse files Browse the repository at this point in the history
Deprecate reduced mobility API. This functionality is
trivial to implement and doesn't need a whole API within the
Link Controller.

Signed-off-by: Mirko Covizzi <[email protected]>
  • Loading branch information
MirkoCovizzi authored and rlubos committed Oct 9, 2024
1 parent 2d99f4f commit 5611086
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 11 deletions.
41 changes: 41 additions & 0 deletions doc/nrf/releases_and_maturity/migration/migration_guide_2.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,47 @@ LTE link control library
err = nrf_modem_at_printf("AT%%XFACTORYRESET=1");
* Replace the use of the :c:func:`lte_lc_reduced_mobility_get` function with the following:

.. code-block:: C
#include <nrf_modem_at.h>
uint16_t mode;
ret = nrf_modem_at_scanf("AT%REDMOB?", "%%REDMOB: %hu", &mode);
if (ret != 1) {
/* Handle failure. */
} else {
/* Handle success. */
}
* Replace the use of the :c:func:`lte_lc_reduced_mobility_set` function with the following:

* If the :c:enumerator:`LTE_LC_REDUCED_MOBILITY_DEFAULT` value is used with the :c:func:`lte_lc_reduced_mobility_set` function:

.. code-block:: C
#include <nrf_modem_at.h>
err = nrf_modem_at_printf("AT%%REDMOB=0");
* If the :c:enumerator:`LTE_LC_REDUCED_MOBILITY_NORDIC` value is used with the :c:func:`lte_lc_reduced_mobility_set` function:

.. code-block:: C
#include <nrf_modem_at.h>
err = nrf_modem_at_printf("AT%%REDMOB=1");
* If the :c:enumerator:`LTE_LC_REDUCED_MOBILITY_DISABLED` value is used with the :c:func:`lte_lc_reduced_mobility_set` function:

.. code-block:: C
#include <nrf_modem_at.h>
err = nrf_modem_at_printf("AT%%REDMOB=2");
AT command parser
-----------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,9 @@ Modem libraries
Use the ``AT%XFACTORYRESET`` AT command instead.
Refer to the :ref:`migration guide <migration_2.8>` for more details.
* The :c:enum:`lte_lc_factory_reset_type` type has been deprecated.
* The :c:func:`lte_lc_reduced_mobility_get` and :c:func:`lte_lc_reduced_mobility_set` functions have been deprecated.
Refer to the :ref:`migration guide <migration_2.8>` for more details.
* The :c:enum:`lte_lc_reduced_mobility_mode` type has been deprecated.
Refer to the :ref:`migration guide <migration_2.8>` for more details.

* :ref:`lib_location` library:
Expand Down
9 changes: 8 additions & 1 deletion include/modem/lte_lc.h
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,10 @@ enum lte_lc_ce_level {
LTE_LC_CE_LEVEL_UNKNOWN = UINT8_MAX,
};

/** Reduced mobility mode. */
/** Reduced mobility mode.
*
* @deprecated since v2.8.0.
*/
enum lte_lc_reduced_mobility_mode {
/** Functionality according to the 3GPP relaxed monitoring feature. */
LTE_LC_REDUCED_MOBILITY_DEFAULT = 0,
Expand Down Expand Up @@ -1767,6 +1770,8 @@ int lte_lc_periodic_search_request(void);
* @retval 0 if a mode was found and written to the provided pointer.
* @retval -EINVAL if input parameter was @c NULL.
* @retval -EFAULT if an AT command failed.
*
* @deprecated since v2.8.0.
*/
int lte_lc_reduced_mobility_get(enum lte_lc_reduced_mobility_mode *mode);

Expand All @@ -1779,6 +1784,8 @@ int lte_lc_reduced_mobility_get(enum lte_lc_reduced_mobility_mode *mode);
*
* @retval 0 if the new reduced mobility mode was accepted by the modem.
* @retval -EFAULT if an AT command failed.
*
* @deprecated since v2.8.0.
*/
int lte_lc_reduced_mobility_set(enum lte_lc_reduced_mobility_mode mode);

Expand Down
20 changes: 19 additions & 1 deletion samples/cellular/modem_shell/src/link/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ enum link_ncellmeas_modes {

#define LINK_FUNMODE_NONE 99
#define LINK_SYSMODE_NONE 99
#define LINK_REDMOB_NONE 99

/** Type of factory reset to perform. */
enum link_factory_reset_type {
Expand All @@ -32,6 +31,25 @@ enum link_factory_reset_type {
LINK_FACTORY_RESET_INVALID = 99
};

/** Reduced mobility mode. */
enum link_reduced_mobility_mode {
/** Functionality according to the 3GPP relaxed monitoring feature. */
LINK_REDUCED_MOBILITY_DEFAULT = 0,

/** Enable Nordic-proprietary reduced mobility feature. */
LINK_REDUCED_MOBILITY_NORDIC = 1,

/**
* Full measurements for best possible mobility.
*
* Disable the 3GPP relaxed monitoring and Nordic-proprietary reduced mobility features.
*/
LINK_REDUCED_MOBILITY_DISABLED = 2,

/** Invalid type. */
LINK_REDUCED_MOBILITY_NONE = 99
};

void link_init(void);
void link_ind_handler(const struct lte_lc_evt *const evt);
void link_rsrp_subscribe(bool subscribe);
Expand Down
18 changes: 9 additions & 9 deletions samples/cellular/modem_shell/src/link/link_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ static int link_shell_redmob(const struct shell *shell, size_t argc, char **argv
{
int ret;
enum link_shell_operation operation = LINK_OPERATION_NONE;
enum lte_lc_reduced_mobility_mode redmob_mode = LINK_REDMOB_NONE;
enum link_reduced_mobility_mode redmob_mode = LINK_REDUCED_MOBILITY_NONE;
char snum[10];

optreset = 1;
Expand All @@ -2017,10 +2017,10 @@ static int link_shell_redmob(const struct shell *shell, size_t argc, char **argv
break;

case LINK_SHELL_OPT_REDMOB_DEFAULT:
redmob_mode = LTE_LC_REDUCED_MOBILITY_DEFAULT;
redmob_mode = LINK_REDUCED_MOBILITY_DEFAULT;
break;
case LINK_SHELL_OPT_REDMOB_NORDIC:
redmob_mode = LTE_LC_REDUCED_MOBILITY_NORDIC;
redmob_mode = LINK_REDUCED_MOBILITY_NORDIC;
break;

case 'h':
Expand All @@ -2038,21 +2038,21 @@ static int link_shell_redmob(const struct shell *shell, size_t argc, char **argv
}

if (operation == LINK_OPERATION_DISABLE) {
redmob_mode = LTE_LC_REDUCED_MOBILITY_DISABLED;
redmob_mode = LINK_REDUCED_MOBILITY_DISABLED;
}
if (operation == LINK_OPERATION_READ) {
enum lte_lc_reduced_mobility_mode mode;
enum link_reduced_mobility_mode mode;

ret = lte_lc_reduced_mobility_get(&mode);
if (ret) {
ret = nrf_modem_at_scanf("AT%REDMOB?", "%%REDMOB: %hu", &mode);
if (ret != 1) {
mosh_error("Cannot get reduced mobility mode: %d", ret);
} else {
mosh_print(
"Reduced mobility mode read successfully: %s",
link_shell_redmob_mode_to_string(mode, snum));
}
} else if (redmob_mode != LINK_REDMOB_NONE) {
ret = lte_lc_reduced_mobility_set(redmob_mode);
} else if (redmob_mode != LINK_REDUCED_MOBILITY_NONE) {
ret = nrf_modem_at_printf("AT%%REDMOB=%d", redmob_mode);
if (ret) {
mosh_error("Cannot set reduced mobility mode: %d", ret);
} else {
Expand Down

0 comments on commit 5611086

Please sign in to comment.