Search in sources :

Example 1 with BluetoothGattService

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);
    }
}
Also used : BluetoothDescriptor(org.eclipse.smarthome.binding.bluetooth.BluetoothDescriptor) BluetoothService(org.eclipse.smarthome.binding.bluetooth.BluetoothService) BluetoothCharacteristic(org.eclipse.smarthome.binding.bluetooth.BluetoothCharacteristic) BluetoothGattService(tinyb.BluetoothGattService) BluetoothGattDescriptor(tinyb.BluetoothGattDescriptor) BluetoothGattCharacteristic(tinyb.BluetoothGattCharacteristic)

Aggregations

BluetoothCharacteristic (org.eclipse.smarthome.binding.bluetooth.BluetoothCharacteristic)1 BluetoothDescriptor (org.eclipse.smarthome.binding.bluetooth.BluetoothDescriptor)1 BluetoothService (org.eclipse.smarthome.binding.bluetooth.BluetoothService)1 BluetoothGattCharacteristic (tinyb.BluetoothGattCharacteristic)1 BluetoothGattDescriptor (tinyb.BluetoothGattDescriptor)1 BluetoothGattService (tinyb.BluetoothGattService)1