Package jmri.jmrix.pi
Class RaspberryPiAdapter
- java.lang.Object
-
- jmri.jmrix.AbstractPortController
-
- jmri.jmrix.pi.RaspberryPiAdapter
-
- All Implemented Interfaces:
PortAdapter
public class RaspberryPiAdapter extends AbstractPortController
Provides an Adapter to allow the system connection memo and multiple RaspberryPi managers to be handled.
-
-
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 RaspberryPiAdapter()
RaspberryPiAdapter(boolean isSimulator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure()
Configure all of the other jmrix widgets needed to work with this adapter.void
connect()
Open the connection.void
dispose()
Clean up before removal.java.lang.String
getCurrentPortName()
com.pi4j.io.gpio.GpioController
getGPIOController()
java.io.DataInputStream
getInputStream()
Get the InputStream from the port.java.io.DataOutputStream
getOutputStream()
Get the outputStream to the port.RaspberryPiSystemConnectionMemo
getSystemConnectionMemo()
Get theSystemConnectionMemo
associated with this object.static boolean
isSimulator()
void
recover()
This is called when a connection is initially lost.-
Methods inherited from class jmri.jmrix.AbstractPortController
closeConnection, configureOption1, configureOption2, configureOption3, configureOption4, getDisabled, getManufacturer, getOption1Name, getOption2Name, getOption3Name, getOption4Name, getOptionChoices, getOptionDisplayName, getOptions, getOptionState, getReconnectMaxAttempts, getReconnectMaxInterval, getSystemPrefix, getUserName, isDirty, isOptionAdvanced, isOptionTypePassword, isOptionTypeText, isRestartRequired, purgeStream, reconnect, reconnectFromLoop, resetupConnection, safeSleep, setClosed, setDisabled, setManufacturer, setOpened, setOptionState, setReconnectMaxAttempts, setReconnectMaxInterval, setSystemConnectionMemo, setSystemPrefix, setUserName, status
-
-
-
-
Constructor Detail
-
RaspberryPiAdapter
public RaspberryPiAdapter()
-
RaspberryPiAdapter
public RaspberryPiAdapter(boolean isSimulator)
-
-
Method Detail
-
isSimulator
public static boolean isSimulator()
-
getCurrentPortName
public java.lang.String getCurrentPortName()
- Specified by:
getCurrentPortName
in interfacePortAdapter
- Specified by:
getCurrentPortName
in classAbstractPortController
-
dispose
public void dispose()
Description copied from class:AbstractPortController
Clean up before removal. Overriding methods must callsuper.dispose()
or document why they are not calling the overridden implementation. In most cases, failure to call the overridden implementation will cause user-visible error.- Specified by:
dispose
in interfacePortAdapter
- Overrides:
dispose
in classAbstractPortController
-
connect
public void connect()
Description copied from interface:PortAdapter
Open the connection.
-
configure
public void configure()
Description copied from interface:PortAdapter
Configure all of the other jmrix widgets needed to work with this adapter.
-
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
-
getSystemConnectionMemo
public RaspberryPiSystemConnectionMemo 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
-
recover
public void recover()
Description copied from class:AbstractPortController
This is called when a connection is initially lost. After checking the allowConnectionRecovery flag, closes the connection, resets the open flag and attempts a reconnection.- Specified by:
recover
in interfacePortAdapter
- Overrides:
recover
in classAbstractPortController
-
getGPIOController
@CheckForNull public com.pi4j.io.gpio.GpioController getGPIOController()
-
-