270 /* |
270 /* |
271 * Only allow certain types to edit. Auto detected hardware cannot be changed. |
271 * Only allow certain types to edit. Auto detected hardware cannot be changed. |
272 */ |
272 */ |
273 $outstr .= ' <tr class="editor">'.PHP_EOL; |
273 $outstr .= ' <tr class="editor">'.PHP_EOL; |
274 $outstr .= ' <td class="editname">Device Type</td>'.PHP_EOL; |
274 $outstr .= ' <td class="editname">Device Type</td>'.PHP_EOL; |
275 if (($type == "W1") || ($type == "GPIO")) |
275 if (($type == "W1") || ($type == "GPIO") || ($type == "SIM")) |
276 $outstr .= ' <td class="editfield"><input type="hidden" name="Type" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
276 $outstr .= ' <td class="editfield"><input type="hidden" name="Type" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
277 else |
277 else |
278 $outstr .= ' <td class="editfield"><input type="text" name="Type" size="50" value="'.$f[1].'"></td>'.PHP_EOL; |
278 $outstr .= ' <td class="editfield"><input type="text" name="Type" size="50" value="'.$f[1].'"></td>'.PHP_EOL; |
|
279 $outstr .= ' </tr>'.PHP_EOL; |
|
280 } |
|
281 if ($f[0] == "ADDRESS") { |
|
282 $address = $f[1]; |
|
283 $outstr .= ' <tr class="editor">'.PHP_EOL; |
|
284 $outstr .= ' <td class="editname">Address</td>'.PHP_EOL; |
|
285 if (($type == "W1") || ($type == "GPIO")) |
|
286 $outstr .= ' <td class="editfield"><input type="hidden" name="Address" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
|
287 else |
|
288 $outstr .= ' <td class="editfield"><input type="text" name="Address" size="50" value="'.$f[1].'"></td>'.PHP_EOL; |
279 $outstr .= ' </tr>'.PHP_EOL; |
289 $outstr .= ' </tr>'.PHP_EOL; |
280 } |
290 } |
281 if ($f[0] == "DIRECTION") { |
291 if ($f[0] == "DIRECTION") { |
282 $direction = $f[1]; |
292 $direction = $f[1]; |
283 /* |
293 /* |
284 * Only devices that cannot auto detect can be changed. |
294 * Only devices that cannot auto detect can be changed. |
285 */ |
295 */ |
286 $outstr .= ' <tr class="editor">'.PHP_EOL; |
296 $outstr .= ' <tr class="editor">'.PHP_EOL; |
287 $outstr .= ' <td class="editname">IO Direction and mode</td>'.PHP_EOL; |
297 $outstr .= ' <td class="editname">IO Direction and mode</td>'.PHP_EOL; |
288 if ($type == "W1") |
298 if ($type == "W1") { |
289 $outstr .= ' <td class="editfield"><input type="hidden" name="Direction" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
299 if ((strncmp($address, "29", 2) == 0) || (strncmp($address, "3a", 2) == 0)) { |
290 else { |
300 $outstr .= ' <td class="editfield"><select name="Direction">'.PHP_EOL; |
291 $outstr .= ' <td class="editfield"><select name="Direction">'.PHP_EOL; |
|
292 if ($type == "GPIO") { |
|
293 $se = ($f[1] == "UNDEF")?" selected":""; |
301 $se = ($f[1] == "UNDEF")?" selected":""; |
294 $outstr .= ' <option value="UNDEF"'.$se.'>Undefined</option>'.PHP_EOL; |
302 $outstr .= ' <option value="UNDEF"'.$se.'>Undefined</option>'.PHP_EOL; |
295 $se = ($f[1] == "IN_BIN")?" selected":""; |
303 $se = ($f[1] == "IN_BIN")?" selected":""; |
296 $outstr .= ' <option value="IN_BIN"'.$se.'>Binary input</option>'.PHP_EOL; |
304 $outstr .= ' <option value="IN_BIN"'.$se.'>Binary input</option>'.PHP_EOL; |
297 $se = ($f[1] == "OUT_BIN")?" selected":""; |
305 $se = ($f[1] == "OUT_BIN")?" selected":""; |
298 $outstr .= ' <option value="OUT_BIN"'.$se.'>Binary output</option>'.PHP_EOL; |
306 $outstr .= ' <option value="OUT_BIN"'.$se.'>Binary output</option>'.PHP_EOL; |
299 $se = ($f[1] == "OUT_PWM")?" selected":""; |
307 $se = ($f[1] == "OUT_PWM")?" selected":""; |
300 $outstr .= ' <option value="OUT_PWM"'.$se.'>PWM output</option>'.PHP_EOL; |
308 $outstr .= ' <option value="OUT_PWM"'.$se.'>PWM output</option>'.PHP_EOL; |
301 } |
309 $outstr .= ' </select></td>'.PHP_EOL; |
302 if ($type == "RC433") { |
310 } else { |
303 $se = ($f[1] == "UNDEF")?" selected":""; |
311 $outstr .= ' <td class="editfield"><input type="hidden" name="Direction" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
304 $outstr .= ' <option value="UNDEF"'.$se.'>Undefined</option>'.PHP_EOL; |
312 } |
|
313 } else { |
|
314 $outstr .= ' <td class="editfield"><select name="Direction">'.PHP_EOL; |
|
315 if ($type == "GPIO") { |
|
316 $se = ($f[1] == "UNDEF")?" selected":""; |
|
317 $outstr .= ' <option value="UNDEF"'.$se.'>Undefined</option>'.PHP_EOL; |
|
318 $se = ($f[1] == "IN_BIN")?" selected":""; |
|
319 $outstr .= ' <option value="IN_BIN"'.$se.'>Binary input</option>'.PHP_EOL; |
305 $se = ($f[1] == "OUT_BIN")?" selected":""; |
320 $se = ($f[1] == "OUT_BIN")?" selected":""; |
306 $outstr .= ' <option value="OUT_BIN"'.$se.'>Binary output</option>'.PHP_EOL; |
321 $outstr .= ' <option value="OUT_BIN"'.$se.'>Binary output</option>'.PHP_EOL; |
|
322 $se = ($f[1] == "OUT_PWM")?" selected":""; |
|
323 $outstr .= ' <option value="OUT_PWM"'.$se.'>PWM output</option>'.PHP_EOL; |
|
324 } |
|
325 if ($type == "RC433") { |
|
326 $se = ($f[1] == "UNDEF")?" selected":""; |
|
327 $outstr .= ' <option value="UNDEF"'.$se.'>Undefined</option>'.PHP_EOL; |
|
328 $se = ($f[1] == "OUT_BIN")?" selected":""; |
|
329 $outstr .= ' <option value="OUT_BIN"'.$se.'>Binary output</option>'.PHP_EOL; |
307 } |
330 } |
308 if ($type == "DHT") { |
331 if ($type == "DHT") { |
309 $se = ($f[1] == "UNDEF")?" selected":""; |
332 $se = ($f[1] == "UNDEF")?" selected":""; |
310 $outstr .= ' <option value="UNDEF"'.$se.'>Undefined</option>'.PHP_EOL; |
333 $outstr .= ' <option value="UNDEF"'.$se.'>Undefined</option>'.PHP_EOL; |
311 $se = ($f[1] == "IN_ANALOG")?" selected":""; |
334 $se = ($f[1] == "IN_ANALOG")?" selected":""; |
335 $outstr .= ' <td class="editfield"><input type="hidden" name="Value" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
362 $outstr .= ' <td class="editfield"><input type="hidden" name="Value" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
336 $outstr .= ' </tr>'.PHP_EOL; |
363 $outstr .= ' </tr>'.PHP_EOL; |
337 } |
364 } |
338 if ($f[0] == "OFFSET") { |
365 if ($f[0] == "OFFSET") { |
339 $outstr .= ' <tr class="editor">'.PHP_EOL; |
366 $outstr .= ' <tr class="editor">'.PHP_EOL; |
340 $outstr .= ' <td class="editname">Value</td>'.PHP_EOL; |
367 $outstr .= ' <td class="editname">Offset</td>'.PHP_EOL; |
341 if ($direction == "IN_ANALOG") |
368 if ($direction == "IN_ANALOG") |
342 $outstr .= ' <td class="editfield"><input type="text" name="Offset" size="50" value="'.$f[1].'"></td>'.PHP_EOL; |
369 $outstr .= ' <td class="editfield"><input type="text" name="Offset" size="50" value="'.$f[1].'"></td>'.PHP_EOL; |
343 else |
370 else |
344 $outstr .= ' <td class="editfield"><input type="hidden" name="Offset" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
371 $outstr .= ' <td class="editfield"><input type="hidden" name="Offset" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
345 $outstr .= ' </tr>'.PHP_EOL; |
372 $outstr .= ' </tr>'.PHP_EOL; |
362 $outstr .= ' <option value="YES"'.$se.'>Present and Ok</option>'.PHP_EOL; |
389 $outstr .= ' <option value="YES"'.$se.'>Present and Ok</option>'.PHP_EOL; |
363 $se = ($f[1] == "ERROR")?" selected":""; |
390 $se = ($f[1] == "ERROR")?" selected":""; |
364 $outstr .= ' <option value="ERROR"'.$se.'>Present and Error</option>'.PHP_EOL; |
391 $outstr .= ' <option value="ERROR"'.$se.'>Present and Error</option>'.PHP_EOL; |
365 $outstr .= ' </select></td>'.PHP_EOL; |
392 $outstr .= ' </select></td>'.PHP_EOL; |
366 } |
393 } |
367 $outstr .= ' </tr>'.PHP_EOL; |
|
368 } |
|
369 if ($f[0] == "ADDRESS") { |
|
370 $outstr .= ' <tr class="editor">'.PHP_EOL; |
|
371 $outstr .= ' <td class="editname">Address</td>'.PHP_EOL; |
|
372 if (($type == "W1") || ($type == "GPIO")) |
|
373 $outstr .= ' <td class="editfield"><input type="hidden" name="Address" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; |
|
374 else |
|
375 $outstr .= ' <td class="editfield"><input type="text" name="Address" size="50" value="'.$f[1].'"></td>'.PHP_EOL; |
|
376 $outstr .= ' </tr>'.PHP_EOL; |
394 $outstr .= ' </tr>'.PHP_EOL; |
377 } |
395 } |
378 if ($f[0] == "SUBDEVICE") { |
396 if ($f[0] == "SUBDEVICE") { |
379 $outstr .= ' <tr class="editor">'.PHP_EOL; |
397 $outstr .= ' <tr class="editor">'.PHP_EOL; |
380 $outstr .= ' <td class="editname">Subdevice</td>'.PHP_EOL; |
398 $outstr .= ' <td class="editname">Subdevice</td>'.PHP_EOL; |