From 5bd49eb547c484481b342929940d5154de4ec663 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 2 Oct 2015 09:40:41 -0400 Subject: re-add skip function --- op25/gr-op25_repeater/apps/scope.py | 8 ++++---- op25/gr-op25_repeater/apps/trunking.py | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/op25/gr-op25_repeater/apps/scope.py b/op25/gr-op25_repeater/apps/scope.py index 3a38441..5bc36ed 100755 --- a/op25/gr-op25_repeater/apps/scope.py +++ b/op25/gr-op25_repeater/apps/scope.py @@ -620,10 +620,10 @@ class p25_rx_block (stdgui2.std_top_block): hbox.Add(vbox_form, 0, 0) vbox_buttons = wx.BoxSizer(wx.VERTICAL) -# skip_button = form.button_with_callback( -# parent=self.panel, label="Skip", -# callback=self.form_skip) -# vbox_buttons.Add(skip_button, 0, 0) + skip_button = form.button_with_callback( + parent=self.panel, label="Skip", + callback=self.form_skip) + vbox_buttons.Add(skip_button, 0, 0) lockout_button = form.button_with_callback( parent=self.panel, label="Lockout", callback=self.form_lockout) diff --git a/op25/gr-op25_repeater/apps/trunking.py b/op25/gr-op25_repeater/apps/trunking.py index 9465330..7959074 100644 --- a/op25/gr-op25_repeater/apps/trunking.py +++ b/op25/gr-op25_repeater/apps/trunking.py @@ -172,7 +172,15 @@ class trunked_system (object): tgid not in self.blacklist and not (self.whitelist and tgid not in self.whitelist))] + def blacklist_update(self, start_time): + expired_tgs = [tg for tg in self.blacklist.keys() + if self.blacklist[tg] is not None + and self.blacklist[tg] < start_time] + for tg in expired_tgs: + self.blacklist.pop(tg) + def find_talkgroup(self, start_time, tgid=None): + self.blacklist_update(start_time) if tgid is not None and tgid in self.talkgroups and self.talkgroups[tgid]['time'] >= start_time: return self.talkgroups[tgid]['frequency'], tgid, self.talkgroups[tgid]['tdma_slot'] for active_tgid in self.talkgroups: @@ -188,10 +196,10 @@ class trunked_system (object): return self.talkgroups[active_tgid]['frequency'], active_tgid, self.talkgroups[active_tgid]['tdma_slot'] return None, None, None - def add_blacklist(self, tgid): + def add_blacklist(self, tgid, end_time=None): if not tgid: return - self.blacklist[tgid] = 1 + self.blacklist[tgid] = end_time def decode_mbt_data(self, opcode, header, mbt_data): self.cc_timeouts = 0 @@ -480,6 +488,7 @@ class rx_ctl (object): self.tgid_hold = None self.tgid_hold_until = time.time() self.TGID_HOLD_TIME = 2.0 # TODO: make more configurable + self.TGID_SKIP_TIME = 15.0 # TODO: make more configurable self.current_nac = None self.current_id = 0 self.TSYS_HOLD_TIME = 3.0 # TODO: make more configurable @@ -839,11 +848,12 @@ class rx_ctl (object): self.current_tgid = None self.tgid_hold = None self.tgid_hold_until = curr_time - elif command == 'skip': - pass # TODO - elif command == 'lockout': + elif command == 'skip' or command == 'lockout': if self.current_tgid: - tsys.add_blacklist(self.current_tgid) + end_time = None + if command == 'skip': + end_time = curr_time + self.TGID_SKIP_TIME + tsys.add_blacklist(self.current_tgid, end_time=end_time) self.current_tgid = None self.tgid_hold = None self.tgid_hold_until = curr_time -- cgit v1.2.3