open method

Future<OpenUSBDevice> open({
  1. int maxBufferLength = 256,
})

Implementation

Future<OpenUSBDevice> open({int maxBufferLength = 256}) async {
  var responsePort = ReceivePort();
  Isolate.spawn(
      usbIsolate,
      USBIsolateInit(
          responsePort.sendPort, vendorId, productId, maxBufferLength));
  var commandPort = await responsePort.first;
  if (commandPort is SendPort) {
    return OpenUSBDevice(commandPort, this);
  } else {
    var resp = commandPort as USBIsolateResponse;
    throw Exception("Error closing device: ${resp.errorMsg}");
  }
}