BleDispatcher¶
-
public interface
BleDispatcher
¶ Interface used to abstract the use of Bluetooth operations.
Mostly used by
KallistoSensors
to talk with the remote device.
Methods¶
disableNotification¶
-
boolean
disableNotification
(UUID serviceUuid, UUID characteristicUuid, BleNotificationListener listener)¶ Disables notifications of the the characteristic with the passed UUID of the service with the passed UUID.
- Parameters
serviceUuid – The UUID of the service containing the characteristic that should have its’ notifications disabled.
characteristicUuid – The UUID of the characteristic that should have its’ notifications disabled.
listener – The listener used in
enableNotification(UUID,UUID,BleNotificationListener)
call.
- Throws
BleException – If something went wrong with the BLE communication.
- Returns
{code true} if notifications were disabled successfully.
enableNotification¶
-
boolean
enableNotification
(UUID serviceUuid, UUID characteristicUuid, BleNotificationListener listener)¶ Enables notifications of the the characteristic with the passed UUID of the service with the passed UUID.
- Parameters
serviceUuid – The UUID of the service containing the characteristic that should have its’ notifications enabled.
characteristicUuid – The UUID of the characteristic that should have its’ notifications enabled.
listener – The listener to receive notifications.
- Throws
BleException – If something went wrong with the BLE communication.
- Returns
{code true} if notifications were enabled successfully.
getCharacteristics¶
-
List<UUID>
getCharacteristics
(UUID serviceUuid)¶ Get the remote device BLE characteristic list of the service with the passed UUID.
- Parameters
serviceUuid – The UUID of the service whose characteristic should be returned.
- Returns
A list of UUIDs representing the BLE characteristic of the passed service. Will be empty if the service is not found.
getServices¶
readCharacteristic¶
-
byte[]
readCharacteristic
(UUID serviceUuid, UUID characteristicUuid)¶ Reads the characteristic with the passed UUID of the service with the passed UUID.
- Parameters
serviceUuid – The UUID of the service containing the characteristic that should be read.
characteristicUuid – The UUID of the characteristic that should be read.
- Throws
BleException – If something went wrong with the BLE communication.
- Returns
A byte buffer with the requested data. Can be empty if something went wrong.
writeCharacteristic¶
-
boolean
writeCharacteristic
(UUID serviceUuid, UUID characteristicUuid, byte[] vals)¶ Writes the passed data to the characteristic with the passed UUID of the service with the passed UUID.
- Parameters
serviceUuid – The UUID of the service containing the characteristic that should be written.
characteristicUuid – The UUID of the characteristic that should be written.
vals – A byte buffer with the data to be written.
- Throws
BleException – If something went wrong with the BLE communication.
- Returns
A byte buffer with the requested data. Can be empty if something went wrong.