Package jmri.jmrix.sprog.update
Class SprogVersionQuery
- java.lang.Object
-
- jmri.jmrix.sprog.update.SprogVersionQuery
-
- All Implemented Interfaces:
java.util.EventListener
,SprogListener
public class SprogVersionQuery extends java.lang.Object implements SprogListener
Get the firmware version of the attached SPROG.Updated April 2016 by Andrew Crosland: look for the correct replies, which may not be the very next message after a query is sent, due to slot manager traffic. Add Pi-SPROG version decoding.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
SprogVersionQuery.QueryState
-
Field Summary
Fields Modifier and Type Field Description protected int
LONG_TIMEOUT
(package private) java.lang.String
replyString
(package private) SprogVersionQuery.QueryState
state
(package private) SprogTrafficController
tc
(package private) javax.swing.Timer
timer
(package private) SprogVersion
ver
protected static java.util.Vector<SprogVersionListener>
versionListeners
-
Constructor Summary
Constructors Constructor Description SprogVersionQuery(SprogSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addSprogVersionListener(SprogVersionListener l)
void
notifyMessage(SprogMessage m)
SprogListener notify Message (not used).void
notifyReply(SprogReply m)
SprogListener notifyReply listens to replies and looks for version reply.protected void
notifyVersion(SprogVersion v)
Notify all registered listeners of the SPROG version.void
removeSprogVersionListener(SprogVersionListener l)
Remove a SprogVersionListener.void
requestVersion(SprogVersionListener l)
protected void
restartTimer(int delay)
Internal routine to handle timer starts and restarts.protected void
startLongTimer()
Internal routine to restart timer with a long delay.protected void
stopTimer()
Internal routine to stop timer, as all is well.protected void
timeout()
Internal routine to handle a timeout.
-
-
-
Field Detail
-
replyString
java.lang.String replyString
-
ver
SprogVersion ver
-
LONG_TIMEOUT
protected final int LONG_TIMEOUT
- See Also:
- Constant Field Values
-
timer
javax.swing.Timer timer
-
versionListeners
protected static final java.util.Vector<SprogVersionListener> versionListeners
-
-
Constructor Detail
-
SprogVersionQuery
public SprogVersionQuery(SprogSystemConnectionMemo memo)
-
-
Method Detail
-
addSprogVersionListener
protected void addSprogVersionListener(SprogVersionListener l)
-
removeSprogVersionListener
public void removeSprogVersionListener(SprogVersionListener l)
Remove a SprogVersionListener. Stops Timer ( if running ), when no further Listeners are present.- Parameters:
l
- the Listener to remove.
-
requestVersion
public void requestVersion(SprogVersionListener l)
-
notifyVersion
protected void notifyVersion(SprogVersion v)
Notify all registered listeners of the SPROG version.- Parameters:
v
- version to send notify to
-
notifyMessage
public void notifyMessage(SprogMessage m)
SprogListener notify Message (not used).- Specified by:
notifyMessage
in interfaceSprogListener
-
notifyReply
public void notifyReply(SprogReply m)
SprogListener notifyReply listens to replies and looks for version reply.- Specified by:
notifyReply
in interfaceSprogListener
-
timeout
protected void timeout()
Internal routine to handle a timeout.
-
startLongTimer
protected void startLongTimer()
Internal routine to restart timer with a long delay.
-
stopTimer
protected void stopTimer()
Internal routine to stop timer, as all is well.
-
restartTimer
protected void restartTimer(int delay)
Internal routine to handle timer starts and restarts.- Parameters:
delay
- timer delay
-
-