configuration updates

max
Max 5 years ago
parent 94a34dc4df
commit 9c01b98542
  1. 18
      op25/gr-op25_repeater/apps/http.py
  2. 9
      op25/gr-op25_repeater/apps/terminal.py

@ -269,6 +269,14 @@ class Backend(threading.Thread):
self.subproc = None
self.backend = '%s/%s' % (os.getcwd(), 'rx.py')
self.q_watcher = queue_watcher(self.input_q, self.process_msg)
def publish(self, msg):
t = msg.type()
s = msg.to_string()
a = msg.arg1()
self.zmq_pub.send(json.dumps({'command': s, 'data': a, 'msgtype': t}))
def check_subproc(self): # return True if subprocess is active
if not self.subproc:
return False
@ -335,8 +343,12 @@ class Backend(threading.Thread):
def run(self):
while self.keep_running:
msg = self.input_q.delete_head()
self.process_msg(msg)
js = self.zmq_sub.recv()
if not self.keep_running:
break
msg = gr.message().make_from_string(js, -4, 0, 0)
if not self.output_q.full_p():
self.output_q.insert_tail(msg)
class rx_options(object):
def __init__(self, name):
@ -389,6 +401,8 @@ def http_main():
my_backend = Backend(options, backend_input_q, backend_output_q)
server = http_server(input_q, output_q, options.endpoint)
q_watcher = queue_watcher(output_q, lambda msg : my_backend.publish(msg))
backend_q_watcher = queue_watcher(backend_output_q, lambda msg : process_qmsg(msg))
server.run()

@ -233,22 +233,19 @@ class zeromq_terminal(threading.Thread):
self.zmq_pub.sndhwm = 5
self.zmq_pub.bind('tcp://*:%d' % port)
self.queue_watcher = q_watcher(self.input_q, self.process_qmsg)
self.queue_watcher = q_watcher(self.input_q, lambda msg : self.zmq_pub.send(msg.to_string()))
self.start()
def end_terminal(self):
self.keep_running = False
def process_qmsg(self, msg):
msg = self.input_q.delete_head()
self.zmq_pub.send(msg.to_string())
def run(self):
while self.keep_running:
js = self.zmq_sub.recv()
if not self.keep_running:
break
msg = gr.message().make_from_string(js, -4, 0, 0)
d = json.loads(js)
msg = gr.message().make_from_string(str(d['command']), d['msgtype'], d['data'], 0)
if self.output_q.full_p():
self.output_q.delete_head()
if not self.output_q.full_p():

Loading…
Cancel
Save