Skip to content

Commit 42c1ddd

Browse files
committed
Added GSI Online to intro doc, fixed some issues
1 parent cdcb75c commit 42c1ddd

File tree

2 files changed

+88
-4
lines changed

2 files changed

+88
-4
lines changed

docs/introduction.rst

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ low level serial communication.
3636
conn.close() # Closes the wrapped serial port
3737
3838
.. caution::
39+
:class: warning
3940

4041
It is strongly recommended to set a ``timeout`` on the connection. Without
4142
a ``timeout`` set, the connection may end up in a perpetual waiting state
42-
if the instrument becomes unresponsive.
43+
if the instrument becomes unresponsive. A too small value however might
44+
result in premature timeout issues when using slow commands (e.g.
45+
motorized functions, measurements).
4346

4447
The :class:`~geocompy.communication.SerialConnection` can also be used as a
4548
context manager, that automatically closes the serial port when the context
@@ -115,7 +118,7 @@ connection. The connection is tested during the initialization, and some
115118
communication parameters are syncronized.
116119

117120
.. code-block:: python
118-
:caption: Initializing instrument connection
121+
:caption: Initializing instrument connection with GeoCom
119122
:linenos:
120123
121124
from geocompy.communication import open_serial
@@ -125,11 +128,18 @@ communication parameters are syncronized.
125128
with open_serial("COM1", timeout=10) as conn:
126129
tps = TPS1200P(conn)
127130
131+
.. note::
132+
133+
If the instrument is not turned on when the connection is initiated,
134+
the process will try to wake it up. Since some instruments must be
135+
manually put into GeoCom mode, the initialization might not be successful
136+
from a completely shutdown state.
137+
128138
Once the connection is verified, the commands can be executed through the
129139
various subsystems.
130140

131141
.. code-block:: python
132-
:caption: Querying the system software version through the Central Services
142+
:caption: Querying the system software version through Central Services
133143
:linenos:
134144
135145
resp = tps.csv.get_sw_version()
@@ -148,5 +158,77 @@ GSI Online
148158
^^^^^^^^^^
149159

150160
The GSI Online protocol is a command system that is older than GeoCom. Many
151-
older instruments either only support this system. Some support both (e.g.
161+
older instruments only support this system. Some support both (e.g.
152162
TPS1100 series).
163+
164+
The commands fall into two groups:
165+
166+
- instrument settings (CONF and SET commands)
167+
- measurements (GET and PUT commands)
168+
169+
Instrument settings are set and queried with the ``SET`` and ``CONF`` commands.
170+
The values are communicated with simple enumerations of the valid settings.
171+
172+
.. code-block::
173+
:caption: GSI Online settings exchange example
174+
175+
CONF/30 # Query command
176+
0030/0001 # Response
177+
178+
SET/30/2 # Setting beeping to loud
179+
? # Success confirmation
180+
181+
Measurement related ``PUT`` and ``GET`` commands on the other hand use GSI data
182+
words to exchange the necessary information.
183+
184+
.. code-block::
185+
:caption: GSI Online measurements exchange example
186+
187+
GET/M/WI11 # Query current point ID
188+
11....+000000A1 # Response if format is GSI8
189+
*11....+00000000000000A1 # Response if format is GSI16
190+
191+
PUT/11....+000000A2 # Setting new point ID
192+
? # Success confirmation
193+
194+
The GSI Online based implementations mainly consist of 3 parts. The instrument
195+
object implements the basic request functions. The ``settings`` and the
196+
``measurements`` subsystems provide the individual commands.
197+
198+
The connection to an instrument is identical to the GeoCom versions. The
199+
connection is tested during the initialization, and some communication
200+
parameters are syncronized.
201+
202+
.. code-block:: python
203+
:caption: Initializing instrument connection with GSI Online
204+
:linenos:
205+
206+
from geocompy.communication import open_serial
207+
from geocompy.dna import DNA
208+
209+
210+
with open_serial("COM1", timeout=10) as conn:
211+
level = DNA(conn)
212+
213+
.. note::
214+
215+
If the instrument is not turned on when the connection is initiated,
216+
the process will try to wake it up.
217+
218+
Once the connection is live, the commands can be executed.
219+
220+
.. code-block:: python
221+
:caption: Turning off beeping and getting a staff reading
222+
:linenos:
223+
224+
level.settings.set_beep(level.settings.BEEPINTENSITY.OFF)
225+
resp = level.measurements.get_reading()
226+
print(resp) # GsiOnlineResponse(Reading) success, value: ...
227+
228+
All GSI Online commands return a :class:`~geocompy.protocols.GsiOnlineResponse`
229+
object, that encapsulates command metadata and the result of the request.
230+
231+
.. tip::
232+
233+
The complete list of available commands and their documentations are
234+
available in their respective API documentation categories.

docs/overview.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ GeoComPy is hosted on PyPI, therefore it can be installed with ``pip``.
5757
Package dependencies are automatically handled.
5858

5959
.. code-block:: shell
60+
:caption: Installing from PyPI
6061
6162
pip install geocompy
6263
@@ -70,5 +71,6 @@ Unpack the archive to a suitable place, and enter the ``geocompy-x.y.z``
7071
directory. Build and install the package with the following command:
7172

7273
.. code-block:: shell
74+
:caption: Building and installing locally
7375
7476
python -m pip install .

0 commit comments

Comments
 (0)