Skip to content

Commit 13e0cef

Browse files
author
Jani Suonperä
authored
Merge pull request #15 from ARMmbed/release-1.5.0
mbed-cloud-client 1.5.0
2 parents 9b0bc6a + 9bbd11d commit 13e0cef

File tree

269 files changed

+16008
-8289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+16008
-8289
lines changed

CHANGELOG.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,70 @@
1-
## Changelog for Mbed Cloud Client
1+
## Changelog for Pelion Device Management Client
2+
3+
### Release 1.5.0 (11.09.2018)
4+
5+
#### Pelion Device Management Client
6+
7+
* Implement new callback to track notification and delayed post response delivery statuses.
8+
* Added API: `M2MBase::set_message_delivery_status_cb(message_delivery_status_cb callback, void *client_args);`
9+
* Following API's are mark as deprecated since this new API will replace them. These API's will be removed in subsequential client relases.
10+
* `M2MBase::send_notification_delivery_status(const M2MBase& object, const NotificationDeliveryStatus status)`
11+
* `M2MBase::get_notification_msgid()`
12+
* `M2MBase::set_notification_msgid(uint16_t msgid)`
13+
* `M2MBase::set_notification_delivery_status_cb(notification_delivery_status_cb callback, void *client_args)`
14+
* `M2MBase::get_notification_delivery_status()`
15+
* `M2MBase::clear_notification_delivery_status()`
16+
* Implemented new functionality to get the internal object list of Mbed Cloud Client.
17+
* Added API: `MbedCloudClient::get_object_list()`.
18+
19+
#### Platform Adaptation Layer (PAL)
20+
21+
* Fixed Coverity issues in PAL.
22+
* Improved error handling and logging for network and storage.
23+
* Introduced `PAL_DNS_API_VERSION` for handling DNS.
24+
* 0 = synchronous DNS.
25+
* 1 = asynchronous DNS.
26+
* 2 = asynchronous DNS v2 (Only with Mbed OS 5.9 or later).
27+
* Fixed PAL tracing implementation to allow an application to override the tracing level definitions.
28+
* In `pal_isLeapYear` fixed a bug that made the certificate times off by a day.
29+
* Enforced usage of MTU limits when using DTLS and `PAL_UDP_MTU_SIZE` is defined.
30+
* Added configuration for K66F.
31+
* [LINUX] Improved logging for RNG generation.
32+
* [LINUX] Removed the glibc-specific function `pthread_sigqueue()` and replaced with `pthead_kill()`.
33+
* [LINUX] Increased stack-size of `PAL_NOISE_TRNG_THREAD` to 32k. Increased stack-size of `PAL_NET_TEST_ASYNC_SOCKET_MANAGER_THREAD_STACK_SIZE` to 24k.
34+
* [LINUX] Added socket event filter clearing for `pal_plat_connect()` and `pal_plat_asynchronousSocket()`.
35+
* [Mbed OS] Define `PAL_USE_INTERNAL_FLASH` and `PAL_INT_FLASH_NUM_SECTIONS = 2` by default for all targets.
36+
* [Mbed OS] Compatibility changes for Mbed OS 5.10.
37+
* [Mbed OS] Fixed a compatibility issue with Mbed TLS 2.13.0 for ARMCC compiler.
38+
39+
#### Mbed Cloud Update
40+
41+
* Fixed Device Management Client factory update flow by setting default identity configuration to KCM
42+
* Added Firmware Update over CoAP into Device Management Client
43+
* The firmware is downloaded using HTTP by default.
44+
* To Download using CoAP in MbedOS set the flag into "target_overrides" -section in mbed_app.json followingly:
45+
* "mbed-cloud-client.update-download-protocol": "MBED_CLOUD_CLIENT_UPDATE_DOWNLOAD_PROTOCOL_COAP"
46+
* [LINUX] Fixed Linux Update e2e failure reverting adding "set -eu" to linux scripts.
47+
* Fixed RTL8195 Flash R/W Issue by adding FlashIAP Init -call into initialization
48+
* Fixed long HTTP headers handling logic to support headers to split to multiple fragments
49+
* Fixed Device Management Update Client versioning to work in factory flow
50+
* Fixed Device Management Update Client uninitialization logic by adding handling for state ARM_UC_HUB_STATE_UNINITIALIZED in state machine
51+
* Optimized static RAM usage by reusing the static object "ManifestManagerContext" during init
52+
* Added support into Device Management Update Client Configuration to map external Download Protocol -definition to internal configurations. This is needed for supporting Download protocol selection in Device Management Client
53+
* Implemented resume firmware download after connection failure.
54+
* Added a scheduler trace macro.
55+
* Merged two branches of Device Management Update client to one and added profile & feature flags to separate between different feature sets. New profile flag `ARM_UC_PROFILE_MBED_CLOUD_CLIENT` is used to enable correct profile for Device Management Client.
56+
* `MBED_CONF_MBED_CLIENT_DNS_USE_THREAD` removed.
57+
* Fixed Linux scripts to use -e and -u parameters for "set" to propagate errors
58+
* Fixed Update state machine failure which was noticed when traces were enabled. Notification state machine was changed to sequentially wait internal asynchronous operations to complete before sending updated resource values to service and waiting for acknowledgment from service.
59+
* MCCP=3 in Pelion Device Management Client: Support for sending update resource data as part of the Registration Message, thereby reducing traffic to Pelion Device Management.
60+
* Changed uninitialization for Device Management Update Client to be done for all states past initialization states. Added null-checks for resource value settings.
61+
62+
#### Factory configurator client
63+
64+
* The error `FCC_STATUS_STORE_ERROR` is returned upon an internal storage init failure.
265

