msl.equipment.hislip module

Implementation of the HiSLIP protocol for a client.

This module implements the following IVI Protocol Specification:

IVI-6.1: High-Speed LAN Instrument Protocol (HiSLIP) v2.0 April 23, 2020

class msl.equipment.hislip.MessageType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Message types.

Initialize = 0
InitializeResponse = 1
FatalError = 2
Error = 3
AsyncLock = 4
AsyncLockResponse = 5
Data = 6
DataEnd = 7
DeviceClearComplete = 8
DeviceClearAcknowledge = 9
AsyncRemoteLocalControl = 10
AsyncRemoteLocalResponse = 11
Trigger = 12
Interrupted = 13
AsyncInterrupted = 14
AsyncMaximumMessageSize = 15
AsyncMaximumMessageSizeResponse = 16
AsyncInitialize = 17
AsyncInitializeResponse = 18
AsyncDeviceClear = 19
AsyncServiceRequest = 20
AsyncStatusQuery = 21
AsyncStatusResponse = 22
AsyncDeviceClearAcknowledge = 23
AsyncLockInfo = 24
AsyncLockInfoResponse = 25
GetDescriptors = 26
GetDescriptorsResponse = 27
StartTLS = 28
AsyncStartTLS = 29
AsyncStartTLSResponse = 30
EndTLS = 31
AsyncEndTLS = 32
AsyncEndTLSResponse = 33
GetSaslMechanismList = 34
GetSaslMechanismListResponse = 35
AuthenticationStart = 36
AuthenticationExchange = 37
AuthenticationResult = 38
class msl.equipment.hislip.ErrorType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Error types.

UNIDENTIFIED = 0
BAD_HEADER = 1
CHANNELS_INACTIVATED = 2
INVALID_INIT_SEQUENCE = 3
MAX_CLIENTS = 4
BAD_MESSAGE_TYPE = 1
BAD_CONTROL_CODE = 2
BAD_VENDOR = 3
MESSAGE_TOO_LARGE = 4
AUTHENTICATION_FAILED = 5
exception msl.equipment.hislip.HiSLIPException(message_type, control_code, reason=None)[source]

Bases: Exception

Base class for HiSLIP exceptions.

Parameters:
  • message_type (MessageType) – The message type.

  • control_code (int) – The control code from the server response.

  • reason (str) – Additional information to display in exception string.

property message

The error message that can be written to the server.

Type:

Message

exception msl.equipment.hislip.FatalError(control_code, reason=None)[source]

Bases: HiSLIPException

Exception for a fatal error.

Parameters:
  • control_code (int) – The control code from the server response.

  • reason (str) – Additional information to display in exception string.

exception msl.equipment.hislip.Error(control_code, reason=None)[source]

Bases: HiSLIPException

Exception for a non-fatal error.

Parameters:
  • control_code (int) – The control code from the server response.

  • reason (str) – Additional information to display in exception string.

class msl.equipment.hislip.Message(control_code=0, parameter=0, payload=b'')[source]

Bases: object

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

header = <_struct.Struct object>
prologue = b'HS'
type = None
property length_payload

The length of the payload.

Type:

int

pack()[source]

Convert the message to bytes.

Returns:

bytearray – The messaged packed as bytes.

static repack(unpack_fmt, pack_fmt, *args)[source]

Convert arguments from one byte format to another.

Parameters:
  • unpack_fmt (str) – The format to convert the arguments to.

  • pack_fmt (str) – The format that the arguments are currently in.

  • *args – The arguments to convert.

Returns:

tuple – The converted arguments.

property size

int The total size of the message.

