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• """))
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)
def test_stdout_failure(self): self.assertFalse(test_subprocess(['echo', 'y'], 'x', shell=False))
def test_stdout_success(self): self.assertTrue(test_subprocess(['echo', 'x'], 'x', shell=False))
def test_stdout_success(self): self.assertFalse(test_subprocess(['echo', 'x'], b'x', shell=False))
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)
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)
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)
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• """))
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)
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)
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)