cern.cmw.rda.examples
Class NoiseGenerator

java.lang.Object
  extended by cern.cmw.rda.examples.NoiseGenerator

public class NoiseGenerator
extends Object

A device simulator that allows to check all basic device access methods.

A NoiseGenerator device has two properties:

Applications can read and monitor values of all properties, and change the CCV value. The cycleSelector and context parameters are ignored in all access methods.


Method Summary
 Data get(IOPoint iop, Data context)
          Returns a value of the specified property in a Data object.
 void monitorOff(IOPoint iop, ValueChangeListener listener)
          Detaches the specified listener from the specified property.
 void monitorOn(IOPoint iop, ValueChangeListener listener)
          Attaches the specified listener to the specified property.
 void set(IOPoint iop, Data value, Data context)
          Sets the specified property to the specified value.
 void update()
          Updates the AQN value and notifies attached listeners, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

update

public void update()
Updates the AQN value and notifies attached listeners, if any.

In a real device this method would perform physical I/O; here it adds a random value within the -5.0 ... 5.0 range to the current CCV value, then informs all attached listeners on the value update. The on-change monitors will be fired if difference between new and old values is more then 1.0. The reported Data contains "value" and "timestamp" entries. If the AQN value occasionally goes out of its legal range then a simulated IOError will be reported.


get

public Data get(IOPoint iop,
                Data context)
         throws BadParameter,
                IOError
Returns a value of the specified property in a Data object. For AQN, the result Data contains two entries: For CCV, it only contains the "value" entry.

Throws:
BadParameter - if there is no such property in the device
IOError - if an I/O error has been detected in the last update cycle (AQN only)
See Also:
update()

set

public void set(IOPoint iop,
                Data value,
                Data context)
         throws BadParameter,
                IOError
Sets the specified property to the specified value. The new value is expected in the data entry tagged "value". If the operation does not result in an exception then all listeners attached to the property will be notified on the value change.

Throws:
BadParameter - if there is no such property in the device, or if the value Data does not contain the "value" entry, or if the value contained is not a double, or if the new value is out of the legal CCV range.
IOError - if the specified property is AQN (no write access)

monitorOn

public void monitorOn(IOPoint iop,
                      ValueChangeListener listener)
               throws BadParameter
Attaches the specified listener to the specified property.

Throws:
BadParameter - if there is no such property in the device

monitorOff

public void monitorOff(IOPoint iop,
                       ValueChangeListener listener)
Detaches the specified listener from the specified property.



Copyright © 2007 CERN. All Rights Reserved.