Demo starter application to connect WiGo to NSP and expose on-board sensors
Dependencies: NVIC_set_all_priorities cc3000_hostdriver_mbedsocket mbed nsdl_lib TEMT6200 TSI Wi-Go_eCompass_Lib_V3 WiGo_BattCharger
This is the mbed project for the IoT World Hackathon event, June 17th and 18th in Palo Also.
The setup instructions for participants are at the Setup page of this wiki:
Diff: nsdl_support.cpp
- Revision:
- 18:11b9d98ecae2
- Parent:
- 16:d6812604cf92
--- 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; }