Lightly modified version of the BLE stack, that doesn't bring up a DFUService by default... as we have our own.

Fork of BLE_API by Bluetooth Low Energy

Committer:
rgrover1
Date:
Wed Jan 21 09:32:49 2015 +0000
Revision:
260:ea7f9f14cc15
Parent:
144:c025c8839682
Child:
329:2e082a9c7c13
Synchronized with git rev bec9560c
Author: Rohit Grover
fix all line endings to be Unix style

Who changed what in which revision?

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