aboutsummaryrefslogtreecommitdiffstats
path: root/examples/direct_bt_scanner01
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-07-27 07:33:12 +0200
committerSven Gothel <[email protected]>2020-07-27 07:33:12 +0200
commit6e71e6e8fcf1a075d2b14ce5b2f18081cb436abd (patch)
tree8d047dadc1488f3a091d9df7ed58d830821c5cef /examples/direct_bt_scanner01
parentb7d7d08c108fb3a1d17d3542dce1f942f6bb4059 (diff)
C++/Java *Device::connect*(..), disconnect(): Return HCIStatusCode instead of just boolean, passing through potential HCI error detail
The HCIStatusCode on failed connect*/disconnect commands issued via direct_bt HCI, could help applications making a better fail-recovery decision than just having the binary result.
Diffstat (limited to 'examples/direct_bt_scanner01')
-rw-r--r--examples/direct_bt_scanner01/dbt_scanner01.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/direct_bt_scanner01/dbt_scanner01.cpp b/examples/direct_bt_scanner01/dbt_scanner01.cpp
index 720f68e0..bc3e8b2e 100644
--- a/examples/direct_bt_scanner01/dbt_scanner01.cpp
+++ b/examples/direct_bt_scanner01/dbt_scanner01.cpp
@@ -218,8 +218,9 @@ int main(int argc, char *argv[])
// (Without: Overall communication takes ~twice as long!!!)
//
if( doHCI_Connect ) {
- if( 0 == device->connectDefault() ) {
- fprintf(stderr, "Connect: Failed %s\n", device->toString().c_str());
+ HCIStatusCode res;
+ if( ( res = device->connectDefault() ) != HCIStatusCode::SUCCESS ) {
+ fprintf(stderr, "Connect: Failed res %s, %s\n", getHCIStatusCodeString(res).c_str(), device->toString().c_str());
// we tolerate the failed immediate connect, as it might happen at a later time
} else {
fprintf(stderr, "Connect: Success\n");