diff --git a/doc/cloud_module.rst b/doc/cloud_module.rst index 52991b71..a44c5d6d 100644 --- a/doc/cloud_module.rst +++ b/doc/cloud_module.rst @@ -176,7 +176,7 @@ Configurations for Azure IoT Hub library To enable communication with Azure IoT Hub, set the following options in the :file:`overlay-azure.conf` file: * :kconfig:option:`CONFIG_AZURE_IOT_HUB_DPS_ID_SCOPE` -* :kconfig:option:`CONFIG_AZURE_IOT_HUB_SEC_TAG` +* :kconfig:option:`CONFIG_MQTT_HELPER_SEC_TAG` * :kconfig:option:`CONFIG_AZURE_FOTA_SEC_TAG` If not using the default DPS (Device Provisioning Service) host, ensure that the hostname option is correctly set using the following Kconfig option: diff --git a/doc/debug_module.rst b/doc/debug_module.rst index 50978826..d3485129 100644 --- a/doc/debug_module.rst +++ b/doc/debug_module.rst @@ -38,6 +38,18 @@ This enables the application to be able to collect coredump data before a reboot To enable Memfault, you must include the :file:`../overlay-memfault.conf` when building the application. To get started with Memfault, see :ref:`using_memfault`. +.. _asset_tracker_v2_ext_transport: + +Custom transport +---------------- + +The data that is collected from the device can be routed through a custom transport to the Memfault cloud instead of using Memfault's own HTTPS transport. +To do this, enable the :ref:`CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT ` Kconfig option. +If this option is enabled, the debug module forwards the captured Memfault data through the :c:enumerator:`DEBUG_EVT_MEMFAULT_DATA_READY` event. +If the :ref:`CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT ` Kconfig option is disabled, the debug module uses the `Memfault firmware SDK's `_ own internal HTTP transport. +Transporting Memfault data through a pre-established transport can save overhead related to maintaining multiple connections at the same time. +Currently, only the AWS IoT configuration supports this configuration. + Configuration options ********************* diff --git a/overlay-azure.conf b/overlay-azure.conf index c024571b..5306d008 100644 --- a/overlay-azure.conf +++ b/overlay-azure.conf @@ -7,8 +7,7 @@ CONFIG_AZURE_IOT_HUB=y CONFIG_AZURE_IOT_HUB_DPS=y CONFIG_AZURE_IOT_HUB_AUTO_DEVICE_TWIN_REQUEST=y -CONFIG_AZURE_IOT_HUB_MQTT_RX_TX_BUFFER_LEN=2048 -CONFIG_AZURE_IOT_HUB_STACK_SIZE=4096 + # Increase the number of maximum message properties that can be parsed by the Azure IoT Hub library. # Needed to be able to parse P-GPS responses. CONFIG_AZURE_IOT_HUB_MSG_PROPERTY_RECV_MAX_COUNT=4 @@ -16,7 +15,11 @@ CONFIG_AZURE_IOT_HUB_MSG_PROPERTY_RECV_MAX_COUNT=4 # Azure IoT Hub options that must be configured in order to establish a connection. CONFIG_AZURE_IOT_HUB_DPS_HOSTNAME="global.azure-devices-provisioning.net" CONFIG_AZURE_IOT_HUB_DPS_ID_SCOPE="" -CONFIG_AZURE_IOT_HUB_SEC_TAG=11 + +# MQTT helper library +CONFIG_MQTT_HELPER_RX_TX_BUFFER_SIZE=2048 +CONFIG_MQTT_HELPER_STACK_SIZE=4096 +CONFIG_MQTT_HELPER_SEC_TAG=11 # MQTT Transport library # Maximum specified MQTT keepalive timeout for Azure IoT Hub is 1177 seconds. diff --git a/overlay-lwm2m.conf b/overlay-lwm2m.conf index d72e4a25..adc380b9 100644 --- a/overlay-lwm2m.conf +++ b/overlay-lwm2m.conf @@ -79,9 +79,6 @@ CONFIG_LWM2M_CONN_MON_BEARER_MAX=2 CONFIG_LWM2M_CLIENT_UTILS=y CONFIG_LWM2M_CLIENT_UTILS_SECURITY_OBJ_SUPPORT=y CONFIG_LWM2M_CLIENT_UTILS_FIRMWARE_UPDATE_OBJ_SUPPORT=y -# Disable rebooting of the device from the lwm2m client utils firmware object. -# The application handles the reboot itself. -CONFIG_LWM2M_CLIENT_UTILS_FIRMWARE_UPDATE_REBOOT=n CONFIG_LWM2M_CLIENT_UTILS_DEVICE_OBJ_SUPPORT=n CONFIG_LWM2M_CLIENT_UTILS_CONN_MON_OBJ_SUPPORT=n CONFIG_LWM2M_CLIENT_UTILS_LOCATION_OBJ_SUPPORT=n diff --git a/src/cloud/Kconfig.azure_fota_patch b/src/cloud/Kconfig.azure_fota_patch index 46d5fa64..27b39344 100644 --- a/src/cloud/Kconfig.azure_fota_patch +++ b/src/cloud/Kconfig.azure_fota_patch @@ -23,4 +23,4 @@ config AZURE_FOTA_VERSION_MAX_LEN # to Azure IoT Hub. If this Kconfig is not set when building with Azure FOTA, the library will # throw a build assert. config AZURE_FOTA_SEC_TAG - default AZURE_IOT_HUB_SEC_TAG + default MQTT_HELPER_SEC_TAG diff --git a/src/cloud/lwm2m_integration/lwm2m_integration.c b/src/cloud/lwm2m_integration/lwm2m_integration.c index 22784629..bb31e116 100644 --- a/src/cloud/lwm2m_integration/lwm2m_integration.c +++ b/src/cloud/lwm2m_integration/lwm2m_integration.c @@ -200,13 +200,13 @@ static void rd_client_event(struct lwm2m_ctx *client, enum lwm2m_rd_client_event /* Callback handler triggered when lwm2m object resource 1/0/4 (device/reboot) is executed. */ static int device_reboot_cb(uint16_t obj_inst_id, uint8_t *args, uint16_t args_len) { - ARG_UNUSED(args); - ARG_UNUSED(args_len); ARG_UNUSED(obj_inst_id); - struct cloud_wrap_event cloud_wrap_evt = { - .type = CLOUD_WRAP_EVT_REBOOT_REQUEST - }; + struct cloud_wrap_event cloud_wrap_evt = { .type = CLOUD_WRAP_EVT_REBOOT_REQUEST }; + + if (args_len && args && *args == REBOOT_SOURCE_FOTA_OBJ) { + cloud_wrap_evt.type = CLOUD_WRAP_EVT_FOTA_DONE; + } cloud_wrapper_notify_event(&cloud_wrap_evt); return 0; @@ -290,6 +290,8 @@ static int firmware_update_state_cb(uint8_t update_state) case STATE_UPDATING: LOG_DBG("STATE_UPDATING, result: %d", update_result); cloud_wrap_evt.type = CLOUD_WRAP_EVT_FOTA_DONE; + /* Disable further callbacks from FOTA */ + lwm2m_firmware_set_update_state_cb(NULL); break; default: LOG_ERR("Unknown state: %d", update_state); diff --git a/src/events/debug_module_event.h b/src/events/debug_module_event.h index 45cb5558..1aeb9173 100644 --- a/src/events/debug_module_event.h +++ b/src/events/debug_module_event.h @@ -21,7 +21,7 @@ extern "C" { #endif enum debug_module_event_type { - /** Event carrying memfault data that should be forwarded via the configured cloud + /** Event carrying Memfault data that should be forwarded via the configured cloud * backend to Memfault cloud. Only sent if * CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT is enabled. * Payload is of type @ref debug_module_memfault_data. diff --git a/src/main.c b/src/main.c index bc49570a..88b8be63 100644 --- a/src/main.c +++ b/src/main.c @@ -13,9 +13,6 @@ #include #endif /* CONFIG_NRF_MODEM_LIB */ #include -#if defined(CONFIG_LWM2M_INTEGRATION) -#include -#endif /* CONFIG_LWM2M_INTEGRATION */ #include /* Module name is used by the Application Event Manager macros in this file */ @@ -226,8 +223,6 @@ static void handle_nrf_modem_lib_init_ret(void) #if defined(CONFIG_NRF_CLOUD_FOTA) /* Ignore return value, rebooting below */ (void)nrf_cloud_fota_pending_job_validate(NULL); -#elif defined(CONFIG_LWM2M_INTEGRATION) - lwm2m_verify_modem_fw_update(); #endif LOG_DBG("Rebooting..."); LOG_PANIC(); diff --git a/tests/lwm2m_integration/src/lwm2m_integration_test.c b/tests/lwm2m_integration/src/lwm2m_integration_test.c index 129c96fd..c570d873 100644 --- a/tests/lwm2m_integration/src/lwm2m_integration_test.c +++ b/tests/lwm2m_integration/src/lwm2m_integration_test.c @@ -341,6 +341,7 @@ void test_lwm2m_integration_fota_result_get(void) __cmock_lwm2m_get_u8_ExpectAndReturn(&LWM2M_OBJ(5, 0, 5), NULL, 0); __cmock_lwm2m_get_u8_IgnoreArg_value(); + __cmock_lwm2m_firmware_set_update_state_cb_Expect(NULL); firmware_update_state_cb(STATE_IDLE); firmware_update_state_cb(STATE_DOWNLOADING); @@ -389,6 +390,7 @@ void test_lwm2m_integration_fota_downloaded(void) void test_lwm2m_integration_fota_updating(void) { __cmock_lwm2m_get_u8_IgnoreAndReturn(0); + __cmock_lwm2m_firmware_set_update_state_cb_Expect(NULL); last_cb_type = UINT8_MAX;