opus_interface
frog.hardware.plugins.spectrometer.opus_interface
¤
Module containing code for sending commands to the OPUS program for the EM27.
Communication is based on a protocol using HTTP and HTML.
The OPUS program must be running on the computer at OPUS_IP for the commands to work. Note that this is a separate machine from the EM27!
Attributes¤
Classes¤
OPUSInterface(host=DEFAULT_OPUS_HOST, port=DEFAULT_OPUS_PORT, polling_interval=DEFAULT_OPUS_POLLING_INTERVAL, timeout=DEFAULT_EM27_HTTP_TIMEOUT)
¤
Bases: HTTPDevice
, OPUSInterfaceBase
Interface for communicating with the OPUS program.
HTTP requests are handled on a background thread.
Create a new OPUSInterface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host
|
str
|
The hostname or IP address on which to make requests |
DEFAULT_OPUS_HOST
|
port
|
int
|
The port on which to make requests |
DEFAULT_OPUS_PORT
|
polling_interval
|
float
|
Minimum polling interval for status |
DEFAULT_OPUS_POLLING_INTERVAL
|
timeout
|
float
|
The maximum time in seconds to wait for a response from the server |
DEFAULT_EM27_HTTP_TIMEOUT
|
Source code in frog/hardware/plugins/spectrometer/opus_interface.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
Functions¤
close()
¤
Close the device.
Source code in frog/hardware/plugins/spectrometer/opus_interface.py
112 113 114 115 |
|
handle_response(response)
¤
Process HTTP response from OPUS.
Source code in frog/hardware/plugins/spectrometer/opus_interface.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
request_command(command)
¤
Request that OPUS run the specified command.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command
|
str
|
Name of command to run |
required |
Source code in frog/hardware/plugins/spectrometer/opus_interface.py
141 142 143 144 145 146 147 |
|
Functions¤
parse_response(response)
¤
Parse OPUS's HTML response.
Source code in frog/hardware/plugins/spectrometer/opus_interface.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|