Merge branch 'master' of git://git.devl.org/git/malvira/mc1322x-tests
This commit is contained in:
commit
427b08f7dc
2 changed files with 22 additions and 14 deletions
|
@ -53,28 +53,32 @@ while(1) {
|
||||||
if (defined($count) && ($count != 0)) {
|
if (defined($count) && ($count != 0)) {
|
||||||
$str .= $c;
|
$str .= $c;
|
||||||
# match if ends in \n or \r and process line
|
# match if ends in \n or \r and process line
|
||||||
if(($str =~ /\n\r$/) ||
|
if(($str =~ /\n$/) ||
|
||||||
($str =~ /\r\n$/)) {
|
($str =~ /\r$/)) {
|
||||||
if($str =~ /^rftest/) {
|
if($str =~ /^rftest/) {
|
||||||
#new packet
|
#new packet
|
||||||
($sec, $usec) = gettimeofday;
|
($sec, $usec) = gettimeofday;
|
||||||
# print "rftestline: $sec $usec $str\n\r";
|
print STDERR "rftestline: $sec $usec $str";
|
||||||
} elsif($str =~ /^\s*data/) {
|
} elsif($str =~ /^\s*data/) {
|
||||||
#packet payload
|
#packet payload
|
||||||
|
print STDERR "dataline: ";
|
||||||
|
print STDERR $str;
|
||||||
$str =~ /data: 0x\d+ (.+)/;
|
$str =~ /data: 0x\d+ (.+)/;
|
||||||
my @data = split(' ',$1);
|
my @data = split(' ',$1);
|
||||||
# print "dataline: ";
|
|
||||||
($len, @data) = @data;
|
($len, @data) = @data;
|
||||||
# print "\n\r";
|
|
||||||
#write out pcap entry
|
#write out pcap entry
|
||||||
print pack('LLLL',($sec,$usec,scalar(@data),scalar(@data)+2));
|
print pack('LLLL',($sec,$usec,scalar(@data),scalar(@data)+2));
|
||||||
|
print STDERR "new packet: $sec $usec " . scalar(@data) . " " . (scalar(@data)+2) . "\n\r";
|
||||||
@frame = @data[0,1];
|
@frame = @data[0,1];
|
||||||
print pack ('CC',($frame[1],$frame[0]));
|
print pack ('CC',(hex($frame[0]),hex($frame[1])));
|
||||||
|
print STDERR "$frame[0] $frame[1] ";
|
||||||
foreach my $data (@data[2..scalar(@data)-1]) {
|
foreach my $data (@data[2..scalar(@data)-1]) {
|
||||||
print pack ('C',hex($data));
|
print pack ('C',hex($data));
|
||||||
|
print STDERR "$data ";
|
||||||
}
|
}
|
||||||
|
print STDERR "\n\r";
|
||||||
}
|
}
|
||||||
|
print STDERR "\n\r";
|
||||||
$str = '';
|
$str = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,21 +10,21 @@ use CGI qw/:standard/;
|
||||||
# paths
|
# paths
|
||||||
my $meshpath = "/home/malvira/work";
|
my $meshpath = "/home/malvira/work";
|
||||||
my $wwwpath = "/var/www";
|
my $wwwpath = "/var/www";
|
||||||
my $hostname = "localhost";
|
my $hostname = "hotdog.redwirellc.com";
|
||||||
|
|
||||||
# aliases
|
# aliases
|
||||||
my %aliases = (
|
my %aliases = (
|
||||||
"2.0" => {
|
"2.0" => {
|
||||||
alias => "Lower Door",
|
alias => "Lower Door",
|
||||||
ds=> {
|
ds=> {
|
||||||
"GPIO29" => "Lock",
|
"GPIO29" => "Lock (0 - locked, 1 - unlocked)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"4.0" => {
|
"4.0" => {
|
||||||
alias => "Upper Door",
|
alias => "Upper Door",
|
||||||
},
|
},
|
||||||
"1.0" => {
|
"1.0" => {
|
||||||
alias => "Sink (Hotdog)",
|
alias => "Hotdog (datasink)",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -42,13 +42,17 @@ foreach my $file (@files) {
|
||||||
print h1("$addr: $aliases{$addr}{'alias'}");
|
print h1("$addr: $aliases{$addr}{'alias'}");
|
||||||
my @info = split(/\n/,qx(rrdtool info $meshpath/$addr.rrd));
|
my @info = split(/\n/,qx(rrdtool info $meshpath/$addr.rrd));
|
||||||
|
|
||||||
my %ds;
|
my %dses;
|
||||||
foreach my $info (@info) {
|
foreach my $info (@info) {
|
||||||
next if $info !~ /ds\[([\w\d]+)\]/;
|
next if $info !~ /ds\[([\w\d]+)\]\.([\w\d_]+)\s+=\s+([\w\d]+)/;
|
||||||
$ds{$1}++;
|
$dses{$1}{$2} = $3;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $ds (keys(%ds)) {
|
my $lastupdate = qx(rrdtool lastupdate $meshpath/$addr.rrd);
|
||||||
|
$lastupdate =~ /([\w\d]+)\s+(\d+):\s+([\w\d]+)/;
|
||||||
|
print localtime($2) . " $1 $3<br>";
|
||||||
|
|
||||||
|
foreach my $ds (keys(%dses)) {
|
||||||
print h2("$ds: $aliases{$addr}{'ds'}{$ds}");
|
print h2("$ds: $aliases{$addr}{'ds'}{$ds}");
|
||||||
qx(rrdtool graph $wwwpath/$addr-$ds.png --start end-60min DEF:$ds=$meshpath/$addr.rrd:$ds:LAST LINE2:$ds#00a000:\"$ds\");
|
qx(rrdtool graph $wwwpath/$addr-$ds.png --start end-60min DEF:$ds=$meshpath/$addr.rrd:$ds:LAST LINE2:$ds#00a000:\"$ds\");
|
||||||
print img({src=>"http://$hostname/$addr-$ds.png"});
|
print img({src=>"http://$hostname/$addr-$ds.png"});
|
||||||
|
|
Loading…
Reference in a new issue