Updated
Fork of BLE_API by
ble/BLEInstanceBase.h@1179:4ab722f8dca0, 2016-04-06 (annotated)
- Committer:
- vcoubard
- Date:
- Wed Apr 06 19:15:30 2016 +0100
- Revision:
- 1179:4ab722f8dca0
- Parent:
- 1178:a4418fcb462f
- Child:
- 1183:1589830dbdb7
Synchronized with git rev ca632aaf
Author: Andres Amaya Garcia
Update Gap state after advertising times out
The BLE API was not updating the Gap internal state when the advertising stops
because of a user timeout. This commit fixes the issue by updating the internal
state structure in Gap just before the registered callbacks are notified of the
advertising timeout.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vcoubard | 1145:d21353309b6c | 1 | /* mbed Microcontroller Library |
vcoubard | 1145:d21353309b6c | 2 | * Copyright (c) 2006-2013 ARM Limited |
vcoubard | 1145:d21353309b6c | 3 | * |
vcoubard | 1145:d21353309b6c | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
vcoubard | 1145:d21353309b6c | 5 | * you may not use this file except in compliance with the License. |
vcoubard | 1145:d21353309b6c | 6 | * You may obtain a copy of the License at |
vcoubard | 1145:d21353309b6c | 7 | * |
vcoubard | 1145:d21353309b6c | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
vcoubard | 1145:d21353309b6c | 9 | * |
vcoubard | 1145:d21353309b6c | 10 | * Unless required by applicable law or agreed to in writing, software |
vcoubard | 1145:d21353309b6c | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
vcoubard | 1145:d21353309b6c | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
vcoubard | 1145:d21353309b6c | 13 | * See the License for the specific language governing permissions and |
vcoubard | 1145:d21353309b6c | 14 | * limitations under the License. |
vcoubard | 1145:d21353309b6c | 15 | */ |
vcoubard | 1145:d21353309b6c | 16 | |
vcoubard | 1145:d21353309b6c | 17 | #ifndef __BLE_DEVICE_INSTANCE_BASE__ |
vcoubard | 1145:d21353309b6c | 18 | #define __BLE_DEVICE_INSTANCE_BASE__ |
vcoubard | 1145:d21353309b6c | 19 | |
vcoubard | 1145:d21353309b6c | 20 | #include "Gap.h" |
vcoubard | 1145:d21353309b6c | 21 | #include "ble/SecurityManager.h" |
vcoubard | 1145:d21353309b6c | 22 | #include "ble/BLE.h" |
vcoubard | 1145:d21353309b6c | 23 | |
vcoubard | 1145:d21353309b6c | 24 | /* Forward declarations. */ |
vcoubard | 1145:d21353309b6c | 25 | class GattServer; |
vcoubard | 1145:d21353309b6c | 26 | class GattClient; |
vcoubard | 1145:d21353309b6c | 27 | |
vcoubard | 1145:d21353309b6c | 28 | /** |
vcoubard | 1145:d21353309b6c | 29 | * The interface for the transport object to be created by the target library's |
vcoubard | 1145:d21353309b6c | 30 | * createBLEInstance(). |
vcoubard | 1145:d21353309b6c | 31 | */ |
vcoubard | 1145:d21353309b6c | 32 | class BLEInstanceBase |
vcoubard | 1145:d21353309b6c | 33 | { |
vcoubard | 1145:d21353309b6c | 34 | public: |
vcoubard | 1145:d21353309b6c | 35 | virtual ble_error_t init(BLE::InstanceID_t instanceID, |
vcoubard | 1145:d21353309b6c | 36 | FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> initCallback) = 0; |
vcoubard | 1145:d21353309b6c | 37 | virtual bool hasInitialized(void) const = 0; |
vcoubard | 1145:d21353309b6c | 38 | virtual ble_error_t shutdown(void) = 0; |
vcoubard | 1145:d21353309b6c | 39 | virtual const char * getVersion(void) = 0; |
vcoubard | 1145:d21353309b6c | 40 | virtual Gap& getGap() = 0; |
vcoubard | 1145:d21353309b6c | 41 | virtual const Gap& getGap() const = 0; |
vcoubard | 1145:d21353309b6c | 42 | virtual GattServer& getGattServer() = 0; |
vcoubard | 1145:d21353309b6c | 43 | virtual const GattServer& getGattServer() const = 0; |
vcoubard | 1145:d21353309b6c | 44 | virtual GattClient& getGattClient() = 0; |
vcoubard | 1145:d21353309b6c | 45 | virtual SecurityManager& getSecurityManager() = 0; |
vcoubard | 1145:d21353309b6c | 46 | virtual const SecurityManager& getSecurityManager() const = 0; |
vcoubard | 1145:d21353309b6c | 47 | virtual void waitForEvent(void) = 0; |
vcoubard | 1145:d21353309b6c | 48 | }; |
vcoubard | 1145:d21353309b6c | 49 | |
vcoubard | 1145:d21353309b6c | 50 | /** |
vcoubard | 1145:d21353309b6c | 51 | * BLE uses composition to hide an interface object encapsulating the |
vcoubard | 1145:d21353309b6c | 52 | * backend transport. |
vcoubard | 1145:d21353309b6c | 53 | * |
vcoubard | 1145:d21353309b6c | 54 | * The following API is used to create the singleton interface object. An |
vcoubard | 1145:d21353309b6c | 55 | * implementation for this function must be provided by the device-specific |
vcoubard | 1145:d21353309b6c | 56 | * library, otherwise there will be a linker error. |
vcoubard | 1145:d21353309b6c | 57 | */ |
vcoubard | 1145:d21353309b6c | 58 | extern BLEInstanceBase *createBLEInstance(void); |
vcoubard | 1145:d21353309b6c | 59 | |
rgrover1 | 716:11b41f651697 | 60 | #endif // ifndef __BLE_DEVICE_INSTANCE_BASE__ |