COAP mbed Beispiel

Dependencies:   EthernetInterface mbed-rtos mbed nsdl_lib

Fork of IoTKit_CoAP by mc-b

Constrained Application Protocol (Coap) ist ein Software-Protokoll welches für Internet der Dinge Geräte zugeschnitten ist.

COAP ist auf den meisten Geräten, die UDP Unterstützen, lauffähig.

Ein COAP fähiges Gerät publiziert seine Sensoren und Aktoren in einem Resource Directory oder stellt selber ein solches zur Verfügung.

Mittels Resource Discovery können die vorhandenen Sensoren und Aktoren mit ihren Attributen abgefragt werden.

Revision:
3:52c1b649eb04
Parent:
2:7e489126fe7a
Child:
4:15690450a797
--- a/main.cpp	Tue Oct 15 12:45:46 2013 +0000
+++ b/main.cpp	Tue Oct 15 15:48:23 2013 +0000
@@ -26,9 +26,9 @@
 
 // NSP configuration
 /* Change this IP address to that of your NanoService Platform installation */
-static const char* NSP_ADDRESS = "217.140.101.40"; /* internal NSP*/
+static const char* NSP_ADDRESS = "217.140.101.20"; /* internal NSP*/
 static const int NSP_PORT = 5683;
-char endpoint_name[15] = "MyMbedexam";
+char endpoint_name[16] = "refactored";
 uint8_t ep_type[] = {"mbed_device"};
 uint8_t lifetime_ptr[] = {"1200"};
 
@@ -53,7 +53,7 @@
 
     mbed_interface_uid(mbed_uid);
     mbed_uid[32] = '\0';
-    memcpy(&endpoint_name[10], &mbed_uid[27], 5);
+    memcpy(&endpoint_name[10], &mbed_uid[27], 6);
 
     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", endpoint_name);
+    lcd.printf("EP name:%s\n", endpoint_name);
 }
 
 // ****************************************************************************
@@ -121,7 +121,6 @@
         pc.printf("NSP registering failed\r\n");
     else
         pc.printf("NSP registering OK\r\n");
-
     nsdl_clean_register_endpoint(&endpoint_ptr);
 
     nsdl_free(resource_ptr->resource_parameters_ptr);