1.0.0

org.eclipse.soda.dk.measurement.service
Interface MeasurementService

All Superinterfaces:
ControlService
All Known Implementing Classes:
ChildMeasurement, CommandMeasurement, ConcreteMeasurement, ControlsMeasurement, CountMeasurement, DataMeasurement, Measurement, Measurements, MethodMeasurement, ReadMeasurement, ReadOnlyMeasurement, SignalMeasurement, TotalMeasurement, UnitsMeasurement

public interface MeasurementService
extends ControlService

The MeasurementService interface defines the MeasurementService concept. A MeasurementService is a persistant store of a value which exists on a hardware device. The reading and writing methods are used in order to modify the value of the MeasurementService. An application may register interest by using the MeasurementListener interface, and be notified whenever the MeasurementService changes.

Version:
1.0.0
See Also:
Measurement, ControlService, MeasurementListener

Method Summary
 void addMeasurementListener(MeasurementListener measurementListener)
          Adds the specified listener to receive measurement listener notification.
 void executeRead()
          Forces an asyncronous hardware read of the current value.
 void executeWrite(java.lang.Object value)
          Forces an asyncronous hardware write of the specified value.
 java.lang.Object getTimestamp()
          Gets the Object timestamp property value.
 java.lang.Object getValue()
          Returns the locally cached value of the measurement.
 java.lang.Object read(long timeout)
          Perform the read method and return the Object result.
 void removeMeasurementListener(MeasurementListener measurementListener)
          Removes the specified listener from receiving listener notification.
 void setValue(java.lang.Object value)
          This method forces a synchronous write of the locally cached value.
 
Methods inherited from interface org.eclipse.soda.dk.device.service.ControlService
getKey
 

Method Detail

addMeasurementListener

void addMeasurementListener(MeasurementListener measurementListener)
Adds the specified listener to receive measurement listener notification. This method adds a Listener to the list of current listeners on this MeasurementService. Each time this measurement changes, all the listeners of this measurement will be notified using the MeasurementListener interface.

Parameters:
measurementListener - The org.eclipse.soda.dk.measurement.service.MeasurementListener listener to be added.
See Also:
removeMeasurementListener(MeasurementListener)

executeRead

void executeRead()
Forces an asyncronous hardware read of the current value.


executeWrite

void executeWrite(java.lang.Object value)
Forces an asyncronous hardware write of the specified value.

Parameters:
value - java.lang.Object

getTimestamp

java.lang.Object getTimestamp()
Gets the Object timestamp property value. This method returns the time of the last value received from the hardware device.

Returns:
java.lang.Object The last time the measurement was received.

getValue

java.lang.Object getValue()
Returns the locally cached value of the measurement.

Returns:
java.lang.Object The current cached measurement value.
See Also:
setValue(Object)

read

java.lang.Object read(long timeout)
                      throws java.lang.RuntimeException
Perform the read method and return the Object result. This method forces a synchronous hardware read with a timeout specified in milliseconds.

Parameters:
timeout - long
Returns:
Results of the read (Object) value.
Throws:
java.lang.RuntimeException - Thrown if the read command does not result in a response from the device.

removeMeasurementListener

void removeMeasurementListener(MeasurementListener measurementListener)
Removes the specified listener from receiving listener notification. This method removes a Listener to the list of current listeners on this MeasurementService. The MeasurementListener will no longer be notified each time this measurement changes.

Parameters:
measurementListener - The org.eclipse.soda.dk.measurement.service.MeasurementListener listener to be removed.
See Also:
addMeasurementListener(MeasurementListener)

setValue

void setValue(java.lang.Object value)
This method forces a synchronous write of the locally cached value. This method should only be used for simulation and testing purposes, as it will insert false data into the measurement.

Parameters:
value - The new property value (java.lang.Object).
See Also:
getValue()

1.0.0

Copyright (c) 1999, 2007 IBM