-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi everybody.
I don't know if this is a bug, but I would like to know why when I connect my device (the device detect the connectio as per the application) when I try
characteristic.write(command);
or
await characteristic.setNotifyValue(true);
I get this error: ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: FlutterBluePlusException | writeCharacteristic | fbp-code: 6 | device is not connected.
Could someone help me?
Thank you
Flutter Windows
Channel Stable 3.32.2
flutter_blue_plus_windows
`Future onConnectPressed(BluetoothDevice dev) async {
try {
blueDevice = dev;
await blueDevice.connect(); //connect
if (GetPlatform.isWindows) {
await blueDevice.connectionState
.where((s) => s == BluetoothConnectionState.connected)
.first;
}
services = await blueDevice.discoverServices(); //discover services
await Future.delayed(const Duration(milliseconds: 500));
subscribe(); //subscribe to characteristic
connectionStateSubscription =
blueDevice.connectionState.listen((state) async {
connectionState = state;
if (connectionState == BluetoothConnectionState.disconnected) {
if (downloadChain == DownloadState.start ||
downloadChain == DownloadState.startAll) {
hideOverlay();
showBluetoothErrorDialog(
'Connection timeout\nAlphaDBSpat disconnected'.tr);
}
}
update();
});
} catch (e) {
if (e is FlutterBluePlusException &&
e.code == FbpErrorCode.connectionCanceled.index) {
// ignore connections canceled by the user
} else {
debugPrint(e.toString());
}
}
}`
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working