public class DefaultConnectionCallbacks extends java.lang.Object implements ConnectionCallbacks
DefaultConnectionCallbacks
class provides a default implementation of the
ConnectionCallbacks
interface.
The implementation of each of the methods does nothing.
Constructor and Description |
---|
DefaultConnectionCallbacks() |
Modifier and Type | Method and Description |
---|---|
void |
onConnected(BluetoothDevice device)
Called when a connection attempt is successful or when a remote device connects to the adapter.
|
void |
onConnectFailed(BluetoothDevice device)
Called when a connection attempt fails.
|
void |
onDisconnected(BluetoothDevice device)
Called when the connection with a device is closed.
|
void |
onPairCompleted(BluetoothDevice device,
boolean success)
Called when the pairing procedure with a device is completed.
|
void |
onPairRequest(BluetoothDevice device)
Called when a pairing request from a device is received.
|
void |
onPasskeyGenerated(BluetoothDevice device,
int passkey)
Called when a passkey is generated to be displayed to the user.
|
void |
onPasskeyRequest(BluetoothDevice device)
Called when a passkey request from a device is received.
|
void |
onServicesDiscovered(BluetoothDevice device)
Called when the services of the device are discovered.
|
public void onConnectFailed(BluetoothDevice device)
ConnectionCallbacks
onConnectFailed
in interface ConnectionCallbacks
device
- the device to which the connection has failed.BluetoothDevice.connect(ConnectionCallbacks)
public void onConnected(BluetoothDevice device)
ConnectionCallbacks
onConnected
in interface ConnectionCallbacks
device
- the device to which the connection was established.BluetoothDevice.connect(ConnectionCallbacks)
,
BluetoothAdapter.startAdvertising(AdvertisementCallbacks, ConnectionCallbacks, byte[])
public void onDisconnected(BluetoothDevice device)
ConnectionCallbacks
onDisconnected
in interface ConnectionCallbacks
device
- the device to which the connection was closed.BluetoothDevice.disconnect()
public void onPairRequest(BluetoothDevice device)
ConnectionCallbacks
onPairRequest
in interface ConnectionCallbacks
device
- the device from which the pairing request was received.BluetoothDevice.pairReply(boolean)
public void onPairCompleted(BluetoothDevice device, boolean success)
ConnectionCallbacks
onPairCompleted
in interface ConnectionCallbacks
device
- the device with which the pairing procedure was completed.success
- true if the pairing procedure was successful, false otherwise.BluetoothDevice.pair()
,
BluetoothDevice.pairReply(boolean)
public void onPasskeyRequest(BluetoothDevice device)
ConnectionCallbacks
onPasskeyRequest
in interface ConnectionCallbacks
device
- the device from which the passkey request was received.BluetoothDevice.passkeyReply(boolean, int)
public void onPasskeyGenerated(BluetoothDevice device, int passkey)
ConnectionCallbacks
onPasskeyGenerated
in interface ConnectionCallbacks
device
- the device to which the passkey request was sent.passkey
- the passkey which was generated.BluetoothDevice.passkeyReply(boolean, int)
public void onServicesDiscovered(BluetoothDevice device)
ConnectionCallbacks
onServicesDiscovered
in interface ConnectionCallbacks
device
- the device of which the services were discovered.BluetoothDevice.discoverServices()