1 | #!/usr/bin/env perl
|
---|
2 |
|
---|
3 | #
|
---|
4 | # getGlonassFrequencies.pl - parse GLONASS slot & freq information from a logfile written by BNC in scanRTCM mode
|
---|
5 | #
|
---|
6 | # Revision: $Header: trunk/BNC/scripts/getGlonassFrequencies.pl 9668 2022-03-23 12:51:45Z wiese $
|
---|
7 | #
|
---|
8 |
|
---|
9 | use strict;
|
---|
10 | use warnings;
|
---|
11 |
|
---|
12 | my $scanRTCMlogfile = shift @ARGV;
|
---|
13 | defined ($scanRTCMlogfile) || die ( HELP_MESSAGE(), "\n" );
|
---|
14 |
|
---|
15 | my %frq_of = parseGloFrequencies($scanRTCMlogfile);
|
---|
16 | die ("no GLO frequencies found in $scanRTCMlogfile\n") if ( scalar ( keys %frq_of ) < 1 );
|
---|
17 |
|
---|
18 | foreach ( sort { $a <=> $b } keys %frq_of ) {
|
---|
19 | print STDOUT $_ . ' ' . $frq_of{$_} . "\n";
|
---|
20 | }
|
---|
21 |
|
---|
22 | # 22-03-23 08:46:19 USCL00CHL0: GLONASS Slot:Freq R07:5 R08:6 R12:-1 R13:-2 R14:-7 R17:4 R23:3 R24:2
|
---|
23 | sub parseGloFrequencies {
|
---|
24 | my ($logfile) = @_;
|
---|
25 |
|
---|
26 | my %frq_of = ();
|
---|
27 | open ( my $inp, '<', $logfile ) || die "could not open file '$logfile': $!\n";
|
---|
28 | while ( my $ln = <$inp> ) {
|
---|
29 | chomp $ln;
|
---|
30 | next unless ( $ln =~ /GLONASS Slot:Freq/ );
|
---|
31 | my $idx = index ( $ln, "Freq", 30 );
|
---|
32 | next unless ($idx);
|
---|
33 | my $slotsStr = substr ( $ln, $idx + 5 );
|
---|
34 | $slotsStr =~ s/^[\s]*//g;
|
---|
35 | my @hlp = split ( /\s+/, $slotsStr );
|
---|
36 | foreach (@hlp) {
|
---|
37 | my ( $sat, $frq ) = split ( ":", $_, 2 );
|
---|
38 | my $satNr = int ( substr ( $sat, 1 ) );
|
---|
39 | if ( exists $frq_of{$satNr} && $frq_of{$satNr} != $frq ) {
|
---|
40 | warn ("frq differs for existing $sat:$frq_of{$satNr} in line: $ln\n");
|
---|
41 | }
|
---|
42 | $frq_of{$satNr} = int ($frq);
|
---|
43 | }
|
---|
44 | }
|
---|
45 | close ($inp);
|
---|
46 | return %frq_of;
|
---|
47 | }
|
---|
48 |
|
---|
49 | sub HELP_MESSAGE {
|
---|
50 | print <<EOI_KURZHILFE;
|
---|
51 | getGlonassFrequencies.pl - Parse GLONASS slot & freq information from a logfile written by BNC in scanRTCM mode
|
---|
52 |
|
---|
53 | Usage: getGlonassFrequencies.pl /path/to/BNC-logfile
|
---|
54 |
|
---|
55 | Arguments:
|
---|
56 | -h|--help print help
|
---|
57 | -BNC-logfile BNC-logfile with activated scanRTCM mode
|
---|
58 |
|
---|
59 | Copyright (c) 2022 BKG Frankfurt <Erwin.Wiesensarter\@bkg.bund.de>
|
---|
60 | EOI_KURZHILFE
|
---|
61 | }
|
---|
62 |
|
---|