source: trunk/FACT++/scripts/doc/dim.js@ 14696

Last change on this file since 14696 was 14696, checked in by tbretz, 12 years ago
Updated
File size: 5.3 KB
Line 
1throw new Error("Description for built in functions. Must not be included!");
2/**
3 * @fileOverview
4 * Documentation of dim namespace.
5 */
6
7/**
8 * @namespace
9 *
10 * Namespace for extension functions dealing with the DIM network.
11 *
12 * @author <a href="mailto:thomas.bretz@epfl.ch">Thomas Bretz</a>
13 */
14var dim = { };
15
16/**
17 *
18 * Post a message into the dim log stream.
19 *
20 * It will be logged by the datalogger, displayed on the console
21 * and in the smartfact web-gui.
22 *
23 * @param argument
24 * Any kind of argument can be given. If it is not a String, it
25 * is converted using the toString() member function.
26 *
27 * @param [. . .]
28 * Any number of additional arguments. Each argument will appear in
29 * a new line.
30 *
31 * @example
32 * dim.print("Five="+5, "--- new line ---");
33 *
34 */
35dim.print = function() { /* [native code] */ }
36
37/**
38 *
39 * Posts a message to the dim network with alarm severity.
40 *
41 * Similar to dim.print, but the message is posted to the network
42 * with alarm severity. This means that it is displayed in red
43 * and the smartfact web-gui will play an alarm sound.
44 * The alarm state will stay valid (displayed in the web-gui) until it
45 * is reset.
46 *
47 * @param argument
48 * Any kind of argument can be given. If it is not a String, it
49 * is converted using the toString() member function.
50 *
51 * @param [. . .]
52 * Any number of additional arguments. Each argument will appear as
53 * individual alarm.
54 *
55 * @example
56 * dim.alarm("Alarm for 30 seconds!");
57 * v8.sleep(30000);
58 * dim.alarm();
59 */
60dim.alarm = function() { /* [native code] */ }
61
62/**
63 *
64 * Send a dim command to a dim client.
65 *
66 * @param {String} commandId
67 * The command id is a string and usually compiles like
68 * 'SERVER/COMMAND'
69 *
70 * @param argument
71 * Any kind of argument can be given. Arguments are internally
72 * converted into strings using toString() and processed as
73 * if they were typed on th console.
74 *
75 * @param [. . .]
76 * Any number of additional arguments.
77 *
78 * @example
79 * dim.send('DRIVE_CONTROL/TRACK_SOURCE 0.5 180 "Mrk 421"');
80 * dim.send('DRIVE_CONTROL/TRACK_SOURCE', 0.5, 180, 'Mrk 421');
81 *
82 * @returns
83 * A boolean value is returned whether the command was succesfully
84 * posted into the network or not. Note that true does by no means
85 * mean that the command was sucessfully received or even processed.
86 */
87dim.send = function() { /* [native code] */ }
88
89/**
90 * Returns the state of the given server.
91 *
92 * @param {String} name
93 * The name of the server of which you want to get the state.
94 *
95 * @throws
96 * If number or type of arguments is wrong
97 *
98 * @returns {Object}
99 * An object with the properties 'index' {Integer} and 'name' {String}
100 * is returned if a connection to the server is established and
101 * state information have been received, 'undefined' otherwise. If
102 * the time of the last state change is available it is stored
103 * in the 'property'. If a server disconnected, a valid object will
104 * be returned, but without any properties.
105 */
106dim.state = function(server, timeout) { /* [native code] */ }
107
108/**
109 * Wait for the given state of a server.
110 *
111 * Note that the function is internally asynchornously checking the
112 * state, that means that theoretically, a state could be missed if
113 * it changes too fast. If this can happen callbacks have to be used.
114 *
115 * @param {String} name
116 * The name of the server of which you want to wait for a state.
117 * The name must not contain quotation marks.
118 *
119 * @param {String,Integer} state
120 * The state you want to wait for. It can either be given as an Integer
121 * or as the corresponding short name. If given as String it must
122 * not contain quotation marks.
123 *
124 * @param {Integer} [timeout]
125 * An optional timeout. If no timeout is given, waiting will not stop
126 * until the condition is fulfilled. A timeout of 0 is allowed and
127 * will essentially just check if the server is in this state or not.
128 *
129 * @throws
130 * <li> If number or type of arguments is wrong
131 * <li> If no connection to the server is established or no state
132 * has been received yet. This is identical to dim.state()
133 * returning 'undefined'.
134 *
135 * @returns {Boolean}
136 * true if the state was achived within the timeout, false otherwise.
137 */
138dim.wait = function() { /* [native code] */ }
139
140/**
141 *
142 * Callback in case of state changes.
143 *
144 * To install a callback in case the state of a server changes. set
145 * the corresponding property of this array to a function. The argument
146 * provided to the function is identical with the object returned
147 * by dim.state(). In addition the name of the server is added
148 * as the 'name' property and the comment sent with the state change
149 * as 'comment' property. For the code executed, the same rules apply
150 * than for a thread created with Thread.<P>
151 *
152 * If a state change is defined for a server for which no callback
153 * has been set, the special entry '*' is checked.
154 *
155 *
156 * @type Array[Function]
157 *
158 * @example
159 * dim.onchange['*'] = function(state) { console.out("State change from "+state.name+" received"); }
160 * dim.onchange['DIM_CONTROL'] = function(state) { console.out(JSON.stringify(state); }
161 * ...
162 * delete dim.onchange['DIM_CONTROL']; // to remove the callback
163 *
164 */
165dim.onchange = [];
166
167/**
168 * DIM version number
169 *
170 * @constant
171 * @type Integer
172 */
173dim.version = 0;
Note: See TracBrowser for help on using the repository browser.