first implementation of a station dropdown

This commit is contained in:
Jakob Ketterl 2024-01-24 23:01:51 +01:00
parent df6fe8971a
commit f33dfda005
3 changed files with 39 additions and 1 deletions

View file

@ -40,7 +40,10 @@ class MetaProcessor(PickleModule):
if "programmes" in data:
result["programmes"] = data["programmes"]
# don't send out data if there was nothing interesting for the client
return result if result else None
if not result:
return
result["mode"] = "DAB"
return result
class Dablin(BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain, HdAudio, MetaProvider):

View file

@ -150,6 +150,7 @@
</div>
</div>
<div class="openwebrx-panel openwebrx-meta-panel disabled" id="openwebrx-panel-metadata-wfm" style="display: none;" data-panel-name="metadata-wfm"></div>
<div class="openwebrx-panel openwebrx-meta-panel" id="openwebrx-panel-metadata-dab" style="display: none;" data-panel-name="metadata-dab"></div>
<div class="openwebrx-panel" id="openwebrx-panel-log" data-panel-name="debug" style="width: 619px;">
<div class="openwebrx-panel-inner nano" id="openwebrx-log-scroll">
<div class="nano-content">

View file

@ -550,6 +550,39 @@ WfmMetaPanel.prototype.clear = function() {
this.radiotext_plus = false;
};
function DabMetaPanel(el) {
MetaPanel.call(this, el);
this.modes = ['DAB'];
$(this.el).html(
'<select id="dab-service-id"></select>'
)
this.clear();
}
DabMetaPanel.prototype = new MetaPanel();
DabMetaPanel.prototype.isSupported = function(data) {
return this.modes.includes(data.mode);
}
DabMetaPanel.prototype.update = function(data) {
if (!this.isSupported(data)) return;
if ('programmes' in data) {
var options = Object.entries(data.programmes).map(function(e) {
return '<option value="' + e[0] + '">' + e[1] + '</option>';
});
$(this.el).find('#dab-service-id').html(options.join(''));
}
console.info(data);
}
DabMetaPanel.prototype.clear = function() {
}
MetaPanel.types = {
dmr: DmrMetaPanel,
ysf: YsfMetaPanel,
@ -557,6 +590,7 @@ MetaPanel.types = {
nxdn: NxdnMetaPanel,
m17: M17MetaPanel,
wfm: WfmMetaPanel,
dab: DabMetaPanel,
};
$.fn.metaPanel = function() {