High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Fri Jun 19 15:53:03 2015 +0100
Parent:
687:85b0a8f457a1
Child:
689:08b9c561c62f
Commit message:
Synchronized with git rev db2de911
Author: Rohit Grover
handle Gap::onRadioNotification()

Changed in this revision

public/BLE.h Show annotated file Show diff for this revision Revisions of this file
public/Gap.h Show annotated file Show diff for this revision Revisions of this file
--- a/public/BLE.h	Fri Jun 19 15:53:03 2015 +0100
+++ b/public/BLE.h	Fri Jun 19 15:53:03 2015 +0100
@@ -1106,6 +1106,31 @@
     }
 
     /**
+     * Radio Notification is a feature that enables ACTIVE and INACTIVE
+     * (nACTIVE) signals from the stack that notify the application when the
+     * radio is in use. The signal is sent using software interrupt.
+     *
+     * The ACTIVE signal is sent before the Radio Event starts. The nACTIVE
+     * signal is sent at the end of the Radio Event. These signals can be used
+     * by the application programmer to synchronize application logic with radio
+     * activity. For example, the ACTIVE signal can be used to shut off external
+     * devices to manage peak current drawn during periods when the radio is on,
+     * or to trigger sensor data collection for transmission in the Radio Event.
+     *
+     * @param callback
+     *          The application handler to be invoked in response to a radio
+     *          ACTIVE/INACTIVE event.
+     *
+     * @note: This API is now *deprecated* and will be dropped in the future.
+     * You should use the parallel API from GattServer directly. A former call
+     * to ble.onRadioNotification(...) should be replaced with
+     * ble.gap().onRadioNotification(...).
+     */
+    void onRadioNotification(Gap::RadioNotificationEventCallback_t callback) {
+        gap().onRadioNotification(callback);
+    }
+
+    /**
      * Add a callback for the GATT event DATA_SENT (which is triggered when
      * updates are sent out by GATT in the form of notifications).
      *
@@ -1159,24 +1184,6 @@
     void onUpdatesDisabled(GattServer::EventCallback_t callback);
     void onConfirmationReceived(GattServer::EventCallback_t callback);
 
-    /**
-     * Radio Notification is a feature that enables ACTIVE and INACTIVE
-     * (nACTIVE) signals from the stack that notify the application when the
-     * radio is in use. The signal is sent using software interrupt.
-     *
-     * The ACTIVE signal is sent before the Radio Event starts. The nACTIVE
-     * signal is sent at the end of the Radio Event. These signals can be used
-     * by the application programmer to synchronize application logic with radio
-     * activity. For example, the ACTIVE signal can be used to shut off external
-     * devices to manage peak current drawn during periods when the radio is on,
-     * or to trigger sensor data collection for transmission in the Radio Event.
-     *
-     * @param callback
-     *          The application handler to be invoked in response to a radio
-     *          ACTIVE/INACTIVE event.
-     */
-    void onRadioNotification(Gap::RadioNotificationEventCallback_t callback);
-
 public:
     BLE() : transport(createBLEInstance()) {
         /* empty */
@@ -1240,12 +1247,6 @@
     transport->getGattServer().setOnConfirmationReceived(callback);
 }
 
-inline void
-BLE::onRadioNotification(Gap::RadioNotificationEventCallback_t callback)
-{
-    gap().setOnRadioNotification(callback);
-}
-
 inline ble_error_t
 BLE::initializeSecurity(bool                          enableBonding,
                         bool                          requireMITM,
--- a/public/Gap.h	Fri Jun 19 15:53:03 2015 +0100
+++ b/public/Gap.h	Fri Jun 19 15:53:03 2015 +0100
@@ -784,10 +784,23 @@
 
     /**
      * Set the application callback for radio-notification events.
+     *
+     * Radio Notification is a feature that enables ACTIVE and INACTIVE
+     * (nACTIVE) signals from the stack that notify the application when the
+     * radio is in use. The signal is sent using software interrupt.
+     *
+     * The ACTIVE signal is sent before the Radio Event starts. The nACTIVE
+     * signal is sent at the end of the Radio Event. These signals can be used
+     * by the application programmer to synchronize application logic with radio
+     * activity. For example, the ACTIVE signal can be used to shut off external
+     * devices to manage peak current drawn during periods when the radio is on,
+     * or to trigger sensor data collection for transmission in the Radio Event.
+     *
      * @param callback
-     *          Handler to be executed in response to a radio notification event.
+     *          The application handler to be invoked in response to a radio
+     *          ACTIVE/INACTIVE event.
      */
-    virtual void setOnRadioNotification(RadioNotificationEventCallback_t callback) {onRadioNotification = callback;}
+    virtual void onRadioNotification(RadioNotificationEventCallback_t callback) {radioNotificationCallback = callback;}
 
     /**
      * To indicate that security procedure for link has started.
@@ -828,7 +841,7 @@
         timeoutCallback(NULL),
         connectionCallback(NULL),
         disconnectionCallback(NULL),
-        onRadioNotification(),
+        radioNotificationCallback(),
         onSecuritySetupInitiated(),
         onSecuritySetupCompleted(),
         onLinkSecured(),
@@ -927,7 +940,7 @@
     TimeoutEventCallback_t           timeoutCallback;
     ConnectionEventCallback_t        connectionCallback;
     DisconnectionEventCallback_t     disconnectionCallback;
-    RadioNotificationEventCallback_t onRadioNotification;
+    RadioNotificationEventCallback_t radioNotificationCallback;
     SecuritySetupInitiatedCallback_t onSecuritySetupInitiated;
     SecuritySetupCompletedCallback_t onSecuritySetupCompleted;
     LinkSecuredCallback_t            onLinkSecured;