m_autoCenteringEnabled(false),
m_automaticUpdateFirstStart(true),
m_userMoved(false),
- m_automaticUpdateScreenOff(false),
m_automaticUpdateIntervalTimer(0),
m_lastUpdatedGPSPosition(QPointF())
{
{
qDebug() << __PRETTY_FUNCTION__;
- m_displayOn = on;
-
- if (m_autoCenteringEnabled)
- enableAutoCentering(on);
+ m_gps->enablePowerSave(!on);
}
void SituareEngine::enableAutoCentering(bool enabled)
{
- qDebug() << __PRETTY_FUNCTION__;
+ qWarning() << __PRETTY_FUNCTION__ << enabled;
m_ui->setAutoCenteringButtonEnabled(enabled);
m_mapEngine->setAutoCentering(enabled);
m_userMoved = true;
}
- if (m_automaticUpdateGPSRequest) {
- m_
+ if (!m_mce->isDisplayOn()) {
+ m_gps->stop();
}
}
private:
bool m_autoCenteringEnabled; ///< Auto centering flag
bool m_automaticUpdateFirstStart; ///< Automatic location update first start flag
- bool m_automaticUpdateScreenOff; ///< Flag for automatic location update when screen is off
- bool m_screenOn; ///< Flag for device screen on
bool m_userMoved; ///< Flag for user moving
m_gpsPositionPrivate = new GPSPositionPrivate(this);
}
+void GPSPosition::enablePowerSave(bool enabled)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_gpsPositionPrivate->enablePowerSave(enabled);
+}
+
bool GPSPosition::isInitialized()
{
qDebug() << __PRETTY_FUNCTION__;
m_gpsPositionPrivate->requestLastPosition();
}
+void GPSPosition::requestUpdate()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_gpsPositionPrivate->requestUpdate();
+}
+
void GPSPosition::setMode(Mode mode, const QString &filePath)
{
qDebug() << __PRETTY_FUNCTION__;
******************************************************************************/
public:
/**
+ * @brief Enables power save mode.
+ *
+ * Starts GPS for position update and then stops it.
+ */
+ void enablePowerSave(bool enabled);
+
+ /**
* @brief Returns is GPS initialized.
*
* @return true if initialized, false otherwise
void requestLastPosition();
/**
+ * @brief Requests update from GPS.
+ *
+ * Enables GPS if it is disabled
+ */
+ void requestUpdate();
+
+ /**
* @brief Set GPS mode.
*
* Modes: default and simulation.
m_parent = static_cast<GPSPosition*>(parent);
}
+void GPSPositionPrivate::enablePowerSave(bool enabled)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
+
bool GPSPositionPrivate::isInitialized()
{
qDebug() << __PRETTY_FUNCTION__;
}
}
+void GPSPositionPrivate::requestUpdate()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (!isRunning())
+ start();
+
+ m_gpsSource->requestUpdate();
+}
+
void GPSPositionPrivate::positionUpdated(const QGeoPositionInfo &positionInfo)
{
qDebug() << __PRETTY_FUNCTION__ << positionInfo;
******************************************************************************/
public:
/**
+ * @brief Enables power save mode.
+ *
+ * Starts GPS for position update and then stops it.
+ */
+ void enablePowerSave(bool enabled);
+
+ /**
* @brief Returns is GPS initialized.
*
* @return true if initialized, false otherwise
void requestLastPosition();
/**
+ * @brief Requests update from GPS.
+ *
+ * Enables GPS if it is disabled
+ */
+ void requestUpdate();
+
+ /**
* @brief Set GPS mode.
*
* Modes: default and simulation.
: QObject(parent),
m_liblocationWrapper(0),
m_initialized(false),
+ m_powerSave(false),
m_running(false),
m_updateInterval(DEFAULT_UPDATE_INTERVAL)
{
m_parent = static_cast<GPSPosition*>(parent);
}
+void GPSPositionPrivate::enablePowerSave(bool enabled)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (isRunning()) {
+ m_powerSave = enabled;
+ if (enabled)
+ m_liblocationWrapper->stopUpdates();
+ else
+ m_liblocationWrapper->startUpdates();
+ }
+ else {
+ m_powerSave = false;
+ }
+}
+
bool GPSPositionPrivate::isInitialized()
{
qDebug() << __PRETTY_FUNCTION__;
}
}
+void GPSPositionPrivate::requestUpdate()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (m_powerSave)
+ m_liblocationWrapper->startUpdates();
+}
+
void GPSPositionPrivate::positionUpdated(const GeoPositionInfo &positionInfo)
{
qDebug() << __PRETTY_FUNCTION__;
emit m_parent->position(QPointF(coordinate.longitude(), coordinate.latitude()),
accuracy(positionInfo));
}
+
+ if (m_powerSave)
+ m_liblocationWrapper->stopUpdates();
}
void GPSPositionPrivate::locationError(const QString &errorMessage)
******************************************************************************/
public:
/**
+ * @brief Enables power save mode.
+ *
+ * Starts GPS for position update and then stops it.
+ */
+ void enablePowerSave(bool enabled);
+
+ /**
* @brief Returns is GPS initialized.
*
* @return true if initialized, false otherwise
void requestLastPosition();
/**
+ * @brief Requests update from GPS.
+ *
+ * Enables GPS if it is disabled
+ */
+ void requestUpdate();
+
+ /**
* @brief Set GPS mode.
*
* Modes: default and simulation.
LiblocationWrapper *m_liblocationWrapper; ///< Liblocation wrapper object
GPSPosition *m_parent; ///< Parent object
bool m_initialized; ///< GPS is initialized
+ bool m_powerSave; ///< Power save flag
bool m_running; ///< GPS is running
int m_updateInterval; ///< GPS update interval
};
m_parent = static_cast<GPSPosition*>(parent);
}
+void GPSPositionPrivate::enablePowerSave(bool enabled)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
+
bool GPSPositionPrivate::isInitialized()
{
qDebug() << __PRETTY_FUNCTION__;
{
qDebug() << __PRETTY_FUNCTION__;
}
+
+void GPSPositionPrivate::requestUpdate()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+}
******************************************************************************/
public:
/**
+ * @brief Enables power save mode.
+ *
+ * Starts GPS for position update and then stops it.
+ */
+ void enablePowerSave(bool enabled);
+
+ /**
* @brief Returns is GPS initialized.
*
* RETURNS FALSE
void requestLastPosition();
/**
+ * @brief Requests update from GPS.
+ *
+ * Enables GPS if it is disabled
+ */
+ void requestUpdate();
+
+ /**
* @brief Set GPS update interval.
*
* DOES NOTHING.
QString content = message.arguments().at(DISPLAY_STATE_INDEX).toString();
if (!content.isEmpty()) {
- if (content == MCE_DISPLAY_ON_STRING)
+ if (content == MCE_DISPLAY_ON_STRING) {
+ m_displayOn = true;
emit m_parent->displayOn(true);
- else if (content == MCE_DISPLAY_OFF_STRING)
+ }
+ else if (content == MCE_DISPLAY_OFF_STRING) {
+ m_displayOn = false;
emit m_parent->displayOn(false);
+ }
}
}
QT += network \
webkit
-#DEFINES += QT_NO_DEBUG_OUTPUT
+DEFINES += QT_NO_DEBUG_OUTPUT
simulator {
SOURCES += network/networkhandlerprivatestub.cpp \