Created
December 10, 2012 18:02
-
-
Save tinbotu/4252185 to your computer and use it in GitHub Desktop.
gpsbabel patch supporting Sony GPS-CS1 Style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ../nmea.c 2012-12-11 01:46:06.000000000 +0900 | |
+++ nmea.c 2012-12-11 01:56:11.000000000 +0900 | |
@@ -175,6 +175,7 @@ | |
static char* opt_append; | |
static char* opt_gisteq; | |
static char* opt_ignorefix; | |
+static char* opt_sonycs1; | |
static long sleepus; | |
static int getposn; | |
@@ -205,6 +206,7 @@ | |
{"baud", &opt_baud, "Speed in bits per second of serial port (baud=4800)", NULL, ARGTYPE_INT, ARG_NOMINMAX }, | |
{"gisteq", &opt_gisteq, "Write tracks for Gisteq Phototracker", "0", ARGTYPE_BOOL, ARG_NOMINMAX }, | |
{"ignore_fix", &opt_ignorefix, "Accept position fixes in gpgga marked invalid", "0", ARGTYPE_BOOL, ARG_NOMINMAX }, | |
+ {"sonycs1", &opt_sonycs1, "NMEA for SONY GPS Image Tracker (GPS-CS1 compatible)", "0", ARGTYPE_BOOL, ARG_NOMINMAX }, | |
ARG_TERMINATOR | |
}; | |
@@ -268,6 +270,7 @@ | |
CHECK_BOOL(opt_gpvtg); | |
CHECK_BOOL(opt_gpgsa); | |
CHECK_BOOL(opt_gisteq); | |
+ CHECK_BOOL(opt_sonycs1); | |
QUEUE_INIT(&pcmpt_head); | |
@@ -323,6 +326,7 @@ | |
CHECK_BOOL(opt_gpvtg); | |
CHECK_BOOL(opt_gpgsa); | |
CHECK_BOOL(opt_gisteq); | |
+ CHECK_BOOL(opt_sonycs1); | |
append_output = atoi(opt_append); | |
@@ -336,6 +340,10 @@ | |
sleepus = -1; | |
} | |
} | |
+ | |
+ if(!atoi(opt_append) && opt_sonycs1){ | |
+ gbfprintf(file_out, "@SonyGPS/ver1.0/wgs-84\n"); | |
+ } | |
mkshort_handle = mkshort_new_handle(); | |
setshort_length(mkshort_handle, atoi(snlenopt)); | |
@@ -1253,6 +1261,16 @@ | |
struct tm* tm; | |
time_t hms; | |
time_t ymd; | |
+ char *vtg_normal = "GPVTG,%.3f,T,0,M,%.3f,N,%.3f,K"; | |
+ char *vtg_sony = "GPVTG,%.3f,T,,M,%.3f,N,%.3f,K"; | |
+ char *vtgstr; | |
+ | |
+ if(sonycs1){ | |
+ vtgstr = vtg_sony; | |
+ } | |
+ else{ | |
+ vtgstr = vtg_normal; | |
+ } | |
if (opt_sleep) { | |
gbfflush(file_out); | |
@@ -1327,8 +1345,8 @@ | |
cksum = nmea_cksum(obuf); | |
gbfprintf(file_out, "$%s*%02X\n", obuf, cksum); | |
} | |
- if ((opt_gpvtg) && (WAYPT_HAS(wpt, course) || WAYPT_HAS(wpt, speed))) { | |
- snprintf(obuf,sizeof(obuf),"GPVTG,%.3f,T,0,M,%.3f,N,%.3f,K", | |
+ if (opt_sonycs1 || ((opt_gpvtg) && (WAYPT_HAS(wpt, course) || WAYPT_HAS(wpt, speed)))) { | |
+ snprintf(obuf,sizeof(obuf), vtgstr, | |
WAYPT_HAS(wpt, course) ? (wpt->course):(0), | |
WAYPT_HAS(wpt, speed) ? MPS_TO_KNOTS(wpt->speed):(0), | |
WAYPT_HAS(wpt, speed) ? MPS_TO_KPH(wpt->speed):(0)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment