send messages to frontend, spots to pskreporter
This commit is contained in:
parent
bcb8a2315c
commit
2de0cbc6c0
@ -13,6 +13,7 @@ from owrx.locator import Locator
|
|||||||
from owrx.property import PropertyStack
|
from owrx.property import PropertyStack
|
||||||
from multiprocessing import Queue
|
from multiprocessing import Queue
|
||||||
from queue import Full
|
from queue import Full
|
||||||
|
from js8py import Js8Frame
|
||||||
import json
|
import json
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
@ -333,6 +334,15 @@ class OpenWebRxReceiverClient(Client):
|
|||||||
def write_backoff_message(self, reason):
|
def write_backoff_message(self, reason):
|
||||||
self.send({"type": "backoff", "reason": reason})
|
self.send({"type": "backoff", "reason": reason})
|
||||||
|
|
||||||
|
def write_js8_message(self, frame: Js8Frame, freq: int):
|
||||||
|
self.send({"type": "js8_message", "value": {
|
||||||
|
"msg": str(frame),
|
||||||
|
"timestamp": frame.timestamp,
|
||||||
|
"db": frame.db,
|
||||||
|
"dt": frame.dt,
|
||||||
|
"freq": freq + frame.freq,
|
||||||
|
}})
|
||||||
|
|
||||||
|
|
||||||
class MapConnection(Client):
|
class MapConnection(Client):
|
||||||
def __init__(self, conn):
|
def __init__(self, conn):
|
||||||
|
26
owrx/js8.py
26
owrx/js8.py
@ -2,7 +2,9 @@ from .wsjt import WsjtChopper
|
|||||||
from .parser import Parser
|
from .parser import Parser
|
||||||
import re
|
import re
|
||||||
from js8py import Js8
|
from js8py import Js8
|
||||||
from js8py.frames import Js8FrameDirected, Js8FrameData, Js8FrameDataCompressed
|
from js8py.frames import Js8FrameHeartbeat
|
||||||
|
from owrx.map import Map, LocatorLocation
|
||||||
|
from owrx.pskreporter import PskReporter
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -36,12 +38,22 @@ class Js8Parser(Parser):
|
|||||||
logger.debug(msg)
|
logger.debug(msg)
|
||||||
|
|
||||||
frame = Js8().parse_message(msg)
|
frame = Js8().parse_message(msg)
|
||||||
if frame is None:
|
self.handler.write_js8_message(frame, self.dial_freq)
|
||||||
logger.warning("message could not be parsed")
|
logger.debug(frame)
|
||||||
elif isinstance(frame, Js8FrameDirected):
|
|
||||||
logger.debug("directed frame from: {0} to: {1}".format(frame.callsign_from, frame.callsign_to))
|
if isinstance(frame, Js8FrameHeartbeat):
|
||||||
elif isinstance(frame, Js8FrameData) or isinstance(frame, Js8FrameDataCompressed):
|
Map.getSharedInstance().updateLocation(
|
||||||
logger.debug("message frame: {0}".format(frame.message))
|
frame.callsign, LocatorLocation(frame.grid), "JS8", self.band
|
||||||
|
)
|
||||||
|
PskReporter.getSharedInstance().spot({
|
||||||
|
"callsign": frame.callsign,
|
||||||
|
"mode": "JS8",
|
||||||
|
"locator": frame.grid,
|
||||||
|
"freq": self.dial_freq + frame.freq,
|
||||||
|
"db": frame.db,
|
||||||
|
"timestamp": frame.timestamp,
|
||||||
|
"msg": str(frame)
|
||||||
|
})
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("error while parsing js8 message")
|
logger.exception("error while parsing js8 message")
|
||||||
|
@ -30,7 +30,7 @@ class PskReporter(object):
|
|||||||
sharedInstance = None
|
sharedInstance = None
|
||||||
creationLock = threading.Lock()
|
creationLock = threading.Lock()
|
||||||
interval = 300
|
interval = 300
|
||||||
supportedModes = ["FT8", "FT4", "JT9", "JT65"]
|
supportedModes = ["FT8", "FT4", "JT9", "JT65", "JS8"]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getSharedInstance():
|
def getSharedInstance():
|
||||||
|
Loading…
Reference in New Issue
Block a user