move 2 sensors from klanjec to tuhelj
[zc] / zc-queue-inspect
index 60ac5a2..0ab2bd5 100755 (executable)
@@ -6,10 +6,11 @@ use Data::Dump qw(dump);
 use File::Slurp;
 use POSIX qw(strftime);
 
-use lib '.';
+use FindBin;
+use lib "$FindBin::Bin/.";
 use Protocol;
 
-my $debug = $ENV{DEBUG};
+my $debug = $ENV{DEBUG} // 0;
 $| = 1;
 
 if ( $debug > 1 ) {
@@ -35,6 +36,8 @@ foreach my $filename ( @ARGV ) {
 
        warn "hash = ",dump($hash) if $debug;
 
+       my $imei = $1 if $filename =~ m{queue/(\d+)};
+
        my $function_code = $hash->{function_code} || die "no function_code";
        my $fc_desc = $function_code_description->{$up_down}->{$function_code} || die "no function_code_description for $up_down $function_code";
        print " function_code=$function_code ",
@@ -45,6 +48,7 @@ foreach my $filename ( @ARGV ) {
 
        foreach my $data_id ( @{ $hash->{data_id_order} } ) {
                print join(" | ", 
+                       $imei,
                        $hash->{up_down},
                        unpack('H*', chr($data_id)),
                        $protocol->{$data_id}->{description},