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:
Rohit Grover
Date:
Thu May 29 08:16:31 2014 +0100
Parent:
52:62b9d3b7a689
Child:
54:7014517e2d60
Commit message:
remove need for UUID::update()

Changed in this revision

GattService.cpp Show annotated file Show diff for this revision Revisions of this file
UUID.cpp Show annotated file Show diff for this revision Revisions of this file
UUID.h Show annotated file Show diff for this revision Revisions of this file
--- a/GattService.cpp	Wed May 28 17:24:30 2014 +0100
+++ b/GattService.cpp	Thu May 29 08:16:31 2014 +0100
@@ -36,11 +36,13 @@
     @endcode
 */
 /**************************************************************************/
-GattService::GattService(uint8_t base_uuid[16])
+GattService::GattService(uint8_t base_uuid[16]) :
+    primaryServiceID(base_uuid),
+    characteristicCount(0),
+    characteristics(),
+    handle(0)
 {
-    primaryServiceID.update(base_uuid);
-    characteristicCount = 0;
-    handle              = 0;
+    /* empty */
 }
 
 /**************************************************************************/
@@ -58,11 +60,12 @@
     @endcode
 */
 /**************************************************************************/
-GattService::GattService(uint16_t ble_uuid)
+GattService::GattService(uint16_t ble_uuid) :
+    primaryServiceID(ble_uuid),
+    characteristicCount(0),
+    characteristics(),
+    handle(0)
 {
-    primaryServiceID.update( ble_uuid );
-    characteristicCount = 0;
-    handle              = 0;
 }
 
 /**************************************************************************/
--- a/UUID.cpp	Wed May 28 17:24:30 2014 +0100
+++ b/UUID.cpp	Thu May 29 08:16:31 2014 +0100
@@ -121,70 +121,3 @@
 UUID::~UUID(void)
 {
 }
-
-/**************************************************************************/
-/*!
-    @brief  Updates the value of the UUID
-
-    @args[in]   uuid_base
-                The 128-bit value to use when updating the UUID.  For
-                16-bit IDs, insert the ID in bytes 2/3 in LSB format.
-
-    @returns    BLE_ERROR_NONE (0) if everything executed correctly, or an
-                error code if there was a problem
-    @retval     BLE_ERROR_NONE
-                Everything executed correctly
-
-    @section EXAMPLE
-
-    @code
-
-    @endcode
-*/
-/**************************************************************************/
-ble_error_t UUID::update(uint8_t const uuid_base[LENGTH_OF_LONG_UUID])
-{
-    memcpy(base, uuid_base, LENGTH_OF_LONG_UUID);
-    value = (uint16_t)((uuid_base[3] << 8) | (uuid_base[2]));
-
-    /* Check if this is a short of a long UUID */
-    if (uuid_base[0] + uuid_base[1] +
-        uuid_base[4] + uuid_base[5] + uuid_base[6] + uuid_base[7] +
-        uuid_base[8] + uuid_base[9] + uuid_base[10] + uuid_base[11] +
-        uuid_base[12] + uuid_base[13] + uuid_base[14] + uuid_base[15] == 0) {
-        type = UUID_TYPE_SHORT;
-    } else {
-        type = UUID_TYPE_LONG;
-    }
-
-    return BLE_ERROR_NONE;
-}
-
-/**************************************************************************/
-/*!
-    @brief  Updates the value of the UUID
-
-    @args[in]   ble_uuid
-                The 16-bit value to use when updating the UUID.
-
-    @returns    BLE_ERROR_NONE (0) if everything executed correctly, or an
-                error code if there was a problem
-    @retval     BLE_ERROR_NONE
-                Everything executed correctly
-
-    @section EXAMPLE
-
-    @code
-
-    @endcode
-*/
-/**************************************************************************/
-ble_error_t UUID::update(uint16_t const ble_uuid)
-{
-    memset(base, 0, LENGTH_OF_LONG_UUID);
-    memcpy(base + 2, (uint8_t *)&ble_uuid, 2);
-    value = ble_uuid;
-    type  = UUID_TYPE_SHORT;
-
-    return BLE_ERROR_NONE;
-}
--- a/UUID.h	Wed May 28 17:24:30 2014 +0100
+++ b/UUID.h	Thu May 29 08:16:31 2014 +0100
@@ -36,9 +36,6 @@
     UUID(uint16_t const);
     virtual ~UUID(void);
 
-    ble_error_t update(uint8_t const[LENGTH_OF_LONG_UUID]);
-    ble_error_t update(uint16_t const);
-
 public:
     uint8_t  type;         // UUID_TYPE_SHORT or UUID_TYPE_LONG
     uint8_t  base[LENGTH_OF_LONG_UUID];     // in case of custom