CoAP Device Server Client mit leshan Server

Dependencies:   EthernetInterface mbed-rtos mbed nsdl_lib

Fork of COAPmbed by smd.iotkit2.ch

Sandbox Server

Eclipse stellt einen Testserver unter http://leshan.eclipse.org/ zur Verfügung. Das Programm verbindet sich mit diesem und ist unter mbed-k64f... erreichbar.

Installation lokale Version leshan

wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-server-demo.jar
java -jar ./leshan-server-demo.jar

cURL

Die Funktionen können mittels cURL oder Browser wie folgt getestet werden:

# Alle Clients abfragen (Antwort im JSON Format)
curl -X GET  http://localhost:8080/api/clients
                         
# Wert von LED2 abfragen (Antwort im text/plain Format)                      
curl -X GET  http://localhost:8080/api/clients/mbed-k64f-1234/10/0/2 
 
# Wert für LED2 setzen
curl -X GET -vvv http://localhost:8080/api/clients/mbed-k64f-1234/10/0/2 -H "Content-Type: text/plain" -d "10"
Revision:
7:6b068978be9a
Parent:
3:52c1b649eb04
Child:
15:fba25b7e63cd
diff -r 442775856f5f -r 6b068978be9a nsdl_support.cpp
--- a/nsdl_support.cpp	Mon Oct 21 21:30:05 2013 +0000
+++ b/nsdl_support.cpp	Tue Oct 22 10:50:05 2013 +0000
@@ -69,7 +69,7 @@
     {
         memset(endpoint_structure, 0, sizeof(sn_nsdl_ep_parameters_s));
         endpoint_structure->endpoint_name_ptr = name;
-        endpoint_structure->endpoint_name_len = 15;
+        endpoint_structure->endpoint_name_len = strlen((char*)name);
         endpoint_structure->type_ptr = typename_ptr;
         endpoint_structure->type_len =  strlen((char*)typename_ptr);
         endpoint_structure->lifetime_ptr = lifetime_ptr;