msl.equipment.connection_tcpip_hislip module

Base class for equipment that use the HiSLIP communication protocol.

class msl.equipment.connection_tcpip_hislip.ConnectionTCPIPHiSLIP(record)[source]

Bases: ConnectionMessageBased

Base class for equipment that use the HiSLIP communication protocol.

The properties for a HiSLIP 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]
'rstrip': bool, whether to remove trailing whitespace from "read" messages [default: False]
'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 host

The host (IP address).

Type:

str

property port

The port number.

Type:

int

property asynchronous

The reference to the asynchronous client.

Type:

AsyncClient

property synchronous

The reference to the synchronous client.

Type:

SyncClient

static parse_address(address)[source]

Parse the address for valid TCPIP HiSLIP fields.

Parameters:

address (str) – The address of a ConnectionRecord.

Returns:

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

property max_read_size

The maximum number of bytes that can be read().

Type:

int

property lock_timeout

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

Type:

float

disconnect()[source]

Close the connection to the HiSLIP server.

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.

read_stb()[source]

Read the status byte from the device.

Returns:

int – The status byte.

trigger()[source]

Send the trigger message (emulates a GPIB Group Execute Trigger event).

clear()[source]

Send the clear command to the device.

lock(lock_string='')[source]

Acquire the device’s lock.

Parameters:

lock_string (str, optional) – An ASCII string that identifies this lock. If not specified, then an exclusive lock is requested, otherwise the string indicates an identification of a shared-lock request.

Returns:

bool – Whether acquiring the lock was successful.

unlock()[source]

Release the lock acquired by lock().

Returns:

bool – Whether releasing the lock was successful.

lock_status()[source]

Request the lock status from the HiSLIP server.

Returns:

  • bool – Whether the HiSLIP server has an exclusive lock with a client.

  • int – The number of HiSLIP clients that have a lock with the HiSLIP server.

remote_local_control(request)[source]

Send a GPIB-like remote/local control request.

Parameters:

request (int) –

The request to perform.

  • 0 – Disable remote, VI_GPIB_REN_DEASSERT

  • 1 – Enable remote, VI_GPIB_REN_ASSERT

  • 2 – Disable remote and go to local, VI_GPIB_REN_DEASSERT_GTL

  • 3 – Enable Remote and go to remote, VI_GPIB_REN_ASSERT_ADDRESS

  • 4 – Enable remote and lock out local, VI_GPIB_REN_ASSERT_LLO

  • 5 – Enable remote, go to remote, and set local lockout, VI_GPIB_REN_ASSERT_ADDRESS_LLO

  • 6 – go to local without changing REN or lockout state, VI_GPIB_REN_ADDRESS_GTL