最新revisionだとなんかerrorになるので、暫定的に rev 111にrevert。ごめんなさい。こういうときどういうふうにcommitすればいいのか分からなかったので。

Dependents:   MiniSteer_BLE

Fork of BLE_API by Bluetooth Low Energy

Files at this revision

API Documentation at this revision

Comitter:
lipoyang
Date:
Wed Sep 17 04:54:22 2014 +0000
Parent:
117:0fb20195102b
Commit message:
revert to revison 111

Changed in this revision

common/UUID.cpp Show annotated file Show diff for this revision Revisions of this file
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/GapAdvertisingParams.h Show annotated file Show diff for this revision Revisions of this file
public/GapEvents.h Show annotated file Show diff for this revision Revisions of this file
public/GattAttribute.h Show diff for this revision Revisions of this file
public/GattCharacteristic.h Show annotated file Show diff for this revision Revisions of this file
public/GattCharacteristicWriteCBParams.h Show diff for this revision Revisions of this file
public/GattServer.h Show annotated file Show diff for this revision Revisions of this file
public/GattServerEvents.h Show annotated file Show diff for this revision Revisions of this file
public/GattService.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
--- a/common/UUID.cpp	Mon Sep 08 17:11:58 2014 +0100
+++ b/common/UUID.cpp	Wed Sep 17 04:54:22 2014 +0000
@@ -64,7 +64,7 @@
     @endcode
 */
 /**************************************************************************/
-UUID::UUID(const LongUUIDBytes_t longUUID) : type(UUID_TYPE_SHORT), baseUUID(), shortUUID(0)
+UUID::UUID(const LongUUID_t longUUID) : type(UUID_TYPE_SHORT), baseUUID(), shortUUID(0)
 {
     memcpy(baseUUID, longUUID, LENGTH_OF_LONG_UUID);
     shortUUID = (uint16_t)((longUUID[2] << 8) | (longUUID[3]));
@@ -98,7 +98,7 @@
                 The 16-bit BLE UUID value.
 */
 /**************************************************************************/
-UUID::UUID(ShortUUIDBytes_t shortUUID) : type(UUID_TYPE_SHORT), baseUUID(), shortUUID(shortUUID)
+UUID::UUID(ShortUUID_t shortUUID) : type(UUID_TYPE_SHORT), baseUUID(), shortUUID(shortUUID)
 {
     /* empty */
 }
--- a/public/BLEDevice.h	Mon Sep 08 17:11:58 2014 +0100
+++ b/public/BLEDevice.h	Wed Sep 17 04:54:22 2014 +0000
@@ -194,27 +194,27 @@
      */
     ble_error_t stopAdvertising(void);
 
-    ble_error_t disconnect(Gap::DisconnectionReason_t reason);
+    ble_error_t disconnect(void);
 
     /* APIs to set GAP callbacks. */
     void onTimeout(Gap::EventCallback_t timeoutCallback);
 
-    void onConnection(Gap::ConnectionEventCallback_t connectionCallback);
+    void onConnection(Gap::HandleSpecificEventCallback_t connectionCallback);
     /**
      * Used to setup a callback for GAP disconnection.
      */
-    void onDisconnection(Gap::DisconnectionEventCallback_t disconnectionCallback);
+    void onDisconnection(Gap::HandleSpecificEventCallback_t disconnectionCallback);
 
     /**
      * Setup a callback for the GATT event DATA_SENT.
      */
-    void onDataSent(GattServer::ServerEventCallbackWithCount_t callback);
+    void onDataSent(GattServer::ServerEventCallback_t callback);
 
     /**
      * Setup a callback for when a characteristic has its value updated by a
      * client.
      */
-    void onDataWritten(GattServer::WriteEventCallback_t callback);
+    void onDataWritten(GattServer::EventCallback_t callback);
     void onUpdatesEnabled(GattServer::EventCallback_t callback);
     void onUpdatesDisabled(GattServer::EventCallback_t callback);
     void onConfirmationReceived(GattServer::EventCallback_t callback);
@@ -443,9 +443,9 @@
 }
 
 inline ble_error_t
-BLEDevice::disconnect(Gap::DisconnectionReason_t reason)
+BLEDevice::disconnect(void)
 {
-    return transport->getGap().disconnect(reason);
+    return transport->getGap().disconnect();
 }
 
 inline void
@@ -455,25 +455,25 @@
 }
 
 inline void
