-
Notifications
You must be signed in to change notification settings - Fork 21
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
Can you Please try to add this to a true Cross platform package , like quick_blue #79
Comments
I've been looking at integrating with flutter_reactive_ble but not making good progress. Thanks for the hint about quick_blue. |
@robert-ancell ,i checked your flutter_reactive_ble fork , and used that code for implementing bluez in quick_blue, almost added all methods but , connections seems to be unstable getting this error while connecting : org.bluez.Error.Failed: Software caused connection abort https://github.com/rohitsangwan01/quick_blue/tree/master/quick_blue_linux |
That's awesome! I'll have a look and see if I can reproduce the same issues. Because Bluetooth can sometimes be hard to debug I've found the best method is to try using |
There might be an issue here: void connect(String deviceId) async {
await initBluez();
final device = _getDeviceWithId(deviceId);
if (device == null) {
throw 'No such device $deviceId';
} else {
device.connect();
_checkDeviceConnectionState(device);
}
} You probably want to wait for the result of the connect call:
This also relies on the property changes being sent before the 'connect' completes. I think that should be the case but _checkDeviceConnectionState could potentially be using older data. |
@robert-ancell thanks , i will try this |
I've just released bluez 0.7.8 which has support for subscription (use BlueZGattCharacteristic.startNotify and subscribe for changes to the 'Value` property. I'm working on getting data as a stream and MTU support at the moment. |
@robert-ancell great will try with this update |
@robert-ancell are we suppose to read "Value" property in loop after using c.startNotify ?? |
You want something like this: characteristic.propertiesChanged.listen((names) {
if (names.contains ('Value')) {
handleValue(characteristic.value);
}
});
handleValue(characteristic.value);
characteristic.startNotify(); But we should really add a helper method to automatically make a stream for this. |
See the BlueZ documentation for more information on the GATT API. Over time I would like to see bluez.dart improved so that you don't have to refer to that, but for now that might be the easiest way to work out how to use the API. |
ohh i see , Got it, thanks for info |
Hey , as title suggest , we dont really have true cross platform packages , there is one intresting package which currently supports
Windows , Mac , Android , Ios , it would be great if you can add support of linux to that package, quick_blue
The text was updated successfully, but these errors were encountered: