Microbug / BLE_API

Fork of BLE_API by Bluetooth Low Energy

Revision:
78:5d356ef94347
Parent:
77:1436ecf09583
Child:
79:b6284f5928bb
--- a/hw/BLEDevice.h	Mon Jun 09 08:34:47 2014 +0100
+++ b/hw/BLEDevice.h	Tue Jun 10 08:55:33 2014 +0100
@@ -144,6 +144,11 @@
     Gap::GapState_t getGapState(void) const;
     ble_error_t     updateCharacteristicValue(uint16_t handle, const uint8_t* value, uint16_t size, bool localOnly = false);
 
+    /**
+     * Yield control to the BLE stack or to other tasks waiting for events.
+     */
+    void waitForEvent(void);
+
 private:
     /**
      * Internal helper to udpate the transport backend with advertising data
@@ -187,10 +192,11 @@
 class BLEDeviceInstanceBase
 {
 public:
-    virtual Gap&        getGap()        = 0;
-    virtual GattServer& getGattServer() = 0;
-    virtual ble_error_t init(void)      = 0;
-    virtual ble_error_t reset(void)     = 0;
+    virtual Gap&        getGap()           = 0;
+    virtual GattServer& getGattServer()    = 0;
+    virtual ble_error_t init(void)         = 0;
+    virtual ble_error_t reset(void)        = 0;
+    virtual void        waitForEvent(void) = 0;
 };
 
 
@@ -371,6 +377,12 @@
     return transport->getGattServer().updateValue(handle, const_cast<uint8_t *>(value), size, localOnly);
 }
 
+inline void
+BLEDevice::waitForEvent(void)
+{
+    transport->waitForEvent();
+}
+
 /*
  * ALL OF THE FOLLOWING METHODS ARE DEPRECATED
  */