void LogFilePositionSource::startUpdates()
{
    int interval = updateInterval();
    if (interval < minimumUpdateInterval())
        interval = minimumUpdateInterval();

    timer->start(interval);
}
Esempio n. 2
0
void CLbsPositionLogger::startUpdates()
{
    int interval = updateInterval();
    if (interval < minimumUpdateInterval())
        interval = minimumUpdateInterval();

    m_timer.start(interval);
}
void QGeoSatelliteInfoSourceSimulator::startUpdates()
{
    int interval = updateInterval();
    if (interval < minimumUpdateInterval())
        interval = minimumUpdateInterval();
    timer->setInterval(interval);
    timer->start();
}
void QGeoPositionInfoSourceSimulator::setUpdateInterval(int msec)
{
    // If msec is 0 we send updates as data becomes available, otherwise we force msec to be equal
    // to or larger than the minimum update interval.
    if (msec != 0 && msec < minimumUpdateInterval())
        msec = minimumUpdateInterval();

    QGeoPositionInfoSource::setUpdateInterval(msec);
    if (timer->isActive()) {
        timer->setInterval(msec);
        timer->start();
    }
}
void QGeoSatelliteInfoSourceAndroid::setUpdateInterval(int msec)
{
    int previousInterval = updateInterval();
    msec = (((msec > 0) && (msec < minimumUpdateInterval())) || msec < 0)? minimumUpdateInterval() : msec;

    if (msec == previousInterval)
        return;

    QGeoSatelliteInfoSource::setUpdateInterval(msec);

    if (updatesRunning)
        reconfigureRunningSystem();
}
void QGeoSatelliteInfoSourceSimulator::requestUpdate(int timeout)
{
    if (!requestTimer->isActive()) {
        // Get a single update within timeframe
        if (timeout == 0)
            timeout = minimumUpdateInterval();

        if (timeout < minimumUpdateInterval())
            emit requestTimeout();
        else
            requestTimer->start(timeout);
    }
}
void QGeoSatelliteInfoSourceSimulator::setUpdateInterval(int msec)
{
    // msec should be equal to or larger than the minimum update interval; 0 is a special case
    // that currently behaves as if the interval is set to the minimum update interval
    if (msec != 0 && msec < minimumUpdateInterval())
        msec = minimumUpdateInterval();

    QGeoSatelliteInfoSource::setUpdateInterval(msec);
    if (timer->isActive()) {
        timer->setInterval(msec);
        timer->start();
    }
}
void QGeoSatelliteInfoSourceAndroid::requestUpdate(int timeout)
{
    if (requestTimer.isActive())
        return;

    if (timeout != 0 && timeout < minimumUpdateInterval()) {
        emit requestTimeout();
        return;
    }

    if (timeout == 0)
        timeout = UPDATE_FROM_COLD_START;

    requestTimer.start(timeout);

    // if updates already running with interval equal or less then timeout
    // then we wait for next update coming through
    // assume that a single update will not be quicker than regular updates anyway
    if (updatesRunning && updateInterval() <= timeout)
        return;

    QGeoSatelliteInfoSource::Error error = AndroidPositioning::startSatelliteUpdates(
                androidClassKeyForSingleRequest, true, timeout);
    if (error != QGeoSatelliteInfoSource::NoError) {
        requestTimer.stop();
        m_error = error;
        emit QGeoSatelliteInfoSource::error(m_error);
    }
}
void QGeoPositionInfoSourceAndroidGms::setUpdateInterval(int msec)
{
	int previousInterval = updateInterval();
	msec = (((msec > 0) && (msec < minimumUpdateInterval())) || msec < 0)? minimumUpdateInterval() : msec;

	if (msec == previousInterval)
	{
		return;
	}

	QGeoPositionInfoSource::setUpdateInterval(msec);

	if (updatesRunning_)
	{
		reconfigureRunningSystem();
	}
}
void QGeoPositionInfoSourceWinCE::requestUpdate(int timeout)
{
    // A timeout of 0 means to use the default timeout, which is handled by the QGeoInfoThreadWinCE
    // instance, otherwise if timeout is less than the minimum update interval we emit a
    // updateTimeout signal
    if (timeout < minimumUpdateInterval() && timeout != 0)
        emit updateTimeout();
    else
        infoThread->requestUpdate(timeout);
}
Esempio n. 11
0
/*!
    \reimp
*/
void QNmeaPositionInfoSource::setUpdateInterval(int msec)
{
    int interval = msec;
    if (interval != 0)
        interval = qMax(msec, minimumUpdateInterval());
    QGeoPositionInfoSource::setUpdateInterval(interval);
    if (d->m_invokedStart) {
        d->stopUpdates();
        d->startUpdates();
    }
}
void QGeoPositionInfoSourceSimulator::requestUpdate(int timeout)
{
    if (!requestTimer->isActive()) {
        // Get a single update within timeframe
        if (timeout < minimumUpdateInterval() && timeout != 0)
            emit updateTimeout();
        else {
            requestTimer->start(timeout * qreal(0.75));
        }
    }
}
void QGeoSatelliteInfoSourceNpeBackend::shutdownRequestSession()
{
    requestTimer->stop();
    // Restore updateInterval from before Request Session in case of ongoing tracking session
    if ( satOngoing ) {
        int minimumInterval = minimumUpdateInterval();
        if ( QGeoSatelliteInfoSource::updateInterval() != minimumInterval)
            setUpdateInterval(QGeoSatelliteInfoSource::updateInterval());
    } else {
        // If our timer expired before we could get a sat update, make sure we stop the locationd request
        // (which would otherwise go on until a valid satellite update is obtained).
        m_locationdConn->stopSatelliteUpdates();
    }
}
void QGeoSatelliteInfoSourceGeoclueMaster::requestUpdate(int timeout)
{
    if (timeout < minimumUpdateInterval() && timeout != 0) {
        emit requestTimeout();
        return;
    }

    if (m_requestTimer.isActive())
        return;

    if (!m_master->hasMasterClient())
        configureSatelliteSource();

    m_requestTimer.start(qMax(timeout, minimumUpdateInterval()));

    if (m_sat) {
        QDBusPendingReply<qint32, qint32, qint32, QList<qint32>, QList<QGeoSatelliteInfo> > reply =
            m_sat->GetSatellite();
        QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
        connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
                this, SLOT(getSatelliteFinished(QDBusPendingCallWatcher*)));
    }
}
/*!
    \reimp
*/
void QGeoPositionInfoSourceBb::setUpdateInterval(int msec)
{
    int interval = msec;
    if (interval != 0)
        interval = qMax(msec, minimumUpdateInterval());

    if (interval == updateInterval())
        return;

    QGeoPositionInfoSource::setUpdateInterval(interval);

    Q_D(QGeoPositionInfoSourceBb);
    if (d->_startUpdatesInvoked) {
        d->stopUpdates();
        d->startUpdates();
    }
}
void QGeoSatelliteInfoSourceNpeBackend::requestUpdate(int timeout)
{
    // ignore if another requestUpdate is still pending
    if (!requestTimer->isActive()) {
        int minimumInterval = minimumUpdateInterval();
        if (timeout == 0)
            timeout = 5*minimumInterval; // set reasonable timeout if provided timeout is 0
        // do not start request if timeout can not be fulfilled by the source
        if (timeout < minimumInterval) {
            emit requestTimeout();
            return;
        }
        // get satellite update as fast as possible in case of ongoing tracking session
        if ( satOngoing ) {
            if ( QGeoSatelliteInfoSource::updateInterval() != minimumInterval)
                m_locationdConn->setUpdateInterval(minimumInterval);
        } else { // request the update only if no tracking session is active
            m_locationdConn->requestSatelliteUpdate();
        }
        requestTimer->start(timeout);
    }
}
void QGeoPositionInfoSourceAndroidGms::startUpdates()
{
	if (updatesRunning_)
	{
		return;
	}

	Q_ASSERT(regularProvider_);
	const PositioningMethods methods = preferredPositioningMethods();

	if (methods == 0) 
	{
		setError(UnknownSourceError);
		return;
	}

	QAndroidGmsLocationProvider::enPriority priority = QAndroidGmsLocationProvider::PRIORITY_LOW_POWER;

	if (QGeoPositionInfoSource::NonSatellitePositioningMethods & methods)
	{
		priority = QAndroidGmsLocationProvider::PRIORITY_BALANCED_POWER_ACCURACY;
	}

	if (QGeoPositionInfoSource::SatellitePositioningMethods & methods)
	{
		priority = QAndroidGmsLocationProvider::PRIORITY_HIGH_ACCURACY;
	}

	regularProvider_->setPriority(priority);

	updatesRunning_ = true;

	Q_ASSERT(regularProvider_);
	regularProvider_->setUpdateInterval(updateInterval(), minimumUpdateInterval());
	regularProvider_->startUpdates();

	onProvidersChange(providersListener_->isActiveProvidersEnabled());
}