USA.
*/
+#include <QDebug>
+
#include "geocoordinate.h"
#include "gpscommon.h"
GeoCoordinate::GeoCoordinate()
+ : m_latitude(GPS_COORDINATE_UNDEFINED),
+ m_longitude(GPS_COORDINATE_UNDEFINED)
{
+ qDebug() << __PRETTY_FUNCTION__;
}
GeoCoordinate::GeoCoordinate(double latitude, double longitude)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
m_latitude = latitude;
m_longitude = longitude;
}
-void GeoCoordinate::setLatitude(double latitude)
+bool GeoCoordinate::isValid()
{
- m_latitude = latitude;
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if ((m_latitude >= GPS_MIN_LATITUDE) && (m_latitude < GPS_MAX_LATITUDE) &&
+ (m_longitude >= GPS_MIN_LONGITUDE) && (m_longitude < GPS_MAX_LONGITUDE))
+
+ return true;
+ else
+ return false;
}
double GeoCoordinate::latitude() const
{
+ qDebug() << __PRETTY_FUNCTION__;
+
return m_latitude;
}
+
void GeoCoordinate::setLongitude(double longitude)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
m_longitude = longitude;
}
-double GeoCoordinate::longitude() const
+void GeoCoordinate::setLatitude(double latitude)
{
- return m_longitude;
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_latitude = latitude;
}
-bool GeoCoordinate::isValid()
+double GeoCoordinate::longitude() const
{
- if ((m_latitude >= GPS_MIN_LATITUDE) && (m_latitude < GPS_MAX_LATITUDE) &&
- (m_longitude >= GPS_MIN_LONGITUDE) && (m_longitude < GPS_MAX_LONGITUDE))
+ qDebug() << __PRETTY_FUNCTION__;
- return true;
- else
- return false;
+ return m_longitude;
}
*/
#include <QDateTime>
+#include <QDebug>
#include "geopositioninfo.h"
#include "gpscommon.h"
#include "geocoordinate.h"
GeoPositionInfo::GeoPositionInfo()
- : m_isAccurate(false)
+ : m_timestamp(QDateTime()),
+ m_coordinate(GeoCoordinate()),
+ m_horizontalAccuracy(GPS_ACCURACY_UNDEFINED),
+ m_isAccurate(false)
{
+ qDebug() << __PRETTY_FUNCTION__;
}
QDateTime GeoPositionInfo::timestamp() const
{
+ qDebug() << __PRETTY_FUNCTION__;
+
return m_timestamp;
}
void GeoPositionInfo::setTimestamp(qreal time)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
m_timestamp = QDateTime::fromTime_t(time);
}
void GeoPositionInfo::setCoordinate(const GeoCoordinate &coordinate)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
m_coordinate = coordinate;
}
GeoCoordinate GeoPositionInfo::coordinate() const
{
+ qDebug() << __PRETTY_FUNCTION__;
+
return m_coordinate;
}
bool GeoPositionInfo::isValid()
{
- return m_coordinate.isValid();
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_coordinate.isValid();
}
void GeoPositionInfo::setAccuracy(bool accurate, qreal accuracy)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
if (accuracy < 0)
m_horizontalAccuracy = GPS_ACCURACY_UNDEFINED;
else
qreal GeoPositionInfo::accuracy() const
{
+ qDebug() << __PRETTY_FUNCTION__;
+
return m_horizontalAccuracy;
}
bool GeoPositionInfo::isAccurate() const
{
+ qDebug() << __PRETTY_FUNCTION__;
+
return m_isAccurate;
}
#include <QObject>
const int GPS_ACCURACY_UNDEFINED = -1; ///< Value used when accuracy is undefined
+const int GPS_COORDINATE_UNDEFINED = -1000; ///< Value used when coordinate is undefined
const qreal GPS_MAX_LATITUDE = 85.05112877980659237802; ///< Maximum latitude value
const qreal GPS_MIN_LATITUDE = -GPS_MAX_LATITUDE; ///< Minimum latitude value
#include "gpsposition.h"
-#if defined(Q_WS_MAEMO_5) | defined(Q_WS_SIMULATOR)
+#if defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
#include "gpspositionprivateliblocation.h"
+#elif defined(Q_WS_SIMULATOR)
+#include "gpspositionprivate.h"
#else
#include "gpspositionprivatestub.h"
#endif
{
qDebug() << __PRETTY_FUNCTION__;
- QDateTime timestamp;
-
- if (!positionInfo.dateTime().isValid())
+ if (!positionInfo.timestamp().isValid())
return GPS_ACCURACY_UNDEFINED;
if (positionInfo.hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
QPointF GPSPositionPrivate::lastPosition()
{
+ qDebug() << __PRETTY_FUNCTION__;
+
GeoPositionInfo positionInfo = m_liblocationWrapper->lastKnownPosition();
return QPointF(positionInfo.coordinate().longitude(), positionInfo.coordinate().latitude());
void stop();
private:
+ /**
+ * @brief Returns horizontal accuracy.
+ *
+ * @param positionInfo geo position info
+ * @return accuracy value, -1 if undefined. Returns -1 also is timestamp is not valid
+ * (when using network positioning)
+ */
qreal accuracy(const GeoPositionInfo &positionInfo);
private slots:
: QObject(parent),
m_control(0),
m_device(0),
+ m_lastKnownPosition(GeoPositionInfo()),
m_state(LiblocationWrapper::Undefined)
{
qDebug() << __PRETTY_FUNCTION__;
}
}
wrapper->setLastKnownPosition(positionInfo);
- wrapper->locationChanged();
+ emit wrapper->locationChanged(positionInfo);
}
}
{
qDebug() << __PRETTY_FUNCTION__;
- if (state() == LiblocationWrapper::Running)
- return true;
- else
- return false;
+ return (state() == LiblocationWrapper::Running);
}
GeoPositionInfo LiblocationWrapper::lastKnownPosition() const
return m_lastKnownPosition;
}
-void LiblocationWrapper::locationChanged()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- emit locationChanged(lastKnownPosition());
-}
-
void LiblocationWrapper::setLastKnownPosition(const GeoPositionInfo &positionInfo)
{
qDebug() << __PRETTY_FUNCTION__;
private:
/**
- * @brief Called when GPS location changes.
+ * @brief Called from liblocation when GPS location changes.
*
* @param device LocationGPSDevice
* @param data qpointer
static void changed(LocationGPSDevice *device, gpointer data);
/**
- * @brief Called when there is an error on GPS.
+ * @brief Called from liblocation when there is an error on GPS.
*
* @param device LocationGPSDevice
* @param data qpointer
*/
static void error(LocationGPSDevice *device, gpointer data);
-
- /**
- * @brief Emits locationChanged signal.
- */
- void locationChanged();
-
/**
* @brief Sets state.
*
*/
void locationChanged(const GeoPositionInfo &positionInfo);
+ /**
+ * @brief Signal for error.
+ *
+ * @param messgage error message
+ */
void errorMessage(const QString &message);
network/networkaccessmanager.h \
network/networkhandler.h \
network/networkcookiejar.h \
- network/networkreply.h \
- gps/liblocationwrapper.h \
- gps/geopositioninfo.h \
- gps/geocoordinate.h
+ network/networkreply.h
QT += network \
webkit
DEFINES += QT_NO_DEBUG_OUTPUT
-maemo5 | simulator {
+simulator {
+ SOURCES += network/networkhandlerprivatestub.cpp \
+ gps/gpspositionprivate.cpp
+ HEADERS += network/networkhandlerprivatestub.h \
+ gps/gpspositionprivate.h
+ QT += maemo5
+ CONFIG += mobility
+ MOBILITY += location
+} else:maemo5 {
armel {
DEFINES += ARMEL
INCLUDEPATH += /usr/include/glib-2.0 /usr/lib/glib-2.0/include