From 36127670213051b2a96a2bab68a95e03fc5fa64c Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 6 Dec 2020 18:48:10 -0500 Subject: [PATCH] talkgroup goto: thx Triptolemus --- op25/gr-op25_repeater/apps/README | 1 + op25/gr-op25_repeater/apps/terminal.py | 18 ++++++++++++ op25/gr-op25_repeater/apps/trunking.py | 28 +++++++++++++++---- .../www/www-static/index.html | 5 ++++ op25/gr-op25_repeater/www/www-static/main.js | 15 ++++++++++ 5 files changed, 61 insertions(+), 6 deletions(-) diff --git a/op25/gr-op25_repeater/apps/README b/op25/gr-op25_repeater/apps/README index b2b9db5..513f0b6 100644 --- a/op25/gr-op25_repeater/apps/README +++ b/op25/gr-op25_repeater/apps/README @@ -37,6 +37,7 @@ should open. You must click on the terminal window to restore it to focus, otherwise all keystrokes are consumed by gnuplot. Once in the terminal window there are several keyboard commands: h - hold + H - hold/goto the specified tgid l - lockout s - skip q - quit program diff --git a/op25/gr-op25_repeater/apps/terminal.py b/op25/gr-op25_repeater/apps/terminal.py index 47572a3..c732a3a 100755 --- a/op25/gr-op25_repeater/apps/terminal.py +++ b/op25/gr-op25_repeater/apps/terminal.py @@ -179,6 +179,24 @@ class curses_terminal(threading.Thread): freq = None if freq: self.send_command('set_freq', freq) + elif c == ord('H'): + self.prompt.addstr(0, 0, 'Hold tgid') + self.prompt.refresh() + self.text_win.erase() + response = self.textpad.edit() + self.prompt.erase() + self.prompt.refresh() + self.text_win.erase() + self.text_win.refresh() + self.title_help() + try: + tgid = int(response) + if (tgid < 0) or (tgid > 65535): + tgid = 0 + except: + tgid = 0 + self.send_command('hold', tgid) + elif c == ord(','): self.send_command('adj_tune', -100) elif c == ord('.'): diff --git a/op25/gr-op25_repeater/apps/trunking.py b/op25/gr-op25_repeater/apps/trunking.py index fc5b4cb..022f797 100644 --- a/op25/gr-op25_repeater/apps/trunking.py +++ b/op25/gr-op25_repeater/apps/trunking.py @@ -791,7 +791,7 @@ class rx_ctl (object): cmd = msg.to_string() if self.debug > 10: sys.stderr.write('process_qmsg: command: %s\n' % cmd) - self.update_state(cmd, curr_time) + self.update_state(cmd, curr_time, int(msg.arg1())) # self.update_state(cmd, curr_time) return elif mtype == -1: # timeout if self.debug > 10: @@ -966,7 +966,7 @@ class rx_ctl (object): for frequency in gc_frequencies: # expire working frequencies self.free_frequency(frequency, curr_time) - def update_state(self, command, curr_time): + def update_state(self, command, curr_time, cmd_data = 0): # def update_state(self, command, curr_time): if not self.configs: return # run in "manual mode" if no conf @@ -1058,12 +1058,28 @@ class rx_ctl (object): pass elif command == 'hold': self.last_command = {'command': command, 'time': curr_time} - if self.hold_mode is False and self.current_tgid: - self.tgid_hold = self.current_tgid + if cmd_data != 0: + self.tgid_hold = cmd_data self.tgid_hold_until = curr_time + 86400 * 10000 self.hold_mode = True - if self.debug > 0: - sys.stderr.write ('%f set hold tg(%s) until %f\n' % (time.time(), self.current_tgid, self.tgid_hold_until)) + if self.debug > 0: + sys.stderr.write ('%f set hold tg(%s) until %f\n' % (time.time(), self.tgid_hold, self.tgid_hold_until)) + if self.current_tgid != self.tgid_hold: + self.current_tgid = self.tgid_hold + self.current_srcaddr = 0 + self.current_grpaddr = 0 + self.current_alg = "" + self.current_algid = 128 + self.current_keyid = 0 + new_state = self.states.CC + new_frequency = tsys.trunk_cc + elif self.hold_mode is False: + if self.current_tgid: + self.tgid_hold = self.current_tgid + self.tgid_hold_until = curr_time + 86400 * 10000 + self.hold_mode = True + if self.debug > 0: + sys.stderr.write ('%f set hold tg(%s) until %f\n' % (time.time(), self.tgid_hold, self.tgid_hold_until)) elif self.hold_mode is True: self.current_tgid = None self.tgid_hold = None diff --git a/op25/gr-op25_repeater/www/www-static/index.html b/op25/gr-op25_repeater/www/www-static/index.html index 614cd5f..7db7b70 100644 --- a/op25/gr-op25_repeater/www/www-static/index.html +++ b/op25/gr-op25_repeater/www/www-static/index.html @@ -101,6 +101,11 @@ Before proceeding you will need to know the control channel frequency or frequen
+ +
+ +
+
diff --git a/op25/gr-op25_repeater/www/www-static/main.js b/op25/gr-op25_repeater/www/www-static/main.js index 9bc769c..8395a22 100644 --- a/op25/gr-op25_repeater/www/www-static/main.js +++ b/op25/gr-op25_repeater/www/www-static/main.js @@ -700,6 +700,21 @@ function f_scan_button(command) { send_command(command, current_tgid); } +function f_goto_button(command) { + var _tgid = 0; + + if (command == "goto") { + command = "hold" + if (current_tgid != null) + _tgid = current_tgid; + _tgid = parseInt(prompt("Enter tgid to hold!!!", _tgid)); + + if (isNaN(_tgid) || (_tgid < 0) || (_tgid > 65535)) + _tgid = 0; + send_command(command, _tgid); + } +} + function f_debug() { if (!d_debug) return; var html = "busy " + send_busy;