public class ServiceHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static BluetoothCharacteristic |
getCharacteristic(BluetoothService service,
BluetoothUuid characteristicUuid)
Returns the characteristic with the given UUID in the given service.
|
static BluetoothDescriptor |
getDescriptor(BluetoothCharacteristic characteristic,
BluetoothUuid descriptorUuid)
Returns the descriptor with the given UUID in the given characteristic.
|
static int |
getReadPermission(int securityLevel)
Returns the read permission for the given security level.
|
static int |
getWritePermission(int securityLevel)
Returns the write permission for the given security level.
|
static void |
printService(BluetoothService service,
PrintStream printStream)
Prints information on the given service to the given print stream.
|
public static BluetoothCharacteristic getCharacteristic(BluetoothService service, BluetoothUuid characteristicUuid) throws AttributeNotFoundException
If multiple characteristics have the same UUID, any of them may be returned.
service - the service to search in.characteristicUuid - the UUID of the characteristic to look for.AttributeNotFoundException - if this service does not provide a characteristic with the given UUID.public static BluetoothDescriptor getDescriptor(BluetoothCharacteristic characteristic, BluetoothUuid descriptorUuid) throws AttributeNotFoundException
If multiple descriptors have the same UUID, any of them may be returned.
characteristic - the characteristic to search in.descriptorUuid - the UUID of the descriptor to look for.AttributeNotFoundException - if this characteristic does not provide a descriptor with the given UUID.public static int getReadPermission(int securityLevel)
securityLevel - the security level (see SecurityLevels).BluetoothPermissions).public static int getWritePermission(int securityLevel)
securityLevel - the security level (see SecurityLevels).BluetoothPermissions).public static void printService(BluetoothService service, PrintStream printStream)
service - the service to inspect.printStream - the print stream to print to.