public abstract class BluetoothGattCallback extends Object
java.lang.Object ↳android.bluetooth.BluetoothGattCallback
This abstract class is used to implement BluetoothGatt callbacks.
Callback triggered as a result of a remote characteristic notification.
voidonCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status)Callback reporting the result of a characteristic read operation.
voidonCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status)Callback indicating the result of a characteristic write operation.
voidonConnectionStateChange(BluetoothGatt gatt, int status, int newState)Callback indicating when GATT client has connected/disconnected to/from a remote GATT server.
voidonDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status)Callback reporting the result of a descriptor read operation.
voidonDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status)Callback indicating the result of a descriptor write operation.
voidonMtuChanged(BluetoothGatt gatt, int mtu, int status)Callback indicating the MTU for a given device connection has changed.
void onPhyRead(BluetoothGatt gatt, int txPhy, int rxPhy, int status)Callback triggered as result of readPhy()
voidonPhyUpdate(BluetoothGatt gatt, int txPhy, int rxPhy, int status)Callback triggered as result of setPreferredPhy(int, int, int), or as a result of remote device changing the PHY.
voidonReadRemoteRssi(BluetoothGatt gatt, int rssi, int status)Callback reporting the RSSI for a remote device connection.
voidonReliableWriteCompleted(BluetoothGatt gatt, int status)Callback invoked when a reliable write transaction has been completed.
voidonServicesDiscovered(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.
Callback triggered as a result of a remote characteristic notification.
Parametersgatt BluetoothGatt: GATT client the characteristic is associated with
characteristic BluetoothGattCharacteristic: Characteristic that has been updated as a result of a remote notification event.
Callback reporting the result of a characteristic read operation.
ParametersgattBluetoothGatt: GATT client invoked readCharacteristic(BluetoothGattCharacteristic)
characteristic BluetoothGattCharacteristic: Characteristic that was read from the associated remote device.
statusint: GATT_SUCCESS if the read operation was completed successfully.
Callback indicating the result of a characteristic write operation.
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.
ParametersgattBluetoothGatt: GATT client invoked writeCharacteristic(BluetoothGattCharacteristic)
characteristic BluetoothGattCharacteristic: Characteristic that was written to the associated remote device.
statusint: The result of the write operation GATT_SUCCESS if the operation succeeds.
Callback indicating when GATT client has connected/disconnected to/from a remote GATT server.
ParametersgattBluetoothGatt: GATT client
statusint: Status of the connect or disconnect operation. GATT_SUCCESS if the operation succeeds.
newState int: Returns the new connection state. Can be one of STATE_DISCONNECTED or STATE_CONNECTED
Callback reporting the result of a descriptor read operation.
ParametersgattBluetoothGatt: GATT client invoked readDescriptor(BluetoothGattDescriptor)
descriptor BluetoothGattDescriptor: Descriptor that was read from the associated remote device.
statusint: GATT_SUCCESS if the read operation was completed successfully
Callback indicating the result of a descriptor write operation.
ParametersgattBluetoothGatt: GATT client invoked writeDescriptor(BluetoothGattDescriptor)
descriptor BluetoothGattDescriptor: Descriptor that was writte to the associated remote device.
statusint: The result of the write operation GATT_SUCCESS if the operation succeeds.
Callback indicating the MTU for a given device connection has changed. This callback is triggered in response to the requestMtu(int)function, or in response to a connection event.
ParametersgattBluetoothGatt: GATT client invoked requestMtu(int)
mtuint: The new MTU size
status int: GATT_SUCCESS if the MTU has been changed successfully
Callback triggered as result of readPhy()
ParametersgattBluetoothGatt: GATT client
txPhyint: the transmitter PHY in use. One of PHY_LE_1M, PHY_LE_2M, and PHY_LE_CODED.
rxPhy int: the receiver PHY in use. One of PHY_LE_1M, PHY_LE_2M, and PHY_LE_CODED.
statusint: Status of the PHY read operation. GATT_SUCCESS if the operation succeeds.
Callback triggered as result of setPreferredPhy(int, int, int), or as a result of remote device changing the PHY.
ParametersgattBluetoothGatt: GATT client
txPhy int: the transmitter PHY in use. One of PHY_LE_1M, PHY_LE_2M, and PHY_LE_CODED.
rxPhyint: the receiver PHY in use. One of PHY_LE_1M, PHY_LE_2M, and PHY_LE_CODED.
statusint: Status of the PHY update operation. GATT_SUCCESS if the operation succeeds.
Callback reporting the RSSI for a remote device connection. This callback is triggered in response to the readRemoteRssi() function.
ParametersgattBluetoothGatt: GATT client invoked readRemoteRssi()
rssiint: The RSSI value for the remote device
status int: GATT_SUCCESS if the RSSI was read successfully
Callback invoked when a reliable write transaction has been completed.
ParametersgattBluetoothGatt: GATT client invoked executeReliableWrite()
status int: GATT_SUCCESS if the reliable write transaction was executed successfully
Callback invoked when the list of remote services, characteristics and descriptors for the remote device have been updated, ie new services have been discovered.
ParametersgattBluetoothGatt: GATT client invoked discoverServices()
status int: GATT_SUCCESS if the remote device has been explored successfully.
转载于:https://www.cnblogs.com/nightnine/p/7685712.html