2024-01-18 10:35:44 +00:00
|
|
|
from command import TxCommand
|
|
|
|
import api_validations
|
|
|
|
import base64
|
|
|
|
from queue import Queue
|
|
|
|
from arq_session_iss import ARQSessionISS
|
|
|
|
from message_p2p import MessageP2P
|
2024-01-24 16:45:21 +00:00
|
|
|
from arq_data_type_handler import ARQDataTypeHandler
|
2024-01-18 10:35:44 +00:00
|
|
|
|
|
|
|
class SendMessageCommand(TxCommand):
|
|
|
|
"""Command to send a P2P message using an ARQ transfer session
|
|
|
|
"""
|
|
|
|
|
|
|
|
def set_params_from_api(self, apiParams):
|
|
|
|
origin = f"{self.config['STATION']['mycall']}-{self.config['STATION']['myssid']}"
|
|
|
|
self.message = MessageP2P.from_api_params(origin, apiParams)
|
|
|
|
|
|
|
|
def transmit(self, modem):
|
2024-01-24 16:45:21 +00:00
|
|
|
data, data_type = self.arq_data_type_handler.prepare(self.message.to_payload, 'p2pmsg_lzma')
|
2024-01-18 10:35:44 +00:00
|
|
|
iss = ARQSessionISS(self.config, modem,
|
|
|
|
self.message.destination,
|
2024-01-24 16:45:21 +00:00
|
|
|
data,
|
|
|
|
self.state_manager,
|
|
|
|
data_type)
|
2024-01-18 10:35:44 +00:00
|
|
|
|
|
|
|
self.state_manager.register_arq_iss_session(iss)
|
|
|
|
iss.start()
|