CLbsPositionLogger::CLbsPositionLogger(const char *pszFile, QObject *parent) : QGeoPositionInfoSource(parent) { bool check = connect(&m_timer, SIGNAL(timeout()), SLOT(readNextPosition())); Q_ASSERT(check); m_szFile = pszFile; }
void LogFilePositionSource::requestUpdate(int /*timeout*/) { // For simplicity, ignore timeout - assume that if data is not available // now, no data will be added to the file later if (logFile->canReadLine()) readNextPosition(); else emit updateTimeout(); }
void CLbsPositionLogger::requestUpdate(int timeout) { Q_UNUSED(timeout); // For simplicity, ignore timeout - assume that if data is not available // now, no data will be added to the file later if (m_logFile.canReadLine()) readNextPosition(); else emit updateTimeout(); }
LogFilePositionSource::LogFilePositionSource(QObject *parent) : QGeoPositionInfoSource(parent), logFile(new QFile(this)), timer(new QTimer(this)) { connect(timer, SIGNAL(timeout()), this, SLOT(readNextPosition())); logFile->setFileName(QCoreApplication::applicationDirPath() + QDir::separator() + "simplelog.txt"); if (!logFile->open(QIODevice::ReadOnly)) qWarning() << "Error: cannot open source file" << logFile->fileName(); }
int CLbsPositionLogger::UploadServer(QString szUrl, QString szUser, QString szPassword, QString szDevice) { int nRet = 0; this->OpenFile(); while(!m_logFile.atEnd()) { readNextPosition(); nRet = CNmea::SendHttpOpenGts(szUrl.toStdString(), szUser.toStdString(), szDevice.toStdString(), m_lastPosition); if(nRet) break; } this->CloseFile(); return nRet; }
LogFilePositionSource::LogFilePositionSource(QObject *parent) : QGeoPositionInfoSource(parent), logFile(new QFile(this)), timer(new QTimer(this)) { connect(timer, SIGNAL(timeout()), this, SLOT(readNextPosition())); // logFile->setFileName(QCoreApplication::applicationDirPath() // + QDir::separator() + "simplelog.txt"); logFile->setFileName(QString::fromUtf8(":/simplelog.txt")); if (!logFile->open(QIODevice::ReadOnly)) qWarning() << "Error: cannot open source file" << logFile->fileName(); QGeoCoordinate coor(3.067269, 101.691547); lastPosition.setCoordinate(coor); lastPosition.setTimestamp(QDateTime::currentDateTime()); }