Doug Anson / mbedEndpointNetwork_BLE

Dependencies:   libnsdl_m0 BLE_API Base64 nRF51822 SplitterAssembler

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Sat Apr 11 18:14:49 2015 +0000
Parent:
21:828ca4f1da3d
Child:
23:9aeda6113295
Commit message:
updates for reregistration

Changed in this revision

NSDL/nsdl_support.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/NSDL/nsdl_support.cpp	Fri Apr 10 21:59:38 2015 +0000
+++ b/NSDL/nsdl_support.cpp	Sat Apr 11 18:14:49 2015 +0000
@@ -126,19 +126,17 @@
             endpoint_registered = false;
         }
         else {
-            DBG("NSP initial registration OK\r\n");
+            //DBG("NSP initial registration OK\r\n");
             endpoint_registered = true;
         }
     }
     else {
-        if (endpoint_registered) {
-            endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t *)null_domain, (uint8_t*)null_endpoint_name, null_ep_type, null_lifetime_ptr);
-            if(sn_nsdl_update_registration(endpoint_ptr) != 0) {
-                DBG("NSP re-registration failed\r\n");
-            }
-            else {
-                //DBG("NSP re-registration OK\r\n");
-            }
+        endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t *)null_domain, (uint8_t*)null_endpoint_name, null_ep_type, null_lifetime_ptr);
+        if(sn_nsdl_update_registration(endpoint_ptr) != 0) {
+            DBG("NSP re-registration failed\r\n");
+        }
+        else {
+            //DBG("NSP re-registration OK\r\n");
         }
     }
     nsdl_clean_register_endpoint(&endpoint_ptr);
@@ -150,12 +148,7 @@
 
 // Simple Ticker-based re-registration updating... 
 void registration_update_tick(void) {
-    extern bool __registered;
-    if (__registered) { 
-        //DBG("NSP: (re)registering...\r\n");
-        register_endpoint(false);
-        //DBG("NSP: (re)registering complete.\r\n");
-    }
+    register_endpoint(!endpoint_registered);
 }
 
 void nsdl_init() {    
@@ -199,7 +192,7 @@
             
     // re-registration update ticker...
     Ticker ticker;
-    ticker.attach(registration_update_tick,30); // every 30 seconds...
+    ticker.attach(registration_update_tick,NSP_REREGISTER_TIME);
     
     // FOREVER: main loop for event processing  
     while(true) {