server side: send only changed config keys
This commit is contained in:
parent
abb0813948
commit
29703d10b2
@ -248,7 +248,6 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
|||||||
self.sdr.addClient(self)
|
self.sdr.addClient(self)
|
||||||
|
|
||||||
def handleSdrAvailable(self):
|
def handleSdrAvailable(self):
|
||||||
# send initial config
|
|
||||||
self.getDsp().setProperties(self.connectionProperties)
|
self.getDsp().setProperties(self.connectionProperties)
|
||||||
|
|
||||||
stack = PropertyStack()
|
stack = PropertyStack()
|
||||||
@ -256,23 +255,30 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
|||||||
stack.addLayer(1, Config.get())
|
stack.addLayer(1, Config.get())
|
||||||
configProps = stack.filter(*OpenWebRxReceiverClient.config_keys)
|
configProps = stack.filter(*OpenWebRxReceiverClient.config_keys)
|
||||||
|
|
||||||
def sendConfig(key, value):
|
def sendConfig(changes=None):
|
||||||
config = configProps.__dict__()
|
if changes is None:
|
||||||
# TODO mathematical properties? hmmmm
|
config = configProps.__dict__()
|
||||||
config["start_offset_freq"] = configProps["start_freq"] - configProps["center_freq"]
|
else:
|
||||||
# TODO this is a hack to support multiple sdrs
|
config = changes
|
||||||
config["sdr_id"] = self.sdr.getId()
|
if changes is None or "start_freq" in changes or "center_freq" in changes:
|
||||||
|
config["start_offset_freq"] = configProps["start_freq"] - configProps["center_freq"]
|
||||||
|
if changes is None or "profile_id" in changes:
|
||||||
|
config["sdr_id"] = self.sdr.getId()
|
||||||
self.write_config(config)
|
self.write_config(config)
|
||||||
|
|
||||||
cf = configProps["center_freq"]
|
# TODO make a separate subscription for this
|
||||||
srh = configProps["samp_rate"] / 2
|
if changes is None or "center_freq" in changes or "samp_rate" in changes:
|
||||||
frequencyRange = (cf - srh, cf + srh)
|
cf = configProps["center_freq"]
|
||||||
self.write_dial_frequendies(Bandplan.getSharedInstance().collectDialFrequencies(frequencyRange))
|
srh = configProps["samp_rate"] / 2
|
||||||
bookmarks = [b.__dict__() for b in Bookmarks.getSharedInstance().getBookmarks(frequencyRange)]
|
frequencyRange = (cf - srh, cf + srh)
|
||||||
self.write_bookmarks(bookmarks)
|
self.write_dial_frequendies(Bandplan.getSharedInstance().collectDialFrequencies(frequencyRange))
|
||||||
|
bookmarks = [b.__dict__() for b in Bookmarks.getSharedInstance().getBookmarks(frequencyRange)]
|
||||||
|
self.write_bookmarks(bookmarks)
|
||||||
|
|
||||||
self.configSub = configProps.wire(sendConfig)
|
self.configSub = configProps.wire(sendConfig)
|
||||||
sendConfig(None, None)
|
|
||||||
|
# send initial config
|
||||||
|
sendConfig()
|
||||||
self.__sendProfiles()
|
self.__sendProfiles()
|
||||||
|
|
||||||
self.sdr.addSpectrumClient(self)
|
self.sdr.addSpectrumClient(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user