def __init__(self, aprs_information=None, context=None): gr.hier_block2.__init__( self, self.__class__.__name__, gr.io_signature(1, 1, gr.sizeof_float * 1), gr.io_signature(1, 1, gr.sizeof_float * 1), ) if aprs_information is not None: self.__information = aprs_information else: self.__information = APRSInformation() def receive(line): # %r here provides robustness against arbitrary bytes. log.msg(u'APRS: %r' % (line, )) message = parse_tnc2(line, time.time()) log.msg(u' -> %s' % (message, )) self.__information.receive(message) self.__mm_demod = MultimonNGDemodulator( multimon_demod_args=['-A'], protocol=APRSProcessProtocol(receive), context=context) # APRS Voice Alert squelch -- see http://www.aprs.org/VoiceAlert3.html self.__squelch_mode = None self.__squelch_block = analog.ctcss_squelch_ff( rate=int(self.__mm_demod.get_output_type().get_sample_rate()), freq=100.0, # TODO: should allow the other Voice Alert tones level= 0.05, # amplitude of tone -- TODO: sometimes opens for noise, needs adjustment len=0, # use default ramp=0, # no ramping gate=False) self.__router = blocks.multiply_matrix_ff([[0, 0]]) self.set_squelch(u'ctcss') self.connect(self, self.__mm_demod, self.__squelch_block, self.__router, self) self.connect(self.__mm_demod, (self.__router, 1))
def setUp(self): self.i = APRSInformation()