High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Revision:
14:6ea5d1012a64
Parent:
9:124ae067ae27
Child:
18:86fe1e247a54
diff -r a585c98b6abc -r 6ea5d1012a64 GapAdvertisingParams.cpp
--- a/GapAdvertisingParams.cpp	Wed Dec 18 06:22:35 2013 +0000
+++ b/GapAdvertisingParams.cpp	Wed Dec 18 11:52:37 2013 +0000
@@ -35,8 +35,10 @@
                 connection modes
 
     @param[in]  interval
-                Advertising interval between 0x20 and 0x4000 (32 and 16384)
-                in 0.625ms intervals (20ms to 10.24s).
+                Advertising interval between 0x0020 and 0x4000 in 0.625ms
+                units (20ms to 10.24s).  If using non-connectable mode
+                (\ref ADV_NON_CONNECTABLE_UNDIRECTED) this min value is
+                0x00A0 (100ms).
 
                 @para
                 Increasing this value will allow central devices to detect
@@ -45,7 +47,10 @@
                 
                 @note This field must be set to 0 if connectionMode is equal
                 to \ref ADV_CONNECTABLE_DIRECTED
-
+                
+                @note See Bluetooth Core Specification, Vol 3., Part C,
+                Appendix A for suggested advertising intervals:
+                
     @param[in]  timeout
                 Advertising timeout between 0x1 and 0x3FFF (1 and 16383)
                 in seconds.  Enter 0 to disable the advertising timeout.
@@ -69,6 +74,18 @@
         /* Interval must be 0 in directed connectable mode */
         _interval = 0;
     }
+    else if (_advType == ADV_NON_CONNECTABLE_UNDIRECTED)
+    {
+        /* Min interval is slightly larger than in other modes */
+        if (_interval < GAP_ADV_PARAMS_INTERVAL_MIN_NONCON)
+        {
+            _interval = GAP_ADV_PARAMS_INTERVAL_MIN_NONCON;
+        }
+        if (_interval > GAP_ADV_PARAMS_INTERVAL_MAX)
+        {
+            _interval = GAP_ADV_PARAMS_INTERVAL_MAX;
+        }
+    }
     else
     {
         /* Stay within interval limits */