本文整理汇总了Java中org.usb4java.LibUsb.TRANSFER_TYPE_BULK属性的典型用法代码示例。如果您正苦于以下问题:Java LibUsb.TRANSFER_TYPE_BULK属性的具体用法?Java LibUsb.TRANSFER_TYPE_BULK怎么用?Java LibUsb.TRANSFER_TYPE_BULK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.usb4java.LibUsb
的用法示例。
在下文中一共展示了LibUsb.TRANSFER_TYPE_BULK属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startThread
public void startThread() {
if (!isOpen()) {
try {
open();
}
catch (final HardwareInterfaceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
CypressFX2.log.info("Starting AsyncStatusThread");
usbTransfer = new USBTransferThread(monitor.deviceHandle, CypressFX2.STATUS_ENDPOINT_ADDRESS,
LibUsb.TRANSFER_TYPE_BULK, new ProcessStatusMessages(), 2, 128);
usbTransfer.setName("AsyncStatusThread");
usbTransfer.start();
}
示例2: find_ep
static protected byte find_ep(Device device) {
byte ep_addr = 0;
ConfigDescriptor config = new ConfigDescriptor();
int rval = LibUsb.getActiveConfigDescriptor(device, config);
if (rval != 0) {
throw new LibUsbException("error LibUsb.getActiveConfigDescriptor", rval);
}
InterfaceDescriptor altsetting = null;
for (int i = 0; i < config.bNumInterfaces(); i++) {
Interface[] iface = config.iface();
altsetting = iface[i].altsetting()[0];
if (altsetting.bInterfaceNumber() == 0) {
break;
}
}
EndpointDescriptor ep;
for (int i = 0; i < altsetting.bNumEndpoints(); i++) {
ep = altsetting.endpoint()[i];
if ((ep.bmAttributes() & LibUsb.TRANSFER_TYPE_MASK) == LibUsb.TRANSFER_TYPE_BULK && ep.wMaxPacketSize() != 0) {
ep_addr = ep.bEndpointAddress();
break;
}
}
LibUsb.freeConfigDescriptor(config);
return ep_addr;
}
示例3: startThread
public void startThread() {
if (!isOpen()) {
try {
open();
}
catch (final HardwareInterfaceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
CypressFX3.log.info("Starting AEReader");
usbTransfer = new USBTransferThread(monitor.deviceHandle, CypressFX3.AE_MONITOR_ENDPOINT_ADDRESS, LibUsb.TRANSFER_TYPE_BULK,
new ProcessAEData(), getNumBuffers(), getFifoSize(), null, null, new Runnable() {
@Override
public void run() {
final SwingWorker<Void, Void> shutdownWorker = new SwingWorker<Void, Void>() {
@Override
public Void doInBackground() {
monitor.close();
return (null);
}
};
shutdownWorker.execute();
}
});
usbTransfer.setName("AEReaderThread");
usbTransfer.start();
getSupport().firePropertyChange("readerStarted", false, true);
}
示例4: setEnable
/**
* starts/stops the usbTransfer thread and notifies the readers.
* @param enable
*/
@Override
public void setEnable(boolean enable) {
super.setEnable(enable);
if (enable == true) {
if (!isOpen()) {
try {
open();
} catch (final HardwareInterfaceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
usbTransfer = new USBTransferThread(super.driver.retinahandle, ENDPOINT_IN, LibUsb.TRANSFER_TYPE_BULK,
new PaerAEReader.ProcessAEData(), getNumBuffers(), getFifoSize());
usbTransfer.setPriority(this.MONITOR_PRIORITY);
usbTransfer.setName("AEReaderThread");
usbTransfer.start();
super.getReaderSupport().firePropertyChange("readerStarted", false, true);
} else {
usbTransfer.interrupt();
boolean stopped = false;
while (!stopped) {
try {
usbTransfer.join();
} catch (InterruptedException ex) {
continue;
}
stopped = true;
}
support.firePropertyChange("readerStopped", false, true);
this.driver.aeReader = null;
}
}