msl.equipment.connection_tcpip_vxi11 module

Base class for equipment that use the VXI-11 communication protocol.

class msl.equipment.connection_tcpip_vxi11.ConnectionTCPIPVXI11(record)[source]

Bases: ConnectionMessageBased

Base class for equipment that use the VXI-11 communication protocol.

The properties for a VXI-11 connection supports the following key-value pairs in the Connections Database:

'buffer_size': int, the maximum number of bytes to read at a time [default: 4096]
'encoding': str, the encoding to use [default: 'utf-8']
'encoding_errors': str, encoding error handling scheme, e.g. 'strict', 'ignore' [default: 'strict']
'lock_timeout': float or None, the timeout (in seconds) to wait for a lock [default: 0]
'max_read_size': int, the maximum number of bytes that can be read [default: 1 MB]
'port': int, the port to use instead of calling the RPC Port Mapper function [default: None]
'read_termination': str or None, read until this termination character is found [default: None]
'rstrip': bool, whether to remove trailing whitespace from "read" messages [default: False]
'termination': alias for 'read_termination'
'timeout': float or None, the timeout (in seconds) for read and write operations [default: None]

The backend value must be equal to MSL to use this class for the communication system. This is achieved by setting the value in the Backend field for a connection record in the Connections Database to be MSL.

Do not instantiate this class directly. Use the connect() method to connect to the equipment.

Parameters:

record (EquipmentRecord) – A record from an Equipment-Register Database.

property byte_buffer

Returns the reference to the byte buffer.

Type:

bytearray

property host

The host (IP address).

Type:

str

property port

The port number.

Type:

int

property socket

The reference to the socket.

Type:

socket

static parse_address(address)[source]

Parse the address for valid TCPIP VXI-11 fields.

Parameters:

address (str) – The address of a ConnectionRecord.

Returns:

dict or None – The board number, hostname, and LAN device name of the device or None if address is not valid for a TCPIP VXI-11 connection.

disconnect()[source]

Unlink and close the sockets.

reconnect(max_attempts=1)[source]

Reconnect to the equipment.

Parameters:

max_attempts (int, optional) – The maximum number of attempts to try to reconnect with the equipment. If < 1 or None then keep trying until a connection is successful. If the maximum number of attempts has been reached then an exception is raise.

property lock_timeout

The time, in seconds, to wait to acquire a lock.

Type:

float

abort()[source]

Stop an in-progress request.

read_stb()[source]

Read the status byte from the device.

Returns:

int – The status byte.

trigger()[source]

Send a trigger to the device.

clear()[source]

Send the clear command to the device.

remote()[source]

Place the device in a remote state wherein all programmable local controls are disabled.

local()[source]

Place the device in a local state wherein all programmable local controls are enabled.

lock()[source]

Acquire the device’s lock.

unlock()[source]

Release the lock acquired by lock()

enable_sqr(enable, handle)[source]

Enable or disable the sending of device_intr_srq RPCs by the network instrument server.

Parameters:
  • enable (bool) – Whether to enable or disable interrupts.

  • handle (bytes) – Host specific data (maximum length is 40 characters).

docmd(cmd, value, fmt)[source]

Allows for a variety of commands to be executed.

Parameters:
  • cmd (int) – An IEEE 488 command messages, (e.g., to send a group execute trigger, GET, command the value of cmd would be 0x08).

  • value (bool, int or float) – The value to use with cmd.

  • fmt (str) – How to format value. See Format Characters for more details. Do not include the byte-order character. Network (big-endian) order will always be used.

Returns:

bytes – The results defined by cmd.

Destroy the link with the device.

create_intr_chan(host_addr, host_port, prog_num, prog_vers, prog_family)[source]

Inform the network instrument server to establish an interrupt channel.

Parameters:
  • host_addr (int) – Host servicing the interrupt.

  • host_port (int) – Valid port number on the client.

  • prog_num (int) – Program number.

  • prog_vers (int) – Program version number.

  • prog_family (int) – The underlying socket protocol family type (IPPROTO_TCP or IPPROTO_UDP).

destroy_intr_chan()[source]

Inform the network instrument server to close its interrupt channel.