mbedConnectorInterface sample endpoint utilizing 3g cellular radio as the underlying connection transport.
Dependencies: LM75B mbed mbedConnectorInterface mbedEndpointNetwork_Ublox
Diff: main.cpp
- Revision:
- 7:68f1eadf4a63
- Parent:
- 6:15431341f373
- Child:
- 9:0370006a6988
--- a/main.cpp Thu Jul 23 19:42:38 2015 +0000 +++ b/main.cpp Sat Jul 25 05:16:06 2015 +0000 @@ -40,8 +40,8 @@ // Static Resources #include "StaticResource.h" -StaticResource mfg(&logger,"dev/mfg","U-blox"); -StaticResource model(&logger,"dev/mdl","mbed cellular node"); +StaticResource mfg(&logger,"dev/mfg","u-blox"); +StaticResource model(&logger,"dev/mdl","mbed cellular endpoint"); // // Dynamic Resource Note: @@ -65,14 +65,28 @@ #include "TemperatureResource.h" TemperatureResource temperature(&logger,"303/0/5700",true); +// Location Resource +#include "LocationResource.h" +LocationResource location(&logger,"999/0/1234",true); + // Set our own unique endpoint name -#define MY_ENDPOINT_NAME "mbed-ublox-endpoint" +#define MY_ENDPOINT_NAME "mbed-3g-endpoint" // My NSP Domain #define MY_NSP_DOMAIN "domain" // Customization Example: My custom NSP IPv4 address and NSP CoAP port -uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {23,99,29,171}; // connector (api.connector.mbed.org) +//uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {23,99,29,171}; // connector (api.connector.mbed.org) + +//#define MY_NSP_DOMAIN "311faa04f3ba4a12a893fbfd0ab95d67" +//uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {70,37,91,233}; // azure +//uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {52,25,1,47}; // EC2 +uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {129,41,131,150}; // bluemix vm +//uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {129,41,227,18}; // bluemix container +//uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {10,1,0,150}; // local container +//uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {10,1,0,26}; // local container +//uint8_t my_nsp_address[NSP_IP_ADDRESS_LENGTH] = {192,168,1,147}; // local container + int my_nsp_coap_port = 5683; // called from the Endpoint::start() below to create resources and the endpoint internals... @@ -100,7 +114,8 @@ // Add my specific physical dynamic resources... .addResource(&light) - .addResource(&temperature) + .addResource(&temperature,10000) // observe every 10 seconds + .addResource(&location,10000) // observe every 10 seconds // finalize the configuration... .build(); @@ -110,7 +125,7 @@ int main() { // Announce - logger.log("\r\n\r\nmbed mDS Sample Endpoint v1.0 (U-blox Cellular)"); + logger.log("\r\n\r\nmbed mDS Sample Endpoint v1.0 (3G Cellular)"); // we have to plumb our network first Connector::Endpoint::plumbNetwork(); @@ -118,4 +133,4 @@ // starts the endpoint by finalizing its configuration (configure_endpoint() above called),creating a Thread and reading NSP events... logger.log("Start the endpoint to finish setup and enter the main loop..."); Connector::Endpoint::start(); -} +} \ No newline at end of file