Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jempeg.empeg.protocol
Class USBConnection  view USBConnection download USBConnection.java

java.lang.Object
  extended byorg.jempeg.empeg.protocol.USBConnection
All Implemented Interfaces:
ConnectionIfc

public class USBConnection
extends java.lang.Object
implements ConnectionIfc

USBConnection is an implementation of ConnectionIfc that can communicate with an Empeg over a USB connection.

Version:
$Revision: 1.10 $

Field Summary
private  UsbDevice myDevice
           
private  EmpegInputStream myInputStream
           
private  EmpegOutputStream myOutputStream
           
private  org.jempeg.empeg.core.DynamicConfigFile myPlayerConfiguration
           
 
Constructor Summary
USBConnection(UsbDevice _device)
           
 
Method Summary
 void close()
          Closes the communication channel to the Empeg
 void flushReceiveBuffer()
          Flushes the receive buffer (for use after things like error conditions when lingering bytes may be hanging at the end of the stream.
 UsbDevice getDevice()
           
 EmpegInputStream getInputStream()
          Returns an input stream to read data from the Empeg
 EmpegOutputStream getOutputStream()
          Returns an output stream to write data to the Empeg
 int getPacketSize()
          Returns the maximum packet size of the connection.
 org.jempeg.empeg.core.DynamicConfigFile getPlayerConfiguration()
          Returns the configuration that was obtained during discovery.
 boolean isOpen()
          Returns whether or not this connection is open.
 void open()
          Opens the communication channel to the Empeg
 void pause()
          Pauses the communication channel to the Empeg.
 void setDevice(UsbDevice _device)
           
 void setPlayerConfiguration(org.jempeg.empeg.core.DynamicConfigFile _playerConfiguration)
          Sets the configuration that was obtained during discovery.
 void setTimeout(long _millis)
          Sets the current timeout on the connection.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 void unpause()
          Unpauses the communication channel to the Empeg.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myDevice

private UsbDevice myDevice

myInputStream

private EmpegInputStream myInputStream

myOutputStream

private EmpegOutputStream myOutputStream

myPlayerConfiguration

private org.jempeg.empeg.core.DynamicConfigFile myPlayerConfiguration
Constructor Detail

USBConnection

public USBConnection(UsbDevice _device)
Method Detail

setDevice

public void setDevice(UsbDevice _device)
               throws java.io.IOException,
                      UsbException

getPlayerConfiguration

public org.jempeg.empeg.core.DynamicConfigFile getPlayerConfiguration()
Description copied from interface: ConnectionIfc
Returns the configuration that was obtained during discovery.

Specified by:
getPlayerConfiguration in interface ConnectionIfc

setPlayerConfiguration

public void setPlayerConfiguration(org.jempeg.empeg.core.DynamicConfigFile _playerConfiguration)
Description copied from interface: ConnectionIfc
Sets the configuration that was obtained during discovery.

Specified by:
setPlayerConfiguration in interface ConnectionIfc

getDevice

public UsbDevice getDevice()

getPacketSize

public int getPacketSize()
Description copied from interface: ConnectionIfc
Returns the maximum packet size of the connection.

Specified by:
getPacketSize in interface ConnectionIfc

getInputStream

public EmpegInputStream getInputStream()
Description copied from interface: ConnectionIfc
Returns an input stream to read data from the Empeg

Specified by:
getInputStream in interface ConnectionIfc

getOutputStream

public EmpegOutputStream getOutputStream()
Description copied from interface: ConnectionIfc
Returns an output stream to write data to the Empeg

Specified by:
getOutputStream in interface ConnectionIfc

open

public void open()
          throws java.io.IOException
Description copied from interface: ConnectionIfc
Opens the communication channel to the Empeg

Specified by:
open in interface ConnectionIfc

close

public void close()
           throws java.io.IOException
Description copied from interface: ConnectionIfc
Closes the communication channel to the Empeg

Specified by:
close in interface ConnectionIfc

pause

public void pause()
           throws java.io.IOException
Description copied from interface: ConnectionIfc
Pauses the communication channel to the Empeg. You got me as to why this exists -- this came from the original port. All implementations just proxy close.

Specified by:
pause in interface ConnectionIfc

unpause

public void unpause()
             throws java.io.IOException
Description copied from interface: ConnectionIfc
Unpauses the communication channel to the Empeg. You got me as to why this exists -- this came from the original port. All implementations just proxy open.

Specified by:
unpause in interface ConnectionIfc

flushReceiveBuffer

public void flushReceiveBuffer()
                        throws java.io.IOException
Description copied from interface: ConnectionIfc
Flushes the receive buffer (for use after things like error conditions when lingering bytes may be hanging at the end of the stream.

Specified by:
flushReceiveBuffer in interface ConnectionIfc

setTimeout

public void setTimeout(long _millis)
                throws java.io.IOException
Description copied from interface: ConnectionIfc
Sets the current timeout on the connection.

Specified by:
setTimeout in interface ConnectionIfc

isOpen

public boolean isOpen()
Description copied from interface: ConnectionIfc
Returns whether or not this connection is open.

Specified by:
isOpen in interface ConnectionIfc

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).