chipweinberger / flutter_blue_plus

Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android, iOS, macOS
Other
788 stars 478 forks source link

[Help]: Can't read Characteristic in simple way #928

Closed xOldeVx closed 4 months ago

xOldeVx commented 4 months ago

Requirements

Have you checked this problem on the example app?

Yes

FlutterBluePlus Version

5.3.1

Flutter Version

3.22

What OS?

Android

OS Version

17.3.1

Bluetooth Module

Nordic nRF52

What is your problem?

I'm switching to flutter_blue_plus from flutter_reactive_ble, in flutter_reactive_ble i could read a value from the ble device in very simple way, for example to read the battery value is going so:

final characteristic = QualifiedCharacteristic(serviceId: serviceUuid, characteristicId: characteristicUuid, deviceId: foundDeviceId);
final response = await flutterReactiveBle.readCharacteristic(characteristic);

But in flutter_blue_plus I can't read the battery value in this way, as far as I understand I MUST to discover all the services, and then all the characteristic and then find out the battery characteristic and call it....... a very long way.

Is there a way to call it directly like in flutter_reactive_ble

Logs

See above
chipweinberger commented 4 months ago

yes you can just create a BluetoothCharacteristic object and call read.

basically the same thing