File: grm.py

package info (click to toggle)
python-nmea2 1.19.0-3
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 420 kB
  • sloc: python: 2,948; makefile: 3
file content (76 lines) | stat: -rw-r--r-- 2,236 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Garmin

from decimal import Decimal

from ... import nmea

class GRM(nmea.ProprietarySentence):
    sentence_types = {}

    def __new__(_cls, manufacturer, data):
        name = manufacturer + data[0]
        cls = _cls.sentence_types.get(name, _cls)
        return super(GRM, cls).__new__(cls)

    def __init__(self, manufacturer, data):
        self.sentence_type = manufacturer + data[0]
        super(GRM, self).__init__(manufacturer, data)


class GRME(GRM):
    """ GARMIN Estimated position error
    """
    fields = (
        ("Subtype", "subtype"),
        ("Estimated Horiz. Position Error", "hpe", Decimal),
        ("Estimated Horiz. Position Error Unit (M)", "hpe_unit"),
        ("Estimated Vert. Position Error", "vpe", Decimal),
        ("Estimated Vert. Position Error Unit (M)", "vpe_unit"),
        ("Estimated Horiz. Position Error", "osepe", Decimal),
        ("Overall Spherical Equiv. Position Error", "osepe_unit"),
    )


class GRMM(GRM):
    """ GARMIN Map Datum
    """
    fields = (
        ("Subtype", "subtype"),
        ('Currently Active Datum', 'datum'),
    )


class GRMW(GRM):
    """ GARMIN Waypoint Information

    https://www8.garmin.com/support/pdf/NMEA_0183.pdf
    https://github.com/wb2osz/direwolf/blob/master/waypoint.c

    $PGRMW,wname,alt,symbol,comment*99
    Where,
       wname		is waypoint name.  Must match existing waypoint.
       alt		is altitude in meters.
       symbol		is symbol code.  Hexadecimal up to FFFF.
                    See Garmin Device Interface Specification
                    001-0063-00 for values of "symbol_type."
       comment      is comment for the waypoint.
       *99		    is checksum
    """
    fields = (
        ("Subtype", "subtype"),
        ("Waypoint Name", "wname"),
        ("Altitude", "altitude", Decimal),
        ("Symbol", "symbol"),
        ("Comment", "comment"),
    )


class GRMZ(GRM):
    """ GARMIN Altitude Information
    """
    fields = (
        ("Subtype", "subtype"),
        ("Altitude", "altitude", Decimal),
        ("Altitude Units (Feet)", "altitude_unit"),
        ("Positional Fix Dimension (2=user, 3=GPS)", "pos_fix_dim"),
    )