jSyncManager

org.jSyncManager.API.Protocol
Class USB

java.lang.Object
  |
  +--org.jSyncManager.API.Protocol.USB
All Implemented Interfaces:
CMPDLPTransferInterface

public class USB
extends java.lang.Object
implements CMPDLPTransferInterface

USB packet handler class. This class handles the sending and receiving of USB packets to and from the connected USB device.

Version:
$Revision: 1.5 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>, Last modified by: $Author: dingodave $.

Field Summary
protected  boolean connected
          The connection state.
protected  boolean debugMode
          A field to enable or disable debugging output.
static byte INITIAL_TRANSACTION_ID
          The initial transaction ID for packets.
protected  byte transactionID
          The transaction ID of this packet.
protected  USBTransportInterface transport
          The transport to use for data I/O.
 
Constructor Summary
USB(USBTransportInterface usbTransport)
          USB protocol handler constructor.
 
Method Summary
 void connect()
          Method to be called to initialize the connection.
 void disconnect()
          Disconnects the connection to the underlying communication subsystem.
 GenericPacket readPacket()
          Reads a packet from the underlying communication subsystem.
 void suspendConnection()
          Suspends access to the underlying communication subsystem.
 void transmitPacket(byte[] data, byte srcSocket, byte destSocket)
          Transmits a packet to the underlying communication subsystem.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_TRANSACTION_ID

public static final byte INITIAL_TRANSACTION_ID
The initial transaction ID for packets.

transactionID

protected byte transactionID
The transaction ID of this packet.

transport

protected USBTransportInterface transport
The transport to use for data I/O.

connected

protected boolean connected
The connection state. Set to true if we're connected to the transport, false otherwise.

debugMode

protected boolean debugMode
A field to enable or disable debugging output. Set to true if you want debugging output, otherwise sot to false (default).
Constructor Detail

USB

public USB(USBTransportInterface usbTransport)
USB protocol handler constructor.
Method Detail

connect

public void connect()
Method to be called to initialize the connection.
Specified by:
connect in interface CMPDLPTransferInterface

readPacket

public GenericPacket readPacket()
                         throws NotConnectedException
Reads a packet from the underlying communication subsystem.
Specified by:
readPacket in interface CMPDLPTransferInterface
Returns:
A GenericPacket object containing the read data.

transmitPacket

public void transmitPacket(byte[] data,
                           byte srcSocket,
                           byte destSocket)
                    throws NotConnectedException,
                           PADP_PacketTooBigException
Transmits a packet to the underlying communication subsystem.
Specified by:
transmitPacket in interface CMPDLPTransferInterface
Parameters:
data - the data to transmit.
srcSocket - the socket that was the source of this data (may be ignored).
destSocket - the socket that is the intended destination of this data (may be ignored).

disconnect

public void disconnect()
Disconnects the connection to the underlying communication subsystem.
Specified by:
disconnect in interface CMPDLPTransferInterface

suspendConnection

public void suspendConnection()
Suspends access to the underlying communication subsystem. This needs to close the existing transport, and then reopen it.
Specified by:
suspendConnection in interface CMPDLPTransferInterface

jSyncManager

Copyright (c) 1999 - 2003 Brad BARCLAY and others. All Rights Reserved.