366
### Release 1.4.0 (13.07.2018)
67+
468
* Fixed a timer initialization bug under connection handler.
569
* Linux: Updated mbed-coap to 4.5.0.
670
* This version of Cloud Client has been tested with Mbed OS 5.9.2.

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ SET(MBED_CLOUD_CLIENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/mbed-cloud-client)
1717
add_definitions(-DMBED_CONF_NANOSTACK_EVENTLOOP_EXCLUDE_HIGHRES_TIMER)
1818
add_definitions(-DMBED_CONF_NANOSTACK_EVENTLOOP_USE_PLATFORM_TICK_TIMER)
1919

20+
add_definitions(-DARM_UC_PROFILE_MBED_CLOUD_CLIENT=1)
21+
add_definitions(-DARM_UC_FEATURE_PAL_FILESYSTEM=1)
22+
2023
project(mbedCloudClient)
2124

2225
# mbed-cloud-client
@@ -117,6 +120,12 @@ include_directories(${FACTORY_CLIENT_SOURCE_DIR}/fcc-bundle-handler/fcc-bundle-h
117120
include_directories(${FACTORY_CLIENT_SOURCE_DIR}/fcc-bundle-handler/source/include)
118121
include_directories(${FACTORY_CLIENT_SOURCE_DIR}/fcc-output-info-handler/fcc-output-info-handler)
119122

123+
# Certificate Enrollment Client
124+
SET(CERTIFICATE_ENROLLMENT_CLIENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/certificate-enrollment-client)
125+
ADD_GLOBALDIR(${CERTIFICATE_ENROLLMENT_CLIENT_SOURCE_DIR}/certificate-enrollment-client)
126+
include_directories(${CERTIFICATE_ENROLLMENT_CLIENT_SOURCE_DIR}/certificate-enrollment-client)
127+
include_directories(${CERTIFICATE_ENROLLMENT_CLIENT_SOURCE_DIR}/source/include)
128+
120129
# update-client
121130

122131
SET(UPDATE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/update-client-hub)
@@ -192,6 +201,7 @@ endif()
192201
"${CMAKE_CURRENT_SOURCE_DIR}/ns-hal-pal/arm_hal_timer.cpp"
193202
"${FACTORY_CLIENT_SOURCE_DIR}/source/*.c"
194203
"${FACTORY_CLIENT_SOURCE_DIR}/storage/source/*.c"
204+
"${FACTORY_CLIENT_SOURCE_DIR}/mbed-client-esfs/source/sotp/*.c"
195205
"${FACTORY_CLIENT_SOURCE_DIR}/secure_store/source/*.c"
196206
"${FACTORY_CLIENT_SOURCE_DIR}/key-config-manager/source/*.c"
197207
"${FACTORY_CLIENT_SOURCE_DIR}/utils/source/*.c"
@@ -202,6 +212,8 @@ endif()
202212
"${FACTORY_CLIENT_SOURCE_DIR}/crypto-service/source/*.c"
203213
"${FACTORY_CLIENT_SOURCE_DIR}/fcc-bundle-handler/source/*.c"
204214
"${FACTORY_CLIENT_SOURCE_DIR}/fcc-output-info-handler/source/*.c"
215+
"${CERTIFICATE_ENROLLMENT_CLIENT_SOURCE_DIR}/source/*.c"
216+
"${CERTIFICATE_ENROLLMENT_CLIENT_SOURCE_DIR}/source/*.cpp"
205217
)
206218

