aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-09-24 16:52:36 +0200
committerSven Gothel <[email protected]>2020-09-24 16:52:36 +0200
commit148c4a901c1d69e47364ba78465e25386be5cf97 (patch)
tree8397e3e9297bbc0befca28247c338454fd93bb37 /api
parent53eef8bf45c0500c68af83a5c57f6b348d995c5c (diff)
HCIHandler*: Tuning LE scan + connection parameters for higher performance (stable @ 15ms scan + connect)
commit a2096bf3baf8fb5fc8ed37ce4bdb1ec1112b6e8d increased the connection interval max from 20ms -> 30ms, which caused a performance loss of about magnitude 2 (took > 2 as long as before). Tested fixed 15ms connection interval on CSR and Raspi adapter, so far so good. Notable: Android starts even with just below 10ms and Apple at 11ms (accessoir) or 15ms (default min). Performance w/ 15ms is excellent.
Diffstat (limited to 'api')
-rw-r--r--api/direct_bt/DBTAdapter.hpp8
-rw-r--r--api/direct_bt/DBTDevice.hpp8
-rw-r--r--api/direct_bt/DBTManager.hpp8
-rw-r--r--api/direct_bt/HCIHandler.hpp8
4 files changed, 16 insertions, 16 deletions
diff --git a/api/direct_bt/DBTAdapter.hpp b/api/direct_bt/DBTAdapter.hpp
index 763a4454..273887da 100644
--- a/api/direct_bt/DBTAdapter.hpp
+++ b/api/direct_bt/DBTAdapter.hpp
@@ -372,16 +372,16 @@ namespace direct_bt {
* @param address
* @param address_type
* @param ctype
- * @param conn_interval_min in units of 1.25ms, default value 16 for 20ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
- * @param conn_interval_max in units of 1.25ms, default value 24 for 30ms Value range [6 .. 3200] for [7.5ms .. 4000ms]
+ * @param conn_interval_min in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
+ * @param conn_interval_max in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
* @param conn_latency slave latency in units of connection events, default value 0; Value range [0 .. 0x01F3].
* @param supervision_timeout in units of 10ms, default value >= 10 x conn_interval_max, we use HCIConstInt::LE_CONN_MIN_TIMEOUT_MS minimum; Value range [0xA-0x0C80] for [100ms - 32s].
* @return true if the device was already added or has been newly added to the adapter's whitelist.
*/
bool addDeviceToWhitelist(const EUI48 &address, const BDAddressType address_type,
const HCIWhitelistConnectType ctype,
- const uint16_t conn_interval_min=16, const uint16_t conn_interval_max=24,
- const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 30));
+ const uint16_t conn_interval_min=12, const uint16_t conn_interval_max=12,
+ const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 15)) noexcept;
/** Remove the given device from the adapter's autoconnect whitelist. */
diff --git a/api/direct_bt/DBTDevice.hpp b/api/direct_bt/DBTDevice.hpp
index 8f130b30..7d96700f 100644
--- a/api/direct_bt/DBTDevice.hpp
+++ b/api/direct_bt/DBTDevice.hpp
@@ -238,15 +238,15 @@ namespace direct_bt {
*
* @param le_scan_interval in units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]
* @param le_scan_window in units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]. Shall be <= le_scan_interval
- * @param conn_interval_min in units of 1.25ms, default value 16 for 20ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
- * @param conn_interval_max in units of 1.25ms, default value 24 for 30ms Value range [6 .. 3200] for [7.5ms .. 4000ms]
+ * @param conn_interval_min in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
+ * @param conn_interval_max in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
* @param conn_latency slave latency in units of connection events, default value 0; Value range [0 .. 0x01F3].
* @param supervision_timeout in units of 10ms, default value >= 10 x conn_interval_max, we use HCIConstInt::LE_CONN_MIN_TIMEOUT_MS minimum; Value range [0xA-0x0C80] for [100ms - 32s].
* @return HCIStatusCode::SUCCESS if the command has been accepted, otherwise HCIStatusCode may disclose reason for rejection.
*/
HCIStatusCode connectLE(const uint16_t le_scan_interval=24, const uint16_t le_scan_window=24,
- const uint16_t conn_interval_min=16, const uint16_t conn_interval_max=24,
- const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 30));
+ const uint16_t conn_interval_min=12, const uint16_t conn_interval_max=12,
+ const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 15));
/**
* Establish a HCI BDADDR_BREDR connection to this device.
diff --git a/api/direct_bt/DBTManager.hpp b/api/direct_bt/DBTManager.hpp
index a570a23d..10752a89 100644
--- a/api/direct_bt/DBTManager.hpp
+++ b/api/direct_bt/DBTManager.hpp
@@ -314,15 +314,15 @@ namespace direct_bt {
* @param dev_id
* @param address
* @param address_type
- * @param conn_interval_min in units of 1.25ms, default value 16 for 20ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
- * @param conn_interval_max in units of 1.25ms, default value 24 for 30ms Value range [6 .. 3200] for [7.5ms .. 4000ms]
+ * @param conn_interval_min in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
+ * @param conn_interval_max in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
* @param conn_latency slave latency in units of connection events, default value 0; Value range [0 .. 0x01F3].
* @param supervision_timeout in units of 10ms, default value >= 10 x conn_interval_max, we use HCIConstInt::LE_CONN_MIN_TIMEOUT_MS minimum; Value range [0xA-0x0C80] for [100ms - 32s].
* @return
*/
bool uploadConnParam(const int dev_id, const EUI48 &address, const BDAddressType address_type,
- const uint16_t conn_interval_min=16, const uint16_t conn_interval_max=24,
- const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 30)) noexcept;
+ const uint16_t conn_interval_min=12, const uint16_t conn_interval_max=12,
+ const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 15)) noexcept;
/**
* Returns true, if the adapter's device is already whitelisted.
diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp
index 8b66464e..94d146a1 100644
--- a/api/direct_bt/HCIHandler.hpp
+++ b/api/direct_bt/HCIHandler.hpp
@@ -351,8 +351,8 @@ namespace direct_bt {
* @param own_mac_type
* @param le_scan_interval in units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]
* @param le_scan_window in units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]. Shall be <= le_scan_interval
- * @param conn_interval_min in units of 1.25ms, default value 16 for 20ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
- * @param conn_interval_max in units of 1.25ms, default value 24 for 30ms Value range [6 .. 3200] for [7.5ms .. 4000ms]
+ * @param conn_interval_min in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
+ * @param conn_interval_max in units of 1.25ms, default value 12 for 15ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
* @param conn_latency slave latency in units of connection events, default value 0; Value range [0 .. 0x01F3].
* @param supervision_timeout in units of 10ms, default value >= 10 x conn_interval_max, we use HCIConstInt::LE_CONN_MIN_TIMEOUT_MS minimum; Value range [0xA-0x0C80] for [100ms - 32s].
* @return
@@ -361,8 +361,8 @@ namespace direct_bt {
const HCILEPeerAddressType peer_mac_type=HCILEPeerAddressType::PUBLIC,
const HCILEOwnAddressType own_mac_type=HCILEOwnAddressType::PUBLIC,
const uint16_t le_scan_interval=24, const uint16_t le_scan_window=24,
- const uint16_t conn_interval_min=16, const uint16_t conn_interval_max=24,
- const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 30)) noexcept;
+ const uint16_t conn_interval_min=12, const uint16_t conn_interval_max=12,
+ const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 15)) noexcept;
/**
* Establish a connection to the given BREDR (non LE).