send a new config message when config properties haven been changed
This commit is contained in:
parent
9fc77c2804
commit
35930f79f1
@ -9,7 +9,10 @@ class Property(object):
|
|||||||
def setValue(self, value):
|
def setValue(self, value):
|
||||||
self.value = value
|
self.value = value
|
||||||
for c in self.callbacks:
|
for c in self.callbacks:
|
||||||
c(self.value)
|
try:
|
||||||
|
c(self.value)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
return self
|
return self
|
||||||
def wire(self, callback):
|
def wire(self, callback):
|
||||||
self.callbacks.append(callback)
|
self.callbacks.append(callback)
|
||||||
@ -38,7 +41,10 @@ class PropertyManager(object):
|
|||||||
self.properties[name] = prop
|
self.properties[name] = prop
|
||||||
def fireCallbacks(value):
|
def fireCallbacks(value):
|
||||||
for c in self.callbacks:
|
for c in self.callbacks:
|
||||||
c(name, value)
|
try:
|
||||||
|
c(name, value)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
prop.wire(fireCallbacks)
|
prop.wire(fireCallbacks)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -80,17 +80,24 @@ class WebSocketMessageHandler(object):
|
|||||||
if (message[:16] == "SERVER DE CLIENT"):
|
if (message[:16] == "SERVER DE CLIENT"):
|
||||||
# maybe put some more info in there? nothing to store yet.
|
# maybe put some more info in there? nothing to store yet.
|
||||||
self.handshake = "completed"
|
self.handshake = "completed"
|
||||||
|
print("client connection intitialized")
|
||||||
|
|
||||||
self.client = OpenWebRxClient(conn)
|
self.client = OpenWebRxClient(conn)
|
||||||
|
|
||||||
config_keys = ["waterfall_colors", "waterfall_min_level", "waterfall_max_level",
|
config_keys = ["waterfall_colors", "waterfall_min_level", "waterfall_max_level",
|
||||||
"waterfall_auto_level_margin", "shown_center_freq", "samp_rate", "fft_size", "fft_fps",
|
"waterfall_auto_level_margin", "shown_center_freq", "samp_rate", "fft_size", "fft_fps",
|
||||||
"audio_compression", "fft_compression", "max_clients", "start_mod",
|
"audio_compression", "fft_compression", "max_clients", "start_mod",
|
||||||
"client_audio_buffer_size"]
|
"client_audio_buffer_size", "start_freq", "center_freq"]
|
||||||
config = dict((key, pm.getPropertyValue(key)) for key in config_keys)
|
|
||||||
config["start_offset_freq"] = pm.getPropertyValue("start_freq") - pm.getPropertyValue("center_freq")
|
configProps = pm.collect(*config_keys)
|
||||||
self.client.write_config(config)
|
|
||||||
print("client connection intitialized")
|
def sendConfig(key, value):
|
||||||
|
config = dict((key, configProps[key]) for key in config_keys)
|
||||||
|
config["start_offset_freq"] = configProps["start_freq"] - configProps["center_freq"]
|
||||||
|
self.client.write_config(config)
|
||||||
|
|
||||||
|
configProps.wire(sendConfig)
|
||||||
|
sendConfig(None, None)
|
||||||
|
|
||||||
receiver_keys = ["receiver_name", "receiver_location", "receiver_qra", "receiver_asl", "receiver_gps",
|
receiver_keys = ["receiver_name", "receiver_location", "receiver_qra", "receiver_asl", "receiver_gps",
|
||||||
"photo_title", "photo_desc"]
|
"photo_title", "photo_desc"]
|
||||||
|
Loading…
Reference in New Issue
Block a user