throw new Error("Description for built in functions. Must not be included!"); /** * @fileOverview * Documentation of dim namespace. */ /** * @namespace * * Namespace for extension functions dealing with the DIM network. * * @author Thomas Bretz */ var dim = { }; /** * * Post a message into the dim log stream. * * It will be logged by the datalogger, displayed on the console * and in the smartfact web-gui. * * @param argument * Any kind of argument can be given. If it is not a String, it * is converted using the toString() member function. * * @param [. . .] * Any number of additional arguments. Each argument will appear in * a new line. * * @example * dim.log("Five="+5, "--- new line ---"); * */ dim.log = function() { /* [native code] */ } /** * * Posts a message to the dim network with alarm severity. * * Similar to dim.log, but the message is posted to the network * with alarm severity. This means that it is displayed in red * and the smartfact web-gui will play an alarm sound. * The alarm state will stay valid (displayed in the web-gui) until it * is reset. * * @param argument * Any kind of argument can be given. If it is not a String, it * is converted using the toString() member function. * * @param [. . .] * Any number of additional arguments. Each argument will appear as * individual alarm. * * @example * dim.alarm("Alarm for 30 seconds!"); * v8.sleep(30000); * dim.alarm(); */ dim.alarm = function() { /* [native code] */ } /** * * Send a dim command to a dim client. * * @param {String} commandId * The command id is a string and usually compiles like * 'SERVER/COMMAND' * * @param argument * Any kind of argument can be given. Arguments are internally * converted into strings using toString() and processed as * if they were typed on th console. * * @param [. . .] * Any number of additional arguments. * * @example * dim.send('DRIVE_CONTROL/TRACK_SOURCE 0.5 180 "Mrk 421"'); * dim.send('DRIVE_CONTROL/TRACK_SOURCE', 0.5, 180, 'Mrk 421'); * * @returns * A boolean value is returned whether the command was succesfully * posted into the network or not. Note that true does by no means * mean that the command was sucessfully received or even processed. */ dim.send = function() { /* [native code] */ } /** * Returns the state of the given server. * * @param {String} name * The name of the server of which you want to get the state. * * @throws * If number or type of arguments is wrong * * @returns {Object} * An object with the properties 'index' {Integer} and 'name' {String} * is returned if a connection to the server is established and * state information have been received, 'undefined' otherwise. If * the time of the last state change is available, it is stored * in the 'property'. If a server disconnected, a valid object will * be returned, but without any properties. */ dim.state = function() { /* [native code] */ } /** * Wait for the given state of a server. * * Note that the function is internally asynchornously checking the * state, that means that theoretically, a state could be missed if * it changes too fast. If this can happen callbacks have to be used. * * @param {String} name * The name of the server of which you want to wait for a state. * The name must not contain quotation marks. To wait for * "not the given state", prefix the server name with an * exclamation mark, e.g. "!DIM_CONTROL" * * @param {String,Integer} state * The state you want to wait for. It can either be given as an Integer * or as the corresponding short name. If given as String it must * not contain quotation marks. * * @param {Integer} [timeout] * An optional timeout. If no timeout is given or a timeout of undefined, * waiting will not stop until the condition is fulfilled. A timeout * of 0 is allowed and will essentially just check if the server is * in this state or not. If a negative value is given, exceptions are * suppressed and false is returned in case of timeout. As timeout * the absolute value is used. * * @throws *
* * If a state change is defined for a server for which no callback * has been set, the special entry '*' is checked. * * * @type Array[Function] * * @example * dim.onchange['*'] = function(state) { console.out("State change from "+state.name+" received"); } * dim.onchange['DIM_CONTROL'] = function(state) { console.out(JSON.stringify(state); } * ... * delete dim.onchange['DIM_CONTROL']; // to remove the callback * */ dim.onchange = []; /** * DIM version number * * @constant * @type Integer */ dim.version = 0;