re-add skip function
This commit is contained in:
parent
b3fee05fd0
commit
5bd49eb547
|
@ -620,10 +620,10 @@ class p25_rx_block (stdgui2.std_top_block):
|
||||||
hbox.Add(vbox_form, 0, 0)
|
hbox.Add(vbox_form, 0, 0)
|
||||||
|
|
||||||
vbox_buttons = wx.BoxSizer(wx.VERTICAL)
|
vbox_buttons = wx.BoxSizer(wx.VERTICAL)
|
||||||
# skip_button = form.button_with_callback(
|
skip_button = form.button_with_callback(
|
||||||
# parent=self.panel, label="Skip",
|
parent=self.panel, label="Skip",
|
||||||
# callback=self.form_skip)
|
callback=self.form_skip)
|
||||||
# vbox_buttons.Add(skip_button, 0, 0)
|
vbox_buttons.Add(skip_button, 0, 0)
|
||||||
lockout_button = form.button_with_callback(
|
lockout_button = form.button_with_callback(
|
||||||
parent=self.panel, label="Lockout",
|
parent=self.panel, label="Lockout",
|
||||||
callback=self.form_lockout)
|
callback=self.form_lockout)
|
||||||
|
|
|
@ -172,7 +172,15 @@ class trunked_system (object):
|
||||||
tgid not in self.blacklist and
|
tgid not in self.blacklist and
|
||||||
not (self.whitelist and tgid not in self.whitelist))]
|
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):
|
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:
|
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']
|
return self.talkgroups[tgid]['frequency'], tgid, self.talkgroups[tgid]['tdma_slot']
|
||||||
for active_tgid in self.talkgroups:
|
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 self.talkgroups[active_tgid]['frequency'], active_tgid, self.talkgroups[active_tgid]['tdma_slot']
|
||||||
return None, None, None
|
return None, None, None
|
||||||
|
|
||||||
def add_blacklist(self, tgid):
|
def add_blacklist(self, tgid, end_time=None):
|
||||||
if not tgid:
|
if not tgid:
|
||||||
return
|
return
|
||||||
self.blacklist[tgid] = 1
|
self.blacklist[tgid] = end_time
|
||||||
|
|
||||||
def decode_mbt_data(self, opcode, header, mbt_data):
|
def decode_mbt_data(self, opcode, header, mbt_data):
|
||||||
self.cc_timeouts = 0
|
self.cc_timeouts = 0
|
||||||
|
@ -480,6 +488,7 @@ class rx_ctl (object):
|
||||||
self.tgid_hold = None
|
self.tgid_hold = None
|
||||||
self.tgid_hold_until = time.time()
|
self.tgid_hold_until = time.time()
|
||||||
self.TGID_HOLD_TIME = 2.0 # TODO: make more configurable
|
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_nac = None
|
||||||
self.current_id = 0
|
self.current_id = 0
|
||||||
self.TSYS_HOLD_TIME = 3.0 # TODO: make more configurable
|
self.TSYS_HOLD_TIME = 3.0 # TODO: make more configurable
|
||||||
|
@ -839,11 +848,12 @@ class rx_ctl (object):
|
||||||
self.current_tgid = None
|
self.current_tgid = None
|
||||||
self.tgid_hold = None
|
self.tgid_hold = None
|
||||||
self.tgid_hold_until = curr_time
|
self.tgid_hold_until = curr_time
|
||||||
elif command == 'skip':
|
elif command == 'skip' or command == 'lockout':
|
||||||
pass # TODO
|
|
||||||
elif command == 'lockout':
|
|
||||||
if self.current_tgid:
|
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.current_tgid = None
|
||||||
self.tgid_hold = None
|
self.tgid_hold = None
|
||||||
self.tgid_hold_until = curr_time
|
self.tgid_hold_until = curr_time
|
||||||
|
|
Loading…
Reference in New Issue