Skip to content

Commit

Permalink
Merge pull request #94 from PelionIoT/release-4.11.0
Browse files Browse the repository at this point in the history
mbed-cloud-client 4.11.0
  • Loading branch information
teetak01 authored Sep 21, 2021
2 parents d7edc52 + 40ab22a commit 105a184
Show file tree
Hide file tree
Showing 159 changed files with 7,435 additions and 2,437 deletions.
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
## Changelog for Pelion Device Management Client

### Release 4.11.0 (17.09.2021)

### Device Management Client

- Removed content type `ct=` field from the register message payload.
- Bootstrap LWM2M compliance:
- Bootstrap message parsing extracts instance ID from Uri-Path or from payload.
- Security instance IDs are no longer hardcoded but are in line with the bootstrap-server resource boolean value.
- Extended DELETE to paths other than 0 and 0/0.
- Updated to ignore and not fail when not supported optional resources are included in bootstrap PUT requests.
- Bootstrap done is triggered on receiving ACK to separate CHANGED response to the bs finish POST request. Previously, boostrap done was relying only on ssl peer close notification.
- Client has a new configuration flag `MBED_CLIENT_DYNAMIC_OBSERVABLE`, which controls APIs such as `set_observable()`. The purpose of these features is to control whether the resource can be observed from the cloud. When enabled, Client also appends the "obs" parameter to the resources as part of the registration message. If disabled, all resources are always observable, and you don't need to specify such capability separately. As part of improving LwM2M compliancy and to clean up the code base, this feature is wrapped behind this feature flag that is currently enabled by default. In the future, we plan to disable and eventually remove the feature completely.
- Add support to collect and store trace output to NVM for later review.
- You can enable this option by defining compile time macro `MBED_CONF_MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE`. This defines the size for a RAM buffer. When the buffer is full or trace level trigger is found, the buffer content is stored to NVM.
- When enabled, these resources are published, and you can use them to control logging:
- 33456/0/1 Start log capture.
- 33456/0/2 Stop log capture.
- 33456/0/3 Read current logs from NVM.
- 33456/0/4 Erase existing logs from NVM.
- 33456/0/5 Trace level output. Accepted values are: CMD (0), ERROR (1), WARN (2), INFO (3), DEBUG(4).
- 33456/0/6 Trace level trigger. Accepted values are: DISABLED(0), ERROR (1) and WARN (2). Default value is ERROR. If disabled, all trace lines defined by trace level are stored to NVM.
- 33456/0/7 Size of the NVM in bytes.
- 33456/0/8 Auto erase NVM when full, disabled by default.
- 33456/0/9 Is capture currently enabled/disabled.
- 33456/0/10 Size of unread logs in NVM.
- 33456/0/11 Error, SUCCESS(0), STORAGE FULL(1), READ FAILURE(2), WRITE FAILURE(3), ABORTED(4), OUT OF MEMORY(5).
- 33456/0/12 Total size if logs in NVM.
- The application can also start and stop capture using `MbedCloudClient::set_dynamic_logging_state(bool state)` API.
- Extended the `MbedCloudClient::setup()` API to allow the application to trigger full registration.

#### Device Management Update Client

- [Linux] Added support for FOTA combined update, which is a coordinated and simultaneous installation of multiple images on a device. The new `MBED_CLOUD_CLIENT_FOTA_SUB_COMPONENT_SUPPORT` macro enables this. To enable a combined update on a device, register a device component that consists of the relevant subcomponents that need to be updated together. `FOTA_MAX_NUM_OF_SUB_COMPONENTS` defines the maximum number of supported subcomponents.
- Deprecated component update callback prototypes. Customers using Pelion Device Management Client 4.11 and higher should use the new component update callbacks.
- Deprecated the verify-after-installation callback (`fota_component_verify_install_handler_t`). Use the `fota_comp_verify_cb_t` callback instead.
- Deprecated the installation callback for non-Linux targets (`fota_candidate_iterate_handler_t`). Use the `fota_comp_install_cb_t` callback instead.
- Deprecated the installation callback for Linux targets for component update (`fota_app_on_install_candidate`). For component update, use the `fota_comp_install_cb_t` callback. To update the main application, use `fota_app_on_install_candidate`.
- Added the `fota_comp_finalize_cb_t` installation finalization callback for future use (not in use yet).

