Tue, 07 May 2019 22:03:38 +0200
Finished websockets screens.
0 | 1 | document.getElementById("test").innerHTML = "WebSocket is not connected"; |
2 | ||
3 | var websocket = new WebSocket('ws://'+location.hostname+'/ws'); | |
4 | ||
42 | 5 | var Beep= new Audio( "data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+ Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYY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cJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb//////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=" ); |
0 | 6 | |
7 | var BBScreen={ | |
8 | ||
40
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
9 | Screen: -1, |
42 | 10 | Subscreen: 0, |
11 | setTimer: function(v){ | |
12 | $("#timer").text(''); | |
13 | if (v == 0) { | |
14 | $("#timer").css("font-size", "18px"); | |
15 | $("#timer").css("font-weight", "normal"); | |
16 | $("#timer").css("font-family", "Verdana, Arial, sans-serif"); | |
17 | } else { | |
18 | $("#timer").css("font-size", "36px"); | |
19 | $("#timer").css("font-weight", "bold"); | |
20 | $("#timer").css("font-family", "Courier New, Lucida Console"); | |
21 | } | |
22 | }, | |
23 | clearScreen: function(){ | |
24 | $("#mltline").hide(); | |
25 | $("#mlt_table").hide(); | |
26 | $("#mlt00").hide(); | |
27 | $("#mlt20").hide(); | |
28 | $("#mlt01").hide(); | |
29 | $("#mlt21").hide(); | |
30 | $("#midline").hide(); | |
31 | this.setTimer(0); | |
32 | $("#mid00").hide(); | |
33 | $("#mid20").hide(); | |
34 | $("#mid00").css("background-color", "#e7e7e7"); | |
35 | $("#mid00").css("color", "black"); | |
36 | $("#hltline").hide(); | |
37 | $("#hlt_table").hide(); | |
38 | $("#hlt00").hide(); | |
39 | $("#hlt20").hide(); | |
40 | $("#hlt01").hide(); | |
41 | $("#hlt21").hide(); | |
42 | $("#hlt01").css("background-color", "#e7e7e7"); | |
43 | $("#hlt01").css("color", "black"); | |
44 | $("#row_info").hide(); | |
45 | $("#prompt").hide(); | |
46 | $("#button_nee").css("background-color", "#e7e7e7"); | |
47 | $("#button_nee").css("color", "black"); | |
48 | $("#note").hide(); | |
49 | $("#brew").hide(); | |
50 | }, | |
40
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
51 | setScreen: function(s){ |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
52 | Screen = parseInt(s,10); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
53 | switch (Screen) { |
42 | 54 | case 0: this.clearScreen(); |
55 | $("#mltline").show(); | |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
56 | $("#mlt_table").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
57 | $("#but00").text('Hand'); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
58 | $("#but20").text('Auto'); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
59 | $("#mlt00").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
60 | $("#mlt20").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
61 | $("#midline").show(); |
42 | 62 | this.setTimer(0); |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
63 | $("#hltline").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
64 | $("#hlt_table").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
65 | $("#hlt01").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
66 | $("#but04").text('Info'); |
42 | 67 | // No tools button on the web. |
40
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
68 | break; |
42 | 69 | case 2: this.clearScreen(); |
40
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
70 | $("#row_info").show(); |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
71 | break; |
42 | 72 | case 96: break; // Automaat show recipe and Stop / Start |
73 | case 98: break; // Delay start | |
74 | case 99: this.clearScreen(); // heatup | |
75 | $("#mltline").show(); | |
76 | $("#mlt_table").show(); | |
77 | $("#midline").show(); | |
78 | $("#hltline").show(); | |
79 | $("#hlt_table").show(); | |
80 | break; | |
81 | case 100: // All handled at Subscreen | |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
82 | case 101: |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
83 | case 102: |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
84 | case 103: |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
85 | case 104: |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
86 | case 105: |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
87 | case 106: |
42 | 88 | case 107: break; |
89 | case 108: this.clearScreen(); | |
90 | $("#mltline").show(); // to boil | |
91 | $("#mlt_table").show(); | |
92 | $("#mlt00").show(); | |
93 | $("#mlt20").show(); | |
94 | $("#but00").text('+sp'); | |
95 | $("#but20").text('-sp'); | |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
96 | break; |
42 | 97 | case 109: this.clearScreen(); |
98 | $("#mltline").show(); // boil | |
99 | $("#mlt_table").show(); | |
100 | $("#mlt00").show(); | |
101 | $("#mlt20").show(); | |
102 | $("#but00").text('+sp'); | |
103 | $("#but20").text('-sp'); | |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
104 | $("#midline").show(); |
42 | 105 | $("#mid00").show(); |
106 | $("#mid20").show(); | |
107 | $("#but02").text('+%'); | |
108 | $("#but22").text('-%'); | |
109 | this.setTimer(1); | |
110 | $("#hltline").show(); | |
111 | $("#hlt01").show(); | |
112 | $("#hlt21").show(); | |
113 | $("#but04").text('+1m'); | |
114 | $("#but24").text('-1m'); | |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
115 | break; |
42 | 116 | case 110: // whirlpool 9 |
117 | case 111: // cooling H | |
118 | case 112: // whirlpool 7 | |
119 | case 113: // cooling M | |
120 | case 114: // whirlpool 6 | |
121 | case 115: // cooling C | |
122 | case 116: // whirlpool 2 | |
123 | break; | |
124 | case 117: this.clearScreen(); | |
125 | $("#note").show(); | |
126 | $("#note_msg").text('Brouwen is gereed.'); | |
127 | break; | |
128 | case 118: this.clearScreen(); | |
129 | $("#note").show(); | |
130 | $("#note_msg").text('Brouwen is afgebroken.'); | |
131 | break; | |
132 | case 97: | |
133 | case 200: this.clearScreen(); | |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
134 | $("#prompt").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
135 | break; |
42 | 136 | case 201: this.clearScreen(); |
137 | $("#mltline").show(); | |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
138 | $("#but00").text('+sp'); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
139 | $("#but20").text('-sp'); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
140 | $("#but01").text('Pomp'); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
141 | $("#but21").text('Aan'); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
142 | $("#midline").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
143 | $("#hltline").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
144 | $("#but03").text('+sp'); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
145 | $("#but23").text('-sp'); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
146 | $("#but04").text('Stop'); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
147 | $("#but24").text('Aan'); |
42 | 148 | $("#hlt01").show(); |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
149 | $("#hlt01").css("background-color", "#575757"); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
150 | $("#hlt01").css("color", "white"); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
151 | break; |
42 | 152 | default: this.clearScreen(); |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
153 | console.log("this is default screen "+Screen); |
40
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
154 | break; |
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
155 | } |
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
156 | }, |
42 | 157 | setSubscreen: function(s){ |
158 | Subscreen = parseInt(s,10); | |
159 | console.log("Screen:"+Screen+" Sub:"+Subscreen); | |
160 | if (Screen == 96) { | |
161 | this.clearScreen(); | |
162 | if (Subscreen == 0) { | |
163 | $("#prompt").show(); | |
164 | $("#button_ja").text('Ja'); | |
165 | $("#button_nee").text('Nee'); | |
166 | } else if (Subscreen == 1) { | |
167 | $("#brew").show(); | |
168 | } | |
169 | } else if ((Screen >= 100) && (Screen < 108)) { | |
170 | this.clearScreen(); | |
171 | $("#mltline").show(); | |
172 | $("#mlt_table").show(); | |
173 | $("#midline").show(); | |
174 | $("#hltline").show(); | |
175 | $("#hlt_table").show(); | |
176 | switch (Subscreen) { | |
177 | case 0: // MASH_NONE | |
178 | case 1: // MASH_WAITTEMP | |
179 | $("#mlt00").show(); | |
180 | $("#mlt20").show(); | |
181 | $("#but00").text('+sp'); | |
182 | $("#but20").text('-sp'); | |
183 | break; | |
184 | case 2: // MASH_REST | |
185 | this.setTimer(1); | |
186 | $("#mid00").show(); | |
187 | $("#mid20").show(); | |
188 | $("#but02").text('+1m'); | |
189 | $("#but22").text('-1m'); | |
190 | break; | |
191 | case 3: // MASH_ADD | |
192 | case 4: // MASH_IODINE | |
193 | case 5: // MASH_REMOVE | |
194 | case 6: // MASH_INFUSE | |
195 | this.setTimer(0); | |
196 | $("#mid00").show(); | |
197 | $("#mid00").css("background-color", "#575757"); | |
198 | $("#mid00").css("color", "white"); | |
199 | $("#mid20").show(); | |
200 | $("#but02").text('Halt'); | |
201 | $("#but22").text('Ok'); | |
202 | break; | |
203 | }; | |
204 | } else if ((Screen == 111) || (Screen == 113) || (Screen == 115)) { // cooling H,M,C | |
205 | this.clearScreen(); | |
206 | if (Subscreen == 0) { | |
207 | $("#prompt").show(); | |
208 | $("#button_ja").text('Start'); | |
209 | $("#button_nee").text('Stop'); | |
210 | $("#button_nee").css("background-color", "#575757"); | |
211 | $("#button_nee").css("color", "white"); | |
212 | } else if (Subscreen == 1) { | |
213 | $("#mltline").show(); | |
214 | $("#mlt_table").show(); | |
215 | $("#mlt00").show(); | |
216 | $("#mlt20").show(); | |
217 | $("#but00").text('+1'); | |
218 | $("#but20").text('-1'); | |
219 | $("#hltline").show(); | |
220 | $("#hlt01").show(); | |
221 | $("#but04").text('Stop'); | |
222 | $("#hlt01").css("background-color", "#575757"); | |
223 | $("#hlt01").css("color", "white"); | |
224 | } | |
225 | } else if ((Screen == 110) || (Screen == 112) || (Screen == 114) || (Screen == 116)) { // whirlpools | |
226 | this.clearScreen(); | |
227 | if (Subscreen == 0) { | |
228 | $("#prompt").show(); | |
229 | $("#button_ja").text('Start'); | |
230 | $("#button_nee").text('Stop'); | |
231 | $("#button_nee").css("background-color", "#575757"); | |
232 | $("#button_nee").css("color", "white"); | |
233 | } else if (Subscreen == 1) { | |
234 | $("#mltline").show(); | |
235 | $("#mlt_table").show(); | |
236 | $("#midline").show(); | |
237 | this.setTimer(1); | |
238 | $("#mid00").show(); | |
239 | $("#mid20").show(); | |
240 | $("#but02").text('-1m'); | |
241 | $("#but22").text('+1m'); | |
242 | $("#hltline").show(); | |
243 | $("#hlt21").show(); | |
244 | $("#but24").text('Pomp'); | |
245 | } | |
246 | }; | |
247 | }, | |
0 | 248 | MLT_pv: function(s) { |
249 | $("#mlt_pv").text(s); | |
250 | }, | |
251 | MLT_sp: function(s) { | |
252 | $("#mlt_sp").text(s); | |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
253 | if (Screen == 201) { |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
254 | if (s != "") { |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
255 | $("#mlt00").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
256 | $("#mlt20").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
257 | $("#mlt01").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
258 | $("#mlt21").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
259 | $("#mlt_table").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
260 | } |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
261 | } |
0 | 262 | }, |
263 | MLT_power: function(s) { | |
264 | $("#mlt_power").text(s); | |
42 | 265 | if (Screen == 201) { |
266 | if (s != "") { | |
267 | $("#but21").text('Uit'); | |
268 | } else { | |
269 | $("#but21").text('Aan'); | |
270 | } | |
271 | } | |
0 | 272 | }, |
273 | MLT_led: function(s) { | |
274 | if (s == 0) | |
275 | $("#mlt_led").css("background-color", "#270"); | |
276 | else | |
277 | $("#mlt_led").css("background-color", "#5E0"); | |
278 | }, | |
279 | Pump_led: function(s) { | |
280 | if (s == 0) | |
281 | $("#pump_led").css("background-color", "#820"); | |
282 | else | |
283 | $("#pump_led").css("background-color", "#F40"); | |
284 | }, | |
285 | HLT_pv: function(s) { | |
286 | $("#hlt_pv").text(s); | |
287 | }, | |
288 | HLT_sp: function(s) { | |
289 | $("#hlt_sp").text(s); | |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
290 | if (Screen == 201) { |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
291 | if (s != "") { |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
292 | $("#hlt00").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
293 | $("#hlt20").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
294 | $("#hlt21").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
295 | $("#hlt_table").show(); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
296 | } |
42 | 297 | } |
0 | 298 | }, |
299 | HLT_power: function(s) { | |
300 | $("#hlt_power").text(s); | |
42 | 301 | if (Screen == 201) { |
302 | if (s != "") { | |
303 | $("#but24").text('Uit'); | |
304 | } else { | |
305 | $("#but24").text('Aan'); | |
306 | } | |
307 | } | |
0 | 308 | }, |
309 | HLT_led: function(s) { | |
310 | if (s == 0) | |
311 | $("#hlt_led").css("background-color", "#270"); | |
312 | else | |
313 | $("#hlt_led").css("background-color", "#5E0"); | |
314 | }, | |
315 | Topmessage: function(s) { | |
316 | $("#top_msg").text(s); | |
317 | }, | |
318 | Timer: function(s) { | |
319 | $("#timer").text(s); | |
320 | }, | |
42 | 321 | Brew1: function(s) { |
322 | $("#brew_msg1").text(s); | |
323 | }, | |
324 | Brew2: function(s) { | |
325 | $("#brew_msg2").text(s); | |
326 | }, | |
327 | Beep: function(s) { | |
328 | var loop = parseInt(s,10); | |
329 | Beep.pause(); | |
330 | Beep.loop = false; | |
331 | for (i = 0; i < loop; i++) { | |
332 | Beep.play(); | |
333 | } | |
334 | }, | |
0 | 335 | }; |
336 | ||
337 | var BrewBoard = { | |
338 | ||
339 | p_msg:function(e){ | |
340 | var b=this; | |
341 | var a=JSON.parse(e); | |
342 | var c={ | |
40
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
343 | main: function(v){ |
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
344 | BBScreen.setScreen(v) |
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
345 | }, |
42 | 346 | sub: function(v){ |
347 | BBScreen.setSubscreen(v) | |
348 | }, | |
0 | 349 | mlt_pv:function(v){ |
350 | BBScreen.MLT_pv(v) | |
351 | }, | |
352 | mlt_sp:function(v){ | |
353 | BBScreen.MLT_sp(v) | |
354 | }, | |
355 | mlt_power:function(v){ | |
356 | BBScreen.MLT_power(v) | |
357 | }, | |
358 | mlt_led:function(v){ | |
359 | BBScreen.MLT_led(v) | |
360 | }, | |
361 | pump_led:function(v){ | |
362 | BBScreen.Pump_led(v) | |
363 | }, | |
364 | hlt_pv:function(v){ | |
365 | BBScreen.HLT_pv(v) | |
366 | }, | |
367 | hlt_sp:function(v){ | |
368 | BBScreen.HLT_sp(v) | |
369 | }, | |
370 | hlt_power:function(v){ | |
371 | BBScreen.HLT_power(v) | |
372 | }, | |
373 | hlt_led:function(v){ | |
374 | BBScreen.HLT_led(v) | |
375 | }, | |
376 | top_msg:function(v){ | |
377 | BBScreen.Topmessage(v) | |
378 | }, | |
379 | timer:function(v){ | |
380 | BBScreen.Timer(v) | |
381 | }, | |
42 | 382 | beep:function(v){ |
383 | BBScreen.Beep(v) | |
384 | }, | |
385 | brew1:function(v){ | |
386 | BBScreen.Brew1(v) | |
387 | }, | |
388 | brew2:function(v){ | |
389 | BBScreen.Brew2(v) | |
390 | }, | |
0 | 391 | }; |
392 | $.each(a,function(k,v){ | |
393 | if (typeof(c[k])!="undefined"){ | |
394 | c[k](v) | |
395 | } | |
396 | }); | |
397 | } | |
398 | }; | |
399 | ||
400 | ||
40
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
401 | function sendTouch(x, y) { |
42 | 402 | websocket.send('{"touch":{"x":'+x+',"y":'+y+'}}'); |
0 | 403 | } |
404 | ||
405 | ||
40
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
406 | /* Define keys in the screens and their actions. */ |
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
407 | $("#ok_info").click( function() { sendTouch(160,220); }); |
42 | 408 | $("#ok_note").click( function() { sendTouch(160,220); }); |
41
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
409 | $("#mlt00").click( function() { sendTouch( 35, 46); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
410 | $("#mlt20").click( function() { sendTouch(285, 46); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
411 | $("#mlt01").click( function() { sendTouch( 35, 96); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
412 | $("#mlt21").click( function() { sendTouch(285, 96); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
413 | $("#mid00").click( function() { sendTouch( 35,140); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
414 | $("#mid20").click( function() { sendTouch(285,140); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
415 | $("#hlt00").click( function() { sendTouch( 35,170); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
416 | $("#hlt20").click( function() { sendTouch(285,170); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
417 | $("#hlt01").click( function() { sendTouch( 35,220); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
418 | $("#hlt21").click( function() { sendTouch(285,220); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
419 | $("#button_ja").click( function() { sendTouch( 80,120); }); |
7639cfa6aec0
Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
40
diff
changeset
|
420 | $("#button_nee").click( function() { sendTouch(240,120); }); |
42 | 421 | $("#button_stop").click( function() { sendTouch( 35,220); }); |
422 | $("#button_start").click( function() { sendTouch(285,220); }); | |
40
71e06f6d80fd
Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents:
11
diff
changeset
|
423 | |
0 | 424 | websocket.onopen = function(evt) { |
42 | 425 | console.log('WebSocket connection opened'); |
426 | document.getElementById("test").innerHTML = ""; | |
0 | 427 | } |
428 | ||
429 | /* | |
430 | * Process received websocket messages. | |
431 | */ | |
432 | websocket.onmessage = function(evt) { | |
433 | var msg = evt.data; | |
434 | var value; | |
435 | switch (msg.charAt(0)) { | |
436 | case '{': | |
437 | BrewBoard.p_msg(evt.data); | |
438 | break; | |
439 | default: | |
440 | document.getElementById("output").innerHTML = evt.data; | |
441 | break; | |
442 | } | |
443 | } | |
444 | ||
445 | websocket.onclose = function(evt) { | |
446 | console.log('Websocket connection closed'); | |
447 | document.getElementById("test").innerHTML = "WebSocket closed"; | |
448 | } | |
449 | ||
450 | websocket.onerror = function(evt) { | |
451 | console.log('Websocket error: ' + evt); | |
452 | document.getElementById("test").innerHTML = "WebSocket error????!!!1!!"; | |
453 | } | |
454 | ||
455 |