Event socket bug fix and more docs (#6823)
* Add documentation to methods. Use is_resource for added type detection * Allow connect to specify timeout in microseconds with default 30,000 * Update calling mechanism for event sockets * Update project for new singleton event sockets * remove unused variable * catch errors on closing the socket
This commit is contained in:
@@ -51,38 +51,38 @@
|
||||
/*
|
||||
if ($action == "energy") {
|
||||
//conference 3001-example.dyndns.org energy 103
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$result_array = explode("=",$switch_result);
|
||||
$tmp_value = $result_array[1];
|
||||
if ($direction == "up") { $tmp_value = $tmp_value + 100; }
|
||||
if ($direction == "down") { $tmp_value = $tmp_value - 100; }
|
||||
//echo "energy $tmp_value<br />\n";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
|
||||
$switch_result = event_socket::api($switch_cmd.' '.$tmp_value);
|
||||
}
|
||||
if ($action == "volume_in") {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$result_array = explode("=",$switch_result);
|
||||
$tmp_value = $result_array[1];
|
||||
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
|
||||
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
|
||||
//echo "volume $tmp_value<br />\n";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
|
||||
$switch_result = event_socket::api($switch_cmd.' '.$tmp_value);
|
||||
}
|
||||
if ($action == "volume_out") {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$result_array = explode("=",$switch_result);
|
||||
$tmp_value = $result_array[1];
|
||||
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
|
||||
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
|
||||
//echo "volume $tmp_value<br />\n";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
|
||||
$switch_result = event_socket::api($switch_cmd.' '.$tmp_value);
|
||||
}
|
||||
*/
|
||||
//connect to the event socket
|
||||
//$fp = event_socket_create();
|
||||
//$esl = event_socket::create();
|
||||
//send the command over event socket
|
||||
//if ($fp) {
|
||||
// $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
//if ($esl->is_connected()) {
|
||||
// $switch_result = event_socket::api($switch_cmd);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user