hvl_ccb.dev.keysightb298xx.comm

Inheritance diagram of hvl_ccb.dev.keysightb298xx.comm

class KeysightB2985AVisaCommunication(configuration)[source]

Bases: VisaCommunication

Specialization of VisaCommunication for the KeysightB2985A Overrides read, write, query and its flavors to have proper communication procedure. Introduction of a output buffer to cache write operations when the device can not receive new commands. Can only be used with a Visa TCPIP-INSTR

MULTI_COMMANDS_MAX = 15

The maximum of commands that can be sent in one round is 5 according to the VISA standard.

static config_cls()[source]

Return the default configdataclass class.

Returns:

a reference to the default configdataclass class

open() None[source]

Open the VISA connection and create the resource.

property output_buffer: list
query(command: str, _n_attempts_max: int | None = None, _attempt_interval_sec: int | float | None = None) str | None[source]

Send a command to the interface and handle the status message. Possibly raises an exception.

Parameters:
  • command – Command to send

  • n_attempts_max – Amount of attempts how often a non-empty text is tried to be read as answer

  • attempt_interval_sec – time between the reading attempts

Returns:

Answer from the interface, which can be None instead of an empty reply

query_multiple(*commands: str, _n_attempts_max: int | None = None, _attempt_interval_sec: int | float | None = None) str | tuple[str, ...][source]
read() str[source]

Read a single line of text as str from the communication.

Returns:

text as str including the terminator, which can also be empty “”

reset() None[source]

Reset the device communication

send_output_buffer() None[source]
write(text: str) None[source]

Specialization of write method to satisfy the KeysightB2985A communication

Parameters:

text – command string to write

write_multiple(*commands: str) None[source]
class KeysightB2985AVisaCommunicationConfig(terminator: bytes = b'\n', encoding: str = 'utf-8', encoding_error_handling: str = 'strict', wait_sec_read_text_nonempty: int | float = 0.5, default_n_attempts_read_text_nonempty: int = 10, host: str | ~ipaddress.IPv4Address | ~ipaddress.IPv6Address = '', interface_type: str | ~hvl_ccb.comm.visa.VisaCommunicationConfig.InterfaceType = <InterfaceType.TCPIP_INSTR: 2>, board: int = 0, port: int = 5025, timeout: int = 5000, chunk_size: int = 204800, open_timeout: int = 1000, visa_backend: str = '')[source]

Bases: VisaCommunicationConfig

Configuration dataclass for VisaCommunication with specifications for the KeysightB2985A device class.

force_value(fieldname, value)

Forces a value to a dataclass field despite the class being frozen.

NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.

Parameters:
  • fieldname – name of the field

  • value – value to assign

interface_type: str | InterfaceType = 2

Interface type of the VISA connection, being one of InterfaceType.

classmethod keys() Sequence[str]

Returns a list of all configdataclass fields key-names.

Returns:

a list of strings containing all keys.

classmethod optional_defaults() dict[str, object]

Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.

Returns:

a list of strings containing all optional keys.

classmethod required_keys() Sequence[str]

Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.

Returns:

a list of strings containing all required keys.

exception KeysightB2985AVisaCommunicationError[source]

Bases: VisaCommunicationError

ready_to_query(func: Callable) Callable[source]
ready_to_read(func: Callable) Callable[source]
ready_to_write(func: Callable) Callable[source]