### Platform Adaptation Layer (PAL)

[Linux] Enabled `PAL_DNS_API_VERSION` 3 by default for Linux configurations.

### Release 4.10.0 (07.07.2021)

### Device Management Client
Expand Down
41 changes: 37 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ add_definitions(-DSN_COAP_REDUCE_BLOCKWISE_HEAP_FOOTPRINT=1)
project(mbedCloudClient)

# mbed-cloud-client

SET(MBED_CLOUD_CLIENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mbed-cloud-client)

ADD_GLOBALDIR( ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down Expand Up @@ -270,6 +269,39 @@ SET(UPDATE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/update-client-hub)
include_directories(${UPDATE_SOURCE_DIR}/modules/source)

if (FOTA_ENABLE)

if (MESH_SOCKET_SIMULATOR)
message("<<<< MESH FOTA SIMULATOR >>>>")

ADD_GLOBALDIR(${CMAKE_CURRENT_SOURCE_DIR}/multicast)

add_definitions(-DMBED_CLOUD_CLIENT_MESH_SOCKET_SIMULATOR=1)
add_definitions(-DMBED_CLOUD_CLIENT_FOTA_RESUME_SUPPORT=FOTA_RESUME_UNSUPPORTED)
add_definitions(-DMBED_CLOUD_CLIENT_FOTA_ENCRYPTION_SUPPORT=0)
if (BORDER_ROUTER_MODE)
add_definitions(-DMBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT=FOTA_MULTICAST_BR_MODE)
else()
add_definitions(-DMBED_CLOUD_CLIENT_FOTA_MULTICAST_SUPPORT=FOTA_MULTICAST_NODE_MODE)
endif()

SET(MESH_SOCKET_SIMULATOR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/multicast)

include_directories(${MESH_SOCKET_SIMULATOR_DIR})

FILE(GLOB MESH_FOTA_SRC
"${MESH_SOCKET_SIMULATOR_DIR}/*.c"
"${MESH_SOCKET_SIMULATOR_DIR}/*.cpp"
)

message("MESH FOTA sources = \n ${MESH_FOTA_SRC}")
target_sources(mbedCloudClient PRIVATE "${MESH_FOTA_SRC}")
target_compile_definitions(mbedCloudClient INTERFACE MBED_CLOUD_CLIENT_MESH_SOCKET_SIMULATOR=1)
add_library(multicast STATIC ${MESH_FOTA_SRC})

add_dependencies(mbedCloudClient multicast)
target_link_libraries(mbedCloudClient multicast)
endif()

message("<<<< FOTA ENABLED >>>>")
SET(FOTA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/fota)

Expand Down Expand Up @@ -309,7 +341,7 @@ endif

add_library(fota STATIC ${FOTA_SRC})

if ( NOT FOTA_COAP_DOWNLOAD)
if (NOT FOTA_COAP_DOWNLOAD)
if (MBED_CLOUD_CLIENT_CURL_DYNAMIC_LINK)
include(FindPkgConfig)
pkg_check_modules(CURL libcurl REQUIRED)
Expand All @@ -322,15 +354,16 @@ endif
target_link_libraries(fota libcurl)
endif()
endif()

add_dependencies(mbedCloudClient fota)
target_link_libraries(mbedCloudClient fota)
else()
else() # (FOTA_ENABLE)

include_directories(${UPDATE_SOURCE_DIR}/modules/source-http)

add_dependencies(mbedCloudClient update-client)
target_link_libraries(mbedCloudClient update-client)
endif()
endif() # (FOTA_ENABLE)

# Needed to link sources
#set (SRC_LIBS ${SRC_LIBS} PARENT_SCOPE)
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Due to the release process, all new releases are squashed code drops. Therefore,
| Pawel Dunaj ([@pdunaj](https://github.com/pdunaj)) | N/A | Port Pelion Client to Zephyr OS |
| Emil Obalski ([@emob-nordic](https://github.com/emob-nordic)) | N/A | Port Pelion Client to Zephyr OS |
| Emil Obalski ([@emob-nordic](https://github.com/emob-nordic)) | [#86](https://github.com/PelionIoT/mbed-cloud-client/pull/86) | Update pal Timers |
| ccli8 ([@ccli8](https://github.com/ccli8)) | [#88](https://github.com/PelionIoT/mbed-cloud-client/pull/88) | Fix missing header file |
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <string.h>
#include <time.h>
#ifdef MBED_CONF_MBED_CLOUD_CLIENT_PSA_SUPPORT
#include "crypto.h"
#include "psa/crypto.h"
#endif
#include "pv_macros.h"

Expand Down
6 changes: 6 additions & 0 deletions factory-configurator-client/logger/logger/pv_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void pv_log_trace(int level, const char* filename, int line, const char *func, c
*/
void pv_log_trace_buffer(int level, const char* filename, int line, const char *func, const char *color, const char *name, const uint8_t *buff, uint32_t buff_size);

#ifdef FCC_ENABLE_FULL_TRACING
#define _SA_PV_LOG_FUNC_ENTER(level, filename, line, func, format, ...) _SA_PV_LOG(level, filename, line, func, "===> " format, ##__VA_ARGS__)

/** Exit function logging
Expand All @@ -54,6 +55,11 @@ void pv_log_trace_buffer(int level, const char* filename, int line, const char *
* - Usage example (with INFO level): SA_PV_LOG_INFO_FUNC_EXIT("argPointerToInt = %d, argPointerToUnsigned32 = %" PRIu32 "", *argPointerToInt, (uint32_t)*argPointerToUnsigned32);
*/
#define _SA_PV_LOG_FUNC_EXIT(level, filename, line, func, format, ...) _SA_PV_LOG(level, filename, line, func, "<=== " format, ##__VA_ARGS__)
#else
#define _SA_PV_LOG_FUNC_ENTER(level, filename, line, func, format, ...)

#define _SA_PV_LOG_FUNC_EXIT(level, filename, line, func, format, ...)
#endif

// CRITICAL always being output
#define SA_PV_LOG_CRITICAL(format, ...) \
Expand Down
32 changes: 16 additions & 16 deletions factory-configurator-client/mbed-client-esfs/source/esfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static bool esfs_initialize = false;
esfs_result_e esfs_init(void)
{
esfs_result_e result = ESFS_SUCCESS;
tr_info("esfs_init - enter");
tr_debug("esfs_init - enter");
if (!esfs_initialize)
{
palStatus_t pal_result = PAL_SUCCESS;
Expand Down Expand Up @@ -200,7 +200,7 @@ esfs_result_e esfs_init(void)
esfs_result_e esfs_finalize(void)
{
esfs_initialize = false;
tr_info("esfs_finalize - enter");
tr_debug("esfs_finalize - enter");
return ESFS_SUCCESS;
}

Expand Down Expand Up @@ -829,7 +829,7 @@ esfs_result_e esfs_reset(void)
esfs_result_e result = ESFS_SUCCESS;
palStatus_t pal_result = PAL_SUCCESS;
char dir_path[MAX_FULL_PATH_SIZE] = { 0 };
tr_info("esfs_reset - enter");
tr_debug("esfs_reset - enter");
pal_result = pal_fsGetMountPoint(PAL_FS_PARTITION_PRIMARY, PAL_MAX_FOLDER_DEPTH_CHAR + 1, dir_path);
if (pal_result != PAL_SUCCESS)
{
Expand Down Expand Up @@ -925,7 +925,7 @@ esfs_result_e esfs_factory_reset(void) {
char full_path_backup_dir[MAX_FULL_PATH_SIZE] = { 0 };
bool is_single_partition = true;

tr_info("esfs_factory_reset - enter");
tr_debug("esfs_factory_reset - enter");
pal_result = pal_fsGetMountPoint(PAL_FS_PARTITION_SECONDARY, PAL_MAX_FOLDER_DEPTH_CHAR + 1, full_path_backup_dir);
if (pal_result != PAL_SUCCESS)
{
Expand Down Expand Up @@ -1525,7 +1525,7 @@ esfs_result_e esfs_create(const uint8_t *name, size_t name_length, const esfs_tl
// Verify that the array is always packed without padding, since we read and write it as a whole.
PAL_ASSERT_STATIC(sizeof(esfs_tlvItem_t[ESFS_MAX_TYPE_LENGTH_VALUES]) == ESFS_MAX_TYPE_LENGTH_VALUES * sizeof(esfs_tlvItem_t));

tr_info("esfs_create - enter");
tr_debug("esfs_create - enter");

// Check parameters
if (!file_handle || !name || name_length == 0 || name_length > ESFS_MAX_NAME_LENGTH || meta_data_qty > ESFS_MAX_TYPE_LENGTH_VALUES)
Expand Down Expand Up @@ -1748,7 +1748,7 @@ esfs_result_e esfs_open(const uint8_t *name, size_t name_length, uint16_t *esfs_
bool is_aes_ctx_created = false;
palStatus_t res = PAL_SUCCESS;

tr_info("esfs_open - enter");
tr_debug("esfs_open - enter");
// Check parameters
if(!file_handle || !name || name_length == 0 || name_length > ESFS_MAX_NAME_LENGTH)
{
Expand Down Expand Up @@ -2007,7 +2007,7 @@ esfs_result_e esfs_write(esfs_file_t *file_handle, const void *buffer, size_t by
{
esfs_result_e result = ESFS_ERROR;

tr_info("esfs_write - enter");
tr_debug("esfs_write - enter");
if((esfs_validate(file_handle) != ESFS_SUCCESS) || (!buffer) || (bytes_to_write == 0))
{
tr_err("esfs_write() failed with bad parameters");
Expand Down Expand Up @@ -2060,7 +2060,7 @@ esfs_result_e esfs_read(esfs_file_t *file_handle, void *buffer, size_t bytes_to_
size_t remaining_bytes = 0;
palStatus_t res = PAL_SUCCESS;

tr_info("esfs_read - enter");
tr_debug("esfs_read - enter");
if(esfs_validate(file_handle) != ESFS_SUCCESS || read_bytes == NULL || !buffer)
{
result = ESFS_INVALID_PARAMETER;
Expand Down Expand Up @@ -2161,7 +2161,7 @@ esfs_result_e esfs_seek(esfs_file_t *file_handle, int32_t offset, esfs_seek_orig
palStatus_t res = PAL_SUCCESS;
off_t pal_offset;

tr_info("esfs_seek - enter");
tr_debug("esfs_seek - enter");
if(esfs_validate(file_handle) != ESFS_SUCCESS)
{
tr_err("esfs_seek() failed with bad parameters");
Expand Down Expand Up @@ -2251,7 +2251,7 @@ esfs_result_e esfs_file_size(esfs_file_t *file_handle, size_t *size_in_bytes)
{
esfs_result_e result = ESFS_ERROR;

tr_info("esfs_file_size - enter");
tr_debug("esfs_file_size - enter");
if((esfs_validate(file_handle) != ESFS_SUCCESS) || (!size_in_bytes))
{
tr_err("esfs_file_size() failed with bad parameters");
Expand All @@ -2277,7 +2277,7 @@ esfs_result_e esfs_close(esfs_file_t *file_handle)
char full_path_working_dir[MAX_FULL_PATH_SIZE];
palStatus_t res = PAL_SUCCESS;

tr_info("esfs_close - enter");
tr_debug("esfs_close - enter");
if(esfs_validate(file_handle) != ESFS_SUCCESS)
{
tr_err("esfs_close() failed with bad parameters");
Expand Down Expand Up @@ -2394,7 +2394,7 @@ esfs_result_e esfs_delete(const uint8_t *name, size_t name_length)
char short_file_name[ESFS_QUALIFIED_FILE_NAME_LENGTH];
esfs_result_e result = ESFS_ERROR;

tr_info("esfs_delete - enter");
tr_debug("esfs_delete - enter");
// Check parameters
if(!name || name_length == 0)
{
Expand All @@ -2407,7 +2407,7 @@ esfs_result_e esfs_delete(const uint8_t *name, size_t name_length)
tr_err("esfs_delete() - esfs_get_name_from_blob() failed");
goto errorExit;
}
tr_info("esfs_delete %s", short_file_name);
tr_debug("esfs_delete %s", short_file_name);

pal_result = pal_fsGetMountPoint(PAL_FS_PARTITION_PRIMARY, PAL_MAX_FOLDER_DEPTH_CHAR + 1, working_dir_path);
if (pal_result != PAL_SUCCESS)
Expand All @@ -2424,7 +2424,7 @@ esfs_result_e esfs_delete(const uint8_t *name, size_t name_length)

strncat(working_dir_path,short_file_name, ESFS_QUALIFIED_FILE_NAME_LENGTH - 1);

tr_info("esfs_delete %s", working_dir_path);
tr_debug("esfs_delete %s", working_dir_path);
pal_result = pal_fsUnlink(working_dir_path);

if ((pal_result == PAL_ERR_FS_NO_FILE) || (pal_result == PAL_ERR_FS_NO_PATH))
Expand All @@ -2447,7 +2447,7 @@ esfs_result_e esfs_delete(const uint8_t *name, size_t name_length)
esfs_result_e esfs_get_meta_data_properties(esfs_file_t *file_handle, esfs_tlv_properties_t **meta_data_properties)
{
esfs_result_e result = ESFS_ERROR;
tr_info("esfs_get_meta_data_properties - enter");
tr_debug("esfs_get_meta_data_properties - enter");
if((esfs_validate(file_handle) != ESFS_SUCCESS) || (!meta_data_properties))
{
tr_err("esfs_get_meta_data_properties() failed with bad parameters");
Expand Down Expand Up @@ -2477,7 +2477,7 @@ esfs_result_e esfs_read_meta_data(esfs_file_t *file_handle, uint32_t index, esfs
int32_t offset_to_restore = 0;
palStatus_t res = PAL_SUCCESS;

tr_info("esfs_read_meta_data - enter");
tr_debug("esfs_read_meta_data - enter");
if(esfs_validate(file_handle) != ESFS_SUCCESS || index >= ESFS_MAX_TYPE_LENGTH_VALUES || !meta_data || (file_handle->tlv_properties.tlv_items[index].length_in_bytes == 0))
{
tr_err("esfs_read_meta_data() failed with bad parameters");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ kcm_status_e psa_drv_ps_set(void* data, size_t data_size, uint32_t extra_flags,
kcm_status_e psa_drv_ps_remove(const uint16_t ksa_id);
#endif

#ifdef __MBED__
#include "platform/mbed_version.h"
#endif

/*============================================== Static functions CRYPTO driver implementation =========================================*/
static kcm_status_e psa_import_or_generate(const void* raw_data,
size_t raw_data_size,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ----------------------------------------------------------------------------
// Copyright 2018 ARM Ltd.
// Copyright 2018-2021 Pelion.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@
#include "pv_error_handling.h"
#include "pal_sst.h"
#include "kvstore_global_api.h"
#ifdef TARGET_LIKE_MBED
#ifdef __MBED__
#include "mbed.h"
#if MBED_MAJOR_VERSION > 5
#include "DeviceKey.h"
Expand All @@ -31,7 +31,7 @@

#define TRACE_GROUP "SST"

#ifndef TARGET_LIKE_MBED
#ifndef __MBED__
enum mbed_errors {
MBED_SUCCESS,
MBED_ERROR_READ_FAILED,
Expand Down
2 changes: 1 addition & 1 deletion factory-configurator-client/storage/source/storage_psa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "storage_internal.h"
#include "pv_macros.h"
#include "cs_pal_crypto.h"
#ifdef TARGET_LIKE_MBED
#ifdef __MBED__
#include "mbed.h"
#if !(defined(TARGET_TFM) && (MBED_MAJOR_VERSION > 5))
#include "psa/lifecycle.h"
Expand Down
Loading

0 comments on commit 105a184

Please sign in to comment.