From 61842d126914316c41e149dfbae1af1df6b09f6a Mon Sep 17 00:00:00 2001 From: n0mjs710 Date: Tue, 11 Feb 2020 15:10:29 -0600 Subject: [PATCH] randome updates --- .gitignore | 1 + deconstructor.cfg | 2 +- desconstructor.py | 2 +- mk_voice.py | 13 ++++++++----- play_ambe.py | 5 +---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 192fd9b..a73bac1 100755 --- a/.gitignore +++ b/.gitignore @@ -90,6 +90,7 @@ ENV/ .DS_Store hblink.cfg +deconstructor.cfg *.config *.bak rules.py diff --git a/deconstructor.cfg b/deconstructor.cfg index f6edebe..50af9d2 100755 --- a/deconstructor.cfg +++ b/deconstructor.cfg @@ -60,7 +60,7 @@ ENABLED: True LOOSE: False EXPORT_AMBE: False IP: -PORT: 54001 +PORT: 54666 MASTER_IP: olympic.k0usy.org MASTER_PORT: 62071 PASSPHRASE: c0ffee diff --git a/desconstructor.py b/desconstructor.py index 345db1d..5b22edf 100755 --- a/desconstructor.py +++ b/desconstructor.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # ############################################################################### -# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS +# Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mk_voice.py b/mk_voice.py index a06cf3c..8f7c497 100755 --- a/mk_voice.py +++ b/mk_voice.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # ############################################################################### -# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS +# Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,6 +25,8 @@ from dmr_utils3.const import EMB, SLOT_TYPE, BS_VOICE_SYNC, BS_DATA_SYNC, LC_OPT from random import randint from voice_lib import words +LC_OPT = b'\x00\x00\x00' + # Precalculated "dmrbits" (DMRD packet byte 15) -- just (slot << 7 | this value) and you're good to go! HEADBITS = 0b00100001 BURSTBITS = [0b00010000,0b00000001,0b00000010,0b00000011,0b00000100,0b00000101] @@ -82,10 +84,11 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase): SEQ = (SEQ + 1) % 0x100 yield pkt - # Send a single Voice Terminator Frame - pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | TERMBITS]) + STREAM_ID + (TERM_LC[0] + SLOT_TYPE['VOICE_LC_TERM'][:10] + BS_DATA_SYNC + SLOT_TYPE['VOICE_LC_TERM'][-10:] + TERM_LC[1]).tobytes() + TAIL - SEQ = (SEQ + 1) % 0x100 - yield pkt + # Send 2 Voice Terminator Frames + for i in range(2): + pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | TERMBITS]) + STREAM_ID + (TERM_LC[0] + SLOT_TYPE['VOICE_LC_TERM'][:10] + BS_DATA_SYNC + SLOT_TYPE['VOICE_LC_TERM'][-10:] + TERM_LC[1]).tobytes() + TAIL + SEQ = (SEQ + 1) % 0x100 + yield pkt # Return False to indicate we're done. return False diff --git a/play_ambe.py b/play_ambe.py index b33ebaa..f670912 100755 --- a/play_ambe.py +++ b/play_ambe.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # ############################################################################### -# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS +# Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -78,7 +78,6 @@ class HBP(HBSYSTEM): self.last_stream = b'\x00' def play_voice(self, _rf_src, _tgid, _peer, _slot, _speech): - print("starting playback") speech = pkt_gen(_rf_src, _tgid, _peer, _slot, _speech) sleep(1) @@ -89,12 +88,10 @@ class HBP(HBSYSTEM): break sleep(.058) self.send_system(pkt) - print("sent packet") return None def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data): if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM) and (_stream_id != self.last_stream): - print(int_id(_stream_id), int_id(self.last_stream)) self.last_stream = _stream_id feedback = Thread(target=self.play_voice(bytes_3(3120102), bytes_3(2), bytes_4(3120119), 0, [words['connected'], words['kansas_link']]))