207219
if ((${OS_BRAND} MATCHES "Linux"))

DOXYGEN_FRONTPAGE.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
Mbed Cloud Client API
1+
Device Management Client API
22
=====================
33

4-
This is the Doxygen generated API documentation of Mbed Cloud Client. See the [Files](files.html) section to find the documentation about a specific API. It should be used together with the [Mbed Cloud documentation](https://cloud.mbed.com/docs/current).
4+
This is the Doxygen-generated API documentation for Device Management Client. See the [Files](files.html) section to find the documentation about a specific API. You should also use the [Device Management documentation](https://cloud.mbed.com/docs/current).
55

6-
The Mbed Cloud Client high-level APIs allow mbed Cloud developers to create client side applications that connect to the Mbed Cloud service, with LwM2M features as described in the [Lightweight Machine to Machine Technical Specification](http://technical.openmobilealliance.org/Technical/technical-information/release-program/current-releases/oma-lightweightm2m-v1-0).
6+
The Device Management Client high-level APIs allow developers to create client side applications that connect to **Device Management**, with LwM2M features as described in the [Lightweight Machine to Machine Technical Specification](http://technical.openmobilealliance.org/Technical/technical-information/release-program/current-releases/oma-lightweightm2m-v1-0).
77

8-
Mbed Cloud Client is an extension of the existing [Mbed Client API](http://cloud.mbed.com/docs/current/mbed-client/index.html). It provides an additional feature of creating a unique identity for the client on the Cloud service and also provides functionality to update the client's software through the Mbed Cloud service.
8+
Device Management Client is an extension of the existing [Mbed Client API](http://cloud.mbed.com/docs/current/mbed-client/index.html). It provides an additional feature of creating a unique identity for the client on the **Device Management** and also provides functionality to update the client's software through the **Device Management** service.
9+
10+
These APIs make it possible to:
911

1012
- Use a factory flashed or developer credentials to create a unique device identity.
1113
- Securely communicate with internet services over the industry standard TLS/DTLS.
12-
- Manage devices on the Mbed Cloud service.
14+
- Manage devices.
1315
- Fully control the endpoint and application logic from the service side.
1416
- Provide functionality to update the devices over the air remotely controlled from the service side.
1517
- Have a unified porting layer for porting to different platforms.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Mbed Cloud Client
2-
This repository contains ARM Mbed Cloud Client: a library that connects devices to Mbed Cloud service and to Mbed-enabled cloud services from our partners.
1+
# Device Management Client
2+
This repository contains Pelion Device Management Client: a library that connects devices to Pelion Device Management service and to Mbed-enabled cloud services from our partners.
33

44
The documentation is collected under the docs directory and it is also hosted [here](https://cloud.mbed.com/docs/current/connecting/index.html).
55

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
cmake_minimum_required(VERSION 2.6)
2+
project("certificate-enrollment-client")
3+
4+
# includes
5+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/certificate-enrollment-client)
6+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/source/include)
7+
8+
# FIXME: remove this line once integration is done
9+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../mbed-cloud-client/source/include)
10+
11+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../source/include)
12+
13+
# For mock EST
14+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/TESTS/utils)
15+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../pal-platform/Middleware/mbedtls/mbedtls/include/mbedtls)
16+
17+
FILE(
18+
GLOB_RECURSE
19+
certificate_enrollment_client
20+
21+
"${CMAKE_CURRENT_SOURCE_DIR}/certificate-enrollment-client/*.h"
22+
"${CMAKE_CURRENT_SOURCE_DIR}/source/*.c"
23+
"${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp"
24+
25+
# Fixme: Mock EST
26+
"${CMAKE_CURRENT_SOURCE_DIR}/TESTS/utils/*.cpp"
27+
"${CMAKE_CURRENT_SOURCE_DIR}/TESTS/utils/*.c"
28+
)
29+
30+
message ("*********************************************************************")
31+
message ("certificate_enrollment_client = [[${certificate_enrollment_client}]]")
32+
message ("*********************************************************************")
33+
34+
CREATE_LIBRARY(certificate-enrollment-client "${certificate_enrollment_client}" "")
35+
ADDSUBDIRS()
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// ----------------------------------------------------------------------------
2+
// Copyright 2018 ARM Ltd.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
// ----------------------------------------------------------------------------
16+
17+
#ifndef __CERTIFICATE_ENROLLMENT_CLIENT_H__
18+
#define __CERTIFICATE_ENROLLMENT_CLIENT_H__
19+
20+
#include "mbed-client/m2mresource.h"
21+
#include "mbed-client/m2minterface.h"
22+
#include "stdio.h"
23+
#include "ce_defs.h"
24+
#include "EstClient.h"
25+
26+
namespace CertificateEnrollmentClient {
27+
/**
28+
* \brief Create the Certificate renewal LWM2M object, instance and resource and push the object to the list
29+
* Also save the pointers to the object and resource, register the event handler, and create the renewal_mutex
30+
* Should be called by ServiceClient::initialize_and_register()
31+
* \param list MbedCloudClient object list
32+
*/
33+
ce_status_e init(M2MBaseList& list, const EstClient *est_client);
34+
35+
/**
36+
* \brief Release all the resources owned by the CertificateEnrollmentClient
37+
* Should be called by the ServiceClient destructor.
38+
* Does not free the LWM2M resources as the pointers are owned by the ServiceClient. They are freed by the ServiceClient object when device unregisters.
39+
*/
40+
void finalize();
41+
42+
/**
43+
* \brief Initiate a renewal for a specific certificate.
44+
* The process will generate new keys in order to create a CSR. The CSR is then sent to the EST service to retrieve the renewed certificate.
45+
* The new certificate is then atomically stored in the device, along with its corresponding private key.
46+
* Note: The certificate to be removed *must* already exist in the device.
47+
* \param cert_name A null terminated C string indicating the name of the certificate to be renewed.
48+
* \return CE_STATUS_SUCCESS if asynchronous operations has started successfully - In this case, user callback will be executed at the end of the operation, indicating completion status.
49+
* If any other ce_status_e:: status is returned - operation encountered some error prior to start of the asynchronous stage and user callback will NOT be executed.
50+
*/
51+
ce_status_e certificate_renew(const char *cert_name);
52+
53+
/**
54+
* \brief Sets the callback function that is called when a certificate renewal process finishes.
55+
* Should be called prior to any certificate renewal operation.
56+
* If a certificate renewal is initiated (either by the certificate_renew() API or by the server) - operation will run normal but the device application will not be notified when done.
57+
* \param user_cb A function pointer to the user callback. If user_cb is NULL - no callback will be called when process finishes.
58+
*/
59+
void on_certificate_renewal(cert_renewal_cb_f user_cb);
60+
61+
}
62+
63+
64+
#endif //__CERTIFICATE_ENROLLMENT_CLIENT_H__
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// ----------------------------------------------------------------------------
2+
// Copyright 2018 ARM Ltd.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
// ----------------------------------------------------------------------------
16+
17+
#ifndef __CE_DEFS_H__
18+
#define __CE_DEFS_H__
19+
20+
#ifdef __cplusplus
21+
extern "C" {
22+
#endif
23+
24+
/**
25+
* @file ce_defs.h
26+
* \brief Certificate Enrollment (CE) public defines.
27+
* This file along with ce_status.h (included by this file) contains all the defines exposed to the user for the certificate renewal feature.
28+
* This file should be included by MbedCloudClient.h. This way the user does not have to include it directly.
29+
*/
30+
31+
#include "ce_status.h"
32+
33+
/** Enumeration representing the initiator of a certificate renewal operation */
34+
typedef enum {
35+
CE_INITIATOR_DEVICE, //!< Operation initiated by the application
36+
CE_INITIATOR_SERVER //!< Operation initiated by the MDS
37+
} ce_initiator_e;
38+
39+
//!< User callback for the certificate renewal feature. char* guaranteed to be persistent only in context of the callback!
40+
typedef void(*cert_renewal_cb_f)(const char*, ce_status_e, ce_initiator_e);
41+
42+
#ifdef __cplusplus
43+
}
44+
#endif
45+
46+
#endif //__CE_DEFS_H__
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// ----------------------------------------------------------------------------
2+
// Copyright 2018 ARM Ltd.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
// ----------------------------------------------------------------------------
16+
17+
#ifndef __CE_STATUS_H__
18+
#define __CE_STATUS_H__
19+
20+
#ifdef __cplusplus
21+
extern "C" {
22+
#endif
23+
24+
/**
25+
* @file ce_status.h
26+
* \brief Certificate Enrollment (CE) status/error codes.
27+
* This list may grow as needed.
28+
*/
29+
30+
#define CE_STATUS_RANGE_BASE 0x0500
31+
#define CE_STATUS_RANGE_END 0x05ff
32+
33+
// TBD: need to translate KCM to CE errors
34+
typedef enum {
35+
CE_STATUS_SUCCESS = 0, //!< Operation completed successfully.
36+
CE_STATUS_ERROR = CE_STATUS_RANGE_BASE, //!< Operation ended with an unspecified error.
37+
CE_STATUS_INVALID_PARAMETER, //!< A parameter provided to the function was invalid.
38+
CE_STATUS_INSUFFICIENT_BUFFER, //!< The provided buffer size was insufficient for the required output.
39+
CE_STATUS_OUT_OF_MEMORY, //!< An out-of-memory condition occurred.
40+
CE_STATUS_ITEM_NOT_FOUND, //!< The item was not found in the storage.
41+
CE_STATUS_DEVICE_BUSY, //!< Device currently processing too many certificate renewals
42+
CE_STATUS_BAD_INPUT_FROM_SERVER, //!< Server sent a TLV that is either unsupported or malformed
43+
CE_STATUS_EST_ERROR,
44+
CE_STATUS_STORAGE_ERROR, //!< Storage operation ended with error.
45+
CE_STATUS_RENEWAL_ITEM_VALIDATION_ERROR, //!< Operation failed to validate renewal items.
46+
CE_STATUS_BACKUP_ITEM_ERROR, //!< Operation failed to create/read/validate backup items.
47+
CE_STATUS_ORIGINAL_ITEM_ERROR, //!< Operation failed to create/read/validate original items.
48+
CE_STATUS_RESTORE_BACKUP_ERROR, //!< Operation failed to restore backup items.
49+
CE_STATUS_RENEWAL_STATUS_ERROR, //!< Operation fialed to create/validate/delete renweal status file.
50+
CE_STATUS_FORBIDDEN_REQUEST, //!< Server asked for forbidden request (e.g.: the server is not allowed to renew the device's bootstrap certificate)
51+
CE_STATUS_ITEM_IS_EMPTY, //!< Item was found in storage but has zero length
52+
CE_STATUS_NOT_INITIALIZED, //!< Called CertificateEnrollmentClient API before module initialization
53+
CE_MAX_STATUS = CE_STATUS_RANGE_END
54+
} ce_status_e;
55+
56+
#ifdef __cplusplus
57+
}
58+
#endif
59+
60+
#endif //__CE_STATUS_H__

0 commit comments

Comments
 (0)