2023-12-05 14:40:04 +00:00
|
|
|
import queue
|
2023-12-03 13:11:43 +00:00
|
|
|
from command import TxCommand
|
|
|
|
import api_validations
|
2023-12-05 14:40:04 +00:00
|
|
|
import base64
|
|
|
|
from queue import Queue
|
|
|
|
from arq_session_iss import ARQSessionISS
|
2023-12-21 14:05:22 +00:00
|
|
|
|
|
|
|
|
2023-12-03 13:11:43 +00:00
|
|
|
class ARQRawCommand(TxCommand):
|
|
|
|
|
|
|
|
def set_params_from_api(self, apiParams):
|
2023-12-15 15:22:38 +00:00
|
|
|
self.dxcall = apiParams['dxcall']
|
2023-12-03 13:11:43 +00:00
|
|
|
if not api_validations.validate_freedata_callsign(self.dxcall):
|
|
|
|
self.dxcall = f"{self.dxcall}-0"
|
|
|
|
|
2023-12-05 14:40:04 +00:00
|
|
|
self.data = base64.b64decode(apiParams['data'])
|
2023-12-03 13:11:43 +00:00
|
|
|
|
2023-12-15 23:51:57 +00:00
|
|
|
def run(self, event_queue: Queue, modem):
|
2023-12-05 14:40:04 +00:00
|
|
|
self.emit_event(event_queue)
|
|
|
|
self.logger.info(self.log_message())
|
2023-12-03 13:11:43 +00:00
|
|
|
|
2024-01-04 20:44:59 +00:00
|
|
|
iss = ARQSessionISS(self.config, modem, self.dxcall, self.data, self.state_manager)
|
|
|
|
if iss.id:
|
|
|
|
self.state_manager.register_arq_iss_session(iss)
|
|
|
|
iss.start()
|
|
|
|
return iss
|
|
|
|
return False
|