我已经检查了版本中的插件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
是私有方法。然而被称为
startWriteToGps: function(gpsXml, filename, deviceNumber)
和
startWriteFitnessData: function(tcdXml, deviceNumber, filename, dataTypeName)
从现在开始,我将检查使用您指定的方法调用这些方法是否filename
会永久覆盖文件名值,进一步调用startReadFromGps
将使用新的filename
。
我无法测试它,我没有使用这个库,但你可以试一试。