Android Open Source - USBIPServerForAndroid Usb Ip Submit Urb Reply






From Project

Back to project page USBIPServerForAndroid.

License

The source code is released under:

GNU General Public License

If you think the Android project USBIPServerForAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.cgutman.usbip.server.protocol.dev;
// w  ww.  j av  a 2 s  . c  o m
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class UsbIpSubmitUrbReply extends UsbIpDevicePacket {
  public int status;
  public int actualLength;
  public int startFrame;
  public int numberOfPackets;
  public int errorCount;
  
  public byte[] inData;
  
  public UsbIpSubmitUrbReply(int seqNum, int devId, int dir, int ep) {
    super(UsbIpDevicePacket.USBIP_RET_SUBMIT, seqNum, devId, dir, ep);
  }

  protected byte[] serializeInternal() {
    int inDataLen = inData == null ? 0 : actualLength;
    ByteBuffer bb = ByteBuffer.allocate((UsbIpDevicePacket.USBIP_HEADER_SIZE - 20) +
        inDataLen).order(ByteOrder.BIG_ENDIAN);
    
    bb.putInt(status);
    bb.putInt(actualLength);
    bb.putInt(startFrame);
    bb.putInt(numberOfPackets);
    bb.putInt(errorCount);
    
    bb.position(UsbIpDevicePacket.USBIP_HEADER_SIZE - 20);
    
    if (inDataLen != 0) {
      bb.put(inData, 0, inDataLen);
    }
    
    return bb.array();
  }
  
  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append(super.toString());
    sb.append(String.format("Status: 0x%x\n", status));
    sb.append(String.format("Actual length: %d\n", actualLength));
    sb.append(String.format("Start frame: %d\n", startFrame));
    sb.append(String.format("Number Of Packets: %d\n", numberOfPackets));
    sb.append(String.format("Error Count: %d\n", errorCount));
    return sb.toString();
  }
}




Java Source Code List

org.cgutman.usbip.config.UsbIpConfig.java
org.cgutman.usbip.errno.Errno.java
org.cgutman.usbip.server.UsbDeviceInfo.java
org.cgutman.usbip.server.UsbIpServer.java
org.cgutman.usbip.server.UsbRequestHandler.java
org.cgutman.usbip.server.protocol.ProtoDefs.java
org.cgutman.usbip.server.protocol.UsbIpDevice.java
org.cgutman.usbip.server.protocol.UsbIpInterface.java
org.cgutman.usbip.server.protocol.cli.CommonPacket.java
org.cgutman.usbip.server.protocol.cli.DevListReply.java
org.cgutman.usbip.server.protocol.cli.DevListRequest.java
org.cgutman.usbip.server.protocol.cli.ImportDeviceReply.java
org.cgutman.usbip.server.protocol.cli.ImportDeviceRequest.java
org.cgutman.usbip.server.protocol.dev.UsbIpDevicePacket.java
org.cgutman.usbip.server.protocol.dev.UsbIpSubmitUrbReply.java
org.cgutman.usbip.server.protocol.dev.UsbIpSubmitUrb.java
org.cgutman.usbip.server.protocol.dev.UsbIpUnlinkUrbReply.java
org.cgutman.usbip.server.protocol.dev.UsbIpUnlinkUrb.java
org.cgutman.usbip.service.UsbIpService.java
org.cgutman.usbip.usb.UsbControlHelper.java
org.cgutman.usbip.usb.UsbDeviceDescriptor.java
org.cgutman.usbip.usb.XferUtils.java
org.cgutman.usbip.utils.StreamUtils.java