Package org.openmuc.jship.state
Class State
- java.lang.Object
-
- org.openmuc.jship.state.State
-
- Direct Known Subclasses:
CmiState
,HelloOk
,SmeHelloState
,SmePinState
,SmeProtHState
public abstract class State extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected ChangeStateCallBack
changeStateCB
protected java.util.concurrent.ScheduledExecutorService
checkTimeoutExecs
protected Configuration
config
protected org.slf4j.Logger
log
protected java.lang.String
logPrefix
protected byte[]
receivedMsg
protected ShipConnCallBack
shipConnCB
protected StateCallBack
stateCB
protected java.util.List<StateTransitionCallBack>
stateTransCBList
-
Constructor Summary
Constructors Constructor Description State(ShipConnCallBack shipConnCB, Configuration config, java.lang.String logPrefix)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addStateTransitionCB(StateTransitionCallBack stateTransCB)
protected void
checkTimeout(TimeoutTimer t)
protected abstract void
deactivateAllTimers()
Configuration
getConfig()
java.lang.String
getLogPrefix()
abstract SubState
getSubState()
abstract void
init()
void
next()
protected abstract void
nextState()
byte[]
peekReceivedMsg()
returns the last received message without removing itbyte[]
pollReceivedMsg()
returns and removes the last received messageabstract void
processMsg(byte[] msg)
boolean
receivedMsg()
void
removeStateTransitionCB(StateTransitionCallBack stateTransCB)
void
sendMsg(byte[] msg)
void
setReceivedMsg(byte[] receivedMsg)
void
setStateTransCBList(java.util.List<StateTransitionCallBack> stateTransCBList)
abstract void
setSubState(SubState subState)
void
shutDownExecutors()
protected abstract void
timedOut(TimeoutTimer timeoutTimer)
what should happen if a timer times out
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
shipConnCB
protected ShipConnCallBack shipConnCB
-
stateTransCBList
protected java.util.List<StateTransitionCallBack> stateTransCBList
-
config
protected Configuration config
-
stateCB
protected StateCallBack stateCB
-
changeStateCB
protected ChangeStateCallBack changeStateCB
-
checkTimeoutExecs
protected java.util.concurrent.ScheduledExecutorService checkTimeoutExecs
-
logPrefix
protected java.lang.String logPrefix
-
receivedMsg
protected byte[] receivedMsg
-
-
Constructor Detail
-
State
public State(ShipConnCallBack shipConnCB, Configuration config, java.lang.String logPrefix)
-
-
Method Detail
-
init
public abstract void init()
-
sendMsg
public void sendMsg(byte[] msg)
-
processMsg
public abstract void processMsg(byte[] msg)
-
next
public void next()
-
deactivateAllTimers
protected abstract void deactivateAllTimers()
-
nextState
protected abstract void nextState()
-
shutDownExecutors
public void shutDownExecutors()
-
getSubState
public abstract SubState getSubState()
-
setSubState
public abstract void setSubState(SubState subState)
-
checkTimeout
protected void checkTimeout(TimeoutTimer t)
-
timedOut
protected abstract void timedOut(TimeoutTimer timeoutTimer)
what should happen if a timer times out
-
getConfig
public Configuration getConfig()
-
getLogPrefix
public java.lang.String getLogPrefix()
-
pollReceivedMsg
public byte[] pollReceivedMsg()
returns and removes the last received message- Returns:
- the last received message
-
peekReceivedMsg
public byte[] peekReceivedMsg()
returns the last received message without removing it- Returns:
- the last received message
-
receivedMsg
public boolean receivedMsg()
-
setReceivedMsg
public void setReceivedMsg(byte[] receivedMsg)
-
setStateTransCBList
public void setStateTransCBList(java.util.List<StateTransitionCallBack> stateTransCBList)
-
addStateTransitionCB
public void addStateTransitionCB(StateTransitionCallBack stateTransCB)
-
removeStateTransitionCB
public void removeStateTransitionCB(StateTransitionCallBack stateTransCB)
-
-