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:

http://mbed.org/teams/MBED_DEMOS/code/IoT_World_Hackathon_WiGo_NSP_Demo/wiki/Setup-Guide-for-the-IoT-World-Hackathon

Files at this revision

API Documentation at this revision

Comitter:
michaeljkoster
Date:
Sat Jun 14 09:42:20 2014 +0000
Parent:
6:b542b2a759e8
Child:
8:3926a80af3e0
Commit message:
ticker driven reg update + string buffer length fix in nsdl_support for 24

Changed in this revision

nsdl_support.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/nsdl_support.cpp	Sat Jun 14 08:34:18 2014 +0000
+++ b/nsdl_support.cpp	Sat Jun 14 09:42:20 2014 +0000
@@ -13,7 +13,7 @@
 extern cc3000 wifi;
 extern Endpoint nsp;
 extern UDPSocket server;
-extern char endpoint_name[16];
+extern char endpoint_name[24];
 extern uint8_t ep_type[];
 extern uint8_t lifetime_ptr[];
 
@@ -139,10 +139,24 @@
     set_NSP_address(nsp_addr, 5683, SN_NSDL_ADDRESS_TYPE_IPV4);
 }
 
+Ticker regUpdate;
+sn_nsdl_ep_parameters_s *endpoint_ptr = NULL;
+
+void regUpdateHandler()
+    {
+    endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t*)endpoint_name, ep_type, lifetime_ptr);
+    if(sn_nsdl_register_endpoint(endpoint_ptr) != 0)
+        pc.printf("NSP re-registering failed\r\n");
+    else
+        pc.printf("NSP re-registering OK\r\n");
+    nsdl_clean_register_endpoint(&endpoint_ptr);
+    }
+
 void nsdl_event_loop()
 {
 //    Thread registration_thread(registration_update_thread);
 //put re-registration in timeout loop instead of thread
+    regUpdate.attach(&regUpdateHandler, RD_UPDATE_PERIOD);
 
     sn_nsdl_addr_s received_packet_address;
     uint8_t received_address[4];