MBED_DEMOS / Mbed 2 deprecated IoT_World_Hackathon_WiGo_NSP_Demo

Dependencies:   NVIC_set_all_priorities cc3000_hostdriver_mbedsocket mbed nsdl_lib TEMT6200 TSI Wi-Go_eCompass_Lib_V3 WiGo_BattCharger

Files at this revision

API Documentation at this revision

Comitter:
michaeljkoster
Date:
Wed Jul 09 04:35:49 2014 +0000
Parent:
17:b4cdafc4241d
Commit message:
Checkpoint

Changed in this revision

nsdl_run.cpp Show annotated file Show diff for this revision Revisions of this file
nsdl_support.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r b4cdafc4241d -r 11b9d98ecae2 nsdl_run.cpp
--- a/nsdl_run.cpp	Wed Jun 18 16:20:06 2014 +0000
+++ b/nsdl_run.cpp	Wed Jul 09 04:35:49 2014 +0000
@@ -28,9 +28,12 @@
 // NSP configuration
 /* Change this IP address to that of your NanoService Platform installation */
 static const char* NSP_ADDRESS = "192.168.1.220"; /* Arndale board running NSP on local network for Hackathon */ 
+//static const char* NSP_ADDRESS = "198.41.30.241"; /* Eclipse LWM2M sandbox */ 
 //static const char* NSP_ADDRESS = "217.140.101.20"; /* public mbed demo server */ 
 static const int NSP_PORT = 5683;
+//static const int NSP_PORT = 5684; /* lwm2m sandbox port */
 char endpoint_name[24] = "mbed-";
+//char endpoint_name[24] = "urn:mac:";
 uint8_t ep_type[] = {"mbed_device"};
 uint8_t lifetime_ptr[] = {"120000"}; //30+ hours 
 
diff -r b4cdafc4241d -r 11b9d98ecae2 nsdl_support.cpp
--- a/nsdl_support.cpp	Wed Jun 18 16:20:06 2014 +0000
+++ b/nsdl_support.cpp	Wed Jul 09 04:35:49 2014 +0000
@@ -37,16 +37,16 @@
 void *nsdl_alloc(uint16_t size)
 {
     void *buf = malloc(size);
-    printf("alloc\r\n");
-    MEM_VALID(0);
+//    printf("alloc\r\n");
+//    MEM_VALID(0);
     return buf;
 }
 
 void nsdl_free(void* ptr_to_free)
 {
     free(ptr_to_free);
-    printf("de-alloc\r\n");
-    MEM_VALID(0);
+//    printf("de-alloc\r\n");
+//    MEM_VALID(0);
 }
 
 /*
@@ -122,6 +122,21 @@
 static uint8_t rx_cb(sn_coap_hdr_s *coap_packet_ptr, sn_nsdl_addr_s *address_ptr)
 {
     pc.printf("RX callback!\r\n");
+    pc.printf("msg_code: %d \r\n", coap_packet_ptr->msg_code);
+    pc.printf("Payload length: %d bytes\r\n", coap_packet_ptr->payload_len);
+    int i;
+    pc.printf("Payload:'");
+    for (i=0; i < coap_packet_ptr->payload_len; i++)
+        pc.printf("%c", *(coap_packet_ptr->payload_ptr + i));
+    pc.printf("' \r\n");
+    if (coap_packet_ptr->options_list_ptr && coap_packet_ptr->options_list_ptr->location_path_ptr)
+    {
+        pc.printf("Location: /");
+        int i;
+        for (i=0; i < coap_packet_ptr->options_list_ptr->location_path_len; i++) pc.printf("%c", (char)(coap_packet_ptr->options_list_ptr->location_path_ptr[i]));
+        pc.printf(" \r\n");
+    }
+    //sn_coap_packet_debug(coap_packet_ptr);
     return 0;
 }