qmi.core.transport.create_transport

qmi.core.transport.create_transport(transport_descriptor: str, default_attributes: dict[str, Any] | None = None) QMI_Transport

Create a bidirectional communication channel.

A transport_descriptor specifies all information that may be needed to open a transport, including parameters such as port number, baud rate, etc. Certain entries are obligatory, like giving the host IP address for UDP and TCP transports. Other entries are optional, and are indicated with <, > characters. For those entries, if not given, the string format below indicates the default value used in that case with the =value part. Do not include the <, > characters in the strings.

String format:
  • VXI-11 instrument: “vxi11:host”

  • UDP connection: “udp:host<:port>”

  • TCP connection: “tcp:host<:port><:connect_timeout=10>”

  • Serial port: “serial:device<:baudrate=115200><:databits=8><:parity=N><:stopbits=1>”

  • USBTMC device: “usbtmc:vendorid:productid:serialnr”

  • GPIB device: “gpib:<board=None:>primary_addr<:secondary_addr=None><:connect_timeout=30.0>”

UDP, TCP and VXI-11:
  • “host” (for UDP, TCP & VXI-11 transports) specifies the host name or IP address of the UDP server/TCP client. Numerical IPv6 addresses must be enclosed in square brackets, e.g. “tcp:[2620:0:2d0:200::8]:5000”.

  • “port” (for UDP and TCP transports) specifies the UDP/TCP port number of the server/client.

  • “connect_timeout” is TCP connection timeout.

Serial:
  • “device” is the name of the serial port, for example “COM3” or “/dev/ttyUSB0”.

  • “baudrate” specifies the number of bits per second. This attribute is only required for instruments with a configurable baud rate.

  • “bytesize” specifies the number of data bits per character (valid range 5 - 8). This attribute is only required for instruments with a configurable character format.

  • “parity” specifies the parity bit (‘O’ or ‘E’ or ‘’N’). This attribute is only required for instruments with a configurable character format.

  • “stopbits” specifies the number of stop bits (1 or 1.5 or 2). This attribute is only required for instruments with a configurable character format.

  • “rtscts” enables or disables RTS/CTS flow control. Possible values are True and False; the default is False.

USBTMC:
  • “vendorid” is the USB Vendor ID as a decimal number or as hexadecimal with 0x prefix.

  • “productid” is the USB Product ID as a decimal number or as hexadecimal with 0x prefix.

  • “serialnr” is the USB serial number string.

GPIB:
  • “primary_addr” is GPIB device number (integer).

  • “board” is optional GPIB interface number (in VISA syntax GPIB[board]::…).

  • “secondary_addr” is optional secondary device address number.

  • “connect_timeout” is for opening resource for GPIB device, in seconds.