テスト用
Fork of nRF51822 by
nRF51Gap.h@3:791d672cbbec, 2014-05-22 (annotated)
- Committer:
- Rohit Grover
- Date:
- Thu May 22 15:03:55 2014 +0100
- Revision:
- 3:791d672cbbec
- Parent:
- 1:f84abedbf4fb
- Child:
- 17:c3e11bb6cb72
adding use of consts for GAP related apis
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* mbed Microcontroller Library |
bogdanm | 0:eff01767de02 | 2 | * Copyright (c) 2006-2013 ARM Limited |
bogdanm | 0:eff01767de02 | 3 | * |
bogdanm | 0:eff01767de02 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
bogdanm | 0:eff01767de02 | 5 | * you may not use this file except in compliance with the License. |
bogdanm | 0:eff01767de02 | 6 | * You may obtain a copy of the License at |
bogdanm | 0:eff01767de02 | 7 | * |
bogdanm | 0:eff01767de02 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
bogdanm | 0:eff01767de02 | 9 | * |
bogdanm | 0:eff01767de02 | 10 | * Unless required by applicable law or agreed to in writing, software |
bogdanm | 0:eff01767de02 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
bogdanm | 0:eff01767de02 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
bogdanm | 0:eff01767de02 | 13 | * See the License for the specific language governing permissions and |
bogdanm | 0:eff01767de02 | 14 | * limitations under the License. |
bogdanm | 0:eff01767de02 | 15 | */ |
bogdanm | 0:eff01767de02 | 16 | |
bogdanm | 0:eff01767de02 | 17 | #ifndef __NRF51822_GAP_H__ |
bogdanm | 0:eff01767de02 | 18 | #define __NRF51822_GAP_H__ |
bogdanm | 0:eff01767de02 | 19 | |
bogdanm | 0:eff01767de02 | 20 | #include "mbed.h" |
bogdanm | 0:eff01767de02 | 21 | #include "blecommon.h" |
mbed_official | 1:f84abedbf4fb | 22 | #include "ble.h" |
bogdanm | 0:eff01767de02 | 23 | #include "GapAdvertisingParams.h" |
bogdanm | 0:eff01767de02 | 24 | #include "GapAdvertisingData.h" |
bogdanm | 0:eff01767de02 | 25 | #include "hw/Gap.h" |
bogdanm | 0:eff01767de02 | 26 | |
bogdanm | 0:eff01767de02 | 27 | /**************************************************************************/ |
bogdanm | 0:eff01767de02 | 28 | /*! |
bogdanm | 0:eff01767de02 | 29 | \brief |
bogdanm | 0:eff01767de02 | 30 | |
bogdanm | 0:eff01767de02 | 31 | */ |
bogdanm | 0:eff01767de02 | 32 | /**************************************************************************/ |
bogdanm | 0:eff01767de02 | 33 | class nRF51Gap : public Gap |
bogdanm | 0:eff01767de02 | 34 | { |
bogdanm | 0:eff01767de02 | 35 | public: |
bogdanm | 0:eff01767de02 | 36 | static nRF51Gap& getInstance() |
bogdanm | 0:eff01767de02 | 37 | { |
bogdanm | 0:eff01767de02 | 38 | static nRF51Gap m_instance; |
bogdanm | 0:eff01767de02 | 39 | return m_instance; |
bogdanm | 0:eff01767de02 | 40 | } |
bogdanm | 0:eff01767de02 | 41 | |
bogdanm | 0:eff01767de02 | 42 | /* Functions that must be implemented from Gap */ |
Rohit Grover |
3:791d672cbbec | 43 | virtual ble_error_t setAddress(addr_type_t type, |
Rohit Grover |
3:791d672cbbec | 44 | const uint8_t address[6]); |
Rohit Grover |
3:791d672cbbec | 45 | virtual ble_error_t setAdvertisingData(const GapAdvertisingData &, |
Rohit Grover |
3:791d672cbbec | 46 | const GapAdvertisingData &); |
Rohit Grover |
3:791d672cbbec | 47 | virtual ble_error_t startAdvertising(const GapAdvertisingParams &); |
bogdanm | 0:eff01767de02 | 48 | virtual ble_error_t stopAdvertising(void); |
bogdanm | 0:eff01767de02 | 49 | virtual ble_error_t disconnect(void); |
bogdanm | 0:eff01767de02 | 50 | |
mbed_official | 1:f84abedbf4fb | 51 | void setConnectionHandle(uint16_t con_handle); |
mbed_official | 1:f84abedbf4fb | 52 | uint16_t getConnectionHandle(void); |
mbed_official | 1:f84abedbf4fb | 53 | |
bogdanm | 0:eff01767de02 | 54 | private: |
mbed_official | 1:f84abedbf4fb | 55 | uint16_t m_connectionHandle; |
mbed_official | 1:f84abedbf4fb | 56 | nRF51Gap() { m_connectionHandle = BLE_CONN_HANDLE_INVALID; }; |
bogdanm | 0:eff01767de02 | 57 | nRF51Gap(nRF51Gap const&); |
bogdanm | 0:eff01767de02 | 58 | void operator=(nRF51Gap const&); |
bogdanm | 0:eff01767de02 | 59 | }; |
bogdanm | 0:eff01767de02 | 60 | |
bogdanm | 0:eff01767de02 | 61 | #endif |