I have a microcontroller that sends a string 'Device Boot' on restart. I am using a regex to parse it, but soon as it does find it, i wish to perform a write - to send a $ signal which makes the microcontroller send logs.
So i used the above code right after it found the boot line, like below
.....
_subscription = _transaction!.stream.listen((String line) {
//Set in progress flag for first time read.
if (line.contains('Device Boot')) {
// writing to device
await _port.write(Uint8List.fromList('\$'.codeunits));
setState(() {
Wakelock.enable();
});
.....
But this doesn't work for me, so i am really confused if this is where i should be performing the write, this is first time i am working with usb package. Any help is appreciated.
I have a microcontroller that sends a string '
Device Boot
' on restart. I am using a regex to parse it, but soon as it does find it, i wish to perform a write - to send a$
signal which makes the microcontroller send logs.I am using USB_SERIAL for Flutter.
This is the current setup:
And i wish to perform a write soon as it finds the first line
Device Boot
.The
USB_SERIAL
's document suggests to useSo i used the above code right after it found the boot line, like below
But this doesn't work for me, so i am really confused if this is where i should be performing the write, this is first time i am working with usb package. Any help is appreciated.