jmri.jmrix.rps.serial
Class SerialAdapter

java.lang.Object
  extended by jmri.jmrix.AbstractPortController
      extended by jmri.jmrix.rps.serial.SerialAdapter
All Implemented Interfaces:
PortAdapter, SerialPortAdapter

public class SerialAdapter
extends AbstractPortController
implements SerialPortAdapter

Implements SerialPortAdapter for the RPS system.

Unlike many other SerialPortAdapters, this also converts the input stream into Readings that can be passed to the Distributor.

This version expects that the "A" command will send back "DATA,," followed by a list of receivers numbers, and data lines will be "0,0,0,0": A value for each address up to the max receiver, even if some are missing (0 in that case)

Author:
Bob Jacobsen Copyright (C) 2001, 2002, 2008

Field Summary
protected  String[] validSpeeds
           
protected  int[] validSpeedValues
           
 
Fields inherited from class jmri.jmrix.AbstractPortController
mBaudRate, mOpt1, mOpt2, mPort
 
Constructor Summary
SerialAdapter()
           
 
Method Summary
 void configure()
          Set up all of the other objects to operate
 void configureOption1(String value)
          Set the second port option.
 void dispose()
           
 String getCurrentOption1Setting()
           
 DataInputStream getInputStream()
           
 DataOutputStream getOutputStream()
           
static SerialAdapter instance()
           
protected  void nextLine(String s)
          Handle a new line from the device.
 String openPort(String portName, String appName)
          Open a specified port.
 String option1Name()
          Get a String that says what Option 1 represents May be an empty string, but will not be null
 boolean status()
          Query the status of this connection.
 String[] validBaudRates()
          Get an array of valid baud rates.
 String[] validOption1()
          Get an array of valid values for "option 1"; used to display valid options.
 
Methods inherited from class jmri.jmrix.AbstractPortController
configureBaudRate, configureOption2, currentBaudNumber, getCurrentBaudRate, getCurrentOption2Setting, getCurrentPortName, getPortNames, handlePortBusy, handlePortNotFound, option2Name, reloadDriver, setPort, validBaudNumber, validOption2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.jmrix.SerialPortAdapter
configureBaudRate, configureOption2, getCurrentBaudRate, getCurrentOption2Setting, getCurrentPortName, getPortNames, handlePortBusy, option2Name, setPort, validOption2
 

Field Detail

validSpeeds

protected String[] validSpeeds

validSpeedValues

protected int[] validSpeedValues
Constructor Detail

SerialAdapter

public SerialAdapter()
Method Detail

openPort

public String openPort(String portName,
                       String appName)
Description copied from interface: SerialPortAdapter
Open a specified port. The appname argument is to be provided to the underlying OS during startup so that it can show on status displays, etc

Specified by:
openPort in interface SerialPortAdapter

configure

public void configure()
Set up all of the other objects to operate

Specified by:
configure in interface PortAdapter
Specified by:
configure in interface SerialPortAdapter

getInputStream

public DataInputStream getInputStream()
Specified by:
getInputStream in interface PortAdapter
Specified by:
getInputStream in class AbstractPortController

getOutputStream

public DataOutputStream getOutputStream()
Specified by:
getOutputStream in interface PortAdapter
Specified by:
getOutputStream in class AbstractPortController

status

public boolean status()
Description copied from interface: PortAdapter
Query the status of this connection. If all OK, at least as far as is known, return true

Specified by:
status in interface PortAdapter
Specified by:
status in interface SerialPortAdapter
Specified by:
status in class AbstractPortController

validBaudRates

public String[] validBaudRates()
Get an array of valid baud rates.

Specified by:
validBaudRates in interface SerialPortAdapter

validOption1

public String[] validOption1()
Description copied from class: AbstractPortController
Get an array of valid values for "option 1"; used to display valid options. May not be null, but may have zero entries

Specified by:
validOption1 in interface PortAdapter
Specified by:
validOption1 in interface SerialPortAdapter
Overrides:
validOption1 in class AbstractPortController

option1Name

public String option1Name()
Get a String that says what Option 1 represents May be an empty string, but will not be null

Specified by:
option1Name in interface PortAdapter
Specified by:
option1Name in interface SerialPortAdapter
Overrides:
option1Name in class AbstractPortController

configureOption1

public void configureOption1(String value)
Set the second port option.

Specified by:
configureOption1 in interface PortAdapter
Specified by:
configureOption1 in interface SerialPortAdapter
Overrides:
configureOption1 in class AbstractPortController

getCurrentOption1Setting

public String getCurrentOption1Setting()
Specified by:
getCurrentOption1Setting in interface PortAdapter
Specified by:
getCurrentOption1Setting in interface SerialPortAdapter
Overrides:
getCurrentOption1Setting in class AbstractPortController

instance

public static SerialAdapter instance()

dispose

public void dispose()

nextLine

protected void nextLine(String s)
Handle a new line from the device. This needs to execute on the Swing GUI thread. It forwards via the Distributor object.

Parameters:
s - The new message to distribute


Copyright © 1997 - 2009 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads