a lot of debug
This commit is contained in:
@ -47,8 +47,11 @@ function htmlSend($socket, $text, $meta="")
|
||||
function apiServer($read)
|
||||
{
|
||||
global $topics, $indexDevices, $devices;
|
||||
|
||||
logger(DEBUG, "Function apiServer", __FILE__ . ":" . __LINE__);
|
||||
$array = array();
|
||||
$argList =array();
|
||||
|
||||
//logger(DEBUG, _("askWebserver function starting"), __FILE__ . ":" . __LINE__);
|
||||
if ( stream_select( $read, $array, $array, 0 ))
|
||||
{
|
||||
@ -88,50 +91,63 @@ function apiServer($read)
|
||||
switch($command)
|
||||
{
|
||||
case "dashboard":
|
||||
webDashboard($spawn, $argList["dashboard"]);
|
||||
apiDashboard($spawn, $argList["dashboard"]);
|
||||
break;
|
||||
case "browse":
|
||||
logger(DEBUG, _("Browsing"), __FILE__ . ":" . __LINE__);
|
||||
webBrowse($spawn, $argList);
|
||||
apiBrowse($spawn, $argList);
|
||||
//return true;
|
||||
break;
|
||||
case "get":
|
||||
logger(DEBUG, _("GET reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, webGet($argList));
|
||||
htmlSend($spawn, apiGet($argList));
|
||||
break;
|
||||
case "set":
|
||||
logger(DEBUG, _("SET reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, webSet($argList));
|
||||
htmlSend($spawn, apiSet($argList));
|
||||
break;
|
||||
case "dump":
|
||||
case "print":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, webPrint($argList, $command));
|
||||
htmlSend($spawn, apiPrint($argList, $command));
|
||||
break;
|
||||
case "notify":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, webNotify($argList));
|
||||
htmlSend($spawn, apiNotify($argList));
|
||||
logger(DEBUG, print_r($monitored, true), __FILE__ . ":" . __LINE__);
|
||||
break;
|
||||
case "type":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
//htmlSend($spawn, webDisplayByType($argList));
|
||||
//htmlSend($spawn, apiDisplayByType($argList));
|
||||
/*case "stats":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
displayStats($spawn, $argList);*/
|
||||
break;
|
||||
case "verbose":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, apiVerbose($argList));
|
||||
break;
|
||||
case "friendlyname":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, getFn($argList));
|
||||
break;
|
||||
case "property":
|
||||
logger(DEBUG, $command . _(" reached"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, PropertiesDashboard($argList));
|
||||
break;
|
||||
default:
|
||||
if (is_numeric(array_key_first($argList)))
|
||||
{
|
||||
webDashboard($spawn, $argList[0]);
|
||||
}else
|
||||
{
|
||||
logger(DEBUG, $command . _(" so default action"), __FILE__ . ":" . __LINE__);
|
||||
if (file_exists("php://temp/". $command))
|
||||
if (is_numeric(array_key_first($argList)))
|
||||
{
|
||||
logger(DEBUG, $command . _(" is a file"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, file_get_contents("php://temp/". $command), 'Content-Type: image/png');
|
||||
apiDashboard($spawn, $argList[0]);
|
||||
}else
|
||||
{
|
||||
logger(DEBUG, $command . _(" so default action"), __FILE__ . ":" . __LINE__);
|
||||
if (file_exists("php://temp/". $command))
|
||||
{
|
||||
logger(DEBUG, $command . _(" is a file"), __FILE__ . ":" . __LINE__);
|
||||
htmlSend($spawn, file_get_contents("php://temp/". $command), 'Content-Type: image/png');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (array_key_exists("page", $argList))
|
||||
@ -141,11 +157,11 @@ function apiServer($read)
|
||||
}
|
||||
}else
|
||||
{
|
||||
webDashboard($spawn);
|
||||
apiDashboard($spawn);
|
||||
}
|
||||
}else
|
||||
{
|
||||
webDashboard($spawn);
|
||||
apiDashboard($spawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user