Fixed problems resulting from Nones returned when no such frequency or ARFCN exists.

This commit is contained in:
Piotr Krysik 2017-08-26 11:25:53 +02:00
parent f77c9afb1f
commit aed9f5cc80
2 changed files with 5 additions and 5 deletions

View File

@ -288,7 +288,7 @@ class channel_info(object):
return self.getKey().__cmp__(other.getKey())
def __repr__(self):
return "ARFCN: %4u, Freq: %6.1fM, CID: %5u, LAC: %5u, MCC: %3u, MNC: %3u, Pwr: %3i" % (
return "ARFCN: %4d, Freq: %6.1fM, CID: %5u, LAC: %5u, MCC: %3u, MNC: %3u, Pwr: %3i" % (
self.arfcn, self.freq / 1e6, self.cid, self.lac, self.mcc, self.mnc, self.power)
def do_scan(samp_rate, band, speed, ppm, gain, args, prn = None):

View File

@ -112,7 +112,7 @@ def arfcn2uplink(arfcn, band):
if offset is not None:
f = f_start + (__chan_spacing * (arfcn - offset))
return round(f, 1)
return None
return -1
def arfcn2downlink(arfcn, band):
@ -120,7 +120,7 @@ def arfcn2downlink(arfcn, band):
conf = __band_conf.get(band)
distance = conf['distance']
return round(arfcn2uplink(arfcn, band) + distance, 1)
return None
return -1
def uplink2arfcn(freq, band):
@ -135,7 +135,7 @@ def uplink2arfcn(freq, band):
arfcn = int(round(offset + ((freq - f_start) / __chan_spacing), 0))
if arfcn_start <= arfcn <= arfcn_end:
return arfcn
return None
return -1
def downlink2arfcn(freq, band):
@ -144,7 +144,7 @@ def downlink2arfcn(freq, band):
distance = conf['distance']
freq_uplink = freq - distance
return int(round(uplink2arfcn(freq_uplink, band), 0))
return None
return -1
def get_arfcn_ranges(band):