Package jmri.jmrix.ipocs
Class IpocsPortController
- java.lang.Object
-
- jmri.jmrix.AbstractPortController
-
- jmri.jmrix.ipocs.IpocsPortController
-
- All Implemented Interfaces:
IpocsClientListener
,PortAdapter
public class IpocsPortController extends AbstractPortController implements IpocsClientListener
- Since:
- 4.21.2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractPortController
AbstractPortController.Option
-
-
Field Summary
-
Fields inherited from class jmri.jmrix.AbstractPortController
allowConnectionRecovery, manufacturerName, opened, option1Name, option2Name, option3Name, option4Name, options, reconnectinterval, reconnectMaxAttempts, reconnectMaxInterval
-
-
Constructor Summary
Constructors Constructor Description IpocsPortController(IpocsSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(IpocsClientListener clientListener)
void
clientConnected(IpocsClientHandler client)
void
clientDisconnected(IpocsClientHandler client)
void
configure()
Configure all of the other jmrix widgets needed to work with this adapter.void
connect()
Open the connection.java.lang.String
getCurrentPortName()
java.io.DataInputStream
getInputStream()
Get the InputStream from the port.Message
getLastStatus(java.lang.String userName)
java.io.DataOutputStream
getOutputStream()
Get the outputStream to the port.short
getPort()
IpocsSystemConnectionMemo
getSystemConnectionMemo()
Get theSystemConnectionMemo
associated with this object.void
onMessage(IpocsClientHandler client, Message msg)
void
removeListener(IpocsClientListener clientListener)
void
send(Message msg)
void
setPort(short port)
-
Methods inherited from class jmri.jmrix.AbstractPortController
closeConnection, configureOption1, configureOption2, configureOption3, configureOption4, dispose, getDisabled, getManufacturer, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemPrefix, getUserName, isDirty, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, isRestartRequired, purgeStream, reconnect, reconnectFromLoop, recover, resetupConnection, safeSleep, setClosed, setDisabled, setManufacturer, setOpened, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserName, status
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.ipocs.IpocsClientListener
getUserName
-
-
-
-
Constructor Detail
-
IpocsPortController
public IpocsPortController(IpocsSystemConnectionMemo memo)
-
-
Method Detail
-
getSystemConnectionMemo
public IpocsSystemConnectionMemo getSystemConnectionMemo()
Description copied from class:AbstractPortController
Get theSystemConnectionMemo
associated with this object.This method should only be overridden to ensure that a specific subclass of SystemConnectionMemo is returned. The recommended pattern is:
public MySystemConnectionMemo getSystemConnectionMemo() { return (MySystemConnectionMemo) super.getSystemConnectionMemo(); }
- Specified by:
getSystemConnectionMemo
in interfacePortAdapter
- Overrides:
getSystemConnectionMemo
in classAbstractPortController
- Returns:
- the currently associated SystemConnectionMemo
-
configure
public void configure()
Description copied from interface:PortAdapter
Configure all of the other jmrix widgets needed to work with this adapter.- Specified by:
configure
in interfacePortAdapter
-
connect
public void connect() throws java.io.IOException
Description copied from interface:PortAdapter
Open the connection.- Specified by:
connect
in interfacePortAdapter
- Throws:
java.io.IOException
- if unable to connect
-
getInputStream
public java.io.DataInputStream getInputStream()
Description copied from class:AbstractPortController
Get the InputStream from the port.- Specified by:
getInputStream
in interfacePortAdapter
- Specified by:
getInputStream
in classAbstractPortController
- Returns:
- the InputStream from the port
-
getOutputStream
public java.io.DataOutputStream getOutputStream()
Description copied from class:AbstractPortController
Get the outputStream to the port.- Specified by:
getOutputStream
in interfacePortAdapter
- Specified by:
getOutputStream
in classAbstractPortController
- Returns:
- the outputStream to the port
-
getCurrentPortName
public java.lang.String getCurrentPortName()
- Specified by:
getCurrentPortName
in interfacePortAdapter
- Specified by:
getCurrentPortName
in classAbstractPortController
-
addListener
public void addListener(IpocsClientListener clientListener)
-
removeListener
public void removeListener(IpocsClientListener clientListener)
-
clientConnected
public void clientConnected(IpocsClientHandler client)
- Specified by:
clientConnected
in interfaceIpocsClientListener
-
clientDisconnected
public void clientDisconnected(IpocsClientHandler client)
- Specified by:
clientDisconnected
in interfaceIpocsClientListener
-
onMessage
public void onMessage(IpocsClientHandler client, Message msg)
- Specified by:
onMessage
in interfaceIpocsClientListener
-
getLastStatus
public Message getLastStatus(java.lang.String userName)
-
getPort
public short getPort()
-
setPort
public void setPort(short port)
-
-