Skip to content

Commit fe37cb7

Browse files
MirkoCovizzirlubos
authored andcommitted
lib: lte_link_control: deprecate factory reset
Deprecate factory reset 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]>
1 parent 63f67f6 commit fe37cb7

File tree

7 files changed

+54
-13
lines changed

7 files changed

+54
-13
lines changed

doc/nrf/releases_and_maturity/migration/migration_guide_2.8.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,23 @@ LTE link control library
137137
* Remove the use of the ``CONFIG_LTE_NETWORK_USE_FALLBACK`` Kconfig option.
138138
Use the :kconfig:option:`CONFIG_LTE_NETWORK_MODE_LTE_M_NBIOT` or :kconfig:option:`CONFIG_LTE_NETWORK_MODE_LTE_M_NBIOT_GPS` Kconfig option instead.
139139
In addition, you can control the priority between LTE-M and NB-IoT using the :kconfig:option:`CONFIG_LTE_MODE_PREFERENCE` Kconfig option.
140+
* Replace the use of the :c:func:`lte_lc_factory_reset` function with the following:
141+
142+
* If the :c:enumerator:`LTE_LC_FACTORY_RESET_ALL` value is used with the :c:func:`lte_lc_factory_reset` function:
143+
144+
.. code-block:: C
145+
146+
#include <nrf_modem_at.h>
147+
148+
err = nrf_modem_at_printf("AT%%XFACTORYRESET=0");
149+
150+
* If the :c:enumerator:`LTE_LC_FACTORY_RESET_USER` value is used with the :c:func:`lte_lc_factory_reset` function:
151+
152+
.. code-block:: C
153+
154+
#include <nrf_modem_at.h>
155+
156+
err = nrf_modem_at_printf("AT%%XFACTORYRESET=1");
140157
141158
AT command parser
142159
-----------------

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,11 @@ Modem libraries
749749

750750
* To use the :ref:`at_parser_readme` library instead of the :ref:`at_cmd_parser_readme` library.
751751
* The :c:func:`lte_lc_neighbor_cell_measurement` function to return an error for invalid GCI count.
752+
* The :c:func:`lte_lc_factory_reset` function has been deprecated.
753+
Use the ``AT%XFACTORYRESET`` AT command instead.
754+
Refer to the :ref:`migration guide <migration_2.8>` for more details.
755+
* The :c:enum:`lte_lc_factory_reset_type` type has been deprecated.
756+
Refer to the :ref:`migration guide <migration_2.8>` for more details.
752757

753758
* :ref:`lib_location` library:
754759

include/modem/lte_lc.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,11 @@ enum lte_lc_modem_evt {
742742
LTE_LC_MODEM_EVT_CE_LEVEL_3,
743743
};
744744

