-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot listen for changes on characteristic.startNotifications() #85
Comments
I think I found the problem. The code adds an event for If it works then the data should be received on the |
So I made a commit where the code also listens on But I'm not sure which one is correct since Google chrome samples uses I also haven't gotten the notifications to work locally using the devices I own. I got one that does support notifications and that also works in other apps, but the event doesn't seem to fire when using the web api. Are you able to test this for me by either adding a dependencies:
flutter_web_bluetooth:
git: https://github.com/jeroen1602/flutter_web_bluetooth.git In your Or checking out this project and testing it using the example project? If you go the example project route you may need to change the logic in flutter_web_bluetooth/example/lib/business/bluetooth_business.dart Lines 48 to 58 in 6bd5dd3
|
Hey, thanks for all the help. Eventually I got it working by using this: final List<BluetoothService> services = await device.discoverServices();
final BluetoothService service = services
.firstWhere((BluetoothService service) => service.uuid == serviceId);
final BluetoothCharacteristic characteristic =
await service.getCharacteristic(charId);
await characteristic.startNotifications();
characteristic.value.forEach((ByteData element) {
final ByteBuffer buffer = element.buffer;
final Uint8List received =
buffer.asUint8List(element.offsetInBytes, element.lengthInBytes);} all the data received is now in the list received. I provisioned the device using the return from this notifications so the data returned is correct. |
Is this using the release on live on pub.dev or using the code in master? |
Its from the release on pub.dev |
Does there exist a valueListener in Web ble for flutter to listen for changes in notifications?
example for web ble:
The text was updated successfully, but these errors were encountered: