Official Sheffield ARMBand micro:bit program
microbit/microbit-dal/BLE_API/ble/BLEInstanceBase.h@0:b9164b348919, 2016-10-17 (annotated)
- Committer:
- MrBedfordVan
- Date:
- Mon Oct 17 12:41:20 2016 +0000
- Revision:
- 0:b9164b348919
Official Sheffield ARMBand Micro:bit program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MrBedfordVan | 0:b9164b348919 | 1 | /* mbed Microcontroller Library |
MrBedfordVan | 0:b9164b348919 | 2 | * Copyright (c) 2006-2013 ARM Limited |
MrBedfordVan | 0:b9164b348919 | 3 | * |
MrBedfordVan | 0:b9164b348919 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
MrBedfordVan | 0:b9164b348919 | 5 | * you may not use this file except in compliance with the License. |
MrBedfordVan | 0:b9164b348919 | 6 | * You may obtain a copy of the License at |
MrBedfordVan | 0:b9164b348919 | 7 | * |
MrBedfordVan | 0:b9164b348919 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
MrBedfordVan | 0:b9164b348919 | 9 | * |
MrBedfordVan | 0:b9164b348919 | 10 | * Unless required by applicable law or agreed to in writing, software |
MrBedfordVan | 0:b9164b348919 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
MrBedfordVan | 0:b9164b348919 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MrBedfordVan | 0:b9164b348919 | 13 | * See the License for the specific language governing permissions and |
MrBedfordVan | 0:b9164b348919 | 14 | * limitations under the License. |
MrBedfordVan | 0:b9164b348919 | 15 | */ |
MrBedfordVan | 0:b9164b348919 | 16 | |
MrBedfordVan | 0:b9164b348919 | 17 | #ifndef __BLE_DEVICE_INSTANCE_BASE__ |
MrBedfordVan | 0:b9164b348919 | 18 | #define __BLE_DEVICE_INSTANCE_BASE__ |
MrBedfordVan | 0:b9164b348919 | 19 | |
MrBedfordVan | 0:b9164b348919 | 20 | #include "Gap.h" |
MrBedfordVan | 0:b9164b348919 | 21 | #include "ble/SecurityManager.h" |
MrBedfordVan | 0:b9164b348919 | 22 | #include "ble/BLE.h" |
MrBedfordVan | 0:b9164b348919 | 23 | |
MrBedfordVan | 0:b9164b348919 | 24 | /* Forward declarations. */ |
MrBedfordVan | 0:b9164b348919 | 25 | class GattServer; |
MrBedfordVan | 0:b9164b348919 | 26 | class GattClient; |
MrBedfordVan | 0:b9164b348919 | 27 | |
MrBedfordVan | 0:b9164b348919 | 28 | /** |
MrBedfordVan | 0:b9164b348919 | 29 | * The interface for the transport object to be created by the target library's |
MrBedfordVan | 0:b9164b348919 | 30 | * createBLEInstance(). |
MrBedfordVan | 0:b9164b348919 | 31 | */ |
MrBedfordVan | 0:b9164b348919 | 32 | class BLEInstanceBase |
MrBedfordVan | 0:b9164b348919 | 33 | { |
MrBedfordVan | 0:b9164b348919 | 34 | public: |
MrBedfordVan | 0:b9164b348919 | 35 | virtual ble_error_t init(BLE::InstanceID_t instanceID, |
MrBedfordVan | 0:b9164b348919 | 36 | FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> initCallback) = 0; |
MrBedfordVan | 0:b9164b348919 | 37 | virtual bool hasInitialized(void) const = 0; |
MrBedfordVan | 0:b9164b348919 | 38 | virtual ble_error_t shutdown(void) = 0; |
MrBedfordVan | 0:b9164b348919 | 39 | virtual const char * getVersion(void) = 0; |
MrBedfordVan | 0:b9164b348919 | 40 | virtual Gap& getGap() = 0; |
MrBedfordVan | 0:b9164b348919 | 41 | virtual const Gap& getGap() const = 0; |
MrBedfordVan | 0:b9164b348919 | 42 | virtual GattServer& getGattServer() = 0; |
MrBedfordVan | 0:b9164b348919 | 43 | virtual const GattServer& getGattServer() const = 0; |
MrBedfordVan | 0:b9164b348919 | 44 | virtual GattClient& getGattClient() = 0; |
MrBedfordVan | 0:b9164b348919 | 45 | virtual SecurityManager& getSecurityManager() = 0; |
MrBedfordVan | 0:b9164b348919 | 46 | virtual const SecurityManager& getSecurityManager() const = 0; |
MrBedfordVan | 0:b9164b348919 | 47 | virtual void waitForEvent(void) = 0; |
MrBedfordVan | 0:b9164b348919 | 48 | }; |
MrBedfordVan | 0:b9164b348919 | 49 | |
MrBedfordVan | 0:b9164b348919 | 50 | /** |
MrBedfordVan | 0:b9164b348919 | 51 | * BLE uses composition to hide an interface object encapsulating the |
MrBedfordVan | 0:b9164b348919 | 52 | * backend transport. |
MrBedfordVan | 0:b9164b348919 | 53 | * |
MrBedfordVan | 0:b9164b348919 | 54 | * The following API is used to create the singleton interface object. An |
MrBedfordVan | 0:b9164b348919 | 55 | * implementation for this function must be provided by the device-specific |
MrBedfordVan | 0:b9164b348919 | 56 | * library, otherwise there will be a linker error. |
MrBedfordVan | 0:b9164b348919 | 57 | */ |
MrBedfordVan | 0:b9164b348919 | 58 | extern BLEInstanceBase *createBLEInstance(void); |
MrBedfordVan | 0:b9164b348919 | 59 | |
MrBedfordVan | 0:b9164b348919 | 60 | #endif // ifndef __BLE_DEVICE_INSTANCE_BASE__ |