-
@Deprecated() public interface BleManagerCallbacks
The BleManagerCallbacks should be overridden in your app and all the 'high level' callbacks should be added there.
-
-
Method Summary
Modifier and Type Method Description abstract voidonDeviceConnecting(@NonNull() BluetoothDevice device)Called when the Android device started connecting to given device. abstract voidonDeviceConnected(@NonNull() BluetoothDevice device)Called when the device has been connected. abstract voidonDeviceDisconnecting(@NonNull() BluetoothDevice device)Called when user initialized disconnection. abstract voidonDeviceDisconnected(@NonNull() BluetoothDevice device)Called when the device has disconnected (when the callback returned onConnectionStateChange with stateDISCONNECTED), but ONLY if the shouldAutoConnect method returnedfalse for this device when it was connecting. abstract voidonLinkLossOccurred(@NonNull() BluetoothDevice device)This callback is invoked when the Ble Manager lost connection to a device that has beenconnected with autoConnect option (see shouldAutoConnect. abstract voidonServicesDiscovered(@NonNull() BluetoothDevice device, boolean optionalServicesFound)Called when service discovery has finished and primary services has been found.This method is not called if the primary, mandatory services were not found during servicediscovery. abstract voidonDeviceReady(@NonNull() BluetoothDevice device)Method called when all initialization requests has been completed. booleanshouldEnableBatteryLevelNotifications(@NonNull() BluetoothDevice device)This method should return true if Battery Level notifications should be enabled on thetarget device. voidonBatteryValueReceived(@NonNull() BluetoothDevice device, @IntRange(from = 0, to = 100) int value)Called when battery value has been received from the device. abstract voidonBondingRequired(@NonNull() BluetoothDevice device)Called when an GATT_INSUFFICIENT_AUTHENTICATION error occurred and thedevice bond state is BOND_NONE. abstract voidonBonded(@NonNull() BluetoothDevice device)Called when the device has been successfully bonded. abstract voidonBondingFailed(@NonNull() BluetoothDevice device)Called when the bond state has changed from BOND_BONDING to BOND_NONE. abstract voidonError(@NonNull() BluetoothDevice device, @NonNull() String message, int errorCode)Called when a BLE error has occurred abstract voidonDeviceNotSupported(@NonNull() BluetoothDevice device)Called when service discovery has finished but the main services were not found on the device. -
-
Method Detail
-
onDeviceConnecting
@Deprecated() abstract void onDeviceConnecting(@NonNull() BluetoothDevice device)
Called when the Android device started connecting to given device.The onDeviceConnected will be called when the device is connected,or onError in case of error.
- Parameters:
device- the device that got connected.
-
onDeviceConnected
@Deprecated() abstract void onDeviceConnected(@NonNull() BluetoothDevice device)
Called when the device has been connected. This does not mean that the application may startcommunication.A service discovery will be handled automatically after this call. Service discoverymay ends up with calling onServicesDiscovered or onDeviceNotSupported if required services have not been found.
- Parameters:
device- the device that got connected.
-
onDeviceDisconnecting
@Deprecated() abstract void onDeviceDisconnecting(@NonNull() BluetoothDevice device)
Called when user initialized disconnection.
- Parameters:
device- the device that gets disconnecting.
-
onDeviceDisconnected
@Deprecated() abstract void onDeviceDisconnected(@NonNull() BluetoothDevice device)
Called when the device has disconnected (when the callback returned onConnectionStateChange with stateDISCONNECTED), but ONLY if the shouldAutoConnect method returnedfalse for this device when it was connecting.Otherwise the onLinkLossOccurred method will be called instead.
- Parameters:
device- the device that got disconnected.
-
onLinkLossOccurred
@Deprecated() abstract void onLinkLossOccurred(@NonNull() BluetoothDevice device)
This callback is invoked when the Ble Manager lost connection to a device that has beenconnected with autoConnect option (see shouldAutoConnect.Otherwise a onDeviceDisconnected method will be called on suchevent.
- Parameters:
device- the device that got disconnected due to a link loss.
-
onServicesDiscovered
@Deprecated() abstract void onServicesDiscovered(@NonNull() BluetoothDevice device, boolean optionalServicesFound)
Called when service discovery has finished and primary services has been found.This method is not called if the primary, mandatory services were not found during servicediscovery. For example in the Blood Pressure Monitor, a Blood Pressure service is aprimary service and Intermediate Cuff Pressure service is a optional secondary service.Existence of battery service is not notified by this call.
After successful service discovery the service will initialize all services.The onDeviceReady method will be called when the initializationis complete.
- Parameters:
device- the device which services got disconnected.optionalServicesFound- iftruethe secondary services were also foundon the device.
-
onDeviceReady
@Deprecated() abstract void onDeviceReady(@NonNull() BluetoothDevice device)
Method called when all initialization requests has been completed.
- Parameters:
device- the device that get ready.
-
shouldEnableBatteryLevelNotifications
@Deprecated() boolean shouldEnableBatteryLevelNotifications(@NonNull() BluetoothDevice device)
This method should return true if Battery Level notifications should be enabled on thetarget device. If there is no Battery Service, or the Battery Level characteristic doesnot have NOTIFY property, this method will not be called for this device.
This method may return true only if an activity is bound to the service (to display theinformation to the user), always (e.g. if critical battery level is reported usingnotifications) or never, if such information is not important or the manager wants tocontrol Battery Level notifications on its own.
- Parameters:
device- the target device.
-
onBatteryValueReceived
@Deprecated() void onBatteryValueReceived(@NonNull() BluetoothDevice device, @IntRange(from = 0, to = 100) int value)
Called when battery value has been received from the device.
- Parameters:
device- the device from which the battery value has changed.value- the battery value in percent.
-
onBondingRequired
@Deprecated() abstract void onBondingRequired(@NonNull() BluetoothDevice device)
Called when an GATT_INSUFFICIENT_AUTHENTICATION error occurred and thedevice bond state is BOND_NONE.
- Parameters:
device- the device that requires bonding.
-
onBonded
@Deprecated() abstract void onBonded(@NonNull() BluetoothDevice device)
Called when the device has been successfully bonded.
- Parameters:
device- the device that got bonded.
-
onBondingFailed
@Deprecated() abstract void onBondingFailed(@NonNull() BluetoothDevice device)
Called when the bond state has changed from BOND_BONDING to BOND_NONE.
- Parameters:
device- the device that failed to bond.
-
onError
@Deprecated() abstract void onError(@NonNull() BluetoothDevice device, @NonNull() String message, int errorCode)
Called when a BLE error has occurred
- Parameters:
device- the device that caused an error.message- the error message.errorCode- the error code.
-
onDeviceNotSupported
@Deprecated() abstract void onDeviceNotSupported(@NonNull() BluetoothDevice device)
Called when service discovery has finished but the main services were not found on the device.
- Parameters:
device- the device that failed to connect due to lack of required services.
-
-
-
-