Skip to content

Commit

Permalink
[Bluez] Disable automatic filtering of duplicate data
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Heberling <[email protected]>
  • Loading branch information
tisoft committed Dec 4, 2023
1 parent c22de9b commit 5e293e7
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@
*/
package org.openhab.binding.bluetooth.bluez.internal;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import org.bluez.exceptions.BluezFailedException;
import org.bluez.exceptions.BluezInvalidArgumentsException;
import org.bluez.exceptions.BluezNotReadyException;
import org.bluez.exceptions.BluezNotSupportedException;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.freedesktop.dbus.types.Variant;
import org.openhab.binding.bluetooth.AbstractBluetoothBridgeHandler;
import org.openhab.binding.bluetooth.BluetoothAddress;
import org.openhab.binding.bluetooth.bluez.internal.events.AdapterDiscoveringChangedEvent;
Expand Down Expand Up @@ -139,6 +146,15 @@ public void dispose() {
return null;
}

Map<String, Variant<?>> filter = new HashMap<>();
filter.put("DuplicateData", new Variant<>(true));
try {
adapter.setDiscoveryFilter(filter);
} catch (BluezInvalidArgumentsException | BluezFailedException | BluezNotSupportedException
| BluezNotReadyException e) {
throw new RuntimeException(e);
}

// now lets make sure that discovery is turned on
if (!localAdapter.startDiscovery()) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Trying to start discovery");
Expand Down

0 comments on commit 5e293e7

Please sign in to comment.