Lightly modified version of the BLE stack, that doesn't bring up a DFUService by default... as we have our own.

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Thu Apr 30 08:37:21 2015 +0100
Parent:
341:8a104d9d80c1
Child:
343:4d2576324b62
Commit message:
Synchronized with git rev 35e1e8b8
Author: Rohit Grover
Release 0.3.3
=============

Enhancements
~~~~~~~~~~~~

* Changes needed to support v8 of the Nordic SDK.

Bugfixes
~~~~~~~~

none.

Changed in this revision

public/BLEDevice.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
public/GattServer.h Show annotated file Show diff for this revision Revisions of this file
--- a/public/BLEDevice.h	Wed Apr 15 09:05:11 2015 +0100
+++ b/public/BLEDevice.h	Thu Apr 30 08:37:21 2015 +0100
@@ -336,12 +336,20 @@
      *     output: Total length of attribute value upon successful return.
      */
     ble_error_t readCharacteristicValue(GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP);
+    /**
+     * A version of the same as above with connection handle parameter to allow fetches for connection-specific multivalued attribtues (such as the CCCDs).
+     */
+    ble_error_t readCharacteristicValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP);
 
     /**
      * @param  localOnly
      *         Only update the characteristic locally regardless of notify/indicate flags in the CCCD.
      */
     ble_error_t updateCharacteristicValue(GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly = false);
+    /**
+     * A version of the same as above with connection handle parameter to allow updates for connection-specific multivalued attribtues (such as the CCCDs).
+     */
+    ble_error_t updateCharacteristicValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly = false);
 
     /**
      * Yield control to the BLE stack or to other tasks waiting for events. This
@@ -691,12 +699,23 @@
     return transport->getGattServer().readValue(attributeHandle, buffer, lengthP);
 }
 
+inline ble_error_t BLEDevice::readCharacteristicValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP)
+{
+    return transport->getGattServer().readValue(connectionHandle, attributeHandle, buffer, lengthP);
+}
+
 inline ble_error_t
 BLEDevice::updateCharacteristicValue(GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly)
 {
     return transport->getGattServer().updateValue(attributeHandle, const_cast<uint8_t *>(value), size, localOnly);
 }
 
+inline ble_error_t
+BLEDevice::updateCharacteristicValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly)
+{
+    return transport->getGattServer().updateValue(connectionHandle, attributeHandle, const_cast<uint8_t *>(value), size, localOnly);
+}
+
 inline void
 BLEDevice::waitForEvent(void)
 {
--- a/public/Gap.h	Wed Apr 15 09:05:11 2015 +0100
+++ b/public/Gap.h	Thu Apr 30 08:37:21 2015 +0100
@@ -77,7 +77,10 @@
     }
 
     typedef void (*EventCallback_t)(void);
-    typedef void (*ConnectionEventCallback_t)(Handle_t, addr_type_t peerAddrType, const address_t peerAddr, const ConnectionParams_t *);
+    typedef void (*ConnectionEventCallback_t)(Handle_t,
+                                              addr_type_t peerAddrType, const address_t peerAddr,
+                                              addr_type_t ownAddrType,  const address_t ownAddr,
+                                              const ConnectionParams_t *);
     typedef void (*DisconnectionEventCallback_t)(Handle_t, DisconnectionReason_t);
     typedef void (*RadioNotificationEventCallback_t) (bool radio_active); /* gets passed true for ACTIVE; false for INACTIVE. */
 
@@ -148,10 +151,10 @@
     }
 
 public:
-    void processConnectionEvent(Handle_t handle, addr_type_t type, const address_t addr, const ConnectionParams_t *params) {
+    void processConnectionEvent(Handle_t handle, addr_type_t peerAddrType, const address_t peerAddr, addr_type_t ownAddrType, const address_t ownAddr, const ConnectionParams_t *params) {
         state.connected = 1;
         if (onConnection) {
-            onConnection(handle, type, addr, params);
+            onConnection(handle, peerAddrType, peerAddr, ownAddrType, ownAddr, params);
         }
     }
 
--- a/public/GattServer.h	Wed Apr 15 09:05:11 2015 +0100
+++ b/public/GattServer.h	Thu Apr 30 08:37:21 2015 +0100
@@ -48,7 +48,9 @@
     /* These functions must be defined in the sub-class */
     virtual ble_error_t addService(GattService &)                                                               = 0;
     virtual ble_error_t readValue(GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) = 0;
+    virtual ble_error_t readValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) = 0;
     virtual ble_error_t updateValue(GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly = false) = 0;
+    virtual ble_error_t updateValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly = false) = 0;
     virtual ble_error_t initializeGATTDatabase(void)                                                            = 0;
 
     // ToDo: For updateValue, check the CCCD to see if the value we are