diff --git a/app/client.py b/app/client.py index 0f4bf5f..976bf5d 100644 --- a/app/client.py +++ b/app/client.py @@ -35,6 +35,7 @@ class DiscordStatusValues(str, Enum): ONLINE = "online" # The discord client is online OFFLINE = "offline" # The discord client is offline + class OP25StatusValues(str, Enum): LISTENING = "listening" # OP25 is online and listening ONLINE = "online" # OP25 is online @@ -140,6 +141,32 @@ async def get_status(websocket, request_id): # Corrected line: Convert the dictionary to a JSON string before sending await websocket.send(json.dumps({"type":"response", "request_id": request_id, "payload": response_payload})) +# Start OP25 +@command +async def op25_start(websocket): + await drb_api.start_op25() + +# Stop OP25 +@command +async def op25_stop(websocket): + await drb_api.stop_op25() + +# Set OP25 Config +@command +async def op25_set(websocket, system_id): + system_config = await srv_api.get_system_details(system_id) + + temp_config = ConfigGenerator( + type=system_config['type'], + systemName=system_config['name'], + channels=system_config['frequencies'], + tags=system_config['tags'], + whitelist=system_config['whitelist'] + ) + + await drb_api.generate_op25_config(temp_config) + +# Example command @command async def run_task(websocket, task_id, duration_seconds): """Example command: Simulates running a task."""