High level Bluetooth Low Energy API and radio abstraction layer
Fork of BLE_API by
Revision 6:425638944835, committed 2013-12-13
- Comitter:
- ktownsend
- Date:
- Fri Dec 13 00:41:11 2013 +0000
- Parent:
- 5:7635f81a8e09
- Child:
- 7:5e1f0d7f7c7d
- Commit message:
- More GAP tweeks, still need to integrate Scan Response since it's more important than I thought
Changed in this revision
--- a/GapAdvertisingParams.cpp Thu Dec 12 02:43:22 2013 +0000 +++ b/GapAdvertisingParams.cpp Fri Dec 13 00:41:11 2013 +0000 @@ -8,24 +8,30 @@ /*! @brief Instantiates a new GapAdvertisingParams instance - @param[in] connectionMode - The GAP connection mode to use for this device. Valid - values are defined in \ref ConnectionMode + @param[in] advType + The GAP advertising mode to use for this device. Valid + values are defined in \ref AdvertisingType @para - NON_CONNECTABLE - All connections to the peripheral device - will be refused. + ADV_NON_CONNECTABLE_UNDIRECTED - All connections to the + peripheral device will be refused. @para - DIRECTED_CONNECTABLE - Only connections from a pre-defined - central device will be accepted. + ADV_CONNECTABLE_DIRECTED - Only connections from a + pre-defined central device will be accepted. @para - UNDIRECTED_CONNECTABLE - Any central device can connect to - this peripheral. + ADV_CONNECTABLE_UNDIRECTED - Any central device can connect + to this peripheral. + + @para + ADV_SCANNABLE_UNDIRECTED - Any central device can connect + to this peripheral, and the secondary Scan Response + payload will be included or available to central devices. @note See Bluetooth Core Specification 4.0 (Vol. 3), - Part C, Section 9.3 for further information on GAP + Part C, Section 9.3 and Core Specification 4.0 (Vol. 6), + Part B, Section 2.3.1 for further information on GAP connection modes @param[in] interval @@ -38,7 +44,7 @@ used by the radio due to the higher data transmit rate. @note This field must be set to 0 if connectionMode is equal - to \ref DIRECTED_CONNECTABLE + to \ref ADV_CONNECTABLE_DIRECTED @param[in] timeout Advertising timeout between 0x1 and 0x3FFF (1 and 16383) @@ -51,14 +57,14 @@ @endcode */ /**************************************************************************/ -GapAdvertisingParams::GapAdvertisingParams(ConnectionMode connectionMode, uint16_t interval, uint16_t timeout) +GapAdvertisingParams::GapAdvertisingParams(AdvertisingType advType, uint16_t interval, uint16_t timeout) { - _connectionMode = connectionMode; + _advType = advType; _interval = interval; _timeout = timeout; /* Interval checks */ - if (_connectionMode == DIRECTED_CONNECTABLE) + if (_advType == ADV_CONNECTABLE_DIRECTED) { /* Interval must be 0 in directed connectable mode */ _interval = 0;
--- a/GapAdvertisingParams.h Thu Dec 12 02:43:22 2013 +0000 +++ b/GapAdvertisingParams.h Fri Dec 13 00:41:11 2013 +0000 @@ -10,21 +10,23 @@ class GapAdvertisingParams { public: + /* See Bluetooth Core Specification 4.0 (Vol. 6), Part B, Section 2.3.1 */ /* See Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3 */ - enum ConnectionMode + enum AdvertisingType { - NON_CONNECTABLE, /**< Section 9.3.2 */ - DIRECTED_CONNECTABLE, /**< Section 9.3.3 */ - UNDIRECTED_CONNECTABLE /**< Section 9.3.4 */ + ADV_CONNECTABLE_UNDIRECTED, /**< Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1 */ + ADV_CONNECTABLE_DIRECTED, /**< Vol 3, Part C, Section 9.3.3 and Vol 6, Part B, Section 2.3.1.2 */ + ADV_NON_CONNECTABLE_UNDIRECTED, /**< Vol 3, Part C, Section 9.3.2 and Vol 6, Part B, Section 2.3.1.3 */ + ADV_SCANNABLE_UNDIRECTED /**< Include support for Scan Response payloads, see Vol 6, Part B, Section 2.3.1.4 */ }; - GapAdvertisingParams(ConnectionMode connectionMode = GapAdvertisingParams::UNDIRECTED_CONNECTABLE, - uint16_t interval = GAP_ADV_PARAMS_INTERVAL_MIN, + GapAdvertisingParams(AdvertisingType advType = GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED, + uint16_t interval = GAP_ADV_PARAMS_INTERVAL_MIN, uint16_t timeout = 0); virtual ~GapAdvertisingParams(void); private: - ConnectionMode _connectionMode; + AdvertisingType _advType; uint16_t _interval; uint16_t _timeout; };
--- a/main.cpp Thu Dec 12 02:43:22 2013 +0000 +++ b/main.cpp Fri Dec 13 00:41:11 2013 +0000 @@ -32,7 +32,7 @@ /* Indicate = device (server) sends data when it changes and client confirms reception */ /* GAP Advertising Example (iBeacon) */ -GapAdvertisingParams advParams ( GapAdvertisingParams::NON_CONNECTABLE ); +GapAdvertisingParams advParams ( GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED ); GapAdvertisingData advData; uint8_t iBeaconPayload[25] = { 0x4C, 0x00, 0x02, 0x15, 0xE2, 0x0A, 0x39, 0xF4, 0x73, 0xF5, 0x4B, 0xC4, 0xA1, 0x2F, 0x17, 0xD1, 0xAD, 0x07, 0xA9, 0x61, 0x00, 0x00, 0x00, 0x00, 0xC8 };