2009-01-09 1.2.0

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

All Superinterfaces:
ControlService
All Known Implementing Classes:
ChildMeasurement, CommandMeasurement, ConcreteMeasurement, ConcreteMeasurementFieldMeasurement, ControlsMeasurement, CountMeasurement, DataMeasurement, Measurement, MeasurementFieldMeasurement, 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.

Since:
1.0
Version:
1.2.0
See Also:
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 executeRead(ChannelService channel)
          Forces an asyncronous hardware read of the current value.
 void executeWrite(ChannelService channel, java.lang.Object value)
          Forces an asyncronous hardware write of the specified 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 getTimestamp(ChannelService channel)
          Gets the Object timestamp property value.
 java.lang.Object getValue()
          Returns the locally cached value of the measurement.
 java.lang.Object getValue(ChannelService channel)
          Returns the locally cached value of the measurement.
 java.lang.Object read(ChannelService channel, long timeout)
          Perform the read method and return the Object result.
 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(ChannelService channel, java.lang.Object value)
          This method forces a synchronous write of the locally cached value.
 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 measurement listener (MeasurementListener) parameter.
See Also:
removeMeasurementListener(MeasurementListener)

executeRead

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

See Also:
executeRead(ChannelService)

executeRead

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

Parameters:
channel - The channel (ChannelService) parameter.
Since:
1.2
See Also:
executeRead()

executeWrite

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

Parameters:
channel - The channel (ChannelService) parameter.
value - The value (Object) parameter.
Since:
1.2
See Also:
executeWrite(Object)

executeWrite

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

Parameters:
value - The value (Object) parameter.
See Also:
executeWrite(ChannelService,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.
See Also:
getTimestamp(ChannelService)

getTimestamp

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

Parameters:
channel - The channel (ChannelService) parameter.
Returns:
java.lang.Object The last time the measurement was received.
Since:
1.2
See Also:
getTimestamp()

getValue

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

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

getValue

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

Parameters:
channel - The channel (ChannelService) parameter.
Returns:
java.lang.Object The current cached measurement value.
Since:
1.2
See Also:
getValue(), setValue(ChannelService,Object), setValue(Object)

read

java.lang.Object read(ChannelService channel,
                      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:
channel - The channel (ChannelService) parameter.
timeout - The timeout (long) parameter.
Returns:
Results of the read (Object) value.
Throws:
java.lang.RuntimeException - Runtime Exception.
Since:
1.2
See Also:
read(long)

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 - The timeout (long) parameter.
Returns:
Results of the read (Object) value.
Throws:
java.lang.RuntimeException - Runtime Exception.
See Also:
read(ChannelService,long)

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 measurement listener (MeasurementListener) parameter.
See Also:
addMeasurementListener(MeasurementListener)

setValue

void setValue(ChannelService channel,
              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:
channel - The channel (ChannelService) parameter.
value - The value (Object) parameter.
Since:
1.2
See Also:
getValue(), getValue(ChannelService), setValue(Object)

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 value (Object) parameter.
See Also:
getValue(), getValue(ChannelService), setValue(ChannelService,Object)

2009-01-09 1.2.0

Copyright (c) 2009 IBM. See license in Legal section.