2023-11-08 16:46:15 +00:00
|
|
|
import json
|
|
|
|
|
|
|
|
class EventManager:
|
|
|
|
|
|
|
|
def __init__(self, queues):
|
|
|
|
self.queues = queues
|
|
|
|
|
|
|
|
def broadcast(self, data):
|
|
|
|
for q in self.queues:
|
|
|
|
q.put(data)
|
|
|
|
|
|
|
|
def send_ptt_change(self, on:bool = False):
|
2023-11-26 11:45:51 +00:00
|
|
|
self.broadcast({"ptt": str(on)})
|
2023-11-12 22:22:53 +00:00
|
|
|
|
|
|
|
def send_scatter_change(self, data):
|
2023-11-26 11:45:51 +00:00
|
|
|
self.broadcast({"scatter": str(data)})
|
2023-11-13 17:11:55 +00:00
|
|
|
|
|
|
|
def send_buffer_overflow(self, data):
|
2023-11-26 11:45:51 +00:00
|
|
|
self.broadcast({"buffer-overflow": str(data)})
|
2023-11-20 08:00:07 +00:00
|
|
|
|
2023-11-26 11:45:51 +00:00
|
|
|
def send_custom_event(self, **event_data):
|
|
|
|
self.broadcast(event_data)
|