Ejemplo n.º 1
0
 def test_stdout_failure(self):
     self.assertEquals(
         test_subprocess(['echo', 'y•'], b'x', shell=False),
         textwrap.dedent("""\
             Expected `echo y•` to give output containing 'x', but the actual output was:
             y•
             """))
Ejemplo n.º 2
0
                    label=k)
            self.__cells[k].set_internal(v)
        self.state_changed()
        if shape_changed:
            self.state_shape_changed()
    
    def is_interesting(self):
        """Implements ITelemetryObject."""
        return True
    
    def get_object_expiry(self):
        """implement ITelemetryObject"""
        return self.__last_heard_time + drop_unheard_timeout_seconds
    
    @exported_value(type=TimestampT(), changes='explicit', label='Last heard')
    def get_last_heard_time(self):
        return self.__last_heard_time


# TODO: Arrange for a way for the user to see why it is unavailable.
_rtl_433_available = test_subprocess(
    ['rtl_433', '-r', '/dev/null'],
    'Reading samples from file',
    shell=False)


plugin_mode = ModeDef(mode='433',
    info=EnumRow(label='rtl_433', description='OOK telemetry decoded by rtl_433 mostly found at 433 MHz'),
    demod_class=RTL433Demodulator,
    available=_rtl_433_available)
Ejemplo n.º 3
0
 def test_stdout_failure(self):
     self.assertFalse(test_subprocess(['echo', 'y'], 'x', shell=False))
Ejemplo n.º 4
0
 def test_stdout_success(self):
     self.assertTrue(test_subprocess(['echo', 'x'], 'x', shell=False))
Ejemplo n.º 5
0
 def test_stdout_failure(self):
     self.assertFalse(test_subprocess(['echo', 'y'], 'x', shell=False))
Ejemplo n.º 6
0
 def test_stdout_success(self):
     self.assertFalse(test_subprocess(['echo', 'x'], b'x', shell=False))
Ejemplo n.º 7
0
    def __lineReceived(self, line):
        if line == '':  # observed glitch in output
            pass
        elif line.startswith('Enabled demodulators:'):
            pass
        elif line.startswith(
                '$ULTW'
        ) and self.__last_line is not None:  # observed glitch in output; need to glue to previous line, I think?
            ll = self.__last_line
            self.__last_line = None
            self.__target(ll + line)
        elif line.startswith('APRS: '):
            line = line[len('APRS: '):]
            self.__last_line = line
            self.__target(line)
        else:
            # TODO: Log these properly
            print 'Not APRS line: %r' % line


# TODO: Arrange for a way for the user to see why it is unavailable.
_multimon_available = test_subprocess('multimon-ng -h; exit 0',
                                      'available demodulators:',
                                      shell=True)

pluginDef_APRS = ModeDef(
    mode='APRS',  # TODO: Rename mode to be more accurate
    info='APRS',
    demod_class=FMAPRSDemodulator,
    available=_multimon_available)
Ejemplo n.º 8
0
        self.state_changed()
        if shape_changed:
            self.state_shape_changed()

    def is_interesting(self):
        """Implements ITelemetryObject."""
        return True

    def get_object_expiry(self):
        """implement ITelemetryObject"""
        return self.__last_heard_time + drop_unheard_timeout_seconds

    @exported_value(type=TimestampT(), changes='explicit', label='Last heard')
    def get_last_heard_time(self):
        return self.__last_heard_time


# TODO: Arrange for a way for the user to see why it is unavailable.
_rtl_433_available = test_subprocess(['rtl_433', '-r', '/dev/null'],
                                     'Reading samples from file',
                                     shell=False)

plugin_mode = ModeDef(
    mode='433',
    info=EnumRow(
        label='rtl_433',
        description='OOK telemetry decoded by rtl_433 mostly found at 433 MHz'
    ),
    demod_class=RTL433Demodulator,
    available=_rtl_433_available)
