UsbPlatform class abstract
Abstract seam between high-level USB classes (UsbConnection, UsbDiscovery) and the concrete MethodChannel + FFI backend.
Production code wires the composite at UsbConnection._defaultPlatform.
Tests swap in FakeUsbPlatform via UsbConnection.withPlatform.
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearHalt(
{required int handleId, required int endpoint}) → Future< void> - libusb_clear_halt on the given endpoint. Used after LIBUSB_ERROR_PIPE to recover a stalled endpoint.
-
closeAfterFfi(
String path) → Future< void> -
closeHandle(
{required int handleId}) → Future< void> - Releases the claimed interface and closes the libusb device handle. Also terminates the worker isolate that owned the handle.
-
enumerate(
UsbEnumerateFilter filter) → Future< List< UsbDeviceRecord> > -
hasPermission(
String path) → Future< bool> -
isSupported(
) → Future< bool> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openForFfi(
String path) → Future< UsbOpenResult> -
readBytes(
{required int handleId, required int maxBytes, required int timeoutMs}) → Future< Uint8List> -
Reads up to
maxBytesfrom the bulk-IN endpoint. Returns the actual bytes read (may be 0). Throws UsbTransferTimeoutException on timeout. -
readStringDescriptor(
{required int handleId, required int index}) → Future< String?> -
Reads an ASCII string descriptor at
indexvia libusb_get_string_descriptor_ascii. Returns null on read failure. -
requestPermission(
String path) → Future< bool> -
resetDevice(
{required int handleId}) → Future< void> - libusb_reset_device. Caller must treat the handle as invalid after this — typically followed by close + re-open.
-
toString(
) → String -
A string representation of this object.
inherited
-
writeBytes(
{required int handleId, required Uint8List data, required int timeoutMs}) → Future< void> -
Writes
datavia libusb_bulk_transfer on the bulk-OUT endpoint associated with the handle. The handle is the UsbOpenResult.platformHandle returned by openForFfi.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited