maffoo/pylabrad — pull request #2 by martinisgroup (2013-07-31 03:50:55+00:00)
Title: asyncore backend hot loop + improved gpib device model support

First, fixed that hot loop in the asyncore backend. Use timeout in select loop to allow loop to pick up new commands from user. select()ing on stdin and other various "elegant" solutions don't seem possible in windows.

Second, I modified the gpib superclasses to allow subclasses of GPIBManagedServer to serve for multiple device models. We already had functionality to allow a server to pick up devices of different models with differing *IDN? responses, but the same class was used as the device wrapper for each device. This meant devices had to be SCPI compatible to be served by the same server. Now device wrapper classes are specific to device model and are sorted out according to *IDN? responses. An example is in pylabrad/labrad/servers/gpibMockDeviceServer.py. The relevant difference is that in subclasses of GPIBManagedDevice, instead of this:

deviceName = [deviceName1, deviceName2]
deviceWrapper = MyDeviceWrapper

which always uses the same device wrapper, we do this:

deviceWrappers = {deviceName1: MyDeviceWrapper1, deviceName2: MyDeviceWrapper2}