public abstract class BluetoothGattCallback extends Object
BluetoothGatt
callbacks.Constructor and Description |
---|
BluetoothGattCallback() |
Modifier and Type | Method and Description |
---|---|
void |
onCharacteristicChanged(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic)
Callback triggered as a result of a remote characteristic notification.
|
void |
onCharacteristicRead(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic,
int status)
Callback reporting the result of a characteristic read operation.
|
void |
onCharacteristicWrite(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic,
int status)
Callback indicating the result of a characteristic write operation.
|
void |
onConnectionStateChange(BluetoothGatt gatt,
int status,
int newState)
Callback indicating when GATT client has connected/disconnected to/from a remote
GATT server.
|
void |
onDescriptorRead(BluetoothGatt gatt,
BluetoothGattDescriptor descriptor,
int status)
Callback reporting the result of a descriptor read operation.
|
void |
onDescriptorWrite(BluetoothGatt gatt,
BluetoothGattDescriptor descriptor,
int status)
Callback indicating the result of a descriptor write operation.
|
void |
onMtuChanged(BluetoothGatt gatt,
int mtu,
int status)
Callback indicating the MTU for a given device connection has changed.
|
void |
onReadRemoteRssi(BluetoothGatt gatt,
int rssi,
int status)
Callback reporting the RSSI for a remote device connection.
|
void |
onReliableWriteCompleted(BluetoothGatt gatt,
int status)
Callback invoked when a reliable write transaction has been completed.
|
void |
onServicesDiscovered(BluetoothGatt gatt,
int status)
Callback invoked when the list of remote services, characteristics and descriptors
for the remote device have been updated, ie new services have been discovered.
|
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState)
gatt
- GATT clientstatus
- Status of the connect or disconnect operation.
BluetoothGatt.GATT_SUCCESS
if the operation succeeds.newState
- Returns the new connection state. Can be one of
BluetoothProfile.STATE_DISCONNECTED
or
BluetoothProfile.STATE_CONNECTED
public void onServicesDiscovered(BluetoothGatt gatt, int status)
gatt
- GATT client invoked BluetoothGatt.discoverServices()
status
- BluetoothGatt.GATT_SUCCESS
if the remote device
has been explored successfully.public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status)
gatt
- GATT client invoked BluetoothGatt.readCharacteristic(android.bluetooth.BluetoothGattCharacteristic)
characteristic
- Characteristic that was read from the associated
remote device.status
- BluetoothGatt.GATT_SUCCESS
if the read operation
was completed successfully.public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status)
If this callback is invoked while a reliable write transaction is in progress, the value of the characteristic represents the value reported by the remote device. An application should compare this value to the desired value to be written. If the values don't match, the application must abort the reliable write transaction.
gatt
- GATT client invoked BluetoothGatt.writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic)
characteristic
- Characteristic that was written to the associated
remote device.status
- The result of the write operation
BluetoothGatt.GATT_SUCCESS
if the operation succeeds.public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic)
gatt
- GATT client the characteristic is associated withcharacteristic
- Characteristic that has been updated as a result
of a remote notification event.public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status)
gatt
- GATT client invoked BluetoothGatt.readDescriptor(android.bluetooth.BluetoothGattDescriptor)
descriptor
- Descriptor that was read from the associated
remote device.status
- BluetoothGatt.GATT_SUCCESS
if the read operation
was completed successfullypublic void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status)
gatt
- GATT client invoked BluetoothGatt.writeDescriptor(android.bluetooth.BluetoothGattDescriptor)
descriptor
- Descriptor that was writte to the associated
remote device.status
- The result of the write operation
BluetoothGatt.GATT_SUCCESS
if the operation succeeds.public void onReliableWriteCompleted(BluetoothGatt gatt, int status)
gatt
- GATT client invoked BluetoothGatt.executeReliableWrite()
status
- BluetoothGatt.GATT_SUCCESS
if the reliable write
transaction was executed successfullypublic void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status)
BluetoothGatt.readRemoteRssi()
function.gatt
- GATT client invoked BluetoothGatt.readRemoteRssi()
rssi
- The RSSI value for the remote devicestatus
- BluetoothGatt.GATT_SUCCESS
if the RSSI was read successfullypublic void onMtuChanged(BluetoothGatt gatt, int mtu, int status)
BluetoothGatt.requestMtu(int)
function, or in response to a connection
event.gatt
- GATT client invoked BluetoothGatt.requestMtu(int)
mtu
- The new MTU sizestatus
- BluetoothGatt.GATT_SUCCESS
if the MTU has been changed successfully