VNG board

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
rgrover1
Date:
Tue Dec 09 08:18:11 2014 +0000
Parent:
241:00f2410ad9cc
Child:
243:98f930d14515
Commit message:
Synchronized with git rev c7eb83db
Author: Rohit Grover
minor white space diffs and fixes for typos.

Changed in this revision

services/BatteryService.h Show annotated file Show diff for this revision Revisions of this file
services/DFUService.cpp Show annotated file Show diff for this revision Revisions of this file
services/DFUService.h Show annotated file Show diff for this revision Revisions of this file
services/DeviceInformationService.h Show annotated file Show diff for this revision Revisions of this file
services/HealthThermometerService.h Show annotated file Show diff for this revision Revisions of this file
services/HeartRateService.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
services/URIBeaconConfigService.h Show annotated file Show diff for this revision Revisions of this file
--- a/services/BatteryService.h	Tue Dec 09 07:41:43 2014 +0000
+++ b/services/BatteryService.h	Tue Dec 09 08:18:11 2014 +0000
@@ -19,11 +19,11 @@
 
 #include "BLEDevice.h"
 
-/** 
+/**
 * @class BatteryService
-* @breif BLE Battery Service. This service displays the battery level from 0%->100% represented as a 8bit number.<br> 
+* @brief BLE Battery Service. This service displays the battery level from 0%->100% represented as a 8bit number.<br>
 * Service:  https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml <br>
-* Battery Level Char:  https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.battery_level.xml 
+* Battery Level Char:  https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.battery_level.xml
 */
 class BatteryService {
 public:
@@ -31,7 +31,7 @@
     * @param[ref] _ble
     *               BLEDevice object for the underlying controller.
     * @param[in] level
-    *               8bit batterly level. Usually used to represent percentage of batterly charge remaining. 
+    *               8bit batterly level. Usually used to represent percentage of batterly charge remaining.
     */
     BatteryService(BLEDevice &_ble, uint8_t level = 100) :
         ble(_ble),
@@ -52,10 +52,10 @@
     }
 
     /**
-     * @breif Update the battery level with a new value. Valid values range from
+     * @brief Update the battery level with a new value. Valid values range from
      * 0..100. Anything outside this range will be ignored.
-     * 
-     * @param newLevel 
+     *
+     * @param newLevel
      *              update to battery level.
      */
     void updateBatteryLevel(uint8_t newLevel) {
@@ -64,9 +64,9 @@
     }
 
 private:
-    BLEDevice           &ble;
-    uint8_t              batteryLevel;
-    GattCharacteristic   batteryLevelCharacteristic;
+    BLEDevice          &ble;
+    uint8_t             batteryLevel;
+    GattCharacteristic  batteryLevelCharacteristic;
 };
 
-#endif /* #ifndef __BLE_BATTERY_SERVICE_H__*/
+#endif /* #ifndef __BLE_BATTERY_SERVICE_H__*/
\ No newline at end of file
--- a/services/DFUService.cpp	Tue Dec 09 07:41:43 2014 +0000
+++ b/services/DFUService.cpp	Tue Dec 09 08:18:11 2014 +0000
@@ -16,25 +16,25 @@
 
 #include "DFUService.h"
 
