cat.sensor.event
Class SensorDataEvent

java.lang.Object
  extended byjava.util.EventObject
      extended bycat.sensor.event.SensorEvent
          extended bycat.sensor.event.SensorDataEvent
All Implemented Interfaces:
java.io.Serializable

public class SensorDataEvent
extends SensorEvent

This data event carries the sensor data that a sensor gets. For example, for a temperature sensor this event would contain the recorded temperature by the sensor.

See Also:
Serialized Form

Field Summary
private  int type
          The sensor type of the sensor that made this data.
private  Value value
          The data value of the sensor.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
SensorDataEvent(java.lang.String id, int t, Value v)
          This constructor sets the id of the sensor sending the data event, and the data/value that the sensor is transmitting.
SensorDataEvent(java.lang.String id, Value v)
          This constructor sets the id of the sensor sending the data event, and the data/value that the sensor is transmitting.
 
Method Summary
 Agent getAgent()
          This returns the agent who owns the sensor.
 int getType()
          This returns the type of the sensor that published this event.
 Value getValue()
          This returns the value/data of the sensor that published this event.
 boolean isRemote()
          This returns true if the sensor value/data is remote.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

private Value value
The data value of the sensor.


type

private int type
The sensor type of the sensor that made this data.

Constructor Detail

SensorDataEvent

public SensorDataEvent(java.lang.String id,
                       Value v)
This constructor sets the id of the sensor sending the data event, and the data/value that the sensor is transmitting.

Parameters:
id - The unique id of the sensor sending the data event.
v - The value/data of the sensor.

SensorDataEvent

public SensorDataEvent(java.lang.String id,
                       int t,
                       Value v)
This constructor sets the id of the sensor sending the data event, and the data/value that the sensor is transmitting.

Parameters:
id - The unique id of the sensor sending the data event.
v - The value/data of the sensor.
t - The type of the sensor.
Method Detail

getType

public int getType()
This returns the type of the sensor that published this event.

Returns:
int The type of the sensor.

getValue

public Value getValue()
This returns the value/data of the sensor that published this event.

Returns:
Value The value of the sensor.

isRemote

public boolean isRemote()
This returns true if the sensor value/data is remote. This information is extracted from the sensor value itself.

Returns:
boolean True if the sensor value/data is remote.

getAgent

public Agent getAgent()
This returns the agent who owns the sensor. This information is extracted from the sensor value itself.

Returns:
Agent The agent owning the sensor.