quick_usb icon indicating copy to clipboard operation
quick_usb copied to clipboard

How to keep reading data constantly?

Open Zopenzop opened this issue 2 years ago • 5 comments

In my case, data is inputted erratically through the serial port to my android device, thus the bulkTransferIn function doesn't really suite my purpose. Plugins like usb_serial let you specify a function to be run whenever the android device receives any data through the serial device. Should I run the bulkTransferIn function on a loop or is there a better way to achieve my purpose using this plugin?

Zopenzop avatar May 01 '22 15:05 Zopenzop

I'm not sure about the API, could you post an example?

Sunbreak avatar May 05 '22 05:05 Sunbreak

I was looking for something like an event, I've tried the usb_serial package and it's port object has an event that triggers a function whenever it listens to data.

	port.inputStream.listen((Uint8List event) {
		print(event);
		port.close();
	});

Zopenzop avatar May 05 '22 13:05 Zopenzop

That would be a big feature request. I'm not sure I have enough time for cross-platform implementation.

PRs welcome

Sunbreak avatar May 06 '22 00:05 Sunbreak

Ah sure, just needed to know if there was an existing implementation for the same.

Zopenzop avatar May 06 '22 04:05 Zopenzop

I'd like to leave it open for future implementation

Sunbreak avatar May 06 '22 23:05 Sunbreak