Skip to content

Commit

Permalink
add: Trimble EVT message (TNLEVT) (#165)
Browse files Browse the repository at this point in the history
* add: Trimble EVT message (TNLEVT)

* fix: during first leap seconds of the day UTC date can be wrong

* fix: remove presumptious fix and datestamp derivative
  • Loading branch information
kamiccolo committed Mar 30, 2024
1 parent 8a870af commit 2f1a9d9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pynmea2/types/proprietary/tnl.py
Expand Up @@ -181,3 +181,32 @@ class TNLPJT(TNL):
('Coordinate System', 'coord_name'),
('Project Name', 'project_name'),
)

class TNLEVT(TNL, DatetimeFix):
"""
Trimble EVT message (used for events like hardware triggers)
0 Talker ID $PTNL
1 Message ID EVT
2 Event time. UTC time of event in format hhmmss.ssssss
3 Port number. Port event markers receiver: "1" or "2" (optional),
if two ports are available.
4 NNNNNN. Incremental number of events on each independent port.
5 WWWW. Week number of event (since 06 January 1980).
6 Day of week. Days denoted 0 = Sunday…6 = Saturday.
7 Leap second. UTC Leap Second offset from GPS time,
8 The checksum data, always begins with *
Example message:
$PTNL,EVT,131007.999785,2,460,2181,5,18*72
"""
fields = (
('Empty', '_'),
('Sentence Type', 'type'),
('Timestamp', 'timestamp', timestamp),
('Port Number', 'port_num', int),
('Event Number', 'event_num', int),
('GPS Week Number', 'gps_week_num', int),
('GPS Day of the Week', 'gps_day_num', int),
('Leap Seconds', 'leap_secs', int)
)
13 changes: 13 additions & 0 deletions test/test_tnl.py
Expand Up @@ -107,3 +107,16 @@ def test_tnlvhd():
assert msg.gps_quality == '3'
assert msg.num_sats == 7
assert msg.pdop == 2.4

def test_tnlevt():
data = '$PTNL,EVT,131007.999785,2,460,2181,5,18*72'
msg = pynmea2.parse(data)
assert type(msg) == pynmea2.tnl.TNLEVT
assert msg.manufacturer == 'TNL'
assert msg.type == 'EVT'
assert msg.timestamp == datetime.time(13, 10, 7, 999785, tzinfo=datetime.timezone.utc)
assert msg.port_num == 2
assert msg.event_num == 460
assert msg.gps_week_num == 2181
assert msg.gps_day_num == 5
assert msg.leap_secs == 18

0 comments on commit 2f1a9d9

Please sign in to comment.