Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
GapAdvertisingParams.h@34:da2ea8cd6216, 2014-05-21 (annotated)
- Committer:
- Rohit Grover
- Date:
- Wed May 21 15:01:14 2014 +0100
- Revision:
- 34:da2ea8cd6216
- Parent:
- 27:4a83843f04b0
- Child:
- 40:d405c9b1419d
white space diffs; generated using uncrustify
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ktownsend | 27:4a83843f04b0 | 1 | /* mbed Microcontroller Library |
| ktownsend | 27:4a83843f04b0 | 2 | * Copyright (c) 2006-2013 ARM Limited |
| ktownsend | 27:4a83843f04b0 | 3 | * |
| ktownsend | 27:4a83843f04b0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| ktownsend | 27:4a83843f04b0 | 5 | * you may not use this file except in compliance with the License. |
| ktownsend | 27:4a83843f04b0 | 6 | * You may obtain a copy of the License at |
| ktownsend | 27:4a83843f04b0 | 7 | * |
| ktownsend | 27:4a83843f04b0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| ktownsend | 27:4a83843f04b0 | 9 | * |
| ktownsend | 27:4a83843f04b0 | 10 | * Unless required by applicable law or agreed to in writing, software |
| ktownsend | 27:4a83843f04b0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| ktownsend | 27:4a83843f04b0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| ktownsend | 27:4a83843f04b0 | 13 | * See the License for the specific language governing permissions and |
| ktownsend | 27:4a83843f04b0 | 14 | * limitations under the License. |
| ktownsend | 27:4a83843f04b0 | 15 | */ |
| Rohit Grover |
34:da2ea8cd6216 | 16 | |
| ktownsend | 2:ffc5216bd2cc | 17 | #ifndef __GAP_ADVERTISING_PARAMS_H__ |
| ktownsend | 2:ffc5216bd2cc | 18 | #define __GAP_ADVERTISING_PARAMS_H__ |
| ktownsend | 2:ffc5216bd2cc | 19 | |
| ktownsend | 2:ffc5216bd2cc | 20 | #include "blecommon.h" |
| ktownsend | 2:ffc5216bd2cc | 21 | |
| ktownsend | 14:6ea5d1012a64 | 22 | #define GAP_ADV_PARAMS_INTERVAL_MIN (0x0020) |
| ktownsend | 14:6ea5d1012a64 | 23 | #define GAP_ADV_PARAMS_INTERVAL_MIN_NONCON (0x00A0) |
| ktownsend | 14:6ea5d1012a64 | 24 | #define GAP_ADV_PARAMS_INTERVAL_MAX (0x1000) |
| ktownsend | 14:6ea5d1012a64 | 25 | #define GAP_ADV_PARAMS_TIMEOUT_MAX (0x3FFF) |
| ktownsend | 4:50a31ff5f974 | 26 | |
| ktownsend | 18:86fe1e247a54 | 27 | /**************************************************************************/ |
| ktownsend | 18:86fe1e247a54 | 28 | /*! |
| ktownsend | 18:86fe1e247a54 | 29 | \brief |
| ktownsend | 18:86fe1e247a54 | 30 | This class provides a wrapper for the core advertising parameters, |
| ktownsend | 18:86fe1e247a54 | 31 | including the advertising type (Connectable Undirected, |
| ktownsend | 18:86fe1e247a54 | 32 | Non Connectable Undirected, etc.), as well as the advertising and |
| ktownsend | 18:86fe1e247a54 | 33 | timeout intervals. |
| ktownsend | 18:86fe1e247a54 | 34 | |
| ktownsend | 18:86fe1e247a54 | 35 | \par |
| ktownsend | 18:86fe1e247a54 | 36 | See the following for more information on advertising types: |
| Rohit Grover |
34:da2ea8cd6216 | 37 | |
| ktownsend | 18:86fe1e247a54 | 38 | \li \c Bluetooth Core Specification 4.0 (Vol. 6), Part B, Section 2.3.1 |
| ktownsend | 18:86fe1e247a54 | 39 | \li \c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3 |
| ktownsend | 18:86fe1e247a54 | 40 | |
| ktownsend | 18:86fe1e247a54 | 41 | \par EXAMPLE |
| Rohit Grover |
34:da2ea8cd6216 | 42 | |
| ktownsend | 18:86fe1e247a54 | 43 | \code |
| Rohit Grover |
34:da2ea8cd6216 | 44 | |
| ktownsend | 18:86fe1e247a54 | 45 | // ToDo |
| Rohit Grover |
34:da2ea8cd6216 | 46 | |
| ktownsend | 18:86fe1e247a54 | 47 | \endcode |
| ktownsend | 18:86fe1e247a54 | 48 | */ |
| ktownsend | 18:86fe1e247a54 | 49 | /**************************************************************************/ |
| ktownsend | 2:ffc5216bd2cc | 50 | class GapAdvertisingParams |
| ktownsend | 2:ffc5216bd2cc | 51 | { |
| Rohit Grover |
34:da2ea8cd6216 | 52 | public: |
| ktownsend | 21:5442f7c70e71 | 53 | /**************************************************************************/ |
| ktownsend | 21:5442f7c70e71 | 54 | /*! |
| ktownsend | 21:5442f7c70e71 | 55 | \brief |
| ktownsend | 21:5442f7c70e71 | 56 | Encapsulates the peripheral advertising modes, which determine how |
| ktownsend | 21:5442f7c70e71 | 57 | the device appears to other central devices in hearing range |
| ktownsend | 21:5442f7c70e71 | 58 | |
| ktownsend | 21:5442f7c70e71 | 59 | \par |
| ktownsend | 21:5442f7c70e71 | 60 | See the following for more information on advertising types: |
| Rohit Grover |
34:da2ea8cd6216 | 61 | |
| ktownsend | 21:5442f7c70e71 | 62 | \li \c Bluetooth Core Specification 4.0 (Vol. 6), Part B, Section 2.3.1 |
| ktownsend | 21:5442f7c70e71 | 63 | \li \c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3 |
| ktownsend | 21:5442f7c70e71 | 64 | */ |
| ktownsend | 21:5442f7c70e71 | 65 | /**************************************************************************/ |
| ktownsend | 6:425638944835 | 66 | enum AdvertisingType |
| ktownsend | 4:50a31ff5f974 | 67 | { |
| Rohit Grover |
34:da2ea8cd6216 | 68 | ADV_CONNECTABLE_UNDIRECTED, /**< Vol 3, Part C, Section 9.3.4 and |
| Rohit Grover |
34:da2ea8cd6216 | 69 | *Vol 6, Part B, Section 2.3.1.1 */ |
| Rohit Grover |
34:da2ea8cd6216 | 70 | ADV_CONNECTABLE_DIRECTED, /**< Vol 3, Part C, Section 9.3.3 and |
| Rohit Grover |
34:da2ea8cd6216 | 71 | *Vol 6, Part B, Section 2.3.1.2 */ |
| Rohit Grover |
34:da2ea8cd6216 | 72 | ADV_SCANNABLE_UNDIRECTED, /**< Include support for Scan Response |
| Rohit Grover |
34:da2ea8cd6216 | 73 | *payloads, see Vol 6, Part B, Section |
| Rohit Grover |
34:da2ea8cd6216 | 74 | *2.3.1.4 */ |
| Rohit Grover |
34:da2ea8cd6216 | 75 | ADV_NON_CONNECTABLE_UNDIRECTED /**< Vol 3, Part C, Section 9.3.2 and |
| Rohit Grover |
34:da2ea8cd6216 | 76 | *Vol 6, Part B, Section 2.3.1.3 */ |
| ktownsend | 4:50a31ff5f974 | 77 | }; |
| Rohit Grover |
34:da2ea8cd6216 | 78 | |
| Rohit Grover |
34:da2ea8cd6216 | 79 | GapAdvertisingParams( |
| Rohit Grover |
34:da2ea8cd6216 | 80 | AdvertisingType advType = |
| Rohit Grover |
34:da2ea8cd6216 | 81 | GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED, |
| Rohit Grover |
34:da2ea8cd6216 | 82 | uint16_t interval = |
| Rohit Grover |
34:da2ea8cd6216 | 83 | GAP_ADV_PARAMS_INTERVAL_MIN_NONCON, |
| Rohit Grover |
34:da2ea8cd6216 | 84 | uint16_t timeout = 0); |
| ktownsend | 2:ffc5216bd2cc | 85 | virtual ~GapAdvertisingParams(void); |
| Rohit Grover |
34:da2ea8cd6216 | 86 | |
| ktownsend | 7:5e1f0d7f7c7d | 87 | virtual AdvertisingType getAdvertisingType(void); |
| ktownsend | 9:124ae067ae27 | 88 | virtual uint16_t getInterval(void); |
| ktownsend | 9:124ae067ae27 | 89 | virtual uint16_t getTimeout(void); |
| ktownsend | 2:ffc5216bd2cc | 90 | |
| Rohit Grover |
34:da2ea8cd6216 | 91 | private: |
| Rohit Grover |
34:da2ea8cd6216 | 92 | AdvertisingType _advType; |
| Rohit Grover |
34:da2ea8cd6216 | 93 | uint16_t _interval; |
| Rohit Grover |
34:da2ea8cd6216 | 94 | uint16_t _timeout; |
| ktownsend | 2:ffc5216bd2cc | 95 | }; |
| ktownsend | 2:ffc5216bd2cc | 96 | |
| Rohit Grover |
34:da2ea8cd6216 | 97 | #endif // ifndef __GAP_ADVERTISING_PARAMS_H__ |
