edu.uiuc.cs.seclab.modem.gui
Class SerialPortSelector

java.lang.Object
  extended by java.util.Observable
      extended by edu.uiuc.cs.seclab.modem.gui.SerialPortSelector
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, javax.swing.event.ListSelectionListener

public class SerialPortSelector
extends java.util.Observable
implements javax.swing.event.ListSelectionListener, java.awt.event.ActionListener

Select serial port parameters. For the USB-connected Maxstream module, you must have first loaded the "ftdi-sio" module in Linux, so that the USB-to-serial converter appears as /dev/ttyUSBx.


Nested Class Summary
 class SerialPortSelector.ComPortEntry
          List entry for each COM port
 class SerialPortSelector.LabeledVal<T>
           
 
Field Summary
protected  javax.swing.JComboBox baudLst
           
protected  SerialPortSelector.ComPortEntry curEnt
           
protected  javax.swing.JComboBox dataBitsLst
           
static int DFL_BAUD
           
static int DFL_DATA_BITS
           
static int DFL_FLOW_CTRL
           
static int DFL_PARITY
           
static int DFL_STOP_BITS
           
protected  javax.swing.JComboBox flowCtlLst
           
protected  javax.swing.JPanel mainPnl
           
protected  javax.swing.JComboBox parityLst
           
protected  gnu.io.SerialPort port
           
protected  javax.swing.JList portLst
           
protected  SerialPortPanel portPnl
           
protected  javax.swing.JCheckBox series2Box
           
protected  javax.swing.JComboBox stopBitsLst
           
 
Constructor Summary
SerialPortSelector()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void applyConfig()
           
 void closePort()
           
protected  void constructBaudLst()
           
protected  void constructDataBitsLst()
           
protected  void constructFlowCtlLst()
           
protected  void constructParityLst()
           
protected  void constructPortLst()
           
protected  void constructStopBitsLst()
           
protected  void deselConfig()
           
 javax.swing.JPanel getComponent()
           
 gnu.io.SerialPort getPort()
           
 boolean isSeries2()
           
protected  void setConfigEnabled(boolean enabled)
           
 void setDefaultBaudRate(int def)
           
 void setDefaultFlowControl(int mode)
           
 void setDefaultStopBits(int def)
           
protected  void updateConfig()
           
 void valueChanged(javax.swing.event.ListSelectionEvent e)
          Port selected
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baudLst

protected javax.swing.JComboBox baudLst

curEnt

protected SerialPortSelector.ComPortEntry curEnt

dataBitsLst

protected javax.swing.JComboBox dataBitsLst

DFL_BAUD

public static final int DFL_BAUD
See Also:
Constant Field Values

DFL_DATA_BITS

public static final int DFL_DATA_BITS
See Also:
Constant Field Values

DFL_FLOW_CTRL

public static final int DFL_FLOW_CTRL
See Also:
Constant Field Values

DFL_PARITY

public static final int DFL_PARITY
See Also:
Constant Field Values

DFL_STOP_BITS

public static final int DFL_STOP_BITS
See Also:
Constant Field Values

flowCtlLst

protected javax.swing.JComboBox flowCtlLst

mainPnl

protected javax.swing.JPanel mainPnl

parityLst

protected javax.swing.JComboBox parityLst

port

protected gnu.io.SerialPort port

portLst

protected javax.swing.JList portLst

portPnl

protected SerialPortPanel portPnl

series2Box

protected javax.swing.JCheckBox series2Box

stopBitsLst

protected javax.swing.JComboBox stopBitsLst
Constructor Detail

SerialPortSelector

public SerialPortSelector()
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

applyConfig

public void applyConfig()
                 throws gnu.io.UnsupportedCommOperationException
Throws:
gnu.io.UnsupportedCommOperationException

closePort

public void closePort()

constructBaudLst

protected void constructBaudLst()

constructDataBitsLst

protected void constructDataBitsLst()

constructFlowCtlLst

protected void constructFlowCtlLst()

constructParityLst

protected void constructParityLst()

constructPortLst

protected void constructPortLst()

constructStopBitsLst

protected void constructStopBitsLst()

deselConfig

protected void deselConfig()

getComponent

public javax.swing.JPanel getComponent()

getPort

public gnu.io.SerialPort getPort()

isSeries2

public boolean isSeries2()

setConfigEnabled

protected void setConfigEnabled(boolean enabled)

setDefaultBaudRate

public void setDefaultBaudRate(int def)

setDefaultFlowControl

public void setDefaultFlowControl(int mode)

setDefaultStopBits

public void setDefaultStopBits(int def)

updateConfig

protected void updateConfig()

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent e)
Port selected

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener