当前位置: 首页>>代码示例>>Python>>正文


Python Top.start方法代码示例

本文整理汇总了Python中shinysdr.top.Top.start方法的典型用法代码示例。如果您正苦于以下问题:Python Top.start方法的具体用法?Python Top.start怎么用?Python Top.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shinysdr.top.Top的用法示例。


在下文中一共展示了Top.start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DemodulatorTester

# 需要导入模块: from shinysdr.top import Top [as 别名]
# 或者: from shinysdr.top.Top import start [as 别名]
class DemodulatorTester(object):
    '''
    Set up an environment for testing a demodulator and do some fundamental tests.
    '''
    def __init__(self, mode, state=None):
        # TODO: Refactor things so that we can take the demod ctor rather than a mode string
        if state is None:
            state = {}
        mode_def = lookup_mode(mode)
        if mode_def is None:
            raise Exception('No such mode is registered: ' + repr(mode))
        # TODO: Tell the simulated device to have no modulators, or have a simpler dummy source for testing, so we don't waste time on setup
        self.__top = Top(devices={'s1': SimulatedDevice()})
        (_, receiver) = self.__top.add_receiver(mode, key='a', state=state)
        self.__demodulator = receiver.get_demodulator()
        if not isinstance(self.__demodulator, mode_def.demod_class):
            raise Exception('Demodulator not of expected class: ' + repr(self.__demodulator))
        self.__top.start()  # TODO overriding internals
    
    def close(self):
        if self.__top is not None:
            self.__top.stop()
            self.__top = None
    
    def __enter__(self):
        state_smoke_test(self.__demodulator)
    
    def __exit__(self, exc_type, exc_value, traceback):
        self.close()
开发者ID:croutonage,项目名称:shinysdr,代码行数:31,代码来源:testutil.py

示例2: DemodulatorTester

# 需要导入模块: from shinysdr.top import Top [as 别名]
# 或者: from shinysdr.top.Top import start [as 别名]
class DemodulatorTester(object):
    '''
    Set up an environment for testing a demodulator.
    '''
    def __init__(self, mode):
        # TODO: Refactor things so that we can take the demod ctor rather than a mode string
        # TODO: Tell the simulated device to have no modulators, or have a simpler dummy source for testing, so we don't waste time on setup
        self.__top = Top(devices={'s1': SimulatedDevice()})
        self.__top.add_receiver(mode, key='a')
        self.__top.start()  # TODO overriding internals
    
    def close(self):
        if self.__top is not None:
            self.__top.stop()
            self.__top = None
    
    def __enter__(self):
        pass
    
    def __exit__(self, exc_type, exc_value, traceback):
        self.close()
开发者ID:gstark307,项目名称:shinysdr,代码行数:23,代码来源:testutil.py

示例3: DemodulatorTester

# 需要导入模块: from shinysdr.top import Top [as 别名]
# 或者: from shinysdr.top.Top import start [as 别名]
class DemodulatorTester(object):
    '''
    Set up an environment for testing a demodulator and do some fundamental tests.
    '''
    def __init__(self, mode, state=None):
        # TODO: Refactor things so that we can take the demod ctor rather than a mode string
        # TODO: Tell the simulated device to have no modulators, or have a simpler dummy source for testing, so we don't waste time on setup
        if state is None:
            state = {}
        self.__top = Top(devices={'s1': SimulatedDevice()})
        (_, receiver) = self.__top.add_receiver(mode, key='a', state=state)
        self.__demodulator = receiver.get_demodulator()
        self.__top.start()  # TODO overriding internals
    
    def close(self):
        if self.__top is not None:
            self.__top.stop()
            self.__top = None
    
    def __enter__(self):
        state_smoke_test(self.__demodulator)
    
    def __exit__(self, exc_type, exc_value, traceback):
        self.close()
开发者ID:langxj,项目名称:shinysdr,代码行数:26,代码来源:testutil.py


注:本文中的shinysdr.top.Top.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。