Enhance Bluetooth scanning and notification handling for web platform

chore/offband-rebrand
just_stuff_tm 7 months ago committed by just-stuff-tm
parent c23a1da430
commit 5f4333398e

@ -738,7 +738,7 @@ class MeshCoreConnector extends ChangeNotifier {
});
await FlutterBluePlus.startScan(
withKeywords: ["MeshCore-", "Whisper-"],
withKeywords: ["MeshCore-", "Whisper-", "Wismesh-", "WisCore-"],
webOptionalServices: [Guid(MeshCoreUuids.service)],
timeout: timeout,
androidScanMode: AndroidScanMode.lowLatency,
@ -836,7 +836,18 @@ class MeshCoreConnector extends ChangeNotifier {
throw Exception("MeshCore characteristics not found");
}
// Retry setNotifyValue with increasing delays
if (PlatformInfo.isWeb) {
debugPrint('Starting setNotifyValue(true)');
debugPrint('Web: Calling setNotifyValue(true) without awaiting');
unawaited(() async {
try {
await _txCharacteristic!.setNotifyValue(true);
} catch (error) {
debugPrint('Web setNotifyValue error (ignoring): $error');
}
}());
debugPrint('setNotifyValue(true) configuration completed');
} else {
bool notifySet = false;
for (int attempt = 0; attempt < 3 && !notifySet; attempt++) {
try {
@ -850,6 +861,7 @@ class MeshCoreConnector extends ChangeNotifier {
if (attempt == 2) rethrow;
}
}
}
_notifySubscription = _txCharacteristic!.onValueReceived.listen(
_handleFrame,
);

Loading…
Cancel
Save

Powered by TurnKey Linux.