Testing OP25 Improvements

- New system of handling thread
This commit is contained in:
Logan Cusano
2022-03-19 01:18:45 -04:00
parent 4f230f8d33
commit 126ba907af
2 changed files with 31 additions and 8 deletions

View File

@@ -15,14 +15,37 @@ class OP25Handler(threading.Thread):
self.HTTP_ENABLED = False
#def start(self) -> None:
self.Start_OP25 = False
self.Stop_OP25 = False
def run(self) -> None:
self.open_op25()
while True:
if self.Start_OP25:
self.open_op25()
def set_op25_parameters(self, _frequency, _http_enabled: bool = True):
self.Frequency = _frequency
self.Start_OP25 = False
self.Stop_OP25 = False
self.HTTP_ENABLED = _http_enabled
while not self.Stop_OP25:
time.sleep(1)
self.close_op25()
time.sleep(.5)
def set_op25_parameters(self, _frequency: str = False, _http_enabled: bool = True, _start: bool = False, _stop: bool = False):
if _frequency:
self.Frequency = _frequency
if _start:
self.Start_OP25 = _start
if _stop:
self.Stop_OP25 = _stop
if _http_enabled:
self.HTTP_ENABLED = _http_enabled
def open_op25(self):
if self.OP25Proc is not None: