use of tinyb.BluetoothGattService in project smarthome by eclipse.
the class BlueZBluetoothDevice method refreshServices.
protected void refreshServices() {
if (device.getServices().size() > getServices().size()) {
for (BluetoothGattService tinybService : device.getServices()) {
BluetoothService service = new BluetoothService(UUID.fromString(tinybService.getUUID()), tinybService.getPrimary());
for (BluetoothGattCharacteristic tinybCharacteristic : tinybService.getCharacteristics()) {
BluetoothCharacteristic characteristic = new BluetoothCharacteristic(UUID.fromString(tinybCharacteristic.getUUID()), 0);
for (BluetoothGattDescriptor tinybDescriptor : tinybCharacteristic.getDescriptors()) {
BluetoothDescriptor descriptor = new BluetoothDescriptor(characteristic, UUID.fromString(tinybDescriptor.getUUID()));
characteristic.addDescriptor(descriptor);
}
service.addCharacteristic(characteristic);
}
addService(service);
}
notifyListeners(BluetoothEventType.SERVICES_DISCOVERED);
}
}
Aggregations