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:
Fri Nov 21 09:23:24 2014 +0000
Revision:
144:c025c8839682
Parent:
140:407d134c179d
Child:
260:ea7f9f14cc15
Synchronized with git rev 3d8441e2
Author: Rohit Grover
minor cleanup of public API classes.

Who changed what in which revision?

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