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:51:58 2015 +0100
Parent:
457:6ebc9bbde90b
Child:
459:a83b41d87755
Commit message:
Synchronized with git rev 081ceb5c
Author: Rohit Grover
Move certain UUID related declarations within the UUID namespace.

Changed in this revision

public/ServiceDiscovery.h Show annotated file Show diff for this revision Revisions of this file
public/UUID.h Show annotated file Show diff for this revision Revisions of this file
services/UARTService.cpp Show annotated file Show diff for this revision Revisions of this file
services/UARTService.h Show annotated file Show diff for this revision Revisions of this file
--- a/public/ServiceDiscovery.h	Fri Jun 19 15:51:58 2015 +0100
+++ b/public/ServiceDiscovery.h	Fri Jun 19 15:51:58 2015 +0100
@@ -28,14 +28,14 @@
      */
     class DiscoveredService {
     public:
-        void setup(ShortUUIDBytes_t uuidIn, GattAttribute::Handle_t startHandleIn, GattAttribute::Handle_t endHandleIn) {
+        void setup(UUID::ShortUUIDBytes_t uuidIn, GattAttribute::Handle_t startHandleIn, GattAttribute::Handle_t endHandleIn) {
             uuid        = uuidIn;
             startHandle = startHandleIn;
             endHandle   = endHandleIn;
         }
 
     public:
-        const ShortUUIDBytes_t& getShortUUID(void) const {
+        const UUID::ShortUUIDBytes_t& getShortUUID(void) const {
             return uuid;
         }
 
@@ -55,7 +55,7 @@
         DiscoveredService(const DiscoveredService &);
 
     private:
-        ShortUUIDBytes_t        uuid;        /**< UUID of the service.  */
+        UUID::ShortUUIDBytes_t  uuid;        /**< UUID of the service.  */
         GattAttribute::Handle_t startHandle; /**< Service Handle Range. */
         GattAttribute::Handle_t endHandle;   /**< Service Handle Range. */
     };
@@ -98,7 +98,7 @@
             uint8_t auth_signed_wr :1; /**< Writing the value with Signed Write Command permitted. */
         };
 
-        void setup(ShortUUIDBytes_t uuidIn, Properties_t propsIn, GattAttribute::Handle_t declHandleIn, GattAttribute::Handle_t valueHandleIn) {
+        void setup(UUID::ShortUUIDBytes_t uuidIn, Properties_t propsIn, GattAttribute::Handle_t declHandleIn, GattAttribute::Handle_t valueHandleIn) {
             uuid        = uuidIn;
             props       = propsIn;
             declHandle  = declHandleIn;
@@ -106,7 +106,7 @@
         }
 
     public:
-        const ShortUUIDBytes_t& getShortUUID(void) const {
+        const UUID::ShortUUIDBytes_t& getShortUUID(void) const {
             return uuid;
         }
 
@@ -127,7 +127,7 @@
         }
 
     private:
-        ShortUUIDBytes_t        uuid;
+        UUID::ShortUUIDBytes_t  uuid;
         Properties_t            props;
         GattAttribute::Handle_t declHandle;
         GattAttribute::Handle_t valueHandle;
@@ -142,8 +142,8 @@
     static ble_error_t launch(Gap::Handle_t             connectionHandle,
                               ServiceCallback_t         sc = NULL,
                               CharacteristicCallback_t  cc = NULL,
-                              const UUID               &matchingServiceUUID = ShortUUIDBytes_t(BLE_UUID_UNKNOWN),
-                              const UUID               &matchingCharacteristicUUIDIn = ShortUUIDBytes_t(BLE_UUID_UNKNOWN));
+                              const UUID               &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN),
+                              const UUID               &matchingCharacteristicUUIDIn = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN));
 
     static void        terminate(void);
 
--- a/public/UUID.h	Fri Jun 19 15:51:58 2015 +0100
+++ b/public/UUID.h	Fri Jun 19 15:51:58 2015 +0100
@@ -21,10 +21,6 @@
 
 #include "blecommon.h"
 
