High level Bluetooth Low Energy API and radio abstraction layer

Dependencies:   nRF51822

Dependents:   LinkNode_LIS3DH

Fork of BLE_API by Bluetooth Low Energy

Revision:
609:af4de765f47c
Parent:
608:700a809b0832
Child:
625:3882ae21df26
--- a/public/UUID.h	Fri Jun 19 15:52:53 2015 +0100
+++ b/public/UUID.h	Fri Jun 19 15:52:54 2015 +0100
@@ -43,8 +43,7 @@
      *          The 128-bit (16-byte) UUID value, MSB first (big-endian).
      */
     UUID(const LongUUIDBytes_t longUUID) : type(UUID_TYPE_LONG), baseUUID(), shortUUID(0) {
-        memcpy(baseUUID, longUUID, LENGTH_OF_LONG_UUID);
-        shortUUID = (uint16_t)((longUUID[2] << 8) | (longUUID[3]));
+        setupLong(longUUID);
     }
 
     /**
@@ -87,6 +86,15 @@
         /* empty */
     }
 
+    /**
+     * Fill in a 128-bit UUID; this is useful when UUID isn't known at the time of object construction.
+     */
+    void setupLong(const LongUUIDBytes_t longUUID) {
+        type      = UUID_TYPE_LONG;
+        memcpy(baseUUID, longUUID, LENGTH_OF_LONG_UUID);
+        shortUUID = (uint16_t)((longUUID[2] << 8) | (longUUID[3]));
+    }
+
 public:
     UUID_Type_t       shortOrLong(void)  const {return type;     }
     const uint8_t    *getBaseUUID(void)  const {