gpib_device_manager.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:barium 作者: barium-project 项目源码 文件源码
def initServer(self):
        """Initialize the server after connecting to LabRAD."""
        self.knownDevices = {} # maps (server, channel) to (name, idn)
        self.deviceServers = {} # maps device name to list of interested servers.
                                # each interested server is {'target':<>,'context':<>,'messageID':<>}
        self.identFunctions = {} # maps server to (setting, ctx) for ident
        self.identLock = DeferredLock()

        # named messages are sent with source ID first, which we ignore
        connect_func = lambda c, (s, payload): self.gpib_device_connect(*payload)
        disconnect_func = lambda c, (s, payload): self.gpib_device_disconnect(*payload)
        mgr = self.client.manager
        self._cxn.addListener(connect_func, source=mgr.ID, ID=10)
        self._cxn.addListener(disconnect_func, source=mgr.ID, ID=11)
        yield mgr.subscribe_to_named_message('GPIB Device Connect', 10, True)
        yield mgr.subscribe_to_named_message('GPIB Device Disconnect', 11, True)

        # do an initial scan of the available GPIB devices
        yield self.refreshDeviceLists()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号