More advanced NanoService Demo for LPC1768 App Board using OMA Lightweight Objects

Dependencies:   Beep C12832_lcd EthernetInterface LM75B MMA7660 mbed-rtos mbed nsdl_lib

Fork of LWM2M_NanoService_Ethernet by MBED_DEMOS

Revision:
14:5acd59fec679
Parent:
13:b52d83adc1ab
Child:
15:db022645bcc1
--- a/main.cpp	Wed Mar 26 22:16:52 2014 +0000
+++ b/main.cpp	Wed Mar 26 22:33:45 2014 +0000
@@ -32,7 +32,7 @@
 char mbed_uid[33]; // for creating unique name for the board
 uint8_t ep_type[] = {"mbed_lpc1768_appboard"};
 uint8_t lifetime_ptr[] = {"60"};
-static const char* FIRMWARE_VER = "0.91"; // Used in static resource
+static const char* FIRMWARE_VER = "14"; // Committed revision number
 char* mac;
 char* ipAddr;
 char* gateway;
@@ -120,10 +120,14 @@
     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/2")-1, (uint8_t*) "3/0/2", 0, 0,  (uint8_t*) mbed_uid, sizeof(mbed_uid)-1);
     nsdl_create_static_resource(resource_ptr, sizeof("3/0/3")-1, (uint8_t*) "3/0/3", 0, 0,  (uint8_t*) FIRMWARE_VER, sizeof(FIRMWARE_VER));
-    nsdl_create_static_resource(resource_ptr, sizeof("4/0/0")-1, (uint8_t*) "4/0/0", 0, 0,  (uint8_t*) "Ethernet", sizeof("Ethernet")-1);
-    nsdl_create_static_resource(resource_ptr, sizeof("4/0/1")-1, (uint8_t*) "4/0/1", 0, 0,  (uint8_t*) "Ethernet", sizeof("Ethernet")-1);
-    nsdl_create_static_resource(resource_ptr, sizeof("4/0/4")-1, (uint8_t*) "4/0/4", 0, 0,  (uint8_t*) ipAddr, 15);
-    nsdl_create_static_resource(resource_ptr, sizeof("4/0/5")-1, (uint8_t*) "4/0/5", 0, 0,  (uint8_t*) gateway, 15);
+   #ifdef DHCP
+    nsdl_create_static_resource(resource_ptr, sizeof("4/0/0")-1, (uint8_t*) "4/0/0", 0, 0,  (uint8_t*) "Ethernet DHCP", sizeof("Ethernet DHCP")-1);
+   #else
+    nsdl_create_static_resource(resource_ptr, sizeof("4/0/0")-1, (uint8_t*) "4/0/0", 0, 0,  (uint8_t*) "Ethernet Static", sizeof("Ethernet Static")-1);  
+   #endif
+    nsdl_create_static_resource(resource_ptr, sizeof("4/0/1")-1, (uint8_t*) "4/0/1", 0, 0,  (uint8_t*) "Ethernet (Static, DHCP)", sizeof("Ethernet (Static, DHCP)")-1);
+    nsdl_create_static_resource(resource_ptr, sizeof("4/0/4")-1, (uint8_t*) "4/0/4", 0, 0,  (uint8_t*) ipAddr, strlen(ipAddr));
+    nsdl_create_static_resource(resource_ptr, sizeof("4/0/5")-1, (uint8_t*) "4/0/5", 0, 0,  (uint8_t*) gateway, strlen(gateway));
     nsdl_create_static_resource(resource_ptr, sizeof("3/0/16")-1, (uint8_t*) "3/0/16", 0, 0,  (uint8_t*) "UDP", sizeof("UDP")-1);
 
     // Dynamic resources
@@ -152,7 +156,7 @@
 {
     lcd.cls();
     lcd.locate(0,0);
-    lcd.printf("NanoService LWM2M %s", FIRMWARE_VER);
+    lcd.printf("NanoService LWM2M r%s", FIRMWARE_VER);
     NSDL_DEBUG("NanoService LWM2M Demo for LPC1768 App Board\n");
     
     // Initialize Ethernet interface first