File: gpsdrive-1.32-heading.patch

package info (click to toggle)
kismet 2008-05-R1-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,232 kB
  • ctags: 3,998
  • sloc: cpp: 33,568; sh: 5,544; ansic: 459; makefile: 457; perl: 62; sql: 41
file content (83 lines) | stat: -rw-r--r-- 2,582 bytes parent folder | download | duplicates (7)
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
77
78
79
80
81
82
83
diff -ur gpsdrive-1.32/src/gpsd.c gpsdrive-1.32-heading/src/gpsd.c
--- gpsdrive-1.32/src/gpsd.c	2003-01-23 06:05:34.000000000 -0800
+++ gpsdrive-1.32-heading/src/gpsd.c	2003-07-21 11:47:53.000000000 -0700
@@ -663,6 +663,10 @@
 	      sprintf (reply + strlen (reply), ",R=1");
 	    }
 	  break;
+	case 'H':
+	case 'h':
+	  sprintf (reply + strlen (reply), ",H=%.5f", gNMEAdata.heading);
+	  break;
 	case 'S':
 	case 's':
 	  sprintf (reply + strlen (reply), ",S=%d", gNMEAdata.status);
diff -ur gpsdrive-1.32/src/nmea.h gpsdrive-1.32-heading/src/nmea.h
--- gpsdrive-1.32/src/nmea.h	2002-09-25 03:04:52.000000000 -0700
+++ gpsdrive-1.32-heading/src/nmea.h	2003-07-18 19:52:25.000000000 -0700
@@ -4,6 +4,7 @@
 #define GPGSA "GPGSA"
 #define GPGSV "GPGSV"
 #define GPRMC "GPRMC"
+#define HCHDG "HCHDG"
 #define PRWIZCH "PRWIZCH"
 
 struct OUTDATA {
@@ -76,6 +77,8 @@
     int seen[12];
 
     int valid[12];		/* signal valid */
+
+    double heading; 
 };
 
 #define C_LATLON	1
@@ -84,6 +87,7 @@
 
 /* prototypes */
 extern void doNMEA(short refNum);
+extern void processHCHDG(char *sentence);
 extern void processGPRMC(char *sentence);
 extern void processGPGGA(char *sentence);
 extern void processGPGSV(char *sentence);
diff -ur gpsdrive-1.32/src/nmea_parse.c gpsdrive-1.32-heading/src/nmea_parse.c
--- gpsdrive-1.32/src/nmea_parse.c	2002-09-25 03:04:52.000000000 -0700
+++ gpsdrive-1.32-heading/src/nmea_parse.c	2003-07-19 14:27:19.000000000 -0700
@@ -14,6 +14,25 @@
 #endif
 /* ----------------------------------------------------------------------- */
 
+
+/* HCHDG format:
+ * $HCHDG,heading,<no data>,<no data>,deviation
+ * sentence = 'HCHDG,51.8,,,13.0,E*27'
+ */
+void processHCHDG(char *sentence) {
+   int    i, rv;
+   double heading;
+
+   rv = sscanf( field( sentence, 1 ), "%lg", &heading );
+   if( rv != 1 ) {
+      return; /* don't set anything */
+   }
+
+   gNMEAdata.heading = heading;
+
+   return;
+}
+
 /*
    The time field in the GPRMC sentence is in the format hhmmss;
    the date field is in the format ddmmyy. The output will
diff -ur gpsdrive-1.32/src/tm.c gpsdrive-1.32-heading/src/tm.c
--- gpsdrive-1.32/src/tm.c	2002-06-28 17:23:18.000000000 -0700
+++ gpsdrive-1.32-heading/src/tm.c	2003-07-19 14:08:25.000000000 -0700
@@ -27,6 +27,8 @@
     if (checksum(sentence)) {
 	if (strncmp(GPRMC, sentence, 5) == 0) {
 	    processGPRMC(sentence);
+	} else if (strncmp(HCHDG, sentence, 5) == 0) {
+	    processHCHDG(sentence);
 	} else if (strncmp(GPGGA, sentence, 5) == 0) {
 	    processGPGGA(sentence);
 	} else if (strncmp(GPGSA, sentence, 5) == 0) {