Apparence-io / webUSB_plugin

A flutter webusb plugin
https://pub.dev/packages/usb_device
23 stars 13 forks source link

怎么向usb设备发送数据 #5

Open GalaxyCal opened 2 years ago

GalaxyCal commented 2 years ago

/// send data to usb
Future transferOut( dynamic device, endpointNumber, ByteBuffer data) { return _platform.transferOut(device, endpointNumber, data); }

我找到发送数据的方法,其中endpointNumber这个端口号参数,是怎么获取的呢,求解答

GalaxyCal commented 2 years ago

I found a way to send data, how to get the port number parameter endpointNumber, please answer

techttiru commented 2 years ago

device

@GalaxyCal - Hi, were you be able to send the data? I am trying to connect USB POS printer from flutter web. so i am not clear in this endpoint and TypedData. My data is in List format. now i want to know how to send this List data in the below method.

Future<UsbOutTransferResult> transferOut(int endpointNumber, TypedData data).

here what is endpointNumber and how to get the endpontNumber. Also, how to convert my List data to TypedData?

can you please sample code if possible? Appreciate your response..