BLE API as used in the blog entry.

Dependents:   BLE_iBeacon_Exercise

Fork of BLE_API_Native by Kevin Townsend

Committer:
ktownsend
Date:
Thu Feb 06 11:51:06 2014 +0000
Revision:
0:4c3097c65247
Native mode drivers

Who changed what in which revision?

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