From 6e71e6e8fcf1a075d2b14ce5b2f18081cb436abd Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 27 Jul 2020 07:33:12 +0200 Subject: 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. --- examples/direct_bt_scanner01/dbt_scanner01.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples/direct_bt_scanner01') 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"); -- cgit v1.2.3