connectionState property
Stream<BrilliantConnectionState>
get
connectionState
Implementation
Stream<BrilliantConnectionState> get connectionState {
// changed to only listen for connectionState data coming from the Frame device rather than all events from all devices as before
return device.connectionState
.where((event) =>
event == BluetoothConnectionState.connected ||
(event == BluetoothConnectionState.disconnected &&
device.disconnectReason != null &&
device.disconnectReason!.code != 23789258))
.asyncMap((event) async {
if (event == BluetoothConnectionState.connected) {
_log.info("Connection state stream: Connected");
return BrilliantConnectionState.connected;
}
else {
_log.info("Connection state stream: Disconnected");
return BrilliantConnectionState.disconnected;
}
});
}