www-thermferm/devices.php

changeset 209
c5b1dfd83e81
parent 196
4d7a96c5d1ff
child 232
bee2600d3d30
--- a/www-thermferm/devices.php	Sun Aug 10 16:56:22 2014 +0200
+++ b/www-thermferm/devices.php	Sun Aug 10 17:25:50 2014 +0200
@@ -95,6 +95,7 @@
  * @param string $_POST['Type'] The device Type
  * @param string $_POST['Direction'] The device IO Direction
  * @param string $_POST['Value'] The device value
+ * @param string $_POST['Offset'] The device offset
  * @param string $_POST['Present'] The device Present state
  * @param string $_POST['Address'] The device Address
  * @param string $_POST['Subdevice'] The device Subaddress
@@ -125,6 +126,8 @@
 	    usleep(20000);
 	    socket_write($sock, "VALUE,".$_POST['Value'], 4096);
 	    usleep(20000);
+	    socket_write($sock, "OFFSET,".$_POST['Offset'], 4096);
+	    usleep(20000);
 	    socket_write($sock, "PRESENT,".$_POST['Present'], 4096);
 	    usleep(20000);
 	    socket_write($sock, "ADDRESS,".$_POST['Address'], 4096);
@@ -172,6 +175,7 @@
  * @param string $_POST['Type'] Device Type
  * @param string $_POST['Direction']
  * @param string $_POST['Value']
+ * @param string $_POST['Offset']
  * @param string $_POST['Present']
  * @param string $_POST['Address']
  * @param string $_POST['Subdevice']
@@ -193,7 +197,7 @@
 
     global $arr;
 
-    if (isset($_POST['UUID']) && isset($_POST['Type']) && isset($_POST['Direction']) && isset($_POST['Value']) &&
+    if (isset($_POST['UUID']) && isset($_POST['Type']) && isset($_POST['Direction']) && isset($_POST['Value']) && isset($_POST['Offset']) &&
 	isset($_POST['Present']) && isset($_POST['Address']) && isset($_POST['Subdevice']) && isset($_POST['Gpiopin']) &&
 	isset($_POST['Description']) && isset($_POST['Comment']) && isset($_POST['key']) && isset($_POST['command'])) {
 
@@ -363,6 +367,15 @@
 		    $outstr .= '        <td class="editfield"><input type="hidden" name="Value" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL;
 		$outstr .= '       </tr>'.PHP_EOL;
 	    }
+	    if ($f[0] == "OFFSET") {
+		$outstr .= '       <tr class="editor">'.PHP_EOL;
+		$outstr .= '        <td class="editname">Value</td>'.PHP_EOL;
+		if ($direction == "IN_ANALOG")
+		    $outstr .= '        <td class="editfield"><input type="text" name="Offset" size="50" value="'.$f[1].'"></td>'.PHP_EOL;
+		else
+		    $outstr .= '        <td class="editfield"><input type="hidden" name="Offset" value="'.$f[1].'">'.$f[1].'</td>'.PHP_EOL;
+		$outstr .= '       </tr>'.PHP_EOL;
+	    }
 	    if ($f[0] == "PRESENT") {
 		/*
 		 * Only devices that cannot auto detect can be changed.

mercurial