diff --git a/op25/gr-op25_repeater/apps/cfg.json b/op25/gr-op25_repeater/apps/cfg.json index d1db5266..81fde081 100644 --- a/op25/gr-op25_repeater/apps/cfg.json +++ b/op25/gr-op25_repeater/apps/cfg.json @@ -1,6 +1,7 @@ { "channels": [ { + "name": "p25", "device": "", "demod_type": "cqpsk", "cqpsk_tracking": true, @@ -12,7 +13,6 @@ "filter_type": "rc", "frequency": 460412500, "if_rate": 24000, - "name": "p25", "plot": "symbol", "symbol_rate": 4800, "raw_output": "", @@ -24,6 +24,7 @@ }, { + "name": "ysf", "device": "device_0", "demod_type": "fsk4", "cqpsk_tracking": false, @@ -32,7 +33,6 @@ "filter_type": "rrc", "frequency": 460500000, "if_rate": 24000, - "name": "ysf", "plot": "datascope", "symbol_rate": 4800, "raw_output": "", @@ -42,6 +42,7 @@ "nbfm_squelch": -60 }, { + "name": "dmr", "device": "device_1", "demod_type": "fsk4", "cqpsk_tracking": false, @@ -50,7 +51,6 @@ "filter_type": "rrc", "frequency": 460050000, "if_rate": 24000, - "name": "dmr", "plot": "symbol", "symbol_rate": 4800, "raw_output": "", @@ -148,6 +148,7 @@ "terminal_type": "curses", "#terminal_type": "http:127.0.0.1:8080", "terminal_timeout": 5.0, + "default_channel": "p25", "curses_plot_interval": 0.2, "http_plot_interval": 1.0, "http_plot_directory": "../www/images", diff --git a/op25/gr-op25_repeater/apps/p25_rtl_example.json b/op25/gr-op25_repeater/apps/p25_rtl_example.json index 55590ad7..505c66ad 100644 --- a/op25/gr-op25_repeater/apps/p25_rtl_example.json +++ b/op25/gr-op25_repeater/apps/p25_rtl_example.json @@ -135,6 +135,7 @@ "http_plot_interval": 1.0, "http_plot_directory": "../www/images", "tuning_step_large": 1200, - "tuning_step_small": 100 + "tuning_step_small": 100, + "default_channel": "Voice_ch2" } } diff --git a/op25/gr-op25_repeater/apps/smartnet_example.json b/op25/gr-op25_repeater/apps/smartnet_example.json index 3ef227e1..7c9f9d4c 100644 --- a/op25/gr-op25_repeater/apps/smartnet_example.json +++ b/op25/gr-op25_repeater/apps/smartnet_example.json @@ -129,6 +129,7 @@ "http_plot_interval": 1.0, "http_plot_directory": "../www/images", "tuning_step_large": 1200, - "tuning_step_small": 100 + "tuning_step_small": 100, + "default_channel": "voice channel" } } diff --git a/op25/gr-op25_repeater/apps/terminal.py b/op25/gr-op25_repeater/apps/terminal.py index ec2a300b..84b74034 100755 --- a/op25/gr-op25_repeater/apps/terminal.py +++ b/op25/gr-op25_repeater/apps/terminal.py @@ -91,6 +91,7 @@ def __init__(self, input_q, output_q, sock=None, **kwds): self.current_encrypted = 0 self.current_msgqid = '0' self.channel_list = [] + self.default_channel = None self.capture_active = False self.hold_tgid = 0 self.maxx = 0 @@ -168,8 +169,6 @@ def title_help(self): title_str = "OP25 (symbol capture)" else: title_str = "OP25" - if self.hold_tgid != 0: - title_str += (" (holding tg %d)" % self.hold_tgid) help_str = "(f)req (h)old (s)kip (l)ock (W)list (B)list (q)uit (1-6)plot (,.<>)tune" self.title_bar.erase() self.help_bar.erase() @@ -418,6 +417,16 @@ def process_json(self, js): if ('channels' not in msg) or (len(msg['channels']) == 0): return self.channel_list = msg['channels'] + + # Pick the default channel if specified and this is the first update received. + if self.default_channel is not None and self.default_channel != "": + for ch_id in self.channel_list: + if msg[ch_id]['name'] == self.default_channel: + self.current_msgqid = ch_id + break + self.default_channel = None + + # Format and display the channel info c_id = self.current_msgqid if self.current_msgqid in self.channel_list else self.channel_list[0] if 'system' in msg[c_id] and msg[c_id]['system'] is not None: self.current_sysname = msg[c_id]['system'] @@ -431,14 +440,12 @@ def process_json(self, js): if msg[c_id]['capture'] != self.capture_active: self.capture_active = msg[c_id]['capture'] self.title_help() - if msg[c_id]['hold_tgid'] is not None: - if msg[c_id]['hold_tgid'] != self.hold_tgid: - self.hold_tgid = msg[c_id]['hold_tgid'] - self.title_help() if msg[c_id]['tgid'] is not None: s += ' Talkgroup ID %s' % (int(msg[c_id]['tgid'])) if 'tdma' in msg[c_id] and msg[c_id]['tdma'] is not None: s += ' TDMA Slot %s' % int(msg[c_id]['tdma']) + if msg[c_id]['hold_tgid'] is not None: + s += ' [HOLD]' if 'mode' in msg[c_id]: mode = msg[c_id]['mode'] if mode == 0: @@ -493,6 +500,8 @@ def process_json(self, js): self.sm_step = int(msg['tuning_step_small']) if 'tuning_step_large' in msg and int(msg['tuning_step_large']) > 0: self.lg_step = int(msg['tuning_step_large']) + if 'default_channel' in msg and str(msg['default_channel']) != "": + self.default_channel = str(msg['default_channel']) return False diff --git a/op25/gr-op25_repeater/www/www-static/main.js b/op25/gr-op25_repeater/www/www-static/main.js index d4d9822d..d2578555 100644 --- a/op25/gr-op25_repeater/www/www-static/main.js +++ b/op25/gr-op25_repeater/www/www-static/main.js @@ -51,6 +51,7 @@ var c_nac = 0; var c_name = ""; var channel_list = []; var channel_index = 0; +var default_channel = null; function find_parent(ele, tagname) { while (ele) { @@ -164,6 +165,9 @@ function term_config(d) { if (updated) { set_tuning_step_sizes(lg_step, sm_step); } + if ((d["default_channel"] != undefined) && (d["default_channel"] != "")) { + default_channel = d["default_channel"]; + } } function set_tuning_step_sizes(lg_step=1200, sm_step=100) { @@ -269,6 +273,18 @@ function channel_update(d) { channel_list = d['channels']; if (channel_list.length > 0) { + // if this is the first update, find the default_channel if specified + if (default_channel != null && default_channel != "") { + for (ch_id = 0; ch_id < channel_list.length; ch_id++) { + if (d[ch_id]['name'] == default_channel) { + channel_index = ch_id; + break; + } + } + default_channel = null; + } + + // display channel information var c_id = channel_list[channel_index]; c_system = d[c_id]['system']; c_name = "[" + c_id + "]";