jmri.jmrix.loconet
Class LnPortController

java.lang.Object
  extended by jmri.jmrix.AbstractPortController
      extended by jmri.jmrix.loconet.LnPortController
All Implemented Interfaces:
PortAdapter, SerialPortAdapter
Direct Known Subclasses:
LnHexFilePort, LnTcpDriverAdapter, LocoBufferAdapter, MS100Adapter

public abstract class LnPortController
extends AbstractPortController

Base for classes representing a LocoNet communications port

Author:
Bob Jacobsen Copyright (C) 2001, 2002

Field Summary
protected  String commandStationName
           
protected  String[] commandStationNames
           
protected  boolean mCanRead
           
protected  boolean mProgPowersOff
           
 
Fields inherited from class jmri.jmrix.AbstractPortController
log, mBaudRate, mOpt1, mOpt2, mPort
 
Constructor Summary
LnPortController()
           
 
Method Summary
static void configureCommandStation(boolean mCanRead, boolean mProgPowersOff, String name)
          Configure the programming manager and "command station" objects
static void configureManagers()
          Configure the common managers for LocoNet connections.
abstract  DataInputStream getInputStream()
           
abstract  DataOutputStream getOutputStream()
           
 boolean okToSend()
          Can the port accept additional characters?
 void setCommandStationType(String value)
          Set config info from the command station type name.
abstract  boolean status()
          Check that this object is ready to operate.
 
Methods inherited from class jmri.jmrix.AbstractPortController
configureBaudRate, configureOption1, configureOption2, currentBaudNumber, getCurrentBaudRate, getCurrentOption1Setting, getCurrentOption2Setting, getCurrentPortName, handlePortBusy, handlePortNotFound, option1Name, option2Name, setPort, validBaudNumber, validOption1, 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
configure, getPortNames, openPort, validBaudRates
 

Field Detail

mCanRead

protected boolean mCanRead

mProgPowersOff

protected boolean mProgPowersOff

commandStationName

protected String commandStationName

commandStationNames

protected String[] commandStationNames
Constructor Detail

LnPortController

public LnPortController()
Method Detail

getInputStream

public abstract DataInputStream getInputStream()
Specified by:
getInputStream in class AbstractPortController

getOutputStream

public abstract DataOutputStream getOutputStream()
Specified by:
getOutputStream in class AbstractPortController

status

public abstract boolean status()
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 AbstractPortController

okToSend

public boolean okToSend()
Can the port accept additional characters? This might go false for short intervals, but it might also stick off if something goes wrong.

Provide a default implementation for the MS100, etc, in which this is _always_ true, as we rely on the queueing in the port itself.


setCommandStationType

public void setCommandStationType(String value)
Set config info from the command station type name.


configureCommandStation

public static void configureCommandStation(boolean mCanRead,
                                           boolean mProgPowersOff,
                                           String name)
Configure the programming manager and "command station" objects

Parameters:
mCanRead -
mProgPowersOff -
name - Command station type name

configureManagers

public static void configureManagers()
Configure the common managers for LocoNet connections. This puts the common manager config in one place. This method is static so that it can be referenced from classes that don't inherit, including hexfile.HexFileFrame and locormi.LnMessageClient



Copyright © 1997 - 2008 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: SourceForge_Logo