class msl.equipment.hislip.FatalErrorMessage(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 2
class msl.equipment.hislip.ErrorMessage(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 3
class msl.equipment.hislip.Initialize(major, minor, client_id, sub_address)[source]

Bases: Message

Create an Initialize message.

Parameters:
  • major (int) – The major version number of the HiSLIP protocol that the client supports.

  • minor (int) – The minor version number of the HiSLIP protocol that the client supports.

  • client_id (bytes) – The vendor ID of the client. Must have a length of 2 characters.

  • sub_address (bytes) – A particular device managed by this server. For VISA clients this field corresponds to the VISA LAN device name (default is hislip0). The maximum length is 256 characters.

type = 0
class msl.equipment.hislip.InitializeResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 1
property encrypted

Whether encryption is optional or mandatory.

Type:

bool

property initial_encryption

Whether the client shall switch to encrypted mode.

Type:

bool

property overlapped

Whether the server is in overlapped or synchronous mode.

Type:

bool

property protocol_version

The (major, minor) version numbers of the HiSLIP protocol that the client and server are to use.

Type:

tuple

property session_id

The session ID.

Type:

int

class msl.equipment.hislip.Data(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 6
class msl.equipment.hislip.DataEnd(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 7
class msl.equipment.hislip.AsyncLock(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 4
class msl.equipment.hislip.AsyncLockResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 5
property error

Whether the request was an invalid attempt to release a lock that was not acquired or to request a lock already granted.

Type:

bool

property failed

Whether a lock was requested but not granted (timeout expired).

Type:

bool

property success

Whether requesting or releasing the lock was successful.

Type:

bool

property shared_released

Whether releasing a shared lock was successful.

Type:

bool

class msl.equipment.hislip.AsyncLockInfo(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 24
class msl.equipment.hislip.AsyncLockInfoResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 25
property exclusive

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

Type:

bool

property num_locks

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

Type:

int

class msl.equipment.hislip.AsyncRemoteLocalControl(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 10
class msl.equipment.hislip.AsyncRemoteLocalResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 11
class msl.equipment.hislip.AsyncDeviceClear(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 19
class msl.equipment.hislip.AsyncDeviceClearAcknowledge(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 23
property feature_bitmap

The feature bitmap that the server prefers.

Type:

int

class msl.equipment.hislip.DeviceClearComplete(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 8
class msl.equipment.hislip.DeviceClearAcknowledge(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 9
class msl.equipment.hislip.Trigger(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 12
class msl.equipment.hislip.AsyncMaximumMessageSize(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 15
class msl.equipment.hislip.AsyncMaximumMessageSizeResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 16
property maximum_message_size

The maximum message size that the server’s synchronous channel accepts.

Type:

int

class msl.equipment.hislip.GetDescriptors(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 26
class msl.equipment.hislip.GetDescriptorsResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 27
class msl.equipment.hislip.AsyncInitialize(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 17
class msl.equipment.hislip.AsyncInitializeResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 18
SECURE_CONNECTION_SUPPORTED = 1
property secure_connection_supported

Whether secure connection capability is supported.

Type:

bool

property server_vendor_id

The two-character vendor abbreviation of the server.

Type:

bytes

class msl.equipment.hislip.AsyncStatusQuery(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 21
class msl.equipment.hislip.AsyncStatusResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 22
property status

The status value.

Type:

int

class msl.equipment.hislip.StartTLS(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 28
class msl.equipment.hislip.AsyncStartTLS(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 29
class msl.equipment.hislip.AsyncStartTLSResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 30
property busy

Whether the server is busy.

Type:

bool

property success

Whether the request was successful.

Type:

bool

property error

Whether there was an error processing the request.

Type:

bool

class msl.equipment.hislip.EndTLS(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 31
class msl.equipment.hislip.AsyncEndTLS(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 32
class msl.equipment.hislip.AsyncEndTLSResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 33
property busy

Whether the server is busy.

Type:

bool

property success

Whether the request was successful.

Type:

bool

property error

Whether there was an error processing the request.

Type:

bool

class msl.equipment.hislip.GetSaslMechanismList(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 34
class msl.equipment.hislip.GetSaslMechanismListResponse(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 35
property data

List of SASL mechanisms.

Type:

list

class msl.equipment.hislip.AuthenticationStart(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 36
class msl.equipment.hislip.AuthenticationExchange(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 37
class msl.equipment.hislip.AuthenticationResult(control_code=0, parameter=0, payload=b'')[source]

Bases: Message

Create a new HiSLIP message.

Parameters:
  • control_code (int, optional) – This 8-bit field is a general parameter for the message. If the field is not defined for a message, 0 shall be sent.

  • parameter (int, optional) – This 32-bit field has various uses in different messages. If this field is not defined for a message, 0 shall be sent.

  • payload (bytes, optional) – The payload data.

type = 38
property data

Additional data returned by the server.

Type:

bytes

property error

Whether there was an error processing the request.

Type:

bool

property error_code

If authentication fails, the mechanism-dependent error code.

Type:

int

property success

Whether the request was successful.

Type:

bool

class msl.equipment.hislip.HiSLIPClient(host)[source]

Bases: object

Base class for a HiSLIP client.

Parameters:

host (str) – The hostname or IP address of the remote device.

close()[source]

Close the TCP socket, if one is open.

connect(port=4880, timeout=10)[source]

Connect to a specific port of the device.

Parameters:
  • port (int) – The port number to connect to.

  • timeout (float or None, optional) – The maximum number of seconds to wait for the connection to be established.

get_descriptors()[source]

Descriptors were added in HiSLIP version 2.0 to provide extra information about specific server capabilities.

Returns:

GetDescriptorsResponse – The response.

property maximum_server_message_size

The maximum message size that the server accepts.

Type:

int

read(message, chunk_size=4096)[source]

Read a message from the server.

Parameters:
  • message (Message) – An instance of the type of message to read.

  • chunk_size (int, optional) – The maximum number of bytes to receive at a time.

Returns:

Message – The message that was passed in, but with its attributes updated with the information from the received data.

get_timeout()[source]

Get the socket timeout value.

Returns:

float or None – The timeout, in seconds, of the socket.

set_timeout(timeout)[source]

Set the socket timeout value.

Parameters:

timeout (float or None) – The timeout, in seconds, to use for the socket.

property socket

The reference to the socket.

Type:

socket

write(message)[source]

Write a message to the server.

Parameters:

message (Message) – The message to write.

class msl.equipment.hislip.SyncClient(host)[source]

Bases: HiSLIPClient

A synchronous connection to the HiSLIP server.

Parameters:

host (str) – The hostname or IP address of the remote device.

device_clear_complete(feature_bitmap)[source]

Send the device-clear complete message.

Also resets the message id.

Parameters:

feature_bitmap (int) – The feature bitmap of the server (i.e., AsyncDeviceClearAcknowledge.feature_bitmap).

Returns:

DeviceClearAcknowledge – The response.

initialize(major=1, minor=0, client_id=b'XX', sub_address=b'')[source]

Initialize the synchronous connection.

Parameters:
  • major (int, optional) – The major version number of the HiSLIP protocol that the client supports.

  • minor (int, optional) – The minor version number of the HiSLIP protocol that the client supports.

  • client_id (bytes, optional) – The vendor ID of the client. Must have a length of 2 characters.

  • sub_address (bytes, optional) – A particular device managed by this server. For VISA clients this field corresponds to the VISA LAN device name (default is hislip0). The maximum length is 256 characters.

Returns:

InitializeResponse – The response.

property message_id

The id of the most-recent message that has completed.

Type:

int

property message_id_received

The id of most-recent message that has been received from the server.

Type:

int

receive(size=None, max_size=None, chunk_size=4096)[source]

Receive data.

Parameters:
  • size (int, optional) – The number of bytes to read. If not specified, then read until a Response Message Terminator (RMT) is detected.

  • max_size (int, optional) – The maximum number of bytes that can be read. If not specified, then there is no limit.

  • chunk_size (int, optional) – The maximum number of bytes to receive at a time.

Returns:

bytearray – The received data.

property rmt

int The current state of the Response Message Terminator (RMT).

send(data)[source]

Send data with the Response Message Terminator (RMT) character.

Parameters:

data (bytes) – The data to send.

Returns:

int – The number of bytes sent.

trigger()[source]

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

start_tls()[source]

Send the StartTLS message.

end_tls()[source]

Send the EndTLS message.

get_sasl_mechanism_list()[source]

Request the list of SASL mechanisms from the server.

Returns:

GetSaslMechanismListResponse – The response.

authentication_start(mechanism)[source]

Send a SASL authentication method to the server.

Parameters:

mechanism (bytes) – The selected mechanism to use for authentication.

write_authentication_exchange(data)[source]

Send exchange data during the authentication transaction.

Parameters:

data (bytes) – The data to send.

read_authentication_exchange()[source]

Receive exchange data during the authentication transaction.

Returns:

AuthenticationExchange – The exchange.

authentication_result()[source]

Receive an authentication result from the server.

Returns:

AuthenticationResult – The result.

class msl.equipment.hislip.AsyncClient(host)[source]

Bases: HiSLIPClient

An asynchronous connection to the HiSLIP server.

Parameters:

host (str) – The hostname or IP address of the remote device.

async_initialize(session_id)[source]

Initialize the asynchronous connection.

Parameters:

session_id (int) – The session ID.

Returns:

AsyncInitializeResponse – The response.

async_maximum_message_size(size)[source]

Exchange the maximum message sizes that are accepted between the client and server.

Parameters:

size (int) – The maximum message size that the client accepts.

Returns:

AsyncMaximumMessageSizeResponse – The maximum message size that the server accepts.

async_lock_request(timeout=None, lock_string='')[source]

Request a lock.

Parameters:
  • timeout (float, optional) – The number of seconds to wait to acquire a lock. A timeout of 0 indicates that the HiSLIP server should only grant the lock if it is available immediately.

  • 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. The maximum length is 256 characters.

Returns:

AsyncLockResponse – The response.

async_lock_release(message_id)[source]

Release a lock.

Parameters:

message_id (int) – The most recent message id that was completed on the synchronous channel (i.e., SyncClient.message_id).

Returns:

AsyncLockResponse – The response.

async_lock_info()[source]

Request the lock status from the HiSLIP server.

Returns:

AsyncLockInfoResponse – The response.

async_remote_local_control(request, message_id)[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

  • message_id (int) – The most recent message id that was completed on the synchronous channel (i.e., SyncClient.message_id).

Returns:

AsyncRemoteLocalResponse – The response.

async_device_clear()[source]

Send the device clear request.

Returns:

AsyncDeviceClearAcknowledge – The response.

async_status_query(synchronous)[source]

Status query transaction.

The status query provides an 8-bit status response from the server that corresponds to the VISA viReadSTB operation.

Parameters:

synchronous (SyncClient) – The synchronous client that corresponds with this asynchronous client.

Returns:

AsyncStatusResponse – The response.

async_start_tls(synchronous)[source]

Initiate the secure connection transaction.

Parameters:

synchronous (SyncClient) – The synchronous client that corresponds with this asynchronous client.

Returns:

AsyncStartTLSResponse – The response.

async_end_tls(synchronous)[source]

Initiate the end of the secure connection transaction.

Parameters:

synchronous (SyncClient) – The synchronous client that corresponds with this asynchronous client.

Returns:

AsyncEndTLSResponse – The response.