mbed Connector Endpoint interface. This interface permits a mbed endpoint to easily setup MDS resources and emit those resources to an MDS server.

Dependents:   IoT_LED_demo ServoTest uWater_Project hackathon ... more

Revision:
16:383ad1356963
Parent:
13:b0b2f1ae4c30
--- a/api/ConnectorEndpoint.cpp	Thu Feb 05 14:49:04 2015 +0000
+++ b/api/ConnectorEndpoint.cpp	Fri Feb 06 04:07:51 2015 +0000
@@ -28,6 +28,37 @@
 // Connector namespace
 namespace Connector {
 
+// STATIC: Plumb the network
+void Endpoint::plumbNetwork(bool canActAsRouterNode) {
+    // call into our network stubs to (pre-configure) plumb the network... 
+    DBG("plumbNetwork: pre-configure plumb of network...\r\n");
+    net_stubs_pre_plumb_network(canActAsRouterNode);
+    
+    // configure the endpoint now...
+    DBG("plumbNetwork: configuring endpoint...\r\n");
+    utils_configure_endpoint();   
+    
+    // call into our network stubs to (pre-configure) plumb the network... 
+    DBG("plumbNetwork: post-configure plumb of network...\r\n");
+    net_stubs_post_plumb_network(); 
+}
+
+// STATIC: Finalize the endpoint's configuration and begin the endpoint's main even loop (static, not tied into Logger)
+void Endpoint::start()
+{   
+   // initialize our endpoint and register it
+   DBG("Endpoint::start(): creating endpoint instance and registering with mDS...\r\n");
+   utils_init_and_register_endpoint();
+   
+   // create the main loop plumbing for our lower network stack
+   DBG("Endpoint::start(): creating main loop plumbing...\r\n");
+   net_stubs_create_main_loop();
+   
+   // call into the lower network stubs to start event processing
+   DBG("Endpoint::start(): beginning main event loop...\r\n");
+   net_stubs_begin_main_loop();
+}
+
 // Constructor
 Endpoint::Endpoint(const Logger *logger, const Options *options)
 {
@@ -47,14 +78,8 @@
 {
 }
 
-// Plumb the network
-void Endpoint::plumbNetwork(bool canActAsRouterNode) {
-    // call into our network stubs to plumb the network... 
-    net_stubs_plumb_network(canActAsRouterNode);
-}
-
-// initialize the endpoint
-void Endpoint::initialize()
+// register the endpoint
+void Endpoint::register_endpoint()
 {    
     // Create the NSDL Resource Pointer...
     this->logger()->log("Endpoint::initialize(): initializing NSP resource pointer...");
@@ -93,18 +118,6 @@
     nsdl_free(resource_ptr);
 }
 
-// Finalize the endpoint's configuration and begin the endpoint's main even loop (static, not tied into Logger)
-void Endpoint::start()
-{   
-   // create the main loop plumbing for our lower network stack
-   DBG("Endpoint::start(): creating main loop plumbing...\r\n");
-   net_stubs_create_main_loop();
-   
-   // call into the lower network stubs to start event processing
-   DBG("Endpoint::start(): beginning main event loop...\r\n");
-   net_stubs_begin_main_loop();
-}
-
 // our logger
 Logger *Endpoint::logger()
 {