mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
29 lines
781 B
Python
29 lines
781 B
Python
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):
|
|
jsondata = {"ptt": str(on)}
|
|
data_out = json.dumps(jsondata)
|
|
self.broadcast(data_out)
|
|
|
|
def send_scatter_change(self, data):
|
|
jsondata = {"scatter": str(data)}
|
|
data_out = json.dumps(jsondata)
|
|
self.broadcast(data_out)
|
|
|
|
def send_buffer_overflow(self, data):
|
|
jsondata = {"buffer-overflow": str(data)}
|
|
data_out = json.dumps(jsondata)
|
|
self.broadcast(data_out)
|
|
|
|
def send_custom_event(self, **jsondata):
|
|
data_out = json.dumps(jsondata)
|
|
self.broadcast(data_out)
|