hvl_ccb.dev.highland_t560.base

Inheritance diagram of hvl_ccb.dev.highland_t560.base

Module containing base device and communication classes and enums.

Communication with device is performed via its ethernet port and a Telnet connection.

class AutoInstallMode(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: ValueEnum

Modes for installing configuration settings to the device.

INSTALL = 1
OFF = 0
QUEUE = 2
class GateMode(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: ValueEnum

Available T560 gate modes

INPUT = 'INP'
OFF = 'OFF'
OUTPUT = 'OUT'
class Polarity(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: ValueEnum

Possible channel polarity states

ACTIVE_HIGH = 'POS'
ACTIVE_LOW = 'NEG'
class T560Communication(configuration)[source]

Bases: SyncCommunicationProtocol, TelnetCommunication

Communication class for T560. It uses a TelnetCommunication with the SyncCommunicationProtocol

static config_cls()[source]

Return the default configdataclass class.

Returns:

a reference to the default configdataclass class

query(command: str, n_attempts_max: int | None = None, attempt_interval_sec: int | float | None = None) str[source]

Send a command to the device and handle the response.

For device setting queries, response will be ‘OK’ if successful, or ‘??’ if setting cannot be carried out, raising an error.

Parameters:
  • command – Command string to be sent

  • 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

Raises:

T560Error – if no response is received, or if the device responds with an error message.

Returns:

Response from the device.

class T560CommunicationConfig(terminator: bytes = b'\r', 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 | NoneType = None, port: int = 2000, timeout: int | float = 0.2)[source]

Bases: SyncCommunicationProtocolConfig, TelnetCommunicationConfig

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

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.

port: int = 2000

Port at which the host is listening

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.

terminator: bytes = b'\r'

The terminator character. Typically this is b'\r\n' or b'\n', but can also be b'\r' or other combinations. This defines the end of a single line.

exception T560Error[source]

Bases: DeviceError

T560 related errors.

class TriggerMode(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: ValueEnum

Available T560 trigger modes

COMMAND = 'REM'
EXT_FALLING_EDGE = 'NEG'
EXT_RISING_EDGE = 'POS'
INT_SYNTHESIZER = 'SYN'
OFF = 'OFF'