public interface LegoBluetoothDeviceManager
Modifier and Type | Method and Description |
---|---|
java.util.List<LegoBluetoothDevice> |
allDevices()
Returns a list with all known devices regardless of their current connect state.
|
void |
cancelDeviceConnection(LegoBluetoothDevice device)
Disconnect from a LEGO Bluetooth LE Device.
|
void |
connectToDevice(android.content.Context context,
LegoBluetoothDevice device)
Connect to a @class LegoBluetoothDevice.
|
java.util.List<LegoBluetoothDevice> |
devicesInState(LegoDevice.DeviceState connectionState)
Returns a list of devices in the specified device state.
|
long |
getAdvertisingDevicesInterval() |
long |
getConnectRequestTimeoutInterval() |
boolean |
isAutomaticReconnectOnConnectionLostEnabled() |
void |
registerCallbackListener(LegoBluetoothDeviceManagerCallbackListener listener)
Add a listener to receive device discovery and connection events.
|
void |
scan(android.content.Context context)
Start scanning for LEGO BLE devices
|
void |
setAutomaticReconnectOnConnectionLostEnabled(boolean enabled) |
void |
setConnectRequestTimeoutInterval(long interval) |
void |
stopScanning()
Stop scanning for LEGO BLE devices
|
void |
unregisterCallbackListener(LegoBluetoothDeviceManagerCallbackListener listener)
Remove a listener
|
void |
updateAdvertisingDevicesInterval(long interval)
Update the Advertising interval - determines the interval in milliseconds within which devices should advertise before being ruled out
|
void scan(android.content.Context context) throws java.lang.IllegalStateException
context
- the Android contextjava.lang.IllegalStateException
- when Bluetooth is not available or enabled on devicevoid stopScanning()
void connectToDevice(android.content.Context context, LegoBluetoothDevice device)
context
- The Android contextdevice
- The device to establish a connection toboolean isAutomaticReconnectOnConnectionLostEnabled()
void setAutomaticReconnectOnConnectionLostEnabled(boolean enabled)
enabled
- whether automatic reconnect attempts should be performed or notlong getConnectRequestTimeoutInterval()
void setConnectRequestTimeoutInterval(long interval)
interval
- the timeout interval used for device connect attemptsvoid cancelDeviceConnection(LegoBluetoothDevice device)
device
- The device to disconnect fromvoid registerCallbackListener(LegoBluetoothDeviceManagerCallbackListener listener)
listener
- The listener to addvoid unregisterCallbackListener(LegoBluetoothDeviceManagerCallbackListener listener)
listener
- The listener to removelong getAdvertisingDevicesInterval()
void updateAdvertisingDevicesInterval(long interval)
interval
- Interval to setjava.util.List<LegoBluetoothDevice> devicesInState(LegoDevice.DeviceState connectionState)
connectionState
- The state of the devices.java.util.List<LegoBluetoothDevice> allDevices()