dragonfly.implementations.ethernet_provider module

Some template vars

Members: EthernetProvider Functions: Classes:

All communication with instruments is performed via ethernet, or via an intermediate interface that inherits from EthernetProvider. This class must be kept general, with specific cases handled in higher-level interfaces.

General rules to observe: - All instruments should communicate with a response_terminator (typically

and/or

, possibly an additional prompt) - All endpoints and communication must be configured to return a response, otherwise nasty timeouts will be incurred

Every instrument config file (hardware repo) must specify: - socket_info, command_terminator, response_terminator Optional config options: - socket timeout : if long timeouts expected (undesirable) - cmd_at_reconnect : if instrument response buffer needs clearing or special configuration - reply_echo_cmd : if instrument response contains the query (see glenlivet) - bare_response_terminator : special response terminator (undesirable)

Summary

class dragonfly.implementations.ethernet_provider.EthernetProvider(socket_timeout=1.0, socket_info=('localhost', 1234), cmd_at_reconnect=['*OPC?'], reconnect_test='1', command_terminator='', response_terminator=None, bare_response_terminator=None, reply_echo_cmd=False, **kwargs)

Bases: dragonfly.implementations.ethernet_provider.EthernetProvider

Keyword Arguments:
 
  • Connection-related options (>) –
  • socket_timeout (float) – time in seconds for the socket to timeout
  • socket_info (tuple) – (<network_address_as_str>, <port_as_int>)
  • cmd_at_reconnect (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
  • reconnect_test (str) – expected return value from final reconnect command
  • Query-related options (>) –
  • command_terminator (str) – string to append to commands
  • response_terminator (str||None) – string to strip from responses, this MUST exist for get method to function properly!
  • bare_response_terminator (str||None) – abbreviated string to strip from responses containing only prompt : only used to handle non-standard lockin behavior
  • reply_echo_cmd (bool) – set to True if command+command_terminator or just command are present in reply
  • name (str) – unique identifier across all dripline services (used to determine routing key)
  • calibration (str||dict) – string use to process raw get result (with .format(raw)) or a dict to use for the same purpose where raw must be a key
  • get_on_set (bool) – flag to toggle running ‘on_get’ after each ‘on_set’

> Connection-related options: socket_timeout (float): time in seconds for the socket to timeout socket_info (tuple): (<network_address_as_str>, <port_as_int>) cmd_at_reconnect (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

reconnect_test (str): expected return value from final reconnect command > Query-related options: command_terminator (str): string to append to commands response_terminator (str||None): string to strip from responses, this MUST exist for get method to function properly! bare_response_terminator (str||None): abbreviated string to strip from responses containing only prompt

: only used to handle non-standard lockin behavior

reply_echo_cmd (bool): set to True if command+command_terminator or just command are present in reply

add_endpoint(endpoint)
cmd(target, method_name, value=[], payload={}, lockout_key=False, timeout=None, ignore_retcode=False)
endpoint(endpoint)
endpoint_names
endpoints
get(target, timeout=None, ignore_retcode=False)
handle_request(channel, method, properties, request)
is_locked
list_endpoints()
lock(*args, **kwargs)
lockout_key
logging_status
on_cmd(*args, **kwargs)

WARNING! if you override this method, you must ensure you deal with lockout properly

on_config(attribute, value=None)

configure a property again

WARNING! if you override this method, you must ensure you deal with lockout properly

on_send(*commands)
on_set(*args, **kwargs)
ping(*args, **kwargs)

ignore all details and respond with an empty message

schedule_status
send(commands, **kwargs)

Standard provider 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
set(target, value, lockout_key=False, timeout=None, ignore_retcode=False)
set_condition(*args, **kwargs)

To actually do something inside a class, the set_condition should be implemented in the class itself.

unlock(*args, **kwargs)

End of modules condition

Data:

End of data condition