Example #1
0
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
include "common.php";
html_header($config->title);
if ($_GET["addr"] != "" && $_GET["val"] != "") {
    $addr = $_GET["addr"];
    $typ = $_GET["typ"];
    $value = $_GET["val"];
    $res = -1;
    $con = $config->connect();
    switch ($typ) {
        case "small":
            $res = groupswrite($con, $addr, $value);
            break;
        case "p1":
            if ($value < 0) {
                $value = 0;
            }
            if ($value > 100) {
                $value = 100;
            }
            $value = (int) ($value * 255 / 100 + 0.5);
            $res = groupwrite($con, $addr, array($value & 0xff));
            break;
        case "b1":
            $res = groupwrite($con, $addr, array($value & 0xff));
            break;
        case "b2":
Example #2
0
/**
* Title
*
* Description
*
* @access public
*/
function knxwrite($con, $addr, $value, $typ)
{
    $res = -1;
    switch ($typ) {
        case "small":
            $res = groupswrite($con, $addr, $value);
            break;
        case "p1":
            if ($value < 0) {
                $value = 0;
            }
            if ($value > 100) {
                $value = 100;
            }
            $value = (int) ($value * 255 / 100 + 0.5);
            $res = groupwrite($con, $addr, array($value & 0xff));
            break;
        case "b1":
            $res = groupwrite($con, $addr, array($value & 0xff));
            break;
        case "b2":
            $res = groupwrite($con, $addr, array($value >> 8 & 0xff, $value & 0xff));
            break;
        case "f2":
            $res = groupwrite($con, $addr, f2_encode($value));
            break;
    }
    return $res;
}