2023-02-14 15:39:59 +01:00
|
|
|
from pycsdr.types import Format
|
2023-08-21 23:18:58 +02:00
|
|
|
from pycsdr.modules import ExecModule
|
2023-08-29 01:56:27 +02:00
|
|
|
from csdr.module import LineBasedModule
|
2023-02-14 18:36:17 +01:00
|
|
|
from owrx.wsjt import WsjtParser, Msk144Profile
|
|
|
|
|
import pickle
|
|
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
logger = logging.getLogger(__name__)
|
2023-02-14 15:39:59 +01:00
|
|
|
|
|
|
|
|
|
2023-08-21 23:18:58 +02:00
|
|
|
class Msk144Module(ExecModule):
|
|
|
|
|
def __init__(self):
|
|
|
|
|
super().__init__(
|
|
|
|
|
Format.SHORT,
|
|
|
|
|
Format.CHAR,
|
|
|
|
|
["msk144decoder"]
|
|
|
|
|
)
|
2023-02-14 18:36:17 +01:00
|
|
|
|
|
|
|
|
|
2023-08-29 01:56:27 +02:00
|
|
|
class ParserAdapter(LineBasedModule):
|
2023-02-14 18:36:17 +01:00
|
|
|
def __init__(self):
|
|
|
|
|
self.parser = WsjtParser()
|
|
|
|
|
self.dialFrequency = 0
|
2023-08-29 01:56:27 +02:00
|
|
|
self.profile = Msk144Profile()
|
2023-02-14 18:36:17 +01:00
|
|
|
super().__init__()
|
|
|
|
|
|
2023-08-29 01:56:27 +02:00
|
|
|
def process(self, line: bytes):
|
|
|
|
|
# actual messages from msk144decoder should start with "*** "
|
|
|
|
|
if line[0:4] == b"*** ":
|
|
|
|
|
return self.parser.parse(self.profile, self.dialFrequency, line[4:])
|
2023-02-14 18:36:17 +01:00
|
|
|
|
|
|
|
|
def setDialFrequency(self, frequency: int) -> None:
|
|
|
|
|
self.dialFrequency = frequency
|