diff options
author | Sven Gothel <[email protected]> | 2020-10-13 02:25:17 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-10-13 02:25:17 +0200 |
commit | fb9d0436163d8251fc3620b2c8bf6779afe27e39 (patch) | |
tree | 3c218dcc728f57a303eb3aeb7aa5c28a2f1f1380 /examples | |
parent | f3acf0e335bf65e67aa5b4d292bb5446ffbde271 (diff) |
dbt_scanner10, DBTScanner10: POWERED-ON @ AdapterStatusListener::adapterSettingsChanged(..) action ..
POWERED-ON @ AdapterStatusListener::adapterSettingsChanged(..): Only act upon non-initialSetting,
as initial startDiscovery is handled by application code!
Diffstat (limited to 'examples')
-rw-r--r-- | examples/direct_bt_scanner10/dbt_scanner10.cpp | 10 | ||||
-rw-r--r-- | examples/java/DBTScanner10.java | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/examples/direct_bt_scanner10/dbt_scanner10.cpp b/examples/direct_bt_scanner10/dbt_scanner10.cpp index a7e0b505..2ec21995 100644 --- a/examples/direct_bt_scanner10/dbt_scanner10.cpp +++ b/examples/direct_bt_scanner10/dbt_scanner10.cpp @@ -160,6 +160,16 @@ class MyAdapterStatusListener : public AdapterStatusListener { fprintf(stderr, "Status DBTAdapter:\n"); fprintf(stderr, "%s\n", a.toString().c_str()); (void)timestamp; + + if( !initialSetting && + isAdapterSettingSet(changedmask, AdapterSetting::POWERED) && + isAdapterSettingSet(newmask, AdapterSetting::POWERED) ) + { + HCIStatusCode status = a.startDiscovery( true ); + if( HCIStatusCode::SUCCESS != status ) { + fprintf(stderr, "Adapter (powered-on): Start discovery failed: %s", getHCIStatusCodeString(status).c_str()); + } + } } void discoveringChanged(DBTAdapter &a, const bool enabled, const bool keepAlive, const uint64_t timestamp) override { diff --git a/examples/java/DBTScanner10.java b/examples/java/DBTScanner10.java index 75a35f75..0a0a1f05 100644 --- a/examples/java/DBTScanner10.java +++ b/examples/java/DBTScanner10.java @@ -118,7 +118,8 @@ public class DBTScanner10 { } println("Status Adapter:"); println(adapter.toString()); - if( changedmask.isSet(AdapterSettings.SettingType.POWERED) && + if( !initialSetting && + changedmask.isSet(AdapterSettings.SettingType.POWERED) && newmask.isSet(AdapterSettings.SettingType.POWERED) ) { // powered on adapter .... |