Exemple #1
0
class TestAPRSInformation(unittest.TestCase):
	def setUp(self):
		self.i = APRSInformation()
	
	def test_new_station(self):
		self.assertEqual([], self.i.state().keys())
		self.i.receive(parse_tnc2(
			'N6WKZ-3>APU25N,WB6TMS-3*,N6ZX-3*,WIDE2*:=3746.42N112226.00W# {UIV32N}',
			_dummy_receive_time))
		self.assertEqual(['N6WKZ-3'], self.i.state().keys())
Exemple #2
0
class TestAPRSInformation(unittest.TestCase):
    def setUp(self):
        self.i = APRSInformation()

    def test_new_station(self):
        self.assertEqual([], self.i.state().keys())
        self.i.receive(
            parse_tnc2(
                'N6WKZ-3>APU25N,WB6TMS-3*,N6ZX-3*,WIDE2*:=3746.42N112226.00W# {UIV32N}',
                _dummy_receive_time))
        self.assertEqual(['N6WKZ-3'], self.i.state().keys())
Exemple #3
0
    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))
Exemple #4
0
class TestAPRSInformation(unittest.TestCase):
    def setUp(self):
        self.i = APRSInformation()
    
    def test_new_station(self):
        self.assertEqual([], self.i.state().keys())
        self.i.receive(parse_tnc2(
            'N6WKZ-3>APU25N,WB6TMS-3*,N6ZX-3*,WIDE2*:=3746.42N112226.00W# {UIV32N}',
            _dummy_receive_time))
        self.assertEqual(['N6WKZ-3'], self.i.state().keys())

    def test_object_item_report(self):
        self.i.receive(parse_tnc2(
            'KE6AFE-2>APU25N,WR6ABD*,NCA1:;TFCSCRUZ *160323z3655.94N\12200.92W?70 In 10 Minutes',
            _dummy_receive_time))
        self.assertEqual(['KE6AFE-2', 'TFCSCRUZ '], self.i.state().keys())
Exemple #5
0
 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))
Exemple #6
0
class TestAPRSInformation(unittest.TestCase):
    def setUp(self):
        self.i = APRSInformation()

    def test_new_station(self):
        self.assertEqual([], self.i.state().keys())
        self.i.receive(
            parse_tnc2(
                'N6WKZ-3>APU25N,WB6TMS-3*,N6ZX-3*,WIDE2*:=3746.42N112226.00W# {UIV32N}',
                _dummy_receive_time))
        self.assertEqual(['N6WKZ-3'], self.i.state().keys())

    def test_object_item_report(self):
        self.i.receive(
            parse_tnc2(
                'KE6AFE-2>APU25N,WR6ABD*,NCA1:;TFCSCRUZ *160323z3655.94N\12200.92W?70 In 10 Minutes',
                _dummy_receive_time))
        self.assertEqual(['KE6AFE-2', 'TFCSCRUZ '], self.i.state().keys())
Exemple #7
0
class APRSDemodulator(gr.hier_block2, ExportedState):
    '''
    Demod APRS and feed into an APRSInformation object.
    '''
    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 get_input_type(self):
        return self.__mm_demod.get_input_type()
    
    def get_output_type(self):
        return self.__mm_demod.get_output_type()
    
    @exported_value(ctor=_aprs_squelch_type)
    def get_squelch(self):
        return self.__squelch_mode
    
    @setter
    def set_squelch(self, value):
        value = _aprs_squelch_type(value)
        if value == self.__squelch_mode: return
        self.__squelch_mode = value
        if value == u'mute':
            self.__router.set_A([[0, 0]])
        elif value == u'monitor':
            self.__router.set_A([[0, 1]])
        elif value == u'ctcss':
            self.__router.set_A([[1, 0]])
        else:
            warnings.warn('can\'t happen: bad squelch value: %r' % (value,))
Exemple #8
0
class APRSDemodulator(gr.hier_block2, ExportedState):
    '''
    Demod APRS and feed into an APRSInformation object.
    '''
    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):
            log.msg(u'APRS: %s' % (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 get_input_type(self):
        return self.__mm_demod.get_input_type()

    def get_output_type(self):
        return self.__mm_demod.get_output_type()

    @exported_value(ctor=_aprs_squelch_type)
    def get_squelch(self):
        return self.__squelch_mode

    @setter
    def set_squelch(self, value):
        value = _aprs_squelch_type(value)
        if value == self.__squelch_mode: return
        self.__squelch_mode = value
        if value == u'mute':
            self.__router.set_A([[0, 0]])
        elif value == u'monitor':
            self.__router.set_A([[0, 1]])
        elif value == u'ctcss':
            self.__router.set_A([[1, 0]])
        else:
            warnings.warn('can\'t happen: bad squelch value: %r' % (value, ))
Exemple #9
0
	def setUp(self):
		self.i = APRSInformation()
Exemple #10
0
 def setUp(self):
     self.i = APRSInformation()