mirror of https://github.com/aredn/aredn.git
feature: added realtime charts by device
This commit is contained in:
parent
c81127f2a4
commit
dd04d3d657
|
@ -55,9 +55,12 @@ if($parms{"realtime"}) {
|
||||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
|
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
|
||||||
$d = sprintf ("%02d:%02d:%02d", $hour, $min, $sec);
|
$d = sprintf ("%02d:%02d:%02d", $hour, $min, $sec);
|
||||||
|
|
||||||
#if($parms{device} eq '') {
|
if($parms{device} eq '' or $parms{device} eq 'strongest') {
|
||||||
($s, $n) = get_wifi_signal(get_interface("wifi"));
|
($s, $n) = get_wifi_signal(get_interface("wifi"));
|
||||||
#}
|
} else {
|
||||||
|
my ($dmac, $dname) = $parms{device} =~ /^(.*?)\-(.*)/;
|
||||||
|
($s, $n) = get_realtime_signal($dmac);
|
||||||
|
}
|
||||||
|
|
||||||
$sjson= sprintf("{\"label\":\"%s\",\"y\":%s}",$d,$s);
|
$sjson= sprintf("{\"label\":\"%s\",\"y\":%s}",$d,$s);
|
||||||
$njson= sprintf("{\"label\":\"%s\",\"y\":%s}",$d,$n);
|
$njson= sprintf("{\"label\":\"%s\",\"y\":%s}",$d,$n);
|
||||||
|
@ -108,3 +111,20 @@ sub json_header
|
||||||
print "Cache-Control: no-store\r\n";
|
print "Cache-Control: no-store\r\n";
|
||||||
print "\r\n";
|
print "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub get_realtime_signal()
|
||||||
|
{
|
||||||
|
my $s, $n;
|
||||||
|
my ($var) = @_;
|
||||||
|
return ("-1","-1") if not defined $var;
|
||||||
|
if (-d "/sys/kernel/debug/ieee80211/phy0/netdev:wlan0/stations/$var") {
|
||||||
|
$test="GOOD DIR";
|
||||||
|
chomp($s = `cat /sys/kernel/debug/ieee80211/phy0/netdev:wlan0/stations/$var/last_signal`);
|
||||||
|
} else {
|
||||||
|
$test="BAD DIR";
|
||||||
|
#return ("-2","-2");
|
||||||
|
return ($var, $test);
|
||||||
|
}
|
||||||
|
($junk, $n) = get_wifi_signal(get_interface("wifi"));
|
||||||
|
return ($s, $n);
|
||||||
|
}
|
Loading…
Reference in New Issue