UsbSerialDevice class abstract

Base class for USB serial devices.

This abstract class defines the common API for communicating with USB serial devices via libusb. Subclasses implement device-specific behaviors (e.g., Cp210XSerialDevice or CdcSerialDevice).

Implemented types

Constructors

UsbSerialDevice(UsbDevice device, int interfaceId)

Properties

deviceHandle ↔ Pointer<libusb_device_handle>
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
inEndpoint ↔ UsbEndpoint?
getter/setter pair
outEndpoint ↔ UsbEndpoint?
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
usbDevice ↔ UsbDevice
latefinal
usbInterfaceId ↔ int
getter/setter pair

Methods

close() → Future<void>
Closes the device and releases resources.
override
getConfiguration(int index) → Future<UsbConfiguration>
Retrieves the USB configuration at the given index.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open() → Future<bool>
Opens the device and claims its interface(s).
override
read(int bytesToRead, int timeout) → Future<Uint8List>
Reads data from the device using bulk transfer.
override
setBaudRate(int baudRate) → Future<void>
Configures the baud rate for serial communication.
override
setBreak(bool state) → Future<void>
Sets or clears the break condition on the line.
override
setDataBits(int dataBits) → Future<void>
Configures the number of data bits per character.
override
setDtr(bool state) → Future<void>
Asserts or deasserts the DTR (Data Terminal Ready) line.
override
setFlowControl(int flowControl) → Future<void>
Configures hardware/software flow control.
override
setParity(int parity) → Future<void>
Configures the parity bit (none, even, odd, etc.).
override
setRts(bool state) → Future<void>
Asserts or deasserts the RTS (Request To Send) line.
override
setStopBits(int stopBits) → Future<void>
Configures the number of stop bits.
override
toString() → String
A string representation of this object.
inherited
write(Uint8List data, int timeout) → Future<int>
Writes data to the device using bulk transfer.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

autoDetachKernelDriverEnabled ↔ bool
getter/setter pair
usbTimeout → int
final

Static Methods

createDevice(UsbDevice device, {int interfaceId = -1, String type = ''}) → UsbSerialDevice?
Factory method that creates a UsbSerialDevice implementation.
exit() → void
init() → void
isSupported(UsbDevice device) → bool
Checks whether the given UsbDevice is supported.
listDevices() → Future<List<UsbDevice>>
Lists all USB devices currently connected to the system.
setAutoDetachKernelDriver(bool enabled) → void
Sets whether the kernel driver should be automatically detached when the device is opened, on Linux.

Constants

cdc → const String
ch34x → const String
cp210x → const String
pl2303 → const String