nordic

Fork of nRF51822 by Nordic Semiconductor

Revision:
562:613dbbdeed27
Parent:
550:3f782c64d014
Child:
564:9c4b96f7be8d
--- a/source/nRF5xGattClient.h	Mon Jan 11 10:19:14 2016 +0000
+++ b/source/nRF5xGattClient.h	Mon Jan 11 10:19:15 2016 +0000
@@ -147,6 +147,25 @@
         }
     }
 
+protected:
+    /**
+     * @brief  Clear nRF5xGattClient's state.
+     *
+     * @return
+     *           BLE_ERROR_NONE if successful.
+     */
+    virtual ble_error_t cleanup(void) {
+        /* Clear all state that is from the parent, including private members */
+        if (GattClient::cleanup() != BLE_ERROR_NONE) {
+            return BLE_ERROR_INVALID_STATE;
+        }
+
+        /* Clear derived class members */
+        discovery.cleanup();
+
+        return BLE_ERROR_NONE;
+    }
+
 public:
     nRF5xGattClient() : discovery(this) {
         /* empty */