use new library for js8 decoding
This commit is contained in:
parent
ddfd85c586
commit
bcb8a2315c
15
owrx/js8.py
15
owrx/js8.py
@ -1,6 +1,8 @@
|
||||
from .wsjt import WsjtChopper
|
||||
from .parser import Parser
|
||||
import re
|
||||
from js8py import Js8
|
||||
from js8py.frames import Js8FrameDirected, Js8FrameData, Js8FrameDataCompressed
|
||||
|
||||
import logging
|
||||
|
||||
@ -22,6 +24,7 @@ class Js8Parser(Parser):
|
||||
decoderRegex = re.compile(" ?<Decode(Started|Debug|Finished)>")
|
||||
|
||||
def parse(self, raw):
|
||||
try:
|
||||
freq, raw_msg = raw
|
||||
self.setDialFrequency(freq)
|
||||
msg = raw_msg.decode().rstrip()
|
||||
@ -29,4 +32,16 @@ class Js8Parser(Parser):
|
||||
return
|
||||
if msg.startswith(" EOF on input file"):
|
||||
return
|
||||
|
||||
logger.debug(msg)
|
||||
|
||||
frame = Js8().parse_message(msg)
|
||||
if frame is None:
|
||||
logger.warning("message could not be parsed")
|
||||
elif isinstance(frame, Js8FrameDirected):
|
||||
logger.debug("directed frame from: {0} to: {1}".format(frame.callsign_from, frame.callsign_to))
|
||||
elif isinstance(frame, Js8FrameData) or isinstance(frame, Js8FrameDataCompressed):
|
||||
logger.debug("message frame: {0}".format(frame.message))
|
||||
|
||||
except Exception:
|
||||
logger.exception("error while parsing js8 message")
|
||||
|
Loading…
Reference in New Issue
Block a user