The main API to control the station is through the `Tango Controls https://tango-controls.readthedocs.io/en/latest/` API we expose on port 10000, which is most easily accessed using a `PyTango https://pytango.readthedocs.io/en/stable/client_api/index.html` client.
The main API to control the station is through the `Tango Controls https://tango-controls.readthedocs.io/en/latest/` API we expose on port 10000, which is most easily accessed using a `PyTango https://pytango.readthedocs.io/en/stable/client_api/index.html` client.
...
@@ -18,7 +18,6 @@ For example, you can start a new *Station Control* notebook (File->New Notebook-
...
@@ -18,7 +18,6 @@ For example, you can start a new *Station Control* notebook (File->New Notebook-
.. image:: jupyter_basic_example.png
.. image:: jupyter_basic_example.png
Python
Python
------------------------
------------------------
...
@@ -61,3 +60,19 @@ To obtain a list of all devices, we need to access the database::
...
@@ -61,3 +60,19 @@ To obtain a list of all devices, we need to access the database::
# Print the device's state.
# Print the device's state.
print(any_device.state())
print(any_device.state())
ReST API
------------------------
We also provide a ReST API to allow the station to be controlled without needing to use the Tango API. The root access point is http://localhost:8080/tango/rest/v10/hosts/databaseds;port=10000/ (credentials: tango-cs/tango). This API allows for:
- getting and setting attribute values,
- calling commands,
- retrieving the device state,
- and more.
For example, retrieving http://localhost:8080/tango/rest/v10/hosts/databaseds;port=10000/devices/LTS/SDP/1/state returns the following JSON document::
{"state":"ON","status":"The device is in ON state."}
For a full description of this API, see https://tango-rest-api.readthedocs.io/en/latest/.
Each device exposes a list of monitoring points as attributes with the `_R` prefix. These can be accessed interactively from a controle console (such as Jupyter), but that will not scale.
Each device exposes a list of monitoring points as attributes with the `_R` prefix. These can be accessed interactively from a controle console (such as Jupyter), but that will not scale.