diff options
author | Sven Gothel <[email protected]> | 2020-10-24 04:09:55 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-10-24 04:09:55 +0200 |
commit | c7cc9acfe7fcce0df302de16497b3d730d337e36 (patch) | |
tree | d9cd9f37c5c7640e6c6c1fccda9ee3dfb4dbf1cd /src | |
parent | 985f87f0565c6b6e3c9da485655f2c84cfa8fdfc (diff) |
DBTManager: Start dropping index (idx) for adapter id, use dev_id - drop index requirement
Diffstat (limited to 'src')
-rw-r--r-- | src/direct_bt/DBTAdapter.cpp | 6 | ||||
-rw-r--r-- | src/direct_bt/DBTManager.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp index 821e6217..b17d571a 100644 --- a/src/direct_bt/DBTAdapter.cpp +++ b/src/direct_bt/DBTAdapter.cpp @@ -198,7 +198,7 @@ bool DBTAdapter::validateDevInfo() noexcept { DBTAdapter::DBTAdapter() noexcept : debug_event(jau::environment::getBooleanProperty("direct_bt.debug.adapter.event", false)), mgmt( DBTManager::get(BTMode::NONE /* use env default */) ), - dev_id( mgmt.getDefaultAdapterIdx() ), + dev_id( mgmt.getDefaultAdapterDevId() ), hci( dev_id ) { valid = validateDevInfo(); @@ -207,7 +207,7 @@ DBTAdapter::DBTAdapter() noexcept DBTAdapter::DBTAdapter(EUI48 &mac) noexcept : debug_event(jau::environment::getBooleanProperty("direct_bt.debug.adapter.event", false)), mgmt( DBTManager::get(BTMode::NONE /* use env default */) ), - dev_id( mgmt.findAdapterInfoIdx(mac) ), + dev_id( mgmt.findAdapterInfoDevId(mac) ), hci( dev_id ) { valid = validateDevInfo(); @@ -216,7 +216,7 @@ DBTAdapter::DBTAdapter(EUI48 &mac) noexcept DBTAdapter::DBTAdapter(const int _dev_id) noexcept : debug_event(jau::environment::getBooleanProperty("direct_bt.debug.adapter.event", false)), mgmt( DBTManager::get(BTMode::NONE /* use env default */) ), - dev_id( 0 <= _dev_id ? _dev_id : mgmt.getDefaultAdapterIdx() ), + dev_id( 0 <= _dev_id ? _dev_id : mgmt.getDefaultAdapterDevId() ), hci( dev_id ) { valid = validateDevInfo(); diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp index 19a054bb..c865039f 100644 --- a/src/direct_bt/DBTManager.cpp +++ b/src/direct_bt/DBTManager.cpp @@ -532,7 +532,7 @@ void DBTManager::close() noexcept { DBG_PRINT("DBTManager::close: End"); } -int DBTManager::findAdapterInfoIdx(const EUI48 &mac) const noexcept { +int DBTManager::findAdapterInfoDevId(const EUI48 &mac) const noexcept { auto begin = adapterInfos.begin(); auto it = std::find_if(begin, adapterInfos.end(), [&](std::shared_ptr<AdapterInfo> const& p) { return p->address == mac; @@ -581,7 +581,7 @@ std::shared_ptr<AdapterInfo> DBTManager::getDefaultAdapterInfo() const noexcept return adapterInfos.size() > 0 ? getAdapterInfo(0) : nullptr; // first adapter or nullptr, if none. } -int DBTManager::getDefaultAdapterIdx() const noexcept { +int DBTManager::getDefaultAdapterDevId() const noexcept { std::shared_ptr<AdapterInfo> ai = getDefaultAdapterInfo(); if( nullptr == ai ) { return -1; |