keisuke Yoshida
/
BLE_WallbotBLE_Challenge_byYUTAKA
under constructiong
Fork of BLE_WallbotBLE_Challenge by
nRF51822/nRF51Gap.h@4:951fabc31ba6, 2018-06-11 (annotated)
- Committer:
- Keisuke_Yoshida
- Date:
- Mon Jun 11 06:51:49 2018 +0000
- Revision:
- 4:951fabc31ba6
- Parent:
- 0:76dfa9657d9d
firstcmit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:76dfa9657d9d | 1 | /* mbed Microcontroller Library |
jksoft | 0:76dfa9657d9d | 2 | * Copyright (c) 2006-2013 ARM Limited |
jksoft | 0:76dfa9657d9d | 3 | * |
jksoft | 0:76dfa9657d9d | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jksoft | 0:76dfa9657d9d | 5 | * you may not use this file except in compliance with the License. |
jksoft | 0:76dfa9657d9d | 6 | * You may obtain a copy of the License at |
jksoft | 0:76dfa9657d9d | 7 | * |
jksoft | 0:76dfa9657d9d | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jksoft | 0:76dfa9657d9d | 9 | * |
jksoft | 0:76dfa9657d9d | 10 | * Unless required by applicable law or agreed to in writing, software |
jksoft | 0:76dfa9657d9d | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jksoft | 0:76dfa9657d9d | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jksoft | 0:76dfa9657d9d | 13 | * See the License for the specific language governing permissions and |
jksoft | 0:76dfa9657d9d | 14 | * limitations under the License. |
jksoft | 0:76dfa9657d9d | 15 | */ |
jksoft | 0:76dfa9657d9d | 16 | |
jksoft | 0:76dfa9657d9d | 17 | #ifndef __NRF51822_GAP_H__ |
jksoft | 0:76dfa9657d9d | 18 | #define __NRF51822_GAP_H__ |
jksoft | 0:76dfa9657d9d | 19 | |
jksoft | 0:76dfa9657d9d | 20 | #include "mbed.h" |
jksoft | 0:76dfa9657d9d | 21 | #include "blecommon.h" |
jksoft | 0:76dfa9657d9d | 22 | #include "ble.h" |
jksoft | 0:76dfa9657d9d | 23 | #include "GapAdvertisingParams.h" |
jksoft | 0:76dfa9657d9d | 24 | #include "GapAdvertisingData.h" |
jksoft | 0:76dfa9657d9d | 25 | #include "public/Gap.h" |
jksoft | 0:76dfa9657d9d | 26 | |
jksoft | 0:76dfa9657d9d | 27 | /**************************************************************************/ |
jksoft | 0:76dfa9657d9d | 28 | /*! |
jksoft | 0:76dfa9657d9d | 29 | \brief |
jksoft | 0:76dfa9657d9d | 30 | |
jksoft | 0:76dfa9657d9d | 31 | */ |
jksoft | 0:76dfa9657d9d | 32 | /**************************************************************************/ |
jksoft | 0:76dfa9657d9d | 33 | class nRF51Gap : public Gap |
jksoft | 0:76dfa9657d9d | 34 | { |
jksoft | 0:76dfa9657d9d | 35 | public: |
jksoft | 0:76dfa9657d9d | 36 | static nRF51Gap &getInstance() { |
jksoft | 0:76dfa9657d9d | 37 | static nRF51Gap m_instance; |
jksoft | 0:76dfa9657d9d | 38 | return m_instance; |
jksoft | 0:76dfa9657d9d | 39 | } |
jksoft | 0:76dfa9657d9d | 40 | |
jksoft | 0:76dfa9657d9d | 41 | /* Functions that must be implemented from Gap */ |
jksoft | 0:76dfa9657d9d | 42 | virtual ble_error_t setAddress(addr_type_t type, |
jksoft | 0:76dfa9657d9d | 43 | const uint8_t address[6]); |
jksoft | 0:76dfa9657d9d | 44 | virtual ble_error_t setAdvertisingData(const GapAdvertisingData &, |
jksoft | 0:76dfa9657d9d | 45 | const GapAdvertisingData &); |
jksoft | 0:76dfa9657d9d | 46 | virtual ble_error_t startAdvertising(const GapAdvertisingParams &); |
jksoft | 0:76dfa9657d9d | 47 | virtual ble_error_t stopAdvertising(void); |
jksoft | 0:76dfa9657d9d | 48 | virtual ble_error_t disconnect(DisconnectionReason_t reason); |
jksoft | 0:76dfa9657d9d | 49 | |
jksoft | 0:76dfa9657d9d | 50 | virtual ble_error_t setDeviceName(const uint8_t *deviceName); |
jksoft | 0:76dfa9657d9d | 51 | virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP); |
jksoft | 0:76dfa9657d9d | 52 | virtual ble_error_t setAppearance(uint16_t appearance); |
jksoft | 0:76dfa9657d9d | 53 | virtual ble_error_t getAppearance(uint16_t *appearanceP); |
jksoft | 0:76dfa9657d9d | 54 | |
jksoft | 0:76dfa9657d9d | 55 | void setConnectionHandle(uint16_t con_handle); |
jksoft | 0:76dfa9657d9d | 56 | uint16_t getConnectionHandle(void); |
jksoft | 0:76dfa9657d9d | 57 | |
jksoft | 0:76dfa9657d9d | 58 | virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params); |
jksoft | 0:76dfa9657d9d | 59 | virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params); |
jksoft | 0:76dfa9657d9d | 60 | virtual ble_error_t updateConnectionParams(Handle_t handle, const ConnectionParams_t *params); |
jksoft | 0:76dfa9657d9d | 61 | |
jksoft | 0:76dfa9657d9d | 62 | private: |
jksoft | 0:76dfa9657d9d | 63 | uint16_t m_connectionHandle; |
jksoft | 0:76dfa9657d9d | 64 | nRF51Gap() { |
jksoft | 0:76dfa9657d9d | 65 | m_connectionHandle = BLE_CONN_HANDLE_INVALID; |
jksoft | 0:76dfa9657d9d | 66 | } |
jksoft | 0:76dfa9657d9d | 67 | |
jksoft | 0:76dfa9657d9d | 68 | nRF51Gap(nRF51Gap const &); |
jksoft | 0:76dfa9657d9d | 69 | void operator=(nRF51Gap const &); |
jksoft | 0:76dfa9657d9d | 70 | }; |
jksoft | 0:76dfa9657d9d | 71 | |
jksoft | 0:76dfa9657d9d | 72 | #endif // ifndef __NRF51822_GAP_H__ |