当前位置: 首页>>代码示例>>Java>>正文


Java UsbConstants.USB_TYPE_VENDOR属性代码示例

本文整理汇总了Java中android.hardware.usb.UsbConstants.USB_TYPE_VENDOR属性的典型用法代码示例。如果您正苦于以下问题:Java UsbConstants.USB_TYPE_VENDOR属性的具体用法?Java UsbConstants.USB_TYPE_VENDOR怎么用?Java UsbConstants.USB_TYPE_VENDOR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.hardware.usb.UsbConstants的用法示例。


在下文中一共展示了UsbConstants.USB_TYPE_VENDOR属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: controlRequestTypeFromName

private static int controlRequestTypeFromName(String requestType) throws UsbError{
    requestType = requestType.toLowerCase();
    if ("standard".equals(requestType)) {
        return UsbConstants.USB_TYPE_STANDARD;  /* 0x00 */
    } else if ("class".equals(requestType)) {
        return UsbConstants.USB_TYPE_CLASS;     /* 0x20 */
    } else if ("vendor".equals(requestType)) {
        return UsbConstants.USB_TYPE_VENDOR;    /* 0x40 */
    } else if ("reserved".equals(requestType)) {
        return UsbConstants.USB_TYPE_RESERVED;  /* 0x60 */
    } else {
        throw new UsbError("Unknown transfer requestType: " + requestType);
    }
}
 
开发者ID:MobileChromeApps,项目名称:cordova-plugin-chrome-apps-usb,代码行数:14,代码来源:ChromeUsb.java

示例2: pl2303Init

private boolean pl2303Init() {
	byte buf[] = new byte[4];
	final int read = UsbConstants.USB_DIR_IN | UsbConstants.USB_TYPE_VENDOR;
	final int write = UsbConstants.USB_DIR_OUT | UsbConstants.USB_TYPE_VENDOR;
	final int tmout = PL2303_INIT_TIMEOUT_MS;

	if ((mUsbConnection.controlTransfer(read, 0x01, 0x8484, 0, buf, 1, tmout) < 0)
		|| (mUsbConnection.controlTransfer(write, 0x01, 0x0404, 0, null, 0, tmout) < 0)
		|| (mUsbConnection.controlTransfer(read, 0x01, 0x8484, 0, buf, 1, tmout) < 0)
		|| (mUsbConnection.controlTransfer(read, 0x01, 0x8383, 0, buf, 1, tmout) < 0)
		|| (mUsbConnection.controlTransfer(read, 0x01, 0x8484, 0, buf, 1, tmout) < 0)
		|| (mUsbConnection.controlTransfer(write, 0x01, 0x0404, 1, null, 0, tmout) < 0)
		|| (mUsbConnection.controlTransfer(read, 0x01, 0x8484, 0, buf, 1, tmout) < 0)
		|| (mUsbConnection.controlTransfer(read, 0x01, 0x8383, 0, buf, 1, tmout) < 0)
		|| (mUsbConnection.controlTransfer(write, 0x01, 0, 1, null, 0, tmout) < 0)
		|| (mUsbConnection.controlTransfer(write, 0x01, 1, 0, null, 0, tmout) < 0)
			) return false;
	if (isPl2303Hx) {
		if (mUsbConnection.controlTransfer(write, 0x01, 2, 0x44, null, 0, tmout) < 0) return false;
	}else {
		if (mUsbConnection.controlTransfer(write, 0x01, 2, 0x24, null, 0, tmout) < 0) return false;
	}

	if ((mUsbConnection.controlTransfer(write, 0x01, 8, 0, null, 0, tmout) < 0)
		|| (mUsbConnection.controlTransfer(write, 0x01, 9, 0, null, 0, tmout) < 0)
		) return false;

	return true;
}
 
开发者ID:illarionov,项目名称:RtkGps,代码行数:29,代码来源:UsbPl2303Controller.java

示例3: controlIn

private int controlIn(int request, int value, int index, byte[] buffer) {
	final int REQTYPE_HOST_TO_DEVICE = UsbConstants.USB_TYPE_VENDOR | UsbConstants.USB_DIR_IN;
	return mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, request,
			value, index, buffer, buffer.length, USB_TIMEOUT_MILLIS);
}
 
开发者ID:OpilkiInside,项目名称:bimdroid,代码行数:5,代码来源:Ch34xSerialDriver.java

示例4: controlIn

private int controlIn(int request, int value, int index, byte[] buffer) {
    final int REQTYPE_HOST_TO_DEVICE = UsbConstants.USB_TYPE_VENDOR | UsbConstants.USB_DIR_IN;
    return mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, request,
            value, index, buffer, buffer.length, USB_TIMEOUT_MILLIS);
}
 
开发者ID:msillano,项目名称:USBphpTunnel,代码行数:5,代码来源:Ch34xSerialDriver.java

示例5: controlIn

private int controlIn(int request, int value, int index, byte[] buffer) {
    final int REQTYPE_HOST_TO_DEVICE = UsbConstants.USB_TYPE_VENDOR | UsbConstants.USB_DIR_IN;
    return mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, request, value, index, buffer, buffer.length, USB_TIMEOUT_MILLIS);
}
 
开发者ID:HelloHuDi,项目名称:usb-with-serial-port,代码行数:4,代码来源:Ch34xSerialDriver.java


注:本文中的android.hardware.usb.UsbConstants.USB_TYPE_VENDOR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。