2021-08-31 19:53:15 +00:00
|
|
|
from csdr.chain import Chain
|
|
|
|
from csdr.chain.selector import Selector
|
2021-09-23 16:43:41 +00:00
|
|
|
from csdr.chain.demodulator import BaseDemodulatorChain, ServiceDemodulator
|
2021-09-06 13:05:33 +00:00
|
|
|
from pycsdr.types import Format
|
2021-08-31 19:53:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ServiceDemodulatorChain(Chain):
|
2021-09-23 16:43:41 +00:00
|
|
|
def __init__(self, demod: BaseDemodulatorChain, secondaryDemod: ServiceDemodulator, sampleRate: int, frequencyOffset: int):
|
|
|
|
self.selector = Selector(sampleRate, secondaryDemod.getFixedAudioRate(), withSquelch=False)
|
|
|
|
self.selector.setFrequencyOffset(frequencyOffset)
|
2021-09-06 13:05:33 +00:00
|
|
|
|
|
|
|
workers = [self.selector]
|
|
|
|
|
|
|
|
# primary demodulator is only necessary if the secondary does not accept IQ input
|
|
|
|
if secondaryDemod.getInputFormat() is not Format.COMPLEX_FLOAT:
|
|
|
|
workers += [demod]
|
|
|
|
|
|
|
|
workers += [secondaryDemod]
|
2021-08-31 19:53:15 +00:00
|
|
|
|
|
|
|
super().__init__(workers)
|
|
|
|
|
|
|
|
def setBandPass(self, lowCut, highCut):
|
|
|
|
self.selector.setBandpass(lowCut, highCut)
|