I apologize for the length of this question in advance.

Background: The July 2015 issue of Nuts and Volts magazine had an article
on using an inexpensive DVB-T USB dongle along with a 24MHz upconverter as
the basis for an HF and higher Software Defined Receiver(SDR). The software
used in the article was SDR# an MS-Windows application. As I am an Ubuntu
user, I looked for a similar Linux application. I found gqrx. While waiting
on parts to build the upconverter, I installed gqrx-sdr from the Ubuntu
Software Center. It ran and pulled in various signals from 24MHz up, but
was unstable. Turns out this was a pretty old version and after
uninstalling and then installing sudo add-apt-repository
ppa:gqrx/snapshots, a stable version was found.

Well, gqrx has a Remote Control feature that can accept commands over a
Telnet connection and more digging turned up a perl script(gqrx-scan) that
uses this interface, through Net::Telnet, to implement a scanner feature.
gqrx-scan has many bells and whistles that I wouldn't ever use so I wrote a
lite/crude version(lite.pl) that just scans from F1 to F2 repeatedly. For
more flexibility(and practice) I decided to expand lite.pl into a wxPerl
application(wxgqrxLite.pl), mostly a bunch of text controls and sizers.

Problem 1: lite.pl is basically a while(1) loop scanning from F1 to F2,
listening for a second when a strong signal is detected.
Question 1: Where should the non-GUI stuff fit into a wxPerl application?
Current Solution 1: I created two timer events and put the scan code in one
and the listen code in the other. They trigger each other alternately at
separate rates(30msec and 2 seconds). Only one of these events/timers are
active at a time. This actually works!

Problem 2: You can't start scanning unless the Telnet connection is open,
otherwise it throws a connection refused error.
Solution 2: Add code to track scanning and connection status to prevent the
user from doing illegal operations or multiple consecutive hits of the same
button, and popup message boxes to flag these errors.

Problem 3: The error checks, interlocks and message boxes between the
{startbutton} and {stopbutton} events seems to be ok. The same cannot be
said for the {connectbutton} and {disconnectbutton} events. There seems to
be a race/async processing problem between establishing the Telnet
connection(which errors and should set the {tnerror} flag) and the mainline
event code. The three individual print Dumper $self->{tnerror} statements
all show {tnerror} = 0 (wrong!) while the print Dumper $self statement
below shows {tnerror} = 1 (right!). There's a delay in this flag being set
in the Net::Telnet call which causes the rest of the {connectbutton} event
routine to process a wrong flag value.
Question 3: HELP ????? I'm out of ideas...

Question 4: Does event->Skip() terminate the current event handler like
last terminates a while loop?

Code attached. It will run without the dongle or gqrx installed. It just
fails on the Telnet connection.

Thanks for your input.

James
Ubuntu 14.04.2LTS/perl 5.18.2/wxPerl 3.0.1/HP 15 Quadcore Laptop

Attachment: lite.pl
Description: Perl program

Attachment: wxgqrxLite.pl
Description: Perl program

Reply via email to