re-add m17

This commit is contained in:
Jakob Ketterl
2021-09-07 14:45:52 +02:00
parent f9f0bdde12
commit f3b05c6318
6 changed files with 98 additions and 28 deletions

26
csdr/chain/m17.py Normal file
View File

@ -0,0 +1,26 @@
from csdr.chain.demodulator import BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain
from owrx.m17 import M17Module
from pycsdr.modules import FmDemod, Limit, Convert
from pycsdr.types import Format
from digiham.modules import DcBlock
class M17Chain(BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain):
def __init__(self):
workers = [
FmDemod(),
DcBlock(),
Limit(),
Convert(Format.FLOAT, Format.SHORT),
M17Module(),
]
super().__init__(workers)
def getFixedIfSampleRate(self) -> int:
return 48000
def getFixedAudioRate(self) -> int:
return 8000
def supportsSquelch(self) -> bool:
return False

View File

@ -28,12 +28,7 @@ class Module(BaseModule, metaclass=ABCMeta):
pass
class ThreadModule(Module, Thread, metaclass=ABCMeta):
def __init__(self):
self.doRun = True
super().__init__()
Thread.__init__(self)
class AutoStartModule(Module, metaclass=ABCMeta):
def _checkStart(self) -> None:
if self.reader is not None and self.writer is not None:
self.start()
@ -46,6 +41,17 @@ class ThreadModule(Module, Thread, metaclass=ABCMeta):
super().setWriter(writer)
self._checkStart()
@abstractmethod
def start(self):
pass
class ThreadModule(AutoStartModule, Thread, metaclass=ABCMeta):
def __init__(self):
self.doRun = True
super().__init__()
Thread.__init__(self)
@abstractmethod
def run(self):
pass
@ -54,6 +60,9 @@ class ThreadModule(Module, Thread, metaclass=ABCMeta):
self.doRun = False
self.reader.stop()
def start(self):
Thread.start(self)
class PickleModule(ThreadModule):
def getInputFormat(self) -> Format: