MicroBit as BLE gamepad
Fork of nRF51822 by
source/nRF5xn.h@571:bbf6410b6a89, 2016-01-11 (annotated)
- Committer:
- vcoubard
- Date:
- Mon Jan 11 10:19:22 2016 +0000
- Revision:
- 571:bbf6410b6a89
- Parent:
- 570:f162898cb6c4
- Child:
- 575:7023a8204a1b
Synchronized with git rev 752e2ba4
Author: Rohit Grover
Merge pull request #88 from rgrover/develop
follow the extraction of address related types from Gap.h into BLEProtocol.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vcoubard | 565:cf03471a4ec4 | 1 | /* mbed Microcontroller Library |
vcoubard | 565:cf03471a4ec4 | 2 | * Copyright (c) 2006-2013 ARM Limited |
vcoubard | 565:cf03471a4ec4 | 3 | * |
vcoubard | 565:cf03471a4ec4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
vcoubard | 565:cf03471a4ec4 | 5 | * you may not use this file except in compliance with the License. |
vcoubard | 565:cf03471a4ec4 | 6 | * You may obtain a copy of the License at |
vcoubard | 565:cf03471a4ec4 | 7 | * |
vcoubard | 565:cf03471a4ec4 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
vcoubard | 565:cf03471a4ec4 | 9 | * |
vcoubard | 565:cf03471a4ec4 | 10 | * Unless required by applicable law or agreed to in writing, software |
vcoubard | 565:cf03471a4ec4 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
vcoubard | 565:cf03471a4ec4 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
vcoubard | 565:cf03471a4ec4 | 13 | * See the License for the specific language governing permissions and |
vcoubard | 565:cf03471a4ec4 | 14 | * limitations under the License. |
vcoubard | 565:cf03471a4ec4 | 15 | */ |
vcoubard | 565:cf03471a4ec4 | 16 | |
vcoubard | 565:cf03471a4ec4 | 17 | #ifndef __NRF51822_H__ |
vcoubard | 565:cf03471a4ec4 | 18 | #define __NRF51822_H__ |
vcoubard | 565:cf03471a4ec4 | 19 | |
vcoubard | 565:cf03471a4ec4 | 20 | #include "ble/BLE.h" |
vcoubard | 565:cf03471a4ec4 | 21 | #include "ble/blecommon.h" |
vcoubard | 565:cf03471a4ec4 | 22 | #include "ble/BLEInstanceBase.h" |
vcoubard | 565:cf03471a4ec4 | 23 | |
vcoubard | 565:cf03471a4ec4 | 24 | #include "nRF5xGap.h" |
vcoubard | 565:cf03471a4ec4 | 25 | #include "nRF5xGattServer.h" |
vcoubard | 565:cf03471a4ec4 | 26 | #include "nRF5xGattClient.h" |
vcoubard | 565:cf03471a4ec4 | 27 | #include "nRF5xSecurityManager.h" |
vcoubard | 565:cf03471a4ec4 | 28 | |
vcoubard | 565:cf03471a4ec4 | 29 | #include "btle.h" |
vcoubard | 565:cf03471a4ec4 | 30 | |
vcoubard | 565:cf03471a4ec4 | 31 | class nRF5xn : public BLEInstanceBase |
vcoubard | 565:cf03471a4ec4 | 32 | { |
vcoubard | 565:cf03471a4ec4 | 33 | public: |
vcoubard | 565:cf03471a4ec4 | 34 | nRF5xn(void); |
vcoubard | 565:cf03471a4ec4 | 35 | virtual ~nRF5xn(void); |
vcoubard | 565:cf03471a4ec4 | 36 | |
vcoubard | 565:cf03471a4ec4 | 37 | virtual ble_error_t init(BLE::InstanceID_t instanceID, FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> callback); |
vcoubard | 565:cf03471a4ec4 | 38 | virtual bool hasInitialized(void) const { |
vcoubard | 565:cf03471a4ec4 | 39 | return initialized; |
vcoubard | 565:cf03471a4ec4 | 40 | } |
vcoubard | 565:cf03471a4ec4 | 41 | virtual ble_error_t shutdown(void); |
vcoubard | 565:cf03471a4ec4 | 42 | virtual const char *getVersion(void); |
vcoubard | 565:cf03471a4ec4 | 43 | |
vcoubard | 565:cf03471a4ec4 | 44 | virtual Gap &getGap() { |
vcoubard | 571:bbf6410b6a89 | 45 | return nRF5xGap::getInstance(); |
vcoubard | 570:f162898cb6c4 | 46 | }; |
vcoubard | 571:bbf6410b6a89 | 47 | virtual const Gap &getGap() const { |
vcoubard | 571:bbf6410b6a89 | 48 | return nRF5xGap::getInstance(); |
vcoubard | 571:bbf6410b6a89 | 49 | }; |
vcoubard | 570:f162898cb6c4 | 50 | virtual GattServer &getGattServer() { |
vcoubard | 571:bbf6410b6a89 | 51 | return nRF5xGattServer::getInstance(); |
vcoubard | 565:cf03471a4ec4 | 52 | }; |
vcoubard | 571:bbf6410b6a89 | 53 | virtual const GattServer &getGattServer() const { |
vcoubard | 571:bbf6410b6a89 | 54 | return nRF5xGattServer::getInstance(); |
vcoubard | 571:bbf6410b6a89 | 55 | }; |
vcoubard | 570:f162898cb6c4 | 56 | virtual GattClient &getGattClient() { |
vcoubard | 571:bbf6410b6a89 | 57 | return nRF5xGattClient::getInstance(); |
vcoubard | 570:f162898cb6c4 | 58 | } |
vcoubard | 565:cf03471a4ec4 | 59 | virtual const SecurityManager &getSecurityManager() const { |
vcoubard | 571:bbf6410b6a89 | 60 | return nRF5xSecurityManager::getInstance(); |
vcoubard | 565:cf03471a4ec4 | 61 | } |
vcoubard | 571:bbf6410b6a89 | 62 | virtual SecurityManager &getSecurityManager() { |
vcoubard | 571:bbf6410b6a89 | 63 | return nRF5xSecurityManager::getInstance(); |
vcoubard | 571:bbf6410b6a89 | 64 | } |
vcoubard | 565:cf03471a4ec4 | 65 | virtual void waitForEvent(void); |
vcoubard | 565:cf03471a4ec4 | 66 | |
vcoubard | 565:cf03471a4ec4 | 67 | private: |
vcoubard | 565:cf03471a4ec4 | 68 | bool initialized; |
vcoubard | 565:cf03471a4ec4 | 69 | BLE::InstanceID_t instanceID; |
vcoubard | 565:cf03471a4ec4 | 70 | }; |
vcoubard | 565:cf03471a4ec4 | 71 | |
rgrover1 | 388:db85a09c27ef | 72 | #endif |