Comments (5)
I think I found the problem.
The code adds an event for characteristicvaluechanged
while it should be oncharacteristicvaluechanged
.
If it works then the data should be received on the value
stream
from flutter_web_bluetooth.
So I made a commit where the code also listens on oncharacteristicvaluechanged
But I'm not sure which one is correct since Google chrome samples uses characteristicvaluechanged
.
While the Web api draft uses oncharacteristicvaluechanged
.
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 git
dependency to your own project using:
dependencies:
flutter_web_bluetooth:
git: https://github.com/jeroen1602/flutter_web_bluetooth.git
In your pubspec.yml
. Source
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 bluetooth_buesiness.dart
to get it to find your devices.
flutter_web_bluetooth/example/lib/business/bluetooth_business.dart
Lines 48 to 58 in 6bd5dd3
from flutter_web_bluetooth.
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.
from flutter_web_bluetooth.
Is this using the release on live on pub.dev or using the code in master?
from flutter_web_bluetooth.
Its from the release on pub.dev
from flutter_web_bluetooth.
Related Issues (20)
- Struggling with BluetoothCharacteristic.value HOT 2
- Error with brand new Flutter project HOT 2
- Unable to read data using .value property from a BluetoothCharacteristic object. HOT 6
- Misleading description on pub.dev HOT 4
- Support for getting list of characteristics from a service
- Can't find any service HOT 6
- MTU HOT 6
- Can We Get Manufacturer Data or FilterOption by Manufacturer data HOT 5
- How to determine the current connected device ? HOT 1
- Signal strength HOT 3
- Getting meta dependency issue HOT 1
- Thermal Printers compatibility?
- Interaction between Flutter web app and Flutter mobile app HOT 2
- Browser supports HOT 6
- Unable to getting Services of Bluetooth Device HOT 3
- Add exclusion filters
- Manufacturer Data Map is empty in advertisements HOT 6
- Support Notifications
- Couldn't find all of the services! HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_web_bluetooth.