Skip to content

Commit

Permalink
Added "default_channel" capability to multi_rx terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
boatbod committed Aug 23, 2023
1 parent a4257a9 commit 2abf6e1
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
7 changes: 4 additions & 3 deletions op25/gr-op25_repeater/apps/cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"channels": [
{
"name": "p25",
"device": "",
"demod_type": "cqpsk",
"cqpsk_tracking": true,
Expand All @@ -12,7 +13,6 @@
"filter_type": "rc",
"frequency": 460412500,
"if_rate": 24000,
"name": "p25",
"plot": "symbol",
"symbol_rate": 4800,
"raw_output": "",
Expand All @@ -24,6 +24,7 @@

},
{
"name": "ysf",
"device": "device_0",
"demod_type": "fsk4",
"cqpsk_tracking": false,
Expand All @@ -32,7 +33,6 @@
"filter_type": "rrc",
"frequency": 460500000,
"if_rate": 24000,
"name": "ysf",
"plot": "datascope",
"symbol_rate": 4800,
"raw_output": "",
Expand All @@ -42,6 +42,7 @@
"nbfm_squelch": -60
},
{
"name": "dmr",
"device": "device_1",
"demod_type": "fsk4",
"cqpsk_tracking": false,
Expand All @@ -50,7 +51,6 @@
"filter_type": "rrc",
"frequency": 460050000,
"if_rate": 24000,
"name": "dmr",
"plot": "symbol",
"symbol_rate": 4800,
"raw_output": "",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion op25/gr-op25_repeater/apps/p25_rtl_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
3 changes: 2 additions & 1 deletion op25/gr-op25_repeater/apps/smartnet_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
21 changes: 15 additions & 6 deletions op25/gr-op25_repeater/apps/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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']
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions op25/gr-op25_repeater/www/www-static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 + "]";
Expand Down

0 comments on commit 2abf6e1

Please sign in to comment.