I don't know why this is happening.

Fork of BLE_API by Bluetooth Low Energy

Revision:
140:407d134c179d
Parent:
139:baaf1c5f0db2
Child:
143:8bdf577b1598
--- a/public/GattServer.h	Fri Nov 21 09:23:24 2014 +0000
+++ b/public/GattServer.h	Fri Nov 21 09:23:24 2014 +0000
@@ -17,7 +17,6 @@
 #ifndef __GATT_SERVER_H__
 #define __GATT_SERVER_H__
 
-#include "blecommon.h"
 #include "GattService.h"
 #include "GattServerEvents.h"
 #include "GattCharacteristicWriteCBParams.h"
@@ -33,20 +32,29 @@
 class GattServer
 {
 public:
+    /* Event callback handlers. */
+    typedef void (*EventCallback_t)(uint16_t attributeHandle);
+    typedef void (*ServerEventCallback_t)(void);                    /**< independent of any particular attribute */
+    typedef void (*ServerEventCallbackWithCount_t)(unsigned count); /**< independent of any particular attribute */
+
+protected:
+    GattServer() : serviceCount(0), characteristicCount(0), onDataSent(NULL), onDataWritten(), onUpdatesEnabled(NULL), onUpdatesDisabled(NULL), onConfirmationReceived(NULL) {
+        /* empty */
+    }
+
+    friend class BLEDevice;
+private:
     /* These functions must be defined in the sub-class */
     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 initializeGATTDatabase(void) = 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
     // be sure to call sd_ble_gatts_hvx() twice with notify then indicate!
     // Strange use case, but valid and must be covered!
 
-    /* Event callback handlers. */
-    typedef void (*EventCallback_t)(uint16_t attributeHandle);
-    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) {
         onDataSent = callback;
     }
@@ -67,6 +75,7 @@
         onConfirmationReceived = callback;
     }
 
+protected:
     void handleDataWrittenEvent(const GattCharacteristicWriteCBParams *params) {
         if (onDataWritten.hasCallbacksAttached()) {
             onDataWritten.call(params);
@@ -100,14 +109,8 @@
     }
 
 protected:
-    GattServer() : serviceCount(0), characteristicCount(0), onDataSent(NULL), onDataWritten(), onUpdatesEnabled(NULL), onUpdatesDisabled(NULL), onConfirmationReceived(NULL) {
-        /* empty */
-    }
-
-protected:
     uint8_t serviceCount;
     uint8_t characteristicCount;
-    uint8_t descriptorCount;
 
 private:
     ServerEventCallbackWithCount_t onDataSent;
@@ -115,6 +118,11 @@
     EventCallback_t                onUpdatesEnabled;
     EventCallback_t                onUpdatesDisabled;
     EventCallback_t                onConfirmationReceived;
+
+private:
+    /* disallow copy and assginment */
+    GattServer(const GattServer &);
+    GattServer& operator=(const GattServer &);
 };
 
 #endif // ifndef __GATT_SERVER_H__
\ No newline at end of file