UI now somewhat operational.
This commit is contained in:
parent
c043e17451
commit
b8f6969b53
|
|
@ -121,7 +121,7 @@ class AcarsDecModule(WavFileModule):
|
|||
|
||||
class CwSkimmerModule(ExecModule):
|
||||
def __init__(self, sampleRate: int = 12000, charCount: int = 8):
|
||||
cmd = ["csdr-cwskimmer", "-r", str(sampleRate), "-n", str(charCount)]
|
||||
cmd = ["csdr-cwskimmer", "-i", "-r", str(sampleRate), "-n", str(charCount)]
|
||||
super().__init__(Format.SHORT, Format.CHAR, cmd)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1588,6 +1588,7 @@ img.openwebrx-mirror-img
|
|||
#openwebrx-panel-digimodes[data-mode="fax"] #openwebrx-digimode-content-container,
|
||||
#openwebrx-panel-digimodes[data-mode="ism"] #openwebrx-digimode-content-container,
|
||||
#openwebrx-panel-digimodes[data-mode="dsc"] #openwebrx-digimode-content-container,
|
||||
#openwebrx-panel-digimodes[data-mode="cwskimmer"] #openwebrx-digimode-content-container,
|
||||
#openwebrx-panel-digimodes[data-mode="ft8"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="wspr"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="jt65"] #openwebrx-digimode-select-channel,
|
||||
|
|
@ -1611,7 +1612,8 @@ img.openwebrx-mirror-img
|
|||
#openwebrx-panel-digimodes[data-mode="ism"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="selcall"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="zvei"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="eas"] #openwebrx-digimode-select-channel
|
||||
#openwebrx-panel-digimodes[data-mode="eas"] #openwebrx-digimode-select-channel,
|
||||
#openwebrx-panel-digimodes[data-mode="cwskimmer"] #openwebrx-digimode-select-channel
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
|
@ -1637,7 +1639,8 @@ img.openwebrx-mirror-img
|
|||
#openwebrx-panel-digimodes[data-mode="sstv"] #openwebrx-digimode-canvas-container,
|
||||
#openwebrx-panel-digimodes[data-mode="fax"] #openwebrx-digimode-canvas-container,
|
||||
#openwebrx-panel-digimodes[data-mode="ism"] #openwebrx-digimode-canvas-container,
|
||||
#openwebrx-panel-digimodes[data-mode="dsc"] #openwebrx-digimode-canvas-container
|
||||
#openwebrx-panel-digimodes[data-mode="dsc"] #openwebrx-digimode-canvas-container,
|
||||
#openwebrx-panel-digimodes[data-mode="cwskimmer"] #openwebrx-digimode-canvas-container
|
||||
{
|
||||
height: 200px;
|
||||
margin: -10px;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,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-dsc-message" style="display: none; width: 619px;" data-panel-name="dsc-message"></div>
|
||||
<div class="openwebrx-panel openwebrx-message-panel" id="openwebrx-panel-cwskimmer-message" style="display: none; width: 619px;" data-panel-name="cwskimmer-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">
|
||||
|
|
|
|||
|
|
@ -173,12 +173,10 @@ DemodulatorPanel.prototype.updatePanels = function() {
|
|||
toggle_panel("openwebrx-panel-wsjt-message", ['ft8', 'wspr', 'jt65', 'jt9', 'ft4', 'fst4', 'fst4w', "q65", "msk144"].indexOf(modulation) >= 0);
|
||||
// Aeronautic modes share the same panel
|
||||
toggle_panel("openwebrx-panel-hfdl-message", ['hfdl', 'vdl2', 'acars'].indexOf(modulation) >= 0);
|
||||
// But ADSB has its own panel
|
||||
toggle_panel("openwebrx-panel-adsb-message", modulation === 'adsb');
|
||||
// Packet modes share the same panel
|
||||
toggle_panel("openwebrx-panel-packet-message", ['packet', 'ais'].indexOf(modulation) >= 0);
|
||||
// these modes come with their own
|
||||
['js8', 'page', 'pocsag', 'sstv', 'fax', 'ism', 'dsc'].forEach(function(m) {
|
||||
// These modes come with their own panels
|
||||
['js8', 'page', 'pocsag', 'sstv', 'fax', 'ism', 'dsc', 'adsb', 'cwskimmer'].forEach(function(m) {
|
||||
toggle_panel('openwebrx-panel-' + m + '-message', modulation === m);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -877,3 +877,63 @@ $.fn.faxMessagePanel = function() {
|
|||
}
|
||||
return this.data('panel');
|
||||
};
|
||||
|
||||
CwSkimmerMessagePanel = function(el) {
|
||||
MessagePanel.call(this, el);
|
||||
this.initClearTimer();
|
||||
this.freqs = [];
|
||||
this.texts = [];
|
||||
}
|
||||
|
||||
CwSkimmerMessagePanel.prototype = Object.create(MessagePanel.prototype);
|
||||
|
||||
CwSkimmerMessagePanel.prototype.supportsMessage = function(message) {
|
||||
return message['mode'] === 'CW';
|
||||
};
|
||||
|
||||
CwSkimmerMessagePanel.prototype.render = function() {
|
||||
$(this.el).append($(
|
||||
'<table>' +
|
||||
'<thead><tr>' +
|
||||
'<th class="frequency">Freq</th>' +
|
||||
'<th class="data">Message</th>' +
|
||||
'</tr></thead>' +
|
||||
'<tbody></tbody>' +
|
||||
'</table>'
|
||||
));
|
||||
};
|
||||
|
||||
CwSkimmerMessagePanel.prototype.pushMessage = function(msg) {
|
||||
// Find existing frequency
|
||||
var j = this.freqs.indexOf(msg.freq);
|
||||
|
||||
if (j >= 0) {
|
||||
// Update existing entry
|
||||
this.texts[j] = msg.text;
|
||||
} else {
|
||||
// Add a new entry
|
||||
this.freqs.push(msg.freq);
|
||||
this.texts.push(msg.text);
|
||||
// Limit the number of active frequencies
|
||||
if (this.freqs.length > 10) {
|
||||
this.freqs.pop();
|
||||
this.texts.pop();
|
||||
}
|
||||
}
|
||||
|
||||
// Generate table body
|
||||
var body = '';
|
||||
for (j = 0 ; j < this.freqs.length ; j++) {
|
||||
body += '<tr><td>' + this.freqs[j] + '</td><td>' + this.texts[j] + '</td></tr>\n';
|
||||
}
|
||||
|
||||
// Assign new table body
|
||||
$(this.el).find('tbody').html(body);
|
||||
};
|
||||
|
||||
$.fn.cwskimmerMessagePanel = function() {
|
||||
if (!this.data('panel')) {
|
||||
this.data('panel', new CwSkimmerMessagePanel(this));
|
||||
}
|
||||
return this.data('panel');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1056,7 +1056,7 @@ function on_ws_recv(evt) {
|
|||
break;
|
||||
case 'secondary_demod':
|
||||
var value = json['value'];
|
||||
var panels = ['wsjt', 'packet', 'pocsag', 'page', 'sstv', 'fax', 'ism', 'hfdl', 'adsb', 'dsc'].map(function(id) {
|
||||
var panels = ['wsjt', 'packet', 'pocsag', 'page', 'sstv', 'fax', 'ism', 'hfdl', 'adsb', 'dsc', 'cwskimmer'].map(function(id) {
|
||||
return $('#openwebrx-panel-' + id + '-message')[id + 'MessagePanel']();
|
||||
});
|
||||
panels.push($('#openwebrx-panel-js8-message').js8());
|
||||
|
|
|
|||
|
|
@ -419,7 +419,8 @@ class EasParser(TextParser):
|
|||
class CwSkimmerParser(TextParser):
|
||||
def __init__(self, charTotal: int = 32, service: bool = False):
|
||||
self.reLine = re.compile("^(\d+):\s*(.*)$")
|
||||
self.data = {}
|
||||
self.charTotal = charTotal
|
||||
self.cwCache = {}
|
||||
# Construct parent object
|
||||
super().__init__(filePrefix="CW", service=service)
|
||||
|
||||
|
|
@ -434,11 +435,11 @@ class CwSkimmerParser(TextParser):
|
|||
freq = int(r.group(1))
|
||||
text = r.group(2)
|
||||
# Add up newly decoded characters
|
||||
if freq in self.data:
|
||||
text = self.data[freq] + text
|
||||
if freq in self.cwCache:
|
||||
text = self.cwCache[freq] + text
|
||||
# Truncate received text to charTotal
|
||||
text = text if len(text) <= charTotal else text[:charTotal]
|
||||
self.data[freq] = text
|
||||
text = text if len(text) <= self.charTotal else text[:self.charTotal]
|
||||
self.cwCache[freq] = text
|
||||
# Compose output
|
||||
out = { "mode": "CW", "text": text }
|
||||
# Add frequency, if known
|
||||
|
|
|
|||
Loading…
Reference in New Issue