summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-10-23 06:56:52 +0200
committerSven Gothel <[email protected]>2020-10-23 06:56:52 +0200
commit0a71109c4105d2b9f3880a83252c39f8720eb832 (patch)
tree0e1c9a087823ea5aee07c12c5507c37f41f27248 /src
parentfcbe2b39e5eb5bf2aafc876bdf5e6bf1a300f3ae (diff)
AdapterStatusListener::discoveringChanged: Add meta ScanType and changed ScanType for the changedEnabled value; Expose meta ScanType.
The additional information in the callback is essential in a LE + BREDR environment. User can also see the current meta ScanType. ScanType is exposed to Java. Java's BluetoothAdapter also adds 'ScanType getCurrentScanType()', exposing the last sent meta ScanType. DBTAdapter.java stores the meta ScanType instead of a boolean flag, hence we can react on LE only scanning for example. DBTAdapter can call all discovery callbacks for all ScanTypes now.
Diffstat (limited to 'src')
-rw-r--r--src/direct_bt/DBTAdapter.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp
index 7b5d5dc6..0a20736f 100644
--- a/src/direct_bt/DBTAdapter.cpp
+++ b/src/direct_bt/DBTAdapter.cpp
@@ -740,22 +740,17 @@ bool DBTAdapter::mgmtEvDeviceDiscoveringAny(std::shared_ptr<MgmtEvent> e, const
checkDiscoveryState();
- // FIXME: AdapterStatusListener::discoveringChanged(..)
- // Method shall include the enabled/disabled ScanType plus the current overall ScanType state.
- // For now, we only report LE discovery state.
- if( hasScanType(eventScanType, ScanType::LE) ) { // only report LE-scan changes for now
- int i=0;
- jau::for_each_cow(statusListenerList, [&](std::shared_ptr<AdapterStatusListener> &l) {
- try {
- l->discoveringChanged(*this, eventEnabled, keep_le_scan_alive, event.getTimestamp());
- } catch (std::exception &except) {
- ERR_PRINT("DBTAdapter::EventCB:DeviceDiscovering-CBs %d/%zd: %s of %s: Caught exception %s",
- i+1, statusListenerList.size(),
- l->toString().c_str(), toString().c_str(), except.what());
- }
- i++;
- });
- }
+ int i=0;
+ jau::for_each_cow(statusListenerList, [&](std::shared_ptr<AdapterStatusListener> &l) {
+ try {
+ l->discoveringChanged(*this, currentMetaScanType, eventScanType, eventEnabled, keep_le_scan_alive, event.getTimestamp());
+ } catch (std::exception &except) {
+ ERR_PRINT("DBTAdapter::EventCB:DeviceDiscovering-CBs %d/%zd: %s of %s: Caught exception %s",
+ i+1, statusListenerList.size(),
+ l->toString().c_str(), toString().c_str(), except.what());
+ }
+ i++;
+ });
if( !hasScanType(currentNativeScanType, ScanType::LE) && keep_le_scan_alive ) {
std::thread bg(&DBTAdapter::startDiscoveryBackground, this); // @suppress("Invalid arguments")