lewis.examples.simple_device

Members

VerySimpleDevice

VerySimpleInterface

A very simple device with TCP-stream interface

class lewis.examples.simple_device.VerySimpleDevice[source]

Bases: Device

class lewis.examples.simple_device.VerySimpleInterface[source]

Bases: StreamInterface

A very simple device with TCP-stream interface

The device has only one parameter, which can be set to an arbitrary value. The interface consists of five commands which can be invoked via telnet. To connect:

$ telnet host port

After that, typing either of the commands and pressing enter sends them to the server.

The commands are:

  • V: Returns the parameter as part of a verbose message.

  • V=something: Sets the parameter to something.

  • P: Returns the device parameter unmodified.

  • P=something: Exactly the same as V=something.

  • R or r: Returns the number 4.

get_param()[source]

Returns the device parameter.

handle_error(request, error)[source]

Override this method to handle exceptions that are raised during command processing. The default implementation does nothing, so that any errors are silently ignored.

Parameters:
  • request – The request that resulted in the error.

  • error – The exception that was raised.

set_param(new_param) None[source]

Set the device parameter, does not return anything.