-BLEDevice::onConnection(Gap::ConnectionEventCallback_t connectionCallback)
+BLEDevice::onConnection(Gap::HandleSpecificEventCallback_t connectionCallback)
 {
     transport->getGap().setOnConnection(connectionCallback);
 }
 
 inline void
-BLEDevice::onDisconnection(Gap::DisconnectionEventCallback_t disconnectionCallback)
+BLEDevice::onDisconnection(Gap::HandleSpecificEventCallback_t disconnectionCallback)
 {
     transport->getGap().setOnDisconnection(disconnectionCallback);
 }
 
 inline void
-BLEDevice::onDataSent(GattServer::ServerEventCallbackWithCount_t callback)
+BLEDevice::onDataSent(GattServer::ServerEventCallback_t callback)
 {
     transport->getGattServer().setOnDataSent(callback);
 }
 
 inline void
-BLEDevice::onDataWritten(GattServer::WriteEventCallback_t callback)
+BLEDevice::onDataWritten(GattServer::EventCallback_t callback)
 {
     transport->getGattServer().setOnDataWritten(callback);
 }
@@ -551,25 +551,25 @@
 inline ble_error_t
 BLEDevice::setDeviceName(const uint8_t *deviceName)
 {
-    return transport->getGap().setDeviceName(deviceName);
+    return transport->getGattServer().setDeviceName(deviceName);
 }
 
 inline ble_error_t
 BLEDevice::getDeviceName(uint8_t *deviceName, unsigned *lengthP)
 {
-    return transport->getGap().getDeviceName(deviceName, lengthP);
+    return transport->getGattServer().getDeviceName(deviceName, lengthP);
 }
 
 inline ble_error_t
 BLEDevice::setAppearance(uint16_t appearance)
 {
-    return transport->getGap().setAppearance(appearance);
+    return transport->getGattServer().setAppearance(appearance);
 }
 
 inline ble_error_t
 BLEDevice::getAppearance(uint16_t *appearanceP)
 {
-    return transport->getGap().getAppearance(appearanceP);
+    return transport->getGattServer().getAppearance(appearanceP);
 }
 
 inline ble_error_t
--- a/public/Gap.h	Mon Sep 08 17:11:58 2014 +0100
+++ b/public/Gap.h	Wed Sep 17 04:54:22 2014 +0000
@@ -40,19 +40,6 @@
         ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE
     } addr_type_t;
 
-    /**
-     * enumeration for disconnection reasons. The values for these reasons are
-     * derived from Nordic's implementation; but the reasons are meant to be
-     * independent of the transport. If you are returned a reason which is not
-     * covered by this enumeration, then please refer to the underlying
-     * transport library.
-     */
-    enum DisconnectionReason_t {
-        REMOTE_USER_TERMINATED_CONNECTION = 0x13,
-        LOCAL_HOST_TERMINATED_CONNECTION  = 0x16,
-        CONN_INTERVAL_UNACCEPTABLE        = 0x3B,
-    };
-
     /* Describes the current state of the device (more than one bit can be set) */
     typedef struct GapState_s {
         unsigned advertising : 1; /**< peripheral is currently advertising */
@@ -74,42 +61,39 @@
     virtual ble_error_t setAdvertisingData(const GapAdvertisingData &, const GapAdvertisingData &) = 0;
     virtual ble_error_t startAdvertising(const GapAdvertisingParams &) = 0;
     virtual ble_error_t stopAdvertising(void)                    = 0;
-    virtual ble_error_t disconnect(DisconnectionReason_t reason) = 0;
+    virtual ble_error_t disconnect(void)                         = 0;
     virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params) = 0;
     virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params) = 0;
     virtual ble_error_t updateConnectionParams(Handle_t handle, const ConnectionParams_t *params) = 0;
 
-    virtual ble_error_t setDeviceName(const uint8_t *deviceName) = 0;
-    virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP) = 0;
-    virtual ble_error_t setAppearance(uint16_t appearance) = 0;
-    virtual ble_error_t getAppearance(uint16_t *appearanceP) = 0;
-
     typedef void (*EventCallback_t)(void);
-    typedef void (*ConnectionEventCallback_t)(Handle_t, const ConnectionParams_t *);
-    typedef void (*DisconnectionEventCallback_t)(Handle_t, DisconnectionReason_t);
+    typedef void (*HandleSpecificEventCallback_t)(Handle_t);
 
     /* Event callback handlers */
     void setOnTimeout(EventCallback_t callback) {
         onTimeout = callback;
     }
