Пример #1
0
class AppRoot(ExportedState):
    def __init__(self, devices, audio_config, features):
        self.__receive_flowgraph = Top(
            devices=devices,
            audio_config=audio_config,
            features=features)
        # TODO: only one session while we sort out other things
        self.__session = Session(
            receive_flowgraph=self.__receive_flowgraph,
            features=features)
    
    @exported_value(type=ReferenceT(), changes='never')
    def get_receive_flowgraph(self):  # TODO needs to go away
        return self.__receive_flowgraph
    
    @exported_value(type=ReferenceT(), persists=True, changes='never')
    def get_devices(self):
        """Return all existant devices.
        
        This exists only for persistence purposes.
        """
        return self.__receive_flowgraph.get_sources()
    
    # TODO: should become something more like 'create new session'
    def get_session(self):
        return self.__session
    
    def close_all_devices(self):
        self.__receive_flowgraph.close_all_devices()
Пример #2
0
class AppRoot(ExportedState):
    def __init__(self, devices, audio_config, read_only_dbs, writable_db,
                 features):
        self.__receive_flowgraph = Top(devices=devices,
                                       audio_config=audio_config,
                                       features=features)
        # TODO: only one session while we sort out other things
        self.__session = Session(receive_flowgraph=self.__receive_flowgraph,
                                 read_only_dbs=read_only_dbs,
                                 writable_db=writable_db,
                                 features=features)

    @exported_value(type=ReferenceT(), changes='never')
    def get_receive_flowgraph(self):  # TODO needs to go away
        return self.__receive_flowgraph

    @exported_value(type=ReferenceT(), persists=True, changes='never')
    def get_devices(self):
        """Return all existant devices.
        
        This exists only for persistence purposes.
        """
        return self.__receive_flowgraph.get_sources()

    # TODO: should become something more like 'create new session'
    def get_session(self):
        return self.__session

    def close_all_devices(self):
        self.__receive_flowgraph.close_all_devices()
Пример #3
0
class AppRoot(ExportedState):
    def __init__(self, devices, audio_config, features):
        self.__receive_flowgraph = Top(devices=devices,
                                       audio_config=audio_config,
                                       features=features)
        # TODO: only one session while we sort out other things
        self.__session = Session(receive_flowgraph=self.__receive_flowgraph,
                                 features=features)

    @exported_block()
    def get_receive_flowgraph(self):  # TODO needs to go away
        return self.__receive_flowgraph

    @exported_block(persists=True)
    def get_devices(self):
        """Return all existant devices.
        
        This exists only for persistence purposes.
        """
        return self.__receive_flowgraph.get_sources()

    # TODO: should become something more like 'create new session'
    def get_session(self):
        return self.__session

    def close_all_devices(self):
        self.__receive_flowgraph.close_all_devices()
Пример #4
0
 def test_close(self):
     log = []
     top = Top(devices={'m':
         merge_devices([
             SimulatedDeviceForTest(),
             Device(components={'c': _DeviceShutdownDetector(log)})])})
     top.close_all_devices()
     self.assertEqual(log, ['close'])
Пример #5
0
 def test_close(self):
     log = []
     top = Top(devices={'m':
         merge_devices([
             SimulatedDeviceForTest(),
             Device(components={'c': _DeviceShutdownDetector(log)})])})
     top.close_all_devices()
     self.assertEqual(log, ['close'])
Пример #6
0
class TestReceiver(unittest.TestCase):
    def setUp(self):
        self.top = Top(devices={'s1': SimulatedDevice()})
        (_key, self.receiver) = self.top.add_receiver('AM', key='a')
    
    def tearDown(self):
        self.top.close_all_devices()

    def test_smoke(self):
        state_smoke_test(self.receiver)

    def test_no_audio_demodulator(self):
        """Smoke test for demodulator with no audio output."""
        # TODO: Allow parameterizing with a different mode table so that we can use a test stub mode rather than a real one
        self.receiver.set_mode('MODE-S')
Пример #7
0
class TestReceiver(unittest.TestCase):
    def setUp(self):
        self.top = Top(devices={'s1': SimulatedDevice()})
        (_key, self.receiver) = self.top.add_receiver('AM', key='a')

    def tearDown(self):
        self.top.close_all_devices()

    def test_smoke(self):
        state_smoke_test(self.receiver)

    def test_no_audio_demodulator(self):
        """Smoke test for demodulator with no audio output."""
        # TODO: Allow parameterizing with a different mode table so that we can use a test stub mode rather than a real one. Also fix rtl_433 leaving unclean reactor.
        for mode in ['MODE-S']:
            if lookup_mode(mode):
                self.receiver.set_mode(mode)
                break
        else:
            raise unittest.SkipTest('No no-audio mode available.')
Пример #8
0
class TestReceiver(unittest.TestCase):
    def setUp(self):
        self.top = Top(devices={'s1': SimulatedDevice()})
        (_key, self.receiver) = self.top.add_receiver('AM', key='a')
    
    def tearDown(self):
        self.top.close_all_devices()

    def test_smoke(self):
        state_smoke_test(self.receiver)

    def test_no_audio_demodulator(self):
        """Smoke test for demodulator with no audio output."""
        # TODO: Allow parameterizing with a different mode table so that we can use a test stub mode rather than a real one. Also fix rtl_433 leaving unclean reactor.
        for mode in ['MODE-S']:
            if lookup_mode(mode):
                self.receiver.set_mode(mode)
                break
        else:
            raise unittest.SkipTest('No no-audio mode available.')