public abstract class BluetoothPeripheralManagerCallback
extends java.lang.Object
Constructor and Description |
---|
BluetoothPeripheralManagerCallback() |
Modifier and Type | Method and Description |
---|---|
void |
onAdvertiseFailure(@NotNull AdvertiseError advertiseError)
Advertising has failed
|
void |
onAdvertisingStarted(@NotNull android.bluetooth.le.AdvertiseSettings settingsInEffect)
Advertising has successfully started
|
void |
onAdvertisingStopped()
Advertising has stopped
|
void |
onCentralConnected(@NotNull BluetoothCentral bluetoothCentral)
A remote central has connected
|
void |
onCentralDisconnected(@NotNull BluetoothCentral bluetoothCentral)
A remote central has disconnected
|
void |
onCharacteristicRead(@NotNull BluetoothCentral bluetoothCentral,
@NotNull android.bluetooth.BluetoothGattCharacteristic characteristic)
A remote central has requested to read a local characteristic.
|
GattStatus |
onCharacteristicWrite(@NotNull BluetoothCentral bluetoothCentral,
@NotNull android.bluetooth.BluetoothGattCharacteristic characteristic,
@NotNull byte[] value)
A remote central has requested to write a local characteristic.
|
void |
onDescriptorRead(@NotNull BluetoothCentral bluetoothCentral,
@NotNull android.bluetooth.BluetoothGattDescriptor descriptor)
A remote central has requested to read a local descriptor.
|
GattStatus |
onDescriptorWrite(@NotNull BluetoothCentral bluetoothCentral,
@NotNull android.bluetooth.BluetoothGattDescriptor descriptor,
@NotNull byte[] value)
A remote central has requested to write a local descriptor.
|
void |
onNotificationSent(@NotNull BluetoothCentral bluetoothCentral,
@NotNull byte[] value,
@NotNull android.bluetooth.BluetoothGattCharacteristic characteristic,
@NotNull GattStatus status)
A notification has been sent to a central
|
void |
onNotifyingDisabled(@NotNull BluetoothCentral bluetoothCentral,
@NotNull android.bluetooth.BluetoothGattCharacteristic characteristic)
A remote central has disabled notifications or indications for a characteristic
|
void |
onNotifyingEnabled(@NotNull BluetoothCentral bluetoothCentral,
@NotNull android.bluetooth.BluetoothGattCharacteristic characteristic)
A remote central has enabled notifications or indications for a characteristic
|
void |
onServiceAdded(@NotNull GattStatus status,
@NotNull android.bluetooth.BluetoothGattService service)
Indicates whether a local service has been added successfully.
|
public void onServiceAdded(@NotNull @NotNull GattStatus status, @NotNull @NotNull android.bluetooth.BluetoothGattService service)
status
- Returns SUCCESS if the service was added
successfully.service
- The service that has been addedpublic void onCharacteristicRead(@NotNull @NotNull BluetoothCentral bluetoothCentral, @NotNull @NotNull android.bluetooth.BluetoothGattCharacteristic characteristic)
This callback is called before the current value of the characteristic is returned to the central. Therefore, any modifications to the characteristic value can still be made. If the characteristic's value is longer than the MTU - 1 bytes, a long read will be executed automatically
bluetoothCentral
- the central that is doing the requestcharacteristic
- the characteristic to be readpublic GattStatus onCharacteristicWrite(@NotNull @NotNull BluetoothCentral bluetoothCentral, @NotNull @NotNull android.bluetooth.BluetoothGattCharacteristic characteristic, @NotNull @NotNull byte[] value)
This callback is called before the current value of the characteristic is set to value
.
The value should be checked and a GattStatus should be returned. If anything else than GattStatus.SUCCESS is returned,
the characteristic's value will not be updated.
The value may be up to 512 bytes (in case of a long write)
bluetoothCentral
- the central that is doing the requestcharacteristic
- the characteristic to be writtenvalue
- the value the central wants to writepublic void onDescriptorRead(@NotNull @NotNull BluetoothCentral bluetoothCentral, @NotNull @NotNull android.bluetooth.BluetoothGattDescriptor descriptor)
This callback is called before the current value of the descriptor is returned to the central. Therefore, any modifications to the characteristic value can still be made. If the descriptor's value is longer than the MTU - 1 bytes, a long read will be executed automatically
bluetoothCentral
- the central that is doing the requestdescriptor
- the descriptor to be readpublic GattStatus onDescriptorWrite(@NotNull @NotNull BluetoothCentral bluetoothCentral, @NotNull @NotNull android.bluetooth.BluetoothGattDescriptor descriptor, @NotNull @NotNull byte[] value)
This callback is called before the current value of the descriptor is set to value
.
The value should be checked and a GattStatus should be returned. If anything else than GattStatus.SUCCESS is returned,
the descriptor's value will not be updated.
The value may be up to 512 bytes (in case of a long write)
bluetoothCentral
- the central that is doing the requestdescriptor
- the descriptor to be writtenvalue
- the value the central wants to writepublic void onNotifyingEnabled(@NotNull @NotNull BluetoothCentral bluetoothCentral, @NotNull @NotNull android.bluetooth.BluetoothGattCharacteristic characteristic)
bluetoothCentral
- the centralcharacteristic
- the characteristicpublic void onNotifyingDisabled(@NotNull @NotNull BluetoothCentral bluetoothCentral, @NotNull @NotNull android.bluetooth.BluetoothGattCharacteristic characteristic)
bluetoothCentral
- the centralcharacteristic
- the characteristicpublic void onNotificationSent(@NotNull @NotNull BluetoothCentral bluetoothCentral, @NotNull @NotNull byte[] value, @NotNull @NotNull android.bluetooth.BluetoothGattCharacteristic characteristic, @NotNull @NotNull GattStatus status)
bluetoothCentral
- the centralvalue
- the value of the notificationcharacteristic
- the characteristic for which the notification was sentstatus
- the status of the operationpublic void onCentralConnected(@NotNull @NotNull BluetoothCentral bluetoothCentral)
bluetoothCentral
- the centralpublic void onCentralDisconnected(@NotNull @NotNull BluetoothCentral bluetoothCentral)
bluetoothCentral
- the centralpublic void onAdvertisingStarted(@NotNull @NotNull android.bluetooth.le.AdvertiseSettings settingsInEffect)
settingsInEffect
- the AdvertiseSettings that are currently activepublic void onAdvertiseFailure(@NotNull @NotNull AdvertiseError advertiseError)
advertiseError
- the error explaining why the advertising failedpublic void onAdvertisingStopped()