public class LightControllerStateMachine
extends java.lang.Object
implements SecurityLightController.LightControllerCommandInterface
Constructor and Description |
---|
LightControllerStateMachine()
This is the default constructor, which will instantiate a new instance of
this class.
|
Modifier and Type | Method and Description |
---|---|
protected int |
getCurrentState()
This method will return the current state of the Light controller.
|
protected void |
setCurrentState(int currentState)
This method will set the current state of the light controller.
|
void |
setLight(SecurityLightController.LightDeviceInterface light)
This method will set the light that is to be controlled by this state
machine.
|
void |
setTmr(SecurityLightController.LightTimerInterface tmr)
This method will set an instance of the timer that is to be used with
this class.
|
void |
signalAction(int request)
This method provides a mechanism for a signal to be received by the light
controller.
|
void |
subscribe(SecurityLightController.LightControllerStateMachineObserverInterface obs)
This method will allow an external observer to subscribe to state
machine, receiving updates when states change.
|
void |
unsubscribe(SecurityLightController.LightControllerStateMachineObserverInterface obs)
This method will allow an external observer to unsubscribe to state
machine, receiving updates when states change.
|
public LightControllerStateMachine()
public void setLight(SecurityLightController.LightDeviceInterface light)
light
- This is the instance of the light that is to be directly
controlled.public void setTmr(SecurityLightController.LightTimerInterface tmr)
tmr
- This is the timer instance.public void subscribe(SecurityLightController.LightControllerStateMachineObserverInterface obs)
SecurityLightController.LightControllerCommandInterface
subscribe
in interface SecurityLightController.LightControllerCommandInterface
obs
- This is the observer interface that is to be subscribed.public void unsubscribe(SecurityLightController.LightControllerStateMachineObserverInterface obs)
SecurityLightController.LightControllerCommandInterface
unsubscribe
in interface SecurityLightController.LightControllerCommandInterface
obs
- This is the observer interface that is to be unsubscribed.public void signalAction(int request)
SecurityLightController.LightControllerCommandInterface
signalAction
in interface SecurityLightController.LightControllerCommandInterface
request
- This is the signal that is being received. It can be one of
LIGHT_SENSOR_DARKENED, LIGHT_SENSOR_LIGHTENED,
MANUAL_SWITCH_ON, MANUAL_SWITCH_OFF, MOTION_DETECTED,
SECURITY_ALARM_TRIPPED, ALARM_CLEARED, or LAMP_TIMER_EXPIRED.
\protected int getCurrentState()
protected void setCurrentState(int currentState)
currentState
- This is the desired state for the light controller.