Skip to content

Commit 924e71b

Browse files
committed
Added TPS1100 AUS
1 parent 9e13232 commit 924e71b

File tree

4 files changed

+228
-0
lines changed

4 files changed

+228
-0
lines changed

docs/api/tps1100/aus.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Automation
2+
==========
3+
4+
.. automodule:: geocompy.tps1000.aus
5+
:inherited-members:
6+
7+
Definitions
8+
-----------

docs/api/tps1100/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ TPS1100
1414
:hidden:
1515

1616
rc
17+
aus
1718
com
1819
csv

src/geocompy/tps1100/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
----------
1717
1818
- ``geocompy.tps1100.rc``
19+
- ``geocompy.tps1100.aus``
1920
- ``geocompy.tps1100.com``
2021
- ``geocompy.tps1100.csv``
2122
"""
@@ -38,6 +39,7 @@
3839
GeoComProtocol,
3940
GeoComResponse
4041
)
42+
from .aus import TPS1100AUS
4143
from .com import TPS1100COM
4244
from .csv import TPS1100CSV
4345
from .rc import TPS1100RC, rpcnames
@@ -120,6 +122,8 @@ def __init__(
120122
number of retries.
121123
"""
122124
super().__init__(connection, logger)
125+
self.aus: TPS1100AUS = TPS1100AUS(self)
126+
"""Alt User subsystem."""
123127
self.com: TPS1100COM = TPS1100COM(self)
124128
"""Communications subsystem."""
125129
self.csv: TPS1100CSV = TPS1100CSV(self)

src/geocompy/tps1100/aus.py

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
"""
2+
Description
3+
===========
4+
5+
Module: ``geocompy.tps1100.aus``
6+
7+
Definitions for the TPS1100 Alt user subsystem.
8+
9+
Types
10+
-----
11+
12+
- ``TPS1100AUS``
13+
14+
"""
15+
from __future__ import annotations
16+
17+
from enum import Enum
18+
19+
from ..data import (
20+
toenum,
21+
enumparser
22+
)
23+
from ..protocols import (
24+
GeoComSubsystem,
25+
GeoComResponse
26+
)
27+
28+
29+
class TPS1100AUS(GeoComSubsystem):
30+
"""
31+
Alt user subsystem of the TPS1100 GeoCom protocol.
32+
33+
.. versionadded:: GeoCom-1.04
34+
35+
This subsystem can be used to set and query the ATR and LOCK
36+
automation modes.
37+
38+
"""
39+
class ONOFF(Enum):
40+
OFF = 0
41+
ON = 1
42+
43+
def get_user_atr_state(self) -> GeoComResponse[ONOFF]:
44+
"""
45+
RPC 18006, ``AUS_GetUserAtrState``
46+
47+
Gets the current state of the ATR mode.
48+
49+
Returns
50+
-------
51+
GeoComResponse
52+
Params:
53+
- `ONOFF`: current ATR state
54+
55+
Error codes:
56+
- ``NOT_IMPL``: ATR is not available.
57+
58+
Notes
59+
-----
60+
This command does not indicate if the ATR has acquired a prism.
61+
62+
See Also
63+
--------
64+
set_user_atr_state
65+
"""
66+
return self._request(
67+
18006,
68+
parsers=enumparser(self.ONOFF)
69+
)
70+
71+
def set_user_atr_state(
72+
self,
73+
state: ONOFF | str
74+
) -> GeoComResponse[None]:
75+
"""
76+
RPC 18005, ``AUS_SetUserAtrState``
77+
78+
Activates or deactivates the ATR mode.
79+
80+
Parameters
81+
----------
82+
state : ONOFF | str
83+
ATR state to set
84+
85+
Returns
86+
-------
87+
GeoComResponse
88+
Error codes:
89+
- ``NOT_IMPL``: ATR is not available.
90+
91+
Notes
92+
-----
93+
If LOCK mode is active when the ATR is activated, then LOCK mode
94+
changes to ATR mode.
95+
96+
If the ATR is deactivated, the LOCK mode does not change.
97+
98+
See Also
99+
--------
100+
get_user_atr_state
101+
get_user_lock_state
102+
set_user_lock_state
103+
"""
104+
_state = toenum(self.ONOFF, state)
105+
return self._request(18005, [_state.value])
106+
107+
def get_user_lock_state(self) -> GeoComResponse[ONOFF]:
108+
"""
109+
RPC 18005, ``AUS_GetUserLockState``
110+
111+
Gets the current state of the LOCK mode.
112+
113+
Returns
114+
-------
115+
GeoComResponse
116+
Params:
117+
- `ONOFF`: current ATR state
118+
119+
Error codes:
120+
- ``NOT_IMPL``: ATR is not available.
121+
122+
See Also
123+
--------
124+
set_user_lock_state
125+
mot.read_lock_status
126+
"""
127+
return self._request(
128+
18008,
129+
parsers=enumparser(self.ONOFF)
130+
)
131+
132+
def set_user_lock_state(
133+
self,
134+
state: ONOFF | str
135+
) -> GeoComResponse[None]:
136+
"""
137+
RPC 18007, ``AUS_SetUserLockState``
138+
139+
Activates or deactivates the LOCK mode.
140+
141+
Parameters
142+
----------
143+
state : ONOFF | str
144+
LOCK state to set
145+
146+
Returns
147+
-------
148+
GeoComResponse
149+
Error codes:
150+
- ``NOT_IMPL``: ATR is not available.
151+
152+
Notes
153+
-----
154+
Activating the LOCK mode does not mean that the instrument is
155+
automatically locked onto a prism.
156+
157+
See Also
158+
--------
159+
get_user_lock_state
160+
get_user_atr_state
161+
aut.lock_in
162+
"""
163+
_state = toenum(self.ONOFF, state)
164+
return self._request(
165+
18007,
166+
[_state.value]
167+
)
168+
169+
def get_rcs_search_switch(self) -> GeoComResponse[ONOFF]:
170+
"""
171+
RPC 18010, ``AUS_GetRcsSearchSwitch``
172+
173+
Gets the current state of the RCS search mode.
174+
175+
Returns
176+
-------
177+
GeoComResponse
178+
Params:
179+
- `ONOFF`: Current RCS state.
180+
181+
Error codes:
182+
- ``NOT_IMPL``: ATR is not available.
183+
184+
"""
185+
return self._request(
186+
18008,
187+
parsers=enumparser(self.ONOFF)
188+
)
189+
190+
def switch_rcs_search(
191+
self,
192+
state: ONOFF | str
193+
) -> GeoComResponse[None]:
194+
"""
195+
RPC 18009, ``AUS_SwitchRcsSearch``
196+
197+
Enables or disables the RCS searching mode.
198+
199+
Parameters
200+
----------
201+
state : ONOFF | str
202+
New state of the RCS search mode.
203+
204+
Returns
205+
-------
206+
GeoComResponse
207+
Error codes:
208+
- ``NOT_IMPL``: ATR is not available.
209+
210+
"""
211+
_state = toenum(self.ONOFF, state)
212+
return self._request(
213+
18009,
214+
[_state.value]
215+
)

0 commit comments

Comments
 (0)