public class SensorAgent extends java.lang.Object implements LifeCycleAgent
SensorAdapter
s.LifeCycleAgent
interface and will be
instantiated with an SensorAdapter
, which will be started immediately. Furthermore it will wrap the running
SensorAdapter
by a LifeCycleApp
. Nevertheless, this class implements the control actions related to a
SensorAdapter
, such as: "start", "sleep", "info" and "stop".Modifier and Type | Field and Description |
---|---|
private ProjectStatus |
myStatus
The current status of the sensor agent.
|
private static long |
SHUTDOWN_CHECKTIME
Time to wait to check again if the worker has already been stopped, while
stop() is ending the worker
thread, before sending success. |
private SensorAdapter |
worker
The
SensorAdapter , a thread which provides sensor data of a certain context dimension in an internal data
format. |
private ReasonerDimension |
workerDimension
The context dimension as
ReasonerDimension for which the worker provides sensor data. |
private java.lang.String |
workerName
The simple class name of the
worker . |
Constructor and Description |
---|
SensorAgent(SensorAdapter adapter)
Create a new
SensorAgent which starts the supplied SensorAdapter as LifeCycleApp and
manages control messages for this SensorAdapter , such as "start", "stop", "info" and "sleep". |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getID()
the identifier of the Application.
|
JsonInfoMessage |
getInfoMessage()
Generating a Info Message.
|
void |
sleep()
the application no longer communicates with the Blackboard.
|
void |
start()
start with the actual work.
|
void |
stop()
shutting the agent down.
|
private ProjectStatus myStatus
private static final long SHUTDOWN_CHECKTIME
stop()
is ending the worker
thread, before sending success.private SensorAdapter worker
SensorAdapter
, a thread which provides sensor data of a certain context dimension in an internal data
format.private java.lang.String workerName
worker
.private ReasonerDimension workerDimension
ReasonerDimension
for which the worker
provides sensor data.public SensorAgent(SensorAdapter adapter)
SensorAgent
which starts the supplied SensorAdapter
as LifeCycleApp
and
manages control messages for this SensorAdapter
, such as "start", "stop", "info" and "sleep".adapter
- The SensorAdapter
which shall be started and managed as LifeCycleApp
.public final void sleep()
LifeCycleAgent
sleep
in interface LifeCycleAgent
LifeCycleAgent.sleep()
public final JsonInfoMessage getInfoMessage()
LifeCycleAgent
getInfoMessage
in interface LifeCycleAgent
JsonInfoMessage
, which describes the current execution state of the managed
SensorAdapter
.LifeCycleAgent.getInfoMessage()
public final void start()
LifeCycleAgent
start
in interface LifeCycleAgent
LifeCycleAgent.start()
public final void stop()
LifeCycleAgent
stop
in interface LifeCycleAgent
LifeCycleAgent.stop()
public final java.lang.String getID()
LifeCycleAgent
getID
in interface LifeCycleAgent
String
defined by ProjectInfo.REACHABILITY_AGENT_NAME
.
This exact ID needs to be provided within a control message to take effect on this
SensorAgent
.LifeCycleAgent.getID()