summaryrefslogtreecommitdiffstats
path: root/examples/direct_bt_scanner00/dbt_scanner00.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-10-13 02:19:02 +0200
committerSven Gothel <[email protected]>2020-10-13 02:19:02 +0200
commitf3acf0e335bf65e67aa5b4d292bb5446ffbde271 (patch)
treea206c9b4aa0d550fe0d73f9d7e7d24e5680ad6d0 /examples/direct_bt_scanner00/dbt_scanner00.cpp
parentd5adce54eedbbe17f47db839f47280ba8fcf1f49 (diff)
AdapterStatusListener[1] and DBTAdapter[2] API Refinement: [1] non const DBTAdapter, [2] use HCIStatusCode for start/stopDiscovery
and well as [2] return boolean for set[Discoverable|Bondable|Powered](..). AdapterStatusListener needs to pass non-const DBTAdapter to allow actionable modification of adapter state, e.g. start/stopDiscovery. HCIStatusCode is desired for start/stopDiscovery, allowing user to read actual HCI status code on failure. boolean return value for set[Discoverable|Bondable|Powered](..) reflecting general success or failure on these basic commands.
Diffstat (limited to 'examples/direct_bt_scanner00/dbt_scanner00.cpp')
-rw-r--r--examples/direct_bt_scanner00/dbt_scanner00.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/direct_bt_scanner00/dbt_scanner00.cpp b/examples/direct_bt_scanner00/dbt_scanner00.cpp
index df37a103..0940de7e 100644
--- a/examples/direct_bt_scanner00/dbt_scanner00.cpp
+++ b/examples/direct_bt_scanner00/dbt_scanner00.cpp
@@ -51,7 +51,7 @@ std::mutex mtxDeviceFound;
std::condition_variable cvDeviceFound;
class MyAdapterStatusListener : public AdapterStatusListener {
- void adapterSettingsChanged(DBTAdapter const &a, const AdapterSetting oldmask, const AdapterSetting newmask,
+ void adapterSettingsChanged(DBTAdapter &a, const AdapterSetting oldmask, const AdapterSetting newmask,
const AdapterSetting changedmask, const uint64_t timestamp) override {
fprintf(stderr, "****** Native Adapter SETTINGS_CHANGED: %s -> %s, changed %s\n",
getAdapterSettingsString(oldmask).c_str(),
@@ -62,7 +62,7 @@ class MyAdapterStatusListener : public AdapterStatusListener {
(void)timestamp;
}
- void discoveringChanged(DBTAdapter const &a, const bool enabled, const bool keepAlive, const uint64_t timestamp) override {
+ void discoveringChanged(DBTAdapter &a, const bool enabled, const bool keepAlive, const uint64_t timestamp) override {
fprintf(stderr, "****** DISCOVERING: enabled %d, keepAlive %d: %s\n", enabled, keepAlive, a.toString().c_str());
(void)timestamp;
}
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
const int64_t t0 = getCurrentMilliseconds();
while( ok && ( forever || !foundDevice ) ) {
- ok = adapter.startDiscovery(true /* keepAlive */);
+ ok = HCIStatusCode::SUCCESS == adapter.startDiscovery(true /* keepAlive */);
if( !ok) {
perror("Adapter start discovery failed");
goto out;