adding resources firmware and 1/0/8
Dependencies: Beep C12832_lcd EthernetInterface EthernetNetIf HTTPClient LM75B MMA7660 mbed-rtos mbed nsdl_lib
Fork of LWM2M_NanoService_Ethernet by
Revision 8:f0ecb62bda47, committed 2014-02-04
- Comitter:
- zdshelby
- Date:
- Tue Feb 04 05:19:54 2014 +0000
- Parent:
- 7:6b068978be9a
- Child:
- 9:66e8aeb60dc6
- Commit message:
- MWC2014 NanoService Demo Project for the LPC1768 on App Board
Changed in this revision
--- a/main.cpp Tue Oct 22 10:50:05 2013 +0000 +++ b/main.cpp Tue Feb 04 05:19:54 2014 +0000 @@ -26,11 +26,11 @@ // NSP configuration /* Change this IP address to that of your NanoService Platform installation */ -static const char* NSP_ADDRESS = "217.140.101.20"; /* demo NSP, web interface at http://nanoservice-demo.mbed.org*/ +static const char* NSP_ADDRESS = "208.111.39.209"; /* demo NSP, web interface at http://nanoservice-demo.mbed.org*/ static const int NSP_PORT = 5683; -char endpoint_name[16] = "mbed-"; -uint8_t ep_type[] = {"mbed_device"}; -uint8_t lifetime_ptr[] = {"1200"}; +char endpoint_name[20] = "mbed-ethernet-"; +uint8_t ep_type[] = {"mbed_lpc1768_appboard"}; +uint8_t lifetime_ptr[] = {"60"}; // **************************************************************************** // Ethernet initialization @@ -53,7 +53,7 @@ mbed_interface_uid(mbed_uid); mbed_uid[32] = '\0'; - strncat(endpoint_name, mbed_uid + 27, 15 - strlen(endpoint_name)); + strncat(endpoint_name, mbed_uid + 27, 20 - strlen(endpoint_name)); lcd.locate(0,11); lcd.printf("IP:%s", eth.getIPAddress()); @@ -78,7 +78,7 @@ NSDL_DEBUG("NSP=%s - port %d\n", NSP_ADDRESS, NSP_PORT); lcd.locate(0,22); - lcd.printf("EP name:%s\n", endpoint_name); + lcd.printf("EP:%s\n", endpoint_name); } // **************************************************************************** @@ -106,8 +106,9 @@ memset(resource_ptr->resource_parameters_ptr, 0, sizeof(sn_nsdl_resource_parameters_s)); // Static resources - nsdl_create_static_resource(resource_ptr, sizeof("dev/mfg")-1, (uint8_t*) "dev/mfg", 0, 0, (uint8_t*) "Sensinode", sizeof("Sensinode")-1); - nsdl_create_static_resource(resource_ptr, sizeof("dev/mdl")-1, (uint8_t*) "dev/mdl", 0, 0, (uint8_t*) "NSDL-C mbed device", sizeof("NSDL-C mbed device")-1); + nsdl_create_static_resource(resource_ptr, sizeof("3/0/0")-1, (uint8_t*) "3/0/0", 0, 0, (uint8_t*) "ARM", sizeof("ARM")-1); + nsdl_create_static_resource(resource_ptr, sizeof("3/0/1")-1, (uint8_t*) "3/0/1", 0, 0, (uint8_t*) "LPC1768 App Board", sizeof("LPC1768 App Board")-1); + nsdl_create_static_resource(resource_ptr, sizeof("3/0/16")-1, (uint8_t*) "3/0/16", 0, 0, (uint8_t*) "U", sizeof("U")-1); // Dynamic resources create_temperature_resource(resource_ptr); @@ -135,8 +136,8 @@ { lcd.cls(); lcd.locate(0,0); - lcd.printf("mbed NanoService demo"); - NSDL_DEBUG("mbed NanoService Example App 0.1\n"); + lcd.printf("NanoService @ MWC2014"); + NSDL_DEBUG("NanoService @ MWC2014 Demo for LPC1768 App Board\n"); // Initialize Ethernet interface first ethernet_init();
--- a/resources/gps.cpp Tue Oct 22 10:50:05 2013 +0000 +++ b/resources/gps.cpp Tue Feb 04 05:19:54 2014 +0000 @@ -7,7 +7,7 @@ #define GPS_RES_ID "gps/loc" extern Serial pc; -static uint8_t res_gps_val[] = {"52.182382,0.178849"}; +static uint8_t res_gps_val[] = {"41.3575123, 2.1249663"}; /* Only GET method allowed */ static uint8_t gps_resource_cb(sn_coap_hdr_s *received_coap_ptr, sn_nsdl_addr_s *address, sn_proto_info_s * proto) @@ -36,6 +36,6 @@ int create_gps_resource(sn_nsdl_resource_info_s *resource_ptr) { - nsdl_create_dynamic_resource(resource_ptr, sizeof(GPS_RES_ID)-1, (uint8_t*)GPS_RES_ID, 0, 0, 0, &gps_resource_cb, SN_GRS_GET_ALLOWED); + nsdl_create_dynamic_resource(resource_ptr, sizeof(GPS_RES_ID)-1, (uint8_t*)GPS_RES_ID, 0, 0, 1, &gps_resource_cb, SN_GRS_GET_ALLOWED); return 0; } \ No newline at end of file
--- a/resources/light.cpp Tue Oct 22 10:50:05 2013 +0000 +++ b/resources/light.cpp Tue Feb 04 05:19:54 2014 +0000 @@ -4,7 +4,7 @@ #include "nsdl_support.h" #include "light.h" -#define LIGHT_RES_ID "lt/0/dim" +#define LIGHT_RES_ID "311/0/5851" extern Serial pc; //PwmOut led1(LED1);
--- a/resources/relay.cpp Tue Oct 22 10:50:05 2013 +0000 +++ b/resources/relay.cpp Tue Feb 04 05:19:54 2014 +0000 @@ -5,7 +5,7 @@ #include "relay.h" #include "Beep.h" -#define RELAY_RES_ID "beep/0/on" +#define RELAY_RES_ID "306/0/5850" extern Serial pc; static Beep buzzer(p26);
--- a/resources/temperature.cpp Tue Oct 22 10:50:05 2013 +0000 +++ b/resources/temperature.cpp Tue Feb 04 05:19:54 2014 +0000 @@ -6,7 +6,7 @@ #include "nsdl_support.h" #include "temperature.h" -#define TEMP_RES_ID "sen/temp" +#define TEMP_RES_ID "303/0/5700" static LM75B tmp(p28,p27); /* stored data for observable resource */