Class USBConnection

  extended by lejos.nxt.comm.NXTConnection
      extended by lejos.nxt.comm.USBConnection
All Implemented Interfaces:
Connection, InputConnection, OutputConnection, StreamConnection

public class USBConnection
extends NXTConnection

Provides a USB connection Supports both packetized, raw and stream based communication. Blocking and non-blocking I/O. Notes When using the low level read/write functions no buffering is provided. This means that for read operations te entire packet must be read or data will be lost. A USB packet has a max size of 64 bytes. The Stream based functions take care of this automatically. When operating in RAW mode low level USB packets may be read and written. however this mode has no concept of EOF or start of a connection. When using PACKET mode each packet has a single byte header added to it. This is used to provide a simple start of connection/EOF model.

Field Summary
Fields inherited from class lejos.nxt.comm.NXTConnection
Constructor Summary
USBConnection(int mode)
Method Summary
 void setIOMode(int mode)
          Set the IO mode to be used for this connection.
Methods inherited from class lejos.nxt.comm.NXTConnection
available, available, close, getAddress, openDataInputStream, openDataOutputStream, openInputStream, openOutputStream, read, read, readPacket, sendPacket, write, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public USBConnection(int mode)
Method Detail


public void setIOMode(int mode)
Set the IO mode to be used for this connection. USB has a 1 byte header, and does not use packet mode for LCP data.

setIOMode in class NXTConnection
mode -
See Also:
NXTConnection.RAW, NXTConnection.LCP, NXTConnection.PACKET