read metadata from pipeline decoders
This commit is contained in:
parent
f8f2740c77
commit
c5a314810e
@ -56,6 +56,7 @@ class Dsp(DirewolfConfigSubscriber):
|
|||||||
self.pycsdr_client_chain = None
|
self.pycsdr_client_chain = None
|
||||||
self.pycsdr_reader = None
|
self.pycsdr_reader = None
|
||||||
self.pycsdr_power_reader = None
|
self.pycsdr_power_reader = None
|
||||||
|
self.pycsdr_meta_reader = None
|
||||||
self.buffer = None
|
self.buffer = None
|
||||||
|
|
||||||
self.samp_rate = 250000
|
self.samp_rate = 250000
|
||||||
@ -764,6 +765,22 @@ class Dsp(DirewolfConfigSubscriber):
|
|||||||
chain.setPowerWriter(powerBuffer)
|
chain.setPowerWriter(powerBuffer)
|
||||||
self.pycsdr_power_reader = powerBuffer.getReader()
|
self.pycsdr_power_reader = powerBuffer.getReader()
|
||||||
self.output.send_output("smeter", self.pycsdr_power_reader.read)
|
self.output.send_output("smeter", self.pycsdr_power_reader.read)
|
||||||
|
|
||||||
|
if self.isDigitalVoice():
|
||||||
|
metaBuffer = Buffer(Format.CHAR)
|
||||||
|
chain.setMetaWriter(metaBuffer)
|
||||||
|
self.pycsdr_meta_reader = metaBuffer.getReader()
|
||||||
|
|
||||||
|
def read_meta():
|
||||||
|
raw = self.pycsdr_meta_reader.read()
|
||||||
|
if raw is None or len(raw) == 0:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
raw = raw.tobytes().decode("cp437")
|
||||||
|
return raw.rstrip("\n")
|
||||||
|
|
||||||
|
self.output.send_output("meta", read_meta)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
command_base = " | ".join(chain)
|
command_base = " | ".join(chain)
|
||||||
@ -864,6 +881,9 @@ class Dsp(DirewolfConfigSubscriber):
|
|||||||
self.pycsdr_power_reader = None
|
self.pycsdr_power_reader = None
|
||||||
self.pycsdr_client_chain.stop()
|
self.pycsdr_client_chain.stop()
|
||||||
self.pycsdr_client_chain = None
|
self.pycsdr_client_chain = None
|
||||||
|
if self.pycsdr_meta_reader is not None:
|
||||||
|
self.pycsdr_meta_reader.stop()
|
||||||
|
self.pycsdr_meta_reader = None
|
||||||
if self.process is not None:
|
if self.process is not None:
|
||||||
try:
|
try:
|
||||||
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
|
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
|
||||||
|
@ -5,6 +5,8 @@ from pycsdr.types import Format
|
|||||||
|
|
||||||
class DemodulatorChain(Chain):
|
class DemodulatorChain(Chain):
|
||||||
def __init__(self, samp_rate: int, audioRate: int, shiftRate: float, demodulator: Chain):
|
def __init__(self, samp_rate: int, audioRate: int, shiftRate: float, demodulator: Chain):
|
||||||
|
self.demodulator = demodulator
|
||||||
|
|
||||||
self.shift = Shift(shiftRate)
|
self.shift = Shift(shiftRate)
|
||||||
|
|
||||||
decimation, fraction = self._getDecimation(samp_rate, audioRate)
|
decimation, fraction = self._getDecimation(samp_rate, audioRate)
|
||||||
@ -44,6 +46,9 @@ class DemodulatorChain(Chain):
|
|||||||
def setPowerWriter(self, writer: Writer):
|
def setPowerWriter(self, writer: Writer):
|
||||||
self.squelch.setPowerWriter(writer)
|
self.squelch.setPowerWriter(writer)
|
||||||
|
|
||||||
|
def setMetaWriter(self, writer: Writer):
|
||||||
|
self.demodulator.setMetaWriter(writer)
|
||||||
|
|
||||||
def _getDecimation(self, input_rate, output_rate):
|
def _getDecimation(self, input_rate, output_rate):
|
||||||
if output_rate <= 0:
|
if output_rate <= 0:
|
||||||
raise ValueError("invalid output rate: {rate}".format(rate=output_rate))
|
raise ValueError("invalid output rate: {rate}".format(rate=output_rate))
|
||||||
|
@ -1,44 +1,46 @@
|
|||||||
from csdr.chain import Chain
|
from csdr.chain import Chain
|
||||||
from pycsdr.modules import FmDemod, Agc
|
from pycsdr.modules import FmDemod, Agc, Writer
|
||||||
from pycsdr.types import Format
|
from pycsdr.types import Format
|
||||||
from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, GfskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder
|
from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, GfskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder
|
||||||
from digiham.ambe import Modes
|
from digiham.ambe import Modes
|
||||||
|
|
||||||
|
|
||||||
class Dstar(Chain):
|
class DigihamChain(Chain):
|
||||||
def __init__(self, codecserver: str = ""):
|
def __init__(self, codecserver: str = ""):
|
||||||
if codecserver is None:
|
if codecserver is None:
|
||||||
codecserver = ""
|
codecserver = ""
|
||||||
agc = Agc(Format.SHORT)
|
|
||||||
agc.setMaxGain(30)
|
|
||||||
agc.setInitialGain(3)
|
|
||||||
workers = [
|
workers = [
|
||||||
FmDemod(),
|
FmDemod(),
|
||||||
DcBlock(),
|
DcBlock(),
|
||||||
FskDemodulator(samplesPerSymbol=10),
|
self.fskDemodulator,
|
||||||
DstarDecoder(),
|
self.decoder,
|
||||||
MbeSynthesizer(Modes.DStarMode, codecserver),
|
MbeSynthesizer(self.mbeMode, codecserver),
|
||||||
DigitalVoiceFilter(),
|
DigitalVoiceFilter(),
|
||||||
agc
|
self.agc
|
||||||
]
|
]
|
||||||
super().__init__(*workers)
|
super().__init__(*workers)
|
||||||
|
|
||||||
|
def setMetaWriter(self, writer: Writer):
|
||||||
|
self.decoder.setMetaWriter(writer)
|
||||||
|
|
||||||
class Nxdn(Chain):
|
|
||||||
|
class Dstar(DigihamChain):
|
||||||
def __init__(self, codecserver: str = ""):
|
def __init__(self, codecserver: str = ""):
|
||||||
if codecserver is None:
|
self.fskDemodulator = FskDemodulator(samplesPerSymbol=10)
|
||||||
codecserver = ""
|
self.decoder = DstarDecoder()
|
||||||
agc = Agc(Format.SHORT)
|
self.mbeMode = Modes.DStarMode
|
||||||
agc.setMaxGain(30)
|
self.agc = Agc(Format.SHORT)
|
||||||
agc.setInitialGain(3)
|
self.agc.setMaxGain(30)
|
||||||
workers = [
|
self.agc.setInitialGain(3)
|
||||||
FmDemod(),
|
super().__init__(codecserver)
|
||||||
DcBlock(),
|
|
||||||
NarrowRrcFilter(),
|
|
||||||
GfskDemodulator(samplesPerSymbol=20),
|
class Nxdn(DigihamChain):
|
||||||
NxdnDecoder(),
|
def __init__(self, codecserver: str = ""):
|
||||||
MbeSynthesizer(Modes.NxdnMode, codecserver),
|
self.fskDemodulator = GfskDemodulator(samplesPerSymbol=20)
|
||||||
DigitalVoiceFilter(),
|
self.decoder = NxdnDecoder()
|
||||||
agc,
|
self.mbeMode = Modes.NxdnMode
|
||||||
]
|
self.agc = Agc(Format.SHORT)
|
||||||
super().__init__(*workers)
|
self.agc.setMaxGain(30)
|
||||||
|
self.agc.setInitialGain(3)
|
||||||
|
super().__init__(codecserver)
|
||||||
|
Loading…
Reference in New Issue
Block a user