mpylab.device.communication_debug module

This is the mpylab.device.communication_debug module.

author:

Hans Georg Krauthäuser (main author)

license:

GPLv3 or higher

class mpylab.device.communication_debug.CommunicationDebug(idn, fout=None, fin=None)

Bases: object

CommunicationDebug class.

query(cmd, tmpl=None, send_opc=False)
Parameters:
  • cmdstr, command to send

  • tmplstr, a re pattern for re.match or None

  • send_opcbool, append ; *OPC? to a non-query command

Returns:

str or dict or None: dict with the parsed result

See read function for more explanation regarding the re pattern

read(tmpl=None)
Parameters:

tmplstr, a re pattern for re.match or None

Returns:

str or dict or None: dict with the parsed result or raw result as str or None if no match

write(cmd)
Parameters:

cmdstr, command to send

Returns:

int: status code; number of bytes sent or 0