High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Revision:
64:95529f47b782
Parent:
63:653378e782ea
Child:
72:bd485a3b18c5
--- a/hw/BLEDevice.h	Wed Jun 04 09:36:31 2014 +0100
+++ b/hw/BLEDevice.h	Wed Jun 04 10:06:19 2014 +0100
@@ -129,10 +129,18 @@
 
     ble_error_t disconnect(void);
 
+    /* APIs to set GAP callbacks. */
     void onTimeout(Gap::EventCallback_t       timeoutCallback);
     void onConnection(Gap::EventCallback_t    connectionCallback);
     void onDisconnection(Gap::EventCallback_t disconnectionCallback);
 
+    /* APIs to set GATT server callbacks */
+    void onDataSent(GattServer::EventCallback_t callback);
+    void onDataWritten(GattServer::EventCallback_t callback);
+    void onUpdatesEnabled(GattServer::EventCallback_t callback);
+    void onUpdatesDisabled(GattServer::EventCallback_t callback);
+    void onConfirmationReceived(GattServer::EventCallback_t callback);
+
 private:
     /**
      * Internal helper to udpate the transport backend with advertising data
@@ -283,6 +291,46 @@
     return transport->getGap().setAdvertisingData(advPayload, scanResponse);
 }
 
+inline void
+BLEDevice::onTimeout(Gap::EventCallback_t timeoutCallback) {
+    transport->getGap().setOnTimeout(timeoutCallback);
+}
+
+inline void
+BLEDevice::onConnection(Gap::EventCallback_t connectionCallback) {
+    transport->getGap().setOnConnection(connectionCallback);
+}
+
+inline void
+BLEDevice::onDisconnection(Gap::EventCallback_t disconnectionCallback) {
+    transport->getGap().setOnDisconnection(disconnectionCallback);
+}
+
+inline void
+BLEDevice::onDataSent(GattServer::EventCallback_t callback) {
+    transport->getGattServer().setOnDataSent(callback);
+}
+
+inline void
+BLEDevice::onDataWritten(GattServer::EventCallback_t callback) {
+    transport->getGattServer().setOnDataWritten(callback);
+}
+
+inline void
+BLEDevice::onUpdatesEnabled(GattServer::EventCallback_t callback) {
+    transport->getGattServer().setOnUpdatesEnabled(callback);
+}
+
+inline void
+BLEDevice::onUpdatesDisabled(GattServer::EventCallback_t callback) {
+    transport->getGattServer().setOnUpdatesDisabled(callback);
+}
+
+inline void
+BLEDevice::onConfirmationReceived(GattServer::EventCallback_t callback) {
+    transport->getGattServer().setOnConfirmationReceived(callback);
+}
+
 /*
  * ALL OF THE FOLLOWING METHODS ARE DEPRECATED
  */
@@ -304,20 +352,4 @@
     return transport->getGap().startAdvertising(_advParams);
 }
 
-inline void
-BLEDevice::onTimeout(Gap::EventCallback_t timeoutCallback) {
-    transport->getGap().setOnTimeout(timeoutCallback);
-}
-
-inline void
-BLEDevice::onConnection(Gap::EventCallback_t connectionCallback) {
-    transport->getGap().setOnConnection(connectionCallback);
-}
-
-inline void
-BLEDevice::onDisconnection(Gap::EventCallback_t disconnectionCallback) {
-    transport->getGap().setOnDisconnection(disconnectionCallback);
-}
-
-
 #endif // ifndef __BLE_DEVICE_H__