Skip to content

Commit

Permalink
Added getter/setter for arfcn
Browse files Browse the repository at this point in the history
  • Loading branch information
romankh committed Aug 24, 2015
1 parent 7eda480 commit 5a80400
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions apps/airprobe_rtlsdr_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

class airprobe_rtlsdr_capture(gr.top_block):

def __init__(self, fc, gain, samp_rate, ppm, arfcn, cfile=None, burst_file=None, verbose=False):
def __init__(self, fc, gain, samp_rate, ppm, arfcn, cfile=None, burst_file=None, band=None, verbose=False):

gr.top_block.__init__(self, "Airprobe RTL-SDR Capture")

Expand All @@ -52,6 +52,7 @@ def __init__(self, fc, gain, samp_rate, ppm, arfcn, cfile=None, burst_file=None,
self.arfcn = arfcn
self.cfile = cfile
self.burst_file = burst_file
self.band = band
self.verbose = verbose
self.shiftoff = shiftoff = 400e3

Expand Down Expand Up @@ -121,6 +122,22 @@ def set_fc(self, fc):
self.fc = fc
if self.verbose or self.burst_file:
self.gsm_input.set_fc(self.fc)

def get_arfcn(self):
return self.arfcn

def set_arfcn(self, arfcn):
self.arfcn = arfcn
if self.verbose or self.burst_file:
self.gsm_receiver.set_cell_allocation([self.arfcn])
if options.band:
new_freq = grgsm.arfcn.arfcn2downlink(self.arfcn, self.band)
else:
for band in grgsm.arfcn.get_bands():
if grgsm.arfcn.is_valid_arfcn(arfcn, band):
new_freq = grgsm.arfcn.arfcn2downlink(arfcn, band)
break
self.set_fc(new_freq)

def get_gain(self):
return self.gain
Expand Down Expand Up @@ -221,7 +238,7 @@ def set_ppm(self, ppm):

tb = airprobe_rtlsdr_capture(fc=fc, gain=options.gain, samp_rate=options.samp_rate,
ppm=options.ppm, arfcn=arfcn, cfile=options.cfile,
burst_file=options.burst_file, verbose=options.verbose)
burst_file=options.burst_file, band=options.band, verbose=options.verbose)

def signal_handler(signal, frame):
tb.stop()
Expand Down

0 comments on commit 5a80400

Please sign in to comment.