📄 garmin.py
字号:
self.cmnt = cmnt # comment (must be upper case) self.unused = 0L self.dst = dst # proximity distance (m) self.smbl = smbl # symbol_type id self.dspl = dspl # D107 display option self.color = color def __repr__(self): return "<Waypoint %s (%3.5f, %3.5f) (at %x)>" % (self.ident, degrees(self.slat), degrees(self.slon), id(self)) def __str__(self): return "%s (%3.5f, %3.5f)" % (self.ident, degrees(self.slat), degrees(self.slon)) def getDict(self): self.data = {'name': self.ident, 'comment': stripnull(self.cmnt), 'latitude': self.slat, 'longitude': self.slon, 'distance': self.dst, 'symbol': self.smbl, 'display': self.dspl, 'color': self.color } return self.dataclass D108(Waypoint): parts = ("wpt_class", "color", "dspl", "attr", "smbl", "subclass", "slat", "slon", "alt", "dpth", "dist", "state", "cc", "ident", "cmnt", "facility", "city", "addr", "cross_road") fmt = "<b b b b h 18s l l f f f 2s 2s s s s s s s" wpt_class = 0 color = 0 dspl = 0 attr = 0x60 smbl = 0 subclass = "" alt = 1.0e25 dpth = 1.0e25 dist = 0.0 state = "" cc = "" facility = "" city = "" addr = "" cross_road = "" def __init__(self, ident="", slat=0L, slon=0L, alt=1.0e25, dpth=1.0e25, cmnt="", subclass="", wpt_class=0L, lnk_ident="", smbl=18L): self.ident = ident # text identidier (upper case) self.slat = slat # lat & long in semicircle terms self.slon = slon self.wpt_class = wpt_class self.unused = 0L self.subclass = subclass self.lnk_ident = lnk_ident self.smbl = smbl self.cmnt = cmnt def __repr__(self): return "<Waypoint %s (%3.5f, %3.5f) (at %x)>" % (self.ident, degrees(self.slat), degrees(self.slon), id(self)) def __str__(self): return "%s (%3.5f, %3.5f, %3f) '%s' class %d symbl %d" % ( self.ident, degrees(self.slat), degrees(self.slon), self.alt, string.strip(self.cmnt), self.wpt_class, self.smbl)class D150(Waypoint): parts = ("ident", "cc", "clss", "lat", "lon", "alt", "city", "state", "name", "cmnt") fmt = "<6s 2s b l l i 24s 2s 30s 40s" cc = " " clss = 0 alt = 0 city = "" state = "" name = ""class D151(Waypoint): parts = Waypoint.parts + ("dst", "name", "city", "state", "alt", "cc", "unused2", "wpt_class") fmt = "< 6s l l L 40s f 30s 24s 2s i 2s c b" dst = 0.0 name = "" city = "" state = "" alt = 0 cc = "" unused2 = "" wpt_cass = 0class D152(Waypoint): parts = Waypoint.parts + ("dst", "name", "city", "state", "alt", "cc", "unused2", "wpt_class") fmt = "< 6s l l L 40s f 30s 24s 2s i 2s c b" dst = 0.0 name = "" city = "" state = "" alt = 0 cc = "" unused2 = "" wpt_cass = 0class D154(Waypoint): parts = Waypoint.parts + ("dst", "name", "city", "state", "alt", "cc", "unused2", "wpt_class", "smbl") fmt = "< 6s l l L 40s f 30s 24s 2s i 2s c b i" dst = 0.0 name = "" city = "" state = "" alt = 0 cc = "" unused2 = "" wpt_cass = 0 smbl = 0class D155(Waypoint): parts = Waypoint.parts + ("dst", "name", "city", "state", "alt", "cc", "unused2", "wpt_class", "smbl", "dspl") fmt = "< 6s l l L 40s f 30s 24s 2s i 2s c b i b" dst = 0.0 name = "" city = "" state = "" alt = 0 cc = "" unused2 = "" wpt_cass = 0 smbl = 0 dspl = 0# Route headers ---------------------------------------------class RouteHdr(DataPoint): def __repr__(self): return "<RouteHdr (at %s)>" % id(self)class D200(RouteHdr): parts = ("route_num",) fmt = "<b"class D201(RouteHdr): parts = ("route_num", "cmnt") fmt = "<b 20s" cmnt = ""class D202(RouteHdr): parts = ("ident",) fmt="<s"# Route links -----------------------------------------------class RouteLink(DataPoint): def __repr__(self): return "<RouteLink (at %s)" % id(self)class D210(RouteLink): parts = ("clazz", "subclass", "ident") fmt = "<h 18s s"# Track points ----------------------------------------------class TrackPoint(DataPoint): slat = 0L slon = 0L time = 0L # secs since midnight 31/12/89? def __repr__(self): return "<Trackpoint (%3.5f, %3.5f) %s (at %x)>" %\ (degrees(self.slat), degrees(self.slon), time.asctime(time.gmtime(TimeEpoch+self.time)), id(self))class D300(TrackPoint): parts = ("slat", "slon", "time", "newtrk") fmt = "<l l L B" newtrk = 0class D301(TrackPoint): parts = ("slat", "slon", "time", "alt", "depth", "new_trk") fmt = "<l l L f f b" alt = 0.0 depth = 0.0 new_trk = 0# Track headers ----------------------------------------------class TrackHdr(DataPoint): trk_ident = "" def __repr__(self): return "<TrackHdr %s (at %x)>" % (self.trk_ident, id(self)) class D310(TrackHdr): parts = ("dspl", "color", "trk_ident") fmt = "<b b s" dspl = 0 color = 0# Proximity waypoints ---------------------------------------class ProxPoint(DataPoint): dst = 0.0class D400(ProxPoint, D100): parts = D100.parts + ("dst",) fmt = D100.fmt + "f" class D403(ProxPoint, D103): parts = D103.parts + ("dst",) fmt = D103.fmt + "f" class D450(ProxPoint, D150): parts = ("idx",) + D150.parts + ("dst",) fmt = "i" + D150.fmt + "f" idx = 0# Almanacs ---------------------------------------------------class Almanac(DataPoint): passclass D500(Almanac): parts = ("weeknum", "toa", "af0", "af1", "e", "sqrta", "m0", "w", "omg0", "odot", "i") fmt = "<i f f f f f f f f f f"class D501(Almanac): parts = ("weeknum", "toa", "af0", "af1", "e", "sqrta", "m0", "w", "omg0", "odot", "i", "hlth") fmt = "<i f f f f f f f f f f b"class D550(Almanac): parts = ("svid", "weeknum", "toa", "af0", "af1", "e", "sqrta", "m0", "w", "omg0", "odot", "i") fmt = "<c i f f f f f f f f f f"class D551(Almanac): parts = ("svid", "weeknum", "toa", "af0", "af1", "e", "sqrta", "m0", "w", "omg0", "odot", "i", "hlth") fmt = "<c i f f f f f f f f f f b"# Date & Time ---------------------------------------------------class TimePoint(DataPoint): # Not sure what the last four bytes are. Not in docs. # hmm... eTrex just sends 8 bytes, no trailing 4 bytes parts = ("month", "day", "year", "hour", "min", "sec") #,"unknown") fmt = "<b b H h b b" #L" month = 0 # month (1-12) day = 0 # day (1-32) year = 0 # year hour = 0 # hour (0-23) min = 0 # min (0-59) sec = 0 # sec (0-59) def __str__(self): return "%d-%.2d-%.2d %.2d:%.2d:%.2d UTC" % ( self.year, self.month, self.day, self.hour, self.min, self.sec)class D600(TimePoint): pass# Position ---------------------------------------------------class D700(DataPoint): parts = ("rlat", "rlon") fmt = "<d d" rlat = 0.0 # radians rlon = 0.0 # radians# Pvt ---------------------------------------------------------# Live position infoclass D800(DataPoint): parts = ("alt", "epe", "eph", "epv", "fix", "tow", "rlat", "rlon", "east", "north", "up", "msl_height", "leap_secs", "wn_days") fmt = "<f f f f h d d d f f f f h l" def __str__(self): return "tow: %g rlat: %g rlon: %g east: %g north %g" \ % (self.tow, self.rlat, self.rlon, self.east, self.north)# Garmin models ==============================================# For reference, here are some of the product ID numbers used by# different Garmin models. Notice that this is not a one-to-one# mapping in either direction!ModelIDs = ( (52, "GNC 250"), (64, "GNC 250 XL"), (33, "GNC 300"), (98, "GNC 300 XL"), (77, "GPS 12"), (87, "GPS 12"), (96, "GPS 12"), (77, "GPS 12 XL"), (96, "GPS 12 XL"), (106, "GPS 12 XL Chinese"), (105, "GPS 12 XL Japanese"), (47, "GPS 120"), (55, "GPS 120 Chinese"), (74, "GPS 120 XL"), (61, "GPS 125 Sounder"), (95, "GPS 126"), (100, "GPS 126 Chinese"), (95, "GPS 128"), (100, "GPS 128 Chinese"), (20, "GPS 150"), (64, "GPS 150 XL"), (34, "GPS 155"), (98, "GPS 155 XL"), (34, "GPS 165"), (41, "GPS 38"), (56, "GPS 38 Chinese"), (62, "GPS 38 Japanese"), (31, "GPS 40"), (41, "GPS 40"), (56, "GPS 40 Chinese"), (62, "GPS 40 Japanese"), (31, "GPS 45"), (41, "GPS 45"), (56, "GPS 45 Chinese"), (41, "GPS 45 XL"), (96, "GPS 48"), (7, "GPS 50"), (14, "GPS 55"), (15, "GPS 55 AVD"), (18, "GPS 65"), (13, "GPS 75"), (23, "GPS 75"), (42, "GPS 75"), (25, "GPS 85"), (39, "GPS 89"), (45, "GPS 90"), (112, "GPS 92"), (24, "GPS 95"), (35, "GPS 95"), (22, "GPS 95 AVD"), (36, "GPS 95 AVD"), (36, "GPS 95 XL"), (59, "GPS II"), (73, "GPS II Plus"), (97, "GPS II Plus"), (72, "GPS III"), (71, "GPS III Pilot"), (50, "GPSCOM 170"), (53, "GPSCOM 190"), (49, "GPSMAP 130"), (76, "GPSMAP 130 Chinese"), (49, "GPSMAP 135 Sounder"), (49, "GPSMAP 175"), (48, "GPSMAP 195"), (29, "GPSMAP 205"), (44, "GPSMAP 205"), (29, "GPSMAP 210"), (88, "GPSMAP 215"), (29, "GPSMAP 220"), (88, "GPSMAP 225"), (49, "GPSMAP 230"), (76, "GPSMAP 230 Chinese"), (49, "GPSMAP 235 Sounder"))# Make sure you've got a really wide window to view this one!# This describes the protocol capabilities of products that do not# support the Protocol Capabilities Protocol (most of them). Some# models differ in capabilities depending on the software version# installed. So for each ID there is a tuple of entries. Each entry# begins with either None, if it applies to all versions with that ID,# or (minv, maxv), meaning that it applies if the software version# >= minv and < maxv.# All models implement A000, A600 and A700
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -