aboutsummaryrefslogtreecommitdiffstats
path: root/apps/helpers/grgsm_capture
diff options
context:
space:
mode:
Diffstat (limited to 'apps/helpers/grgsm_capture')
-rwxr-xr-xapps/helpers/grgsm_capture47
1 files changed, 8 insertions, 39 deletions
diff --git a/apps/helpers/grgsm_capture b/apps/helpers/grgsm_capture
index add42d3..b1b85a7 100755
--- a/apps/helpers/grgsm_capture
+++ b/apps/helpers/grgsm_capture
@@ -38,7 +38,7 @@ import sys
class grgsm_capture(gr.top_block):
- def __init__(self, fc, gain, samp_rate, ppm, arfcn, cfile=None, burst_file=None, band=None, verbose=False, rec_length=None, args=""):
+ def __init__(self, fc, gain, samp_rate, ppm, arfcn, cfile=None, burst_file=None, verbose=False, rec_length=None, args=""):
gr.top_block.__init__(self, "Gr-gsm Capture")
@@ -52,7 +52,6 @@ class grgsm_capture(gr.top_block):
self.arfcn = arfcn
self.cfile = cfile
self.burst_file = burst_file
- self.band = band
self.verbose = verbose
self.shiftoff = shiftoff = 400e3
self.rec_length = rec_length
@@ -138,13 +137,7 @@ class grgsm_capture(gr.top_block):
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
+ new_freq = grgsm.arfcn.arfcn2downlink(self.arfcn)
self.set_fc(new_freq)
def get_gain(self):
@@ -186,7 +179,7 @@ if __name__ == '__main__':
help="Set frequency [default=%default]")
parser.add_option("-a", "--arfcn", dest="arfcn", type="intx",
- help="Set ARFCN instead of frequency. In some cases you may have to provide the GSM band also")
+ help="Set ARFCN instead of frequency (for PCS1900 add 0x8000 (2**15) to the ARFCN number)")
parser.add_option("-g", "--gain", dest="gain", type="eng_float",
default=eng_notation.num_to_str(30),
@@ -205,10 +198,6 @@ if __name__ == '__main__':
parser.add_option("-c", "--cfile", dest="cfile",
help="File where the captured data are saved")
- bands_list = ", ".join(grgsm.arfcn.get_bands())
- parser.add_option("--band", dest="band",
- help="Specify the GSM band for the frequency.\nAvailable bands are: " + bands_list + ".\nIf no band is specified, it will be determined automatically, defaulting to 0." )
-
parser.add_option("", "--args", dest="args", type="string", default="",
help="Set device arguments [default=%default]")
@@ -229,38 +218,18 @@ if __name__ == '__main__':
arfcn = 0
fc = 939.4e6
if options.arfcn:
- if options.band:
- if options.band not in grgsm.arfcn.get_bands():
- parser.error("Invalid GSM band\n")
- elif not grgsm.arfcn.is_valid_arfcn(options.arfcn, options.band):
- parser.error("ARFCN is not valid in the specified band\n")
- else:
- arfcn = options.arfcn
- fc = grgsm.arfcn.arfcn2downlink(arfcn, options.band)
+ if not grgsm.arfcn.is_valid_arfcn(options.arfcn):
+ parser.error("ARFCN is not valid\n")
else:
arfcn = options.arfcn
- for band in grgsm.arfcn.get_bands():
- if grgsm.arfcn.is_valid_arfcn(arfcn, band):
- fc = grgsm.arfcn.arfcn2downlink(arfcn, band)
- break
+ fc = grgsm.arfcn.arfcn2downlink(arfcn)
elif options.fc:
fc = options.fc
- if options.band:
- if options.band not in grgsm.arfcn.get_bands():
- parser.error("Invalid GSM band\n")
- elif not grgsm.arfcn.is_valid_downlink(options.fc, options.band):
- parser.error("Frequency is not valid in the specified band\n")
- else:
- arfcn = grgsm.arfcn.downlink2arfcn(options.fc, options.band)
- else:
- for band in grgsm.arfcn.get_bands():
- if grgsm.arfcn.is_valid_downlink(options.fc, band):
- arfcn = grgsm.arfcn.downlink2arfcn(options.fc, band)
- break
+ arfcn = grgsm.arfcn.downlink2arfcn(options.fc)
tb = grgsm_capture(fc=fc, gain=options.gain, samp_rate=options.samp_rate,
ppm=options.ppm, arfcn=arfcn, cfile=options.cfile,
- burst_file=options.burst_file, band=options.band, verbose=options.verbose,
+ burst_file=options.burst_file, verbose=options.verbose,
rec_length=options.rec_length, args=options.args)
def signal_handler(signal, frame):