-const uint8_t DFUServiceBaseUUID[] = {
+const uint8_t              DFUServiceBaseUUID[] = {
     0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0xEF, 0xDE,
     0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23,
 };
-const uint16_t DFUServiceShortUUID                      = 0x1530;
-const uint16_t DFUServiceControlCharacteristicShortUUID = 0x1531;
-const uint16_t DFUServicePacketCharacteristicShortUUID  = 0x1532;
+const uint16_t             DFUServiceShortUUID                      = 0x1530;
+const uint16_t             DFUServiceControlCharacteristicShortUUID = 0x1531;
+const uint16_t             DFUServicePacketCharacteristicShortUUID  = 0x1532;
 
-const uint8_t DFUServiceUUID[] = {
+const uint8_t              DFUServiceUUID[] = {
     0x00, 0x00, (uint8_t)(DFUServiceShortUUID >> 8), (uint8_t)(DFUServiceShortUUID & 0xFF), 0x12, 0x12, 0xEF, 0xDE,
     0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23,
 };
-const uint8_t DFUServiceControlCharacteristicUUID[] = {
+const uint8_t              DFUServiceControlCharacteristicUUID[] = {
     0x00, 0x00, (uint8_t)(DFUServiceControlCharacteristicShortUUID >> 8), (uint8_t)(DFUServiceControlCharacteristicShortUUID & 0xFF), 0x12, 0x12, 0xEF, 0xDE,
     0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23,
 };
-const uint8_t DFUServicePacketCharacteristicUUID[] = {
+const uint8_t              DFUServicePacketCharacteristicUUID[] = {
     0x00, 0x00, (uint8_t)(DFUServicePacketCharacteristicShortUUID >> 8), (uint8_t)(DFUServicePacketCharacteristicShortUUID & 0xFF), 0x12, 0x12, 0xEF, 0xDE,
     0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23,
 };
 
-DFUService::ResetPrepare_t DFUService::handoverCallback = NULL;
+DFUService::ResetPrepare_t DFUService::handoverCallback = NULL;
\ No newline at end of file
--- a/services/DFUService.h	Tue Dec 09 07:41:43 2014 +0000
+++ b/services/DFUService.h	Tue Dec 09 08:18:11 2014 +0000
@@ -32,12 +32,12 @@
 
 /**
 * @class DFUService
-* @breif Device Firmware Update Service. 
+* @brief Device Firmware Update Service.
 */
 class DFUService {
 public:
     /**
-     * @breif Signature for the handover callback. The application may provide such a
+     * @brief Signature for the handover callback. The application may provide such a
      * callback when setting up the DFU service, in which case it will be
      * invoked before handing control over to the bootloader.
      */
@@ -45,7 +45,7 @@
 
 public:
     /**
-    * @breif Adds Device Firmware Update service to an existing ble object. 
+    * @brief Adds Device Firmware Update service to an existing ble object.
     *
     * @param[ref] _ble
     *               BLEDevice object for the underlying controller.
@@ -75,26 +75,26 @@
 
         ble.addService(dfuService);
         handoverCallback = _handoverCallback;
-        serviceAdded = true;
+        serviceAdded     = true;
 
         ble.onDataWritten(this, &DFUService::onDataWritten);
     }
 
     /**
-    * @breif 
-    * @return 
+    * @brief
+    * @return
     */
     uint16_t getControlHandle(void) {
         return controlPoint.getValueAttribute().getHandle();
     }
 
     /**
-     * @breif This callback allows the DFU service to receive the initial trigger to
+     * @brief This callback allows the DFU service to receive the initial trigger to
      * handover control to the bootloader; but first the application is given a
      * chance to clean up.
      *
      * @param[in]
-     *              
+     *
      */
     virtual void onDataWritten(const GattCharacteristicWriteCBParams *params) {
         if (params->charHandle == controlPoint.getValueAttribute().getHandle()) {
@@ -131,4 +131,4 @@
     GattCharacteristic  packet;
 };
 
-#endif /* #ifndef __BLE_DFU_SERVICE_H__*/
+#endif /* #ifndef __BLE_DFU_SERVICE_H__*/
\ No newline at end of file
--- a/services/DeviceInformationService.h	Tue Dec 09 07:41:43 2014 +0000
+++ b/services/DeviceInformationService.h	Tue Dec 09 08:18:11 2014 +0000
@@ -21,14 +21,14 @@
 
 /**
 * @class DeviceInformationService
-* @breif BLE Device Information Service <br>
+* @brief BLE Device Information Service <br>
 * Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.device_information.xml <br>
-* Manufacturer Name String Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.manufacturer_name_string.xml 
+* Manufacturer Name String Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.manufacturer_name_string.xml
 */
 class DeviceInformationService {
 public:
     /**
-     * @breif Device Information Service Constructor. 
+     * @brief Device Information Service Constructor.
      *
      * @param[ref] _ble
      *                BLEDevice object for the underlying controller.
@@ -95,7 +95,7 @@
                                              (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* minLength */
                                              (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* maxLength */
                                              GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ)
-                                               {
+    {
         static bool serviceAdded = false; /* We should only ever need to add the heart rate service once. */
         if (serviceAdded) {
             return;
@@ -124,4 +124,4 @@
     GattCharacteristic  softwareRevisionStringCharacteristic;
 };
 
-#endif /* #ifndef __BLE_DEVICE_INFORMATION_SERVICE_H__*/
+#endif /* #ifndef __BLE_DEVICE_INFORMATION_SERVICE_H__*/
\ No newline at end of file
--- a/services/HealthThermometerService.h	Tue Dec 09 07:41:43 2014 +0000
+++ b/services/HealthThermometerService.h	Tue Dec 09 08:18:11 2014 +0000
@@ -19,19 +19,18 @@
 
 #include "BLEDevice.h"
 
-/** 
+/**
 * @class HealthThermometerService
-* @breif BLE Health Thermometer Service. This service provides the location of the thermometer and the temperature.  <br>
+* @brief BLE Health Thermometer Service. This service provides the location of the thermometer and the temperature.  <br>
 * Service:  https://developer.bluetooth.org/gatt/profiles/Pages/ProfileViewer.aspx?u=org.bluetooth.profile.health_thermometer.xml <br>
 * Temperature Measurement: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_measurement.xml <br>
-* Temperature Type: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_type.xml 
+* Temperature Type: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_type.xml
 */
 class HealthThermometerService {
 public:
-    
     /**
     * @enum Sensor Location
-    * @breif Location of sensor on the body
+    * @brief Location of sensor on the body
     */
     enum {
         LOCATION_ARMPIT = 1,    /*!< armpit */
@@ -46,9 +45,8 @@
     };
 
 public:
-
     /**
-     * @breif Add the Health Thermometer Service to an existing ble object, initialize with temperature and location. 
+     * @brief Add the Health Thermometer Service to an existing ble object, initialize with temperature and location.
      * @param[ref] _ble         reference to the BLE device
      * @param[in] initialTemp  initial value in celsius
      * @param[in] _location
@@ -69,11 +67,11 @@
     }
 
     /**
-    * @breif Update the temperature being broadcast 
+    * @brief Update the temperature being broadcast
     *
     * @param[in] temperature
     *                   Floating point value of the temperature
-    * 
+    *
     */
     void updateTemperature(float temperature) {
         if (ble.getGapState().connected) {
@@ -93,8 +91,8 @@
         static const unsigned TIMESTAMP_FLAG_POS         = 1;
         static const unsigned TEMPERATURE_TYPE_FLAG_POS  = 2;
 
-        static const uint8_t TEMPERATURE_UNITS_CELSIUS    = 0;
-        static const uint8_t TEMPERATURE_UNITS_FAHRENHEIT = 1;
+        static const uint8_t  TEMPERATURE_UNITS_CELSIUS    = 0;
+        static const uint8_t  TEMPERATURE_UNITS_FAHRENHEIT = 1;
 
         TemperatureValueBytes(float initialTemperature) : bytes() {
             /* assumption: temperature values are expressed in Celsius */
@@ -109,7 +107,7 @@
             memcpy(&bytes[OFFSET_OF_VALUE], &temp_ieee11073, sizeof(float));
         }
 
-        uint8_t *getPointer(void) {
+        uint8_t       *getPointer(void) {
             return bytes;
         }
 
@@ -117,7 +115,7 @@
             return bytes;
         }
 
-    private:
+private:
         /**
          * @brief A very quick conversion between a float temperature and 11073-20601 FLOAT-Type.
          * @param temperature The temperature as a float.
@@ -130,8 +128,7 @@
             return (((uint32_t)exponent) << 24) | mantissa;
         }
 
-
-    private:
+private:
         /* First byte = 8-bit flags, Second field is a float holding the temperature value. */
         /* See --> https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_measurement.xml */
         uint8_t bytes[SIZEOF_VALUE_BYTES];
@@ -144,4 +141,4 @@
     GattCharacteristic     tempLocation;
 };
 
-#endif /* #ifndef __BLE_HEALTH_THERMOMETER_SERVICE_H__*/
+#endif /* #ifndef __BLE_HEALTH_THERMOMETER_SERVICE_H__*/
\ No newline at end of file
--- a/services/HeartRateService.h	Tue Dec 09 07:41:43 2014 +0000
+++ b/services/HeartRateService.h	Tue Dec 09 08:18:11 2014 +0000
@@ -19,19 +19,18 @@
 
 #include "BLEDevice.h"
 
-/** 
+/**
 * @class HeartRateService
-* @breif BLE Service for HeartRate. This BLE Service contains the location of the sensor, the heartrate in beats per minute. <br>
+* @brief BLE Service for HeartRate. This BLE Service contains the location of the sensor, the heartrate in beats per minute. <br>
 * Service:  https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.heart_rate.xml <br>
 * HRM Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml <br>
-* Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml 
+* Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml
 */
 class HeartRateService {
 public:
-    
     /**
     * @enum SensorLocation
-    * @breif Location of HeartRate sensor on body.
+    * @brief Location of HeartRate sensor on body.
     */
     enum {
         LOCATION_OTHER = 0, /*!< Other Location */
@@ -45,7 +44,7 @@
 
 public:
     /**
-     * @breif Constructor with 8bit HRM Counter value.
+     * @brief Constructor with 8bit HRM Counter value.
      *
      * @param[ref] _ble
      *               Reference to the underlying BLEDevice.
@@ -68,7 +67,7 @@
     }
 
     /**
-     * @breif Constructor with a 16-bit HRM Counter value.
+     * @brief Constructor with a 16-bit HRM Counter value.
      *
      * @param[in] _ble
      *               Reference to the underlying BLEDevice.
@@ -91,10 +90,10 @@
     }
 
     /**
-     * @breif Set a new 8-bit value for heart rate.
+     * @brief Set a new 8-bit value for heart rate.
      *
      * @param[in] hrmCounter
-     *                  HeartRate in bpm. 
+     *                  HeartRate in bpm.
      */
     void updateHeartRate(uint8_t hrmCounter) {
         valueBytes.updateHeartRate(hrmCounter);
@@ -105,7 +104,7 @@
      * Set a new 16-bit value for heart rate.
      *
      * @param[in] hrmCounter
-     *                  HeartRate in bpm. 
+     *                  HeartRate in bpm.
      */
     void updateHeartRate(uint16_t hrmCounter) {
         valueBytes.updateHeartRate(hrmCounter);
@@ -115,7 +114,7 @@
     /**
      * This callback allows the HeartRateService to receive updates to the
      * controlPoint Characteristic.
-     *                  
+     *
      */
     virtual void onDataWritten(const GattCharacteristicWriteCBParams *params) {
         if (params->charHandle == controlPoint.getValueAttribute().getHandle()) {
@@ -162,17 +161,17 @@
         }
 
         void updateHeartRate(uint8_t hrmCounter) {
-            valueBytes[FLAGS_BYTE_INDEX] &= ~VALUE_FORMAT_FLAG;
+            valueBytes[FLAGS_BYTE_INDEX]    &= ~VALUE_FORMAT_FLAG;
             valueBytes[FLAGS_BYTE_INDEX + 1] = hrmCounter;
         }
 
         void updateHeartRate(uint16_t hrmCounter) {
-            valueBytes[FLAGS_BYTE_INDEX] |= VALUE_FORMAT_FLAG;
+            valueBytes[FLAGS_BYTE_INDEX]    |= VALUE_FORMAT_FLAG;
             valueBytes[FLAGS_BYTE_INDEX + 1] = (uint8_t)(hrmCounter & 0xFF);
             valueBytes[FLAGS_BYTE_INDEX + 2] = (uint8_t)(hrmCounter >> 8);
         }
 
-        uint8_t *getPointer(void) {
+        uint8_t       *getPointer(void) {
             return valueBytes;
         }
 
@@ -180,11 +179,11 @@
             return valueBytes;
         }
 
-        unsigned getNumValueBytes(void) const {
+        unsigned       getNumValueBytes(void) const {
             return 1 + ((valueBytes[FLAGS_BYTE_INDEX] & VALUE_FORMAT_FLAG) ? sizeof(uint16_t) : sizeof(uint8_t));
         }
 
-    private:
+private:
         /* First byte = 8-bit values, no extra info, Second byte = uint8_t HRM value */
         /* See --> https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml */
         uint8_t valueBytes[MAX_VALUE_BYTES];
@@ -199,4 +198,4 @@
     GattCharacteristic   controlPoint;
 };
 
-#endif /* #ifndef __BLE_HEART_RATE_SERVICE_H__*/
+#endif /* #ifndef __BLE_HEART_RATE_SERVICE_H__*/
\ No newline at end of file
--- a/services/UARTService.cpp	Tue Dec 09 07:41:43 2014 +0000
+++ b/services/UARTService.cpp	Tue Dec 09 08:18:11 2014 +0000
@@ -16,26 +16,26 @@
 
 #include "UARTService.h"
 
-const uint8_t UARTServiceBaseUUID[LENGTH_OF_LONG_UUID] = {
+const uint8_t  UARTServiceBaseUUID[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[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[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[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[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	Tue Dec 09 07:41:43 2014 +0000
+++ b/services/UARTService.h	Tue Dec 09 08:18:11 2014 +0000
@@ -23,20 +23,20 @@
 #include "UUID.h"
 #include "BLEDevice.h"
 
-extern const uint8_t UARTServiceBaseUUID[LENGTH_OF_LONG_UUID];
+extern const uint8_t  UARTServiceBaseUUID[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[LENGTH_OF_LONG_UUID];
+extern const uint8_t  UARTServiceUUID_reversed[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[LENGTH_OF_LONG_UUID];
+extern const uint8_t  UARTServiceRXCharacteristicUUID[LENGTH_OF_LONG_UUID];
 
 /**
 * @class UARTService
-* @breif BLE Service to enable UART over BLE
+* @brief BLE Service to enable UART over BLE
 */
 class UARTService {
 public:
@@ -82,8 +82,6 @@
     }
 
     /**
-     * Override for Stream::write().
-     *
      * We attempt to collect bytes before pushing them to the UART RX
      * characteristic--writing to the RX characteristic will then generate
      * notifications for the client. Updates made in quick succession to a
@@ -100,15 +98,15 @@
      * @param  length Amount of characters to be appended.
      * @return        Amount of characters appended to the rxCharacteristic.
      */
-    ssize_t write(const void* _buffer, size_t length) {
-        size_t origLength     = length;
-        const uint8_t *buffer = static_cast<const uint8_t *>(_buffer);
+    ssize_t write(const void *_buffer, size_t length) {
+        size_t         origLength = length;
+        const uint8_t *buffer     = static_cast<const uint8_t *>(_buffer);
 
         if (ble.getGapState().connected) {
             unsigned bufferIndex = 0;
             while (length) {
                 unsigned bytesRemainingInSendBuffer = BLE_UART_SERVICE_MAX_DATA_LEN - sendBufferIndex;
-                unsigned bytesToCopy = (length < bytesRemainingInSendBuffer) ? length : bytesRemainingInSendBuffer;
+                unsigned bytesToCopy                = (length < bytesRemainingInSendBuffer) ? length : bytesRemainingInSendBuffer;
 
                 /* copy bytes into sendBuffer */
                 memcpy(&sendBuffer[sendBufferIndex], &buffer[bufferIndex], bytesToCopy);
@@ -192,4 +190,4 @@
                                            *   application. */
 };
 
-#endif /* #ifndef __BLE_UART_SERVICE_H__*/
+#endif /* #ifndef __BLE_UART_SERVICE_H__*/
\ No newline at end of file
--- a/services/URIBeaconConfigService.h	Tue Dec 09 07:41:43 2014 +0000
+++ b/services/URIBeaconConfigService.h	Tue Dec 09 08:18:11 2014 +0000
@@ -34,17 +34,15 @@
 
 /**
 * @class URIBeaconConfigService
-* @breif UriBeacon Configuration Service. Can be used to set URL, adjust power levels, and set flags.
+* @brief UriBeacon Configuration Service. Can be used to set URL, adjust power levels, and set flags.
 */
 class URIBeaconConfigService {
 public:
-    
     /**
-    * @enum TXPowerModes_t 
-    * @breif Transmission Power Modes for UriBeacon
-    */
+     * @enum TXPowerModes_t
+     * @brief Transmission Power Modes for UriBeacon
+     */
     enum TXPowerModes_t {
-        
         TX_POWER_MODE_LOWEST = 0, /*!< Lowest TX power mode */
         TX_POWER_MODE_LOW    = 1, /*!< Low TX power mode */
         TX_POWER_MODE_MEDIUM = 2, /*!< Medium TX power mode */
@@ -125,7 +123,6 @@
      * transactions.
      */
 public:
-    
     /**
      * Update flags of the URIBeacon dynamically.
      *
@@ -149,8 +146,8 @@
     }
 
     /**
-     * @breif Update the txPowerLevels table.
-     * 
+     * @brief Update the txPowerLevels table.
+     *
      * @param[in] powerLevelsIn
      *              Array of power levels
      */
@@ -161,7 +158,7 @@
     }
 
     /**
-     * @breif Set the effective power mode from one of the values in the powerLevels tables.
+     * @brief Set the effective power mode from one of the values in the powerLevels tables.
      *
      * @param[in] mode
      *              Set the TX Power Mode.
@@ -180,7 +177,7 @@
      * @param beaconPeriodIn
      *              Beacon advertising period in milliseconds
      */
-    void setBeaconPeriod(uint16_t beaconPeriodIn) { 
+    void setBeaconPeriod(uint16_t beaconPeriodIn) {
         beaconPeriod = beaconPeriodIn;
         configureGAP();
         updateBeaconPeriodCharacteristic();
@@ -212,13 +209,13 @@
     }
 
     /*
-    *  Encode the URI Prefix to a single byte if possible.
-    */
+     *  Encode the URI Prefix to a single byte if possible.
+     */
     size_t encodeURISchemePrefix(const char *&urldata, size_t &sizeofURLData) {
         if (!sizeofURLData) {
             return 0;
         }
-        
+
         /* These are the URI Prefixes that can be abbreviated.*/
         const char *prefixes[] = {
             "http://www.",
@@ -244,12 +241,11 @@
 
         return encodedBytes;
     }
-    
+
     /*
-    *  Encode the URI Suffix to a single byte if possible.
-    */
+     *  Encode the URI Suffix to a single byte if possible.
+     */
     size_t encodeURI(const char *urldata, size_t sizeofURLData) {
-        
         /* These are the URI suffixes that can be abbreviated. */
         const char *suffixes[] = {
             ".com/",
@@ -303,8 +299,11 @@
     }
 
     /*
-    *  
-    */
+     * This callback is invoked when a GATT client attempts to modify any of the
+     * characteristics of this service. Attempts to do so must be rolled back if
+     * the config service is locked; else they are also applied to the internal
+     * state of this service object.
+     */
     void onDataWritten(const GattCharacteristicWriteCBParams *params) {
         uint16_t handle = params->charHandle;
         if (handle == uriDataChar.getValueHandle()) {
@@ -361,8 +360,8 @@
     }
 
     /*
-    *  Reset the default values.
-    */
+     *  Reset the default values.
+     */
     void resetDefaults(void) {
         lockedState      = false;
         uriDataLength    = 0;
@@ -376,8 +375,9 @@
     }
 
     /*
-    *  
-    */
+     * Internal helper function used to update the GATT database following any
+     * change to the internal state of the service object.
+     */
     void updateGATT(void) {
         updateLockedStateCharacteristic();
         updateURIDataCharacteristic();
@@ -408,16 +408,12 @@
     }
 
     void updateTxPowerLevelsCharacteristic(void) {
-       ble.updateCharacteristicValue(txPowerLevelsChar.getValueHandle(), reinterpret_cast<uint8_t *>(powerLevels), NUM_POWER_MODES * sizeof(int8_t));
+        ble.updateCharacteristicValue(txPowerLevelsChar.getValueHandle(), reinterpret_cast<uint8_t *>(powerLevels), NUM_POWER_MODES * sizeof(int8_t));
     }
 
+private:
     /**
-    * The following is a private debug function.
-    */
-private:
-
-    /**
-     * For debugging only. Print Hex representation of ServiceDataPayload to terminal.
+     * For debugging only. Print Hex representation of ServiceDataPayload to the console.
      */
     void dumpEncodedSeviceData() const {
         printf("encoded: '");