add dumpvdl2 basic infrastructure

This commit is contained in:
Jakob Ketterl 2023-09-04 19:02:43 +02:00
parent f794f285f3
commit e934a3935c
9 changed files with 102 additions and 8 deletions

17
csdr/chain/dumpvdl2.py Normal file
View file

@ -0,0 +1,17 @@
from csdr.chain.demodulator import ServiceDemodulator
from csdr.module import JsonParser
from owrx.vdl2.dumpvdl2 import DumpVDL2Module
from pycsdr.modules import Convert
from pycsdr.types import Format
class DumpVDL2(ServiceDemodulator):
def __init__(self):
super().__init__([
Convert(Format.COMPLEX_FLOAT, Format.COMPLEX_SHORT),
DumpVDL2Module(),
JsonParser("VDL2")
])
def getFixedAudioRate(self) -> int:
return 105000

View file

@ -77,6 +77,7 @@
<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-message-panel" id="openwebrx-panel-vdl2-message" style="display: none; width: 619px;" data-panel-name="vdl2-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">

View file

@ -167,7 +167,7 @@ DemodulatorPanel.prototype.updatePanels = function() {
// 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);
// these modes come with their own
['js8', 'packet', 'pocsag', 'adsb', 'ism', 'hfdl'].forEach(function(m) {
['js8', 'packet', 'pocsag', 'adsb', 'ism', 'hfdl', 'vdl2'].forEach(function(m) {
toggle_panel('openwebrx-panel-' + m + '-message', modulation === m);
});
@ -378,6 +378,6 @@ DemodulatorPanel.prototype.setTuningPrecision = function(precision) {
$.fn.demodulatorPanel = function(){
if (!this.data('panel')) {
this.data('panel', new DemodulatorPanel(this));
};
}
return this.data('panel');
};

View file

@ -473,10 +473,7 @@ 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>' +
'<th class="todo">TODO</th>' +
'</tr></thead>' +
'<tbody></tbody>' +
'</table>'
@ -488,7 +485,12 @@ HfdlMessagePanel.prototype.supportsMessage = function(message) {
};
HfdlMessagePanel.prototype.pushMessage = function(message) {
console.info(message);
var $b = $(this.el).find('tbody');
$b.append($(
'<tr>' +
'<td class="todo">' + JSON.stringify(message) + '</td>' +
'</tr>'
));
};
$.fn.hfdlMessagePanel = function() {
@ -496,4 +498,43 @@ $.fn.hfdlMessagePanel = function() {
this.data('panel', new HfdlMessagePanel(this));
}
return this.data('panel');
};
Vdl2MessagePanel = function(el) {
MessagePanel.apply(this, el);
this.initClearTimer();
}
Vdl2MessagePanel.prototype = new MessagePanel();
Vdl2MessagePanel.prototype.render = function() {
$(this.el).append($(
'<table>' +
'<thead><tr>' +
'<th class="todo">TODO</th>' +
'</tr></thead>' +
'<tbody></tbody>' +
'</table>'
));
};
Vdl2MessagePanel.prototype.supportsMessage = function(message) {
return message['mode'] === 'VDL2';
};
Vdl2MessagePanel.prototype.pushMessage = function(message) {
var $b = $(this.el).find('tbody');
$b.append($(
'<tr>' +
'<td class="todo">' + JSON.stringify(message) + '</td>' +
'</tr>'
));
this.scrollToBottom();
};
$.fn.vdl2MessagePanel = function() {
if (!this.data('panel')) {
this.data('panel', new Vdl2MessagePanel(this));
}
return this.data('panel');
};

View file

@ -859,7 +859,7 @@ function on_ws_recv(evt) {
break;
case 'secondary_demod':
var value = json['value'];
var panels = ['wsjt', 'packet', 'pocsag', 'adsb', 'ism', 'hfdl'].map(function(id) {
var panels = ['wsjt', 'packet', 'pocsag', 'adsb', 'ism', 'hfdl', 'vdl2'].map(function(id) {
return $('#openwebrx-panel-' + id + '-message')[id + 'MessagePanel']();
});
panels.push($('#openwebrx-panel-js8-message').js8());

View file

@ -627,6 +627,9 @@ class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient)
elif mod == "hfdl":
from csdr.chain.dumphfdl import DumpHFDL
return DumpHFDL()
elif mod == "vdl2":
from csdr.chain.dumpvdl2 import DumpVDL2
return DumpVDL2()
def setSecondaryDemodulator(self, mod):
demodulator = self._getSecondaryDemodulator(mod)

View file

@ -87,6 +87,7 @@ class FeatureDetector(object):
"dump1090": ["dump1090"],
"ism": ["rtl_433"],
"dumphfdl": ["dumphfdl"],
"dumpvdl2": ["dumpvdl2"],
}
def feature_availability(self):
@ -609,3 +610,9 @@ class FeatureDetector(object):
TODO
"""
return self.command_is_runnable("dumphfdl --version")
def has_dumpvdl2(self):
"""
TODO
"""
return self.command_is_runnable("dumpvdl2 --version")

View file

@ -189,6 +189,14 @@ class Modes(object):
bandpass=Bandpass(0, 3000),
requirements=["dumphfdl"],
squelch=False,
),
DigitalMode(
"vdl2",
"VDL2",
underlying=["empty"],
bandpass=Bandpass(-12500, 12500),
requirements=["dumpvdl2"],
squelch=False,
)
]

17
owrx/vdl2/dumpvdl2.py Normal file
View file

@ -0,0 +1,17 @@
from pycsdr.modules import ExecModule
from pycsdr.types import Format
class DumpVDL2Module(ExecModule):
def __init__(self):
super().__init__(
Format.COMPLEX_SHORT,
Format.CHAR,
[
"dumpvdl2",
"--iq-file", "-",
"--oversample", "1",
"--sample-format", "S16_LE",
"--output", "decoded:json:file:path=-",
]
)