92 if ((strcmp($vals[0], "FAN_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
94 if ((strcmp($vals[0], "FAN_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) { |
93 $fan = "yes"; |
95 $fan = "yes"; |
94 } |
96 } |
95 if (strcmp($vals[0], "FAN_STATE") == 0) { |
97 if (strcmp($vals[0], "FAN_STATE") == 0) { |
96 $fan_state = $vals[1]; |
98 $fan_state = $vals[1]; |
|
99 } |
|
100 if (strcmp($vals[0], "PROFILE") == 0) { |
|
101 $profile = $vals[1]; |
|
102 } |
|
103 if (strcmp($vals[0], "PROF_STATE") == 0) { |
|
104 $prof_state = $vals[1]; |
97 } |
105 } |
98 if (($vals[0] == "BEER_SET") && ($mode == "BEER")) { |
106 if (($vals[0] == "BEER_SET") && ($mode == "BEER")) { |
99 $set_temperature = $vals[1]; |
107 $set_temperature = $vals[1]; |
100 } |
108 } |
101 if (($vals[0] == "FRIDGE_SET") && ($mode == "FRIDGE")) { |
109 if (($vals[0] == "FRIDGE_SET") && ($mode == "FRIDGE")) { |
201 strcmp($mode, "PROFILE") ? $se = "" : $se = " checked"; |
209 strcmp($mode, "PROFILE") ? $se = "" : $se = " checked"; |
202 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="PROFILE"'.$se.$dis.'>Profile'.PHP_EOL; |
210 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="PROFILE"'.$se.$dis.'>Profile'.PHP_EOL; |
203 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
211 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL; |
204 $outstr .= ' </form>'.PHP_EOL; |
212 $outstr .= ' </form>'.PHP_EOL; |
205 $outstr .= ' </div>'.PHP_EOL; |
213 $outstr .= ' </div>'.PHP_EOL; |
|
214 |
206 $outstr .= ' <div id="fermentor_powerled">'.PHP_EOL; |
215 $outstr .= ' <div id="fermentor_powerled">'.PHP_EOL; |
207 $outstr .= ' <img src="images/led_green_'.$power_led.'.png"><br>Pwr'.PHP_EOL; |
216 $outstr .= ' <img src="images/led_green_'.$power_led.'.png"><br>Pwr'.PHP_EOL; |
|
217 $outstr .= ' </div>'.PHP_EOL; |
|
218 |
|
219 $outstr .= ' <div id="fermentor_mode_control">'.PHP_EOL; |
|
220 if ($mode == "FRIDGE") { |
|
221 $outstr .= ' <form id="set_fridge_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
|
222 $outstr .= ' <input type="text" name="Fridge" size="5" value="'.$set_temperature.'"><br>'.PHP_EOL; |
|
223 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL; |
|
224 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
|
225 $outstr .= ' </form>'.PHP_EOL; |
|
226 } |
|
227 if ($mode == "BEER") { |
|
228 $outstr .= ' <form id="set_beer_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
|
229 $outstr .= ' <input type="text" name="Beer" size="5" value="'.$set_temperature.'">'.PHP_EOL; |
|
230 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL; |
|
231 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
|
232 $outstr .= ' </form>'.PHP_EOL; |
|
233 } |
|
234 if ($mode == "PROFILE") { |
|
235 /* |
|
236 * First, load a list with available profiles. |
|
237 */ |
|
238 $sock = open_socket(); |
|
239 if ($sock == true) { |
|
240 socket_write($sock, "PROFILE LIST", 4096); |
|
241 $answer = ""; |
|
242 while (1) { |
|
243 $line = socket_read($sock, 4096); |
|
244 if ($line === '') |
|
245 break; |
|
246 $answer .= $line; |
|
247 } |
|
248 socket_close($sock); |
|
249 $reply = explode("\r\n", $answer); |
|
250 } |
|
251 |
|
252 /* |
|
253 * Show loaded profile. |
|
254 */ |
|
255 if ($profile == "(null)") { |
|
256 $prof_name = "None"; |
|
257 }else { |
|
258 if (startsWith($reply[0], "212")) { |
|
259 $i = 1; |
|
260 while (1) { |
|
261 if (strcmp($reply[$i], ".") == 0) |
|
262 break; |
|
263 $f = explode(",", $reply[$i]); |
|
264 if ($f[0] == $profile) { |
|
265 $prof_name = $f[1]; |
|
266 break; |
|
267 } |
|
268 $i++; |
|
269 } |
|
270 } |
|
271 } |
|
272 $outstr .= ' <div style="color: blue; width: 148px; height: 20px; overflow: hidden;">Profile: '.$prof_name.'</div>'.PHP_EOL; |
|
273 |
|
274 $outstr .= ' <form id="set_profile_'.$unr.'" action="index.php" method="post">'.PHP_EOL; |
|
275 if ($prof_state == "OFF") { |
|
276 $outstr .= ' <select name="SetProfile" style="width: 130px;">'.PHP_EOL; |
|
277 $outstr .= ' <option value="">None</option>'.PHP_EOL; |
|
278 if (startsWith($reply[0], "212")) { |
|
279 $i = 1; |
|
280 while (1) { |
|
281 if (strcmp($reply[$i], ".") == 0) |
|
282 break; |
|
283 $f = explode(",", $reply[$i]); |
|
284 if ($f[2] > 0) { |
|
285 ($f[0] == $profile) ? $se = " selected" : $se = ""; |
|
286 $outstr .= ' <option value="'.$f[0].'"'.$se.'>'.$f[1].'</option>'.PHP_EOL; |
|
287 } |
|
288 $i++; |
|
289 } |
|
290 } |
|
291 $outstr .= ' </select>'.PHP_EOL; |
|
292 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL; |
|
293 if ($profile != "(null)") |
|
294 $outstr .= ' <input type="submit" value="Start" name="key">'.PHP_EOL; |
|
295 |
|
296 } else if ($prof_state == "RUN") { |
|
297 } else if ($prof_state == "PAUSE") { |
|
298 } else if ($prof_state == "DONE") { |
|
299 } |
|
300 //$outstr .= ' <input type="text" name="Beer" size="5" value="'.$set_temperature.'">'.PHP_EOL; |
|
301 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL; |
|
302 $outstr .= ' </form>'.PHP_EOL; |
|
303 } |
208 $outstr .= ' </div>'.PHP_EOL; |
304 $outstr .= ' </div>'.PHP_EOL; |
209 $outstr .= ' </div> <!-- fermentor_panel_top -->'.PHP_EOL; |
305 $outstr .= ' </div> <!-- fermentor_panel_top -->'.PHP_EOL; |
210 |
306 |
211 $outstr .= ' <div id="fermentor_panel_display">'.PHP_EOL; |
307 $outstr .= ' <div id="fermentor_panel_display">'.PHP_EOL; |
212 $outstr .= ' <div id="fermentor_display1">'.PHP_EOL; |
308 $outstr .= ' <div id="fermentor_display1">'.PHP_EOL; |