added max-age and content-format
Fork of mbedConnectorInterface by
Diff: api/ConnectorEndpoint.cpp
- Revision:
- 9:d094cfc650c3
- Parent:
- 8:b518d1c01df1
- Child:
- 12:c068a2d3e8fe
--- a/api/ConnectorEndpoint.cpp Sun Feb 01 14:54:18 2015 +0000 +++ b/api/ConnectorEndpoint.cpp Sun Feb 01 18:10:10 2015 +0000 @@ -22,11 +22,8 @@ #include "ConnectorEndpoint.h" -// support for temporary mbedEndpointLib calls... -#include "mbedEndpointLib.h" - -// Tasklet ID -int main_tasklet_id = -1; +// lower level network stubs integration +#include "mbedEndpointNetworkStubs.h" // Connector namespace namespace Connector { @@ -52,8 +49,8 @@ // Plumb the network void Endpoint::plumbNetwork(bool canActAsRouterNode) { - // call into mbedEndpointLib directly for now... (TODO: wont be able to (re)set MAC address in OptionsBuilder as its already been plumbed here...) - init_network(canActAsRouterNode); + // call into our network stubs to plumb the network... + net_stubs_plumb_network(canActAsRouterNode); } // initialize the endpoint @@ -99,27 +96,22 @@ // initialize the NSDL Network void Endpoint::initNetwork() { - // register with NSP - this->logger()->log("Calling NSP_registration()..."); - NSP_registration(); - this->logger()->log("NSP_registration() completed"); + // register with NSP through our lower network stubs... + this->logger()->log("initNetwork: calling NSP registration..."); + net_stubs_register_endpoint(); + this->logger()->log("initNetwork: NSP registration completed"); } // Finalize the endpoint's configuration and begin the endpoint's main even loop (static, not tied into Logger) void Endpoint::start() { - // mbedEndpointLib tasklet creation... - main_tasklet_id = arm_ns_tasklet_create(&tasklet_main); - if(main_tasklet_id < 0) { - //Tasklet cerate fail - std::printf("startTasklet: Tasklet creation failed...\r\n"); - return; - } - - // mbedEndpointLib event dispatching - std::printf("startTasklet: Beginning event dispatch...\r\n"); - event_dispatch(); - return; + // 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