public final class BleDevice extends BleNode
BleManager
.
It acts as a BLE-specific abstraction for the BluetoothDevice
and
BluetoothGatt
classes. It does everything you would expect, like
providing methods for connecting, reading/writing characteristics, enabling
notifications, etc.
BleManager.newDevice(String, String)
, usually they're created
implicitly by BleManager
as a result of a scanning operation (e.g.
BleManager.startScan()
) and sent to you through
GenericListener_Void.onEvent(Event)
.Modifier and Type | Field and Description |
---|---|
static BleDevice |
NULL
Special value that is used in place of Java's built-in
null . |
Modifier and Type | Method and Description |
---|---|
void |
addHistoricalData(java.util.UUID uuid,
byte[] data)
Same as
addHistoricalData(UUID, byte[], EpochTime) but uses System.currentTimeMillis() for the timestamp. |
void |
addHistoricalData(java.util.UUID uuid,
byte[] data,
EpochTime epochTime)
Manual way to add data to the historical data list managed by this device.
|
void |
addHistoricalData(java.util.UUID uuid,
EpochTime epochTime,
byte[] data)
Just an overload of
addHistoricalData(UUID, byte[], EpochTime) with the data and epochTime parameters switched around. |
void |
addHistoricalData(java.util.UUID uuid,
ForEach_Returning<HistoricalData> historicalData)
Same as
addHistoricalData(UUID, byte[], EpochTime) but for large datasets this is more efficient when writing to disk. |
void |
addHistoricalData(java.util.UUID uuid,
HistoricalData historicalData)
|
void |
addHistoricalData(java.util.UUID uuid,
java.util.Iterator<HistoricalData> historicalData)
Same as
addHistoricalData(UUID, byte[], EpochTime) but for large datasets this is more efficient when writing to disk. |
void |
addHistoricalData(java.util.UUID uuid,
java.util.List<HistoricalData> historicalData)
Same as
addHistoricalData(UUID, byte[], EpochTime) but for large datasets this is more efficient when writing to disk. |
BondListener.BondEvent |
bond()
Attempts to create a bond.
|
BondListener.BondEvent |
bond(BondListener listener)
Same as
bond() but you can pass a listener to be notified of the details behind success or failure. |
void |
clearAllData()
One method to remove absolutely all "metadata" related to this device that is stored on disk and/or cached in memory in any way.
|
void |
clearHistoricalData_memoryOnly()
Clears all
HistoricalData tracked by this device. |
void |
clearHistoricalData_memoryOnly(EpochTimeRange range)
Clears all
HistoricalData tracked by this device within the given range. |
void |
clearHistoricalData_memoryOnly(EpochTimeRange range,
long count)
Clears the first
count number of HistoricalData tracked by this device within the given range. |
void |
clearHistoricalData_memoryOnly(long count)
Clears the first
count number of HistoricalData tracked by this device. |
void |
clearHistoricalData_memoryOnly(java.util.UUID uuid)
Clears all
HistoricalData tracked by this device for a particular
characteristic UUID . |
void |
clearHistoricalData_memoryOnly(java.util.UUID characteristicUuid,
EpochTimeRange range)
Clears all
HistoricalData tracked by this device for a particular
characteristic UUID within the given range. |
void |
clearHistoricalData_memoryOnly(java.util.UUID characteristicUuid,
EpochTimeRange range,
long count)
Clears the first
count number of HistoricalData tracked by this device for a particular
characteristic UUID within the given range. |
void |
clearHistoricalData_memoryOnly(java.util.UUID uuid,
long count)
Clears the first
count number of HistoricalData tracked by this device for a particular
characteristic UUID . |
void |
clearHistoricalData()
Clears all
HistoricalData tracked by this device. |
void |
clearHistoricalData(EpochTimeRange range)
Clears all
HistoricalData tracked by this device within the given range. |
void |
clearHistoricalData(EpochTimeRange range,
long count)
Clears the first
count number of HistoricalData tracked by this device within the given range. |
void |
clearHistoricalData(long count)
Clears the first
count number of HistoricalData tracked by this device. |
void |
clearHistoricalData(java.util.UUID... uuids)
Overload of
clearHistoricalData(UUID) that just calls that method multiple times. |
void |
clearHistoricalData(java.util.UUID uuid)
Clears all
HistoricalData tracked by this device for a particular
characteristic UUID . |
void |
clearHistoricalData(java.util.UUID uuid,
EpochTimeRange range)
Clears all
HistoricalData tracked by this device for a particular
characteristic UUID within the given range. |
void |
clearHistoricalData(java.util.UUID uuid,
EpochTimeRange range,
long count)
Clears the first
count number of HistoricalData tracked by this device for a particular
characteristic UUID within the given range. |
void |
clearHistoricalData(java.util.UUID uuid,
long count)
Clears the first
count number of HistoricalData tracked by this device for a particular
characteristic UUID . |
void |
clearName()
Clears any name previously provided through
setName(String) or overloads. |
void |
clearSharedPreferences()
Convenience forwarding of
BleManager.clearSharedPreferences(String) . |
DeviceReconnectFilter.ConnectFailEvent |
connect()
Starts a connection process, or does nothing if already
BleDeviceState.BLE_CONNECTED or BleDeviceState.BLE_CONNECTING . |
DeviceReconnectFilter.ConnectFailEvent |
connect(BleTransaction.Auth authenticationTxn)
Same as
connect() but provides a hook for the app to do some kind of authentication handshake if it wishes. |
DeviceReconnectFilter.ConnectFailEvent |
connect(BleTransaction.Auth authenticationTxn,
BleTransaction.Init initTxn)
Combination of
connect(BleTransaction.Auth) and connect(BleTransaction.Init) . |
DeviceReconnectFilter.ConnectFailEvent |
connect(BleTransaction.Auth authenticationTxn,
BleTransaction.Init initTxn,
DeviceConnectListener connectionListener)
Same as
connect(BleTransaction.Auth, BleTransaction.Init) but calls setListener_State(DeviceStateListener) and
setListener_Reconnect(DeviceReconnectFilter) for you. |
DeviceReconnectFilter.ConnectFailEvent |
connect(BleTransaction.Init initTxn)
Same as
connect() but provides a hook for the app to do some kind of initialization before it's considered fully
BleDeviceState.INITIALIZED . |
DeviceReconnectFilter.ConnectFailEvent |
connect(DeviceConnectListener connectListener)
Starts a connection process, or does nothing if already
BleDeviceState.BLE_CONNECTED or BleDeviceState.BLE_CONNECTING . |
void |
disableNotifies(BleNotify[] notifies)
Overload for
disableNotify(BleNotify) . |
void |
disableNotifies(java.lang.Iterable<BleNotify> notifies)
Overload for
disableNotify(BleNotify) . |
ReadWriteListener.ReadWriteEvent |
disableNotify(BleNotify notify)
Disables all notifications enabled by
enableNotify(BleNotify) or
any of it's overloads. |
void |
disableNotify(java.lang.Iterable<java.util.UUID> charUuids)
Deprecated.
- This will be removed in v3.1. Please use
disableNotifies(Iterable) instead. |
void |
disableNotify(java.lang.Iterable<java.util.UUID> charUuids,
Interval forceReadTimeout)
Deprecated.
- This will be removed in v3.1. Please use
disableNotifies(Iterable) instead. |
void |
disableNotify(java.lang.Iterable<java.util.UUID> charUuids,
Interval forceReadTimeout,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
disableNotifies(Iterable) instead. |
void |
disableNotify(java.lang.Iterable<java.util.UUID> charUuids,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
disableNotifies(Iterable) instead. |
ReadWriteListener.ReadWriteEvent |
disableNotify(java.util.UUID characteristicUuid)
Deprecated.
- This will be removed in v3.1. Please use
disableNotify(BleNotify) instead. |
void |
disableNotify(java.util.UUID[] uuids)
Deprecated.
- This will be removed in v3.1. Please use
disableNotifies(BleNotify[]) instead. |
void |
disableNotify(java.util.UUID[] uuids,
Interval forceReadTimeout)
Deprecated.
- This will be removed in v3.1. Please use
disableNotifies(BleNotify[]) instead. |
void |
disableNotify(java.util.UUID[] uuids,
Interval forceReadTimeout,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
disableNotifies(BleNotify[]) instead. |
void |
disableNotify(java.util.UUID[] uuids,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
disableNotifies(BleNotify[]) instead. |
ReadWriteListener.ReadWriteEvent |
disableNotify(java.util.UUID characteristicUuid,
Interval forceReadTimeout)
Deprecated.
- This will be removed in v3.1. Please use
disableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
disableNotify(java.util.UUID characteristicUuid,
Interval forceReadTimeout,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
disableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
disableNotify(java.util.UUID characteristicUuid,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
disableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
disableNotify(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid)
Deprecated.
- This will be removed in v3.1. Please use
disableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
disableNotify(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
DescriptorFilter descriptorFilter,
Interval forceReadTimeout)
Deprecated.
- This will be removed in v3.1. Please use
disableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
disableNotify(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
Interval forceReadTimeout)
Deprecated.
- This will be removed in v3.1. Please use
disableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
disableNotify(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
Interval forceReadTimeout,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
disableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
disableNotify(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
disableNotify(BleNotify) instead. |
boolean |
disconnect_remote()
Same as
disconnect() but this call roughly simulates the disconnect as if it's because of the remote device going down, going out of range, etc. |
boolean |
disconnect()
Disconnects from a connected device or does nothing if already
BleDeviceState.BLE_DISCONNECTED . |
boolean |
disconnectWhenReady()
Similar to
disconnect() with the difference being the disconnect task is set to a low priority. |
void |
enableNotifies(BleNotify[] notifies)
Overload for
enableNotify(BleNotify) . |
void |
enableNotifies(java.lang.Iterable<BleNotify> notifies)
Overload for
enableNotify(BleNotify) . |
ReadWriteListener.ReadWriteEvent |
enableNotify(BleNotify notify)
Enables notification on the given characteristic.
|
void |
enableNotify(java.lang.Iterable<java.util.UUID> charUuids)
Deprecated.
- This will be removed in v3.1. Please use
enableNotifies(Iterable) instead. |
void |
enableNotify(java.lang.Iterable<java.util.UUID> charUuids,
Interval forceReadTimeout)
Deprecated.
- This will be removed in v3.1. Please use
enableNotifies(Iterable) instead. |
void |
enableNotify(java.lang.Iterable<java.util.UUID> charUuids,
Interval forceReadTimeout,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
enableNotifies(Iterable) instead. |
void |
enableNotify(java.lang.Iterable<java.util.UUID> charUuids,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
enableNotifies(Iterable) instead. |
ReadWriteListener.ReadWriteEvent |
enableNotify(java.util.UUID characteristicUuid)
Deprecated.
- This will be removed in v3.1. Please use
enableNotify(BleNotify) instead. |
void |
enableNotify(java.util.UUID[] charUuids)
Deprecated.
- This will be removed in v3.1. Please use
enableNotifies(BleNotify[]) instead. |
void |
enableNotify(java.util.UUID[] charUuids,
Interval forceReadTimeout)
Deprecated.
- This will be removed in v3.1. Please use
enableNotifies(BleNotify[]) instead. |
void |
enableNotify(java.util.UUID[] charUuids,
Interval forceReadTimeout,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
enableNotifies(BleNotify[]) instead. |
void |
enableNotify(java.util.UUID[] charUuids,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
enableNotifies(BleNotify[]) instead. |
ReadWriteListener.ReadWriteEvent |
enableNotify(java.util.UUID characteristicUuid,
Interval forceReadTimeout)
Deprecated.
- This will be removed in v3.1. Please use
enableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
enableNotify(java.util.UUID characteristicUuid,
Interval forceReadTimeout,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
enableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
enableNotify(java.util.UUID characteristicUuid,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
enableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
enableNotify(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid)
Deprecated.
- This will be removed in v3.1. Please use
enableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
enableNotify(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
Interval forceReadTimeout)
Deprecated.
- This will be removed in v3.1. Please use
enableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
enableNotify(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
Interval forceReadTimeout,
DescriptorFilter descriptorFilter,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
enableNotify(BleNotify) instead. |
ReadWriteListener.ReadWriteEvent |
enableNotify(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
enableNotify(BleNotify) instead. |
boolean |
equals(BleDevice device_nullable)
First checks referential equality and if
false checks
equality of getMacAddress() . |
boolean |
equals(java.lang.Object object_nullable)
Returns
equals(BleDevice) if object is an instance of BleDevice . |
java.util.Map<java.util.UUID,byte[]> |
getAdvertisedServiceData()
Returns the manufacturer data, if any, parsed from
getScanRecord() . |
java.util.UUID[] |
getAdvertisedServices()
Returns the advertised services, if any, parsed from
getScanRecord() . |
int |
getAdvertisingFlags()
Returns the advertising flags, if any, parsed from
getScanRecord() . |
Interval |
getAverageReadTime()
See similar explanation for
getAverageWriteTime() . |
Interval |
getAverageWriteTime()
Returns the average round trip time in seconds for all write operations started with
write(UUID, byte[]) or
write(UUID, byte[], ReadWriteListener) . |
BleDeviceConfig |
getConfig()
Return the
BleDeviceConfig this device is set to use. |
BleConnectionPriority |
getConnectionPriority()
Returns the connection priority value set by
setConnectionPriority(BleConnectionPriority, ReadWriteListener) , or BleNodeConfig.DEFAULT_MTU_SIZE if
it was never set explicitly. |
int |
getConnectionRetryCount()
Returns the connection failure retry count during a retry loop.
|
Distance |
getDistance()
Returns the approximate distance in meters based on
getRssi() and
getTxPower() . |
int |
getEffectiveWriteMtuSize()
Returns the effective MTU size for a write.
|
HistoricalData |
getHistoricalData_atOffset(java.util.UUID uuid,
EpochTimeRange range,
int offsetFromStart)
Same as
getHistoricalData_atOffset(java.util.UUID, int) but offset is relative to the time range provided. |
HistoricalData |
getHistoricalData_atOffset(java.util.UUID uuid,
int offsetFromStart)
Same as
addHistoricalData(UUID, byte[], EpochTime) but returns the data from the chronological offset, i.e. |
HistoricalDataCursor |
getHistoricalData_cursor(java.util.UUID uuid)
Returns a cursor capable of random access to the database-persisted historical data for this device.
|
HistoricalDataCursor |
getHistoricalData_cursor(java.util.UUID uuid,
EpochTimeRange range)
Same as
getHistoricalData_cursor(UUID) but constrains the results to the given time range. |
boolean |
getHistoricalData_forEach(java.util.UUID uuid,
EpochTimeRange range,
ForEach_Breakable<HistoricalData> forEach)
Provides all historical data through the "for each" provided within the range provided.
|
boolean |
getHistoricalData_forEach(java.util.UUID uuid,
EpochTimeRange range,
ForEach_Void<HistoricalData> forEach)
Provides all historical data through the "for each" provided within the range provided.
|
boolean |
getHistoricalData_forEach(java.util.UUID uuid,
ForEach_Breakable<HistoricalData> forEach)
Provides all historical data through the "for each" provided.
|
boolean |
getHistoricalData_forEach(java.util.UUID uuid,
ForEach_Void<HistoricalData> forEach)
Provides all historical data through the "for each" provided.
|
java.util.Iterator<HistoricalData> |
getHistoricalData_iterator(java.util.UUID uuid)
Returns an iterator that will iterate through all
HistoricalData entries. |
java.util.Iterator<HistoricalData> |
getHistoricalData_iterator(java.util.UUID uuid,
EpochTimeRange range)
Returns an iterator that will iterate through all
HistoricalData entries within the range provided. |
HistoricalData |
getHistoricalData_latest(java.util.UUID uuid)
Returns the cached data from the latest successful read or notify received for a given uuid.
|
int |
getHistoricalDataCount(java.util.UUID uuid)
Returns the number of historical data entries that have been logged for the device's given characteristic.
|
int |
getHistoricalDataCount(java.util.UUID uuid,
EpochTimeRange range)
Returns the number of historical data entries that have been logged
for the device's given characteristic within the range provided.
|
java.lang.String |
getHistoricalDataTableName(java.util.UUID uuid)
Returns the database table name for the underlying store of historical data for the given
UUID . |
State.ChangeIntent |
getLastDisconnectIntent()
This enum gives you an indication of the last interaction with a device across app sessions or in-app BLE
BleManagerState.OFF ->BleManagerState.ON cycles or undiscovery->rediscovery, which
basically means how it was last BleDeviceState.BLE_DISCONNECTED . |
EpochTime |
getLastDiscoveryTime()
Returns the last time the device was
DiscoveryListener.LifeCycle.DISCOVERED
or DiscoveryListener.LifeCycle.REDISCOVERED . |
DeviceConnectListener |
getListener_Connect()
Returns the current
DeviceConnectListener being used (the top of the stack). |
NotificationListener |
getListener_Notification()
Returns the current
NotificationListener being used (the top of the stack). |
ReadWriteListener |
getListener_ReadWrite()
Returns the current
ReadWriteListener being used (the top of the stack). |
DeviceReconnectFilter |
getListener_Reconnect()
Returns the current
DeviceReconnectFilter being used (the top of the stack). |
DeviceStateListener |
getListener_State()
Returns the current
DeviceStateListener being used (the top of the stack). |
java.lang.String |
getMacAddress()
Returns the MAC address of this device, as retrieved from the native stack or provided through
BleManager.newDevice(String) (or overloads thereof). |
byte[] |
getManufacturerData()
Returns the manufacturer data, if any, parsed from
getScanRecord() . |
int |
getManufacturerId()
Returns the manufacturer id, if any, parsed from
getScanRecord() }. |
int |
getMtu()
Returns the "maximum transmission unit" value set by
negotiateMtu(int, ReadWriteListener) , or BleNodeConfig.DEFAULT_MTU_SIZE if
it was never set explicitly. |
java.lang.String |
getName_debug()
Returns a name useful for logging and debugging.
|
java.lang.String |
getName_native()
Returns the raw, unmodified device name retrieved from the stack.
|
java.lang.String |
getName_normalized()
The name retrieved from
getName_native() can change arbitrarily,
like the last 4 of the MAC address can get appended sometimes, and spaces
might get changed to underscores or vice-versa, caps to lowercase, etc. |
java.lang.String |
getName_override()
By default returns the same value as
getName_native() . |
android.bluetooth.BluetoothDevice |
getNative()
Provides just-in-case lower-level access to the native device instance.
|
android.bluetooth.BluetoothGatt |
getNativeGatt()
See pertinent warning for
getNative() . |
int |
getNativeStateMask()
Returns the actual native state mask representation of the
BleDeviceState for this device. |
BleDeviceOrigin |
getOrigin()
How the device was originally created, either from scanning or explicit creation.
|
int |
getRssi()
Returns the raw RSSI retrieved from when the device was discovered,
rediscovered, or when you call
readRssi() or startRssiPoll(Interval) . |
Percent |
getRssiPercent()
Raw RSSI from
getRssi() is a little cryptic, so this gives you a friendly 0%-100% value for signal strength. |
BleScanRecord |
getScanInfo()
Returns the
BleScanRecord instance held by this BleDevice . |
byte[] |
getScanRecord()
Returns the scan record from when we discovered the device.
|
int |
getStateMask()
Returns the bitwise state mask representation of
BleDeviceState for this device. |
Interval |
getTimeInState(BleDeviceState state)
If
is(BleDeviceState) returns true for the given state (i.e. |
int |
getTxPower()
Returns the calibrated transmission power of the device.
|
boolean |
hasHistoricalData()
Returns
true if there is any historical data at all for this device. |
boolean |
hasHistoricalData(EpochTimeRange range)
Returns
true if there is any historical data at all for this device within the given range. |
boolean |
hasHistoricalData(java.util.UUID uuid)
Returns
true if there is any historical data for the given uuid. |
boolean |
hasHistoricalData(java.util.UUID[] uuids)
Returns
true if there is any historical data for any of the given uuids. |
boolean |
hasHistoricalData(java.util.UUID uuid,
EpochTimeRange range)
Returns
true if there is any historical data for the given uuid within the given range. |
boolean |
is(BleDeviceState state)
Returns whether the device is in the provided state.
|
boolean |
is(java.lang.Object... query)
Similar to
is(BleDeviceState) and isAny(BleDeviceState...) but allows you to give a simple query
made up of BleDeviceState and Boolean pairs. |
boolean |
isAll(BleDeviceState... states)
Returns whether the device is in all of the provided states.
|
boolean |
isAll(int mask_BleDeviceState)
Returns
true if there is complete bitwise overlap between the provided value and getStateMask() . |
boolean |
isAny(BleDeviceState... states)
Returns whether the device is in any of the provided states.
|
boolean |
isAny(int mask_BleDeviceState)
Returns
true if there is any bitwise overlap between the provided value and getStateMask() . |
boolean |
isConnectable()
Convenience method to tell you whether a call to
connect() (or overloads) has a chance of succeeding. |
boolean |
isHistoricalDataLoaded()
Returns
true if the historical data for all historical data for
this device is loaded into memory. |
boolean |
isHistoricalDataLoaded(java.util.UUID uuid)
Returns
true if the historical data for a given uuid is loaded into memory. |
boolean |
isHistoricalDataLoading()
Returns whether the device is currently loading any historical data to memory, either through
loadHistoricalData() (or overloads) or getHistoricalData_iterator(UUID) (or overloads). |
boolean |
isHistoricalDataLoading(java.util.UUID uuid)
Returns whether the device is currently loading any historical data to memory for the given uuid, either through
loadHistoricalData() (or overloads) or getHistoricalData_iterator(UUID) (or overloads). |
boolean |
isNotifyEnabled(java.util.UUID uuid)
Returns
true if notifications are enabled for the given uuid. |
boolean |
isNotifyEnabling(java.util.UUID uuid)
Returns
true if SweetBlue is in the process of enabling notifications for the given uuid. |
boolean |
isNull()
|
void |
loadHistoricalData()
Loads all historical data to memory for this device.
|
void |
loadHistoricalData(HistoricalDataLoadListener listener)
Loads all historical data to memory for this device with a callback for when it's complete.
|
void |
loadHistoricalData(java.util.UUID uuid)
Loads all historical data to memory for this device for the given
UUID . |
void |
loadHistoricalData(java.util.UUID uuid,
HistoricalDataLoadListener listener)
Loads all historical data to memory for this device for the given
UUID . |
ReadWriteListener.ReadWriteEvent |
negotiateMtu(int mtu)
Same as
negotiateMtu(int, ReadWriteListener) , which passes null for the listener, if you don't care about the result, or are using
a global listener via setListener_ReadWrite(ReadWriteListener) , or BleManager.setListener_Read_Write(ReadWriteListener) . |
ReadWriteListener.ReadWriteEvent |
negotiateMtu(int mtu,
ReadWriteListener listener)
Wrapper for
BluetoothGatt.requestMtu(int) which attempts to change the "maximum transmission unit" for a given connection. |
ReadWriteListener.ReadWriteEvent |
negotiateMtuToDefault()
Same as
negotiateMtuToDefault(ReadWriteListener) but use this method when you don't much care when/if the "maximum transmission unit" is actually updated. |
ReadWriteListener.ReadWriteEvent |
negotiateMtuToDefault(ReadWriteListener listener)
Overload of
negotiateMtu(int, ReadWriteListener) that returns the "maximum transmission unit" to the default. |
boolean |
performOta(BleTransaction.Ota txn)
Kicks off an "over the air" long-term transaction if it's not already
taking place and the device is
BleDeviceState.INITIALIZED . |
boolean |
performTransaction(BleTransaction txn)
Allows you to perform an arbitrary transaction that is not associated with any
BleDeviceState like
BleDeviceState.PERFORMING_OTA , BleDeviceState.AUTHENTICATING or BleDeviceState.INITIALIZING . |
boolean |
popListener_Connect()
Pop the current
DeviceConnectListener out of the stack of listeners. |
boolean |
popListener_Connect(DeviceConnectListener listener)
Similar to
popListener_Connect() , only this method allows you to pass in the DeviceConnectListener you'd like to "pop" from the stack. |
boolean |
popListener_Notification()
Pops the current
NotificationListener off the stack of listeners. |
boolean |
popListener_Notification(NotificationListener listener)
Similar to
popListener_Notification() , only this method allows you to pass in the NotificationListener you'd like to "pop" from the stack. |
boolean |
popListener_ReadWrite()
Pops the current
ReadWriteListener off the stack of listeners. |
boolean |
popListener_ReadWrite(ReadWriteListener listener)
Similar to
popListener_ReadWrite() , only this method allows you to pass in the ReadWriteListener you'd like to "pop" from the stack. |
boolean |
popListener_Reconnect()
Pops the current
DeviceReconnectFilter off the stack of listeners. |
boolean |
popListener_Reconnect(DeviceReconnectFilter listener)
Similar to
popListener_Reconnect() , only this method allows you to pass in the DeviceReconnectFilter you'd like to "pop" from the stack. |
boolean |
popListener_State()
Pop the current
DeviceStateListener out of the stack of listeners. |
boolean |
popListener_State(DeviceStateListener listener)
Similar to
popListener_State() , only this method allows you to pass in the DeviceStateListener you'd like to "pop" from the stack. |
java.lang.String |
printState()
Returns a string of all the states this
BleDevice is currently in. |
boolean |
pushListener_Connect(DeviceConnectListener listener)
Push a new
DeviceConnectListener onto the stack. |
void |
pushListener_Notification(NotificationListener listener)
Pushes the provided
NotificationListener on to the top of the stack of listeners. |
void |
pushListener_ReadWrite(ReadWriteListener listener)
Pushes the provided
ReadWriteListener on to the top of the stack of listeners. |
void |
pushListener_Reconnect(DeviceReconnectFilter listener)
Pushes the provided
DeviceReconnectFilter on to the top of the stack of listeners. |
boolean |
pushListener_State(DeviceStateListener listener)
Push a new
DeviceStateListener onto the stack. |
ReadWriteListener.ReadWriteEvent |
read(BleDescriptorRead read)
Reads a descriptor from the device with a callback, if one is set in the provided
BleRead . |
ReadWriteListener.ReadWriteEvent |
read(BleRead read)
Reads a characteristic from the device.
|
void |
read(java.lang.Iterable<java.util.UUID> charUuids)
Deprecated.
- This will be removed in v3.1. Please use
readMany(Iterable) instead. |
void |
read(java.lang.Iterable<java.util.UUID> charUuids,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
readMany(Iterable) instead. |
ReadWriteListener.ReadWriteEvent |
read(java.util.UUID characteristicUuid)
Deprecated.
- This will be removed in v3.1. Please use
read(BleRead) instead. |
void |
read(java.util.UUID[] charUuids)
Deprecated.
- This will be removed in v3.1. Please use
readMany(BleRead[]) instead. |
void |
read(java.util.UUID[] charUuids,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
readMany(BleRead[]) instead. |
ReadWriteListener.ReadWriteEvent |
read(java.util.UUID characteristicUuid,
DescriptorFilter descriptorFilter)
Deprecated.
- This will be removed in v3.1. Please use
read(BleRead) instead. |
ReadWriteListener.ReadWriteEvent |
read(java.util.UUID characteristicUuid,
DescriptorFilter descriptorFilter,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
read(BleRead) instead. |
ReadWriteListener.ReadWriteEvent |
read(java.util.UUID characteristicUuid,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
read(BleRead) instead. |
ReadWriteListener.ReadWriteEvent |
read(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid)
Deprecated.
- This will be removed in v3.1. Please use
read(BleRead) instead. |
ReadWriteListener.ReadWriteEvent |
read(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
DescriptorFilter descriptorFilter)
Deprecated.
- This will be removed in v3.1. Please use
read(BleRead) instead. |
ReadWriteListener.ReadWriteEvent |
read(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
DescriptorFilter descriptorFilter,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
read(BleRead) instead. |
ReadWriteListener.ReadWriteEvent |
read(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
read(BleRead) instead. |
ReadWriteListener.ReadWriteEvent |
readBatteryLevel(ReadWriteListener listener)
Read the battery level of this device.
|
ReadWriteListener.ReadWriteEvent |
readDescriptor(java.util.UUID descriptorUuid)
Deprecated.
- This will be removed in v3.1. Please use
read(BleDescriptorRead) instead. |
ReadWriteListener.ReadWriteEvent |
readDescriptor(java.util.UUID descriptorUuid,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
read(BleDescriptorRead) instead. |
ReadWriteListener.ReadWriteEvent |
readDescriptor(java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid)
Deprecated.
- This will be removed in v3.1. Please use
read(BleDescriptorRead) instead. |
ReadWriteListener.ReadWriteEvent |
readDescriptor(java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
read(BleDescriptorRead) instead. |
ReadWriteListener.ReadWriteEvent |
readDescriptor(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid)
Deprecated.
- This will be removed in v3.1. Please use
read(BleDescriptorRead) instead. |
ReadWriteListener.ReadWriteEvent |
readDescriptor(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid,
ReadWriteListener listener)
Deprecated.
- This will be removed in v3.1. Please use
read(BleDescriptorRead) instead. |
void |
readMany(BleRead[] bleReads)
Overload of
read(BleRead) . |
void |
readMany(java.lang.Iterable<BleRead> bleReads)
Overload of
read(BleRead) . |
ReadWriteListener.ReadWriteEvent |
readPhyOptions()
Overload of
readPhyOptions(ReadWriteListener) , which passes no listener. |
ReadWriteListener.ReadWriteEvent |
readPhyOptions(ReadWriteListener listener)
Method to get the current "phy options" (physical layer), or current bluetooth 5 feature.
|
ReadWriteListener.ReadWriteEvent |
readRssi()
Same as
readRssi(ReadWriteListener) but use this method when you don't much care when/if the RSSI is actually updated. |
ReadWriteListener.ReadWriteEvent |
readRssi(ReadWriteListener listener)
Wrapper for
BluetoothGatt.readRemoteRssi() . |
void |
refreshGattDatabase()
Overload of
refreshGattDatabase(Interval) which uses the default gatt refresh delay of BleDeviceConfig.DEFAULT_GATT_REFRESH_DELAY . |
void |
refreshGattDatabase(Interval gattPause)
This only applies to a device which is
BleDeviceState.BLE_CONNECTED . |
ReadWriteListener.ReadWriteEvent |
reliableWrite_abort()
Wrapper for
BluetoothGatt.abortReliableWrite() - will return an event such that ReadWriteListener.ReadWriteEvent.isNull() will
return false if there are no problems. |
ReadWriteListener.ReadWriteEvent |
reliableWrite_begin(ReadWriteListener listener)
Wrapper for
BluetoothGatt.beginReliableWrite() - will return an event such that ReadWriteListener.ReadWriteEvent.isNull() will
return false if there are no problems. |
ReadWriteListener.ReadWriteEvent |
reliableWrite_execute()
Wrapper for
BluetoothGatt.abortReliableWrite() - will return an event such that ReadWriteListener.ReadWriteEvent.isNull() will
return false if there are no problems. |
void |
setConfig(BleDeviceConfig config_nullable)
Optionally sets overrides for any custom options given to
BleManager.get(android.content.Context, BleManagerConfig)
for this individual device. |
ReadWriteListener.ReadWriteEvent |
setConnectionPriority(BleConnectionPriority connectionPriority)
Same as
setConnectionPriority(BleConnectionPriority, ReadWriteListener) but use this method when you don't much care when/if the connection priority is updated. |
ReadWriteListener.ReadWriteEvent |
setConnectionPriority(BleConnectionPriority connectionPriority,
ReadWriteListener listener)
Wrapper for
BluetoothGatt.requestConnectionPriority(int) which attempts to change the connection priority for a given connection. |
void |
setListener_Bond(BondListener listener_nullable)
Set a listener here to be notified whenever a bond attempt succeeds.
|
boolean |
setListener_Connect(DeviceConnectListener listener)
Set a listener here to be notified whenever this device connects, or gets disconnected.
|
void |
setListener_HistoricalDataLoad(HistoricalDataLoadListener listener_nullable)
Sets a default backup
HistoricalDataLoadListener that will be invoked
for all historical data loads to memory for all uuids. |
void |
setListener_Notification(NotificationListener listener_nullable)
Sets a default
NotificationListener that will be called when receiving notifications, or indications. |
void |
setListener_ReadWrite(ReadWriteListener listener_nullable)
Sets a default backup
ReadWriteListener that will be called for all calls to read(UUID, ReadWriteListener) ,
write(UUID, byte[], ReadWriteListener) , enableNotify(UUID, ReadWriteListener) , etc. |
void |
setListener_Reconnect(DeviceReconnectFilter listener_nullable)
Set a listener here to be notified whenever a connection fails and to
have control over retry behavior.
|
boolean |
setListener_State(DeviceStateListener listener_nullable)
Set a listener here to be notified whenever this device's state changes.
|
void |
setName(java.lang.String name)
Same as
setName(String, UUID, ReadWriteListener) but will not attempt to propagate the
name change to the remote device. |
ReadWriteListener.ReadWriteEvent |
setName(java.lang.String name,
java.util.UUID characteristicUuid)
Same as
setName(String, UUID, ReadWriteListener) but you can use this
if you don't care much whether the device name change actually successfully reaches
the remote device. |
ReadWriteListener.ReadWriteEvent |
setName(java.lang.String name,
java.util.UUID characteristicUuid,
ReadWriteListener listener)
Sets the local name of the device and also attempts a
write(java.util.UUID, byte[], ReadWriteListener)
using the given UUID . |
ReadWriteListener.ReadWriteEvent |
setPhyOptions(Phy phyOptions)
Overload of
setPhyOptions(Phy, ReadWriteListener) , which passes no listener. |
ReadWriteListener.ReadWriteEvent |
setPhyOptions(Phy phyOptions,
ReadWriteListener listener)
Use this method to manually set the bluetooth 5 physical layer to use a bluetooth 5 feature (high speed/long range).
|
void |
startChangeTrackingPoll(BleRead read,
Interval interval)
Similar to
startPoll(BleRead, Interval) but only
invokes a callback when a change in the characteristic value is detected. |
void |
startChangeTrackingPoll(java.lang.Iterable<java.util.UUID> charUuids,
Interval interval)
Same as
startChangeTrackingPoll(java.util.UUID[], Interval, ReadWriteListener) but without a listener. |
void |
startChangeTrackingPoll(java.lang.Iterable<java.util.UUID> charUuids,
Interval interval,
ReadWriteListener listener)
Convenience to call
startChangeTrackingPoll(java.util.UUID, Interval, ReadWriteListener) for multiple
characteristic uuids all at once. |
void |
startChangeTrackingPoll(java.util.UUID[] charUuids,
Interval interval)
Same as
startChangeTrackingPoll(java.util.UUID[], Interval, ReadWriteListener) but without a listener. |
void |
startChangeTrackingPoll(java.util.UUID[] charUuids,
Interval interval,
ReadWriteListener listener)
Convenience to call
startChangeTrackingPoll(java.util.UUID, Interval, ReadWriteListener) for multiple
characteristic uuids all at once. |
void |
startChangeTrackingPoll(java.util.UUID characteristicUuid,
Interval interval,
ReadWriteListener listener)
Similar to
startPoll(UUID, Interval, ReadWriteListener) but only
invokes a callback when a change in the characteristic value is detected. |
void |
startChangeTrackingPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
DescriptorFilter descriptorFilter,
Interval interval,
ReadWriteListener listener)
Overload of
startChangeTrackingPoll(UUID, UUID, Interval, ReadWriteListener) for when you have characteristics with identical uuids under the same service. |
void |
startChangeTrackingPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
Interval interval,
ReadWriteListener listener)
Overload of
startChangeTrackingPoll(UUID, Interval, ReadWriteListener) for when you have characteristics with identical uuids under different services. |
void |
startPoll(BleRead read,
Interval interval)
Starts a periodic read of a particular characteristic.
|
void |
startPoll(java.lang.Iterable<java.util.UUID> charUuids,
Interval interval)
Same as
startPoll(java.util.UUID[], Interval, ReadWriteListener) but without a listener. |
void |
startPoll(java.lang.Iterable<java.util.UUID> charUuids,
Interval interval,
ReadWriteListener listener)
Convenience to call
startPoll(java.util.UUID, Interval, ReadWriteListener) for multiple
characteristic uuids all at once. |
void |
startPoll(java.util.UUID[] charUuids,
Interval interval)
Same as
startPoll(java.util.UUID[], Interval, ReadWriteListener) but without a listener. |
void |
startPoll(java.util.UUID[] charUuids,
Interval interval,
ReadWriteListener listener)
Convenience to call
startPoll(java.util.UUID, Interval, ReadWriteListener) for multiple
characteristic uuids all at once. |
void |
startPoll(java.util.UUID characteristicUuid,
Interval interval)
Same as
startPoll(java.util.UUID, Interval, ReadWriteListener) but without a listener. |
void |
startPoll(java.util.UUID characteristicUuid,
Interval interval,
ReadWriteListener listener)
Starts a periodic read of a particular characteristic.
|
void |
startPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
DescriptorFilter descriptorFilter,
Interval interval,
ReadWriteListener listener)
Overload of
startPoll(UUID, UUID, Interval, ReadWriteListener) for when you have characteristics with identical uuids under the same service. |
void |
startPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
Interval interval)
Overload of
startPoll(UUID, Interval) for when you have characteristics with identical uuids under different services. |
void |
startPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
Interval interval,
ReadWriteListener listener)
Overload of
startPoll(UUID, Interval, ReadWriteListener) for when you have characteristics with identical uuids under different services. |
void |
startRssiPoll(Interval interval)
Same as
startPoll(UUID, Interval, ReadWriteListener) but for when you don't care when/if the RSSI is actually updated. |
void |
startRssiPoll(Interval interval,
ReadWriteListener listener)
Kicks off a poll that automatically calls
readRssi(ReadWriteListener) at the Interval frequency
specified. |
void |
stopPoll(BleRead read,
Interval interval)
Stop a poll with the given
BleRead , and interval. |
void |
stopPoll(java.lang.Iterable<java.util.UUID> uuids)
Calls
stopPoll(java.util.UUID) multiple times for you. |
void |
stopPoll(java.lang.Iterable<java.util.UUID> uuids,
Interval interval)
Calls
stopPoll(java.util.UUID, Interval) multiple times for you. |
void |
stopPoll(java.lang.Iterable<java.util.UUID> uuids,
Interval interval,
ReadWriteListener listener)
Calls
stopPoll(java.util.UUID, Interval, ReadWriteListener) multiple times for you. |
void |
stopPoll(java.util.UUID characteristicUuid)
Same as
stopPoll(java.util.UUID, ReadWriteListener) but without the listener. |
void |
stopPoll(java.util.UUID[] uuids)
Calls
stopPoll(java.util.UUID) multiple times for you. |
void |
stopPoll(java.util.UUID[] uuids,
Interval interval)
Calls
stopPoll(java.util.UUID, Interval) multiple times for you. |
void |
stopPoll(java.util.UUID[] uuids,
Interval interval,
ReadWriteListener listener)
Calls
stopPoll(java.util.UUID, Interval, ReadWriteListener) multiple times for you. |
void |
stopPoll(java.util.UUID characteristicUuid,
Interval interval)
Same as
stopPoll(java.util.UUID, Interval, ReadWriteListener) but without the listener. |
void |
stopPoll(java.util.UUID characteristicUuid,
Interval interval,
ReadWriteListener listener)
Same as
stopPoll(UUID, ReadWriteListener) but with added filtering for the poll Interval . |
void |
stopPoll(java.util.UUID characteristicUuid,
ReadWriteListener listener)
Stops a poll(s) started by either
startPoll(UUID, Interval, ReadWriteListener) or
startChangeTrackingPoll(UUID, Interval, ReadWriteListener) . |
void |
stopPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid)
Overload of
stopPoll(UUID) for when you have characteristics with identical uuids under different services. |
void |
stopPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
DescriptorFilter descriptorFilter,
Interval interval,
ReadWriteListener listener)
Overload of
stopPoll(UUID, UUID, Interval, ReadWriteListener) for when you have characteristics with identical uuids under the same service. |
void |
stopPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
Interval interval)
Overload of
stopPoll(UUID, Interval) for when you have characteristics with identical uuids under different services. |
void |
stopPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
Interval interval,
ReadWriteListener listener)
Overload of
stopPoll(UUID, Interval, ReadWriteListener) for when you have characteristics with identical uuids under different services. |
void |
stopPoll(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
ReadWriteListener listener)
Overload of
stopPoll(UUID, ReadWriteListener) for when you have characteristics with identical uuids under different services. |
void |
stopRssiPoll()
Stops an RSSI poll previously started either by
startRssiPoll(Interval) or startRssiPoll(Interval, ReadWriteListener) . |
java.lang.String |
toString()
Returns the device's name and current state for logging and debugging purposes.
|
boolean |
unbond()
Opposite of
bond() . |
boolean |
unbond(BondListener listener)
Opposite of
bond(BondListener) . |
boolean |
undiscover()
Convenience method that calls
BleManager.undiscover(BleDevice) . |
ReadWriteListener.ReadWriteEvent |
write(BleDescriptorWrite write)
Writes to the device descriptor without a callback.
|
ReadWriteListener.ReadWriteEvent |
write(BleDescriptorWrite write,
ReadWriteListener listener)
Writes to the device descriptor with a callback.
|
ReadWriteListener.ReadWriteEvent |
write(BleWrite bleWrite)
Writes to the device without a callback.
|
ReadWriteListener.ReadWriteEvent |
write(BleWrite bleWrite,
ReadWriteListener listener)
Writes to the device with a callback.
|
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID characteristicUuid,
byte[] data)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID characteristicUuid,
byte[] data,
DescriptorFilter descriptorFilter,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID characteristicUuid,
byte[] data,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID characteristicUuid,
DescriptorFilter descriptorFilter,
byte[] data)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID characteristicUuid,
FutureData futureData)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID characteristicUuid,
FutureData futureData,
DescriptorFilter descriptorFilter,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID characteristicUuid,
FutureData futureData,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
byte[] data)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
byte[] data,
DescriptorFilter descriptorFilter,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
byte[] data,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
DescriptorFilter filter,
byte[] data)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
FutureData futureData)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
FutureData futureData,
DescriptorFilter descriptorFilter)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
FutureData futureData,
DescriptorFilter descriptorFilter,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
write(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
FutureData futureData,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleWrite) , or write(BleWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID descriptorUuid,
byte[] data)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID descriptorUuid,
byte[] data,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID descriptorUuid,
FutureData futureData)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID descriptorUuid,
FutureData futureData,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid,
byte[] data)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid,
byte[] data,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid,
FutureData futureData)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid,
FutureData futureData,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid,
byte[] data,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
ReadWriteListener.ReadWriteEvent |
writeDescriptor(java.util.UUID serviceUuid,
java.util.UUID characteristicUuid,
java.util.UUID descriptorUuid,
FutureData futureData,
ReadWriteListener listener)
Deprecated.
to be removed in 3.1, use
write(BleDescriptorWrite) , or write(BleDescriptorWrite, ReadWriteListener) instead |
void |
writeMany(BleWrite[] writes)
Overload for
write(BleWrite) . |
void |
writeMany(java.lang.Iterable<BleWrite> writes)
Overload for
write(BleWrite) . |
appData, cast, cast, getManager, getNativeBleCharacteristic, getNativeBleCharacteristic, getNativeBleDescriptor_inChar, getNativeBleDescriptor_inService, getNativeBleDescriptor, getNativeBleDescriptor, getNativeBleService, getNativeCharacteristic, getNativeCharacteristics_List, getNativeCharacteristics_List, getNativeCharacteristics, getNativeCharacteristics, getNativeCharacteristics, getNativeCharacteristics, getNativeCharacteristics, getNativeCharacteristics, getNativeDescriptors_inChar_List, getNativeDescriptors_inChar, getNativeDescriptors_inChar, getNativeDescriptors_inChar, getNativeDescriptors_inService_List, getNativeDescriptors_inService, getNativeDescriptors_inService, getNativeDescriptors_inService, getNativeDescriptors_List, getNativeDescriptors_List, getNativeDescriptors, getNativeDescriptors, getNativeDescriptors, getNativeDescriptors, getNativeDescriptors, getNativeDescriptors, getNativeServices_List, getNativeServices, getNativeServices, getNativeServices, newHistoricalData, queryHistoricalData, queryHistoricalData, select
public static final BleDevice NULL
null
.public final ReadWriteListener.ReadWriteEvent reliableWrite_begin(ReadWriteListener listener)
BluetoothGatt.beginReliableWrite()
- will return an event such that ReadWriteListener.ReadWriteEvent.isNull()
will
return false
if there are no problems. After calling this you should do your write(UUID, byte[])
calls then call reliableWrite_execute()
.public final ReadWriteListener.ReadWriteEvent reliableWrite_abort()
BluetoothGatt.abortReliableWrite()
- will return an event such that ReadWriteListener.ReadWriteEvent.isNull()
will
return false
if there are no problems. This call requires a previous call to reliableWrite_begin(ReadWriteListener)
.public final ReadWriteListener.ReadWriteEvent reliableWrite_execute()
BluetoothGatt.abortReliableWrite()
- will return an event such that ReadWriteListener.ReadWriteEvent.isNull()
will
return false
if there are no problems. This call requires a previous call to reliableWrite_begin(ReadWriteListener)
.public final java.lang.String printState()
BleDevice
is currently in.public final void setConfig(BleDeviceConfig config_nullable)
BleManager.get(android.content.Context, BleManagerConfig)
for this individual device.public final BleDeviceConfig getConfig()
BleDeviceConfig
this device is set to use. If none has been set explicitly, then the instance
of BleManagerConfig
is returned.public final BleDeviceOrigin getOrigin()
BleDeviceOrigin.EXPLICIT
may still be
DiscoveryListener.LifeCycle.REDISCOVERED
through BleManager.startScan()
.public final EpochTime getLastDiscoveryTime()
DiscoveryListener.LifeCycle.DISCOVERED
or DiscoveryListener.LifeCycle.REDISCOVERED
. If getOrigin()
returns
BleDeviceOrigin.EXPLICIT
then this will return EpochTime.NULL
unless or until
the device is DiscoveryListener.LifeCycle.REDISCOVERED
.public final State.ChangeIntent getLastDisconnectIntent()
BleManagerState.OFF
->BleManagerState.ON
cycles or undiscovery->rediscovery, which
basically means how it was last BleDeviceState.BLE_DISCONNECTED
.
State.ChangeIntent.NULL
, then the last disconnect is unknown because
(a) device has never been seen before,
(b) reason for disconnect was app being killed and BleDeviceConfig.manageLastDisconnectOnDisk
was false
,
(c) app user cleared app data between app sessions or reinstalled the app.
State.ChangeIntent.UNINTENTIONAL
, then from a user experience perspective, the user may not have wanted
the disconnect to happen, and thus *probably* would want to be automatically connected again as soon as the device is discovered.
State.ChangeIntent.INTENTIONAL
, then the last reason the device was BleDeviceState.BLE_DISCONNECTED
was because
disconnect()
was called, which most-likely means the user doesn't want to automatically connect to this device again.
BleDeviceConfig.manageLastDisconnectOnDisk
.public final boolean setListener_State(DeviceStateListener listener_nullable)
DeviceStateListener
s, and set
the one provided here to be the only one in the stack.
If the provided listener is null
, then the stack of listeners will be cleared.
NOTE: If BondFilter.onEvent(BondFilter.ConnectionBugEvent)
returns BondFilter.ConnectionBugEvent.Please.tryFix()
, and the fix is in process,
then this method will early out, and will NOT set the listener.public final boolean pushListener_State(DeviceStateListener listener)
DeviceStateListener
onto the stack. This new listener will be the one events are dispatched to, until
popListener_State()
is called.
This method will early-out if the provided listener is null
NOTE: If BondFilter.onEvent(BondFilter.ConnectionBugEvent)
returns BondFilter.ConnectionBugEvent.Please.tryFix()
, and the fix is in process,
then this method will early out, and will NOT push the listener.public final boolean popListener_State()
DeviceStateListener
out of the stack of listeners.
Returns true
if a listener was actually removed from the stack (it will only be false if the stack is already empty).
NOTE: If BondFilter.onEvent(BondFilter.ConnectionBugEvent)
returns BondFilter.ConnectionBugEvent.Please.tryFix()
, and the fix is in process,
then this method will early out, and will NOT pop the listener.public final boolean popListener_State(DeviceStateListener listener)
popListener_State()
, only this method allows you to pass in the DeviceStateListener
you'd like to "pop" from the stack. This will
remove the given listener from the stack, regardless if it's at the head or not. Returns true
if the Stack contained the given listener, and
it got removed.
NOTE: If BondFilter.onEvent(BondFilter.ConnectionBugEvent)
returns BondFilter.ConnectionBugEvent.Please.tryFix()
, and the fix is in process,
then this method will early out, and will NOT pop the listener.public final DeviceStateListener getListener_State()
DeviceStateListener
being used (the top of the stack). This can return null
if there
are no listeners in the stack.public final boolean setListener_Connect(DeviceConnectListener listener)
DeviceStateListener
s, and set
the one provided here to be the only one in the stack.
If the provided listener is null
, then the stack of listeners will be cleared.
NOTE: If BondFilter.onEvent(BondFilter.ConnectionBugEvent)
returns BondFilter.ConnectionBugEvent.Please.tryFix()
, and the fix is in process,
then this method will early out, and will NOT set the listener.public final boolean pushListener_Connect(DeviceConnectListener listener)
DeviceConnectListener
onto the stack. This new listener will be the one events are dispatched to, until
popListener_State()
is called.
This method will early-out if the provided listener is null
NOTE: If BondFilter.onEvent(BondFilter.ConnectionBugEvent)
returns BondFilter.ConnectionBugEvent.Please.tryFix()
, and the fix is in process,
then this method will early out, and will NOT push the listener.public final boolean popListener_Connect()
DeviceConnectListener
out of the stack of listeners.
Returns true
if a listener was actually removed from the stack (it will only be false if the stack is already empty).
NOTE: If BondFilter.onEvent(BondFilter.ConnectionBugEvent)
returns BondFilter.ConnectionBugEvent.Please.tryFix()
, and the fix is in process,
then this method will early out, and will NOT pop the listener.public final boolean popListener_Connect(DeviceConnectListener listener)
popListener_Connect()
, only this method allows you to pass in the DeviceConnectListener
you'd like to "pop" from the stack. This will
remove the given listener from the stack, regardless if it's at the head or not. Returns true
if the Stack contained the given listener, and
it got removed.
NOTE: If BondFilter.onEvent(BondFilter.ConnectionBugEvent)
returns BondFilter.ConnectionBugEvent.Please.tryFix()
, and the fix is in process,
then this method will early out, and will NOT pop the listener.public final DeviceConnectListener getListener_Connect()
DeviceConnectListener
being used (the top of the stack). This can return null
if there
are no listeners in the stack.public final void setListener_Reconnect(DeviceReconnectFilter listener_nullable)
DeviceReconnectFilter
s, and set
the one provided here to be the only one in the stack. If the provided listener is null
, then the stack of listeners will be cleared.public final void pushListener_Reconnect(DeviceReconnectFilter listener)
DeviceReconnectFilter
on to the top of the stack of listeners.
This method will early-out if the provided listener is null
public final boolean popListener_Reconnect()
DeviceReconnectFilter
off the stack of listeners.
Returns true
if a listener was actually removed from the stack (it will only be false if the stack is already empty).public final boolean popListener_Reconnect(DeviceReconnectFilter listener)
popListener_Reconnect()
, only this method allows you to pass in the DeviceReconnectFilter
you'd like to "pop" from the stack. This will
remove the given listener from the stack, regardless if it's at the head or not. Returns true
if the Stack contained the given listener, and
it got removed.public final DeviceReconnectFilter getListener_Reconnect()
DeviceReconnectFilter
being used (the top of the stack). This can return null
if there
are no listeners in the stack.public final void setListener_Bond(BondListener listener_nullable)
bond()
and when bonding
through the operating system settings or from other apps.public final void setListener_ReadWrite(ReadWriteListener listener_nullable)
ReadWriteListener
that will be called for all calls to read(UUID, ReadWriteListener)
,
write(UUID, byte[], ReadWriteListener)
, enableNotify(UUID, ReadWriteListener)
, etc.
NOTE: This will clear the stack of ReadWriteListener
s, and set
the one provided here to be the only one in the stack. If the provided listener is null
, then the stack of listeners will be cleared.public final void pushListener_ReadWrite(ReadWriteListener listener)
ReadWriteListener
on to the top of the stack of listeners.
This method will early-out if the provided listener is null
public final boolean popListener_ReadWrite()
ReadWriteListener
off the stack of listeners.
Returns true
if a listener was actually removed from the stack (it will only be false if the stack is already empty).public final boolean popListener_ReadWrite(ReadWriteListener listener)
popListener_ReadWrite()
, only this method allows you to pass in the ReadWriteListener
you'd like to "pop" from the stack. This will
remove the given listener from the stack, regardless if it's at the head or not. Returns true
if the Stack contained the given listener, and
it got removed.public final ReadWriteListener getListener_ReadWrite()
ReadWriteListener
being used (the top of the stack). This can return null
if there
are no listeners in the stack.public final void setListener_Notification(NotificationListener listener_nullable)
NotificationListener
that will be called when receiving notifications, or indications. This listener will also
be called when toggling notifications. This does NOT replace ReadWriteListener
, just adds to it. If
a default ReadWriteListener
has been set, it will still fire in addition to this listener.
NOTE: This will clear the stack of ReadWriteListener
s, and set
the one provided here to be the only one in the stack. If the provided listener is null
, then the stack of listeners will be cleared.public final void pushListener_Notification(NotificationListener listener)
NotificationListener
on to the top of the stack of listeners.
This method will early-out if the provided listener is null
public final boolean popListener_Notification()
NotificationListener
off the stack of listeners.
Returns true
if a listener was actually removed from the stack (it will only be false if the stack is already empty).public final boolean popListener_Notification(NotificationListener listener)
popListener_Notification()
, only this method allows you to pass in the NotificationListener
you'd like to "pop" from the stack. This will
remove the given listener from the stack, regardless if it's at the head or not. Returns true
if the Stack contained the given listener, and
it got removed.public final NotificationListener getListener_Notification()
NotificationListener
being used (the top of the stack). This can return null
if there
are no listeners in the stack.public final void setListener_HistoricalDataLoad(HistoricalDataLoadListener listener_nullable)
HistoricalDataLoadListener
that will be invoked
for all historical data loads to memory for all uuids.public final int getConnectionRetryCount()
setListener_Reconnect(DeviceReconnectFilter)
and update your application's UI with this method's return value downstream of your
ReconnectFilter.onConnectFailed(ReconnectFilter.ConnectFailEvent)
override.public final int getStateMask()
BleDeviceState
for this device.BleDeviceState
public final int getNativeStateMask()
BleDeviceState
for this device.
The main purpose of this is to reflect what's going on under the hood while is(BleDeviceState)
with BleDeviceState.RECONNECTING_SHORT_TERM
is true
.public final Interval getAverageReadTime()
getAverageWriteTime()
.public final Interval getAverageWriteTime()
write(UUID, byte[])
or
write(UUID, byte[], ReadWriteListener)
. This is a running average with N being defined by
BleDeviceConfig.nForAverageRunningWriteTime
. This may be useful for estimating how long a series of
reads and/or writes will take. For example for displaying the estimated time remaining for a firmware update.public final int getRssi()
readRssi()
or startRssiPoll(Interval)
.getDistance()
public final Percent getRssiPercent()
getRssi()
is a little cryptic, so this gives you a friendly 0%-100% value for signal strength.public final Distance getDistance()
getRssi()
and
getTxPower()
. NOTE: the higher the distance, the less the accuracy.public final int getTxPower()
BleDeviceConfig.defaultTxPower
.BleDeviceConfig.defaultTxPower
public final byte[] getScanRecord()
null
.public final BleScanRecord getScanInfo()
BleScanRecord
instance held by this BleDevice
.public final int getAdvertisingFlags()
getScanRecord()
.public final java.util.UUID[] getAdvertisedServices()
getScanRecord()
. May be empty but never null
.public final byte[] getManufacturerData()
getScanRecord()
. May be empty but never null
.public final int getManufacturerId()
getScanRecord()
}. May be -1 if not setpublic final java.util.Map<java.util.UUID,byte[]> getAdvertisedServiceData()
getScanRecord()
. May be empty but never null
.public final java.lang.String getHistoricalDataTableName(java.util.UUID uuid)
UUID
.public final HistoricalDataCursor getHistoricalData_cursor(java.util.UUID uuid)
getHistoricalData_iterator(UUID)
and other overloads,
this call does not force bulk data load into memory.
HistoricalDataCursor.close()
when you are done with the data.public final HistoricalDataCursor getHistoricalData_cursor(java.util.UUID uuid, EpochTimeRange range)
getHistoricalData_cursor(UUID)
but constrains the results to the given time range.
HistoricalDataCursor.close()
when you are done with the data.public final void loadHistoricalData()
public final void loadHistoricalData(java.util.UUID uuid)
UUID
.public final void loadHistoricalData(HistoricalDataLoadListener listener)
public final void loadHistoricalData(java.util.UUID uuid, HistoricalDataLoadListener listener)
UUID
.public final boolean isHistoricalDataLoading()
loadHistoricalData()
(or overloads) or getHistoricalData_iterator(UUID)
(or overloads).public final boolean isHistoricalDataLoading(java.util.UUID uuid)
loadHistoricalData()
(or overloads) or getHistoricalData_iterator(UUID)
(or overloads).public final boolean isHistoricalDataLoaded()
true
if the historical data for all historical data for
this device is loaded into memory.
Use HistoricalDataLoadListener
to listen for when the load actually completes. If hasHistoricalData(UUID)
returns false
then this will also always return false
.public final boolean isHistoricalDataLoaded(java.util.UUID uuid)
true
if the historical data for a given uuid is loaded into memory.
Use HistoricalDataLoadListener
to listen for when the load actually completes. If hasHistoricalData(UUID)
returns false
then this will also always return false
.public final HistoricalData getHistoricalData_latest(java.util.UUID uuid)
ReadWriteListener.ReadWriteEvent
for which ReadWriteListener.ReadWriteEvent.isRead()
and ReadWriteListener.ReadWriteEvent.wasSuccess()
both return true
then ReadWriteListener.ReadWriteEvent.data()
,
will be cached and is retrievable by this method.HistoricalData.NULL
otherwise.BleNodeConfig.HistoricalDataLogFilter
,
BleNodeConfig.DefaultHistoricalDataLogFilter
public final java.util.Iterator<HistoricalData> getHistoricalData_iterator(java.util.UUID uuid)
HistoricalData
entries.public final java.util.Iterator<HistoricalData> getHistoricalData_iterator(java.util.UUID uuid, EpochTimeRange range)
HistoricalData
entries within the range provided.public final boolean getHistoricalData_forEach(java.util.UUID uuid, ForEach_Void<HistoricalData> forEach)
true
if there are any entries, false
otherwise.BleNodeConfig.HistoricalDataLogFilter
,
BleNodeConfig.DefaultHistoricalDataLogFilter
public final boolean getHistoricalData_forEach(java.util.UUID uuid, EpochTimeRange range, ForEach_Void<HistoricalData> forEach)
true
if there are any entries, false
otherwise.BleNodeConfig.HistoricalDataLogFilter
,
BleNodeConfig.DefaultHistoricalDataLogFilter
public final boolean getHistoricalData_forEach(java.util.UUID uuid, ForEach_Breakable<HistoricalData> forEach)
true
if there are any entries, false
otherwise.BleNodeConfig.HistoricalDataLogFilter
,
BleNodeConfig.DefaultHistoricalDataLogFilter
public final boolean getHistoricalData_forEach(java.util.UUID uuid, EpochTimeRange range, ForEach_Breakable<HistoricalData> forEach)
true
if there are any entries, false
otherwise.BleNodeConfig.HistoricalDataLogFilter
,
BleNodeConfig.DefaultHistoricalDataLogFilter
public final HistoricalData getHistoricalData_atOffset(java.util.UUID uuid, int offsetFromStart)
addHistoricalData(UUID, byte[], EpochTime)
but returns the data from the chronological offset, i.e. offsetFromStart=0
will return the earliest HistoricalData
. Use in combination with getHistoricalDataCount(java.util.UUID)
to iterate
"manually" through this device's historical data for the given characteristic.public final HistoricalData getHistoricalData_atOffset(java.util.UUID uuid, EpochTimeRange range, int offsetFromStart)
getHistoricalData_atOffset(java.util.UUID, int)
but offset is relative to the time range provided.public final int getHistoricalDataCount(java.util.UUID uuid)
public final int getHistoricalDataCount(java.util.UUID uuid, EpochTimeRange range)
public final boolean hasHistoricalData()
true
if there is any historical data at all for this device.public final boolean hasHistoricalData(EpochTimeRange range)
true
if there is any historical data at all for this device within the given range.public final boolean hasHistoricalData(java.util.UUID uuid)
true
if there is any historical data for the given uuid.public final boolean hasHistoricalData(java.util.UUID[] uuids)
true
if there is any historical data for any of the given uuids.public final boolean hasHistoricalData(java.util.UUID uuid, EpochTimeRange range)
true
if there is any historical data for the given uuid within the given range.public final void addHistoricalData(java.util.UUID uuid, byte[] data, EpochTime epochTime)
public final void addHistoricalData(java.util.UUID uuid, EpochTime epochTime, byte[] data)
addHistoricalData(UUID, byte[], EpochTime)
with the data and epochTime parameters switched around.public final void addHistoricalData(java.util.UUID uuid, byte[] data)
addHistoricalData(UUID, byte[], EpochTime)
but uses System.currentTimeMillis()
for the timestamp.public final void addHistoricalData(java.util.UUID uuid, HistoricalData historicalData)
public final void addHistoricalData(java.util.UUID uuid, java.util.Iterator<HistoricalData> historicalData)
addHistoricalData(UUID, byte[], EpochTime)
but for large datasets this is more efficient when writing to disk.public final void addHistoricalData(java.util.UUID uuid, java.util.List<HistoricalData> historicalData)
addHistoricalData(UUID, byte[], EpochTime)
but for large datasets this is more efficient when writing to disk.public final void addHistoricalData(java.util.UUID uuid, ForEach_Returning<HistoricalData> historicalData)
addHistoricalData(UUID, byte[], EpochTime)
but for large datasets this is more efficient when writing to disk.public final boolean isAny(BleDeviceState... states)
is(BleDeviceState)
public final boolean isAll(BleDeviceState... states)
isAny(BleDeviceState...)
public final boolean isConnectable()
connect()
(or overloads) has a chance of succeeding.
For example if the device is BleDeviceState.CONNECTING_OVERALL
or BleDeviceState.INITIALIZED
then this will return false
.public final boolean is(BleDeviceState state)
isAny(BleDeviceState...)
public final boolean isAny(int mask_BleDeviceState)
true
if there is any bitwise overlap between the provided value and getStateMask()
.isAll(int)
public final boolean isAll(int mask_BleDeviceState)
true
if there is complete bitwise overlap between the provided value and getStateMask()
.isAny(int)
public final boolean is(java.lang.Object... query)
is(BleDeviceState)
and isAny(BleDeviceState...)
but allows you to give a simple query
made up of BleDeviceState
and Boolean
pairs. So an example would be
myDevice.is(BleDeviceState.BLE_CONNECTING
, true, BleDeviceState.RECONNECTING_LONG_TERM
, false)
.public final Interval getTimeInState(BleDeviceState state)
is(BleDeviceState)
returns true for the given state (i.e. if
the device is in the given state) then this method will (a) return the
amount of time that the device has been in the state. Otherwise, this
will (b) return the amount of time that the device was *previously* in
that state. Otherwise, if the device has never been in the state, it will
(c) return 0.0 seconds. Case (b) might be useful for example for checking
how long you were connected for after becoming
BleDeviceState.BLE_DISCONNECTED
, for analytics purposes or whatever.public final void refreshGattDatabase()
refreshGattDatabase(Interval)
which uses the default gatt refresh delay of BleDeviceConfig.DEFAULT_GATT_REFRESH_DELAY
.public final void refreshGattDatabase(Interval gattPause)
BleDeviceState.BLE_CONNECTED
. This is meant to be used mainly after performing a
firmware update, and the Gatt database has changed. This will clear the device's gatt cache, and perform discover services again.
The device will drop out of BleDeviceState.SERVICES_DISCOVERED
, and enter BleDeviceState.DISCOVERING_SERVICES
. So,
you can listen in your device's DeviceStateListener
for when it enters BleDeviceState.SERVICES_DISCOVERED
to know
when the operation is complete.public final void setName(java.lang.String name)
setName(String, UUID, ReadWriteListener)
but will not attempt to propagate the
name change to the remote device. Only getName_override()
will be affected by this.public final ReadWriteListener.ReadWriteEvent setName(java.lang.String name, java.util.UUID characteristicUuid)
setName(String, UUID, ReadWriteListener)
but you can use this
if you don't care much whether the device name change actually successfully reaches
the remote device. The write will be attempted regardless.public final ReadWriteListener.ReadWriteEvent setName(java.lang.String name, java.util.UUID characteristicUuid, ReadWriteListener listener)
write(java.util.UUID, byte[], ReadWriteListener)
using the given UUID
. Further calls to getName_override()
will immediately reflect the name given here.
Further calls to getName_native()
, getName_debug()
and getName_normalized()
will only reflect
the name given here if the write is successful. It is somewhat assumed that doing this write will cause the remote device
to use the new name given here for its device information service Uuids.DEVICE_NAME
.
If BleDeviceConfig.saveNameChangesToDisk
is true
then this name
will always be returned for getName_override()
, even if you kill/restart the app.public final void clearName()
setName(String)
or overloads.public final java.lang.String getName_override()
getName_native()
.
If you call setName(String)
(or overloads)
then calling this will return the same string provided in that setter.public final java.lang.String getName_native()
BluetoothDevice.getName()
. It's suggested to use
getName_normalized()
if you're using the name to match/filter
against something, e.g. an entry in a config file or for advertising
filtering.public final java.lang.String getName_normalized()
getName_native()
can change arbitrarily,
like the last 4 of the MAC address can get appended sometimes, and spaces
might get changed to underscores or vice-versa, caps to lowercase, etc.
This may somehow be standard, to-the-spec behavior but to the newcomer
it's confusing and potentially time-bomb-bug-inducing, like if you're
using device name as a filter for something and everything's working
until one day your app is suddenly broken and you don't know why. This
method is an attempt to normalize name behavior and always return the
same name regardless of the underlying stack's whimsy. The target format
is all lowercase and underscore-delimited with no trailing MAC address.public final java.lang.String getName_debug()
getName_normalized()
plus the last four digits of the device's
MAC address from getMacAddress()
. toString()
uses this.public final android.bluetooth.BluetoothDevice getNative()
public final android.bluetooth.BluetoothGatt getNativeGatt()
getNative()
. Generally speaking, this
will return null
if the BleDevice is BleDeviceState.BLE_DISCONNECTED
.
public final java.lang.String getMacAddress()
BleManager.newDevice(String)
(or overloads thereof).
You may treat this as the unique ID of the device, suitable as a key in a HashMap
, SharedPreferences
, etc.getMacAddress
in class BleNode
public final BondListener.BondEvent bond(BondListener listener)
bond()
but you can pass a listener to be notified of the details behind success or failure.bond()
.public final BondListener.BondEvent bond()
BluetoothDevice.createBond()
This is also sometimes called
pairing, but while pairing and bonding are closely related, they are technically different from each other.
connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.unbond()
public final boolean unbond()
bond()
.true
if successfully BleDeviceState.UNBONDED
, false
if already BleDeviceState.UNBONDED
.bond()
public final boolean unbond(BondListener listener)
bond(BondListener)
.true
if successfully BleDeviceState.UNBONDED
, false
if already BleDeviceState.UNBONDED
.bond()
public final DeviceReconnectFilter.ConnectFailEvent connect()
BleDeviceState.BLE_CONNECTED
or BleDeviceState.BLE_CONNECTING
.
Use setListener_Reconnect(DeviceReconnectFilter)
and setListener_State(DeviceStateListener)
to receive callbacks for
progress and errors.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.public final DeviceReconnectFilter.ConnectFailEvent connect(DeviceConnectListener connectListener)
BleDeviceState.BLE_CONNECTED
or BleDeviceState.BLE_CONNECTING
.
Use setListener_Reconnect(DeviceReconnectFilter)
and setListener_State(DeviceStateListener)
to receive callbacks for more
thorough progress and errors.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.public final DeviceReconnectFilter.ConnectFailEvent connect(BleTransaction.Auth authenticationTxn)
connect()
but provides a hook for the app to do some kind of authentication handshake if it wishes. This is popular with
commercial BLE devices where you don't want hobbyists or competitors using your devices for nefarious purposes - like releasing a better application
for your device than you ;-). Usually the characteristics read/written inside this transaction are encrypted and so one way or another will require
the device to become BleDeviceState.BONDED
. This should happen automatically for you, i.e you shouldn't need to call bond()
yourself.public final DeviceReconnectFilter.ConnectFailEvent connect(BleTransaction.Init initTxn)
connect()
but provides a hook for the app to do some kind of initialization before it's considered fully
BleDeviceState.INITIALIZED
. For example if you had a BLE-enabled thermometer you could use this transaction to attempt an initial
temperature read before updating your UI to indicate "full" connection success, even though BLE connection itself already succeeded.public final DeviceReconnectFilter.ConnectFailEvent connect(BleTransaction.Auth authenticationTxn, BleTransaction.Init initTxn)
connect(BleTransaction.Auth)
and connect(BleTransaction.Init)
. See those two methods for explanation.public final DeviceReconnectFilter.ConnectFailEvent connect(BleTransaction.Auth authenticationTxn, BleTransaction.Init initTxn, DeviceConnectListener connectionListener)
connect(BleTransaction.Auth, BleTransaction.Init)
but calls setListener_State(DeviceStateListener)
and
setListener_Reconnect(DeviceReconnectFilter)
for you.DeviceReconnectFilter.ConnectFailEvent
is returned telling you why. Otherwise
this method will still return a non-null instance but DeviceReconnectFilter.ConnectFailEvent.isNull()
will be true
.
DeviceReconnectFilter
will still be called even if this method early-outs.
DeviceReconnectFilter
. However if DeviceReconnectFilter.ConnectFailEvent.isNull()
for the return value is false
, meaning
the connection attempt couldn't even start for some reason, then you don't have to throw up the spinner in the first place.public final boolean disconnect()
BleDeviceState.BLE_DISCONNECTED
. You can call this at any point
during the connection process as a whole, during reads and writes, during transactions, whenever, and the device will cleanly cancel all ongoing
operations. This method will also bring the device out of the BleDeviceState.RECONNECTING_LONG_TERM
state.true
if this call "had an effect", such as if the device was previously BleDeviceState.RECONNECTING_LONG_TERM
,
BleDeviceState.CONNECTING_OVERALL
, or BleDeviceState.INITIALIZED
DeviceReconnectFilter.Status.EXPLICIT_DISCONNECT
public final boolean disconnectWhenReady()
disconnect()
with the difference being the disconnect task is set to a low priority. This allows all current calls to finish
executing before finally disconnecting. Note that this can cause issues if you keep executing reads/writes, as they have a higher priority.true
if this call "had an effect", such as if the device was previously BleDeviceState.RECONNECTING_LONG_TERM
,
BleDeviceState.CONNECTING_OVERALL
, or BleDeviceState.INITIALIZED
DeviceReconnectFilter.Status.EXPLICIT_DISCONNECT
public final boolean disconnect_remote()
disconnect()
but this call roughly simulates the disconnect as if it's because of the remote device going down, going out of range, etc.
For example getLastDisconnectIntent()
will be State.ChangeIntent.UNINTENTIONAL
instead of
State.ChangeIntent.INTENTIONAL
.
BleDeviceState.CONNECTING_OVERALL
then your
ReconnectFilter.onConnectFailed(ReconnectFilter.ConnectFailEvent)
implementation will be called with DeviceReconnectFilter.Status.ROGUE_DISCONNECT
.
BleDeviceState.RECONNECTING_SHORT_TERM
or BleDeviceState.RECONNECTING_LONG_TERM
.public final boolean undiscover()
BleManager.undiscover(BleDevice)
.true
if the device was successfully BleDeviceState.UNDISCOVERED
, false
if BleDevice isn't known to the BleManager
.BleManager.undiscover(BleDevice)
public final void clearSharedPreferences()
BleManager.clearSharedPreferences(String)
.public final boolean equals(BleDevice device_nullable)
false
checks
equality of getMacAddress()
. Note that ideally this method isn't
useful to you and never returns true (besides the identity case, which
isn't useful to you). Otherwise it probably means your app is holding on
to old references that have been undiscovered, and this may be a bug or
bad design decision in your code. This library will (well, should) never
hold references to two devices such that this method returns true for them.public final boolean equals(java.lang.Object object_nullable)
equals(BleDevice)
if object is an instance of BleDevice
. Otherwise calls super.equals
in class java.lang.Object
equals(BleDevice)
public final void startPoll(java.util.UUID characteristicUuid, Interval interval, ReadWriteListener listener)
enableNotify(UUID, ReadWriteListener)
. One
use case would be to periodically read wind speed from a weather device. You *could* develop your device firmware to send notifications to the app
only when the wind speed changes, but Android has observed stability issues with notifications, so use them only when needed.
BleDeviceState
, even BleDeviceState.BLE_DISCONNECTED
.public final void startPoll(java.util.UUID characteristicUuid, Interval interval)
startPoll(java.util.UUID, Interval, ReadWriteListener)
but without a listener.
read(java.util.UUID)
for an explanation of why you would do this.public final void startPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, Interval interval, ReadWriteListener listener)
startPoll(UUID, Interval, ReadWriteListener)
for when you have characteristics with identical uuids under different services.public final void startPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, DescriptorFilter descriptorFilter, Interval interval, ReadWriteListener listener)
startPoll(UUID, UUID, Interval, ReadWriteListener)
for when you have characteristics with identical uuids under the same service.public final void startPoll(BleRead read, Interval interval)
enableNotify(UUID, ReadWriteListener)
. One
use case would be to periodically read wind speed from a weather device. You *could* develop your device firmware to send notifications to the app
only when the wind speed changes, but Android has observed stability issues with notifications, so use them only when needed.
BleDeviceState
, even BleDeviceState.BLE_DISCONNECTED
.public final void startPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, Interval interval)
startPoll(UUID, Interval)
for when you have characteristics with identical uuids under different services.public final void startPoll(java.util.UUID[] charUuids, Interval interval, ReadWriteListener listener)
startPoll(java.util.UUID, Interval, ReadWriteListener)
for multiple
characteristic uuids all at once.public final void startPoll(java.util.UUID[] charUuids, Interval interval)
startPoll(java.util.UUID[], Interval, ReadWriteListener)
but without a listener.
read(java.util.UUID)
for an explanation of why you would do this.public final void startPoll(java.lang.Iterable<java.util.UUID> charUuids, Interval interval, ReadWriteListener listener)
startPoll(java.util.UUID, Interval, ReadWriteListener)
for multiple
characteristic uuids all at once.public final void startPoll(java.lang.Iterable<java.util.UUID> charUuids, Interval interval)
startPoll(java.util.UUID[], Interval, ReadWriteListener)
but without a listener.
read(java.util.UUID)
for an explanation of why you would do this.public final void startChangeTrackingPoll(java.util.UUID[] charUuids, Interval interval, ReadWriteListener listener)
startChangeTrackingPoll(java.util.UUID, Interval, ReadWriteListener)
for multiple
characteristic uuids all at once.public final void startChangeTrackingPoll(java.util.UUID[] charUuids, Interval interval)
startChangeTrackingPoll(java.util.UUID[], Interval, ReadWriteListener)
but without a listener.
read(java.util.UUID)
for an explanation of why you would do this.public final void startChangeTrackingPoll(java.lang.Iterable<java.util.UUID> charUuids, Interval interval, ReadWriteListener listener)
startChangeTrackingPoll(java.util.UUID, Interval, ReadWriteListener)
for multiple
characteristic uuids all at once.public final void startChangeTrackingPoll(java.lang.Iterable<java.util.UUID> charUuids, Interval interval)
startChangeTrackingPoll(java.util.UUID[], Interval, ReadWriteListener)
but without a listener.
read(java.util.UUID)
for an explanation of why you would do this.public final void startChangeTrackingPoll(java.util.UUID characteristicUuid, Interval interval, ReadWriteListener listener)
startPoll(UUID, Interval, ReadWriteListener)
but only
invokes a callback when a change in the characteristic value is detected.
Use this in preference to enableNotify(UUID, ReadWriteListener)
if possible,
due to instability issues (rare, but still) with notifications on Android.
BleDeviceState
, even BleDeviceState.BLE_DISCONNECTED
.public final void startChangeTrackingPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, Interval interval, ReadWriteListener listener)
startChangeTrackingPoll(UUID, Interval, ReadWriteListener)
for when you have characteristics with identical uuids under different services.public final void startChangeTrackingPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, DescriptorFilter descriptorFilter, Interval interval, ReadWriteListener listener)
startChangeTrackingPoll(UUID, UUID, Interval, ReadWriteListener)
for when you have characteristics with identical uuids under the same service.public final void startChangeTrackingPoll(BleRead read, Interval interval)
startPoll(BleRead, Interval)
but only
invokes a callback when a change in the characteristic value is detected.
Use this in preference to enableNotify(UUID, ReadWriteListener)
if possible,
due to instability issues (rare, but still) with notifications on Android.
BleDeviceState
, even BleDeviceState.BLE_DISCONNECTED
.public final void stopPoll(java.util.UUID characteristicUuid, ReadWriteListener listener)
startPoll(UUID, Interval, ReadWriteListener)
or
startChangeTrackingPoll(UUID, Interval, ReadWriteListener)
. This will stop all polls matching the provided parameters.public final void stopPoll(java.util.UUID characteristicUuid)
stopPoll(java.util.UUID, ReadWriteListener)
but without the listener.public final void stopPoll(java.util.UUID characteristicUuid, Interval interval, ReadWriteListener listener)
stopPoll(UUID, ReadWriteListener)
but with added filtering for the poll Interval
.public final void stopPoll(java.util.UUID characteristicUuid, Interval interval)
stopPoll(java.util.UUID, Interval, ReadWriteListener)
but without the listener.public final void stopPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, ReadWriteListener listener)
stopPoll(UUID, ReadWriteListener)
for when you have characteristics with identical uuids under different services.public final void stopPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid)
stopPoll(UUID)
for when you have characteristics with identical uuids under different services.public final void stopPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, Interval interval, ReadWriteListener listener)
stopPoll(UUID, Interval, ReadWriteListener)
for when you have characteristics with identical uuids under different services.public final void stopPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, Interval interval)
stopPoll(UUID, Interval)
for when you have characteristics with identical uuids under different services.public final void stopPoll(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, DescriptorFilter descriptorFilter, Interval interval, ReadWriteListener listener)
stopPoll(UUID, UUID, Interval, ReadWriteListener)
for when you have characteristics with identical uuids under the same service.public final void stopPoll(BleRead read, Interval interval)
BleRead
, and interval.public final void stopPoll(java.util.UUID[] uuids, Interval interval, ReadWriteListener listener)
stopPoll(java.util.UUID, Interval, ReadWriteListener)
multiple times for you.public final void stopPoll(java.util.UUID[] uuids, Interval interval)
stopPoll(java.util.UUID, Interval)
multiple times for you.public final void stopPoll(java.util.UUID[] uuids)
stopPoll(java.util.UUID)
multiple times for you.public final void stopPoll(java.lang.Iterable<java.util.UUID> uuids, Interval interval, ReadWriteListener listener)
stopPoll(java.util.UUID, Interval, ReadWriteListener)
multiple times for you.public final void stopPoll(java.lang.Iterable<java.util.UUID> uuids, Interval interval)
stopPoll(java.util.UUID, Interval)
multiple times for you.public final void stopPoll(java.lang.Iterable<java.util.UUID> uuids)
stopPoll(java.util.UUID)
multiple times for you.public final void writeMany(BleWrite[] writes)
write(BleWrite)
.public final void writeMany(java.lang.Iterable<BleWrite> writes)
write(BleWrite)
.public final ReadWriteListener.ReadWriteEvent write(BleWrite bleWrite)
write(BleWrite, ReadWriteListener)
.write(BleWrite, ReadWriteListener)
public final ReadWriteListener.ReadWriteEvent write(BleWrite bleWrite, ReadWriteListener listener)
connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID characteristicUuid, byte[] data)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(BleWrite, ReadWriteListener)
.write(BleWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID characteristicUuid, DescriptorFilter descriptorFilter, byte[] data)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(BleWrite, ReadWriteListener)
.write(BleWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID characteristicUuid, byte[] data, ReadWriteListener listener)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(BleWrite, ReadWriteListener)
.write(BleWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID characteristicUuid, byte[] data, DescriptorFilter descriptorFilter, ReadWriteListener listener)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(BleWrite, ReadWriteListener)
.write(BleWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, byte[] data)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(UUID, byte[])
for when you have characteristics with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, DescriptorFilter filter, byte[] data)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(UUID, DescriptorFilter, byte[])
for when you have characteristics with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, byte[] data, ReadWriteListener listener)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(UUID, byte[], ReadWriteListener)
for when you have characteristics with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, byte[] data, DescriptorFilter descriptorFilter, ReadWriteListener listener)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(UUID, byte[], ReadWriteListener)
for when you have characteristics with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID characteristicUuid, FutureData futureData)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(BleWrite, ReadWriteListener)
.write(BleWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID characteristicUuid, FutureData futureData, ReadWriteListener listener)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(BleWrite, ReadWriteListener)
.write(BleWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID characteristicUuid, FutureData futureData, DescriptorFilter descriptorFilter, ReadWriteListener listener)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(BleWrite, ReadWriteListener)
.write(BleWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, FutureData futureData)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(UUID, FutureData)
for when you have characteristics with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, FutureData futureData, DescriptorFilter descriptorFilter)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(UUID, FutureData)
for when you have characteristics with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, FutureData futureData, ReadWriteListener listener)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(UUID, FutureData, ReadWriteListener)
for when you have characteristics with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent write(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, FutureData futureData, DescriptorFilter descriptorFilter, ReadWriteListener listener)
write(BleWrite)
, or write(BleWrite, ReadWriteListener)
insteadwrite(UUID, FutureData, ReadWriteListener)
for when you have characteristics with identical uuids under the same service.@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID descriptorUuid, byte[] data)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwrite(BleDescriptorWrite, ReadWriteListener)
.write(BleDescriptorWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID descriptorUuid, byte[] data, ReadWriteListener listener)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwrite(BleDescriptorWrite, ReadWriteListener)
.write(BleDescriptorWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID characteristicUuid, java.util.UUID descriptorUuid, byte[] data)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwriteDescriptor(UUID, byte[])
for when you have descriptors with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID characteristicUuid, java.util.UUID descriptorUuid, byte[] data, ReadWriteListener listener)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwriteDescriptor(UUID, byte[], ReadWriteListener)
for when you have descriptors with identical uuids under different characteristics.@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, java.util.UUID descriptorUuid, byte[] data, ReadWriteListener listener)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwriteDescriptor(UUID, byte[], ReadWriteListener)
for when you have descriptors with identical uuids under different characteristics and/or services.@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID descriptorUuid, FutureData futureData)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwrite(BleDescriptorWrite, ReadWriteListener)
.write(BleDescriptorWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID descriptorUuid, FutureData futureData, ReadWriteListener listener)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwrite(BleDescriptorWrite, ReadWriteListener)
.write(BleDescriptorWrite, ReadWriteListener)
@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID characteristicUuid, java.util.UUID descriptorUuid, FutureData futureData)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwriteDescriptor(UUID, byte[])
for when you have descriptors with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID characteristicUuid, java.util.UUID descriptorUuid, FutureData futureData, ReadWriteListener listener)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwriteDescriptor(UUID, byte[], ReadWriteListener)
for when you have descriptors with identical uuids under different characteristics.@Deprecated public final ReadWriteListener.ReadWriteEvent writeDescriptor(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, java.util.UUID descriptorUuid, FutureData futureData, ReadWriteListener listener)
write(BleDescriptorWrite)
, or write(BleDescriptorWrite, ReadWriteListener)
insteadwriteDescriptor(UUID, byte[], ReadWriteListener)
for when you have descriptors with identical uuids under different characteristics and/or services.public final ReadWriteListener.ReadWriteEvent write(BleDescriptorWrite write)
write(BleDescriptorWrite, ReadWriteListener)
.write(BleDescriptorWrite, ReadWriteListener)
public final ReadWriteListener.ReadWriteEvent write(BleDescriptorWrite write, ReadWriteListener listener)
connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.@Deprecated public final ReadWriteListener.ReadWriteEvent readDescriptor(java.util.UUID descriptorUuid)
read(BleDescriptorRead)
instead.read(BleDescriptorRead)
.@Deprecated public final ReadWriteListener.ReadWriteEvent readDescriptor(java.util.UUID descriptorUuid, ReadWriteListener listener)
read(BleDescriptorRead)
instead.read(BleDescriptorRead)
.@Deprecated public final ReadWriteListener.ReadWriteEvent readDescriptor(java.util.UUID characteristicUuid, java.util.UUID descriptorUuid)
read(BleDescriptorRead)
instead.read(BleDescriptorRead)
.@Deprecated public final ReadWriteListener.ReadWriteEvent readDescriptor(java.util.UUID characteristicUuid, java.util.UUID descriptorUuid, ReadWriteListener listener)
read(BleDescriptorRead)
instead.read(BleDescriptorRead)
.@Deprecated public final ReadWriteListener.ReadWriteEvent readDescriptor(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, java.util.UUID descriptorUuid)
read(BleDescriptorRead)
instead.read(BleDescriptorRead)
.@Deprecated public final ReadWriteListener.ReadWriteEvent readDescriptor(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, java.util.UUID descriptorUuid, ReadWriteListener listener)
read(BleDescriptorRead)
instead.read(BleDescriptorRead)
.public final ReadWriteListener.ReadWriteEvent read(BleDescriptorRead read)
BleRead
.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.public final ReadWriteListener.ReadWriteEvent readRssi()
readRssi(ReadWriteListener)
but use this method when you don't much care when/if the RSSI is actually updated.readRssi(ReadWriteListener)
.public final ReadWriteListener.ReadWriteEvent readRssi(ReadWriteListener listener)
BluetoothGatt.readRemoteRssi()
. This will eventually update the value returned by getRssi()
but it is not
instantaneous. When a new RSSI is actually received the given listener will be called. The device must be BleDeviceState.BLE_CONNECTED
for
this call to succeed. When the device is not BleDeviceState.BLE_CONNECTED
then the value returned by
getRssi()
will be automatically updated every time this device is discovered (or rediscovered) by a scan operation.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.public final ReadWriteListener.ReadWriteEvent setConnectionPriority(BleConnectionPriority connectionPriority)
setConnectionPriority(BleConnectionPriority, ReadWriteListener)
but use this method when you don't much care when/if the connection priority is updated.setConnectionPriority(BleConnectionPriority, ReadWriteListener)
.public final ReadWriteListener.ReadWriteEvent setConnectionPriority(BleConnectionPriority connectionPriority, ReadWriteListener listener)
BluetoothGatt.requestConnectionPriority(int)
which attempts to change the connection priority for a given connection.
This will eventually update the value returned by getConnectionPriority()
but it is not
instantaneous. When we receive confirmation from the native stack then this value will be updated. The device must be BleDeviceState.BLE_CONNECTED
for
this call to succeed.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.setConnectionPriority(BleConnectionPriority, ReadWriteListener)
,
getConnectionPriority()
public final BleConnectionPriority getConnectionPriority()
setConnectionPriority(BleConnectionPriority, ReadWriteListener)
, or BleNodeConfig.DEFAULT_MTU_SIZE
if
it was never set explicitly.public final int getMtu()
negotiateMtu(int, ReadWriteListener)
, or BleNodeConfig.DEFAULT_MTU_SIZE
if
it was never set explicitly.public final ReadWriteListener.ReadWriteEvent negotiateMtuToDefault()
negotiateMtuToDefault(ReadWriteListener)
but use this method when you don't much care when/if the "maximum transmission unit" is actually updated.negotiateMtu(int, ReadWriteListener)
.public final ReadWriteListener.ReadWriteEvent negotiateMtuToDefault(ReadWriteListener listener)
negotiateMtu(int, ReadWriteListener)
that returns the "maximum transmission unit" to the default.
Unlike negotiateMtu(int)
, this can be called when the device is BleDeviceState.BLE_DISCONNECTED
in the event that you don't want the
MTU to be auto-set upon next reconnection.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.public final ReadWriteListener.ReadWriteEvent negotiateMtu(int mtu)
negotiateMtu(int, ReadWriteListener)
, which passes null
for the listener, if you don't care about the result, or are using
a global listener via setListener_ReadWrite(ReadWriteListener)
, or BleManager.setListener_Read_Write(ReadWriteListener)
.public final ReadWriteListener.ReadWriteEvent negotiateMtu(int mtu, ReadWriteListener listener)
BluetoothGatt.requestMtu(int)
which attempts to change the "maximum transmission unit" for a given connection.
This will eventually update the value returned by getMtu()
but it is not
instantaneous. When we receive confirmation from the native stack then this value will be updated. The device must be BleDeviceState.BLE_CONNECTED
for
this call to succeed. Note that this is a negotiation between android and the bluetooth peripheral, so it's possible to request a different MTU,
and end up with it not changing, but the callback comes back as a success.
NOTE 1: This will only work on devices running Android Lollipop (5.0) or higher. Otherwise it will be ignored.
NOTE 2: Some phones will request an MTU, and accept a higher number, but will fail (time out) when writing a characteristic with a large
payload. Namely, we've found the Moto Pure X, and the OnePlus OnePlus2 to have this behavior. For those phones any MTU above
50 failed.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.public final ReadWriteListener.ReadWriteEvent setPhyOptions(Phy phyOptions)
setPhyOptions(Phy, ReadWriteListener)
, which passes no listener.public final ReadWriteListener.ReadWriteEvent setPhyOptions(Phy phyOptions, ReadWriteListener listener)
public final ReadWriteListener.ReadWriteEvent readPhyOptions()
readPhyOptions(ReadWriteListener)
, which passes no listener.public final ReadWriteListener.ReadWriteEvent readPhyOptions(ReadWriteListener listener)
public final void startRssiPoll(Interval interval)
startPoll(UUID, Interval, ReadWriteListener)
but for when you don't care when/if the RSSI is actually updated.
BleDeviceState
, even BleDeviceState.BLE_DISCONNECTED
, however, a scan must
be running in order to receive any updates (and of course, the device must be found in the scan).public final void startRssiPoll(Interval interval, ReadWriteListener listener)
readRssi(ReadWriteListener)
at the Interval
frequency
specified. This can be called before the device is actually BleDeviceState.BLE_CONNECTED
. If you call this more than once in a
row then the most recent call's parameters will be respected.
BleDeviceState
, even BleDeviceState.BLE_DISCONNECTED
, however, a scan must
be running in order to receive any updates (and of course, the device must be found in the scan).public final void stopRssiPoll()
startRssiPoll(Interval)
or startRssiPoll(Interval, ReadWriteListener)
.public final void clearAllData()
public final void clearHistoricalData()
HistoricalData
tracked by this device.public final void clearHistoricalData(long count)
count
number of HistoricalData
tracked by this device.public final void clearHistoricalData(EpochTimeRange range)
HistoricalData
tracked by this device within the given range.public final void clearHistoricalData(EpochTimeRange range, long count)
count
number of HistoricalData
tracked by this device within the given range.public final void clearHistoricalData(java.util.UUID uuid)
HistoricalData
tracked by this device for a particular
characteristic UUID
.public final void clearHistoricalData(java.util.UUID... uuids)
clearHistoricalData(UUID)
that just calls that method multiple times.public final void clearHistoricalData(java.util.UUID uuid, long count)
count
number of HistoricalData
tracked by this device for a particular
characteristic UUID
.public final void clearHistoricalData(java.util.UUID uuid, EpochTimeRange range)
HistoricalData
tracked by this device for a particular
characteristic UUID
within the given range.public final void clearHistoricalData(java.util.UUID uuid, EpochTimeRange range, long count)
count
number of HistoricalData
tracked by this device for a particular
characteristic UUID
within the given range.public final void clearHistoricalData_memoryOnly()
HistoricalData
tracked by this device.public final void clearHistoricalData_memoryOnly(long count)
count
number of HistoricalData
tracked by this device.public final void clearHistoricalData_memoryOnly(EpochTimeRange range)
HistoricalData
tracked by this device within the given range.public final void clearHistoricalData_memoryOnly(EpochTimeRange range, long count)
count
number of HistoricalData
tracked by this device within the given range.public final void clearHistoricalData_memoryOnly(java.util.UUID uuid)
HistoricalData
tracked by this device for a particular
characteristic UUID
.public final void clearHistoricalData_memoryOnly(java.util.UUID uuid, long count)
count
number of HistoricalData
tracked by this device for a particular
characteristic UUID
.public final void clearHistoricalData_memoryOnly(java.util.UUID characteristicUuid, EpochTimeRange range)
HistoricalData
tracked by this device for a particular
characteristic UUID
within the given range.public final void clearHistoricalData_memoryOnly(java.util.UUID characteristicUuid, EpochTimeRange range, long count)
count
number of HistoricalData
tracked by this device for a particular
characteristic UUID
within the given range.@Deprecated public final void read(java.util.UUID[] charUuids)
readMany(BleRead[])
instead.read(UUID)
.@Deprecated public final void read(java.util.UUID[] charUuids, ReadWriteListener listener)
readMany(BleRead[])
instead.read(UUID, ReadWriteListener)
.public final void readMany(BleRead[] bleReads)
read(BleRead)
.public final void readMany(java.lang.Iterable<BleRead> bleReads)
read(BleRead)
.@Deprecated public final void read(java.lang.Iterable<java.util.UUID> charUuids)
readMany(Iterable)
instead.read(UUID)
.@Deprecated public final void read(java.lang.Iterable<java.util.UUID> charUuids, ReadWriteListener listener)
readMany(Iterable)
instead.read(UUID, ReadWriteListener)
.@Deprecated public final ReadWriteListener.ReadWriteEvent read(java.util.UUID characteristicUuid)
read(BleRead)
instead.read(java.util.UUID, ReadWriteListener)
but you can use this
if you don't immediately care about the result. The callback will still be posted to ReadWriteListener
instances (if any) provided to setListener_ReadWrite(ReadWriteListener)
and
BleManager.setListener_Read_Write(ReadWriteListener)
.@Deprecated public final ReadWriteListener.ReadWriteEvent read(java.util.UUID characteristicUuid, DescriptorFilter descriptorFilter)
read(BleRead)
instead.read(java.util.UUID, DescriptorFilter, ReadWriteListener)
but you can use this
if you don't immediately care about the result. The callback will still be posted to ReadWriteListener
instances (if any) provided to setListener_ReadWrite(ReadWriteListener)
and
BleManager.setListener_Read_Write(ReadWriteListener)
.@Deprecated public final ReadWriteListener.ReadWriteEvent read(java.util.UUID characteristicUuid, ReadWriteListener listener)
read(BleRead)
instead.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.@Deprecated public final ReadWriteListener.ReadWriteEvent read(java.util.UUID characteristicUuid, DescriptorFilter descriptorFilter, ReadWriteListener listener)
read(BleRead)
instead.DescriptorFilter
will grab the correct BluetoothGattCharacteristic
in the case there are
more than one with the same UUID
in the same BluetoothGattService
.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.@Deprecated public final ReadWriteListener.ReadWriteEvent read(java.util.UUID serviceUuid, java.util.UUID characteristicUuid)
read(BleRead)
instead.read(UUID)
for when you have characteristics with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent read(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, DescriptorFilter descriptorFilter)
read(BleRead)
instead.read(UUID, DescriptorFilter)
for when you have characteristics with identical uuids under the same service.@Deprecated public final ReadWriteListener.ReadWriteEvent read(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, ReadWriteListener listener)
read(BleRead)
instead.read(UUID, ReadWriteListener)
for when you have characteristics with identical uuids under different services.@Deprecated public final ReadWriteListener.ReadWriteEvent read(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, DescriptorFilter descriptorFilter, ReadWriteListener listener)
read(BleRead)
instead.read(UUID, DescriptorFilter, ReadWriteListener)
for when you have characteristics with identical uuids under the same service.public final ReadWriteListener.ReadWriteEvent read(BleRead read)
DescriptorFilter
(if set in the BleRead
will grab the correct BluetoothGattCharacteristic
in the case there are
more than one with the same UUID
in the same BluetoothGattService
.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.public final ReadWriteListener.ReadWriteEvent readBatteryLevel(ReadWriteListener listener)
read(UUID, UUID, ReadWriteListener)
using Uuids.BATTERY_SERVICE_UUID
,
and Uuids.BATTERY_LEVEL
. If your battery service/characteristic uses a custom UUID, then use read(UUID, UUID, ReadWriteListener)
with
your custom UUIDs.public final boolean isNotifyEnabled(java.util.UUID uuid)
true
if notifications are enabled for the given uuid.
NOTE: isNotifyEnabling(UUID)
may return true even if this method returns false.isNotifyEnabling(UUID)
public final boolean isNotifyEnabling(java.util.UUID uuid)
true
if SweetBlue is in the process of enabling notifications for the given uuid.isNotifyEnabled(UUID)
@Deprecated public final void enableNotify(java.util.UUID[] charUuids)
enableNotifies(BleNotify[])
instead.enableNotify(UUID)
.@Deprecated public final void enableNotify(java.util.UUID[] charUuids, ReadWriteListener listener)
enableNotifies(BleNotify[])
instead.enableNotify(UUID, ReadWriteListener)
.@Deprecated public final void enableNotify(java.util.UUID[] charUuids, Interval forceReadTimeout)
enableNotifies(BleNotify[])
instead.enableNotify(UUID, Interval)
.@Deprecated public final void enableNotify(java.util.UUID[] charUuids, Interval forceReadTimeout, ReadWriteListener listener)
enableNotifies(BleNotify[])
instead.enableNotify(UUID, Interval, ReadWriteListener)
.public final void enableNotifies(BleNotify[] notifies)
enableNotify(BleNotify)
.public final void enableNotifies(java.lang.Iterable<BleNotify> notifies)
enableNotify(BleNotify)
.@Deprecated public final void enableNotify(java.lang.Iterable<java.util.UUID> charUuids)
enableNotifies(Iterable)
instead.enableNotify(UUID)
.@Deprecated public final void enableNotify(java.lang.Iterable<java.util.UUID> charUuids, ReadWriteListener listener)
enableNotifies(Iterable)
instead.enableNotify(UUID, ReadWriteListener)
.@Deprecated public final void enableNotify(java.lang.Iterable<java.util.UUID> charUuids, Interval forceReadTimeout)
enableNotifies(Iterable)
instead.enableNotify(UUID, Interval)
.@Deprecated public final void enableNotify(java.lang.Iterable<java.util.UUID> charUuids, Interval forceReadTimeout, ReadWriteListener listener)
enableNotifies(Iterable)
instead.enableNotify(UUID, Interval, ReadWriteListener)
.@Deprecated public final ReadWriteListener.ReadWriteEvent enableNotify(java.util.UUID characteristicUuid)
enableNotify(BleNotify)
instead.enableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent enableNotify(java.util.UUID characteristicUuid, ReadWriteListener listener)
enableNotify(BleNotify)
instead.enableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent enableNotify(java.util.UUID characteristicUuid, Interval forceReadTimeout)
enableNotify(BleNotify)
instead.enableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent enableNotify(java.util.UUID characteristicUuid, Interval forceReadTimeout, ReadWriteListener listener)
enableNotify(BleNotify)
instead.enableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent enableNotify(java.util.UUID serviceUuid, java.util.UUID characteristicUuid)
enableNotify(BleNotify)
instead.enableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent enableNotify(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, ReadWriteListener listener)
enableNotify(BleNotify)
instead.enableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent enableNotify(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, Interval forceReadTimeout)
enableNotify(BleNotify)
instead.enableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent enableNotify(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, Interval forceReadTimeout, DescriptorFilter descriptorFilter, ReadWriteListener listener)
enableNotify(BleNotify)
instead.enableNotify(BleNotify)
.public final ReadWriteListener.ReadWriteEvent enableNotify(BleNotify notify)
switch
on NotificationListener.Type.ENABLING_NOTIFICATION
and NotificationListener.Type.NOTIFICATION
(or NotificationListener.Type.INDICATION
) in your listener to distinguish between these.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.@Deprecated public final ReadWriteListener.ReadWriteEvent disableNotify(java.util.UUID characteristicUuid, ReadWriteListener listener)
disableNotify(BleNotify)
instead.disableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent disableNotify(java.util.UUID characteristicUuid, Interval forceReadTimeout, ReadWriteListener listener)
disableNotify(BleNotify)
instead.disableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent disableNotify(java.util.UUID characteristicUuid)
disableNotify(BleNotify)
instead.disableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent disableNotify(java.util.UUID characteristicUuid, Interval forceReadTimeout)
disableNotify(BleNotify)
instead.disableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent disableNotify(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, ReadWriteListener listener)
disableNotify(BleNotify)
instead.disableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent disableNotify(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, Interval forceReadTimeout, ReadWriteListener listener)
disableNotify(BleNotify)
instead.disableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent disableNotify(java.util.UUID serviceUuid, java.util.UUID characteristicUuid)
disableNotify(BleNotify)
instead.disableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent disableNotify(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, Interval forceReadTimeout)
disableNotify(BleNotify)
instead.disableNotify(BleNotify)
.@Deprecated public final ReadWriteListener.ReadWriteEvent disableNotify(java.util.UUID serviceUuid, java.util.UUID characteristicUuid, DescriptorFilter descriptorFilter, Interval forceReadTimeout)
disableNotify(BleNotify)
instead.disableNotify(BleNotify)
.public final ReadWriteListener.ReadWriteEvent disableNotify(BleNotify notify)
enableNotify(BleNotify)
or
any of it's overloads. The listener provided should be the same one that you passed to enableNotify(BleNotify)
. Listen for
ReadWriteListener.Type.DISABLING_NOTIFICATION
in your listener to know when the remote device actually confirmed.connect(BleTransaction.Auth, BleTransaction.Init, DeviceConnectListener)
.public final void disableNotifies(BleNotify[] notifies)
disableNotify(BleNotify)
.public final void disableNotifies(java.lang.Iterable<BleNotify> notifies)
disableNotify(BleNotify)
.@Deprecated public final void disableNotify(java.util.UUID[] uuids, ReadWriteListener listener)
disableNotifies(BleNotify[])
instead.disableNotify(UUID, ReadWriteListener)
.@Deprecated public final void disableNotify(java.util.UUID[] uuids)
disableNotifies(BleNotify[])
instead.disableNotify(UUID)
.@Deprecated public final void disableNotify(java.util.UUID[] uuids, Interval forceReadTimeout)
disableNotifies(BleNotify[])
instead.disableNotify(UUID, Interval)
.@Deprecated public final void disableNotify(java.util.UUID[] uuids, Interval forceReadTimeout, ReadWriteListener listener)
disableNotifies(BleNotify[])
instead.disableNotify(UUID, Interval, ReadWriteListener)
.@Deprecated public final void disableNotify(java.lang.Iterable<java.util.UUID> charUuids)
disableNotifies(Iterable)
instead.disableNotify(UUID)
.@Deprecated public final void disableNotify(java.lang.Iterable<java.util.UUID> charUuids, ReadWriteListener listener)
disableNotifies(Iterable)
instead.disableNotify(UUID, ReadWriteListener)
.@Deprecated public final void disableNotify(java.lang.Iterable<java.util.UUID> charUuids, Interval forceReadTimeout)
disableNotifies(Iterable)
instead.disableNotify(UUID, Interval)
.@Deprecated public final void disableNotify(java.lang.Iterable<java.util.UUID> charUuids, Interval forceReadTimeout, ReadWriteListener listener)
disableNotifies(Iterable)
instead.disableNotify(UUID, Interval, ReadWriteListener)
.public final boolean performOta(BleTransaction.Ota txn)
BleDeviceState.INITIALIZED
. This
will put the device into the BleDeviceState.PERFORMING_OTA
state
if true
is returned. You can use this to do firmware
updates, file transfers, etc.
TimeEstimator
class to let your users know roughly
how much time it will take for the ota to complete.
performTransaction(BleTransaction)
.true
if OTA has started, otherwise false
if device is either already
BleDeviceState.PERFORMING_OTA
or is not BleDeviceState.INITIALIZED
.BleDeviceConfig.includeOtaReadWriteTimesInAverage
,
BleManagerConfig.autoScanDuringOta
,
performTransaction(BleTransaction)
public final boolean performTransaction(BleTransaction txn)
BleDeviceState
like
BleDeviceState.PERFORMING_OTA
, BleDeviceState.AUTHENTICATING
or BleDeviceState.INITIALIZING
.
Generally this transaction should be short, several reads and writes. For longer-term transaction consider using
performOta(BleTransaction.Ota)
.
BleDeviceState.INITIALIZED
.
performOta(BleTransaction.Ota)
.true
if the transaction successfully started, false
otherwise if device is not BleDeviceState.INITIALIZED
.public final int getEffectiveWriteMtuSize()
BleNodeConfig.GATT_WRITE_MTU_OVERHEAD
. The method simply returns the MTU size minus
the overhead. This is just used internally, but is exposed in case it's needed for some other use app-side.public final java.lang.String toString()
toString
in class java.lang.Object
public final boolean isNull()