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:
Sun Jun 15 02:00:39 2014 +0000
Parent:
7:01d01c5cf409
Child:
9:6501da9e384e
Commit message:
checkpoint; ; ticker based nsdl_update_registration not working, commented out

Changed in this revision

nsdl_support.cpp Show annotated file Show diff for this revision Revisions of this file
nsdl_support.h Show annotated file Show diff for this revision Revisions of this file
--- a/nsdl_support.cpp	Sat Jun 14 09:42:20 2014 +0000
+++ b/nsdl_support.cpp	Sun Jun 15 02:00:39 2014 +0000
@@ -16,6 +16,9 @@
 extern char endpoint_name[24];
 extern uint8_t ep_type[];
 extern uint8_t lifetime_ptr[];
+char null_ep_name[] = "";
+uint8_t null_ep_type[] = "";
+uint8_t null_lifetime_ptr[] = "";
 
 /* The number of seconds between NSP registration messages */
 #define RD_UPDATE_PERIOD  60
@@ -139,24 +142,27 @@
     set_NSP_address(nsp_addr, 5683, SN_NSDL_ADDRESS_TYPE_IPV4);
 }
 
-Ticker regUpdate;
-sn_nsdl_ep_parameters_s *endpoint_ptr = NULL;
-
-void regUpdateHandler()
+void nsdl_reg_update()
     {
-    endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t*)endpoint_name, ep_type, lifetime_ptr);
-    if(sn_nsdl_register_endpoint(endpoint_ptr) != 0)
+    sn_nsdl_ep_parameters_s *endpoint_ptr = NULL;
+//    endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t*)endpoint_name, ep_type, lifetime_ptr);
+//    if(sn_nsdl_register_endpoint(endpoint_ptr) != 0)
+//  reg update should be invoked with null parameters if nothing is changing
+    endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t*)null_ep_name, null_ep_type, null_lifetime_ptr);
+    if(sn_nsdl_update_registration(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);
     }
+    
+Ticker regUpdateTicker;
 
 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);
+//    regUpdateTicker.attach(&nsdl_reg_update, RD_UPDATE_PERIOD);
 
     sn_nsdl_addr_s received_packet_address;
     uint8_t received_address[4];
--- a/nsdl_support.h	Sat Jun 14 09:42:20 2014 +0000
+++ b/nsdl_support.h	Sun Jun 15 02:00:39 2014 +0000
@@ -21,5 +21,6 @@
 void nsdl_init();
 void nsdl_event_loop();
 void nsdl_run();
+void nsdl_reg_update();
 
 #endif // NSDL_SUPPORT_H