Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbedConnectorInterfaceV3 by
Diff: source/ConnectorEndpoint.cpp
- Revision:
- 105:aeaaee8fbb1d
- Parent:
- 101:305cc6527e20
- Child:
- 106:8c504a89c1dc
--- a/source/ConnectorEndpoint.cpp Fri Apr 21 03:57:44 2017 +0000 +++ b/source/ConnectorEndpoint.cpp Mon Apr 24 20:42:24 2017 +0000 @@ -50,11 +50,6 @@ // LWIP Network interface instance NetworkInterface *__network_interface = NULL; -#ifdef ENABLE_MBED_CLOUD_SUPPORT -// Static mbed endpoint -static MbedCloudClient __mbed_cloud_client; -#endif - // Connector namespace namespace Connector { @@ -264,12 +259,20 @@ void Endpoint::createCloudEndpointInterface() { if (this->m_endpoint_interface == NULL) { if (this->initializeStorage() && this->initializeFactoryFlow()) { - this->m_endpoint_interface = &__mbed_cloud_client; - - // enable hooks for Updater support (R1.2+) - update_ui_set_cloud_client(&__mbed_cloud_client); - __mbed_cloud_client.set_update_authorize_handler(&Connector::Endpoint::update_authorize); - __mbed_cloud_client.set_update_progress_handler(&Connector::Endpoint::update_progress); + // create a new instance of mbedCloudClient + this->m_endpoint_interface = new MbedCloudClient(); + if (this->m_endpoint_interface == NULL) { + // unable to allocate the MbedCloudClient instance + this->logger()->log("createCloudEndpointInterface: ERROR: unable to allocate MbedCloudClient instance..."); + } + else { + // enable hooks for Updater support (R1.2+) (if enabled) +#ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE + update_ui_set_cloud_client(this->m_endpoint_interface); + this->m_endpoint_interface->set_update_authorize_handler(&Connector::Endpoint::update_authorize); + this->m_endpoint_interface->set_update_progress_handler(&Connector::Endpoint::update_progress); +#endif + } } }