for bbc microbit library

Dependencies:   nrf51-sdk

Dependents:   microbit-dal

Fork of nRF51822 by Lancaster University

Revision:
575:7023a8204a1b
Parent:
571:bbf6410b6a89
Child:
590:3bdd5346ded1
diff -r 7a531ae7a53c -r 7023a8204a1b source/nRF5xGattClient.h
--- a/source/nRF5xGattClient.h	Mon Jan 11 10:19:23 2016 +0000
+++ b/source/nRF5xGattClient.h	Mon Jan 11 10:19:24 2016 +0000
@@ -23,8 +23,6 @@
 class nRF5xGattClient : public GattClient
 {
 public:
-    static nRF5xGattClient &getInstance();
-
     /**
      * When using S110, all Gatt client features will return
      * BLE_ERROR_NOT_IMPLEMENTED
@@ -147,7 +145,30 @@
         }
     }
 
+    /**
+     * @brief  Clear nRF5xGattClient's state.
+     *
+     * @return
+     *           BLE_ERROR_NONE if successful.
+     */
+    virtual ble_error_t reset(void) {
+        /* Clear all state that is from the parent, including private members */
+        if (GattClient::reset() != BLE_ERROR_NONE) {
+            return BLE_ERROR_INVALID_STATE;
+        }
+
+        /* Clear derived class members */
+        discovery.reset();
+
+        return BLE_ERROR_NONE;
+    }
+
 public:
+    /*
+     * Allow instantiation from nRF5xn when required.
+     */
+    friend class nRF5xn;
+
     nRF5xGattClient() : discovery(this) {
         /* empty */
     }