High level Bluetooth Low Energy API and radio abstraction layer
Fork of BLE_API by
Revision 18:86fe1e247a54, committed 2013-12-18
- Comitter:
- ktownsend
- Date:
- Wed Dec 18 19:39:19 2013 +0000
- Parent:
- 17:9eb2b6fbbda9
- Child:
- 19:a6f33421746c
- Commit message:
- Doxygen Cleanup
Changed in this revision
--- a/GapAdvertisingData.cpp Wed Dec 18 19:15:07 2013 +0000 +++ b/GapAdvertisingData.cpp Wed Dec 18 19:39:19 2013 +0000 @@ -5,13 +5,13 @@ /**************************************************************************/ /*! - @brief Creates a new GapAdvertisingData instance + \brief Creates a new GapAdvertisingData instance - @section EXAMPLE + \par EXAMPLE - @code + \code - @endcode + \endcode */ /**************************************************************************/ GapAdvertisingData::GapAdvertisingData(void) @@ -31,27 +31,27 @@ /**************************************************************************/ /*! - @brief Adds advertising data based on the specified AD type (see - \ref DataType) + \brief Adds advertising data based on the specified AD type (see + DataType) - @args[in] advDataType The Advertising \ref DataType to add - @args[in] payload Pointer to the payload contents - @args[in] len Size of the payload in bytes + \args[in] advDataType The Advertising 'DataType' to add + \args[in] payload Pointer to the payload contents + \args[in] len Size of the payload in bytes - @returns ble_error_t + \returns ble_error_t - @retval BLE_ERROR_NONE + \retval BLE_ERROR_NONE Everything executed properly - @retval BLE_ERROR_BUFFER_OVERFLOW + \retval BLE_ERROR_BUFFER_OVERFLOW The specified data would cause the advertising buffer to overflow - @section EXAMPLE + \par EXAMPLE - @code + \code - @endcode + \endcode */ /**************************************************************************/ ble_error_t GapAdvertisingData::addData(DataType advDataType, uint8_t * payload, uint8_t len) @@ -80,25 +80,25 @@ /**************************************************************************/ /*! - @brief Helper function to add \ref APPEARANCE data to the advertising + \brief Helper function to add APPEARANCE data to the advertising payload - @args[in] appearance The \ref APPEARANCE value to add + \args[in] appearance The APPEARANCE value to add - @returns ble_error_t + \returns ble_error_t - @retval BLE_ERROR_NONE + \retval BLE_ERROR_NONE Everything executed properly - @retval BLE_ERROR_BUFFER_OVERFLOW + \retval BLE_ERROR_BUFFER_OVERFLOW The specified data would cause the advertising buffer to overflow - @section EXAMPLE + \par EXAMPLE - @code + \code - @endcode + \endcode */ /**************************************************************************/ ble_error_t GapAdvertisingData::addAppearance(Appearance appearance) @@ -108,37 +108,36 @@ /**************************************************************************/ /*! - @brief Helper function to add \ref FLAGS data to the advertising + \brief Helper function to add FLAGS data to the advertising payload - @args[in] flag The \ref FLAGS value to add + \args[in] flag The FLAGS value to add - @para - \ref LE_LIMITED_DISCOVERABLE - The peripheral is - discoverable for a limited period of time + \par LE_LIMITED_DISCOVERABLE + The peripheral is discoverable for a limited period of + time - @para - \ref LE_GENERAL_DISCOVERABLE - The peripheral is - permanently discoverable + \par LE_GENERAL_DISCOVERABLE + The peripheral is permanently discoverable - @para - \ref BREDR_NOT_SUPPORTED - This peripheral is a - Bluetooth Low Energy only device (no EDR support) + \par BREDR_NOT_SUPPORTED + This peripheral is a Bluetooth Low Energy only device + (no EDR support) - @returns ble_error_t + \returns ble_error_t - @retval BLE_ERROR_NONE + \retval BLE_ERROR_NONE Everything executed properly - @retval BLE_ERROR_BUFFER_OVERFLOW + \retval BLE_ERROR_BUFFER_OVERFLOW The specified data would cause the advertising buffer to overflow - @section EXAMPLE + \par EXAMPLE - @code + \code - @endcode + \endcode */ /**************************************************************************/ ble_error_t GapAdvertisingData::addFlags(Flags flag) @@ -148,25 +147,25 @@ /**************************************************************************/ /*! - @brief Helper function to add \ref TX_POWER_LEVEL data to the + \brief Helper function to add TX_POWER_LEVEL data to the advertising payload - @args[in] flag The \ref TX_POWER_LEVEL value to add + \args[in] flag The TX_POWER_LEVEL value to add - @returns ble_error_t + \returns ble_error_t - @retval BLE_ERROR_NONE + \retval BLE_ERROR_NONE Everything executed properly - @retval BLE_ERROR_BUFFER_OVERFLOW + \retval BLE_ERROR_BUFFER_OVERFLOW The specified data would cause the advertising buffer to overflow - @section EXAMPLE + \par EXAMPLE - @code + \code - @endcode + \endcode */ /**************************************************************************/ ble_error_t GapAdvertisingData::addTxPower(int8_t txPower) @@ -177,7 +176,7 @@ /**************************************************************************/ /*! - @brief Clears the payload and resets the payload length counter + \brief Clears the payload and resets the payload length counter */ /**************************************************************************/ void GapAdvertisingData::clear(void) @@ -188,9 +187,9 @@ /**************************************************************************/ /*! - @brief Returns a pointer to the the current payload + \brief Returns a pointer to the the current payload - @returns A pointer to the payload + \returns A pointer to the payload */ /**************************************************************************/ uint8_t * GapAdvertisingData::getPayload(void) @@ -200,9 +199,9 @@ /**************************************************************************/ /*! - @brief Returns the current payload length (0..31 bytes) + \brief Returns the current payload length (0..31 bytes) - @returns The payload length in bytes + \returns The payload length in bytes */ /**************************************************************************/ uint8_t GapAdvertisingData::getPayloadLen(void)
--- a/GapAdvertisingData.h Wed Dec 18 19:15:07 2013 +0000 +++ b/GapAdvertisingData.h Wed Dec 18 19:39:19 2013 +0000 @@ -7,51 +7,50 @@ /**************************************************************************/ /*! - @brief + \brief This class provides several helper functions to generate properly formatted GAP Advertising and Scan Response data payloads - @note See Bluetooth Specification 4.0 (Vol. 3), Part C, Section 11 and 18 + \note + See Bluetooth Specification 4.0 (Vol. 3), Part C, Section 11 and 18 for further information on Advertising and Scan Response data. - @section Advertising and Scan Response Payloads - - @para + \par Advertising and Scan Response Payloads Advertising data and Scan Response data are organized around a set of data types called 'AD types' in Bluetooth 4.0 (see the Bluetooth Core Specification v4.0, Vol. 3, Part C, Sections 11 and 18). - @para + \par Each AD type has it's own standardized 'assigned number', as defined by the Bluetooth SIG: https://www.bluetooth.org/en-us/specification/assigned-numbers/generic-access-profile - @para + \par For convenience sake, all appropriate AD types have been encapsulated - into \ref DataType. + into GapAdvertisingData::DataType. - @para + \par Before the AD Types and their payload (if any) can be inserted into the Advertising or Scan Response frames, they need to be formatted as follows: - - Record length (1 byte) - - AD Type (1 byte) - - AD payload (optional, only present if record length > 1) + \li \c Record length (1 byte) + \li \c AD Type (1 byte) + \li \c AD payload (optional, only present if record length > 1) - @para + \par This class takes care of properly formatting the payload, performs some basic checks on the payload length, and tries to avoid common errors like adding an exclusive AD field twice in the Advertising or Scan Response payload. - @section EXAMPLE + \par EXAMPLE - @code + \code // ToDo - @endcode + \endcode */ /**************************************************************************/ class GapAdvertisingData
--- a/GapAdvertisingParams.cpp Wed Dec 18 19:15:07 2013 +0000 +++ b/GapAdvertisingParams.cpp Wed Dec 18 19:39:19 2013 +0000 @@ -6,60 +6,63 @@ /**************************************************************************/ /*! - @brief Instantiates a new GapAdvertisingParams instance + \brief + Instantiates a new GapAdvertisingParams instance - @param[in] advType + \param[in] advType The GAP advertising mode to use for this device. Valid - values are defined in \ref AdvertisingType + values are defined in AdvertisingType - @para - ADV_NON_CONNECTABLE_UNDIRECTED - All connections to the - peripheral device will be refused. + \par ADV_NON_CONNECTABLE_UNDIRECTED + All connections to the peripheral device will be refused. - @para - ADV_CONNECTABLE_DIRECTED - Only connections from a - pre-defined central device will be accepted. + \par ADV_CONNECTABLE_DIRECTED + Only connections from a pre-defined central device will be + accepted. - @para - ADV_CONNECTABLE_UNDIRECTED - Any central device can connect - to this peripheral. + \par 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. + \par 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 - @note See Bluetooth Core Specification 4.0 (Vol. 3), - 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 + See Bluetooth Core Specification 4.0 (Vol. 3), 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 + \param[in] interval Advertising interval between 0x0020 and 0x4000 in 0.625ms units (20ms to 10.24s). If using non-connectable mode - (\ref ADV_NON_CONNECTABLE_UNDIRECTED) this min value is + (ADV_NON_CONNECTABLE_UNDIRECTED) this min value is 0x00A0 (100ms). - @para + \par Increasing this value will allow central devices to detect your peripheral faster at the expense of more power being 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 ADV_CONNECTABLE_DIRECTED + \note + This field must be set to 0 if connectionMode is equal + to ADV_CONNECTABLE_DIRECTED - @note See Bluetooth Core Specification, Vol 3., Part C, + \note + See Bluetooth Core Specification, Vol 3., Part C, Appendix A for suggested advertising intervals: - @param[in] timeout + \param[in] timeout Advertising timeout between 0x1 and 0x3FFF (1 and 16383) in seconds. Enter 0 to disable the advertising timeout. - @section EXAMPLE + \par EXAMPLE - @code + \code - @endcode + \endcode */ /**************************************************************************/ GapAdvertisingParams::GapAdvertisingParams(AdvertisingType advType, uint16_t interval, uint16_t timeout) @@ -121,7 +124,7 @@ /**************************************************************************/ /*! - @brief returns the current Advertising Type value + \brief returns the current Advertising Type value */ /**************************************************************************/ GapAdvertisingParams::AdvertisingType GapAdvertisingParams::getAdvertisingType(void) @@ -131,7 +134,7 @@ /**************************************************************************/ /*! - @brief returns the current Advertising Delay (in units of 0.625ms) + \brief returns the current Advertising Delay (in units of 0.625ms) */ /**************************************************************************/ uint16_t GapAdvertisingParams::getInterval(void) @@ -141,7 +144,7 @@ /**************************************************************************/ /*! - @brief returns the current Advertising Timeout (in seconds) + \brief returns the current Advertising Timeout (in seconds) */ /**************************************************************************/ uint16_t GapAdvertisingParams::getTimeout(void)
--- a/GapAdvertisingParams.h Wed Dec 18 19:15:07 2013 +0000 +++ b/GapAdvertisingParams.h Wed Dec 18 19:39:19 2013 +0000 @@ -8,6 +8,29 @@ #define GAP_ADV_PARAMS_INTERVAL_MAX (0x1000) #define GAP_ADV_PARAMS_TIMEOUT_MAX (0x3FFF) +/**************************************************************************/ +/*! + \brief + This class provides a wrapper for the core advertising parameters, + including the advertising type (Connectable Undirected, + Non Connectable Undirected, etc.), as well as the advertising and + timeout intervals. + + \par + See the following for more information on advertising types: + + \li \c Bluetooth Core Specification 4.0 (Vol. 6), Part B, Section 2.3.1 + \li \c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3 + + \par EXAMPLE + + \code + + // ToDo + + \endcode +*/ +/**************************************************************************/ class GapAdvertisingParams { public: