tsip 0.4.1
Python package for parsing and creating TSIP packets
License: BSD License
Keywords: TSIP, Trimble, GPS

.. image:: https://img.shields.io/pypi/v/tsip.svg?style=flat-square
   :target: https://pypi.python.org/pypi/tsip
   :alt: Version

.. image:: https://img.shields.io/github/license/mjuenema/python-TSIP.svg?style=flat-square
   :target: https://opensource.org/licenses/BSD-2-Clause
   :alt: License

.. image:: https://img.shields.io/github/issues/mjuenema/python-TSIP.svg?style=flat-square
   :target: https://github.com/mjuenema/python-TSIP/issues
   :alt: Issues

.. image:: https://img.shields.io/travis/mjuenema/python-TSIP/master.svg?style=flat-square
   :target: https://www.travis-ci.org/mjuenema/python-TSIP/builds
   :alt: Travis-CI


About Python-TSIP
=================

Python-TSIP is a Python package for parsing and creating TSIP packets. The Trimble Standard 
Interface Protocol (TSIP) is the binary protocol spoken by the GPS receivers sold by Trimble Navigation Ltd. 
(http://www.trimble.com).

Python-TSIP is available under the "BSD 2-Clause Simplified License".

I am no longer actively maintaining this project but I am happy to accept merge requests!

Releases up to 0.3.2 supported only Python 2. Any later releases only support Python 3.

Github user **pdaderko** deserves all credit for making this library compatible with Python 3.


Status
======

Almost the full set of TSIP command and report packets understood by the Copernicus II receiver has been implemented but 
so far only some of them have been tested against the actual GPS. Presumably Trimble Thunderbolt and Thunderbolt-E are also 
supported as they appear to implement a subset of the commands/reports of the (newer) Copernicus II receiver. 
I don't have access to any other Trimble products.


Example
=======

The following code shows how to receive the current GPS time from the receiver.

* Command packet 0x21 requests the current GPS time.
* Report packet 0x41 contains the current GPS time. Its fields are accessible by index.

Simple example for Python 3:

.. code-block:: python

   import tsip
   import serial

   # Open serial connection to Trimble receiver
   serial_conn = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
   gps_conn = tsip.GPS(serial_conn)

   # Prepare and send command packet 0x21
   gps_conn.write(tsip.Packet(0x21))

   while True:
       try:
           report = gps_conn.read()
           if report[0] == 0x41: #got response to 0x21
               print(f"GPS time of week .......: {report[1]}")
               print(f"Extended GPS week number: {report[2]}")
               print(f"GPS UTC offset .........: {report[3]}")
               break
           else: #some other packet received, output packet number
               print(f"Received packet: {hex(report[0])}")
       except ValueError:
           pass #ignore failed reads

More examples can be found in the `docs/examples/` folder but they haven't been updated to work with Python 3.




History
=======

0.4.1 (01-Dec-2025)
-------------------

* Python 3 is now supported.
* Python 2 is no longer supported.

0.3.2 (28-Oct-2017)
-------------------

* Added Report Packet 0x58: GPS System Data from the Receiver.
* Fixed Report Packet 0x47: Signals Levels for Tracked Satellites.
* Fixed Report Packet 0x6D: Satellite Selection List.x 
* Added `docs/examples/example2.py` wich provides a more comprehensive
  template program than the example in the README.

0.3.1 (26-Sep-2017)
-------------------

* Fixed README.rst so it renders properly on PyPi.

0.3.0 (26-Sep-2017)
-------------------

* Argument to ``tsip.Packet()`` can now also be a tuple or list 
  (inspired by Criss Swaim).
* Changed development status from alpha to beta.
* Cleaned up lots of code to satisfy flake8.

0.2.0 (03-Dec-2015)
-------------------

* Rewritten from scratch.
* Implements almost complete set of TSIP commands supported by
  Trimble Copernicus II and Thunderbolt/Thunderbolt-E GPS
  receivers.

0.1.0 (20-Jun-2015)
---------------------

* First release on PyPI.