connect method
Establishes a connection to the Bluetooth Device.
timeout
if timeout occurs, cancel the connection request and throw exception
mtu
Android only. Request a larger mtu right after connection, if set.
autoConnect
reconnect whenever the device is found
- if true, this function always returns immediately.
- you must listen to connectionState
to know when connection occurs.
- auto connect is turned off by calling disconnect
- auto connect results in a slower connection process compared to a direct connection
because it relies on the internal scheduling of background scans.
Implementation
Future<void> connect({
Duration? timeout =
const Duration(seconds: 35), // TODO: implementation missing
bool autoConnect = false, // TODO: implementation missing
int? mtu = 512, // TODO: implementation missing
}) async {
try {
await WinBle.connect(_address);
} catch (e) {
print(e);
} finally {
FlutterBluePlusWindows._deviceSet.add(this);
// FlutterBluePlusWindows._removed.remove(this);
}
}