Also, if you have gnuplot installed you can redirect the output of run_hackrf 
to a file and plot it using the attached perl script.

Thanks,

--Patrick

From: [email protected]
To: [email protected]; [email protected]
Subject: RE: [Hackrf-dev] Retune time for the hackRF One
Date: Wed, 27 Apr 2016 17:59:03 -0700




Hi Mike,

I have attached the tar/zipped file of my scanner source. It includes a 
Makefile to build it and a shell script 'run_hackrf' that runs it how I usually 
do.

To explain the design a bit: There is a SignalSource class of which 
HackRFSource is a subclass. This class has the rx_callback method invoked by 
your library. It also has ThreadWorker method running on a separate thread 
which together with the callback implements a state machine with 3 states: 
Streaming, DoRetune, Done. The rx_callback queues the received samples if the 
state is Streaming and then it switches state to DoRetune. The ThreadWorker on 
state DoRetune does the retune, sets a counter to the number of packets to 
drop, and changes the state to Streaming. The rx_callback decrements the 
counter when the state is Streaming until it hits 0 and then enqueues the 
samples and repeat. It is the discard counter (m_dropPacketCount) that I had to 
increase from 1 until I hit the value where the spectrum looks OK. The state 
variable is implemented using std::atomic.

Even if you are not able to build/run it could you please take a look at the 
initialization, callback, and ThreadWorker methods to see if it is OK.

Thanks much for the help,

--Patrick

> Date: Tue, 26 Apr 2016 19:15:29 -0600
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [Hackrf-dev] Retune time for the hackRF One
> 
> On Tue, Apr 26, 2016 at 05:46:01PM -0700, Patrick Sathyanathan wrote:
> >
> > BTW, the ANT500 I received from NooElec does not have the rotating
> > collar I expected from the description.
> 
> It can be a bit stiff, especially at first.  That is a good thing.  It
> means it won't start falling over after you use it for a while.
> 
> Try this: Fully collapse the telescopic section.  Set the elbow so it is
> at a right angle.  Then use one finger near the end of the antenna (so
> you have some leverage) to rotate the antenna clockwise.
> 
> Mike
                                                                                
  
use File::Temp;

sub get_temp_filename {
    my $fh = File::Temp->new(
        TEMPLATE => 'tempXXXXX',
        DIR      => '.',
        SUFFIX   => '.dat',
    );

    return $fh->filename;
}

my $filename = get_temp_filename();

open my $fh, ">", $filename
    or die "could not open $filename: $!";

my $line = "";
while ($line = <>) {
    if ($line =~ /freq ([0-9]+) power\_db ([0-9]+\.[0-9]+)/) {
        print $fh "$1 $2\n";
    }
    if ($line =~ /Start scan/) {
        # print $fh "replot\n";
    }
}

exec("gnuplot -p -e \"plot \'$filename\' using 1:2;\"");
close $fh;
unlink $filename;
_______________________________________________
HackRF-dev mailing list
[email protected]
https://pairlist9.pair.net/mailman/listinfo/hackrf-dev

Reply via email to