xiao sun / BLE_API

Fork of BLE_API by Bluetooth Low Energy

Committer:
ktownsend
Date:
Mon Dec 16 19:43:33 2013 +0000
Revision:
9:124ae067ae27
Parent:
8:780bfa26d0ee
Child:
14:6ea5d1012a64
Preview code enabling most advertising features (requires new nRF51 firmware)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ktownsend 2:ffc5216bd2cc 1 #ifndef __GAP_ADVERTISING_PARAMS_H__
ktownsend 2:ffc5216bd2cc 2 #define __GAP_ADVERTISING_PARAMS_H__
ktownsend 2:ffc5216bd2cc 3
ktownsend 2:ffc5216bd2cc 4 #include "blecommon.h"
ktownsend 2:ffc5216bd2cc 5
ktownsend 4:50a31ff5f974 6 #define GAP_ADV_PARAMS_INTERVAL_MIN (0x0020)
ktownsend 4:50a31ff5f974 7 #define GAP_ADV_PARAMS_INTERVAL_MAX (0x4000)
ktownsend 4:50a31ff5f974 8 #define GAP_ADV_PARAMS_TIMEOUT_MAX (0x3FFF)
ktownsend 4:50a31ff5f974 9
ktownsend 2:ffc5216bd2cc 10 class GapAdvertisingParams
ktownsend 2:ffc5216bd2cc 11 {
ktownsend 4:50a31ff5f974 12 public:
ktownsend 6:425638944835 13 /* See Bluetooth Core Specification 4.0 (Vol. 6), Part B, Section 2.3.1 */
ktownsend 4:50a31ff5f974 14 /* See Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3 */
ktownsend 6:425638944835 15 enum AdvertisingType
ktownsend 4:50a31ff5f974 16 {
ktownsend 6:425638944835 17 ADV_CONNECTABLE_UNDIRECTED, /**< Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1 */
ktownsend 6:425638944835 18 ADV_CONNECTABLE_DIRECTED, /**< Vol 3, Part C, Section 9.3.3 and Vol 6, Part B, Section 2.3.1.2 */
ktownsend 8:780bfa26d0ee 19 ADV_SCANNABLE_UNDIRECTED, /**< Include support for Scan Response payloads, see Vol 6, Part B, Section 2.3.1.4 */
ktownsend 8:780bfa26d0ee 20 ADV_NON_CONNECTABLE_UNDIRECTED /**< Vol 3, Part C, Section 9.3.2 and Vol 6, Part B, Section 2.3.1.3 */
ktownsend 4:50a31ff5f974 21 };
ktownsend 4:50a31ff5f974 22
ktownsend 6:425638944835 23 GapAdvertisingParams(AdvertisingType advType = GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED,
ktownsend 6:425638944835 24 uint16_t interval = GAP_ADV_PARAMS_INTERVAL_MIN,
ktownsend 4:50a31ff5f974 25 uint16_t timeout = 0);
ktownsend 2:ffc5216bd2cc 26 virtual ~GapAdvertisingParams(void);
ktownsend 7:5e1f0d7f7c7d 27
ktownsend 7:5e1f0d7f7c7d 28 virtual AdvertisingType getAdvertisingType(void);
ktownsend 9:124ae067ae27 29 virtual uint16_t getInterval(void);
ktownsend 9:124ae067ae27 30 virtual uint16_t getTimeout(void);
ktownsend 2:ffc5216bd2cc 31
ktownsend 4:50a31ff5f974 32 private:
ktownsend 6:425638944835 33 AdvertisingType _advType;
ktownsend 2:ffc5216bd2cc 34 uint16_t _interval;
ktownsend 2:ffc5216bd2cc 35 uint16_t _timeout;
ktownsend 2:ffc5216bd2cc 36 };
ktownsend 2:ffc5216bd2cc 37
ktownsend 2:ffc5216bd2cc 38 #endif