View Javadoc

1   package org.indi.server;
2   
3   import org.indi.objects.State;
4   import org.indi.objects.Vector;
5   
6   /**
7    * An minimal implementation of an observer callback
8    * 
9    * @author Dirk Hünniger
10   * 
11   */
12  public class Observer implements ObserverCallback {
13      /**
14       * the name of the device to observe
15       */
16      private final String device;
17      /**
18       * the name of the vector to observe
19       */
20      private final String name;
21      /**
22       * the way the vector should be observed
23       */
24      private final ObserverState state;
25      /**
26       * the last State porperty of the vector
27       */
28      public State laststate = null;
29  
30      /**
31       * class consturctor
32       * 
33       * @param device
34       *                the name of the device to observe
35       * @param name
36       *                name of the vector to observe
37       * @param state
38       *                the way the vector should be observed
39       */
40      public Observer(String device, String name, ObserverState state) {
41  	this.device = device;
42  	this.name = name;
43  	this.state = state;
44      }
45  
46      /**
47       * 
48       * @return the name of the device to observe
49       */
50      public String getDevice() {
51  	return this.device;
52      }
53  
54      /**
55       * 
56       * @return the name of the vector to observe
57       */
58      public String getName() {
59  	return this.name;
60      }
61  
62      /**
63       * 
64       * @return the way the vector should be observed
65       */
66      public ObserverState getState() {
67  	return this.state;
68      }
69  
70      public void onObserved(Vector vector) {
71      }
72  }