FreeDATA/modem/server_commands.py

27 lines
718 B
Python
Raw Normal View History

2023-11-09 09:37:45 +00:00
from queues import DATA_QUEUE_TRANSMIT
2023-11-09 14:48:10 +00:00
import structlog
log = structlog.get_logger("COMMANDS")
2023-11-09 09:37:45 +00:00
2023-11-09 17:00:12 +00:00
def cqcqcq():
2023-11-09 12:52:27 +00:00
DATA_QUEUE_TRANSMIT.put(["CQ"])
2023-11-09 14:48:10 +00:00
def ping_ping(data):
try:
dxcallsign = data["dxcallsign"]
if not str(dxcallsign).strip():
return
DATA_QUEUE_TRANSMIT.put(["PING", None, dxcallsign])
except Exception as err:
log.warning(
"[CMD] PING command execution error", e=err, command=data
)
def beacon(data):
2023-11-09 17:00:12 +00:00
beacon_state = data['enabled'] in ['True']
2023-11-09 14:48:10 +00:00
#Beacon.beacon_state = beacon_state
log.info(
"[CMD] Changing beacon state", state=beacon_state
)
2023-11-09 21:11:53 +00:00
DATA_QUEUE_TRANSMIT.put(["BEACON", 300, beacon_state])