aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-10-22 05:37:59 +0200
committerSven Gothel <[email protected]>2023-10-22 05:37:59 +0200
commit0ff1dac23391bd3e5cbe4e9af16d361c81263723 (patch)
tree0b3e9327a05b53da308e6aa31b2107bd139c1774 /examples
parentfec99c59a6b638b17f827e5bfd3539f27190448b (diff)
BTAdapter/BTManager: Initialize BTAdapter w/ optional power-on, allowing subsequent power-off settings w/o toggling power again
Diffstat (limited to 'examples')
-rw-r--r--examples/dbt_scanner10.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/dbt_scanner10.cpp b/examples/dbt_scanner10.cpp
index 2905798f..bceb21ef 100644
--- a/examples/dbt_scanner10.cpp
+++ b/examples/dbt_scanner10.cpp
@@ -631,14 +631,15 @@ static bool initAdapter(std::shared_ptr<BTAdapter>& adapter) {
}
// Initialize with defaults and power-on
if( !adapter->isInitialized() ) {
- HCIStatusCode status = adapter->initialize( btMode );
+ HCIStatusCode status = adapter->initialize( btMode, false );
if( HCIStatusCode::SUCCESS != status ) {
fprintf_td(stderr, "initAdapter: Adapter initialization failed: %s: %s\n",
to_string(status).c_str(), adapter->toString().c_str());
return false;
}
- } else if( !adapter->setPowered( true ) ) {
- fprintf_td(stderr, "initAdapter: Already initialized adapter power-on failed:: %s\n", adapter->toString().c_str());
+ }
+ if( !adapter->setPowered( true ) ) {
+ fprintf_td(stderr, "initAdapter: Adapter power-on failed:: %s\n", adapter->toString().c_str());
return false;
}
// adapter is powered-on