-const unsigned   LENGTH_OF_LONG_UUID = 16;
-typedef uint16_t ShortUUIDBytes_t;
-typedef uint8_t  LongUUIDBytes_t[LENGTH_OF_LONG_UUID];
-
 class UUID {
 public:
     enum UUID_Type_t {
@@ -32,6 +28,10 @@
         UUID_TYPE_LONG  = 1     // Full 128-bit UUID
     };
 
+    static const unsigned LENGTH_OF_LONG_UUID = 16;
+    typedef uint16_t ShortUUIDBytes_t;
+    typedef uint8_t  LongUUIDBytes_t[LENGTH_OF_LONG_UUID];
+
 public:
     /**
      * Creates a new 128-bit UUID
--- a/services/UARTService.cpp	Fri Jun 19 15:51:58 2015 +0100
+++ b/services/UARTService.cpp	Fri Jun 19 15:51:58 2015 +0100
@@ -16,26 +16,26 @@
 
 #include "UARTService.h"
 
-const uint8_t  UARTServiceBaseUUID[LENGTH_OF_LONG_UUID] = {
+const uint8_t  UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID] = {
     0x6E, 0x40, 0x00, 0x00, 0xB5, 0xA3, 0xF3, 0x93,
     0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
 };
 const uint16_t UARTServiceShortUUID                 = 0x0001;
 const uint16_t UARTServiceTXCharacteristicShortUUID = 0x0002;
 const uint16_t UARTServiceRXCharacteristicShortUUID = 0x0003;
-const uint8_t  UARTServiceUUID[LENGTH_OF_LONG_UUID] = {
+const uint8_t  UARTServiceUUID[UUID::LENGTH_OF_LONG_UUID] = {
     0x6E, 0x40, (uint8_t)(UARTServiceShortUUID >> 8), (uint8_t)(UARTServiceShortUUID & 0xFF), 0xB5, 0xA3, 0xF3, 0x93,
     0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
 };
-const uint8_t  UARTServiceUUID_reversed[LENGTH_OF_LONG_UUID] = {
+const uint8_t  UARTServiceUUID_reversed[UUID::LENGTH_OF_LONG_UUID] = {
     0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0,
     0x93, 0xF3, 0xA3, 0xB5, (uint8_t)(UARTServiceShortUUID & 0xFF), (uint8_t)(UARTServiceShortUUID >> 8), 0x40, 0x6E
 };
-const uint8_t  UARTServiceTXCharacteristicUUID[LENGTH_OF_LONG_UUID] = {
+const uint8_t  UARTServiceTXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID] = {
     0x6E, 0x40, (uint8_t)(UARTServiceTXCharacteristicShortUUID >> 8), (uint8_t)(UARTServiceTXCharacteristicShortUUID & 0xFF), 0xB5, 0xA3, 0xF3, 0x93,
     0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
 };
-const uint8_t  UARTServiceRXCharacteristicUUID[LENGTH_OF_LONG_UUID] = {
+const uint8_t  UARTServiceRXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID] = {
     0x6E, 0x40, (uint8_t)(UARTServiceRXCharacteristicShortUUID >> 8), (uint8_t)(UARTServiceRXCharacteristicShortUUID & 0xFF), 0xB5, 0xA3, 0xF3, 0x93,
     0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
 };
\ No newline at end of file
--- a/services/UARTService.h	Fri Jun 19 15:51:58 2015 +0100
+++ b/services/UARTService.h	Fri Jun 19 15:51:58 2015 +0100
@@ -23,16 +23,16 @@
 #include "UUID.h"
 #include "BLEDevice.h"
 
-extern const uint8_t  UARTServiceBaseUUID[LENGTH_OF_LONG_UUID];
+extern const uint8_t  UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID];
 extern const uint16_t UARTServiceShortUUID;
 extern const uint16_t UARTServiceTXCharacteristicShortUUID;
 extern const uint16_t UARTServiceRXCharacteristicShortUUID;
 
-extern const uint8_t  UARTServiceUUID[LENGTH_OF_LONG_UUID];
-extern const uint8_t  UARTServiceUUID_reversed[LENGTH_OF_LONG_UUID];
+extern const uint8_t  UARTServiceUUID[UUID::LENGTH_OF_LONG_UUID];
+extern const uint8_t  UARTServiceUUID_reversed[UUID::LENGTH_OF_LONG_UUID];
 
-extern const uint8_t  UARTServiceTXCharacteristicUUID[LENGTH_OF_LONG_UUID];
-extern const uint8_t  UARTServiceRXCharacteristicUUID[LENGTH_OF_LONG_UUID];
+extern const uint8_t  UARTServiceTXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID];
+extern const uint8_t  UARTServiceRXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID];
 
 /**
 * @class UARTService