BluetoothGattServerCallback
  public
  
  
  abstract
  class
  BluetoothGattServerCallback
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.bluetooth.BluetoothGattServerCallback | 
This abstract class is used to implement BluetoothGattServer callbacks.
Summary
| Public constructors | |
|---|---|
| 
      BluetoothGattServerCallback()
       | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        void | 
      onCharacteristicReadRequest(BluetoothDevice device, int requestId, int offset, BluetoothGattCharacteristic characteristic)
      A remote client has requested to read a local characteristic. | 
| 
        
        
        
        
        
        void | 
      onCharacteristicWriteRequest(BluetoothDevice device, int requestId, BluetoothGattCharacteristic characteristic, boolean preparedWrite, boolean responseNeeded, int offset, byte[] value)
      A remote client has requested to write to a local characteristic. | 
| 
        
        
        
        
        
        void | 
      onConnectionStateChange(BluetoothDevice device, int status, int newState)
      Callback indicating when a remote device has been connected or disconnected. | 
| 
        
        
        
        
        
        void | 
      onDescriptorReadRequest(BluetoothDevice device, int requestId, int offset, BluetoothGattDescriptor descriptor)
      A remote client has requested to read a local descriptor. | 
| 
        
        
        
        
        
        void | 
      onDescriptorWriteRequest(BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor, boolean preparedWrite, boolean responseNeeded, int offset, byte[] value)
      A remote client has requested to write to a local descriptor. | 
| 
        
        
        
        
        
        void | 
      onExecuteWrite(BluetoothDevice device, int requestId, boolean execute)
      Execute all pending write operations for this device. | 
| 
        
        
        
        
        
        void | 
      onMtuChanged(BluetoothDevice device, int mtu)
      Callback indicating the MTU for a given device connection has changed. | 
| 
        
        
        
        
        
        void | 
      onNotificationSent(BluetoothDevice device, int status)
      Callback invoked when a notification or indication has been sent to a remote device. | 
| 
        
        
        
        
        
        void | 
      onPhyRead(BluetoothDevice device, int txPhy, int rxPhy, int status)
      Callback triggered as result of  | 
| 
        
        
        
        
        
        void | 
      onPhyUpdate(BluetoothDevice device, int txPhy, int rxPhy, int status)
      Callback triggered as result of  | 
| 
        
        
        
        
        
        void | 
      onServiceAdded(int status, BluetoothGattService service)
      Indicates whether a local service has been added successfully. | 
| 
        
        
        
        
        
        void | 
      onSubrateChange(BluetoothDevice device, int subrateMode, int status)
      Callback indicating LE connection's subrate parameters have changed. | 
| Inherited methods | |
|---|---|
Public constructors
Public methods
onCharacteristicReadRequest
public void onCharacteristicReadRequest (BluetoothDevice device, int requestId, int offset, BluetoothGattCharacteristic characteristic)
A remote client has requested to read a local characteristic.
An application must call BluetoothGattServer.sendResponse to complete the request.
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device that has requested the read operation | 
| requestId | int: The Id of the request | 
| offset | int: Offset into the value of the characteristic | 
| characteristic | BluetoothGattCharacteristic: Characteristic to be read | 
onCharacteristicWriteRequest
public void onCharacteristicWriteRequest (BluetoothDevice device, int requestId, BluetoothGattCharacteristic characteristic, boolean preparedWrite, boolean responseNeeded, int offset, byte[] value)
A remote client has requested to write to a local characteristic.
An application must call BluetoothGattServer.sendResponse to complete the request.
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device that has requested the write operation | 
| requestId | int: The Id of the request | 
| characteristic | BluetoothGattCharacteristic: Characteristic to be written to. | 
| preparedWrite | boolean: true, if this write operation should be queued for later execution. | 
| responseNeeded | boolean: true, if the remote device requires a response | 
| offset | int: The offset given for the value | 
| value | byte: The value the client wants to assign to the characteristic | 
onConnectionStateChange
public void onConnectionStateChange (BluetoothDevice device, int status, int newState)
Callback indicating when a remote device has been connected or disconnected.
| Parameters | |
|---|---|
| device | BluetoothDevice: Remote device that has been connected or disconnected. | 
| status | int: Status of the connect or disconnect operation. | 
| newState | int: Returns the new connection state. Can be one ofBluetoothProfile.STATE_DISCONNECTEDorBluetoothProfile.STATE_CONNECTED | 
onDescriptorReadRequest
public void onDescriptorReadRequest (BluetoothDevice device, int requestId, int offset, BluetoothGattDescriptor descriptor)
A remote client has requested to read a local descriptor.
An application must call BluetoothGattServer.sendResponse to complete the request.
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device that has requested the read operation | 
| requestId | int: The Id of the request | 
| offset | int: Offset into the value of the characteristic | 
| descriptor | BluetoothGattDescriptor: Descriptor to be read | 
onDescriptorWriteRequest
public void onDescriptorWriteRequest (BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor, boolean preparedWrite, boolean responseNeeded, int offset, byte[] value)
A remote client has requested to write to a local descriptor.
An application must call BluetoothGattServer.sendResponse to complete the request.
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device that has requested the write operation | 
| requestId | int: The Id of the request | 
| descriptor | BluetoothGattDescriptor: Descriptor to be written to. | 
| preparedWrite | boolean: true, if this write operation should be queued for later execution. | 
| responseNeeded | boolean: true, if the remote device requires a response | 
| offset | int: The offset given for the value | 
| value | byte: The value the client wants to assign to the descriptor | 
onExecuteWrite
public void onExecuteWrite (BluetoothDevice device, int requestId, boolean execute)
Execute all pending write operations for this device.
An application must call BluetoothGattServer.sendResponse to complete the request.
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device that has requested the write operations | 
| requestId | int: The Id of the request | 
| execute | boolean: Whether the pending writes should be executed (true) or cancelled (false) | 
onMtuChanged
public void onMtuChanged (BluetoothDevice device, int mtu)
Callback indicating the MTU for a given device connection has changed.
This callback will be invoked if a remote client has requested to change the MTU for a given connection.
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device that requested the MTU change | 
| mtu | int: The new MTU size | 
onNotificationSent
public void onNotificationSent (BluetoothDevice device, int status)
Callback invoked when a notification or indication has been sent to a remote device.
When multiple notifications are to be sent, an application must wait for this callback to be received before sending additional notifications.
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device the notification has been sent to | 
| status | int:BluetoothGatt.GATT_SUCCESSif the operation was successful | 
onPhyRead
public void onPhyRead (BluetoothDevice device, int txPhy, int rxPhy, int status)
Callback triggered as result of BluetoothGattServer.readPhy
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device that requested the PHY read | 
| txPhy | int: the transmitter PHY in use. One ofBluetoothDevice.PHY_LE_1M,BluetoothDevice.PHY_LE_2M, andBluetoothDevice.PHY_LE_CODED | 
| rxPhy | int: the receiver PHY in use. One ofBluetoothDevice.PHY_LE_1M,BluetoothDevice.PHY_LE_2M, andBluetoothDevice.PHY_LE_CODED | 
| status | int: Status of the PHY read operation.BluetoothGatt.GATT_SUCCESSif the
     operation succeeds. | 
