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

Last change on this file since 14675 was 14675, checked in by tbretz, 12 years ago
Made sure that nobody tried to start a docu script.
File size: 5.9 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 * Sleep for a while. This can be used to just wait or give time
18 * back to the operating system to produce less CPU load if the
19 * main purpose of a loop is, e.g., to wait for something to happen.
20 *
21 * @param {Integer} [milliseconds=0]
22 * Number of millliseconds to sleep. Note that even 0 will always
23 * sleep at least one millisecond.
24 *
25 */
26dim.sleep = function() { /* [native code] */ }
27
28/**
29 *
30 * Post a message into the dim log stream.
31 *
32 * It will be logged by the datalogger, displayed on the console
33 * and in the smartfact web-gui.
34 *
35 * @param argument
36 * Any kind of argument can be given. If it is not a String, it
37 * is converted using the toString() member function.
38 *
39 * @param [. . .]
40 * Any number of additional arguments. Each argument will appear in
41 * a new line.
42 *
43 * @example
44 * dim.print("Five="+5, "--- new line ---");
45 *
46 */
47dim.print = function() { /* [native code] */ }
48
49/**
50 *
51 * Posts a message to the dim network with alarm severity.
52 *
53 * Similar to dim.print, but the message is posted to the network
54 * with alarm severity. This means that it is displayed in red
55 * and the smartfact web-gui will play an alarm sound.
56 * The alarm state will stay valid (displayed in the web-gui) until it
57 * is reset.
58 *
59 * @param argument
60 * Any kind of argument can be given. If it is not a String, it
61 * is converted using the toString() member function.
62 *
63 * @param [. . .]
64 * Any number of additional arguments. Each argument will appear as
65 * individual alarm.
66 *
67 * @example
68 * dim.alarm("Alarm for 30 seconds!");
69 * dim.sleep(30000);
70 * dim.alarm();
71 */
72dim.alarm = function() { /* [native code] */ }
73
74/**
75 *
76 * Displays a message on the local console (only).
77 *
78 * @param argument
79 * Any kind of argument can be given. If it is not a String, it
80 * is converted using the toString() member function.
81 *
82 * @param [. . .]
83 * Any number of additional arguments. Each argument will appear in
84 * a new line.
85 *
86 * @example
87 * dim.out("Five="+5, "--- new line ---");
88 *
89 */
90dim.out = function() { /* [native code] */ }
91
92/**
93 *
94 * Send a dim command to a dim client.
95 *
96 * @param {String} commandId
97 * The command id is a string and usually compiles like
98 * 'SERVER/COMMAND'
99 *
100 * @param argument
101 * Any kind of argument can be given. Arguments are internally
102 * converted into strings using toString() and processed as
103 * if they were typed on th console.
104 *
105 * @param [. . .]
106 * Any number of additional arguments.
107 *
108 * @example
109 * dim.send('DRIVE_CONTROL/TRACK_SOURCE 0.5 180 "Mrk 421"');
110 * dim.send('DRIVE_CONTROL/TRACK_SOURCE', 0.5, 180, 'Mrk 421');
111 *
112 * @returns
113 * A boolean value is returned whether the command was succesfully
114 * posted into the network or not. Note that true does by no means
115 * mean that the command was sucessfully received or even processed.
116 */
117dim.send = function() { /* [native code] */ }
118
119/**
120 * Returns the state of the given server.
121 *
122 * @param {String} name
123 * The name of the server of which you want to get the state.
124 *
125 * @throws
126 * If number or type of arguments is wrong
127 *
128 * @returns {Object}
129 * An object with the properties 'index' {Integer} and 'name' {String}
130 * is returned if a connection to the server is established and
131 * state information have been received, 'undefined' otherwise. If
132 * the time of the last state change is available it is stored
133 * in the 'property'. If a server disconnected, a valid object will
134 * be returned, but without any properties.
135 */
136dim.state = function(server, timeout) { /* [native code] */ }
137
138/**
139 * Wait for the given state of a server.
140 *
141 * @param {String} name
142 * The name of the server of which you want to wait for a state.
143 * The name must not contain quotation marks.
144 *
145 * @param {String,Integer} state
146 * The state you want to wait for. It can either be given as an Integer
147 * or as the corresponding short name. If given as String it must
148 * not contain quotation marks.
149 *
150 * @param {Integer} [timeout]
151 * An optional timeout. If no timeout is given, waiting will not stop
152 * until the condition is fulfilled. A timeout of 0 is allowed and
153 * will essentially just check if the server is in this state or not.
154 *
155 * @throws
156 * <li> If number or type of arguments is wrong
157 * <li> If no connection to the server is established or no state
158 * has been received yet. This is identical to dim.state()
159 * returning 'undefined'.
160 *
161 * @returns {Boolean}
162 * true if the state was achived within the timeout, false otherwise.
163 */
164dim.wait = function() { /* [native code] */ }
165
166/**
167 *
168 * Callback in case of state changes.
169 *
170 * To install a callback in case the state of a server changes. set
171 * the corresponding property of this array to a function. The argument
172 * provided to the function is identical with the object returned
173 * by dim.state(). In addition the name of the server is added
174 * as the 'name' property and the comment sent with the state change
175 * as 'comment' property. For the code executed, the same rules apply
176 * than for a thread created with Thread.<P>
177 *
178 * If a state change is defined for a server for which no callback
179 * has been set, the special entry '*' is checked.
180 *
181 *
182 * @type Array[Function]
183 *
184 * @example
185 * dim.onchange['*'] = function(state) { dim.out("State change from "+state.name+" received"); }
186 * dim.onchange['DIM_CONTROL'] = function(state) { dim.out(JSON.stringify(state); }
187 * ...
188 * delete dim.onchange['DIM_CONTROL']; // to remove the callback
189 *
190 */
191dim.onchange = [];
Note: See TracBrowser for help on using the repository browser.