FreeDATA/freedata-server/command_ping.py

20 lines
604 B
Python
Raw Normal View History

2023-11-23 15:59:53 +00:00
from command import TxCommand
2023-12-01 18:54:07 +00:00
import api_validations
2024-01-30 20:22:04 +00:00
from message_system_db_manager import DatabaseManager
2023-11-23 15:59:53 +00:00
class PingCommand(TxCommand):
2023-11-26 11:53:28 +00:00
def set_params_from_api(self, apiParams):
2023-11-23 15:59:53 +00:00
self.dxcall = apiParams['dxcall']
2023-12-01 18:54:07 +00:00
if not api_validations.validate_freedata_callsign(self.dxcall):
self.dxcall = f"{self.dxcall}-0"
2024-01-30 20:22:04 +00:00
# update callsign database...
DatabaseManager(self.event_manager).get_or_create_station(self.dxcall)
2023-11-26 11:53:28 +00:00
return super().set_params_from_api(apiParams)
2023-11-23 15:59:53 +00:00
def build_frame(self):
return self.frame_factory.build_ping(self.dxcall)