Skip to content

Commit f6f7eb3

Browse files
authored
Merge pull request #6 from semuconsulting/RC-1.0.3
Rc 1.0.3
2 parents 90fd271 + f2470fc commit f6f7eb3

File tree

8 files changed

+47
-23
lines changed

8 files changed

+47
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ with UBXSimulator(
108108
print(parsed)
109109
```
110110

111-
Generates mock acknowledgements (ACK-ACK) for valid incoming UBX commands and polls.
111+
Generates mock acknowledgements (ACK-ACK) for valid incoming UBX or TTY (AT+) commands and polls.
112112

113113
See sample [ubxsimulator.json](https://github.com/semuconsulting/pyubxutils/blob/main/examples/ubxsimulator.json) configuration file in the \examples folder, and the [Sphinx API documentation](https://www.semuconsulting.com/pyubxutils/pyubxutils.html#module-pyubxutils.ubxsimulator).
114114

RELEASE_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# pyubxutils Release Notes
22

3+
### RELEASE 1.0.3
4+
5+
ENHANCEMENTS:
6+
7+
1. UBXSimulator now supports limited TTY (AT+) commands. `AT+ECHO=OK` and `AT+ECHO=Error` commands will simulate an `OK` or `Error` TTY response. An `AT+ECHO=xxxxxx` command will echo back the `xxxxxx` string.
8+
39
### RELEASE 1.0.2
410

511
FIXES:

docs/pyubxutils.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,85 +9,85 @@ pyubxutils.exceptions module
99

1010
.. automodule:: pyubxutils.exceptions
1111
:members:
12-
:undoc-members:
1312
:show-inheritance:
13+
:undoc-members:
1414

1515
pyubxutils.globals module
1616
-------------------------
1717

1818
.. automodule:: pyubxutils.globals
1919
:members:
20-
:undoc-members:
2120
:show-inheritance:
21+
:undoc-members:
2222

2323
pyubxutils.helpers module
2424
-------------------------
2525

2626
.. automodule:: pyubxutils.helpers
2727
:members:
28-
:undoc-members:
2928
:show-inheritance:
29+
:undoc-members:
3030

3131
pyubxutils.ubxbase module
3232
-------------------------
3333

3434
.. automodule:: pyubxutils.ubxbase
3535
:members:
36-
:undoc-members:
3736
:show-inheritance:
37+
:undoc-members:
3838

3939
pyubxutils.ubxcompare module
4040
----------------------------
4141

4242
.. automodule:: pyubxutils.ubxcompare
4343
:members:
44-
:undoc-members:
4544
:show-inheritance:
45+
:undoc-members:
4646

4747
pyubxutils.ubxload module
4848
-------------------------
4949

5050
.. automodule:: pyubxutils.ubxload
5151
:members:
52-
:undoc-members:
5352
:show-inheritance:
53+
:undoc-members:
5454

5555
pyubxutils.ubxsave module
5656
-------------------------
5757

5858
.. automodule:: pyubxutils.ubxsave
5959
:members:
60-
:undoc-members:
6160
:show-inheritance:
61+
:undoc-members:
6262

6363
pyubxutils.ubxsetrate module
6464
----------------------------
6565

6666
.. automodule:: pyubxutils.ubxsetrate
6767
:members:
68-
:undoc-members:
6968
:show-inheritance:
69+
:undoc-members:
7070

7171
pyubxutils.ubxsimulator module
7272
------------------------------
7373

7474
.. automodule:: pyubxutils.ubxsimulator
7575
:members:
76-
:undoc-members:
7776
:show-inheritance:
77+
:undoc-members:
7878

7979
pyubxutils.ubxsimulator\_cli module
8080
-----------------------------------
8181

8282
.. automodule:: pyubxutils.ubxsimulator_cli
8383
:members:
84-
:undoc-members:
8584
:show-inheritance:
85+
:undoc-members:
8686

8787
Module contents
8888
---------------
8989

9090
.. automodule:: pyubxutils
9191
:members:
92-
:undoc-members:
9392
:show-inheritance:
93+
:undoc-members:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ classifiers = [
2727
"Programming Language :: Python :: 3.11",
2828
"Programming Language :: Python :: 3.12",
2929
"Programming Language :: Python :: 3.13",
30-
"License :: OSI Approved :: BSD License",
3130
"Topic :: Utilities",
3231
"Topic :: Software Development :: Libraries :: Python Modules",
3332
"Topic :: Scientific/Engineering :: GIS",

src/pyubxutils/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
:license: BSD 3-Clause
99
"""
1010

11-
__version__ = "1.0.2"
11+
__version__ = "1.0.3"

src/pyubxutils/globals.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
"""CLI argument parser epilog"""
2323
MINNMEA = "minnmea"
2424
MINUBX = "minubx"
25-
ALLNMEA_CLS = [b"\xF0", b"\xF1"]
26-
MINMMEA_ID = [b"\xF0\x00", b"\xF0\x02", b"\xF0\x03", b"\xF0\x04", b"\xF0\x05"]
25+
ALLNMEA_CLS = [b"\xf0", b"\xf1"]
26+
MINMMEA_ID = [b"\xf0\x00", b"\xf0\x02", b"\xf0\x03", b"\xf0\x04", b"\xf0\x05"]
2727
ALLUBX_CLS = [b"\x01"]
2828
MINUBX_ID = [b"\x01\x04", b"\x01\x07", b"\x01\x35"]
29+
TTY_PROTOCOL = 32
2930

3031
VERBOSITY_CRITICAL = -1
3132
"""Verbosity critical"""

src/pyubxutils/ubxsetrate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
Usage:
99
10-
ubxsetrate --port dev/tty.usbmodem1301 --baudrate 38400 --timeout 5
10+
ubxsetrate --port dev/tty.usbmodem1301 --baudrate 38400 --timeout 5
1111
--msgClass 0xf1 --msgID 0x00 --rate 1 --verbosity 1
1212
1313
or (to turn off all NMEA messages):

src/pyubxutils/ubxsimulator.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
for raw, parsed in ubr:
2020
print(parsed)
2121
22-
Generates mock acknowledgements (ACK-ACK) for valid incoming UBX commands
23-
and polls.
22+
Generates mock acknowledgements (ACK-ACK) for valid incoming UBX or TTY (AT+)
23+
commands and polls.
2424
2525
See sample ubxsimulator.json configuration file in the \\\\examples folder.
2626
2727
NB: Principally intended for testing Python GNSS application functionality.
2828
There is currently no attempt to simulate real-world satellite geodetics,
29-
though this could be done using e.g. the Python `skyfield` library and the
29+
though this could be done using e.g. the Python `skyfield` library and the
3030
relevant satellite TLE (orbital elements) files. I may look into adding
3131
such functionality as and when time permits. Contributions welcome.
3232
@@ -65,7 +65,7 @@
6565
utc2itow,
6666
)
6767

68-
from pyubxutils.globals import EARTH_RADIUS, UBXSIMULATOR
68+
from pyubxutils.globals import EARTH_RADIUS, TTY_PROTOCOL, UBXSIMULATOR
6969

7070
DEFAULT_INTERVAL = 1000 # milliseconds
7171
DEFAULT_TIMEOUT = 3 # seconds
@@ -303,6 +303,17 @@ def _datahandler(self, data: bytes, outq: Queue):
303303
self._do_monver(outq)
304304
if data.identity == "CFG-RATE":
305305
self._do_cfgrate(data, outq)
306+
else:
307+
raw = None
308+
if data == b"AT+ECHO=OK\r\n":
309+
raw = b"\r\nOK\r\n\r\n"
310+
elif data == b"AT+ECHO=ERROR\r\n":
311+
raw = b"\r\nError\r\n\r\n"
312+
elif data[0:8] == b"AT+ECHO=":
313+
raw = data[8:]
314+
if raw is not None:
315+
outq.put(raw)
316+
self.logger.info(f"TTY Response Sent by Simulator: {raw}\n")
306317

307318
def _do_send(self, msg: UBXMessage, outq: Queue):
308319
"""
@@ -434,10 +445,14 @@ def write(self, data: bytes):
434445
"""
435446
Simulated write to receiver.
436447
437-
:param bytes data: UBX data
448+
:param bytes data: UBX or TTY data
438449
"""
439450

440-
prot = protocol(data)
451+
if data[0:3] == b"AT+":
452+
prot = TTY_PROTOCOL
453+
else:
454+
prot = protocol(data)
455+
441456
try:
442457
if prot == RTCM3_PROTOCOL:
443458
rtm = RTCMReader.parse(data)
@@ -448,6 +463,9 @@ def write(self, data: bytes):
448463
ubx = UBXReader.parse(data, msgmode=msgmode)
449464
self._inqueue.put(ubx)
450465
val = ("UBX", ubx)
466+
elif prot == TTY_PROTOCOL:
467+
self._inqueue.put(data)
468+
val = (f"TTY AT+ {prot}", None)
451469
else:
452470
val = (f"Other Protocol {prot}", None)
453471
except (

0 commit comments

Comments
 (0)