Skip to content

Commit

Permalink
examples/lte_lwm2m: Add handling when version mismatches occur
Browse files Browse the repository at this point in the history
If the application detects a version mismatch, it should
display the version mismatch log and the firmware version
of the modem and exit.
  • Loading branch information
SPRESENSE committed Feb 22, 2023
1 parent 34170e0 commit cf4c6e5
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions examples/lte_lwm2m/lwm2m_lte_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ static void app_restart_cb(uint32_t reason)
char *reson_string[] =
{
"Modem restart by application.",
"Modem restart by self."
"Modem restart by self.",
"Modem version mismatch."
};
printf("%s called. reason:%s\n", __func__, reson_string[reason]);

Expand Down Expand Up @@ -397,6 +398,7 @@ int app_lwm2m_connect_to_lte(void)
struct lte_apn_setting apnsetting;
lte_errinfo_t info = {0};
lte_pdn_t pdn = {0};
lte_version_t version = {0};

/* Create a message queue. It is used to receive result from the
* asynchronous API callback.
Expand Down Expand Up @@ -442,8 +444,22 @@ int app_lwm2m_connect_to_lte(void)
*/

ret = app_wait_lte_callback(&result);
if ((ret < 0) || (result == LTE_RESULT_ERROR))
if (ret < 0)
{
goto errout_with_lte_fin;
}
else if (result == LTE_RESTART_VERSION_ERROR)
{
printf("Please enable the disabled protocol version"
" and flash the application.\n");

ret = lte_get_version_sync(&version);
if (ret == 0)
{
printf("Modem IC Type : %s\n", version.bb_product);
printf(" FW Ver. : %s\n", version.np_package);
}

goto errout_with_lte_fin;
}
}
Expand Down

0 comments on commit cf4c6e5

Please sign in to comment.