Quantcast

hacking gpsbabel to work with the Forerunner 301 (w/ small patch)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

hacking gpsbabel to work with the Forerunner 301 (w/ small patch)

David Scott-14
Hi Everyone,

I just bought myself a new Forerunner 301 from Garmin (my first GPS  
device) and set about trying to get it work with gpsbabel. I've made  
a small patch to allow gpsbabel to understand the track point record  
type D303 which the device sends (and which I note isn't in the  
Garmin spec). So now I can retrieve the track log from the device,  
with a few caveats. The patch is attached to this mail (hopefully!)



I'm a bit of a newbie both with GPS and with gpsbabel so I apologise  
if I've done something stupid! :)

As far as I can tell the D303 record is very similar to the D302  
record. The Garmin spec describes the D302 as:

position_type posn; /* position */
time_type time; /* time */
float32 alt; /* altitude in meters */
float32 dpth; /* depth in meters */
float32 temp; /* temp in degrees C */
bool  new_trk; /* new track segment? */

and my current guess for the format of the D303 is:

position_type posn; /* position */
time_type time; /* time */
float32 alt; /* altitude in meters */
uint32 heartrate; /* might actually be a char */

So no depth or temperature but in their place the heartrate read from  
the monitor strap that comes with the 301. If you don't wear the  
strap then it's recorded as 0. A uint32 for the heartrate is a bit of  
overkill (even for me in my unfit state) so it could be a uint16 or  
even a char. In any case, the last three bytes of the data always  
seem to be 0 (in my limited tests). I was surprised not to find a  
new_trk segment... but it could well be that I just failed to trigger  
it when I went out this morning?

Another issue is that some of the records appear with invalid  
(0x7fffffff) latitude and longitude values (and a nonsensical-looking  
0x69045951 altitude). I _think_ the device sends these whenever it  
wants to record the heartrate but it doesn't have a GPS fix.

I hackily modified the GPS_STrack structure to include a heartrate  
field but I haven't thought of how to incorporate it in any of the  
output format(s) that gpsbabel produces. Does anyone have any advice?  
I notice that GPX can be extended although I'm not proficient in the  
use of XML Schemas etc.

For anyone whose interested, I put the gpx track output and debug  
logs on the web:

http://www.recoil.org/~djs/gpsbabel-notes/

Hopefully I'll continue gathering data with the device and see what  
turns up.

Oh I'm running the cvs version of gpsbabel on an Apple Powerbook with  
OS X 10.4.1 with software version 2.40 on the Forerunner.

Thanks,
David

