Working: TGID, TS and SRC translation working!
This application now meets it’s target functionality!
This commit is contained in:
parent
075dad4ee9
commit
0076fd5f5a
@ -6,10 +6,17 @@
|
||||
# Creative Commons, 444 Castro Street, Suite 900, Mountain View,
|
||||
# California, 94041, USA.
|
||||
|
||||
# This is a sample application that "plays" a voice tranmission
|
||||
# from a datafile... it is really proof of concept for now.
|
||||
# This is a sample application that "plays" a voice tranmission from a file
|
||||
# that was created with record.py. The file is just a pickle of an entire
|
||||
# transmission.
|
||||
#
|
||||
# This program consults a list of "trigger groups" for each timeslot that
|
||||
# will initiate playback. When playback occurs, several items are re-written:
|
||||
# Source Subscriber: this DMRlink's local subscriber ID
|
||||
# Source Peer: this DMRlink's local subscriber ID
|
||||
# Timeslot: timeslot of the tranmission that triggered
|
||||
# TGID: TGID of the message that triggered it
|
||||
|
||||
# PROOF OF CONCEPT ONLY - GUARANTEED TO NOT WORK AS IS!!!
|
||||
|
||||
from __future__ import print_function
|
||||
from twisted.internet import reactor
|
||||
@ -40,9 +47,12 @@ BURST_DATA_TYPE = {
|
||||
# path+filename for the transmission to play back
|
||||
filename = '../test.pickle'
|
||||
|
||||
# trigger logic - True, trigger on these IDs, False trigger on any but these IDs
|
||||
trigger = False
|
||||
|
||||
# groups that we want to trigger playback of this file (ts1 and ts2)
|
||||
trigger_groups_1 = ['\x00\x00\x02', '\x00\x00\x03']
|
||||
trigger_groups_2 = ['\x00\x00\x02', '\x00\x00\x03']
|
||||
trigger_groups_1 = ['\x00\x00\x01', '\x00\x00\x0D', '\x00\x00\x64']
|
||||
trigger_groups_2 = ['\x00\xC0\x30',]
|
||||
|
||||
class playIPSC(IPSC):
|
||||
|
||||
@ -57,8 +67,13 @@ class playIPSC(IPSC):
|
||||
#
|
||||
def group_voice(self, _network, _src_sub, _dst_group, _ts, _end, _peerid, _data):
|
||||
if _end:
|
||||
print('timeslot: ', _ts)
|
||||
if (_ts == 0 and _dst_group in trigger_groups_1) or (_ts == 1 and _dst_group in trigger_groups_2) :
|
||||
if trigger = True:
|
||||
if (_ts == 0 and _dst_group not in trigger_groups_1) or (_ts == 1 and _dst_group not in trigger_groups_2):
|
||||
return
|
||||
else:
|
||||
if (_ts == 0 and _dst_group in trigger_groups_1) or (_ts == 1 and _dst_group in trigger_groups_2):
|
||||
return
|
||||
|
||||
logger.info('(Event ID: %s) Playback triggered from TS %s, TGID %s', self.event_id, (_ts +1), int_id(_dst_group))
|
||||
|
||||
# Determine the type of voice packet this is (see top of file for possible types)
|
||||
|
Loading…
Reference in New Issue
Block a user