summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-02-06 18:22:56 +0100
committerSven Gothel <[email protected]>2022-02-06 18:22:56 +0100
commitac219dec7768492f7517570d52d2b8049b808269 (patch)
tree8404e08dd7a6151f4a4a1fb1c72efe647d23eb38 /api
parentdace5f50121a254376b3c01ede9cbdffd9577e63 (diff)
BTAdapter/HCIHandler: Reflect: Advertising is active until either disabled via stopAdvertising() or _a_connection_ has been made.
This fix set's HCIHandler's 'advertisingEnabled' flags to 'false' after a 'connection complete' event had occured. Further, HCIHandler::le_enable_adv(..) overrides a potential erroneous HCI failure when: - disabling advertising when already disabled, or - enabling advertising when already enabled as stated in spec 'BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command'
Diffstat (limited to 'api')
-rw-r--r--api/direct_bt/BTAdapter.hpp17
-rw-r--r--api/direct_bt/HCIHandler.hpp14
2 files changed, 26 insertions, 5 deletions
diff --git a/api/direct_bt/BTAdapter.hpp b/api/direct_bt/BTAdapter.hpp
index d173aeba..3bdd698c 100644
--- a/api/direct_bt/BTAdapter.hpp
+++ b/api/direct_bt/BTAdapter.hpp
@@ -1165,8 +1165,9 @@ namespace direct_bt {
* If successful, method also changes [this adapter's role](@ref BTAdapterRoles) to ::BTRole::Slave
* and treat connected BTDevice as ::BTRole::Master while service ::GATTRole::Server.
*
- * This adapter's HCIHandler instance is used to initiate scanning,
- * see HCIHandler::le_start_adv().
+ * Advertising is active until either disabled via stopAdvertising() or a connection has been made, see isAdvertising().
+ *
+ * This adapter's HCIHandler instance is used to initiate scanning, see HCIHandler::le_start_adv().
*
* The given ADV EIR EInfoReport will be updated with getName() and at least GAPFlags::LE_Gen_Disc set.
*
@@ -1220,8 +1221,9 @@ namespace direct_bt {
* If successful, method also changes [this adapter's role](@ref BTAdapterRoles) to ::BTRole::Slave
* and treat connected BTDevice as ::BTRole::Master while service ::GATTRole::Server.
*
- * This adapter's HCIHandler instance is used to initiate scanning,
- * see HCIHandler::le_start_adv().
+ * Advertising is active until either disabled via stopAdvertising() or a connection has been made, see isAdvertising().
+ *
+ * This adapter's HCIHandler instance is used to initiate scanning, see HCIHandler::le_start_adv().
*
* The ADV EIR EInfoReport will be generated on the default
* EIRDataType adv_mask using EIRDataType::FLAGS | EIRDataType::SERVICE_UUID
@@ -1257,6 +1259,10 @@ namespace direct_bt {
*
* - BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command
*
+ * Advertising is active until either disabled via stopAdvertising() or a connection has been made, see isAdvertising().
+ *
+ * This adapter's HCIHandler instance is used to stop scanning, see HCIHandler::le_enable_adv().
+ *
* @return HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
* @see startAdvertising()
* @see isAdvertising()
@@ -1266,6 +1272,9 @@ namespace direct_bt {
/**
* Returns the adapter's current advertising state. It can be modified through startAdvertising(..) and stopAdvertising().
+ *
+ * Advertising is active until either disabled via stopAdvertising() or a connection has been made.
+ *
* @see startAdvertising()
* @see stopAdvertising()
* @since 2.4.0
diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp
index 06abc492..ad37724d 100644
--- a/api/direct_bt/HCIHandler.hpp
+++ b/api/direct_bt/HCIHandler.hpp
@@ -409,6 +409,13 @@ namespace direct_bt {
ScanType getCurrentScanType() const noexcept { return currentScanType.load(); }
void setCurrentScanType(const ScanType v) noexcept { currentScanType = v; }
+ /**
+ * Advertising is enabled via le_start_adv() or le_enable_adv().
+ *
+ * Advertising is active until either disabled via le_enable_adv(false) or a connection has been made.
+ *
+ * @return true if advertising is active, otherwise false.
+ */
bool isAdvertising() const noexcept { return advertisingEnabled.load(); }
std::string toString() const noexcept;
@@ -809,6 +816,9 @@ namespace direct_bt {
*
* - BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command
*
+ * Advertising is active until either disabled via le_enable_adv(false) or a connection has been made,
+ * see isAdvertising().
+ *
* @param enable
* @return HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
* @since 2.4.0
@@ -829,10 +839,12 @@ namespace direct_bt {
* - BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.8 LE Set Scan Response Data command
* - BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command
*
+ * Advertising is active until either disabled via le_enable_adv(false) or a connection has been made,
+ * see isAdvertising().
+ *
* TODO:
* - Random address for privacy if desired!
* - Consider SMP (security)
- * </p>
*
* @param eir Full ADV EIR EInfoReport
* @param adv_mask EIRDataType mask for EInfoReport to select advertisement EIR PDU data, defaults to EIRDataType::FLAGS | EIRDataType::SERVICE_UUID