feature: add channel and bandwidth to status page (resolves #28)

This commit is contained in:
Darryl Quinn 2018-07-05 17:47:23 -05:00 committed by dman776
parent 0d95d4d708
commit 41559da318
2 changed files with 21 additions and 0 deletions

View File

@ -39,6 +39,8 @@
$debug = 0;
BEGIN {push @INC, '/www/cgi-bin'};
use perlfunc;
use ucifunc;
# collect some variables
$node = nvram_get("node");
$node = "NOCALL" if $node eq "";
@ -46,6 +48,9 @@ $tactical = nvram_get("tactical");
$config = nvram_get("config");
$config = "not set" if $config eq "" or not -d "/etc/config.mesh";
($junk, $wifi_channel) = &uci_get_named_option("wireless", "radio0", "channel");
($junk, $wifi_chanbw) = &uci_get_named_option("wireless", "radio0", "chanbw");
read_postdata();
if($parms{css} and -f "/www/$parms{css}" and $parms{css} =~ /\.css$/i) {
@ -180,6 +185,12 @@ if($browser_ip)
push @col1, $str . "</td>";
}
$str = "<th align=right><nobr>Channel</nobr></th><td>$wifi_channel";
push @col1, $str . "</td>";
$str = "<th align=right><nobr>Bandwidth</nobr></th><td>$wifi_chanbw Mhz";
push @col1, $str . "</td>";
# right column - system info

View File

@ -65,6 +65,16 @@ sub uci_get_indexed_sectiontype()
return ($rc, @res);
}
sub uci_get_named_option()
{
my ($config,$sname,$option)=@_;
my $cmd=sprintf('uci get %s.%s.%s',$config,$sname,$option);
my @res=`$cmd`;
my $rc=$?;
chomp($res);
return ($rc, @res);
}
# Returns an array of section names
sub uci_get_names_by_sectiontype()
{