de.jaetzold.art.platform
Interface SensorPeer

All Known Subinterfaces:
ActuatorPeer, AngleSensorPeer, BooleanSensorPeer, CountSensorPeer, LightSensorPeer, MotorPeer, ServoPeer, StateSensorPeer, StepperMotorPeer
All Known Implementing Classes:
BaseSensorPeer, RawSensor

public interface SensorPeer


Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          The SensorEvents get deliverd to all registered PropertyChangeListeners.
 void disableEvent(SensorEventDescriptor eventDescriptor)
          Disable delivering the Events described by the given SensorEventDescriptor.
 void enableEvent(SensorEventDescriptor eventDescriptor)
          Enable delivering the Events described by the given SensorEventDescriptor.
 boolean getDeliversFloatingPoint()
          Tells whether this SensorPeer delivers discrete values or not.
 double getPrecision()
          Returns the maximum of the expectable error in the value.
 double getValue()
          Returns the value this peer represents as a double.
 boolean isConnected()
          Tells whether the connection to the represented sensor is still intact.
 void processEvent(SensorEvent event)
          Deliver the given SensorEvent to all Listeners.
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove the specified listener.
 void update()
          Generate and deliver a SensorEvent for the current sensors state.
 

Method Detail

getValue

public double getValue()
Returns the value this peer represents as a double.

getDeliversFloatingPoint

public boolean getDeliversFloatingPoint()
Tells whether this SensorPeer delivers discrete values or not. A result of false means that the result of a getValue() can be cast to int without a loss of precision.

isConnected

public boolean isConnected()
Tells whether the connection to the represented sensor is still intact.
See Also:
RobotInterface.isConnected()

enableEvent

public void enableEvent(SensorEventDescriptor eventDescriptor)
Enable delivering the Events described by the given SensorEventDescriptor. Not fully used. Implementors may enable more than the descibed Events an this is pretty much "all" in the current implementations.
See Also:
SensorEventDescriptor

disableEvent

public void disableEvent(SensorEventDescriptor eventDescriptor)
Disable delivering the Events described by the given SensorEventDescriptor. Not fully used. Implementors may disable less than the descibed Events an this is pretty much "none" in the current implementations.
See Also:
SensorEventDescriptor

update

public void update()
Generate and deliver a SensorEvent for the current sensors state.

getPrecision

public double getPrecision()
Returns the maximum of the expectable error in the value. This is just a guess, what means that nothing really important should depend on it. It is meant to give an algorithm using a Sensor connected to this SensorPeer an idea of how precise the value is so that it either can refuse to use it or try to compensate if necessary.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
The SensorEvents get deliverd to all registered PropertyChangeListeners. The PropertyChangeEvent has the SensorEvent as it's new value and the last SensorEvent as the old value. The property name used for this is value. This mechanism in the SensorPeer is not really used for anything else right now but may be in future releases.
See Also:
Sensor.addPropertyChangeListener(PropertyChangeListener), processEvent(SensorEvent)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Remove the specified listener.
See Also:
addPropertyChangeListener(PropertyChangeListener)

processEvent

public void processEvent(SensorEvent event)
Deliver the given SensorEvent to all Listeners. Maybe update internal cache of the value.
See Also:
addPropertyChangeListener(PropertyChangeListener)