forerunner301.d303.cleaned.patch (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: hacking gpsbabel to work with the Forerunner 301 (w/ small patch)

Robert Lipe
David Scott wrote:

> I just bought myself a new Forerunner 301 from Garmin (my first GPS
> device) and set about trying to get it work with gpsbabel. I've made
> a small patch to allow gpsbabel to understand the track point record

Thanx.  Two or three people have mourned the absence of 301 support, but
so far, the absence of doc and a willing volunteer with access to the
hardware has been missing.


I've applied the patch unchanged except for minor whitespace tweaks.
(Four space indents annoy me, too, but when in Rome...)


Can you please confirm that this:

    GPS_Diag("GPS_D303b_Get (length=%02d) ", length);
    for (i = 0; i < length; i++) GPS_Diag("%02x ", data[i]);
    GPS_Diag("\n");

in GPS_D303b_Get() is redundant and that the lower level serial driver
already does a byte-by-byte dump of incoming packets if given -D9?  If
so, I'd like to whack this.


Thanx.

--
Support GPSBabel by helping to improve it or fund those that that have
done so.  Visit:

        http://sourceforge.net/donate/index.php?group_id=58972


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Gpsbabel-code mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: hacking gpsbabel to work with the Forerunner 301 (w/ small patch)

David Scott-14

On 13 Jun 2005, at 15:56, Robert Lipe wrote:

> Can you please confirm that this:
>
>     GPS_Diag("GPS_D303b_Get (length=%02d) ", length);
>     for (i = 0; i < length; i++) GPS_Diag("%02x ", data[i]);
>     GPS_Diag("\n");
>
> in GPS_D303b_Get() is redundant and that the lower level serial driver
> already does a byte-by-byte dump of incoming packets if given -D9?  If
> so, I'd like to whack this.

Yes that's redundant. I think I added it when I was experimenting  
with the code and forgot to remove it. (Actually I think that's the  
only use of the length parameter so that could be trimmed too)

Thanks,
David


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Gpsbabel-code mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: hacking gpsbabel to work with the Forerunner 301 (w/ small patch)

Robert Lipe
In reply to this post by David Scott-14
> > in GPS_D303b_Get() is redundant and that the lower level serial driver
>
> Yes that's redundant. I think I added it when I was experimenting  
> with the code and forgot to remove it. (Actually I think that's the  
> only use of the length parameter so that could be trimmed too)

[ In Steven Tyler voice ]
I tweaked it with a little fix, like this:

Index: jeeps/gpsapp.c
===================================================================
RCS file: /cvsroot/gpsbabel/gpsbabel/jeeps/gpsapp.c,v
retrieving revision 1.29
diff -p -u -r1.29 gpsapp.c
--- jeeps/gpsapp.c      13 Jun 2005 19:56:20 -0000      1.29
+++ jeeps/gpsapp.c      13 Jun 2005 20:10:36 -0000
@@ -3384,7 +3384,7 @@ int32 GPS_A301_Get(const char *port, GPS
            GPS_D302b_Get(&((*trk)[i]),rec->data);
            break;
        case pD303:
-           GPS_D303b_Get(&((*trk)[i]),rec->data,rec->n);
+           GPS_D303b_Get(&((*trk)[i]),rec->data);
            break;
        default:
            GPS_Error("A301_GET: Unknown track protocol");
@@ -3804,7 +3804,7 @@ void GPS_D302b_Get(GPS_PTrack *trk, UC *
 **
 ** @return [void]
 ************************************************************************/
-void GPS_D303b_Get(GPS_PTrack *trk, UC *data, UC length)
+void GPS_D303b_Get(GPS_PTrack *trk, UC *data)
 {
     UC *p;
     uint32 t;
@@ -3812,10 +3812,6 @@ void GPS_D303b_Get(GPS_PTrack *trk, UC *
     int lat_undefined, lon_undefined;
     int i;

-    GPS_Diag("GPS_D303b_Get (length=%02d) ", length);
-    for (i = 0; i < length; i++) GPS_Diag("%02x ", data[i]);
-    GPS_Diag("\n");
-
     p=data;

     /* Latitude and longitude are sometimes invalid (0x7fffffff or
Index: jeeps/gpsapp.h
===================================================================
RCS file: /cvsroot/gpsbabel/gpsbabel/jeeps/gpsapp.h,v
retrieving revision 1.6
diff -p -u -r1.6 gpsapp.h
--- jeeps/gpsapp.h      13 Jun 2005 19:56:20 -0000      1.6
+++ jeeps/gpsapp.h      13 Jun 2005 20:10:36 -0000
@@ -28,7 +28,7 @@ int32  GPS_D300_Get(GPS_PTrack *trk, int
 void   GPS_D300b_Get(GPS_PTrack *trk, UC *data);
 void   GPS_D301b_Get(GPS_PTrack *trk, UC *data);
 void   GPS_D302b_Get(GPS_PTrack *trk, UC *data);
-void   GPS_D303b_Get(GPS_PTrack *trk, UC *data, UC length);
+void   GPS_D303b_Get(GPS_PTrack *trk, UC *data);
 void   GPS_D310_Get(GPS_PTrack *trk, UC *s);
 void   GPS_D311_Get(GPS_PTrack *trk, UC *s);
 void   GPS_D300_Send(UC *data, GPS_PTrack trk);




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r 
_______________________________________________
Gpsbabel-code mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code
Loading...