aboutsummaryrefslogtreecommitdiffstats
path: root/examples/dbt_peripheral00.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-01-25 18:25:23 +0100
committerSven Gothel <[email protected]>2022-01-25 18:25:23 +0100
commitfed5a977d7d9f2a26b5ef462d13146de1bfaffec (patch)
tree14f260a7094f1cf768a505ea81bd21cedf187180 /examples/dbt_peripheral00.cpp
parent4ceee4cb4d2d34e7d24db33f12c05bb617f288ca (diff)
Expose BTManager::setDefaultConnParam(..) via BTAdapter::setDefaultConnParam(..), essential in server mode
Diffstat (limited to 'examples/dbt_peripheral00.cpp')
-rw-r--r--examples/dbt_peripheral00.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/dbt_peripheral00.cpp b/examples/dbt_peripheral00.cpp
index a6a13373..383a6e74 100644
--- a/examples/dbt_peripheral00.cpp
+++ b/examples/dbt_peripheral00.cpp
@@ -589,6 +589,7 @@ static bool initAdapter(std::shared_ptr<BTAdapter>& adapter) {
fprintf_td(stderr, "initAdapter: setLocalName OK: %s\n", adapter->toString().c_str());
} else {
fprintf_td(stderr, "initAdapter: setLocalName failed: %s\n", adapter->toString().c_str());
+ return false;
}
status = adapter->setSecureConnections( use_SC );
@@ -596,7 +597,21 @@ static bool initAdapter(std::shared_ptr<BTAdapter>& adapter) {
fprintf_td(stderr, "initAdapter: setSecureConnections OK: %s\n", adapter->toString().c_str());
} else {
fprintf_td(stderr, "initAdapter: setSecureConnections failed: %s\n", adapter->toString().c_str());
+ return false;
+ }
+
+ const uint16_t conn_min_interval = 8; // 10ms
+ const uint16_t conn_max_interval = 40; // 50ms
+ const uint16_t conn_latency = 0;
+ const uint16_t supervision_timeout = 50; // 500ms
+ status = adapter->setDefaultConnParam(conn_min_interval, conn_max_interval, conn_latency, supervision_timeout);
+ if( HCIStatusCode::SUCCESS == status ) {
+ fprintf_td(stderr, "initAdapter: setDefaultConnParam OK: %s\n", adapter->toString().c_str());
+ } else {
+ fprintf_td(stderr, "initAdapter: setDefaultConnParam failed: %s\n", adapter->toString().c_str());
+ return false;
}
+
if( !adapter->setPowered( true ) ) {
fprintf_td(stderr, "initAdapter: setPower.2 on failed: %s\n", adapter->toString().c_str());
return false;