pygpibtoolkit/pygpib.py

Thu, 28 Feb 2008 18:35:23 +0100

author
David Douard <david.douard@logilab.fr>
date
Thu, 28 Feb 2008 18:35:23 +0100
changeset 61
6ecb0fd8c129
parent 58
98a94ec5f24e
child 62
486a480d196b
permissions
-rw-r--r--

cleanup: removed useless commandregister (and fix some missing import)

2
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
1 """
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
2 gpib: create serial connection to GPIB-USB device (ProLogix is the
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
3 only supported device for now).
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
4 """
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
5 import serial
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
6 from serial.serialutil import SerialException
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
7 import time
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
8 from pygpibtoolkit.tools import AbstractRegister
2
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
9
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
10 class ConnectionError(Exception):
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
11 pass
cd9efa64f6da added a gpib module (handle gpib connection)
David Douard <david.douard@logilab.fr>
parents:
diff changeset
12
12
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
13 class Constants(object):
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
14 def __init__(self):
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
15 self.constants = {}
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
16 self.descriptions = {}
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
17 self.rev_constants = {}
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
18 for v, k, m in self._constants:
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
19 self.k = v
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
20 self.constants[v] = k
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
21 self.rev_constants[k] = v
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
22 self.descriptions[v] = m
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
23
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
24 def __getitem__(self, k):
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
25 if isinstance(k, basestring):
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
26 return self.rev_constants[k]
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
27 else:
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
28 return self.constants[k]
9
3b50c46fca56 several updates to the gpib module
David Douard <david.douard@logilab.fr>
parents: 7
diff changeset
29
12
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
30 def get_description(self, k):
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
31 if isinstance(k, basestring):
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
32 k = self.rev_constants[k]
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
33 return self.descriptions[k]
9
3b50c46fca56 several updates to the gpib module
David Douard <david.douard@logilab.fr>
parents: 7
diff changeset
34
12
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
35 class MODE(Constants):
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
36 _constants = [(1, "CONTROLLER", "Set device as Controller in Charge"),
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
37 (0, "DEVICE", "Set device as simple listener"),
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
38 ]
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
39
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
40 class ModeCommand(object):
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
41 def __init__(self, description, name, condition=None):
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
42 self.name = name
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
43 self.description = description
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
44 self.condition = condition
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
45
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
46 class AbstractCommand(object):
54
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
47 """
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
48 Base class for HPIB command descritption.
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
49
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
50 This is actually a attribute descriptor, which should have
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
51 AbstractGPIBDevice derived classes as owner.
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
52 """
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
53 _readonly = True
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
54 _init_value = None
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
55
54
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
56 def __get__(self, instance, owner):
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
57 if instance is None:
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
58 return self
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
59 return instance._get(self.__class__.__name__)
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
60 def __set__(self, instance, value):
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
61 if instance is None:
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
62 return self
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
63 return instance._set(self.__class__.__name__, value)
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
64
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
65 class Command(AbstractCommand):
57
7013c4bebc7b Some improvements & cleanups. Now the get/set mecanisme using descriptor works (but is not yet implemented for most commands of the HP356X devices).
David Douard <david.douard@logilab.fr>
parents: 54
diff changeset
66 def build_get_cmd(self):
7013c4bebc7b Some improvements & cleanups. Now the get/set mecanisme using descriptor works (but is not yet implemented for most commands of the HP356X devices).
David Douard <david.douard@logilab.fr>
parents: 54
diff changeset
67 return self.__class__.__name__
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
68
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
69 def build_set_cmd(self, *value):
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
70 raise ValueError, "Can't set value for command '%s'"%self.__class__.__name__
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
71
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
72 def convert_from(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
73 return None
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
74
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
75 class AbstractValue(Command):
54
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
76 _readonly = False
57
7013c4bebc7b Some improvements & cleanups. Now the get/set mecanisme using descriptor works (but is not yet implemented for most commands of the HP356X devices).
David Douard <david.douard@logilab.fr>
parents: 54
diff changeset
77 def build_get_cmd(self):
7013c4bebc7b Some improvements & cleanups. Now the get/set mecanisme using descriptor works (but is not yet implemented for most commands of the HP356X devices).
David Douard <david.douard@logilab.fr>
parents: 54
diff changeset
78 return self.__class__.__name__ + "?"
7013c4bebc7b Some improvements & cleanups. Now the get/set mecanisme using descriptor works (but is not yet implemented for most commands of the HP356X devices).
David Douard <david.douard@logilab.fr>
parents: 54
diff changeset
79
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
80 def build_set_cmd(self, *value):
54
5c1a312830e7 An AbstractGPIBDevice and the Command should now behave quite OK ie. one can type d.MyCommand and it will return the value (either from the cache or after having asked it to the device), and use d.FRS = 10000 to send the command "FRS 10000 Hz" to the device transparently.
David Douard <david.douard@logilab.fr>
parents: 53
diff changeset
81 value = self.convert_to(value)
57
7013c4bebc7b Some improvements & cleanups. Now the get/set mecanisme using descriptor works (but is not yet implemented for most commands of the HP356X devices).
David Douard <david.douard@logilab.fr>
parents: 54
diff changeset
82 cmd = "%s %s"%(self.__class__.__name__, value)
7013c4bebc7b Some improvements & cleanups. Now the get/set mecanisme using descriptor works (but is not yet implemented for most commands of the HP356X devices).
David Douard <david.douard@logilab.fr>
parents: 54
diff changeset
83 return cmd
7013c4bebc7b Some improvements & cleanups. Now the get/set mecanisme using descriptor works (but is not yet implemented for most commands of the HP356X devices).
David Douard <david.douard@logilab.fr>
parents: 54
diff changeset
84
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
85 def convert_to(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
86 if value:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
87 return str(value[0])
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
88 return ""
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
89
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
90 def convert_from(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
91 if value:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
92 return self._type(value[0].strip())
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
93 return None
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
94
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
95 class BoolValue(AbstractValue):
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
96 _type = bool
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
97 def convert_from(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
98 if value:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
99 return value[0] and value[0].lower() in ['1','true','yes','on']
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
100 return False
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
101
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
102 def convert_to(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
103 if value:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
104 return value[0] and "1" or "0"
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
105 return "" # XXX is it correct?
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
106
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
107 class IntValue(AbstractValue):
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
108 _type = int
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
109 def convert_from(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
110 if value:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
111 # int is resturned as a string representing a float
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
112 return self._type(float(value[0].strip()))
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
113 return None
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
114
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
115 class flag(int):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
116 def __new__(cls, val, constants):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
117 val = int.__new__(cls, val)
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
118 val._constants = constants
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
119 for v, name, desc in constants:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
120 if name not in ['', 'N/A']:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
121 setattr(val, name, v)
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
122 return val
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
123
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
124 def __str__(self):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
125 return '%s <' + '|'.join([x[1] for x in self._constants if x[0]&self]) + ">"
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
126 def flags(self):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
127 return [x[1] for x in self._constants if x[0] & (self and x[1]) not in ['','N/A']]
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
128
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
129 def descriptions(self):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
130 return [x[2] for x in self._constants if (x[0] & self) and x[1] not in ['','N/A']]
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
131
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
132 class Flag(IntValue):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
133 _readonly = True
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
134 _constants = []
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
135 _type = flag
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
136 def convert_from(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
137 if value:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
138 return self._type(float(value[0].strip()), _constants)
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
139 return None
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
140
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
141 class FloatValue(AbstractValue):
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
142 _type = float
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
143
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
144 class PercentageValue(FloatValue):
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
145 pass #TODO
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
146
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
147 class FloatUnitValue(FloatValue):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
148 """
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
149 A Float value with unit (frequency, etc.)
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
150 """
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
151 def convert_to(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
152 if value:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
153 if len(value)==1:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
154 if isinstance(value[0], basestring):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
155 value = value[0].strip().split()
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
156 if len(value)==1:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
157 freq = float(value)
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
158 unit = self._units[0]
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
159 elif len(value)==2:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
160 freq = float(value[0])
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
161 unit = value[1]
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
162 else:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
163 raise ValueError, "Can't interpret %s as a %s"%(repr(value), self._name)
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
164 else:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
165 freq = float(value[0])
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
166 unit = self._units[0]
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
167 elif len(value)==2:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
168 freq = float(value[0])
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
169 unit = value[1]
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
170 else:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
171 raise ValueError, "Can't interpret %s as a %s"%(repr(value), self._name)
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
172 assert unit.lower() in self._units, "Unit is not correct (%s)"%unit
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
173 return "%s%s"%(freq, unit)
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
174 return "" # XXX is it correct?
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
175
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
176 class FrequencyValue(FloatUnitValue):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
177 _units = ['Hz','kHz','mHz',]
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
178 _name = "frequency"
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
179
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
180 class VoltageValue(FloatUnitValue):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
181 _units = ['V','mV',]
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
182 _name = "voltage"
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
183
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
184 class DurationValue(FloatUnitValue):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
185 _units = ['sec','msec','usec','min']
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
186 _name = "duration"
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
187
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
188 class StringValue(AbstractValue):
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
189 _type = str
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
190 def convert_to(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
191 if value:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
192 return "'%s'"%str(value[0])
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
193 return "''"
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
194
58
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
195 class EnumValue(StringValue):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
196 _values = []
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
197 def convert_to(self, *value):
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
198 if value:
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
199 assert value[0] in self._values
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
200 return "%s"%self._values.index(value[0])
98a94ec5f24e make convert_from prototype accepts several arguments (to build command with several arguments)
David Douard <david.douard@logilab.fr>
parents: 57
diff changeset
201 return "" # XXX
53
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
202
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
203 class Mode(AbstractValue):
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
204 pass
8e32c806fcdd Major refactoring in progress. Build the toolkit around a GPIB controller which have a communication thread with the devices. Every device is an instance of a class that describes the device model and registers itself to the controller.
David Douard <david.douard@logilab.fr>
parents: 40
diff changeset
205
61
6ecb0fd8c129 cleanup: removed useless commandregister (and fix some missing import)
David Douard <david.douard@logilab.fr>
parents: 58
diff changeset
206
12
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
207 # TODO
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
208 # class STATUS_BYTE(Constants):
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
209 # # IEEE 488.2 Status Byte constants
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
210 # MAV = 0x10 # Message AVailable: bit 4 of the Status Byte
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
211 # ESB = 0x20 # Event Status Bit: bit 5 of the Status Byte
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
212 # MSS = 0x40 # Master Summary Status bit: bit 6 of the Status Byte (NOT
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
213 # # sent in response to a serial poll)
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
214 # RQS = 0x40 # Request Service: bit 6 of the Status Byte (when sent in
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
215 # # response to a serial poll)
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
216 # class SESR(Constants):
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
217 # # SESR constants (Standard Event Status Register)
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
218 # PON = 0x80 # Power On: Power has been turned On since last register
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
219 # # read access
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
220 # URQ = 0x40 # User Request: the user has activated some device control
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
221 # # (whatever the Remote Local state is)
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
222 # CME = 0x20 # Command Error
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
223 # EXE = 0x10 # Execution Error
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
224 # DDE = 0x08 # Device Dependant Error
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
225 # QYE = 0x04 # QuerY Error (attempt to read data while Output Queue is
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
226 # # empty, or data in the OQ was lost)
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
227 # RQC = 0x02 # Request Control: tell the CiC that the device wants to
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
228 # # become the CiC
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
229 # OPC = 0x01 # Operation Complete: device has completed any pending
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
230 # # operation (ready to accept new commands). This bit is
a04bea92c509 some code refactoring and several improvements in gpib_plotter (should be more robust & quicker)
David Douard <david.douard@logilab.fr>
parents: 9
diff changeset
231 # # generated in response to a OPC command.
9
3b50c46fca56 several updates to the gpib module
David Douard <david.douard@logilab.fr>
parents: 7
diff changeset
232

mercurial