745-
/** Type of factory reset to perform. */
745+
/**
746+
* Type of factory reset to perform.
747+
*
748+
* @deprecated since v2.8.0.
749+
*/
746750
enum lte_lc_factory_reset_type {
747751
/** Reset all modem data to factory settings. */
748752
LTE_LC_FACTORY_RESET_ALL = 0,
@@ -1789,6 +1793,8 @@ int lte_lc_reduced_mobility_set(enum lte_lc_reduced_mobility_mode mode);
17891793
*
17901794
* @retval 0 if factory reset was performed successfully.
17911795
* @retval -EFAULT if an AT command failed.
1796+
*
1797+
* @deprecated since v2.8.0.
17921798
*/
17931799
int lte_lc_factory_reset(enum lte_lc_factory_reset_type type);
17941800

samples/cellular/modem_shell/src/link/link.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@ enum link_ncellmeas_modes {
1919
#define LINK_FUNMODE_NONE 99
2020
#define LINK_SYSMODE_NONE 99
2121
#define LINK_REDMOB_NONE 99
22-
#define LTE_LC_FACTORY_RESET_INVALID 99
22+
23+
/** Type of factory reset to perform. */
24+
enum link_factory_reset_type {
25+
/** Reset all modem data to factory settings. */
26+
LINK_FACTORY_RESET_ALL = 0,
27+
28+
/** Reset user-configurable data to factory settings. */
29+
LINK_FACTORY_RESET_USER = 1,
30+
31+
/** Invalid type. */
32+
LINK_FACTORY_RESET_INVALID = 99
33+
};
2334

2435
void link_init(void);
2536
void link_ind_handler(const struct lte_lc_evt *const evt);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,12 +801,12 @@ void link_sett_defaults_set(void)
801801
mosh_print("link settings reseted");
802802
}
803803

804-
void link_sett_modem_factory_reset(enum lte_lc_factory_reset_type type)
804+
void link_sett_modem_factory_reset(enum link_factory_reset_type type)
805805
{
806806
int err;
807807

808808
/* Reset modem factory settings by type */
809-
err = lte_lc_factory_reset(type);
809+
err = nrf_modem_at_printf("AT%%XFACTORYRESET=%d", type);
810810
if (err) {
811811
mosh_error("Resetting modem factory settings failed, err %d", err);
812812
} else {

samples/cellular/modem_shell/src/link/link_settings.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef MOSH_LINK_SETTINGS_H
88
#define MOSH_LINK_SETTINGS_H
99

10+
#include "link.h"
11+
1012
int link_sett_init(void);
1113

1214
void link_sett_defaults_set(void);
@@ -56,6 +58,6 @@ bool link_sett_is_normal_mode_autoconn_enabled(void);
5658
bool link_sett_is_normal_mode_autoconn_rel14_used(void);
5759
void link_sett_normal_mode_autoconn_shell_print(void);
5860

59-
void link_sett_modem_factory_reset(enum lte_lc_factory_reset_type type);
61+
void link_sett_modem_factory_reset(enum link_factory_reset_type type);
6062

6163
#endif /* MOSH_LINK_SETTINGS_H */

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ static int link_shell_search(const struct shell *shell, size_t argc, char **argv
23542354
static int link_shell_settings(const struct shell *shell, size_t argc, char **argv)
23552355
{
23562356
enum link_shell_operation operation = LINK_OPERATION_NONE;
2357-
enum lte_lc_factory_reset_type mreset_type = LTE_LC_FACTORY_RESET_INVALID;
2357+
enum link_factory_reset_type mreset_type = LINK_FACTORY_RESET_INVALID;
23582358

23592359
optreset = 1;
23602360
optind = 1;
@@ -2372,10 +2372,10 @@ static int link_shell_settings(const struct shell *shell, size_t argc, char **ar
23722372
break;
23732373

23742374
case LINK_SHELL_OPT_MRESET_ALL:
2375-
mreset_type = LTE_LC_FACTORY_RESET_ALL;
2375+
mreset_type = LINK_FACTORY_RESET_ALL;
23762376
break;
23772377
case LINK_SHELL_OPT_MRESET_USER:
2378-
mreset_type = LTE_LC_FACTORY_RESET_USER;
2378+
mreset_type = LINK_FACTORY_RESET_USER;
23792379
break;
23802380

23812381
case 'h':
@@ -2395,18 +2395,18 @@ static int link_shell_settings(const struct shell *shell, size_t argc, char **ar
23952395
if (operation == LINK_OPERATION_READ) {
23962396
link_sett_all_print();
23972397
} else if (operation == LINK_OPERATION_RESET ||
2398-
mreset_type != LTE_LC_FACTORY_RESET_INVALID) {
2398+
mreset_type != LINK_FACTORY_RESET_INVALID) {
23992399
if (operation == LINK_OPERATION_RESET) {
24002400
link_sett_defaults_set();
24012401
if (SYS_MODE_PREFERRED != LINK_SYSMODE_NONE) {
24022402
link_shell_sysmode_set(SYS_MODE_PREFERRED,
24032403
CONFIG_LTE_MODE_PREFERENCE_VALUE);
24042404
}
24052405
}
2406-
if (mreset_type == LTE_LC_FACTORY_RESET_ALL) {
2407-
link_sett_modem_factory_reset(LTE_LC_FACTORY_RESET_ALL);
2408-
} else if (mreset_type == LTE_LC_FACTORY_RESET_USER) {
2409-
link_sett_modem_factory_reset(LTE_LC_FACTORY_RESET_USER);
2406+
if (mreset_type == LINK_FACTORY_RESET_ALL) {
2407+
link_sett_modem_factory_reset(mreset_type);
2408+
} else if (mreset_type == LINK_FACTORY_RESET_USER) {
2409+
link_sett_modem_factory_reset(mreset_type);
24102410
}
24112411
} else {
24122412
goto show_usage;

0 commit comments

Comments
 (0)