summaryrefslogtreecommitdiff
path: root/recipes-navigation/gpsd/gpsd-3.20/0007-add-gll-vtg.patch
blob: 7ae2a7c4a4bcd7bea9762fdbc8015780f943fd09 (plain)
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
From 7ed7a9063a65b16b90ea03465a83cbbd16e3abb4 Mon Sep 17 00:00:00 2001
From: Serhii Voloshynov <serhii.voloshynov@globallogic.com>
Date: Wed, 9 Dec 2020 18:51:48 +0200
Subject: [PATCH] add GLL and VTG to 'gpspipe -r' output in binary mode

---
 pseudonmea.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/pseudonmea.c b/pseudonmea.c
index 444be3d..398511b 100644
--- a/pseudonmea.c
+++ b/pseudonmea.c
@@ -168,6 +168,20 @@ void gpsd_position_fix_dump(struct gps_device_t *session,
          * Differential base station ID */
 	(void)strlcat(bufp, ",", len);
         nmea_add_checksum(bufp);
+        //$GNGGA,103527.00,4957.22994,N,03618.97862,E,1,12,0.89,180.3,M,17.0,M,,*4B
+        //$GNGLL,4957.22997,N,03618.97858,E,103526.00,A,A*7B
+        //we use the same values as in GGA sentence
+        char *bufgll = &bufp[strlen(bufp)];
+        (void)snprintf(bufgll, len,
+                       "$GPGLL,%s,%c,%s,%c,%s,%c,A,",
+                       lat_str,
+                       ((session->gpsdata.fix.latitude > 0) ? 'N' : 'S'),
+                       lon_str,
+                       ((session->gpsdata.fix.longitude > 0) ? 'E' : 'W'),
+                       time_str,
+                       session->gpsdata.status ? 'A' : 'V'
+                       );
+        nmea_add_checksum(bufgll);
     }
 }
 
@@ -180,6 +194,7 @@ static void gpsd_transit_fix_dump(struct gps_device_t *session,
     char lat_str[BUF_SZ];
     char lon_str[BUF_SZ];
     char speed_str[BUF_SZ];
+    char kspeed_str[BUF_SZ];
     char track_str[BUF_SZ];
     char var_str[BUF_SZ];
     char *var_dir = "";
@@ -219,6 +234,26 @@ static void gpsd_transit_fix_dump(struct gps_device_t *session,
                    time2_str,
                    var_str, var_dir);
     nmea_add_checksum(bufp);
+    //$GNRMC,114740.00,A,4957.22826,N,03618.97015,E,0.054,,091220,,,A*65
+    //$GNVTG,,T,,M,0.054,N,0.100,K,A*3D
+    //1    = Track made good
+    //2    = Fixed text 'T' indicates that track made good is relative to true north
+    //3    = Track made good, degrees Magnetic
+    //4    = Magnetic track indicator - 'M'
+    //5    = Speed over ground in knots
+    //6    = Fixed text 'N' indicates that speed over ground in in knots
+    //7    = Speed over ground in kilometers/hour
+    //8    = Fixed text 'K' indicates that speed over ground is in kilometers/hour
+    //we use the same values as in RMC sentence
+    char *bufvtg = &bufp[strlen(bufp)];
+    (void)snprintf(bufvtg, len,
+                   "$GPVTG,%s,T,%s,M,%s,N,%s,K,A,",
+                   track_str,
+                   track_str,//it is not Magnetic track, but may be it is enough
+                   speed_str,
+                   f_str(session->gpsdata.fix.speed, "%.4f", kspeed_str)
+                   );
+    nmea_add_checksum(bufvtg);
 }
 
 static void gpsd_binary_satellite_dump(struct gps_device_t *session,
-- 
2.7.4