Skip to content
Permalink
Browse files

Update magichome.class.php

  • Loading branch information...
directman66 committed Sep 5, 2018
1 parent 573e3d7 commit b5df80483a7c19b75820e4b2825ea077e1a4a7ca
Showing with 12 additions and 3 deletions.
  1. +12 −3 modules/magichome/magichome.class.php
@@ -156,7 +156,7 @@ function admin(&$out) {
if ($this->view_mode=='getinfo') {
$this->turnon($this->getinfo2);
$this->getinfo2($this->id);
}
@@ -478,6 +478,12 @@ function getinfo2($id) {
$sendStr = '81:8a:8b:a4';
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, 1);
//socket_sendto($sock, $str, strlen($str), 0, $ip, $port);
//socket_recvfrom($sock, $buf,100 , 0, $ip, $port);
//socket_close($sock);
$socket = socket_create(AF_INET, SOCK_STREAM, getprotobyname("tcp")); // Create Socket
if (socket_connect($socket, $host, $port)) { //Connect
@@ -488,6 +494,9 @@ function getinfo2($id) {
socket_write ($socket, Chr (hexdec ($sendStrArray[$j]))); // by group data transmission
}
socket_recvfrom($sock, $buf,100 , 0, $ip, $port);
socket_close($sock);
@@ -501,8 +510,8 @@ function getinfo2($id) {
}
SQLexec("update magichome_devices set CURRENTCOLOR='$msg' where id='$id'");
sg('test.rgbbuf', $buf);
SQLexec("update magichome_devices set CURRENTCOLOR='$buf' where id='$id'");
}

0 comments on commit b5df804

Please sign in to comment.
You can’t perform that action at this time.