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()
评论列表
文章目录