UT330BUI/model/UT330.py
def connect(self):

        """Connects to the device or raises an error"""

        # Get the port the device is connected to
        # ---------------------------------------
        port = None

        # Get all the serial ports
        port_list = serial.tools.list_ports.comports()
        serial.tools.list_ports.comports

        # Now find which port has our device
        for trial in port_list:

            # I'm not sure this is specific enough for general use. It may
            # give a false report if another device using the same controller
            # is connected. However, I can't find a more specific check.
            if trial.vid == 4292 and trial.pid == 60000:
                port = trial

        if port is None:
            raise IOError('Error! The UT330 device was not detected on any '
                          'USB port.')

        # Attempt a connection to the port
        # --------------------------------
        self._ut330 = serial.Serial(port=port.device,
                                    baudrate=115200,
                                    timeout=self._read_timeout,
                                    write_timeout=self._write_timeout)

        # Check that the serial port is open
        # ----------------------------------
        if not self._ut330.isOpen():
            raise IOError('Error! The UT330 is not open on the serial port.')
Connects to the device or raises an error
Connects to the device or raises an error
Connects to the device or raises an error
def connect(self):
        port = None
        port_list = serial.tools.list_ports.comports()
        serial.tools.list_ports.comports
        for trial in port_list:
            if trial.vid == 4292 and trial.pid == 60000:
                port = trial
        if port is None:
            raise IOError('Error! The UT330 device was not detected on any '
                          'USB port.')
        self._ut330 = serial.Serial(port=port.device,
                                    baudrate=115200,
                                    timeout=self._read_timeout,
                                    write_timeout=self._write_timeout)
        --
        if not self._ut330.isOpen():
            raise IOError('Error! The UT330 is not open on the serial port.')
def connect ( self ) : port = None port_list = serial . tools . list_ports . comports ( ) serial . tools . list_ports . comports for trial in port_list : if trial . vid == 4292 and trial . pid == 60000 : port = trial if port is None : raise IOError ( 'Error! The UT330 device was not detected on any ' 'USB port.' ) self . _ut330 = serial . Serial ( port = port . device , baudrate = 115200 , timeout = self . _read_timeout , write_timeout = self . _write_timeout ) if not self . _ut330 . isOpen ( ) : raise IOError ( 'Error! The UT330 is not open on the serial port.' )
Connects to the device or raises an error
Connects to the device or raises an error
"""Connects to the device or raises an error""" # Get the port the device is connected to # --------------------------------------- # Get all the serial ports # Now find which port has our device # I'm not sure this is specific enough for general use. It may # give a false report if another device using the same controller # is connected. However, I can't find a more specific check. # Attempt a connection to the port # -------------------------------- # Check that the serial port is open # ----------------------------------
self