test code 123
Fork of LinkNode-Test by
nRF51822_Science_Journal/nRF51822/source/nRF5xn.h@0:1ad0e04b1bc5, 2016-09-01 (annotated)
- Committer:
- youkee
- Date:
- Thu Sep 01 05:14:03 2016 +0000
- Revision:
- 0:1ad0e04b1bc5
change internal time from 1s to 200ms
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
youkee | 0:1ad0e04b1bc5 | 1 | /* mbed Microcontroller Library |
youkee | 0:1ad0e04b1bc5 | 2 | * Copyright (c) 2006-2013 ARM Limited |
youkee | 0:1ad0e04b1bc5 | 3 | * |
youkee | 0:1ad0e04b1bc5 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
youkee | 0:1ad0e04b1bc5 | 5 | * you may not use this file except in compliance with the License. |
youkee | 0:1ad0e04b1bc5 | 6 | * You may obtain a copy of the License at |
youkee | 0:1ad0e04b1bc5 | 7 | * |
youkee | 0:1ad0e04b1bc5 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
youkee | 0:1ad0e04b1bc5 | 9 | * |
youkee | 0:1ad0e04b1bc5 | 10 | * Unless required by applicable law or agreed to in writing, software |
youkee | 0:1ad0e04b1bc5 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
youkee | 0:1ad0e04b1bc5 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
youkee | 0:1ad0e04b1bc5 | 13 | * See the License for the specific language governing permissions and |
youkee | 0:1ad0e04b1bc5 | 14 | * limitations under the License. |
youkee | 0:1ad0e04b1bc5 | 15 | */ |
youkee | 0:1ad0e04b1bc5 | 16 | |
youkee | 0:1ad0e04b1bc5 | 17 | #ifndef __NRF51822_H__ |
youkee | 0:1ad0e04b1bc5 | 18 | #define __NRF51822_H__ |
youkee | 0:1ad0e04b1bc5 | 19 | |
youkee | 0:1ad0e04b1bc5 | 20 | #include "ble/BLE.h" |
youkee | 0:1ad0e04b1bc5 | 21 | #include "ble/blecommon.h" |
youkee | 0:1ad0e04b1bc5 | 22 | #include "ble/BLEInstanceBase.h" |
youkee | 0:1ad0e04b1bc5 | 23 | |
youkee | 0:1ad0e04b1bc5 | 24 | #include "nRF5xGap.h" |
youkee | 0:1ad0e04b1bc5 | 25 | #include "nRF5xGattServer.h" |
youkee | 0:1ad0e04b1bc5 | 26 | #include "nRF5xGattClient.h" |
youkee | 0:1ad0e04b1bc5 | 27 | #include "nRF5xSecurityManager.h" |
youkee | 0:1ad0e04b1bc5 | 28 | |
youkee | 0:1ad0e04b1bc5 | 29 | #include "btle.h" |
youkee | 0:1ad0e04b1bc5 | 30 | |
youkee | 0:1ad0e04b1bc5 | 31 | class nRF5xn : public BLEInstanceBase |
youkee | 0:1ad0e04b1bc5 | 32 | { |
youkee | 0:1ad0e04b1bc5 | 33 | public: |
youkee | 0:1ad0e04b1bc5 | 34 | nRF5xn(void); |
youkee | 0:1ad0e04b1bc5 | 35 | virtual ~nRF5xn(void); |
youkee | 0:1ad0e04b1bc5 | 36 | |
youkee | 0:1ad0e04b1bc5 | 37 | virtual ble_error_t init(BLE::InstanceID_t instanceID, FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> callback); |
youkee | 0:1ad0e04b1bc5 | 38 | virtual bool hasInitialized(void) const { |
youkee | 0:1ad0e04b1bc5 | 39 | return initialized; |
youkee | 0:1ad0e04b1bc5 | 40 | } |
youkee | 0:1ad0e04b1bc5 | 41 | virtual ble_error_t shutdown(void); |
youkee | 0:1ad0e04b1bc5 | 42 | virtual const char *getVersion(void); |
youkee | 0:1ad0e04b1bc5 | 43 | |
youkee | 0:1ad0e04b1bc5 | 44 | virtual Gap &getGap() { |
youkee | 0:1ad0e04b1bc5 | 45 | return nRF5xGap::getInstance(); |
youkee | 0:1ad0e04b1bc5 | 46 | }; |
youkee | 0:1ad0e04b1bc5 | 47 | virtual const Gap &getGap() const { |
youkee | 0:1ad0e04b1bc5 | 48 | return nRF5xGap::getInstance(); |
youkee | 0:1ad0e04b1bc5 | 49 | }; |
youkee | 0:1ad0e04b1bc5 | 50 | virtual GattServer &getGattServer() { |
youkee | 0:1ad0e04b1bc5 | 51 | return nRF5xGattServer::getInstance(); |
youkee | 0:1ad0e04b1bc5 | 52 | }; |
youkee | 0:1ad0e04b1bc5 | 53 | virtual const GattServer &getGattServer() const { |
youkee | 0:1ad0e04b1bc5 | 54 | return nRF5xGattServer::getInstance(); |
youkee | 0:1ad0e04b1bc5 | 55 | }; |
youkee | 0:1ad0e04b1bc5 | 56 | virtual GattClient &getGattClient() { |
youkee | 0:1ad0e04b1bc5 | 57 | return nRF5xGattClient::getInstance(); |
youkee | 0:1ad0e04b1bc5 | 58 | } |
youkee | 0:1ad0e04b1bc5 | 59 | virtual const SecurityManager &getSecurityManager() const { |
youkee | 0:1ad0e04b1bc5 | 60 | return nRF5xSecurityManager::getInstance(); |
youkee | 0:1ad0e04b1bc5 | 61 | } |
youkee | 0:1ad0e04b1bc5 | 62 | virtual SecurityManager &getSecurityManager() { |
youkee | 0:1ad0e04b1bc5 | 63 | return nRF5xSecurityManager::getInstance(); |
youkee | 0:1ad0e04b1bc5 | 64 | } |
youkee | 0:1ad0e04b1bc5 | 65 | virtual void waitForEvent(void); |
youkee | 0:1ad0e04b1bc5 | 66 | |
youkee | 0:1ad0e04b1bc5 | 67 | private: |
youkee | 0:1ad0e04b1bc5 | 68 | bool initialized; |
youkee | 0:1ad0e04b1bc5 | 69 | BLE::InstanceID_t instanceID; |
youkee | 0:1ad0e04b1bc5 | 70 | }; |
youkee | 0:1ad0e04b1bc5 | 71 | |
youkee | 0:1ad0e04b1bc5 | 72 | #endif |