Features

This section describes all features that are shipped with this package.

Scenario Features

class balderhub.scpi.lib.scenario_features.ScpiTransmissionFeature(**kwargs)

Bases: Feature

Base feature that is used to transmit SCPI commands.

exception ConnectionError

Bases: Exception

exception for everything regarding the connection

exception NoResponseError

Bases: Exception

exception when no response is sent, but a response was expected.

connect(*args, **kwargs)

Connects a SCPI compatible device.

The method raises an ScpiTransmissionFeature.ConnectionError if the connection fails.

disconnect(*args, **kwargs)

Disconnects the previously connected SCPI device.

query_values(command: bytes, *args, **kwargs) bytes

Queries the SCPI command and returns the results of the SCPI command.

The method raises an ScpiTransmissionFeature.NoResponseError when the device does not respond.

Parameters:

command – the bytes that should be transmitted

Returns:

the response of the SCPI command

write_values(command: bytes, *args, **kwargs) None

Transmits a SCPI command.

Parameters:

command – the command to transmit

Setup Features

class balderhub.scpi.lib.setup_features.SocketScpiFeature(**kwargs)

Bases: ScpiTransmissionFeature

transmission feature that uses a native socket for sending SCPI commands

connect(*args, **kwargs)

Connects a SCPI compatible device.

The method raises an ScpiTransmissionFeature.ConnectionError if the connection fails.

disconnect(*args, **kwargs)

Disconnects the previously connected SCPI device.

property ip_address: str
Returns:

returns the IP address of the device to connect to

property port_number: int
Returns:

returns the port number of the device to connect to

query_values(command: bytes, *args, **kwargs) bytes

Queries the SCPI command and returns the results of the SCPI command.

The method raises an ScpiTransmissionFeature.NoResponseError when the device does not respond.

Parameters:

command – the bytes that should be transmitted

Returns:

the response of the SCPI command

property receive_buffer_size: int
Returns:

specifies the receive buffer the socket should use

property receive_timeout: float
Returns:

specifies the receive-timeout the socket should use

write_values(command: bytes, *args, **kwargs) bytes

Transmits a SCPI command.

Parameters:

command – the command to transmit