org.jSyncManager.Transport
Class CommAPITransport
- ActionListener, Serializable
public class CommAPITransport
implements ActionListener
Sun Communications API Transport. This class provides a bridge between Sun Microsystem's Java
Communications API and the SLP Protocol class.
protected JComboBox | comSelectBox- A combo box to hold the communications port names.
|
protected DataInputStream | dis- The port data input stream.
|
protected DataOutputStream | dos- The port data output stream.
|
protected boolean | noflush- A flag to denote whether or not we should flush the transport during speed change.
|
protected CommPortIdentifier | port- A handle to hold the communications port identifier object.
|
protected String | portName- The name of the port selected for I/O.
|
protected SerialPort | ser- A handle to hold the serial port object.
|
protected JComboBox | speedSelectBox- A combo box to hold the serial port speeds.
|
void | actionPerformed(ActionEvent e)- Method that is called whenever an action is performed.
|
void | close()- Closes the Java COMM API port.
|
protected JPanel | constructConfigPanel()- Constructs this transports configuration panel.
|
protected void | finalize()- This method overrides Object.finalize() in order to ensure that the underlying
Java Comm API connection to the serial handler is properly shut down.
|
void | flush()- Flushes the input buffer of any remaining data.
|
protected static Vector | getPortNames()- Returns an array of Strings representing the names of available ports.
|
int | getPreferredSyncSpeed()- A method to retreive the users preferred sync speed.
|
String | getResourceBundleName()- Returns the fully-qualified classname for the resources package to use for this transport.
|
String | getTransportDescription()- Returns the description for this Transport Interface.
|
String | getTransportExceptionText(TransportException ex)- Retrieves error information for a given TransportException.
|
String | getTransportName()- Returns the name of this Transport Interface.
|
void | initialize()- Initialize the port.
|
void | initialize(Properties properties, int id)- Initialize the port.
|
void | open()- Opens a read/write connection to the implemented transport.
|
byte | readByte()- Read a single byte from the Java COMM API port.
|
protected void | setSpeed(int speed)- Sets the speed of the underlying Java COMM API port.
|
String | toString()- Returns settings information on this transport as a String.
|
void | writeBytes(data[] )- Writes an array of bytes to the Java COMM API port.
|
close, constructConfigPanel, flush, getConfigPanel, getResourceBundle, getResourceBundleName, getTransportDescription, getTransportExceptionText, getTransportName, initialize, initialize, isConnected, loadResourceBundle, open, readByte, setConnected, writeBytes |
comSelectBox
protected JComboBox comSelectBox
A combo box to hold the communications port names.
dis
protected DataInputStream dis
The port data input stream.
dos
protected DataOutputStream dos
The port data output stream.
noflush
protected boolean noflush
A flag to denote whether or not we should flush the transport during speed change.
port
protected CommPortIdentifier port
A handle to hold the communications port identifier object.
portName
protected String portName
The name of the port selected for I/O.
ser
protected SerialPort ser
A handle to hold the serial port object.
speedSelectBox
protected JComboBox speedSelectBox
A combo box to hold the serial port speeds.
CommAPITransport
public CommAPITransport()
throws TransportExceptionCreate a new instance of the Comm API Transport. This constructor creates a new instance of the
Comm API Transport.
TransportException - thrown if the Java Comm API cannot be found,
or if the Java Comm API can't find any serial ports on the users system.
actionPerformed
public void actionPerformed(ActionEvent e)
Method that is called whenever an action is performed.
e - the action that was performed.
constructConfigPanel
protected JPanel constructConfigPanel()
Constructs this transports configuration panel.
- constructConfigPanel in interface SLPTransportInterface
- a javax.swing.JPanel containing the transports settings panel.
finalize
protected void finalize()
throws ThrowableThis method overrides Object.finalize() in order to ensure that the underlying
Java Comm API connection to the serial handler is properly shut down.
getPortNames
protected static Vector getPortNames()
throws NoClassDefFoundErrorReturns an array of Strings representing the names of available ports. This method will return to the
caller an array of strings representing the serial ports available on this system.
- an array of String representing the names of the available ports.
getPreferredSyncSpeed
public int getPreferredSyncSpeed()
A method to retreive the users preferred sync speed.
As the transport takes care of storing user selections on its own, and as the
CMP layer negotiates the speed for the transfer after connecting, it needs a way to
determine at what speed the user prefers to sync at.
- getPreferredSyncSpeed in interface SerialTransportInterface
- the maximum serial rate the user has selected to sync at.
getResourceBundleName
public String getResourceBundleName()
Returns the fully-qualified classname for the resources package to use for this transport.
- getResourceBundleName in interface SLPTransportInterface
- a String object containing the fully qualified classname for the ResoureBundle
class to use for this transport.
getTransportDescription
public String getTransportDescription()
Returns the description for this Transport Interface.
This method will return a string containing the description for
this transport interface.
- getTransportDescription in interface SLPTransportInterface
- the description for this transport interface.
getTransportName
public String getTransportName()
Returns the name of this Transport Interface. This method will return a string containing the name of
this transport interface. This is used when searching for and selecting from one of many available
transport interfaces that are installed on the system.
- getTransportName in interface SLPTransportInterface
- the name of this transport interface.
initialize
public void initialize(Properties properties,
int id)
throws TransportExceptionInitialize the port.
- initialize in interface SLPTransportInterface
properties - a reference to the properties file containing configuration information.id - the transport ID number to load data for.
open
public void open()
throws TransportExceptionOpens a read/write connection to the implemented transport. This method should open the transport
device being implemented using default parameters.
- open in interface SLPTransportInterface
toString
public String toString()
Returns settings information on this transport as a String.
- settings information on this transport as a String.