dripline.implementations.ethernet_scpi_service module¶
-
class
dripline.implementations.ethernet_scpi_service.
EthernetSCPIService
(socket_timeout=1.0, socket_info='localhost', 1234, cmd_at_reconnect=['*OPC?'], reconnect_test='1', command_terminator='', response_terminator=None, reply_echo_cmd=False, **kwargs)[source]¶ Bases:
_dripline.core.Service
A fairly generic subclass of Service for connecting to ethernet-capable instruments/devices. In is developed for and tested against devices with a SCPI-compliant command set, but may be usable with devices which do not strictly conform. In particular, devices must support sending a response to every command received (either natively, or via SCPI’s command composition) and responses are expected to include a termination marking complete transmission.
- Parameters
socket_timeout (int) – number of seconds to wait for a reply from the device before timeout.
socket_info (tuple or string) – either socket.socket.connect argument tuple, or string that parses into one.
cmd_at_reconnect ([str,..]) – a list of commands to send to the device every time the socket connection is estabilished note that these will be sent on every connection, which may be disruptive to ongoing activity.
reconnect_test (str) – expected return from the last command in the cmd_at_reconnect list, must match exactly or the reconnect is deemed a failure
command_terminator (str) – string to be post-pended to commands, indicating to the device that the transmission is complete (often r, n, or rn - where escaping depends on string types)
response_terminator (str) – string added to the end of a reply from the device, indicates the end of the reply
reply_echo_cmd (bool) – indicates that the device includes the the received command in its reply
-
send_to_device
(commands, **kwargs)[source]¶ Standard device access method to communicate with instrument. NEVER RENAME THIS METHOD!
- commands (list||None): list of command(s) to send to the instrument following (re)connection to the instrument, still must return a reply!
: if impossible, set as None to skip