diff options
author | Sven Gothel <[email protected]> | 2020-11-08 03:14:38 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-11-08 03:14:38 +0100 |
commit | 3d88ea91c0ec9e9be014917140cbded31b12a3fe (patch) | |
tree | 7b5661af5f7319960d22d11368b262441733cb11 | |
parent | d462c160a6901dd5af818a177c66c58b872d15d4 (diff) |
DBTManager::addChangedAdapterSetCallback(..): Invoke added CB @ parent addChanged*() method for both types
-rw-r--r-- | src/direct_bt/DBTManager.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp index 4cad0626..4b805b58 100644 --- a/src/direct_bt/DBTManager.cpp +++ b/src/direct_bt/DBTManager.cpp @@ -1043,6 +1043,12 @@ static ChangedAdapterSetCallbackList::equal_comparator _changedAdapterSetCallbac void DBTManager::addChangedAdapterSetCallback(const ChangedAdapterSetCallback & l) { mgmtChangedAdapterSetCallbackList.push_back(l); + + jau::for_each_cow(adapterInfos, [&](std::shared_ptr<AdapterInfo>& ai) { + jau::for_each_cow(mgmtChangedAdapterSetCallbackList, [&](ChangedAdapterSetCallback &cb) { + cb.invoke(true /* added */, *ai); + }); + }); } int DBTManager::removeChangedAdapterSetCallback(const ChangedAdapterSetCallback & l) { return mgmtChangedAdapterSetCallbackList.erase_matching(l, true /* all_matching */, _changedAdapterSetCallbackEqComp); @@ -1053,12 +1059,6 @@ void DBTManager::addChangedAdapterSetCallback(ChangedAdapterSetFunc f) { ChangedAdapterSetCallback( jau::bindPlainFunc<bool, bool, const AdapterInfo&>(f) ) ); - - jau::for_each_cow(adapterInfos, [&](std::shared_ptr<AdapterInfo>& ai) { - jau::for_each_cow(mgmtChangedAdapterSetCallbackList, [&](ChangedAdapterSetCallback &cb) { - cb.invoke(true /* added */, *ai); - }); - }); } int DBTManager::removeChangedAdapterSetCallback(ChangedAdapterSetFunc f) { ChangedAdapterSetCallback l( jau::bindPlainFunc<bool, bool, const AdapterInfo&>(f) ); |