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


Java UsbRequest.setClientData方法代码示例

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


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

示例1: write

import android.hardware.usb.UsbRequest; //导入方法依赖的package包/类
public boolean write(AdbDevice device) {
    synchronized (device) {
        UsbRequest request = device.getOutRequest();
        request.setClientData(this);
        if (request.queue(mMessageBuffer, 24)) {
            int length = getDataLength();
            if (length > 0) {
                request = device.getOutRequest();
                request.setClientData(this);
                if (request.queue(mDataBuffer, length)) {
                    return true;
                } else {
                    device.releaseOutRequest(request);
                    return false;
                }
            }
            return true;
        } else {
            device.releaseOutRequest(request);
            return false;
        }
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:24,代码来源:AdbMessage.java

示例2: run

import android.hardware.usb.UsbRequest; //导入方法依赖的package包/类
public void run() {
    // start out with a command read
    AdbMessage currentCommand = new AdbMessage();
    AdbMessage currentData = null;
    // FIXME error checking
    currentCommand.readCommand(getInRequest());

    while (true) {
        synchronized (this) {
            if (mStop) {
                return;
            }
        }
        UsbRequest request = mDeviceConnection.requestWait();
        if (request == null) {
            break;
        }

        AdbMessage message = (AdbMessage)request.getClientData();
        request.setClientData(null);
        AdbMessage messageToDispatch = null;

        if (message == currentCommand) {
            int dataLength = message.getDataLength();
            // read data if length > 0
            if (dataLength > 0) {
                message.readData(getInRequest(), dataLength);
                currentData = message;
            } else {
                messageToDispatch = message;
            }
            currentCommand = null;
        } else if (message == currentData) {
            messageToDispatch = message;
            currentData = null;
        }

        if (messageToDispatch != null) {
            // queue another read first
            currentCommand = new AdbMessage();
            currentCommand.readCommand(getInRequest());

            // then dispatch the current message
            dispatchMessage(messageToDispatch);
        }

        // put request back into the appropriate pool
        if (request.getEndpoint() == mEndpointOut) {
            releaseOutRequest(request);
        } else {
            synchronized (mInRequestPool) {
                mInRequestPool.add(request);
            }
        }
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:57,代码来源:AdbDevice.java

示例3: readCommand

import android.hardware.usb.UsbRequest; //导入方法依赖的package包/类
public boolean readCommand(UsbRequest request) {
    request.setClientData(this);
    return request.queue(mMessageBuffer, 24);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:5,代码来源:AdbMessage.java

示例4: readData

import android.hardware.usb.UsbRequest; //导入方法依赖的package包/类
public boolean readData(UsbRequest request, int length) {
    request.setClientData(this);
    return request.queue(mDataBuffer, length);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:5,代码来源:AdbMessage.java


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