Lancaster University's fork of the mbed BLE API. Lives on github, https://github.com/lancaster-university/BLE_API
Dependents: microbit-dal microbit-dal microbit-ble-open microbit-dal ... more
Fork of BLE_API by
source/GattClient.cpp@1062:a3fd424b73ca, 2016-01-11 (annotated)
- Committer:
- vcoubard
- Date:
- Mon Jan 11 08:51:37 2016 +0000
- Revision:
- 1062:a3fd424b73ca
Synchronized with git rev b817cf3e
Author: Andres Amaya Garcia
Improve API to facilitate full shutdown procedure
The BLE API exposes a shutdown() function in BLE.h. This function is meant to
be overwridden by platform-specific sub-classes to clear all GAP and GATT
state. However, from the platform-specific implementation it is dificult to
achieve this because the Gap, GattClient, GattServer and SecurityManager
components of the API do not expose any functionality to shutdown.
This commit introduces the following changes:
* Add a static member pointer to Gap, GattClient, GattServer and
SecurityManager that is used to keep track of the initialized objects.
* Add a function member cleanup() to Gap, GattClient, GattServer and
SecurityManager to allow easy reset of the instance's state. This function
is meant to be overriden and called from the derived classes to fully clear the
state of the BLE API and the platform-specific implementation.
* Add a static member function shutdown() to Gap, GattClient, GattServer and
SecurityManager. This function shall be called from the shutdown()
overriding BLE::shutdown() for Gap, GattClient, GattServer and SecurityManager
that will in-turn clear the state of each of the components.
**NOTE:** Platform-specific implementations of this API must be modified to
this changes into account.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vcoubard | 1062:a3fd424b73ca | 1 | /* mbed Microcontroller Library |
vcoubard | 1062:a3fd424b73ca | 2 | * Copyright (c) 2006-2013 ARM Limited |
vcoubard | 1062:a3fd424b73ca | 3 | * |
vcoubard | 1062:a3fd424b73ca | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
vcoubard | 1062:a3fd424b73ca | 5 | * you may not use this file except in compliance with the License. |
vcoubard | 1062:a3fd424b73ca | 6 | * You may obtain a copy of the License at |
vcoubard | 1062:a3fd424b73ca | 7 | * |
vcoubard | 1062:a3fd424b73ca | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
vcoubard | 1062:a3fd424b73ca | 9 | * |
vcoubard | 1062:a3fd424b73ca | 10 | * Unless required by applicable law or agreed to in writing, software |
vcoubard | 1062:a3fd424b73ca | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
vcoubard | 1062:a3fd424b73ca | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
vcoubard | 1062:a3fd424b73ca | 13 | * See the License for the specific language governing permissions and |
vcoubard | 1062:a3fd424b73ca | 14 | * limitations under the License. |
vcoubard | 1062:a3fd424b73ca | 15 | */ |
vcoubard | 1062:a3fd424b73ca | 16 | |
vcoubard | 1062:a3fd424b73ca | 17 | #include "ble/GattClient.h" |
vcoubard | 1062:a3fd424b73ca | 18 | |
vcoubard | 1062:a3fd424b73ca | 19 | GattClient *GattClient::gattClientInstance = NULL; |