![](/media/cache/group/ep_srxDLMd.webp.50x50_q85.jpg)
CoAP Device Server Client mit leshan Server
Dependencies: EthernetInterface mbed-rtos mbed nsdl_lib
Fork of COAPmbed by
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"
Diff: main.cpp
- Revision:
- 22:6d4c96af70e3
- Parent:
- 21:c11c5a72d8e0
diff -r c11c5a72d8e0 -r 6d4c96af70e3 main.cpp --- a/main.cpp Mon Aug 31 09:21:18 2015 +0000 +++ b/main.cpp Thu Oct 15 07:53:35 2015 +0000 @@ -24,8 +24,7 @@ // **************************************************************************** // Server configuration /* Change this IP address to that of your NanoService Platform installation */ -//static const char* NSP_ADDRESS = "leshan.eclipse.org"; /* Eclipse leshan Server */ -static const char* NSP_ADDRESS = "192.168.200.14"; /* Eclipse leshan Server */ +static const char* NSP_ADDRESS = "leshan.eclipse.org"; /* Eclipse leshan Server */ static const int NSP_PORT = 5683; char endpoint_name[64] = "mbed-k64f-"; // wird ergaenzt um MAC Adresse uint8_t ep_type[] = {"mbed_device"};