public interface BtleGatt
Modifier and Type | Interface and Description |
---|---|
static interface |
BtleGatt.DisconnectHandler
Handler for disconnect events
|
static interface |
BtleGatt.NotificationListener
Listener for GATT characteristic notifications
|
static class |
BtleGatt.WriteType
Write types for the GATT characteristic
|
Modifier and Type | Method and Description |
---|---|
Task<Void> |
connectAsync()
Connects to the GATT server on the remote device
|
Task<Void> |
enableNotificationsAsync(BtleGattCharacteristic characteristic,
BtleGatt.NotificationListener listener)
Enable notifications for the characteristic
|
Task<Void> |
localDisconnectAsync()
A disconnect attempted initiated by the Android device
|
void |
onDisconnect(BtleGatt.DisconnectHandler handler)
Register a handler for disconnect events
|
Task<byte[]> |
readCharacteristicAsync(BtleGattCharacteristic characteristic)
Reads the requested characteristic's value
|
Task<byte[][]> |
readCharacteristicAsync(BtleGattCharacteristic[] characteristics)
Convenience method to do bulk characteristic reads
|
Task<Integer> |
readRssiAsync()
Read the remote device's RSSI value
|
Task<Void> |
remoteDisconnectAsync()
A disconnect attempt that will be initiated by the remote device
|
boolean |
serviceExists(UUID gattService)
Checks if a service exists
|
Task<Void> |
writeCharacteristicAsync(BtleGattCharacteristic characteristic,
BtleGatt.WriteType type,
byte[] value)
Writes a GATT characteristic and its value to the remote device
|
void onDisconnect(BtleGatt.DisconnectHandler handler)
handler
- Handler to respond to the dc eventsboolean serviceExists(UUID gattService)
gattService
- UUID identifying the service to lookupTask<Void> writeCharacteristicAsync(BtleGattCharacteristic characteristic, BtleGatt.WriteType type, byte[] value)
characteristic
- GATT characteristic to writetype
- Type of GATT write to usevalue
- Value to be writtenTask<byte[][]> readCharacteristicAsync(BtleGattCharacteristic[] characteristics)
characteristics
- Array of characteristics to readTask<byte[]> readCharacteristicAsync(BtleGattCharacteristic characteristic)
characteristic
- Characteristic to readTask<Void> enableNotificationsAsync(BtleGattCharacteristic characteristic, BtleGatt.NotificationListener listener)
characteristic
- Characteristic to enable notifications forlistener
- Listener for handling characteristic notificationsTask<Void> localDisconnectAsync()
Task<Void> remoteDisconnectAsync()
Task<Void> connectAsync()