mirror of
https://github.com/jketterl/openwebrx.git
synced 2025-12-06 07:12:09 +01:00
add some basic infrastructure for hfdl
This commit is contained in:
parent
7eb277ce97
commit
f794f285f3
14
csdr/chain/dumphfdl.py
Normal file
14
csdr/chain/dumphfdl.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from csdr.chain.demodulator import ServiceDemodulator
|
||||
from owrx.hfdl.dumphfdl import DumpHFDLModule
|
||||
from csdr.module import JsonParser
|
||||
|
||||
|
||||
class DumpHFDL(ServiceDemodulator):
|
||||
def __init__(self):
|
||||
super().__init__([
|
||||
DumpHFDLModule(),
|
||||
JsonParser("HFDL"),
|
||||
])
|
||||
|
||||
def getFixedAudioRate(self) -> int:
|
||||
return 12000
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
from owrx.ism.rtl433 import Rtl433Module, JsonParser
|
||||
from csdr.module import JsonParser
|
||||
from owrx.ism.rtl433 import Rtl433Module
|
||||
from csdr.chain.demodulator import ServiceDemodulator
|
||||
|
||||
|
||||
|
|
@ -10,6 +11,6 @@ class Rtl433(ServiceDemodulator):
|
|||
super().__init__(
|
||||
[
|
||||
Rtl433Module(),
|
||||
JsonParser(),
|
||||
JsonParser("ISM"),
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ from subprocess import Popen, PIPE
|
|||
from functools import partial
|
||||
import pickle
|
||||
import logging
|
||||
import json
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Module(BaseModule, metaclass=ABCMeta):
|
||||
|
|
@ -146,6 +149,21 @@ class LineBasedModule(ThreadModule, metaclass=ABCMeta):
|
|||
pass
|
||||
|
||||
|
||||
class JsonParser(LineBasedModule):
|
||||
def __init__(self, mode: str):
|
||||
self.mode = mode
|
||||
super().__init__()
|
||||
|
||||
def process(self, line):
|
||||
try:
|
||||
msg = json.loads(line.decode())
|
||||
msg["mode"] = self.mode
|
||||
logger.debug(msg)
|
||||
return msg
|
||||
except json.JSONDecodeError:
|
||||
logger.exception("error parsing rtl433 json")
|
||||
|
||||
|
||||
class PopenModule(AutoStartModule, metaclass=ABCMeta):
|
||||
def __init__(self):
|
||||
self.process = None
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@
|
|||
<div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-pocsag-message" style="display: none; width: 619px;" data-panel-name="pocsag-message"></div>
|
||||
<div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-adsb-message" style="display: none; width: 619px;" data-panel-name="adsb-message"></div>
|
||||
<div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-ism-message" style="display: none; width: 619px;" data-panel-name="ism-message"></div>
|
||||
<div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-hfdl-message" style="display: none; width: 619px;" data-panel-name="hfdl-message"></div>
|
||||
<div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-m17" style="display: none;" data-panel-name="metadata-m17">
|
||||
<div class="openwebrx-meta-slot">
|
||||
<div class="openwebrx-meta-user-image">
|
||||
|
|
|
|||
|
|
@ -164,8 +164,10 @@ DemodulatorPanel.prototype.updatePanels = function() {
|
|||
$('#openwebrx-panel-digimodes').attr('data-mode', modulation);
|
||||
var mode = Modes.findByModulation(modulation);
|
||||
toggle_panel("openwebrx-panel-digimodes", modulation && (!mode || mode.secondaryFft));
|
||||
// WSJT-X modes share the same panel
|
||||
toggle_panel("openwebrx-panel-wsjt-message", ['ft8', 'wspr', 'jt65', 'jt9', 'ft4', 'fst4', 'fst4w', "q65", "msk144"].indexOf(modulation) >= 0);
|
||||
['js8', 'packet', 'pocsag', 'adsb', 'ism'].forEach(function(m) {
|
||||
// these modes come with their own
|
||||
['js8', 'packet', 'pocsag', 'adsb', 'ism', 'hfdl'].forEach(function(m) {
|
||||
toggle_panel('openwebrx-panel-' + m + '-message', modulation === m);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -460,4 +460,40 @@ $.fn.ismMessagePanel = function() {
|
|||
this.data('panel', new IsmMessagePanel(this));
|
||||
}
|
||||
return this.data('panel');
|
||||
};
|
||||
|
||||
HfdlMessagePanel = function(el) {
|
||||
MessagePanel.call(this, el);
|
||||
this.initClearTimer();
|
||||
}
|
||||
|
||||
HfdlMessagePanel.prototype = new MessagePanel();
|
||||
|
||||
HfdlMessagePanel.prototype.render = function() {
|
||||
$(this.el).append($(
|
||||
'<table>' +
|
||||
'<thead><tr>' +
|
||||
'<th class="model">Model</th>' +
|
||||
'<th class="id">ID</th>' +
|
||||
'<th class="channel">Channel</th>' +
|
||||
'<th class="data">Data</th>' +
|
||||
'</tr></thead>' +
|
||||
'<tbody></tbody>' +
|
||||
'</table>'
|
||||
));
|
||||
};
|
||||
|
||||
HfdlMessagePanel.prototype.supportsMessage = function(message) {
|
||||
return message['mode'] === 'HFDL';
|
||||
};
|
||||
|
||||
HfdlMessagePanel.prototype.pushMessage = function(message) {
|
||||
console.info(message);
|
||||
};
|
||||
|
||||
$.fn.hfdlMessagePanel = function() {
|
||||
if (!this.data('panel')) {
|
||||
this.data('panel', new HfdlMessagePanel(this));
|
||||
}
|
||||
return this.data('panel');
|
||||
};
|
||||
|
|
@ -859,14 +859,10 @@ function on_ws_recv(evt) {
|
|||
break;
|
||||
case 'secondary_demod':
|
||||
var value = json['value'];
|
||||
var panels = [
|
||||
$("#openwebrx-panel-wsjt-message").wsjtMessagePanel(),
|
||||
$('#openwebrx-panel-packet-message').packetMessagePanel(),
|
||||
$('#openwebrx-panel-pocsag-message').pocsagMessagePanel(),
|
||||
$('#openwebrx-panel-adsb-message').adsbMessagePanel(),
|
||||
$('#openwebrx-panel-ism-message').ismMessagePanel(),
|
||||
$("#openwebrx-panel-js8-message").js8()
|
||||
];
|
||||
var panels = ['wsjt', 'packet', 'pocsag', 'adsb', 'ism', 'hfdl'].map(function(id) {
|
||||
return $('#openwebrx-panel-' + id + '-message')[id + 'MessagePanel']();
|
||||
});
|
||||
panels.push($('#openwebrx-panel-js8-message').js8());
|
||||
if (!panels.some(function(panel) {
|
||||
if (!panel.supportsMessage(value)) return false;
|
||||
panel.pushMessage(value);
|
||||
|
|
@ -1467,11 +1463,9 @@ function secondary_demod_init() {
|
|||
.mousedown(secondary_demod_canvas_container_mousedown)
|
||||
.mouseenter(secondary_demod_canvas_container_mousein)
|
||||
.mouseleave(secondary_demod_canvas_container_mouseleave);
|
||||
$('#openwebrx-panel-wsjt-message').wsjtMessagePanel();
|
||||
$('#openwebrx-panel-packet-message').packetMessagePanel();
|
||||
$('#openwebrx-panel-pocsag-message').pocsagMessagePanel();
|
||||
$('#openwebrx-panel-adsb-message').adsbMessagePanel();
|
||||
$('#openwebrx-panel-ism-message').ismMessagePanel();
|
||||
['wsjt', 'packet', 'pocsag', 'adsb', 'ism', 'hfdl'].forEach(function(id){
|
||||
$('#openwebrx-panel-' + id + '-message')[id + 'MessagePanel']();
|
||||
})
|
||||
$('#openwebrx-panel-js8-message').js8();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -624,6 +624,9 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
|
|||
elif mod == "ism":
|
||||
from csdr.chain.rtl433 import Rtl433
|
||||
return Rtl433()
|
||||
elif mod == "hfdl":
|
||||
from csdr.chain.dumphfdl import DumpHFDL
|
||||
return DumpHFDL()
|
||||
|
||||
def setSecondaryDemodulator(self, mod):
|
||||
demodulator = self._getSecondaryDemodulator(mod)
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ class FeatureDetector(object):
|
|||
"drm": ["dream"],
|
||||
"dump1090": ["dump1090"],
|
||||
"ism": ["rtl_433"],
|
||||
"dumphfdl": ["dumphfdl"],
|
||||
}
|
||||
|
||||
def feature_availability(self):
|
||||
|
|
@ -602,3 +603,9 @@ class FeatureDetector(object):
|
|||
Debian and Ubuntu based systems should be able to install the package `rtl-433` from the package manager.
|
||||
"""
|
||||
return self.command_is_runnable("rtl_433 -h")
|
||||
|
||||
def has_dumphfdl(self):
|
||||
"""
|
||||
TODO
|
||||
"""
|
||||
return self.command_is_runnable("dumphfdl --version")
|
||||
|
|
|
|||
18
owrx/hfdl/dumphfdl.py
Normal file
18
owrx/hfdl/dumphfdl.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
from pycsdr.modules import ExecModule
|
||||
from pycsdr.types import Format
|
||||
|
||||
|
||||
class DumpHFDLModule(ExecModule):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
Format.COMPLEX_FLOAT,
|
||||
Format.CHAR,
|
||||
[
|
||||
"dumphfdl",
|
||||
"--iq-file", "-",
|
||||
"--sample-format", "CF32",
|
||||
"--sample-rate", "12000",
|
||||
"--output", "decoded:json:file:path=-",
|
||||
"0",
|
||||
]
|
||||
)
|
||||
|
|
@ -1,11 +1,5 @@
|
|||
from pycsdr.modules import ExecModule
|
||||
from pycsdr.types import Format
|
||||
from csdr.module import LineBasedModule
|
||||
import json
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Rtl433Module(ExecModule):
|
||||
|
|
@ -17,12 +11,3 @@ class Rtl433Module(ExecModule):
|
|||
)
|
||||
|
||||
|
||||
class JsonParser(LineBasedModule):
|
||||
def process(self, line):
|
||||
try:
|
||||
msg = json.loads(line.decode())
|
||||
msg["mode"] = "ISM"
|
||||
logger.debug(msg)
|
||||
return msg
|
||||
except json.JSONDecodeError:
|
||||
logger.exception("error parsing rtl433 json")
|
||||
|
|
|
|||
|
|
@ -181,6 +181,14 @@ class Modes(object):
|
|||
bandpass=None,
|
||||
requirements=["ism"],
|
||||
squelch=False,
|
||||
),
|
||||
DigitalMode(
|
||||
"hfdl",
|
||||
"HFDL",
|
||||
underlying=["empty"],
|
||||
bandpass=Bandpass(0, 3000),
|
||||
requirements=["dumphfdl"],
|
||||
squelch=False,
|
||||
)
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue