Updated
Fork of BLE_API by
ble/BLEInstanceBase.h@854:ad4ae73c2b5a, 2015-11-02 (annotated)
- Committer:
- rgrover1
- Date:
- Mon Nov 02 09:09:06 2015 +0000
- Revision:
- 854:ad4ae73c2b5a
- Parent:
- 853:2e829bcda785
- Child:
- 857:7f578be2d01d
Synchronized with git rev 918af4fb
Author: Rohit Grover
Major change:
- There's a new type: BLE::InitializationCompleteCallback_t
- init() now takes a completion callback. This is an optional parameter, if no callback is setup the application can still determine the status of initialization using BLE::hasInitialized() (see below).
- There's a new API: BLEInstanceBase::hasInitialized() which transports need to implement.
- BLEInstanceBase.h is no longer included from BLE.h. We use a forward declaration of BLEInstanceBase instead. This is required us to move implementations of BLE methods out of the header and into BLE.cpp.
- There's a new API: BLE::getInstanceID(), which simply returns the ID of an instance.
- There are new error types around initialization.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rgrover1 | 716:11b41f651697 | 1 | /* mbed Microcontroller Library |
rgrover1 | 716:11b41f651697 | 2 | * Copyright (c) 2006-2013 ARM Limited |
rgrover1 | 716:11b41f651697 | 3 | * |
rgrover1 | 716:11b41f651697 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
rgrover1 | 716:11b41f651697 | 5 | * you may not use this file except in compliance with the License. |
rgrover1 | 716:11b41f651697 | 6 | * You may obtain a copy of the License at |
rgrover1 | 716:11b41f651697 | 7 | * |
rgrover1 | 716:11b41f651697 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
rgrover1 | 716:11b41f651697 | 9 | * |
rgrover1 | 716:11b41f651697 | 10 | * Unless required by applicable law or agreed to in writing, software |
rgrover1 | 716:11b41f651697 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
rgrover1 | 716:11b41f651697 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
rgrover1 | 716:11b41f651697 | 13 | * See the License for the specific language governing permissions and |
rgrover1 | 716:11b41f651697 | 14 | * limitations under the License. |
rgrover1 | 716:11b41f651697 | 15 | */ |
rgrover1 | 716:11b41f651697 | 16 | |
rgrover1 | 716:11b41f651697 | 17 | #ifndef __BLE_DEVICE_INSTANCE_BASE__ |
rgrover1 | 716:11b41f651697 | 18 | #define __BLE_DEVICE_INSTANCE_BASE__ |
rgrover1 | 716:11b41f651697 | 19 | |
rgrover1 | 716:11b41f651697 | 20 | #include "Gap.h" |
rgrover1 | 853:2e829bcda785 | 21 | #include "ble/SecurityManager.h" |
rgrover1 | 854:ad4ae73c2b5a | 22 | #include "ble/BLE.h" |
rgrover1 | 716:11b41f651697 | 23 | |
rgrover1 | 716:11b41f651697 | 24 | /* forward declarations */ |
rgrover1 | 716:11b41f651697 | 25 | class GattServer; |
rgrover1 | 716:11b41f651697 | 26 | class GattClient; |
rgrover1 | 716:11b41f651697 | 27 | |
rgrover1 | 716:11b41f651697 | 28 | /** |
rgrover1 | 716:11b41f651697 | 29 | * The interface for the transport object to be created by the target library's |
rgrover1 | 716:11b41f651697 | 30 | * createBLEInstance(). |
rgrover1 | 716:11b41f651697 | 31 | */ |
rgrover1 | 716:11b41f651697 | 32 | class BLEInstanceBase |
rgrover1 | 716:11b41f651697 | 33 | { |
rgrover1 | 716:11b41f651697 | 34 | public: |
rgrover1 | 854:ad4ae73c2b5a | 35 | virtual ble_error_t init(BLE::InstanceID_t instanceID, BLE::InitializationCompleteCallback_t) = 0; |
rgrover1 | 854:ad4ae73c2b5a | 36 | virtual bool hasInitialized(void) const = 0; |
rgrover1 | 854:ad4ae73c2b5a | 37 | virtual ble_error_t shutdown(void) = 0; |
rgrover1 | 854:ad4ae73c2b5a | 38 | virtual const char * getVersion(void) = 0; |
rgrover1 | 854:ad4ae73c2b5a | 39 | virtual Gap& getGap() = 0; |
rgrover1 | 854:ad4ae73c2b5a | 40 | virtual const Gap& getGap() const = 0; |
rgrover1 | 854:ad4ae73c2b5a | 41 | virtual GattServer& getGattServer() = 0; |
rgrover1 | 854:ad4ae73c2b5a | 42 | virtual const GattServer& getGattServer() const = 0; |
rgrover1 | 854:ad4ae73c2b5a | 43 | virtual GattClient& getGattClient() = 0; |
rgrover1 | 854:ad4ae73c2b5a | 44 | virtual SecurityManager& getSecurityManager() = 0; |
rgrover1 | 716:11b41f651697 | 45 | virtual const SecurityManager& getSecurityManager() const = 0; |
rgrover1 | 854:ad4ae73c2b5a | 46 | virtual void waitForEvent(void) = 0; |
rgrover1 | 716:11b41f651697 | 47 | }; |
rgrover1 | 716:11b41f651697 | 48 | |
rgrover1 | 716:11b41f651697 | 49 | /** |
rgrover1 | 716:11b41f651697 | 50 | * BLE uses composition to hide an interface object encapsulating the |
rgrover1 | 716:11b41f651697 | 51 | * backend transport. |
rgrover1 | 716:11b41f651697 | 52 | * |
rgrover1 | 716:11b41f651697 | 53 | * The following API is used to create the singleton interface object. An |
rgrover1 | 716:11b41f651697 | 54 | * implementation for this function must be provided by the device-specific |
rgrover1 | 716:11b41f651697 | 55 | * library, otherwise there will be a linker error. |
rgrover1 | 716:11b41f651697 | 56 | */ |
rgrover1 | 716:11b41f651697 | 57 | extern BLEInstanceBase *createBLEInstance(void); |
rgrover1 | 716:11b41f651697 | 58 | |
rgrover1 | 716:11b41f651697 | 59 | #endif // ifndef __BLE_DEVICE_INSTANCE_BASE__ |