X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=zc-queue-inspect;fp=zc-queue-inspect;h=2f75590f1205339e73a8128593db867f9cf1310e;hb=434e80d65d2d6b28a9b6ea6ddd9136a2e34e5343;hp=0000000000000000000000000000000000000000;hpb=27514330ca51d73a786df6533336bb61d17f391d;p=zc diff --git a/zc-queue-inspect b/zc-queue-inspect new file mode 100755 index 0000000..2f75590 --- /dev/null +++ b/zc-queue-inspect @@ -0,0 +1,53 @@ +#!/usr/bin/perl +use warnings; +use strict; + +use Data::Dump qw(dump); +use File::Slurp; + +use lib '.'; +use Protocol; + +my $debug = $ENV{DEBUG}; +$| = 1; + +if ( $debug ) { + warn "## protocol = ",dump( $protocol ); + warn "## function_code_description = ",dump( $function_code_description ); +} + +my $raw; + +foreach my $filename ( @ARGV ) { + my $up_down = $1 if $filename =~ m/(up|down)/; + my $raw = read_file $filename; + print "# $filename size:", -s $filename, " "; + my $hash = protocol_decode( $up_down, $raw ); + + warn "hash = ",dump($hash); + + 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 ", + $fc_desc, + " ver=", $hash->{ver}, + " len=", $hash->{len}, + "\n"; + + foreach my $data_id ( @{ $hash->{data_id_order} } ) { + print join(" | ", + $hash->{up_down}, + unpack('H*', chr($data_id)), + $protocol->{$data_id}->{description}, + $hash->{data_id}->{$data_id}, + "hex:" . unpack('H*', $hash->{data_range}->{$data_id}), + "len:" . $hash->{data_len}->{$data_id}, + "fmt:" . $protocol->{$data_id}->{pack_fmt}, + "range:" . $protocol->{$data_id}->{range}, + "remark:" . $protocol->{$data_id}->{remark} + ),"\n"; + } + print "\n"; + +} +