Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix: update from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 31, 2023
1 parent 7615435 commit f9f3217
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion doc/cloud_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions doc/debug_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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 <CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT>` Kconfig option is disabled, the debug module uses the `Memfault firmware SDK's <Memfault firmware SDK_>`_ 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
*********************

Expand Down
9 changes: 6 additions & 3 deletions overlay-azure.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
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

# 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.
Expand Down
3 changes: 0 additions & 3 deletions overlay-lwm2m.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/cloud/Kconfig.azure_fota_patch
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 7 additions & 5 deletions src/cloud/lwm2m_integration/lwm2m_integration.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/events/debug_module_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
#include <modem/nrf_modem_lib.h>
#endif /* CONFIG_NRF_MODEM_LIB */
#include <zephyr/sys/reboot.h>
#if defined(CONFIG_LWM2M_INTEGRATION)
#include <net/lwm2m_client_utils.h>
#endif /* CONFIG_LWM2M_INTEGRATION */
#include <net/nrf_cloud.h>

/* Module name is used by the Application Event Manager macros in this file */
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions tests/lwm2m_integration/src/lwm2m_integration_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit f9f3217

Please sign in to comment.