Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read data from a Garmin GPSMap 62 device

I need to read data from a GPSMap 62 device using the device control Javascript library. Problem is, unlike older devices, this device stores its waypoints in separate .GPX files every day. The javascript library expects all tracks and waypoints to be in the current.gpx file, but the 62 stores them in e.g. Waypoints_06-MAY-14.gpx and so on each day.

Short of requiring users to manually upload the appropriate file, has anyone gotten the DeviceControl library to actually support the newer devices with separate GPX files?

As an added bonus, the Garmin Device Control library is deprecated, so no updates are forthcoming.

Some code

startReadFromGps: function(deviceNumber) {
     this.plugin.StartReadFromGps( deviceNumber ); //invokes the external plugin
},
like image 905
Captain Kenpachi Avatar asked May 06 '14 10:05

Captain Kenpachi


1 Answers

I've checked out plugin in version 2.3-RC1 (I do not know, which version do you use).

Indeed there is startReadFromGps method:

/** Initiates the read from the gps device conneted. Use finishReadFromGps and getGpsProgressXml to 
 * determine when the plugin is done with this operation. Also, use getGpsXml to extract the
 * actual data from the device. <br/>
 * <br/>
 * Minimum plugin version 2.0.0.4
 * 
 * @param deviceNumber {Number} assigned by the plugin, see getDevicesXml for 
 * assignment of that number.
 * @see #finishReadFromGps
 * @see #cancelReadFromGps
 * @see #getDevicesXml
 */
startReadFromGps: function(deviceNumber) {
     this.plugin.StartReadFromGps( deviceNumber );
},

So it uses getGpsXml. I assume that it uses specified filename that is read and method returns file's content. My first thought is to change the filename - it is possible with:

/** This the filename that wil contain the gps xml once the transfer is complete. Use with 
 * setWriteGpsXml to set what the file contents will be. Also, use startWriteToGps to 
 * actually make the write happen.
 * 
 * @private
 * @param filename {String} the actual filename that will end up on the device. Should only be the
 * name and not the extension. The plugin will append the extension portion to the file name--typically .gpx.
 * @see #setWriteGpsXml, #startWriteToGps, #startWriteFitnessData
 */
_setWriteFilename: function(filename) {
    this.plugin.FileName = filename;
},

But _setWriteFilename is private method. However called by

startWriteToGps: function(gpsXml, filename, deviceNumber)

and

startWriteFitnessData: function(tcdXml, deviceNumber, filename, dataTypeName)

Since now I will check if calling those methods with your specified filename will override filename value permanently and further calling of startReadFromGps will use new filename.

I cannot test it, I didn't use this library but you can give a shot.

like image 92
hsz Avatar answered Oct 28 '22 22:10

hsz