public abstract class RxBleClient
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RxBleClient.State |
| Constructor and Description |
|---|
RxBleClient() |
| Modifier and Type | Method and Description |
|---|---|
static RxBleClient |
create(android.content.Context context)
Returns instance of RxBleClient using application context.
|
abstract BackgroundScanner |
getBackgroundScanner()
Returns a background scanner instance that can be used to handle background scans, even if your process is stopped.
|
abstract RxBleDevice |
getBleDevice(java.lang.String macAddress)
Obtain instance of RxBleDevice for provided MAC address.
|
abstract java.util.Set<RxBleDevice> |
getBondedDevices()
A function returning a set of currently bonded devices
If Bluetooth state is not STATE_ON, this API will return an empty set.
|
abstract RxBleClient.State |
getState()
Returns the current state of the RxBleClient environment, which may be helpful in deciding if particular functionality
should be used at a given moment.
|
abstract <any> |
observeStateChanges()
Returns an observable emitting state _changes_ of the RxBleClient environment which may be helpful in deciding if particular
functionality should be used at a given moment.
|
abstract <any> |
scanBleDevices(ScanSettings scanSettings,
ScanFilter... scanFilters)
Returns an infinite observable emitting BLE scan results.
|
abstract <any> |
scanBleDevices(java.util.UUID... filterServiceUUIDs)
Deprecated.
use
scanBleDevices(ScanSettings, ScanFilter...) instead |
static void |
setLogLevel(int logLevel)
Deprecated.
|
static void |
updateLogOptions(LogOptions logOptions)
Method for updating logging options.
|
public static RxBleClient create(android.content.Context context)
context - Any Android context@Deprecated public static void setLogLevel(int logLevel)
updateLogOptions(LogOptions)logLevel - the minimum log level to logpublic static void updateLogOptions(LogOptions logOptions)
LogOptions will not get updated.
Default behaviour: MAC addresses are not logged (MAC='XX:XX:XX:XX:XX:XX'), uuids are not logged (uuid='...'), byte array values
are not logged (value=[...]), logger is logging to the logcat (Log), all scanned peripherals are logged if
log level allows it, log level is set not to log anything (LogConstants.NONE)
logOptions - the logging optionspublic abstract RxBleDevice getBleDevice(java.lang.String macAddress)
macAddress - Bluetooth LE device MAC address.java.lang.UnsupportedOperationException - if called on system without Bluetooth capabilitiespublic abstract java.util.Set<RxBleDevice> getBondedDevices()
java.lang.UnsupportedOperationException - if called on system without Bluetooth capabilities@Deprecated public abstract <any> scanBleDevices(java.util.UUID... filterServiceUUIDs)
scanBleDevices(ScanSettings, ScanFilter...) insteadRxBleScanResult will be emitted only if _all_ UUIDs are present
in the advertisement.
The library automatically handles Bluetooth adapter's state changes but you are supposed to prompt the user to enable it if it's disabled.
filterServiceUUIDs - Filtering settings. Scan results are only filtered by exported services.
All specified UUIDs must be present in the advertisement data to match the filter.BleScanException - emits in case of error starting the scanpublic abstract <any> scanBleDevices(ScanSettings scanSettings, ScanFilter... scanFilters)
The library automatically handles Bluetooth adapter state changes but you are supposed to prompt the user to enable it if it is disabled This function works on Android 4.3 in compatibility (emulated) mode.
scanSettings - Scan settingsscanFilters - Filtering settings. ScanResult will be emitted if any of the passed scan filters will match.public abstract BackgroundScanner getBackgroundScanner()
public abstract <any> observeStateChanges()
public abstract RxBleClient.State getState()
RxBleClient.State.BLUETOOTH_NOT_AVAILABLE if check #1 fails,
RxBleClient.State.LOCATION_PERMISSION_NOT_GRANTED if check #2 fails,
RxBleClient.State.BLUETOOTH_NOT_ENABLED if check #3 fails,
RxBleClient.State.LOCATION_SERVICES_NOT_ENABLED if check #4 fails,
RxBleClient.State.READY