![](/media/cache/profiles/5f14615696649541a025d3d0f8e0447f.jpg.50x50_q85.jpg)
テスト用です。
BLE_API/public/GapAdvertisingParams.h@0:8468a4403fea, 2016-10-11 (annotated)
- Committer:
- jksoft
- Date:
- Tue Oct 11 11:09:42 2016 +0000
- Revision:
- 0:8468a4403fea
SB??ver;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:8468a4403fea | 1 | /* mbed Microcontroller Library |
jksoft | 0:8468a4403fea | 2 | * Copyright (c) 2006-2013 ARM Limited |
jksoft | 0:8468a4403fea | 3 | * |
jksoft | 0:8468a4403fea | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jksoft | 0:8468a4403fea | 5 | * you may not use this file except in compliance with the License. |
jksoft | 0:8468a4403fea | 6 | * You may obtain a copy of the License at |
jksoft | 0:8468a4403fea | 7 | * |
jksoft | 0:8468a4403fea | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jksoft | 0:8468a4403fea | 9 | * |
jksoft | 0:8468a4403fea | 10 | * Unless required by applicable law or agreed to in writing, software |
jksoft | 0:8468a4403fea | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jksoft | 0:8468a4403fea | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jksoft | 0:8468a4403fea | 13 | * See the License for the specific language governing permissions and |
jksoft | 0:8468a4403fea | 14 | * limitations under the License. |
jksoft | 0:8468a4403fea | 15 | */ |
jksoft | 0:8468a4403fea | 16 | |
jksoft | 0:8468a4403fea | 17 | #ifndef __GAP_ADVERTISING_PARAMS_H__ |
jksoft | 0:8468a4403fea | 18 | #define __GAP_ADVERTISING_PARAMS_H__ |
jksoft | 0:8468a4403fea | 19 | |
jksoft | 0:8468a4403fea | 20 | /**************************************************************************/ |
jksoft | 0:8468a4403fea | 21 | /*! |
jksoft | 0:8468a4403fea | 22 | \brief |
jksoft | 0:8468a4403fea | 23 | This class provides a wrapper for the core advertising parameters, |
jksoft | 0:8468a4403fea | 24 | including the advertising type (Connectable Undirected, |
jksoft | 0:8468a4403fea | 25 | Non Connectable Undirected, etc.), as well as the advertising and |
jksoft | 0:8468a4403fea | 26 | timeout intervals. |
jksoft | 0:8468a4403fea | 27 | |
jksoft | 0:8468a4403fea | 28 | \par |
jksoft | 0:8468a4403fea | 29 | See the following for more information on advertising types: |
jksoft | 0:8468a4403fea | 30 | |
jksoft | 0:8468a4403fea | 31 | \li \c Bluetooth Core Specification 4.0 (Vol. 6), Part B, Section 2.3.1 |
jksoft | 0:8468a4403fea | 32 | \li \c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3 |
jksoft | 0:8468a4403fea | 33 | */ |
jksoft | 0:8468a4403fea | 34 | /**************************************************************************/ |
jksoft | 0:8468a4403fea | 35 | class GapAdvertisingParams { |
jksoft | 0:8468a4403fea | 36 | public: |
jksoft | 0:8468a4403fea | 37 | static const unsigned GAP_ADV_PARAMS_INTERVAL_MIN = 0x0020; |
jksoft | 0:8468a4403fea | 38 | static const unsigned GAP_ADV_PARAMS_INTERVAL_MIN_NONCON = 0x00A0; |
jksoft | 0:8468a4403fea | 39 | static const unsigned GAP_ADV_PARAMS_INTERVAL_MAX = 0x4000; |
jksoft | 0:8468a4403fea | 40 | static const unsigned GAP_ADV_PARAMS_TIMEOUT_MAX = 0x3FFF; |
jksoft | 0:8468a4403fea | 41 | |
jksoft | 0:8468a4403fea | 42 | /**************************************************************************/ |
jksoft | 0:8468a4403fea | 43 | /*! |
jksoft | 0:8468a4403fea | 44 | \brief |
jksoft | 0:8468a4403fea | 45 | Encapsulates the peripheral advertising modes, which determine how |
jksoft | 0:8468a4403fea | 46 | the device appears to other central devices in hearing range |
jksoft | 0:8468a4403fea | 47 | |
jksoft | 0:8468a4403fea | 48 | \par |
jksoft | 0:8468a4403fea | 49 | See the following for more information on advertising types: |
jksoft | 0:8468a4403fea | 50 | |
jksoft | 0:8468a4403fea | 51 | \li \c Bluetooth Core Specification 4.0 (Vol. 6), Part B, Section 2.3.1 |
jksoft | 0:8468a4403fea | 52 | \li \c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3 |
jksoft | 0:8468a4403fea | 53 | */ |
jksoft | 0:8468a4403fea | 54 | /**************************************************************************/ |
jksoft | 0:8468a4403fea | 55 | enum AdvertisingType { |
jksoft | 0:8468a4403fea | 56 | ADV_CONNECTABLE_UNDIRECTED, /**< Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1 */ |
jksoft | 0:8468a4403fea | 57 | ADV_CONNECTABLE_DIRECTED, /**< Vol 3, Part C, Section 9.3.3 and Vol 6, Part B, Section 2.3.1.2 */ |
jksoft | 0:8468a4403fea | 58 | ADV_SCANNABLE_UNDIRECTED, /**< Include support for Scan Response payloads, see Vol 6, Part B, Section 2.3.1.4 */ |
jksoft | 0:8468a4403fea | 59 | ADV_NON_CONNECTABLE_UNDIRECTED /**< Vol 3, Part C, Section 9.3.2 and Vol 6, Part B, Section 2.3.1.3 */ |
jksoft | 0:8468a4403fea | 60 | }; |
jksoft | 0:8468a4403fea | 61 | |
jksoft | 0:8468a4403fea | 62 | public: |
jksoft | 0:8468a4403fea | 63 | GapAdvertisingParams(AdvertisingType advType = GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED, |
jksoft | 0:8468a4403fea | 64 | uint16_t interval = GAP_ADV_PARAMS_INTERVAL_MIN_NONCON, |
jksoft | 0:8468a4403fea | 65 | uint16_t timeout = 0); |
jksoft | 0:8468a4403fea | 66 | virtual ~GapAdvertisingParams(void); |
jksoft | 0:8468a4403fea | 67 | |
jksoft | 0:8468a4403fea | 68 | AdvertisingType getAdvertisingType(void) const {return _advType; } |
jksoft | 0:8468a4403fea | 69 | uint16_t getInterval(void) const {return _interval;} |
jksoft | 0:8468a4403fea | 70 | uint16_t getTimeout(void) const {return _timeout; } |
jksoft | 0:8468a4403fea | 71 | |
jksoft | 0:8468a4403fea | 72 | void setAdvertisingType(AdvertisingType newAdvType) {_advType = newAdvType; } |
jksoft | 0:8468a4403fea | 73 | void setInterval(uint16_t newInterval) {_interval = newInterval;} |
jksoft | 0:8468a4403fea | 74 | void setTimeout(uint16_t newTimeout) {_timeout = newTimeout; } |
jksoft | 0:8468a4403fea | 75 | |
jksoft | 0:8468a4403fea | 76 | private: |
jksoft | 0:8468a4403fea | 77 | AdvertisingType _advType; |
jksoft | 0:8468a4403fea | 78 | uint16_t _interval; |
jksoft | 0:8468a4403fea | 79 | uint16_t _timeout; |
jksoft | 0:8468a4403fea | 80 | |
jksoft | 0:8468a4403fea | 81 | private: |
jksoft | 0:8468a4403fea | 82 | /* disallow copy constructor */ |
jksoft | 0:8468a4403fea | 83 | GapAdvertisingParams(const GapAdvertisingParams &); |
jksoft | 0:8468a4403fea | 84 | }; |
jksoft | 0:8468a4403fea | 85 | |
jksoft | 0:8468a4403fea | 86 | #endif // ifndef __GAP_ADVERTISING_PARAMS_H__ |