randome updates

This commit is contained in:
n0mjs710 2020-02-11 15:10:29 -06:00
parent f0a8a881c2
commit 61842d1269
5 changed files with 12 additions and 11 deletions

1
.gitignore vendored
View File

@ -90,6 +90,7 @@ ENV/
.DS_Store .DS_Store
hblink.cfg hblink.cfg
deconstructor.cfg
*.config *.config
*.bak *.bak
rules.py rules.py

View File

@ -60,7 +60,7 @@ ENABLED: True
LOOSE: False LOOSE: False
EXPORT_AMBE: False EXPORT_AMBE: False
IP: IP:
PORT: 54001 PORT: 54666
MASTER_IP: olympic.k0usy.org MASTER_IP: olympic.k0usy.org
MASTER_PORT: 62071 MASTER_PORT: 62071
PASSPHRASE: c0ffee PASSPHRASE: c0ffee

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
############################################################################### ###############################################################################
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com> # Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <n0mjs@me.com>
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
############################################################################### ###############################################################################
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com> # Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <n0mjs@me.com>
# #
# This program is free software; you can redistribute it and/or modify # 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 # 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 random import randint
from voice_lib import words 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! # Precalculated "dmrbits" (DMRD packet byte 15) -- just (slot << 7 | this value) and you're good to go!
HEADBITS = 0b00100001 HEADBITS = 0b00100001
BURSTBITS = [0b00010000,0b00000001,0b00000010,0b00000011,0b00000100,0b00000101] BURSTBITS = [0b00010000,0b00000001,0b00000010,0b00000011,0b00000100,0b00000101]
@ -82,7 +84,8 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
SEQ = (SEQ + 1) % 0x100 SEQ = (SEQ + 1) % 0x100
yield pkt yield pkt
# Send a single Voice Terminator Frame # 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 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 SEQ = (SEQ + 1) % 0x100
yield pkt yield pkt

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
############################################################################### ###############################################################################
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com> # Copyright (C) 2016-2020 Cortney T. Buffington, N0MJS <n0mjs@me.com>
# #
# This program is free software; you can redistribute it and/or modify # 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 # 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' self.last_stream = b'\x00'
def play_voice(self, _rf_src, _tgid, _peer, _slot, _speech): def play_voice(self, _rf_src, _tgid, _peer, _slot, _speech):
print("starting playback")
speech = pkt_gen(_rf_src, _tgid, _peer, _slot, _speech) speech = pkt_gen(_rf_src, _tgid, _peer, _slot, _speech)
sleep(1) sleep(1)
@ -89,12 +88,10 @@ class HBP(HBSYSTEM):
break break
sleep(.058) sleep(.058)
self.send_system(pkt) self.send_system(pkt)
print("sent packet")
return None return None
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data): 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): 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 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']])) feedback = Thread(target=self.play_voice(bytes_3(3120102), bytes_3(2), bytes_4(3120119), 0, [words['connected'], words['kansas_link']]))