1 | throw new Error("Description for built in functions. Must not be included!");
|
---|
2 | /**
|
---|
3 | * @fileOverview
|
---|
4 | * Documentation of the dimctrl namespace
|
---|
5 | */
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * @namespace
|
---|
9 | *
|
---|
10 | * Global namespace for functions dealing with the dimctrl state
|
---|
11 | *
|
---|
12 | * @author <a href="mailto:thomas.bretz@epfl.ch">Thomas Bretz</a>
|
---|
13 | */
|
---|
14 | var dimctrl = { };
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Define a new internal state.
|
---|
18 | *
|
---|
19 | * States should be defined when a script is started.
|
---|
20 | *
|
---|
21 | * @param {Integer} index
|
---|
22 | * The intgeger number assigned to the new state. Only numbers
|
---|
23 | * in the range [10, 255] are allowed.
|
---|
24 | *
|
---|
25 | * @param {String} [name]
|
---|
26 | * A short name describing the state. According the the convention
|
---|
27 | * used throughout FACT++, it it must not contain whitespaces or
|
---|
28 | * underscores. Ever word should start with a capital letter,
|
---|
29 | * e.g. 'TriggerOn'
|
---|
30 | *
|
---|
31 | * @param {String} [decription]
|
---|
32 | * A user defined string which gives a more conscise explanation
|
---|
33 | * of the meaning of the state and can also be displayed in the GUI
|
---|
34 | * or anywhere else automatically,
|
---|
35 | * e.g. "System setup and trigger switched on"
|
---|
36 | *
|
---|
37 | * @throws
|
---|
38 | * <li> if something is wrong with the supplied arguments (type, number)
|
---|
39 | * <li> when the index is out of range [10,255]
|
---|
40 | * <li> the given state name is empty
|
---|
41 | * <li> the given state name contains a colon or an equal sign
|
---|
42 | * <li> when a state with the same name or index was already
|
---|
43 | * <li> set since the script was started.
|
---|
44 | *
|
---|
45 | * @returns {Boolean}
|
---|
46 | * A boolean whether the state was newly added (true) or an existing
|
---|
47 | * one overwritten (false).
|
---|
48 | *
|
---|
49 | * @example
|
---|
50 | * dim.defineState(10, "StateTen", "This is state number ten");
|
---|
51 | */
|
---|
52 | dimctrl.defineState = function() { /* [native code] */ }
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Change the internal state.
|
---|
56 | *
|
---|
57 | * @param {Integer,String} state
|
---|
58 | * Either the name of the state to set or its index can be supplied.
|
---|
59 | *
|
---|
60 | * @throws
|
---|
61 | * <li> if something is wrong with the supplied arguments (type, number)
|
---|
62 | * <li> if a String is given and it is not found in the list of names
|
---|
63 | *
|
---|
64 | * @returns {Boolean}
|
---|
65 | * A boolean is returned whether setting the state wa sucessfull or
|
---|
66 | * not. If the function is not called at unexpected time, i.e.
|
---|
67 | * before the execution of the JavaScript has been started or
|
---|
68 | * after it has already be terminated, true should be returned
|
---|
69 | * always.
|
---|
70 | *
|
---|
71 | * @example
|
---|
72 | * dim.setState(10);
|
---|
73 | * dim.setState("StateTen");
|
---|
74 | */
|
---|
75 | dimctrl.setState = function() { /* [native code] */ }
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Get the current internal state.
|
---|
79 | *
|
---|
80 | * @throws
|
---|
81 | * if arguments are supplied
|
---|
82 | *
|
---|
83 | * @returns {Object}
|
---|
84 | * An object with the properties index {Number}, name {String} and
|
---|
85 | * description {String}. Note that name and description might be
|
---|
86 | * an empty string.
|
---|
87 | *
|
---|
88 | * @example
|
---|
89 | * var state = dim.getState();
|
---|
90 | * console.out(JSON.stringify(state));
|
---|
91 | */
|
---|
92 | dimctrl.getState = function() { /* [native code] */ }
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Set an interrupt handler, a function which is called if an
|
---|
96 | * interrupt is received, e.g. via dim (dimctrl --interrupt).
|
---|
97 | * Note that the interrupt handler is executed in its own JavaScript
|
---|
98 | * thread. Thus it interrupts the execution of the script, but does
|
---|
99 | * not stop its execution. Please also note that this is a callback
|
---|
100 | * from the main loop. As long as the handler is executed, no other
|
---|
101 | * event (dim or command interface) will be processed.
|
---|
102 | *
|
---|
103 | * @param {Function} [func]
|
---|
104 | * Function to be called when an interrupt is received. Null, undefined
|
---|
105 | * or no argument to remove the handler.
|
---|
106 | *
|
---|
107 | * @throws
|
---|
108 | * if number of type of arguments is wrong
|
---|
109 | *
|
---|
110 | * @example
|
---|
111 | * function handleIrq(payload, time, user)
|
---|
112 | * {
|
---|
113 | * console.out("Data received: "+payload);
|
---|
114 | * console.out("Interrupt time: "+time);
|
---|
115 | * console.out("Issuing user: "+user);
|
---|
116 | * }
|
---|
117 | * dimctrl.setInterruptHandler(handleIrq);
|
---|
118 | */
|
---|
119 | dimctrl.setInterruptHandler = function() { /* [native code] */ }
|
---|