Hardware Reference
In-Depth Information
$minbin = "/usr/local/minerva/bin/";
$menuActions = array();
// Main menu screen
$menuActions[0] = array(
10=>'media default next music 5',
16=>'media default next music 5',
19=>'mixer default toggle', 20=>'mixer default quiet', 21=>'mixer default loud',
25=>'weatherstatus',26=>'ldbquery get lut stp',27=>'todo list steev',28=>'getcalendar steev 1',
29=>'media default status',
30=>'media default stop', 31=>'media default toggle', 32=>'manifest default next music',
33=>'housenight', 34=>'homedevice default on bedroom',
);
// ... other menu actions here ...
$result = "Unknown command";
if (array_key_exists($menu, $menuActions)) {
if (array_key_exists($index, $menuActions[$menu])) {
$command = $menuActions[$menu][$index];
$command = $minbin.$command;
$command .= " >&1";
$output = array();
exec($command, $output);
$result = join("\n", $output);
}
}
print $result;
?>
Whatever is printed as a consequence of this script is passed back to the app, and displayed in the status window.
The default echo.php script will simply repeat every argument passed in, back to the app. This is helpful to verify your
assumptions about which menu, position on screen, and icon are being pressed. It is simply:
<?php
print_r($_GET);
?>
and worth keeping around during the development your own scripts.
Web Applets
For most people, controlling the house through the web browser is the secondary goal (after voice recognition, that
is!). As I mentioned in Chapter 5, this is the ubiquitous means of communication in the 20th and 21st centuries, so
you are obliged to provide access to all the Bearskin commands through such an interface, hidden behind the security
that SSL and usernames and passwords provide.
Search WWH ::




Custom Search