just a fork
Fork of BLE_API by
Diff: ble/GattServer.h
- Revision:
- 1089:8e810a8e083e
- Parent:
- 1088:709ebced28ab
- Child:
- 1090:148d8b9b56a5
diff -r 709ebced28ab -r 8e810a8e083e ble/GattServer.h --- a/ble/GattServer.h Mon Jan 11 08:51:49 2016 +0000 +++ b/ble/GattServer.h Mon Jan 11 08:51:49 2016 +0000 @@ -36,9 +36,6 @@ typedef FunctionPointerWithContext<const GattReadCallbackParams*> DataReadCallback_t; typedef CallChainOfFunctionPointersWithContext<const GattReadCallbackParams *> DataReadCallbackChain_t; - typedef FunctionPointerWithContext<const GattServer *> GattServerShutdownCallback_t; - typedef CallChainOfFunctionPointersWithContext<const GattServer *> GattServerShutdownCallbackChain_t; - typedef FunctionPointerWithContext<GattAttribute::Handle_t> EventCallback_t; protected: @@ -345,38 +342,6 @@ } /** - * Setup a callback to be invoked to notify the user application that the - * GattServer instance is about to shutdown (possibly as a result of a call - * to BLE::shutdown()). - * - * @Note: It is possible to chain together multiple onShutdown callbacks - * (potentially from different modules of an application) to be notified - * before the GattServer is shutdown. - * - * @Note: It is also possible to set up a callback into a member function of - * some object. - * - * @Note It is possible to unregister a callback using onShutdown().detach(callback) - */ - void onShutdown(const GattServerShutdownCallback_t& callback) { - shutdownCallChain.add(callback); - } - template <typename T> - void onShutdown(T *objPtr, void (T::*memberPtr)(void)) { - shutdownCallChain.add(objPtr, memberPtr); - } - - /** - * @brief provide access to the callchain of shutdown event callbacks - * It is possible to register callbacks using onShutdown().add(callback); - * It is possible to unregister callbacks using onShutdown().detach(callback) - * @return The shutdown event callbacks chain - */ - GattServerShutdownCallbackChain_t& onShutdown() { - return shutdownCallChain; - } - - /** * Set up a callback for when notifications or indications are enabled for a * characteristic on the local GATT server. */ @@ -432,9 +397,7 @@ public: /** - * Notify all registered onShutdown callbacks that the GattServer is - * about to be shutdown and clear all GattServer state of the - * associated object. + * Clear all GattServer state of the associated object. * * This function is meant to be overridden in the platform-specific * sub-class. Nevertheless, the sub-class is only expected to reset its @@ -445,10 +408,7 @@ * @return BLE_ERROR_NONE on success. */ virtual ble_error_t reset(void) { - /* Notify that the instance is about to shutdown */ - shutdownCallChain.call(this); - - serviceCount = 0; + serviceCount = 0; characteristicCount = 0; dataSentCallChain.clear(); @@ -466,13 +426,12 @@ uint8_t characteristicCount; private: - DataSentCallbackChain_t dataSentCallChain; - DataWrittenCallbackChain_t dataWrittenCallChain; - DataReadCallbackChain_t dataReadCallChain; - GattServerShutdownCallbackChain_t shutdownCallChain; - EventCallback_t updatesEnabledCallback; - EventCallback_t updatesDisabledCallback; - EventCallback_t confirmationReceivedCallback; + DataSentCallbackChain_t dataSentCallChain; + DataWrittenCallbackChain_t dataWrittenCallChain; + DataReadCallbackChain_t dataReadCallChain; + EventCallback_t updatesEnabledCallback; + EventCallback_t updatesDisabledCallback; + EventCallback_t confirmationReceivedCallback; private: /* Disallow copy and assignment. */