openwebrx-clone/csdr/chain/demodulator.py

74 lines
1.4 KiB
Python
Raw Normal View History

2021-07-19 17:04:14 +00:00
from csdr.chain import Chain
2021-09-23 16:43:41 +00:00
from abc import ABC, ABCMeta, abstractmethod
from pycsdr.modules import Writer
2021-07-19 17:04:14 +00:00
2021-08-27 15:34:48 +00:00
class FixedAudioRateChain(ABC):
@abstractmethod
2021-08-31 20:46:11 +00:00
def getFixedAudioRate(self) -> int:
2021-08-27 15:34:48 +00:00
pass
class FixedIfSampleRateChain(ABC):
@abstractmethod
2021-08-31 20:46:11 +00:00
def getFixedIfSampleRate(self) -> int:
pass
class DialFrequencyReceiver(ABC):
@abstractmethod
def setDialFrequency(self, frequency: int) -> None:
pass
2021-08-27 15:34:48 +00:00
# marker interface
class HdAudio:
pass
class MetaProvider(ABC):
@abstractmethod
def setMetaWriter(self, writer: Writer) -> None:
pass
class SlotFilterChain(ABC):
@abstractmethod
def setSlotFilter(self, filter: int) -> None:
pass
2021-09-23 16:43:41 +00:00
class SecondarySelectorChain(ABC):
def getBandwidth(self) -> float:
pass
class DeemphasisTauChain(ABC):
@abstractmethod
def setDeemphasisTau(self, tau: float) -> None:
pass
2021-09-23 16:43:41 +00:00
class BaseDemodulatorChain(Chain):
def supportsSquelch(self) -> bool:
return True
def setSampleRate(self, sampleRate: int) -> None:
pass
class SecondaryDemodulator(Chain):
def supportsSquelch(self) -> bool:
return True
def setSampleRate(self, sampleRate: int) -> None:
pass
class ServiceDemodulator(SecondaryDemodulator, FixedAudioRateChain, metaclass=ABCMeta):
pass
2021-12-13 12:26:47 +00:00
class DemodulatorError(Exception):
pass