2021-07-29 22:06:21 +00:00
|
|
|
from csdr.chain import Chain
|
2021-07-31 22:49:20 +00:00
|
|
|
from pycsdr.modules import FmDemod, Agc, Writer
|
2021-07-30 22:10:10 +00:00
|
|
|
from pycsdr.types import Format
|
2021-08-06 18:02:59 +00:00
|
|
|
from digiham.modules import DstarDecoder, DcBlock, FskDemodulator, GfskDemodulator, DigitalVoiceFilter, MbeSynthesizer, NarrowRrcFilter, NxdnDecoder, DmrDecoder
|
2021-07-30 22:10:10 +00:00
|
|
|
from digiham.ambe import Modes
|
2021-07-29 22:06:21 +00:00
|
|
|
|
|
|
|
|
2021-07-31 22:49:20 +00:00
|
|
|
class DigihamChain(Chain):
|
2021-07-29 22:06:21 +00:00
|
|
|
def __init__(self, codecserver: str = ""):
|
2021-07-30 22:10:10 +00:00
|
|
|
if codecserver is None:
|
|
|
|
codecserver = ""
|
2021-08-06 18:02:59 +00:00
|
|
|
agc = Agc(Format.SHORT)
|
|
|
|
agc.setMaxGain(30)
|
|
|
|
agc.setInitialGain(3)
|
2021-07-29 22:06:21 +00:00
|
|
|
workers = [
|
|
|
|
FmDemod(),
|
|
|
|
DcBlock(),
|
2021-07-31 22:49:20 +00:00
|
|
|
self.fskDemodulator,
|
|
|
|
self.decoder,
|
|
|
|
MbeSynthesizer(self.mbeMode, codecserver),
|
2021-07-30 22:10:10 +00:00
|
|
|
DigitalVoiceFilter(),
|
2021-08-06 18:02:59 +00:00
|
|
|
agc
|
2021-07-29 22:06:21 +00:00
|
|
|
]
|
|
|
|
super().__init__(*workers)
|
|
|
|
|
2021-07-31 22:49:20 +00:00
|
|
|
def setMetaWriter(self, writer: Writer):
|
|
|
|
self.decoder.setMetaWriter(writer)
|
2021-07-29 22:06:21 +00:00
|
|
|
|
2021-07-31 22:49:20 +00:00
|
|
|
|
|
|
|
class Dstar(DigihamChain):
|
2021-07-29 22:06:21 +00:00
|
|
|
def __init__(self, codecserver: str = ""):
|
2021-07-31 22:49:20 +00:00
|
|
|
self.fskDemodulator = FskDemodulator(samplesPerSymbol=10)
|
|
|
|
self.decoder = DstarDecoder()
|
|
|
|
self.mbeMode = Modes.DStarMode
|
|
|
|
super().__init__(codecserver)
|
|
|
|
|
|
|
|
|
|
|
|
class Nxdn(DigihamChain):
|
|
|
|
def __init__(self, codecserver: str = ""):
|
|
|
|
self.fskDemodulator = GfskDemodulator(samplesPerSymbol=20)
|
|
|
|
self.decoder = NxdnDecoder()
|
|
|
|
self.mbeMode = Modes.NxdnMode
|
2021-08-06 18:02:59 +00:00
|
|
|
super().__init__(codecserver)
|
|
|
|
|
|
|
|
class Dmr(DigihamChain):
|
|
|
|
def __init__(self, codecserver: str = ""):
|
|
|
|
self.fskDemodulator = GfskDemodulator(samplesPerSymbol=10)
|
|
|
|
self.decoder = DmrDecoder()
|
|
|
|
self.mbeMode = Modes.DmrMode
|
2021-07-31 22:49:20 +00:00
|
|
|
super().__init__(codecserver)
|