onPhyUpdate
public void onPhyUpdate (BluetoothDevice device, int txPhy, int rxPhy, int status)
Callback triggered as result of BluetoothGattServer.setPreferredPhy, or as a result
 of remote device changing the PHY.
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device | 
| txPhy | int: the transmitter PHY in use. One ofBluetoothDevice.PHY_LE_1M,BluetoothDevice.PHY_LE_2M, andBluetoothDevice.PHY_LE_CODED | 
| rxPhy | int: the receiver PHY in use. One ofBluetoothDevice.PHY_LE_1M,BluetoothDevice.PHY_LE_2M, andBluetoothDevice.PHY_LE_CODED | 
| status | int: Status of the PHY update operation.BluetoothGatt.GATT_SUCCESSif the
     operation succeeds. | 
onServiceAdded
public void onServiceAdded (int status, 
                BluetoothGattService service)Indicates whether a local service has been added successfully.
| Parameters | |
|---|---|
| status | int: ReturnsBluetoothGatt.GATT_SUCCESSif the service was added
     successfully. | 
| service | BluetoothGattService: The service that has been added | 
onSubrateChange
public void onSubrateChange (BluetoothDevice device, int subrateMode, int status)
Callback indicating LE connection's subrate parameters have changed.
| Parameters | |
|---|---|
| device | BluetoothDevice: The remote device involved
 This value cannot benull. | 
| subrateMode | int: for this LE connection.
 Value isBluetoothGatt.SUBRATE_MODE_OFF,BluetoothGatt.SUBRATE_MODE_LOW,BluetoothGatt.SUBRATE_MODE_BALANCED,BluetoothGatt.SUBRATE_MODE_HIGH,BluetoothGatt.SUBRATE_MODE_SYSTEM_UPDATE, orBluetoothGatt.SUBRATE_MODE_NOT_UPDATED | 
| status | int:BluetoothGatt.GATT_SUCCESSif the connection subrating has been updated
     successfully
 Value isBluetoothStatusCodes.SUCCESS, android.bluetooth.BluetoothStatusCodes.REASON_SYSTEM_POLICY,BluetoothStatusCodes.ERROR_UNKNOWN, android.bluetooth.BluetoothStatusCodes.ERROR_HARDWARE_GENERIC, android.bluetooth.BluetoothStatusCodes.NOT_ALLOWED, android.bluetooth.BluetoothStatusCodes.ERROR_REMOTE_OPERATION_NOT_SUPPORTED, android.bluetooth.BluetoothStatusCodes.ERROR_LOCAL_NOT_ENOUGH_RESOURCES, or android.bluetooth.BluetoothStatusCodes.ERROR_BAD_PARAMETERS | 
