gpt4 book ai didi

javascript - 从 Garmin GPSMap 62 设备读取数据

转载 作者:数据小太阳 更新时间:2023-10-29 05:36:07 24 4
gpt4 key购买 nike

我需要使用设备控制 Javascript 库从 GPSMap 62 设备读取数据。问题是,与旧设备不同,该设备每天将其航路点存储在单独的 .GPX 文件中。 javascript 库期望所有轨迹和航路点都在 current.gpx 文件中,但是 62 将它们存储在例如Waypoints_06-MAY-14.gpx 等等每一天。

除了要求用户手动上传适当的文件之外,是否有人获得了 DeviceControl 库以实际支持具有单独 GPX 文件的较新设备?

作为额外的好处,Garmin 设备控制库已被弃用,因此不会有更新。

一些代码

startReadFromGps: function(deviceNumber) {
this.plugin.StartReadFromGps( deviceNumber ); //invokes the external plugin
},

最佳答案

我已经检查了 2.3-RC1 版本的插件(我不知道,你用的是哪个版本)。

确实有startReadFromGps方法:

/** 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 );
},

所以它使用getGpsXml。我假设它使用已读取的指定文件名,并且方法返回文件的内容。我的第一个想法是更改文件名 - 可以使用:

/** 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;
},

但是_setWriteFilename 是私有(private)方法。然而调用

startWriteToGps: function(gpsXml, filename, deviceNumber)

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

从现在开始,我将检查使用您指定的 filename 调用这些方法是否会永久覆盖文件名值,并且进一步调用 startReadFromGps 将使用新的 filename.

我无法测试它,我没有使用这个库,但你可以试一试。

关于javascript - 从 Garmin GPSMap 62 设备读取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23492415/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com