Commit 397dbb56 authored by David Johnson's avatar David Johnson

Add a simple node_features filter for the wireless maps; add links to one

that filters on 'usrp' for GNU nodes.
parent fad8051b
...@@ -21,6 +21,7 @@ sub usage { ...@@ -21,6 +21,7 @@ sub usage {
print STDERR "[-s <scale>] | [-c <map_x>,<_y>] "; print STDERR "[-s <scale>] | [-c <map_x>,<_y>] ";
print STDERR "[-S <last_scale> -C <last_x>,<_y>] -O <last_x_off>,<_y>] "; print STDERR "[-S <last_scale> -C <last_x>,<_y>] -O <last_x_off>,<_y>] ";
print STDERR "[-e <pid,eid>] [<building>]\n"; print STDERR "[-e <pid,eid>] [<building>]\n";
print STDERR "[-F <feature>]\n";
print STDERR "\nor\n"; print STDERR "\nor\n";
print STDERR "Usage: floormap [-k] [-o <prefix>] "; print STDERR "Usage: floormap [-k] [-o <prefix>] ";
exit(-1); exit(-1);
...@@ -35,7 +36,7 @@ sub dprint($) { ...@@ -35,7 +36,7 @@ sub dprint($) {
if ($debug); if ($debug);
} }
my $optlist = "df:o:s:c:S:C:O:e:tTakgzvnxy"; my $optlist = "df:o:s:c:S:C:O:e:F:tTakgzvnxy";
my $notitles = 0; # This suppresses titles surrounding the output map. my $notitles = 0; # This suppresses titles surrounding the output map.
my $showany = 0; # When showing specific floor, showany is turned on. my $showany = 0; # When showing specific floor, showany is turned on.
my $mereuser = 1; my $mereuser = 1;
...@@ -53,6 +54,8 @@ my $building; ...@@ -53,6 +54,8 @@ my $building;
my $floor; my $floor;
my $image; my $image;
my $feature_filter;
# These result from clicking on zoom/pan controls outside. # These result from clicking on zoom/pan controls outside.
my $scale = 1; # From clicking on one of the scale buttons. my $scale = 1; # From clicking on one of the scale buttons.
my $scale_arg = 1; # Scale by half-integer factors: 1=>1, 2=>1.5, 3=>2, etc. my $scale_arg = 1; # Scale by half-integer factors: 1=>1, 2=>1.5, 3=>2, etc.
...@@ -299,6 +302,9 @@ if (defined($options{"x"})) { ...@@ -299,6 +302,9 @@ if (defined($options{"x"})) {
$show_exclusion = 1; $show_exclusion = 1;
} }
if (defined($options{"F"})) {
$feature_filter = $options{"F"};
}
if (defined($options{"e"})) { if (defined($options{"e"})) {
if ($options{"e"} =~ /([-\w]*),([-\w]*)/) { if ($options{"e"} =~ /([-\w]*),([-\w]*)/) {
$pid = $1; $pid = $1;
...@@ -497,7 +503,9 @@ sub dofloor($$) ...@@ -497,7 +503,9 @@ sub dofloor($$)
" from location_info as loc ". " from location_info as loc ".
"left join reserved as r on r.node_id=loc.node_id ". "left join reserved as r on r.node_id=loc.node_id ".
"left join nodes as n on n.node_id=loc.node_id ". "left join nodes as n on n.node_id=loc.node_id ".
(defined($feature_filter)?"left join node_features as f on f.node_id=loc.node_id ":"") .
"where loc.building='$building' " . "where loc.building='$building' " .
(defined($feature_filter)?" and f.feature='$feature_filter' ":"") .
(defined($pid) ? " and r.pid='$pid' and r.eid='$eid'" : ""); (defined($pid) ? " and r.pid='$pid' and r.eid='$eid'" : "");
my $query_result = DBQueryFatal($query . " and loc.floor='$floor'"); my $query_result = DBQueryFatal($query . " and loc.floor='$floor'");
......
...@@ -9,7 +9,7 @@ include("defs.php3"); ...@@ -9,7 +9,7 @@ include("defs.php3");
# #
# Standard Testbed Header # Standard Testbed Header
# #
PAGEHEADER("Wireless PC Map"); PAGEHEADER("Wireless PC Map" . ((isset($feature) && $feature != "")?" ($feature)":" (802.11)"));
# #
# Only logged in people at the moment; might open up at some point. # Only logged in people at the moment; might open up at some point.
...@@ -39,6 +39,16 @@ else { ...@@ -39,6 +39,16 @@ else {
unset($floor); unset($floor);
} }
if (isset($feature) && $feature != "") {
# Sanitize for the shell.
if (!preg_match("/^[-\w]+$/", $feature)) {
PAGEARGERROR("Invalid feature argument.");
}
}
else {
unset($feature);
}
# #
# Optional pid,eid. Without a building/floor, show all the nodes for the # Optional pid,eid. Without a building/floor, show all the nodes for the
# experiment in all buildings/floors. Without pid,eid show all wireless # experiment in all buildings/floors. Without pid,eid show all wireless
...@@ -216,7 +226,9 @@ $query_result = ...@@ -216,7 +226,9 @@ $query_result =
"left join interface_settings as s on ". "left join interface_settings as s on ".
" s.node_id=loc.node_id and s.capkey='channel' ". " s.node_id=loc.node_id and s.capkey='channel' ".
"left join reserved as r on r.node_id=loc.node_id ". "left join reserved as r on r.node_id=loc.node_id ".
(isset($feature)?" left join node_features as f on f.node_id=loc.node_id ":"") .
"where loc.building='$building' ". "where loc.building='$building' ".
(isset($feature)?" and f.feature='$feature' ":"") .
(isset($floor) ? "and loc.floor='$floor'" : "")); (isset($floor) ? "and loc.floor='$floor'" : ""));
while ($row = mysql_fetch_array($query_result)) { while ($row = mysql_fetch_array($query_result)) {
...@@ -308,6 +320,7 @@ $perl_args = "-o $prefix " . ...@@ -308,6 +320,7 @@ $perl_args = "-o $prefix " .
(isset($pid) ? "-e $pid,$eid " : "") . (isset($pid) ? "-e $pid,$eid " : "") .
(isset($floor) ? "-f $floor " : "") . (isset($floor) ? "-f $floor " : "") .
(isset($feature) ? "-F $feature " : "") .
(isset($building) ? "$building" : ""); # Building arg must be last! (isset($building) ? "$building" : ""); # Building arg must be last!
if (0) { ### Put the Perl script args into the page when debugging. if (0) { ### Put the Perl script args into the page when debugging.
...@@ -331,7 +344,9 @@ if (! readfile("${prefix}.map")) { ...@@ -331,7 +344,9 @@ if (! readfile("${prefix}.map")) {
echo "<font size=+1>For more info on using wireless nodes, see the echo "<font size=+1>For more info on using wireless nodes, see the
<a href='tutorial/docwrapper.php3?docname=wireless.html'> <a href='tutorial/docwrapper.php3?docname=wireless.html'>
wireless tutorial.</a></font>\n"; wireless tutorial</a> and the
<a href='tutorial/docwrapper.php3?docname=gnuradio.html'>GNU software
defined radio tutorial</a>.</font>\n";
echo "<center>\n"; echo "<center>\n";
...@@ -462,6 +477,9 @@ zoom_btns($curr_scale); ...@@ -462,6 +477,9 @@ zoom_btns($curr_scale);
# Hidden items are all returned as page arguments when any input control is clicked. # Hidden items are all returned as page arguments when any input control is clicked.
echo " <input type=\"hidden\" name=\"prefix\" value=\"$uniqueid\">\n"; echo " <input type=\"hidden\" name=\"prefix\" value=\"$uniqueid\">\n";
if (isset($feature)) {
echo " <input type=\"hidden\" name=\"feature\" value=\"$feature\">\n";
}
# The last_* items come from a .state file with the map, from the Perl script. # The last_* items come from a .state file with the map, from the Perl script.
if (! readfile("${prefix}.state")) { if (! readfile("${prefix}.state")) {
......
...@@ -46,6 +46,8 @@ else { ...@@ -46,6 +46,8 @@ else {
echo "<b>Show: <a href='nodecontrol_list.php3?showtype=summary'>summary</a>, echo "<b>Show: <a href='nodecontrol_list.php3?showtype=summary'>summary</a>,
<a href='nodecontrol_list.php3?showtype=pcs'>pcs</a>, <a href='nodecontrol_list.php3?showtype=pcs'>pcs</a>,
<a href='floormap.php3'>wireless maps</a>, <a href='floormap.php3'>wireless maps</a>,
<a href='floormap.php3?feature=usrp'>
GNU USRP (software defined radio) maps</a>,
<a href='nodecontrol_list.php3?showtype=wireless'> <a href='nodecontrol_list.php3?showtype=wireless'>
wireless list</a>, wireless list</a>,
<a href='robotmap.php3'>robot maps</a>, <a href='robotmap.php3'>robot maps</a>,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment