Commit b749cfe2 authored by auke.klazema's avatar auke.klazema

Moved extracted methodes into order of appearance

parent 63fe7b16
......@@ -40,25 +40,23 @@ class PrologixGpibUsb(PortDevice):
self._devices = "Not scanned."
self._hpib_address = -1
def _find_devices(self):
self._devices = []
for self._hpib_address in range(0, 31):
commandStr = "++addr " + str(self._hpib_address) + chr(10) + \
"*idn?" + chr(10) + \
"++read" + chr(10)
self._serialPort.write(commandStr)
returnStr = self._serialPort.readline()
if returnStr != "":
self._devices += [self._hpib_address, returnStr]
def _set_default_platform_values(self):
if platform.system() == "Linux":
port = "/dev/ttyUSB0"
port_format = "%d"
max_device_num = 99
elif platform.system() == "Darwin":
port = "/dev/ttys000"
port_format = "%03d"
max_device_num = 999
else:
raise NotImplementedError("Windows is not supported")
return max_device_num, port, port_format
def _initialize_prologix_gpi(self):
self._serialPort.write("++savecfg 0" + chr(10))
self._serialPort.write("++auto 0" + chr(10))
self._serialPort.write("++eoi 1" + chr(10))
self._serialPort.write("++eos 2" + chr(10))
self._serialPort.write("++eot_enable 0" + chr(10))
self._serialPort.write("++eot_char 0" + chr(10))
self._serialPort.write("++read_tmo_ms 500" + chr(10))
def _validate_port(self, port):
self._rematch = re.search(r"(/dev/tty.*[^0-9])([0-9]+$)", port)
if not self._rematch:
raise ValueError(port)
def _find_available_port(self, maxDeviceNum, port, portFormat, timeout, verbose):
while int(self._rematch.group(2)) < maxDeviceNum:
......@@ -73,23 +71,25 @@ class PrologixGpibUsb(PortDevice):
if self._serialPort is None:
raise serial.SerialException("Cannot find port")
def _validate_port(self, port):
self._rematch = re.search(r"(/dev/tty.*[^0-9])([0-9]+$)", port)
if not self._rematch:
raise ValueError(port)
def _initialize_prologix_gpi(self):
self._serialPort.write("++savecfg 0" + chr(10))
self._serialPort.write("++auto 0" + chr(10))
self._serialPort.write("++eoi 1" + chr(10))
self._serialPort.write("++eos 2" + chr(10))
self._serialPort.write("++eot_enable 0" + chr(10))
self._serialPort.write("++eot_char 0" + chr(10))
self._serialPort.write("++read_tmo_ms 500" + chr(10))
def _set_default_platform_values(self):
if platform.system() == "Linux":
port = "/dev/ttyUSB0"
port_format = "%d"
max_device_num = 99
elif platform.system() == "Darwin":
port = "/dev/ttys000"
port_format = "%03d"
max_device_num = 999
else:
raise NotImplementedError("Windows is not supported")
return max_device_num, port, port_format
def _find_devices(self):
self._devices = []
for self._hpib_address in range(0, 31):
commandStr = "++addr " + str(self._hpib_address) + chr(10) + \
"*idn?" + chr(10) + \
"++read" + chr(10)
self._serialPort.write(commandStr)
returnStr = self._serialPort.readline()
if returnStr != "":
self._devices += [self._hpib_address, returnStr]
def command(self, hpib_address, command):
if hpib_address != self._hpib_address:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment