FreeDATA/modem/event_manager.py

23 lines
541 B
Python
Raw Normal View History

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):
self.broadcast({"ptt": str(on)})
2023-11-12 22:22:53 +00:00
def send_scatter_change(self, data):
self.broadcast({"scatter": str(data)})
2023-11-13 17:11:55 +00:00
def send_buffer_overflow(self, data):
self.broadcast({"buffer-overflow": str(data)})
2023-11-20 08:00:07 +00:00
def send_custom_event(self, **event_data):
self.broadcast(event_data)