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

Last change on this file since 15043 was 14995, checked in by tbretz, 12 years ago
Added some missing text for dim.wait
File size: 6.2 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.log("Five="+5, "--- new line ---");
33 *
34 */
35dim.log = function() { /* [native code] */ }
36
37/**
38 *
39 * Posts a message to the dim network with alarm severity.
40 *
41 * Similar to dim.log, 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() { /* [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 * If a negative value is given, exceptions are suppressed and false
129 * is returned in case of timeout. As timeout the absolute value is used.
130 *
131 * @throws
132 * <li> If number or type of arguments is wrong
133 * <li> If no connection to the server is established or no state
134 * has been received yet. This is identical to dim.state()
135 * returning 'undefined' (only in case a positive timeout
136 * is given)
137 *
138 * @returns {Boolean}
139 * true if the state was achived within the timeout, false otherwise.
140 */
141dim.wait = function() { /* [native code] */ }
142
143/**
144 *
145 * Returns a list of all known state of a given server.
146 *
147 * The returned object has all states with their index as property.
148 * Each state is returned as a String object with the property description.
149 *
150 * @param {String} [server='DIM_CONTROL']
151 * Name of the server for which states should be listed.
152 * The states of the DIM_CONTROl server are the default.
153 *
154 * @type Object[StringObject]
155 *
156 * @example
157 * var states = dim.getStates("SERVER");
158 * console.out(JSON.stringify(states));
159 * for (var index in states)
160 * console.out(index+"="+states[index]+": "+states[index].description);
161 */
162dim.getStates = function() { /* [native code] */ }
163
164/**
165 *
166 * Callback in case of state changes.
167 *
168 * To install a callback in case the state of a server changes. set
169 * the corresponding property of this array to a function. The argument
170 * provided to the function is identical with the object returned
171 * by dim.state(). In addition the name of the server is added
172 * as the 'name' property and the comment sent with the state change
173 * as 'comment' property. For the code executed, the same rules apply
174 * than for a thread created with Thread.<P>
175 *
176 * If a state change is defined for a server for which no callback
177 * has been set, the special entry '*' is checked.
178 *
179 *
180 * @type Array[Function]
181 *
182 * @example
183 * dim.onchange['*'] = function(state) { console.out("State change from "+state.name+" received"); }
184 * dim.onchange['DIM_CONTROL'] = function(state) { console.out(JSON.stringify(state); }
185 * ...
186 * delete dim.onchange['DIM_CONTROL']; // to remove the callback
187 *
188 */
189dim.onchange = [];
190
191
192/**
193 * DIM version number
194 *
195 * @constant
196 * @type Integer
197 */
198dim.version = 0;
Note: See TracBrowser for help on using the repository browser.