Ejemplo n.º 9
0
        
    def errReceived(self, data):
        # we should inherit stderr, not pipe it
        raise Exception('shouldn\'t happen')
    
    def __lineReceived(self, line):
        if line == '':  # observed glitch in output
            pass
        elif line.startswith('Enabled demodulators:'):
            pass
        elif line.startswith('$ULTW') and self.__last_line is not None:  # observed glitch in output; need to glue to previous line, I think?
            ll = self.__last_line
            self.__last_line = None
            self.__target(ll + line)
        elif line.startswith('APRS: '):
            line = line[len('APRS: '):]
            self.__last_line = line
            self.__target(line)
        else:
            # TODO: Log these properly
            print 'Not APRS line: %r' % line


_multimon_unavailability = test_subprocess('multimon-ng -h; exit 0', 'vailable demodulators:', shell=True)


pluginDef_APRS = ModeDef(mode='APRS',  # TODO: Rename mode to be more accurate
    info='APRS',
    demod_class=FMAPRSDemodulator,
    unavailability=_multimon_unavailability)
Ejemplo n.º 10
0
 def test_stdout_failure(self):
     self.assertEqual(test_subprocess(['echo', 'y•'], b'x', shell=False),
         textwrap.dedent("""\
             Expected `echo y•` to give output containing 'x', but the actual output was:
             y•
             """))
Ejemplo n.º 11
0
    def errReceived(self, data):
        # we should inherit stderr, not pipe it
        raise Exception('shouldn\'t happen')
    
    def __lineReceived(self, line):
        if line == '':  # observed glitch in output
            pass
        elif line.startswith('Enabled demodulators:'):
            pass
        elif line.startswith('$ULTW') and self.__last_line is not None:  # observed glitch in output; need to glue to previous line, I think?
            ll = self.__last_line
            self.__last_line = None
            self.__target(ll + line)
        elif line.startswith('APRS: '):
            line = line[len('APRS: '):]
            self.__last_line = line
            self.__target(line)
        else:
            # TODO: Log these properly
            print 'Not APRS line: %r' % line


# TODO: Arrange for a way for the user to see why it is unavailable.
_multimon_available = test_subprocess('multimon-ng -h; exit 0', 'vailable demodulators:', shell=True)


pluginDef_APRS = ModeDef(mode='APRS',  # TODO: Rename mode to be more accurate
    info='APRS',
    demod_class=FMAPRSDemodulator,
    available=_multimon_available)
Ejemplo n.º 12
0
                    label=k,
                    sort_key='1' + k)
            self.__cells[k].set_internal(v)
        self.state_changed()
        if shape_changed:
            self.state_shape_changed()
    
    def is_interesting(self):
        """Implements ITelemetryObject."""
        return True
    
    def get_object_expiry(self):
        """implement ITelemetryObject"""
        return self.__last_heard_time + drop_unheard_timeout_seconds
    
    @exported_value(type=TimestampT(), changes='explicit', label='Last heard', sort_key='9heard')
    def get_last_heard_time(self):
        return self.__last_heard_time


_rtl_433_unavailability = test_subprocess(
    ['rtl_433', '-r', '/dev/null'],
    b'Reading samples from file',
    shell=False)


plugin_mode = ModeDef(mode='433',
    info=EnumRow(label='rtl_433', description='OOK telemetry decoded by rtl_433 mostly found at 433 MHz'),
    demod_class=RTL433Demodulator,
    unavailability=_rtl_433_unavailability)
Ejemplo n.º 13
0
            self.state_shape_changed()

    def is_interesting(self):
        """Implements ITelemetryObject."""
        return True

    def get_object_expiry(self):
        """implement ITelemetryObject"""
        return self.__last_heard_time + drop_unheard_timeout_seconds

    @exported_value(type=TimestampT(),
                    changes='explicit',
                    label='Last heard',
                    sort_key='9heard')
    def get_last_heard_time(self):
        return self.__last_heard_time


_rtl_433_unavailability = test_subprocess(['rtl_433', '-r', '/dev/null'],
                                          b'Reading samples from file',
                                          shell=False)

plugin_mode = ModeDef(
    mode='433',
    info=EnumRow(
        label='rtl_433',
        description='OOK telemetry decoded by rtl_433 mostly found at 433 MHz'
    ),
    demod_class=RTL433Demodulator,
    unavailability=_rtl_433_unavailability)