com.jpeterson.x10
Class SerialGateway

java.lang.Object
  |
  +--com.jpeterson.x10.GatewayImpl
        |
        +--com.jpeterson.x10.SerialGateway
Direct Known Subclasses:
CM11A, CM17A

public abstract class SerialGateway
extends GatewayImpl

This class provides a base for gateway modules that are based on the serial port. This base class provides methods to set and get the serial port parameters.


Field Summary
protected  int baudRate
           
protected  int dataBits
           
protected  int parity
           
protected  java.lang.String portName
           
protected  int stopBits
           
 
Fields inherited from class com.jpeterson.x10.GatewayImpl
gatewayListeners, gatewayQueue
 
Constructor Summary
protected SerialGateway()
          Constructor only calls parent's constructor.
 
Method Summary
 int getBaudRate()
          Get the serial port communication rate.
 int getDataBits()
          Get the number of data bits to use.
 int getParity()
          Get the serial port parity.
 java.lang.String getPortName()
          Get the serial port to use.
 int getStopBits()
          Get the serial port stop bits.
 void setBaudRate(int baudRate)
          Set the serial port communication rate.
 void setDataBits(int dataBits)
          Set the number of serial port data bits to use.
 void setParity(int parity)
          Set the serial port parity.
 void setPortName(java.lang.String portName)
          Set the serial port to use.
 void setStopBits(int stopBits)
          Set the serial port stop bits.
 
Methods inherited from class com.jpeterson.x10.GatewayImpl
addGatewayListener, allocate, deallocate, dispatchControlEvent, fireControlEvent, getGatewayQueue, getGatewayState, pause, removeGatewayListener, resume, setGatewayQueue, setGatewayState, stateTransition, testGatewayState, waitGatewayState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

portName

protected java.lang.String portName

baudRate

protected int baudRate

dataBits

protected int dataBits

stopBits

protected int stopBits

parity

protected int parity
Constructor Detail

SerialGateway

protected SerialGateway()
Constructor only calls parent's constructor.
Method Detail

setPortName

public void setPortName(java.lang.String portName)
Set the serial port to use. For Microsoft Windows, typical values are COM1, COM2, COM3, or COM4.
Parameters:
portName - the name of the serial port

getPortName

public java.lang.String getPortName()
Get the serial port to use.
Returns:
Name of serial port to use.

setBaudRate

public void setBaudRate(int baudRate)
Set the serial port communication rate.
Parameters:
baudRate - the serial port communication rate

getBaudRate

public int getBaudRate()
Get the serial port communication rate.
Returns:
Baud rate.

setDataBits

public void setDataBits(int dataBits)
Set the number of serial port data bits to use.
Parameters:
dataBits - the number of data bits to use

getDataBits

public int getDataBits()
Get the number of data bits to use.
Returns:
Number of data bits.

setStopBits

public void setStopBits(int stopBits)
Set the serial port stop bits.
Parameters:
stopBits - the serial port stop bits.

getStopBits

public int getStopBits()
Get the serial port stop bits.
Returns:
The serial port stop bits.

setParity

public void setParity(int parity)
Set the serial port parity.
Parameters:
parity - the serial port parity.

getParity

public int getParity()
Get the serial port parity.
Returns:
The serial port parity.