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

Last change on this file since 14972 was 14972, checked in by tbretz, 12 years ago
Replaced dim.print by dim.log
File size: 6.0 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(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 * Returns a list of all known state of a given server.
143 *
144 * The returned object has all states with their index as property.
145 * Each state is returned as a String object with the property description.
146 *
147 * @param {String} [server='DIM_CONTROL']
148 * Name of the server for which states should be listed.
149 * The states of the DIM_CONTROl server are the default.
150 *
151 * @type Object[StringObject]
152 *
153 * @example
154 * var states = dim.getStates("SERVER");
155 * console.out(JSON.stringify(states));
156 * for (var index in states)
157 * console.out(index+"="+states[index]+": "+states[index].description);
158 */
159dim.getStates = function() { /* [native code] */ }
160
161/**
162 *
163 * Callback in case of state changes.
164 *
165 * To install a callback in case the state of a server changes. set
166 * the corresponding property of this array to a function. The argument
167 * provided to the function is identical with the object returned
168 * by dim.state(). In addition the name of the server is added
169 * as the 'name' property and the comment sent with the state change
170 * as 'comment' property. For the code executed, the same rules apply
171 * than for a thread created with Thread.<P>
172 *
173 * If a state change is defined for a server for which no callback
174 * has been set, the special entry '*' is checked.
175 *
176 *
177 * @type Array[Function]
178 *
179 * @example
180 * dim.onchange['*'] = function(state) { console.out("State change from "+state.name+" received"); }
181 * dim.onchange['DIM_CONTROL'] = function(state) { console.out(JSON.stringify(state); }
182 * ...
183 * delete dim.onchange['DIM_CONTROL']; // to remove the callback
184 *
185 */
186dim.onchange = [];
187
188
189/**
190 * DIM version number
191 *
192 * @constant
193 * @type Integer
194 */
195dim.version = 0;
Note: See TracBrowser for help on using the repository browser.