add metadata pipe to allow digital protocol information to be displayed in the website
This commit is contained in:
parent
49e3bd3b80
commit
7700214e5f
@ -78,7 +78,7 @@
|
|||||||
<!-- add canvas here by javascript -->
|
<!-- add canvas here by javascript -->
|
||||||
</div>
|
</div>
|
||||||
<div id="openwebrx-panels-container">
|
<div id="openwebrx-panels-container">
|
||||||
<div class="openwebrx-panel" id="openwebrx-panel-receiver" data-panel-name="client-params" data-panel-pos="right" data-panel-order="0" data-panel-size="259,115">
|
<div class="openwebrx-panel" id="openwebrx-panel-receiver" data-panel-name="client-params" data-panel-pos="right" data-panel-order="0" data-panel-size="259,260">
|
||||||
<div id="webrx-actual-freq">---.--- MHz</div>
|
<div id="webrx-actual-freq">---.--- MHz</div>
|
||||||
<div id="webrx-mouse-freq">---.--- MHz</div>
|
<div id="webrx-mouse-freq">---.--- MHz</div>
|
||||||
<!--<div class="openwebrx-button" onclick="ws.send('SET mod=wfm');" >WFM</div>-->
|
<!--<div class="openwebrx-button" onclick="ws.send('SET mod=wfm');" >WFM</div>-->
|
||||||
@ -117,7 +117,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="openwebrx-panel" id="openwebrx-panel-log" data-panel-name="debug" data-panel-pos="left" data-panel-order="1" data-panel-size="619,142">
|
<div class="openwebrx-panel" id="openwebrx-panel-log" data-panel-name="debug" data-panel-pos="left" data-panel-order="2" data-panel-size="619,142">
|
||||||
<div class="openwebrx-panel-inner" id="openwebrx-log-scroll">
|
<div class="openwebrx-panel-inner" id="openwebrx-log-scroll">
|
||||||
<div id="openwebrx-client-log-title">OpenWebRX client log</strong><span id="openwebrx-problems"></span></div>
|
<div id="openwebrx-client-log-title">OpenWebRX client log</strong><span id="openwebrx-problems"></span></div>
|
||||||
<span id="openwebrx-client-1">Author: </span><a href="http://blog.sdr.hu/about" target="_blank">András Retzler, HA7ILM</a><br />You can support OpenWebRX development via <a href="http://blog.sdr.hu/support" target="_blank">PayPal!</a><br/>
|
<span id="openwebrx-client-1">Author: </span><a href="http://blog.sdr.hu/about" target="_blank">András Retzler, HA7ILM</a><br />You can support OpenWebRX development via <a href="http://blog.sdr.hu/support" target="_blank">PayPal!</a><br/>
|
||||||
@ -132,6 +132,8 @@
|
|||||||
<div class="openwebrx-progressbar" id="openwebrx-bar-server-cpu"> <span class="openwebrx-progressbar-text">Server CPU [0%]</span><div class="openwebrx-progressbar-bar"></div></div>
|
<div class="openwebrx-progressbar" id="openwebrx-bar-server-cpu"> <span class="openwebrx-progressbar-text">Server CPU [0%]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||||
<div class="openwebrx-progressbar" id="openwebrx-bar-clients"> <span class="openwebrx-progressbar-text">Clients [1]</span><div class="openwebrx-progressbar-bar"></div></div>
|
<div class="openwebrx-progressbar" id="openwebrx-bar-clients"> <span class="openwebrx-progressbar-text">Clients [1]</span><div class="openwebrx-progressbar-bar"></div></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="openwebrx-panel" data-panel-name="metadata" data-panel-pos="left" data-panel-order="1" data-panel-size="615,36">
|
||||||
|
</div>
|
||||||
<div class="openwebrx-panel" data-panel-name="client-under-devel" data-panel-pos="none" data-panel-order="0" data-panel-size="245,55" style="background-color: Red;">
|
<div class="openwebrx-panel" data-panel-name="client-under-devel" data-panel-pos="none" data-panel-order="0" data-panel-size="245,55" style="background-color: Red;">
|
||||||
<span style="font-size: 15pt; font-weight: bold;">Under construction</span>
|
<span style="font-size: 15pt; font-weight: bold;">Under construction</span>
|
||||||
<br />We're working on the code right now, so the application might fail.
|
<br />We're working on the code right now, so the application might fail.
|
||||||
|
@ -1221,6 +1221,15 @@ function on_ws_recv(evt)
|
|||||||
{
|
{
|
||||||
divlog("Received invalid message over WebSocket.");
|
divlog("Received invalid message over WebSocket.");
|
||||||
}*/
|
}*/
|
||||||
|
} else if (firstChars=='MET')
|
||||||
|
{
|
||||||
|
var stringData=arrayBufferToString(evt.data);
|
||||||
|
var metaPanels = Array.prototype.filter.call(document.getElementsByClassName('openwebrx-panel'), function(el) {
|
||||||
|
return el.dataset.panelName == 'metadata';
|
||||||
|
});
|
||||||
|
metaPanels.forEach(function(el) {
|
||||||
|
el.innerHTML = stringData;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
11
openwebrx.py
11
openwebrx.py
@ -500,6 +500,17 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
|||||||
myclient.loopstat=31
|
myclient.loopstat=31
|
||||||
rxws.send(self, "MSG s={0}".format(smeter_level))
|
rxws.send(self, "MSG s={0}".format(smeter_level))
|
||||||
|
|
||||||
|
# ========= send metadata =========
|
||||||
|
metadata = None
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
myclient.loopstat=35
|
||||||
|
metadata = dsp.get_metadata();
|
||||||
|
if metadata == None: break
|
||||||
|
rxws.send(self, "MET {0}".format(metadata))
|
||||||
|
except:
|
||||||
|
break
|
||||||
|
|
||||||
# ========= send bcastmsg =========
|
# ========= send bcastmsg =========
|
||||||
if myclient.bcastmsg!="":
|
if myclient.bcastmsg!="":
|
||||||
myclient.loopstat=40
|
myclient.loopstat=40
|
||||||
|
@ -168,6 +168,10 @@ class dsp_plugin:
|
|||||||
line=self.smeter_pipe_file.readline()
|
line=self.smeter_pipe_file.readline()
|
||||||
return float(line[:-1])
|
return float(line[:-1])
|
||||||
|
|
||||||
|
def get_metadata(self):
|
||||||
|
if self.running and self.meta_pipe:
|
||||||
|
return self.meta_pipe_file.readline()
|
||||||
|
|
||||||
def mkfifo(self,path):
|
def mkfifo(self,path):
|
||||||
try:
|
try:
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
@ -183,7 +187,7 @@ class dsp_plugin:
|
|||||||
|
|
||||||
#create control pipes for csdr
|
#create control pipes for csdr
|
||||||
pipe_base_path="/tmp/openwebrx_pipe_{myid}_".format(myid=id(self))
|
pipe_base_path="/tmp/openwebrx_pipe_{myid}_".format(myid=id(self))
|
||||||
self.bpf_pipe = self.shift_pipe = self.squelch_pipe = self.smeter_pipe = None
|
self.bpf_pipe = self.shift_pipe = self.squelch_pipe = self.smeter_pipe = self.meta_pipe = None
|
||||||
if "{bpf_pipe}" in command_base:
|
if "{bpf_pipe}" in command_base:
|
||||||
self.bpf_pipe=pipe_base_path+"bpf"
|
self.bpf_pipe=pipe_base_path+"bpf"
|
||||||
self.mkfifo(self.bpf_pipe)
|
self.mkfifo(self.bpf_pipe)
|
||||||
@ -196,13 +200,18 @@ class dsp_plugin:
|
|||||||
if "{smeter_pipe}" in command_base:
|
if "{smeter_pipe}" in command_base:
|
||||||
self.smeter_pipe=pipe_base_path+"smeter"
|
self.smeter_pipe=pipe_base_path+"smeter"
|
||||||
self.mkfifo(self.smeter_pipe)
|
self.mkfifo(self.smeter_pipe)
|
||||||
|
if "{meta_pipe}" in command_base:
|
||||||
|
self.meta_pipe=pipe_base_path+"meta"
|
||||||
|
self.mkfifo(self.meta_pipe)
|
||||||
|
else:
|
||||||
|
self.meta_pipe=None
|
||||||
|
|
||||||
#run the command
|
#run the command
|
||||||
command=command_base.format( bpf_pipe=self.bpf_pipe, shift_pipe=self.shift_pipe, decimation=self.decimation, \
|
command=command_base.format( bpf_pipe=self.bpf_pipe, shift_pipe=self.shift_pipe, decimation=self.decimation, \
|
||||||
last_decimation=self.last_decimation, fft_size=self.fft_size, fft_block_size=self.fft_block_size(), \
|
last_decimation=self.last_decimation, fft_size=self.fft_size, fft_block_size=self.fft_block_size(), \
|
||||||
bpf_transition_bw=float(self.bpf_transition_bw)/self.if_samp_rate(), ddc_transition_bw=self.ddc_transition_bw(), \
|
bpf_transition_bw=float(self.bpf_transition_bw)/self.if_samp_rate(), ddc_transition_bw=self.ddc_transition_bw(), \
|
||||||
flowcontrol=int(self.samp_rate*2), start_bufsize=self.base_bufsize*self.decimation, nc_port=self.nc_port, \
|
flowcontrol=int(self.samp_rate*2), start_bufsize=self.base_bufsize*self.decimation, nc_port=self.nc_port, \
|
||||||
squelch_pipe=self.squelch_pipe, smeter_pipe=self.smeter_pipe )
|
squelch_pipe=self.squelch_pipe, smeter_pipe=self.smeter_pipe, meta_pipe=self.meta_pipe )
|
||||||
|
|
||||||
print "[openwebrx-dsp-plugin:csdr] Command =",command
|
print "[openwebrx-dsp-plugin:csdr] Command =",command
|
||||||
#code.interact(local=locals())
|
#code.interact(local=locals())
|
||||||
@ -225,6 +234,9 @@ class dsp_plugin:
|
|||||||
if self.smeter_pipe != None:
|
if self.smeter_pipe != None:
|
||||||
self.smeter_pipe_file=open(self.smeter_pipe,"r")
|
self.smeter_pipe_file=open(self.smeter_pipe,"r")
|
||||||
fcntl.fcntl(self.smeter_pipe_file, fcntl.F_SETFL, os.O_NONBLOCK)
|
fcntl.fcntl(self.smeter_pipe_file, fcntl.F_SETFL, os.O_NONBLOCK)
|
||||||
|
if self.meta_pipe != None:
|
||||||
|
self.meta_pipe_file=open(self.meta_pipe,"r")
|
||||||
|
fcntl.fcntl(self.meta_pipe_file, fcntl.F_SETFL, os.O_NONBLOCK)
|
||||||
|
|
||||||
def read(self,size):
|
def read(self,size):
|
||||||
return self.process.stdout.read(size)
|
return self.process.stdout.read(size)
|
||||||
@ -256,6 +268,9 @@ class dsp_plugin:
|
|||||||
if self.smeter_pipe:
|
if self.smeter_pipe:
|
||||||
try: os.unlink(self.smeter_pipe)
|
try: os.unlink(self.smeter_pipe)
|
||||||
except: print "[openwebrx-dsp-plugin:csdr] stop() :: unlink failed: " + self.smeter_pipe
|
except: print "[openwebrx-dsp-plugin:csdr] stop() :: unlink failed: " + self.smeter_pipe
|
||||||
|
if self.meta_pipe:
|
||||||
|
try: os.unlink(self.meta_pipe)
|
||||||
|
except: print "[openwebrx-dsp-plugin:csdr] stop() :: unlink failed: " + self.meta_pipe
|
||||||
self.running = False
|
self.running = False
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user