42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
import threading
|
|
import subprocess
|
|
import os
|
|
|
|
|
|
class OP25Handler(threading.Thread):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.OP25Dir: str = "/home/pi/op25/op25/gr-op25_repeater/apps"
|
|
self.OP25Proc = None
|
|
|
|
self.Frequency = None
|
|
|
|
def run(self) -> None:
|
|
self.open_op25()
|
|
|
|
def set_op25_parameters(self, _frequency):
|
|
self.Frequency = _frequency
|
|
|
|
def open_op25(self):
|
|
if self.OP25Proc is not None:
|
|
self.close_op25()
|
|
|
|
print(f"Starting OP25")
|
|
|
|
print(os.getcwd())
|
|
|
|
os.chdir(self.OP25Dir)
|
|
|
|
print(os.getcwd())
|
|
|
|
self.OP25Proc = subprocess.Popen([f"./rx.py", "--args", "'rtl'", "-N", "'LNA:49'", "-s",
|
|
"200000", "-o", "25600", "-U", "-f", f"{self.Frequency}e6", "-X", "-2",
|
|
"-l" "http:0.0.0.0:8080"])
|
|
|
|
def close_op25(self):
|
|
print(f"Closing OP25")
|
|
try:
|
|
self.OP25Proc.kill()
|
|
except Exception as e:
|
|
print(e)
|