jmri.jmrix.loconet.locobuffer
Class LocoBufferAdapter

java.lang.Object
  extended by jmri.jmrix.AbstractPortController
      extended by jmri.jmrix.loconet.LnPortController
          extended by jmri.jmrix.loconet.locobuffer.LocoBufferAdapter
All Implemented Interfaces:
PortAdapter, SerialPortAdapter
Direct Known Subclasses:
IntelliboxAdapter, LocoBufferIIAdapter, LocoBufferUsbAdapter, PR2Adapter, PR3Adapter

public class LocoBufferAdapter
extends LnPortController
implements SerialPortAdapter

Provide access to LocoNet via a LocoBuffer attached to a serial comm port.

Normally controlled by the LocoBufferFrame class.

Author:
Bob Jacobsen Copyright (C) 2001

Field Summary
protected  String[] validOption1
           
protected  String[] validSpeeds
           
protected  int[] validSpeedValues
           
 
Fields inherited from class jmri.jmrix.loconet.LnPortController
commandStationName, commandStationNames, mCanRead, mProgPowersOff
 
Fields inherited from class jmri.jmrix.AbstractPortController
mBaudRate, mOpt1, mOpt2, mPort
 
Constructor Summary
LocoBufferAdapter()
           
 
Method Summary
 void configure()
          Set up all of the other objects to operate with a LocoBuffer connected to this port.
 void configureOption2(String value)
          Set the second port option.
 DataInputStream getInputStream()
           
 DataOutputStream getOutputStream()
           
 Vector<String> getPortNames()
          Provide a vector of valid port names, each a String.
static boolean hasInstance()
           
static LocoBufferAdapter instance()
           
 boolean okToSend()
          Can the port accept additional characters?
 String openPort(String portName, String appName)
          Open a specified port.
 String option1Name()
          Option 1 controls flow control option
 String option2Name()
          Get a String that says what Option 2 represents May be an empty string, but will not be null
protected  void setSerialPort(SerialPort activeSerialPort)
          Local method to do specific configuration, overridden in class
 boolean status()
          Check that this object is ready to operate.
 int[] validBaudNumber()
          Get an array of valid baud rates as integers.
 String[] validBaudRates()
          Get an array of valid baud rates as strings.
 String[] validOption1()
          Get an array of valid values for "option 1"; used to display valid options.
 String[] validOption2()
          Get an array of valid values for "option 2"; used to display valid options.
 
Methods inherited from class jmri.jmrix.loconet.LnPortController
configureCommandStation, configureManagers, setCommandStationType
 
Methods inherited from class jmri.jmrix.AbstractPortController
configureBaudRate, configureOption1, currentBaudNumber, getCurrentBaudRate, getCurrentOption1Setting, getCurrentOption2Setting, getCurrentPortName, handlePortBusy, handlePortNotFound, reloadDriver, setPort
 
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, configureOption1, getCurrentBaudRate, getCurrentOption1Setting, getCurrentOption2Setting, getCurrentPortName, handlePortBusy, setPort
 

Field Detail

validSpeeds

protected String[] validSpeeds

validSpeedValues

protected int[] validSpeedValues

validOption1

protected String[] validOption1
Constructor Detail

LocoBufferAdapter

public LocoBufferAdapter()
Method Detail

getPortNames

public Vector<String> getPortNames()
Description copied from interface: SerialPortAdapter
Provide a vector of valid port names, each a String.

Specified by:
getPortNames in interface SerialPortAdapter
Overrides:
getPortNames in class AbstractPortController

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

okToSend

public boolean okToSend()
Can the port accept additional characters? The state of CTS determines this, as there seems to be no way to check the number of queued bytes and buffer length. This might go false for short intervals, but it might also stick off if something goes wrong.

Overrides:
okToSend in class LnPortController

configure

public void configure()
Set up all of the other objects to operate with a LocoBuffer connected to this port.

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 LnPortController

getOutputStream

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

status

public boolean status()
Description copied from class: LnPortController
Check that this object is ready to operate. This is a question of configuration, not transient hardware status.

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

setSerialPort

protected void setSerialPort(SerialPort activeSerialPort)
                      throws UnsupportedCommOperationException
Local method to do specific configuration, overridden in class

Throws:
UnsupportedCommOperationException

validBaudRates

public String[] validBaudRates()
Get an array of valid baud rates as strings. This allows subclasses to change the arrays of speeds.

Specified by:
validBaudRates in interface SerialPortAdapter

validBaudNumber

public int[] validBaudNumber()
Get an array of valid baud rates as integers. This allows subclasses to change the arrays of speeds.

Overrides:
validBaudNumber in class AbstractPortController

option1Name

public String option1Name()
Option 1 controls flow control option

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

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

validOption2

public String[] validOption2()
Get an array of valid values for "option 2"; used to display valid options. May not be null, but may have zero entries

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

option2Name

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

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

configureOption2

public void configureOption2(String value)
Set the second port option. Only to be used after construction, but before the openPort call

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

hasInstance

public static boolean hasInstance()

instance

public static LocoBufferAdapter instance()


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