本文整理汇总了Java中javax.usb.UsbControlIrp.setData方法的典型用法代码示例。如果您正苦于以下问题:Java UsbControlIrp.setData方法的具体用法?Java UsbControlIrp.setData怎么用?Java UsbControlIrp.setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.usb.UsbControlIrp
的用法示例。
在下文中一共展示了UsbControlIrp.setData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMessage
import javax.usb.UsbControlIrp; //导入方法依赖的package包/类
/**
* Sends a message to the missile launcher.
*
* @param device
* The USB device handle.
* @param message
* The message to send.
* @throws UsbException
* When sending the message failed.
*/
public static void sendMessage(UsbDevice device, byte[] message)
throws UsbException
{
UsbControlIrp irp = device.createUsbControlIrp(
(byte) (UsbConst.REQUESTTYPE_TYPE_CLASS |
UsbConst.REQUESTTYPE_RECIPIENT_INTERFACE), (byte) 0x09,
(short) 2, (short) 1);
irp.setData(message);
device.syncSubmit(irp);
}
示例2: inRequest
import javax.usb.UsbControlIrp; //导入方法依赖的package包/类
protected UsbControlIrp inRequest(byte request, int dataSize) {
final byte requestType = REQUESTTYPE_TYPE_VENDOR | REQUESTTYPE_DIRECTION_IN;
final UsbControlIrp result = device.createUsbControlIrp(requestType, request, (short)0, (short)0);
result.setData(new byte[dataSize]);
return result;
}
示例3: sendStateToDevice
import javax.usb.UsbControlIrp; //导入方法依赖的package包/类
/**
* Sends a control message to the device. The message that is sent is the
* message that is required to synchronize the device's state with the state
* of this instance.
*/
protected void sendStateToDevice() {
final UsbControlIrp controlRequest = controlRequest();
controlRequest.setData(currentState());
device.syncSubmit(controlRequest);
}
示例4: sendMessage
import javax.usb.UsbControlIrp; //导入方法依赖的package包/类
private static void sendMessage(UsbDevice device, byte[] message) throws UsbException {
UsbControlIrp irp = device.createUsbControlIrp((byte) 0x21, (byte) 0x09, (short) 0x0200, (short) 0x0000);
irp.setData(message);
device.syncSubmit(irp);
irp.waitUntilComplete(100);
}