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:
- 13:9edad7677211
- Parent:
- 10:3f79b5e67c22
- Child:
- 15:c11dbe4d354c
--- a/source/ConnectorEndpoint.cpp Thu Mar 10 16:02:04 2016 +0000 +++ b/source/ConnectorEndpoint.cpp Wed Jun 08 22:32:08 2016 +0000 @@ -43,12 +43,23 @@ namespace Connector { // STATIC: Plumb the network -void Endpoint::plumbNetwork(bool canActAsRouterNode) { +void Endpoint::plumbNetwork(void *device_manager,bool canActAsRouterNode) { if (__endpoint == NULL) { // initialize our endpoint instance DEBUG_OUT("Endpoint::plumbNetwork: initializing endpoint instance...\r\n"); __endpoint = (Connector::Endpoint *)utils_init_endpoint(canActAsRouterNode); } + + // set the device manager + if (device_manager != NULL) { + // device manager has been supplied + DEBUG_OUT("Endpoint::plumbNetwork: setting a device manager...\r\n"); + __endpoint->setDeviceManager(device_manager); + } + else { + // no device manager supplied + DEBUG_OUT("Endpoint::plumbNetwork: no device manager supplied (OK)\r\n"); + } // configure the endpoint now... DEBUG_OUT("Endpoint::plumbNetwork: configuring endpoint...\r\n"); @@ -76,6 +87,8 @@ { this->m_logger = (Logger *)logger; this->m_options = (Options *)options; + this->m_device_manager = NULL; + this->m_connected = false; } // Copy Constructor @@ -87,6 +100,8 @@ this->m_server_instance = ep.m_server_instance; this->m_object_list = ep.m_object_list; this->m_device_object = ep.m_device_object; + this->m_device_manager = ep.m_device_manager; + this->m_connected = ep.m_connected; } // Destructor @@ -97,6 +112,16 @@ delete this->m_server_instance; } +// set the device manager +void Endpoint::setDeviceManager(void *device_manager) { + this->m_device_manager = device_manager; +} + +// get the device manager +void *Endpoint::getDeviceManager(void) { + return this->m_device_manager; +} + // router node behavior setting void Endpoint::asRouterNode(bool canActAsRouterNode) { this->m_canActAsRouterNode = canActAsRouterNode; @@ -319,6 +344,16 @@ } } +// underlying network is connected (SET) +void Endpoint::isConnected(bool connected) { + this->m_connected = connected; +} + +// underlying network is connected (GET) +bool Endpoint::isConnected() { + return this->m_connected; +} + // our logger Logger *Endpoint::logger() {