-
public final class PassiveBluetoothManager
This class enables passive monitoring of BluetoothPeripheral. Interaction with the manager is done through .setPassivePeripherals or with a MonitorDeviceRequest. Setting a non empty list of BluetoothPeripheral will automatically start scanning for the peripherals in the background. Setting the passivePeripherals to an empty collection will stop scanning in the background. Anytime a BluetoothPeripheralController starts pairing or reading, all background reading will be cancelled. Controllers that are in the middle of processing will be cancelled and BluetoothListener.onFail will be called if an error of BluetoothError will be called if a listener has been set. After all foreground bluetooth processing has stopped, passive monitoring will be restarted. To make sure duplicate records are not taken readings in the background will not be taken from a device that has taken a background reading within 15 seconds.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
PassiveBluetoothManager.BluetoothListener
The PassiveManager.BluetoothListener provides callbacks for peripheral monitoring bluetooth peripherals in the background.
public class
PassiveBluetoothManager.Companion
-
Field Summary
Fields Modifier and Type Field Description private PassiveBluetoothManager.BluetoothListener
bluetoothListener
private Set<BluetoothPeripheral>
passivePeripherals
private final Map<String, BluetoothPeripheral>
monitoredDevices
-
Method Summary
Modifier and Type Method Description final PassiveBluetoothManager.BluetoothListener
getBluetoothListener()
Set a listener for events in the background. final Unit
setBluetoothListener(PassiveBluetoothManager.BluetoothListener bluetoothListener)
Set a listener for events in the background. final Set<BluetoothPeripheral>
getPassivePeripherals()
final Unit
setPassivePeripherals(Set<BluetoothPeripheral> passivePeripherals)
final Map<String, BluetoothPeripheral>
getMonitoredDevices()
-
-
Method Detail
-
getBluetoothListener
final PassiveBluetoothManager.BluetoothListener getBluetoothListener()
Set a listener for events in the background. The listener is managed using a weak reference so it is important to keep a reference to your listener.
-
setBluetoothListener
final Unit setBluetoothListener(PassiveBluetoothManager.BluetoothListener bluetoothListener)
Set a listener for events in the background. The listener is managed using a weak reference so it is important to keep a reference to your listener.
-
getPassivePeripherals
final Set<BluetoothPeripheral> getPassivePeripherals()
-
setPassivePeripherals
final Unit setPassivePeripherals(Set<BluetoothPeripheral> passivePeripherals)
-
getMonitoredDevices
final Map<String, BluetoothPeripheral> getMonitoredDevices()
-
-
-
-