diff options
author | Sven Gothel <[email protected]> | 2020-07-21 22:15:23 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-07-21 22:15:23 +0200 |
commit | da1f91d69daa6eacb00824760b11f33a921732f5 (patch) | |
tree | 0b3620c88855e0e16677a4c7d4775888cbba2b61 /examples/direct_bt_scanner01/dbt_scanner01.cpp | |
parent | 01eec2e5f4ce0c91f64bcf1035cdda22f6f6ea3a (diff) |
DBTAdapter: Make HCIHandler instance aggregated (lifecycle over full adapter lifecycle)
Since HCIHandler is being used to track all connections (direct or whitelisted),
it is essential to have it running over the whole adapter lifecycle.
openHCI() is now being performed within validateDevInfo(),
hence also sets adapter's valid state.
Call newly added checkValid() in user API on most 'action' methods,
throws exception if adapter is in invalid state.
Diffstat (limited to 'examples/direct_bt_scanner01/dbt_scanner01.cpp')
-rw-r--r-- | examples/direct_bt_scanner01/dbt_scanner01.cpp | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/examples/direct_bt_scanner01/dbt_scanner01.cpp b/examples/direct_bt_scanner01/dbt_scanner01.cpp index ca774277..10eca512 100644 --- a/examples/direct_bt_scanner01/dbt_scanner01.cpp +++ b/examples/direct_bt_scanner01/dbt_scanner01.cpp @@ -187,14 +187,6 @@ int main(int argc, char *argv[]) const int64_t t0 = getCurrentMilliseconds(); - if( doHCI_Connect ) { - std::shared_ptr<HCIHandler> hci = adapter.openHCI(); - if( nullptr == hci || !hci->isOpen() ) { - fprintf(stderr, "Couldn't open HCI from %s\n", adapter.toString().c_str()); - exit(1); - } - } - while( ok && ( forever || !foundDevice ) ) { ok = adapter.startDiscovery(true /* keepAlive */); if( !ok) { @@ -327,7 +319,6 @@ int main(int argc, char *argv[]) #endif /* SHOW_STATIC_SERVICE_CHARACTERISTIC_COMPOSITION */ out: - adapter.closeHCI(); return 0; } |