mbed Connector Interface simplification API on top of mbed-client
Fork of mbedConnectorInterfaceV3 by
NOTE:
This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!
Diff: source/ConnectorEndpoint.cpp
- Revision:
- 109:e3fc9140cbbf
- Parent:
- 106:8c504a89c1dc
- Child:
- 110:0af085ececd2
--- a/source/ConnectorEndpoint.cpp Tue Apr 25 22:42:59 2017 +0000 +++ b/source/ConnectorEndpoint.cpp Wed Apr 26 03:11:06 2017 +0000 @@ -268,8 +268,11 @@ // mbedCloudClient: create our interface void Endpoint::createCloudEndpointInterface() { if (this->m_endpoint_interface == NULL) { - if (this->initializeStorage() && this->initializeFactoryFlow()) { + bool storage_init = this->initializeStorage(); + bool factory_flow_init = this->initializeFactoryFlow(); + if (storage_init && factory_flow_init) { // create a new instance of mbedCloudClient + this->logger()->log("createCloudEndpointInterface: creating mbed cloud client instance..."); this->m_endpoint_interface = new MbedCloudClient(); if (this->m_endpoint_interface == NULL) { // unable to allocate the MbedCloudClient instance @@ -284,6 +287,17 @@ #endif } } + else { + if (storage_init) { + // unable to create mbed cloud client instance... (FAILED factory flow init) + this->logger()->log("createCloudEndpointInterface: ERROR: unable to initialize factory flow..."); + } + else { + // unable to create mbed cloud client instance... (FAILED storage init) + this->logger()->log("createCloudEndpointInterface: ERROR: unable to initialize storage..."); + } + this->m_endpoint_interface = NULL; + } } // bind LWIP network interface pointer... @@ -294,6 +308,10 @@ this->m_endpoint_interface->on_error(&Connector::Endpoint::on_error); this->m_endpoint_interface->set_update_callback(this); } + else { + // skipping LWIP bind... + this->logger()->log("Connector::Endpoint: ERROR (Cloud) skipping LWIP network instance bind due to previous error..."); + } } #else // mbed-client: create our interface