-    void setOnConnection(ConnectionEventCallback_t callback) {
+    void setOnConnection(HandleSpecificEventCallback_t callback) {
         onConnection = callback;
     }
-    void setOnDisconnection(DisconnectionEventCallback_t callback) {
+    void setOnDisconnection(HandleSpecificEventCallback_t callback) {
         onDisconnection = callback;
     }
 
-    void processConnectionEvent(Handle_t handle, const ConnectionParams_t *params) {
-        state.connected = 1;
-        if (onConnection) {
-            onConnection(handle, params);
-        }
-    }
-
-    void processDisconnectionEvent(Handle_t handle, DisconnectionReason_t reason) {
-        state.connected = 0;
-        if (onDisconnection) {
-            onDisconnection(handle, reason);
+    void processHandleSpecificEvent(GapEvents::gapEvent_e type, Handle_t handle) {
+        switch (type) {
+            case GapEvents::GAP_EVENT_CONNECTED:
+                state.connected = 1;
+                if (onConnection) {
+                    onConnection(handle);
+                }
+                break;
+            case GapEvents::GAP_EVENT_DISCONNECTED:
+                state.connected = 0;
+                if (onDisconnection) {
+                    onDisconnection(handle);
+                }
+                break;
         }
     }
 
@@ -137,9 +121,9 @@
     GapState_t state;
 
 private:
-    EventCallback_t              onTimeout;
-    ConnectionEventCallback_t    onConnection;
-    DisconnectionEventCallback_t onDisconnection;
+    EventCallback_t               onTimeout;
+    HandleSpecificEventCallback_t onConnection;
+    HandleSpecificEventCallback_t onDisconnection;
 };
 
 #endif // ifndef __GAP_H__
--- a/public/GapAdvertisingParams.h	Mon Sep 08 17:11:58 2014 +0100
+++ b/public/GapAdvertisingParams.h	Wed Sep 17 04:54:22 2014 +0000
@@ -63,15 +63,23 @@
         \li \c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3
     */
     /**************************************************************************/
-    enum AdvertisingType {
-        ADV_CONNECTABLE_UNDIRECTED,     /**< Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1 */
-        ADV_CONNECTABLE_DIRECTED,       /**< Vol 3, Part C, Section 9.3.3 and Vol 6, Part B, Section 2.3.1.2 */
-        ADV_SCANNABLE_UNDIRECTED,       /**< Include support for Scan Response payloads, see Vol 6, Part B, Section 2.3.1.4 */
-        ADV_NON_CONNECTABLE_UNDIRECTED  /**< Vol 3, Part C, Section 9.3.2 and Vol 6, Part B, Section 2.3.1.3 */
+    enum AdvertisingType
+    {
+        ADV_CONNECTABLE_UNDIRECTED,     /**< Vol 3, Part C, Section 9.3.4 and
+                                         *Vol 6, Part B, Section 2.3.1.1 */
+        ADV_CONNECTABLE_DIRECTED,       /**< Vol 3, Part C, Section 9.3.3 and
+                                         *Vol 6, Part B, Section 2.3.1.2 */
+        ADV_SCANNABLE_UNDIRECTED,       /**< Include support for Scan Response
+                                         *payloads, see Vol 6, Part B, Section
+                                         *2.3.1.4 */
+        ADV_NON_CONNECTABLE_UNDIRECTED  /**< Vol 3, Part C, Section 9.3.2 and
+                                         *Vol 6, Part B, Section 2.3.1.3 */
     };
 
-    GapAdvertisingParams(AdvertisingType advType  = GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED,
-                         uint16_t        interval = GAP_ADV_PARAMS_INTERVAL_MIN_NONCON,
+    GapAdvertisingParams(AdvertisingType advType  =
+                             GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED,
+                         uint16_t        interval =
+                             GAP_ADV_PARAMS_INTERVAL_MIN_NONCON,
                          uint16_t        timeout  = 0);
     virtual ~GapAdvertisingParams(void);
 
@@ -138,4 +146,5 @@
     return _timeout;
 }
 
+
 #endif // ifndef __GAP_ADVERTISING_PARAMS_H__
--- a/public/GapEvents.h	Mon Sep 08 17:11:58 2014 +0100
+++ b/public/GapEvents.h	Wed Sep 17 04:54:22 2014 +0000
@@ -38,10 +38,43 @@
     */
     /******************************************************************/
     typedef enum gapEvent_e {
-        GAP_EVENT_TIMEOUT      = 1, /**< Advertising timed out before a connection was established */
-        GAP_EVENT_CONNECTED    = 2, /**< A connection was established with a central device */
-        GAP_EVENT_DISCONNECTED = 3  /**< A connection was closed or lost with a central device */
+        GAP_EVENT_TIMEOUT      = 1,                 /**< Advertising timed out
+                                                     *before a connection was
+                                                     *established */
+        GAP_EVENT_CONNECTED    = 2,                 /**< A connection was
+                                                     *established with a
+                                                     *central device */
+        GAP_EVENT_DISCONNECTED = 3                  /**< A connection was
+                                                     *closed or lost with a
+                                                     *central device */
     } gapEvent_t;
+
+    /******************************************************************/
+    /*!
+        \brief
+        Advertising timed out before a connection was established
+    */
+    /******************************************************************/
+    virtual void onTimeout(void) {
+    }
+
+    /******************************************************************/
+    /*!
+        \brief
+        A connection was established with a central device
+    */
+    /******************************************************************/
+    virtual void onConnected(void) {
+    }
+
+    /******************************************************************/
+    /*!
+        \brief
+        A connection was closed or lost with a central device
+    */
+    /******************************************************************/
+    virtual void onDisconnected(void) {
+    }
 };
 
 #endif // ifndef __GAP_EVENTS_H__
--- a/public/GattAttribute.h	Mon Sep 08 17:11:58 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __GATT_ATTRIBUTE_H__
-#define __GATT_ATTRIBUTE_H__
-
-#include "blecommon.h"
-#include "UUID.h"
-
-/**************************************************************************/
-/*!
-    \brief  GATT attribute
-*/
-/**************************************************************************/
-class GattAttribute
-{
-public:
-
-    /**
-     *  @brief  Creates a new GattAttribute using the specified
-     *          UUID, value length, and inital value
-     *
-     *  @param[in]  uuid
-     *              The UUID to use for this attribute
-     *  @param[in]  valuePtr
-     *              The memory holding the initial value.
-     *  @param[in]  initialLen
-     *              The min length in bytes of this characteristic's value
-     *  @param[in]  maxLen
-     *              The max length in bytes of this characteristic's value
-     *
-     *  @section EXAMPLE
-     *
-     *  @code
-     *
-     *  // UUID = 0x2A19, Min length 2, Max len = 2, Properties = write
-     *  GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE );
-     *
-     *  @endcode
-     */
-    /**************************************************************************/
-    GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t initialLen = 0, uint16_t maxLen = 0) :
-        _uuid(uuid), _valuePtr(valuePtr), _initialLen(initialLen), _lenMax(maxLen), _handle(){
-        /* empty */
-    }
-
-public:
-    uint16_t getHandle(void) const {
-        return _handle;
-    }
-    void setHandle(uint16_t id) {
-        _handle = id;
-    }
-    const UUID &getUUID(void) const {
-        return _uuid;
-    }
-    uint16_t getInitialLength(void) const {
-        return _initialLen;
-    }
-    uint16_t getMaxLength(void) const {
-        return _lenMax;
-    }
-    uint8_t *getValuePtr(void) {
-        return _valuePtr;
-    }
-
-protected:
-    UUID      _uuid;        /* Characteristic UUID */
-    uint8_t  *_valuePtr;
-    uint16_t  _initialLen;  /* Initial length of the value */
-    uint16_t  _lenMax;      /* Maximum length of the value */
-    uint16_t  _handle;
-};
-
-#endif // ifndef __GATT_ATTRIBUTE_H__
--- a/public/GattCharacteristic.h	Mon Sep 08 17:11:58 2014 +0100
+++ b/public/GattCharacteristic.h	Wed Sep 17 04:54:22 2014 +0000
@@ -20,7 +20,6 @@
 
 #include "blecommon.h"
 #include "UUID.h"
-#include "GattAttribute.h"
 
 /**************************************************************************/
 /*!
@@ -297,7 +296,7 @@
         uint16_t gatt_nsdesc;    /**< Namespace description from Bluetooth Assigned Numbers, normally '0', see @ref BLE_GATT_CPF_NAMESPACES. */
     } presentation_format_t;
 
-   /**
+    /**
      *  @brief  Creates a new GattCharacteristic using the specified 16-bit
      *          UUID, value length, and properties
      *
@@ -313,42 +312,53 @@
      *              The max length in bytes of this characteristic's value
      *  @param[in]  props
      *              The 8-bit bit field containing the characteristic's properties
-     *  @param[in]  descriptors
-     *              A pointer to an array of descriptors to be included within this characteristic
-     *  @param[in]  numDescriptors
-     *              The number of descriptors
+     *
+     *  @section EXAMPLE
+     *
+     *  @code
+     *
+     *  // UUID = 0x2A19, Min length 2, Max len = 2, Properties = write
+     *  GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE );
+     *
+     *  @endcode
      */
     /**************************************************************************/
     GattCharacteristic(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t initialLen = 0, uint16_t maxLen = 0,
-                       uint8_t props = BLE_GATT_CHAR_PROPERTIES_NONE,
-                       GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) :
-        _valueAttribute(uuid, valuePtr, initialLen, maxLen), _properties(props), _descriptors(descriptors), _descriptorCount(numDescriptors) {
-        
+                       uint8_t props = BLE_GATT_CHAR_PROPERTIES_NONE) :
+        _uuid(uuid), _valuePtr(valuePtr), _initialLen(initialLen), _lenMax(maxLen), _handle(), _properties(props) {
+        /* empty */
     }
 
 public:
-    GattAttribute& getValueAttribute() {
-        return _valueAttribute;
+    uint16_t getHandle(void) const {
+        return _handle;
+    }
+    void setHandle(uint16_t id) {
+        _handle = id;
+    }
+    const UUID &getUUID(void) const {
+        return _uuid;
     }
     uint8_t getProperties(void) const {
         return _properties;
     }
-    uint8_t getDescriptorCount(void) const {
-        return _descriptorCount;
+    uint16_t getInitialLength(void) const {
+        return _initialLen;
     }
-    GattAttribute *getDescriptor(uint8_t index) {
-        if (index >= _descriptorCount) {
-            return NULL;
-        }
-
-        return _descriptors[index];
+    uint16_t getMaxLength(void) const {
+        return _lenMax;
+    }
+    uint8_t *getValuePtr(void) {
+        return _valuePtr;
     }
 
 private:
-    GattAttribute     _valueAttribute;
-    uint8_t           _properties;
-    GattAttribute **  _descriptors;
-    uint8_t           _descriptorCount;
+    UUID      _uuid;        /* Characteristic UUID */
+    uint8_t  *_valuePtr;
+    uint16_t  _initialLen;  /* Initial length of the value */
+    uint16_t  _lenMax;      /* Maximum length of the value */
+    uint16_t  _handle;
+    uint8_t   _properties;
 };
 
 #endif // ifndef __GATT_CHARACTERISTIC_H__
--- a/public/GattCharacteristicWriteCBParams.h	Mon Sep 08 17:11:58 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __GATT_CHARACTERISTIC_WRITE_CB_PARAMS_H__
-#define __GATT_CHARACTERISTIC_WRITE_CB_PARAMS_H__
-
-struct GattCharacteristicWriteCBParams {
-    enum Type {
-        GATTS_CHAR_OP_INVALID               = 0x00,  /**< Invalid Operation. */
-        GATTS_CHAR_OP_WRITE_REQ             = 0x01,  /**< Write Request. */
-        GATTS_CHAR_OP_WRITE_CMD             = 0x02,  /**< Write Command. */
-        GATTS_CHAR_OP_SIGN_WRITE_CMD        = 0x03,  /**< Signed Write Command. */
-        GATTS_CHAR_OP_PREP_WRITE_REQ        = 0x04,  /**< Prepare Write Request. */
-        GATTS_CHAR_OP_EXEC_WRITE_REQ_CANCEL = 0x05,  /**< Execute Write Request: Cancel all prepared writes. */
-        GATTS_CHAR_OP_EXEC_WRITE_REQ_NOW    = 0x06,  /**< Execute Write Request: Immediately execute all prepared writes. */
-    } op;                  /**< Type of write operation, */
-    uint16_t       offset; /**< Offset for the write operation. */
-    uint16_t       len;    /**< Length of the incoming data. */
-    const uint8_t *data;   /**< Incoming data, variable length. */
-};
-
-#endif /*__GATT_CHARACTERISTIC_WRITE_CB_PARAMS_H__*/
--- a/public/GattServer.h	Mon Sep 08 17:11:58 2014 +0100
+++ b/public/GattServer.h	Wed Sep 17 04:54:22 2014 +0000
@@ -21,7 +21,6 @@
 #include "blecommon.h"
 #include "GattService.h"
 #include "GattServerEvents.h"
-#include "GattCharacteristicWriteCBParams.h"
 
 /**************************************************************************/
 /*!
@@ -37,6 +36,10 @@
     virtual ble_error_t addService(GattService &) = 0;
     virtual ble_error_t readValue(uint16_t handle, uint8_t buffer[], uint16_t *const lengthP) = 0;
     virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false) = 0;
+    virtual ble_error_t setDeviceName(const uint8_t *deviceName) = 0;
+    virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP) = 0;
+    virtual ble_error_t setAppearance(uint16_t appearance) = 0;
+    virtual ble_error_t getAppearance(uint16_t *appearanceP) = 0;
 
     // ToDo: For updateValue, check the CCCD to see if the value we are
     // updating has the notify or indicate bits sent, and if BOTH are set
@@ -45,13 +48,11 @@
 
     /* Event callback handlers. */
     typedef void (*EventCallback_t)(uint16_t attributeHandle);
-    typedef void (*WriteEventCallback_t)(uint16_t attributeHandle, const GattCharacteristicWriteCBParams *eventDataP);
-    typedef void (*ServerEventCallback_t)(void);                    /**< independent of any particular attribute */
-    typedef void (*ServerEventCallbackWithCount_t)(unsigned count); /**< independent of any particular attribute */
-    void setOnDataSent(ServerEventCallbackWithCount_t callback) {
+    typedef void (*ServerEventCallback_t)(void); /* independent of any particular attribute */
+    void setOnDataSent(ServerEventCallback_t callback) {
         onDataSent = callback;
     }
-    void setOnDataWritten(WriteEventCallback_t callback) {
+    void setOnDataWritten(EventCallback_t callback) {
         onDataWritten = callback;
     }
     void setOnUpdatesEnabled(EventCallback_t callback) {
@@ -64,14 +65,13 @@
         onConfirmationReceived = callback;
     }
 
-    void handleDataWrittenEvent(uint16_t charHandle, const GattCharacteristicWriteCBParams *params) {
-        if (onDataWritten) {
-            onDataWritten(charHandle, params);
-        }
-    }
-
     void handleEvent(GattServerEvents::gattEvent_e type, uint16_t charHandle) {
         switch (type) {
+            case GattServerEvents::GATT_EVENT_DATA_WRITTEN:
+                if (onDataWritten) {
+                    onDataWritten(charHandle);
+                }
+                break;
             case GattServerEvents::GATT_EVENT_UPDATES_ENABLED:
                 if (onUpdatesEnabled) {
                     onUpdatesEnabled(charHandle);
@@ -90,9 +90,15 @@
         }
     }
 
-    void handleDataSentEvent(unsigned count) {
-        if (onDataSent) {
-            onDataSent(count);
+    void handleEvent(GattServerEvents::gattEvent_e type) {
+        switch (type) {
+            case GattServerEvents::GATT_EVENT_DATA_SENT:
+                if (onDataSent) {
+                    onDataSent();
+                }
+                break;
+            default:
+                break;
         }
     }
 
@@ -104,14 +110,13 @@
 protected:
     uint8_t serviceCount;
     uint8_t characteristicCount;
-    uint8_t descriptorCount;
 
 private:
-    ServerEventCallbackWithCount_t onDataSent;
-    WriteEventCallback_t           onDataWritten;
-    EventCallback_t                onUpdatesEnabled;
-    EventCallback_t                onUpdatesDisabled;
-    EventCallback_t                onConfirmationReceived;
+    ServerEventCallback_t onDataSent;
+    EventCallback_t       onDataWritten;
+    EventCallback_t       onUpdatesEnabled;
+    EventCallback_t       onUpdatesDisabled;
+    EventCallback_t       onConfirmationReceived;
 };
 
 #endif // ifndef __GATT_SERVER_H__
--- a/public/GattServerEvents.h	Mon Sep 08 17:11:58 2014 +0100
+++ b/public/GattServerEvents.h	Wed Sep 17 04:54:22 2014 +0000
@@ -44,6 +44,53 @@
         GATT_EVENT_UPDATES_DISABLED      = 4,       /**< Notify/Indicate Disabled in CCCD */
         GATT_EVENT_CONFIRMATION_RECEIVED = 5        /**< Response received from Indicate message */
     } gattEvent_t;
+
+    /******************************************************************/
+    /*!
+        \brief
+        A message was successfully transmitted
+    */
+    /******************************************************************/
+    virtual void onDataSent(uint16_t charHandle) {
+    }
+
+    /******************************************************************/
+    /*!
+        \brief
+        The GATT client (the phone, tablet, etc.) wrote data to a
+        characteristic or descriptor on the GATT Server (the peripheral
+        device).
+    */
+    /******************************************************************/
+    virtual void onDataWritten(uint16_t charHandle) {
+    }
+
+    /******************************************************************/
+    /*!
+        \brief
+        A Notify or Indicate flag was enabled in the CCCD
+    */
+    /******************************************************************/
+    virtual void onUpdatesEnabled(uint16_t charHandle) {
+    }
+
+    /******************************************************************/
+    /*!
+        \brief
+        A Notify or Indicate flag was disabled in the CCCD
+    */
+    /******************************************************************/
+    virtual void onUpdatesDisabled(uint16_t charHandle) {
+    }
+
+    /******************************************************************/
+    /*!
+        \brief
+        A confirmation response was received from an Indicate message
+    */
+    /******************************************************************/
+    virtual void onConfirmationReceived(uint16_t charHandle) {
+    }
 };
 
 #endif // ifndef __GATT_SERVER_EVENTS_H__
--- a/public/GattService.h	Mon Sep 08 17:11:58 2014 +0100
+++ b/public/GattService.h	Wed Sep 17 04:54:22 2014 +0000
@@ -31,20 +31,6 @@
 class GattService
 {
 public:
-   /**
-     *  @brief  Creates a new GattCharacteristic using the specified 16-bit
-     *          UUID, value length, and properties
-     *
-     *  @note   The UUID value must be unique in the service and is normally >1
-     *
-     *  @param[in]  uuid
-     *              The UUID to use for this characteristic
-     *  @param[in]  characteristics
-     *              A pointer to an array of characteristics to be included within this service
-     *  @param[in]  numCharacteristics
-     *              The number of characteristics
-     */
-    /**************************************************************************/
     GattService(const UUID &uuid, GattCharacteristic *characteristics[], unsigned numCharacteristics);
 
     enum {
--- a/public/UUID.h	Mon Sep 08 17:11:58 2014 +0100
+++ b/public/UUID.h	Wed Sep 17 04:54:22 2014 +0000
@@ -21,8 +21,8 @@
 #include "blecommon.h"
 
 const unsigned   LENGTH_OF_LONG_UUID = 16;
-typedef uint16_t ShortUUIDBytes_t;
-typedef uint8_t  LongUUIDBytes_t[LENGTH_OF_LONG_UUID];
+typedef uint16_t ShortUUID_t;
+typedef uint8_t  LongUUID_t[LENGTH_OF_LONG_UUID];
 
 class UUID
 {
@@ -33,8 +33,8 @@
     };
 
 public:
-    UUID(const LongUUIDBytes_t);
-    UUID(ShortUUIDBytes_t);
+    UUID(const LongUUID_t);
+    UUID(ShortUUID_t);
     virtual ~UUID(void);
 
 public:
@@ -44,18 +44,18 @@
     const uint8_t* getBaseUUID(void) const {
         return baseUUID;
     }
-    ShortUUIDBytes_t    getShortUUID(void) const {
+    ShortUUID_t    getShortUUID(void) const {
         return shortUUID;
     }
 
 private:
-    uint8_t          type;      // UUID_TYPE_SHORT or UUID_TYPE_LONG
-    LongUUIDBytes_t  baseUUID;  /* the base of the long UUID (if
+    uint8_t     type;      // UUID_TYPE_SHORT or UUID_TYPE_LONG
+    LongUUID_t  baseUUID;  /* the base of the long UUID (if
                             * used). Note: bytes 12 and 13 (counting from LSB)
                             * are zeroed out to allow comparison with other long
                             * UUIDs which differ only in the 16-bit relative
                             * part.*/
-    ShortUUIDBytes_t shortUUID; // 16 bit uuid (byte 2-3 using with base)
+    ShortUUID_t shortUUID; // 16 bit uuid (byte 2-3 using with base)
 };
 
 #endif // ifndef __UUID_H__