CoAP messages on W5500 used as a NetworkStack. Built for NUCLEO-L476RG that has no built-in networking.

Dependencies:   NetworkServices W5500Interface easy-connect

Fork of coap-example by sandbox

Revision:
1:b56863927244
Parent:
0:0681e205d0e9
--- a/source/main.cpp	Wed Feb 15 21:18:58 2017 +0100
+++ b/source/main.cpp	Thu Jul 06 06:58:22 2017 +0000
@@ -18,7 +18,6 @@
 #include <string>
 #include "mbed.h"
 #include "easy-connect.h"
-#include "sn_nsdl.h"
 #include "sn_coap_protocol.h"
 #include "sn_coap_header.h"
 
@@ -79,6 +78,7 @@
 }
 
 int main() {
+    printf("Easy connect...\n");
     NetworkInterface *network = easy_connect(true);
     if (!network) {
         printf("Cannot connect to the network, see serial output");
@@ -97,7 +97,7 @@
     recvfromThread.start(&recvfromMain);
 
     // Path to the resource we want to retrieve
-    const char* coap_uri_path = "/hello";
+    const char* coap_uri_path = "/test";
 
     // See ns_coap_header.h
     sn_coap_hdr_s *coap_res_ptr = (sn_coap_hdr_s*)calloc(sizeof(sn_coap_hdr_s), 1);
@@ -126,8 +126,8 @@
     // }
     // printf("\n");
 
-    int scount = socket.sendto("coap.me", 5683, message_ptr, message_len);
-    printf("Sent %d bytes to coap://coap.me:5683\n", scount);
+    int scount = socket.sendto("i-ce.itron.cloud", 5683, message_ptr, message_len);
+    printf("Sent %d bytes to coap://i-ce.itron.cloud:5683\n", scount);
 
     free(coap_res_ptr);
     free(message_ptr);