Skip to content

Commit a4ea834

Browse files
committed
Updated GeoCom protocols to new response codes
1 parent 660ecc6 commit a4ea834

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

src/geocompy/protocols.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __init__(
100100
"""Full, serialized request, that invoked this response."""
101101
self.response: str = response
102102
"""Full, received response."""
103-
self.code: GeoComReturnCode = (
103+
self.error: GeoComReturnCode = (
104104
comcode
105105
if comcode.value == 0
106106
else rpccode
@@ -115,14 +115,14 @@ def __init__(
115115

116116
def __str__(self) -> str:
117117
return (
118-
f"GeoComResponse({self.rpcname}) code: {self.code.name:s}, "
118+
f"GeoComResponse({self.rpcname}) code: {self.error.name:s}, "
119119
f"tr: {self.trans:d}, "
120120
f"params: {self.params}, "
121121
f"(cmd: '{self.cmd}', response: '{self.response}')"
122122
)
123123

124124
def __bool__(self) -> bool:
125-
return bool(self.code)
125+
return bool(self.error)
126126

127127
def map_params(
128128
self,
@@ -151,8 +151,8 @@ def map_params(
151151
self.rpcname,
152152
self.cmd,
153153
self.response,
154-
self.code,
155-
self.code,
154+
self.error,
155+
self.error,
156156
self.trans,
157157
params
158158
)

src/geocompy/tps1000/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def __init__(
174174
try:
175175
self._conn.send("\n")
176176
response = self.com.nullprocess()
177-
if response.comcode and response.rpccode:
177+
if not response.error:
178178
sleep(1)
179179
break
180180
except Exception:
@@ -244,7 +244,7 @@ def set_double_precision(
244244
get_double_precision
245245
"""
246246
response: GeoComResponse[None] = self.request(107, [digits])
247-
if response.comcode and response.rpccode:
247+
if not response.error:
248248
self._precision = digits
249249
return response
250250

@@ -461,7 +461,7 @@ def parse_response(
461461
cmd,
462462
response,
463463
TPS1000RC.COM_CANT_DECODE,
464-
TPS1000RC.UNDEFINED,
464+
TPS1000RC.OK,
465465
0
466466
)
467467

@@ -485,7 +485,7 @@ def parse_response(
485485
cmd,
486486
response,
487487
TPS1000RC.COM_CANT_DECODE,
488-
TPS1000RC.UNDEFINED,
488+
TPS1000RC.OK,
489489
0
490490
)
491491

src/geocompy/tps1100/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def __init__(
180180
try:
181181
self._conn.send("\n")
182182
response = self.com.nullprocess()
183-
if response.comcode and response.rpccode:
183+
if not response.error:
184184
sleep(1)
185185
break
186186
except Exception:
@@ -250,7 +250,7 @@ def set_double_precision(
250250
get_double_precision
251251
"""
252252
response: GeoComResponse[None] = self.request(107, [digits])
253-
if response.comcode and response.rpccode:
253+
if not response.error:
254254
self._precision = digits
255255
return response
256256

@@ -467,7 +467,7 @@ def parse_response(
467467
cmd,
468468
response,
469469
TPS1100RC.COM_CANT_DECODE,
470-
TPS1100RC.UNDEFINED,
470+
TPS1100RC.OK,
471471
0
472472
)
473473

@@ -491,7 +491,7 @@ def parse_response(
491491
cmd,
492492
response,
493493
TPS1100RC.COM_CANT_DECODE,
494-
TPS1100RC.UNDEFINED,
494+
TPS1100RC.OK,
495495
0
496496
)
497497

src/geocompy/tps1200p/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def __init__(
180180
try:
181181
self._conn.send("\n")
182182
response = self.com.nullprocess()
183-
if response.comcode and response.rpccode:
183+
if not response.error:
184184
sleep(1)
185185
break
186186
except Exception:
@@ -250,7 +250,7 @@ def set_double_precision(
250250
get_double_precision
251251
"""
252252
response: GeoComResponse[None] = self.request(107, [digits])
253-
if response.comcode and response.rpccode:
253+
if not response.error:
254254
self._precision = digits
255255
return response
256256

@@ -467,7 +467,7 @@ def parse_response(
467467
cmd,
468468
response,
469469
TPS1200PGRC.COM_CANT_DECODE,
470-
TPS1200PGRC.UNDEFINED,
470+
TPS1200PGRC.OK,
471471
0
472472
)
473473

@@ -491,7 +491,7 @@ def parse_response(
491491
cmd,
492492
response,
493493
TPS1200PGRC.COM_CANT_DECODE,
494-
TPS1200PGRC.UNDEFINED,
494+
TPS1200PGRC.OK,
495495
0
496496
)
497497

src/geocompy/vivatps/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def __init__(
193193
try:
194194
self._conn.send("\n")
195195
response = self.com.nullprocess()
196-
if response.comcode and response.rpccode:
196+
if not response.error:
197197
sleep(1)
198198
break
199199
except Exception:
@@ -265,7 +265,7 @@ def set_double_precision(
265265
266266
"""
267267
response: GeoComResponse[None] = self.request(107, [digits])
268-
if response.comcode and response.rpccode:
268+
if not response.error:
269269
self._precision = digits
270270
return response
271271

@@ -486,7 +486,7 @@ def parse_response(
486486
cmd,
487487
response,
488488
VivaTPSGRC.COM_CANT_DECODE,
489-
VivaTPSGRC.UNDEFINED,
489+
VivaTPSGRC.OK,
490490
0
491491
)
492492

@@ -510,7 +510,7 @@ def parse_response(
510510
cmd,
511511
response,
512512
VivaTPSGRC.COM_CANT_DECODE,
513-
VivaTPSGRC.UNDEFINED,
513+
VivaTPSGRC.OK,
514514
0
515515
)
516516

0 commit comments

Comments
 (0)