org.jSyncManager.Transport
Class ModemTransport
- ActionListener, Serializable
public class ModemTransport
implements ActionListener
Modem Communications Transport.
This transport, based on the Sun Communications API provides additional
connection and configuration methods required for synchronizing through
a modem connection. It assumes a modem with a standard response set.
static String | DEFAULT_INIT_STRING- The default init string to use if none is specified by the user.
|
static int | DEFAULT_SPEED- The default serial speed to use if none is specified.
|
protected JComboBox | comSelectBox- A combo box to hold the communications port names.
|
protected boolean | connected- Serial connectivity flag.
|
protected DataInputStream | dis- The input data stream attached to the selected serial port.
|
protected DataOutputStream | dos- The output data stream attached to the selected serial port.
|
protected String | initString- The initialization string used to setup the modem.
|
protected JTextField | initStringField- A GUI field to display/edit/modify the modem init string.
|
protected boolean | modemConnected- Modem connectivity flag.
|
protected CommPortIdentifier | port- Hold a handle to the underlying CommPortIdentifier object for the
selected serial port.
|
protected String | portName- The platform-specific name of the serial port in use.
|
protected SerialPort | ser- The selected serial port object.
|
protected static int | serialSpeed- The serial speed to use for the serial port connected to the modem.
|
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.
|
void | disconnect()- This method is used to flag that the modem is disconnected.
|
protected void | finalize()- Finalizes this ModemTransport object by closing it's connection.
|
void | flush()- Flushes the input buffer of any remaining data.
|
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)- Changes the speed of the underlying transport mechanism.
|
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 |
DEFAULT_INIT_STRING
public static final String DEFAULT_INIT_STRING
The default init string to use if none is specified by the user.
DEFAULT_SPEED
public static final int DEFAULT_SPEED
The default serial speed to use if none is specified.
comSelectBox
protected JComboBox comSelectBox
A combo box to hold the communications port names.
connected
protected boolean connected
Serial connectivity flag. true if we have an active serial port
connection, false otherwise.
dis
protected DataInputStream dis
The input data stream attached to the selected serial port.
dos
protected DataOutputStream dos
The output data stream attached to the selected serial port.
initString
protected String initString
The initialization string used to setup the modem.
initStringField
protected JTextField initStringField
A GUI field to display/edit/modify the modem init string.
modemConnected
protected boolean modemConnected
Modem connectivity flag. true if we have an active modem
connection, false otherwise.
port
protected CommPortIdentifier port
Hold a handle to the underlying CommPortIdentifier object for the
selected serial port.
portName
protected String portName
The platform-specific name of the serial port in use.
ser
protected SerialPort ser
The selected serial port object.
serialSpeed
protected static int serialSpeed
The serial speed to use for the serial port connected to the modem.
speedSelectBox
protected JComboBox speedSelectBox
A combo box to hold the serial port speeds.
ModemTransport
public ModemTransport()
throws TransportExceptionCreates a new instance of the ModemTransport class.
actionPerformed
public void actionPerformed(ActionEvent e)
Method that is called whenever an action is performed.
e - the ActionEvent object for the event to be processed.
constructConfigPanel
protected JPanel constructConfigPanel()
Constructs this transports configuration panel.
- constructConfigPanel in interface SLPTransportInterface
- a javax.swing.JPanel containing the transports settings panel.
disconnect
public void disconnect()
This method is used to flag that the modem is disconnected.
NOTE: this method does not actually cause the modem to hang up.
It is currently assumed that the Palm will drop the connection, and
that the modem hardware will automatically hangup in response.
finalize
protected void finalize()
throws ThrowableFinalizes this ModemTransport object by closing it's connection.
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
readByte
public byte readByte()
throws TransportExceptionRead a single byte from the Java COMM API port.
- readByte in interface SLPTransportInterface
- the byte read from the data input stream attached to the serial port.
TransportException - this class won't throw any exceptions, but maintains the superclasses
exception signature.
setSpeed
protected void setSpeed(int speed)
throws TransportExceptionChanges the speed of the underlying transport mechanism.
This method is required by the parent class, however the implementation here is null.
- setSpeed in interface SerialTransportInterface
speed - - The speed to set the transport to.
toString
public String toString()
Returns settings information on this transport as a String.
- settings information on this transport as a String.