net.py: typo fix + catch the right exception
[breadcrumb.git] / code / breadcrumb / client / consts.py
blob9a2a61bb1458dbc4a4dd9640f7c7ecb32725bea2
1 # -*- coding: utf8 -*-
2 """ Useful constants for Breadcrumb client-side programs.
4 Sentence offsets for parsing sentence strings
5 See http://www.gpsinformation.org/dale/nmea.htm for an explanation on all sorts
6 of NMEA sentences, not anywhere near limited to those used in this application.
8 SENTENCE_OFFSETS: The keys can be a bit terse, so here's the explanation:
9 - lat_fl, lon_fl: floating point values for lat, lon (pretty raw)
10 - lat_ns, lon_ew: hemisphere (north/south for lat, east/west for lon)
11 - time: self-explanatory
12 - velocity, velocity_kt: velocity in m/s, knots
13 - heading: true heading
14 - m_var: magnetic variation
15 - m_var_dir: direction of magnetic variation, set(['E', 'W'])
16 """
18 DEFAULT_THRESHOLDS = ( # Push a new point when...
19 ('heading', 15), # ... we turn 15 degrees or more,
20 ('distance', 500), # ... or we travel 500 meters or more,
21 ('timestamp', 1200), # ... or twenty minutes pass (heartbeat).
24 SENTENCE_OFFSETS = {
25 'GGA': {
26 'time': 1,
27 'lat_fl': 2,
28 'lat_ns': 3,
29 'lon_fl': 4,
30 'lon_ew': 5,
33 'GGL': {
34 'time': 5,
35 'lat_fl': 1,
36 'lat_ns': 2,
37 'lon_fl': 3,
38 'lon_ew': 4,
41 'RMC': {
42 'time': 1,
43 'lat_fl': 3,
44 'lat_ns': 4,
45 'lon_fl': 5,
46 'lon_ew': 6,
48 'valid_rmc': 2,
49 'velocity_kt': 7,
50 'heading': 8,
51 'm_var': 9,
52 'm_var_dir': 10,