Picking latest changes from the main OWRX repo.

This commit is contained in:
Marat Fayzullin 2023-03-17 23:41:34 -04:00
parent 74cace883c
commit dd908c0917
2 changed files with 21 additions and 14 deletions

View File

@ -679,19 +679,20 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
def unpickler(data):
b = data.tobytes()
# If we know it's not pickled, let us not unpickle
if len(b)<2 or b[0]!=0x80 or b[1]<0x03:
if len(b) < 2 or b[0] != 0x80 or not 3 <= b[1] <= pickle.HIGHEST_PROTOCOL:
callback(b.decode("ascii"))
else:
io = BytesIO(b)
try:
while True:
callback(pickle.load(io))
except EOFError:
pass
except pickle.UnpicklingError:
callback(b.decode("ascii"))
except ValueError:
pass
return
io = BytesIO(b)
try:
while True:
callback(pickle.load(io))
except EOFError:
pass
except pickle.UnpicklingError:
callback(b.decode("ascii"))
except ValueError:
pass
return unpickler

View File

@ -174,11 +174,17 @@ class ServiceHandler(SdrSourceEventClient):
addService(dial, self.source)
def get_min_max(self, group):
def find_bandpass(dial):
mode = Modes.findByModulation(dial["mode"])
if "underlying" in dial:
mode = mode.for_underlying(dial["underlying"])
return mode.get_bandpass()
frequencies = sorted(group, key=lambda f: f["frequency"])
lowest = frequencies[0]
min = lowest["frequency"] + Modes.findByModulation(lowest["mode"]).get_bandpass().low_cut
min = lowest["frequency"] + find_bandpass(lowest).low_cut
highest = frequencies[-1]
max = highest["frequency"] + Modes.findByModulation(highest["mode"]).get_bandpass().high_cut
max = highest["frequency"] + find_bandpass(highest).high_cut
return min, max
def get_center_frequency(self, group):