www-thermferm/devices.php

changeset 209
c5b1dfd83e81
parent 196
4d7a96c5d1ff
child 232
bee2600d3d30
equal deleted inserted replaced
208:934d45d9751d 209:c5b1dfd83e81
93 * 93 *
94 * @param string $_POST['UUID'] The device UUID 94 * @param string $_POST['UUID'] The device UUID
95 * @param string $_POST['Type'] The device Type 95 * @param string $_POST['Type'] The device Type
96 * @param string $_POST['Direction'] The device IO Direction 96 * @param string $_POST['Direction'] The device IO Direction
97 * @param string $_POST['Value'] The device value 97 * @param string $_POST['Value'] The device value
98 * @param string $_POST['Offset'] The device offset
98 * @param string $_POST['Present'] The device Present state 99 * @param string $_POST['Present'] The device Present state
99 * @param string $_POST['Address'] The device Address 100 * @param string $_POST['Address'] The device Address
100 * @param string $_POST['Subdevice'] The device Subaddress 101 * @param string $_POST['Subdevice'] The device Subaddress
101 * @param string $_POST['Gpiopin'] The device GPIO pin 102 * @param string $_POST['Gpiopin'] The device GPIO pin
102 * @param string $_POST['Description'] The device Description 103 * @param string $_POST['Description'] The device Description
122 socket_write($sock, "TYPE,".$_POST['Type'], 4096); 123 socket_write($sock, "TYPE,".$_POST['Type'], 4096);
123 usleep(20000); 124 usleep(20000);
124 socket_write($sock, "DIRECTION,".$_POST['Direction'], 4096); 125 socket_write($sock, "DIRECTION,".$_POST['Direction'], 4096);
125 usleep(20000); 126 usleep(20000);
126 socket_write($sock, "VALUE,".$_POST['Value'], 4096); 127 socket_write($sock, "VALUE,".$_POST['Value'], 4096);
128 usleep(20000);
129 socket_write($sock, "OFFSET,".$_POST['Offset'], 4096);
127 usleep(20000); 130 usleep(20000);
128 socket_write($sock, "PRESENT,".$_POST['Present'], 4096); 131 socket_write($sock, "PRESENT,".$_POST['Present'], 4096);
129 usleep(20000); 132 usleep(20000);
130 socket_write($sock, "ADDRESS,".$_POST['Address'], 4096); 133 socket_write($sock, "ADDRESS,".$_POST['Address'], 4096);
131 usleep(20000); 134 usleep(20000);
170 * 173 *
171 * @param string $_POST['UUID'] Unique record UUID 174 * @param string $_POST['UUID'] Unique record UUID
172 * @param string $_POST['Type'] Device Type 175 * @param string $_POST['Type'] Device Type
173 * @param string $_POST['Direction'] 176 * @param string $_POST['Direction']
174 * @param string $_POST['Value'] 177 * @param string $_POST['Value']
178 * @param string $_POST['Offset']
175 * @param string $_POST['Present'] 179 * @param string $_POST['Present']
176 * @param string $_POST['Address'] 180 * @param string $_POST['Address']
177 * @param string $_POST['Subdevice'] 181 * @param string $_POST['Subdevice']
178 * @param string $_POST['Gpiopin'] 182 * @param string $_POST['Gpiopin']
179 * @param string $_POST['Description'] 183 * @param string $_POST['Description']
191 */ 195 */
192 function test_thedata() { 196 function test_thedata() {
193 197
194 global $arr; 198 global $arr;
195 199
196 if (isset($_POST['UUID']) && isset($_POST['Type']) && isset($_POST['Direction']) && isset($_POST['Value']) && 200 if (isset($_POST['UUID']) && isset($_POST['Type']) && isset($_POST['Direction']) && isset($_POST['Value']) && isset($_POST['Offset']) &&
197 isset($_POST['Present']) && isset($_POST['Address']) && isset($_POST['Subdevice']) && isset($_POST['Gpiopin']) && 201 isset($_POST['Present']) && isset($_POST['Address']) && isset($_POST['Subdevice']) && isset($_POST['Gpiopin']) &&
198 isset($_POST['Description']) && isset($_POST['Comment']) && isset($_POST['key']) && isset($_POST['command'])) { 202 isset($_POST['Description']) && isset($_POST['Comment']) && isset($_POST['key']) && isset($_POST['command'])) {
199 203
200 if ($_POST['key'] == 'Cancel') 204 if ($_POST['key'] == 'Cancel')
201 return 99; 205 return 99;
359 $outstr .= ' <td class="editname">Value</td>'.PHP_EOL; 363 $outstr .= ' <td class="editname">Value</td>'.PHP_EOL;
360 if (($direction == "OUT_BIN") || ($direction == "OUT_ANALOG") || ($direction == "OUT_PWM")) 364 if (($direction == "OUT_BIN") || ($direction == "OUT_ANALOG") || ($direction == "OUT_PWM"))
361 $outstr .= ' <td class="editfield"><input type="text" name="Value" size="50" value="'.$f[1].'"></td>'.PHP_EOL; 365 $outstr .= ' <td class="editfield"><input type="text" name="Value" size="50" value="'.$f[1].'"></td>'.PHP_EOL;
362 else 366 else
363 $outstr .= ' <td class="editfield"><input type="hidden" name="Value" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL; 367 $outstr .= ' <td class="editfield"><input type="hidden" name="Value" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL;
368 $outstr .= ' </tr>'.PHP_EOL;
369 }
370 if ($f[0] == "OFFSET") {
371 $outstr .= ' <tr class="editor">'.PHP_EOL;
372 $outstr .= ' <td class="editname">Value</td>'.PHP_EOL;
373 if ($direction == "IN_ANALOG")
374 $outstr .= ' <td class="editfield"><input type="text" name="Offset" size="50" value="'.$f[1].'"></td>'.PHP_EOL;
375 else
376 $outstr .= ' <td class="editfield"><input type="hidden" name="Offset" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL;
364 $outstr .= ' </tr>'.PHP_EOL; 377 $outstr .= ' </tr>'.PHP_EOL;
365 } 378 }
366 if ($f[0] == "PRESENT") { 379 if ($f[0] == "PRESENT") {
367 /* 380 /*
368 * Only devices that cannot auto detect can be changed. 381 * Only devices that cannot auto detect can be changed.

mercurial