Hi.
I want to know the GPS coordinates of the cellphone's current location.
Accuracy is not important to me so any possible method to aquire the location is accepted as long as it is availabe in Qt.
I read the wikis and articles regarding this and also searched the forums for such problems but couldn't find anything that helps my program.
I downloaded some example in one of the wikis and it didn't work too.
I need to use the GPS coordinates indoor most of the time.
I have a Nokia C6-01.
Ovi Maps works fine both outdoors and indoors.
Here is the header file:
Here is the source:Code:#ifndef GPS_H_ #define GPS_H_ #include <QGeoPositionInfo> #include <QGeoPositionInfoSource> QTM_USE_NAMESPACE class GPS : QObject { Q_OBJECT public: GPS(); ~GPS(); public slots: void positionUpdated(const QGeoPositionInfo &info); void updateTimeout(); private: QGeoPositionInfoSource *mvp_source; QGeoCoordinate mv_coordinate; }; #endif /* GPS_H_ */
Here is the project file:Code:#include "GPS.h" GPS::GPS() { this->mvp_source = QGeoPositionInfoSource::createDefaultSource(this); this->mvp_source->setPreferredPositioningMethods(QGeoPositionInfoSource::NonSatellitePositioningMethods); connect(this->mvp_source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo))); connect(this->mvp_source, SIGNAL(updateTimeout()), this, SLOT(updateTimeout())); this->mvp_source->requestUpdate(); } GPS::~GPS() {} void GPS::positionUpdated(const QGeoPositionInfo &info) { if (info.isValid()) this->mv_coordinate = info.coordinate(); } void GPS::updateTimeout() { switch (this->mvp_source->preferredPositioningMethods()) { case QGeoPositionInfoSource::SatellitePositioningMethods: this->mvp_source->setPreferredPositioningMethods(QGeoPositionInfoSource::NonSatellitePositioningMethods); break; case QGeoPositionInfoSource::NonSatellitePositioningMethods: this->mvp_source->setPreferredPositioningMethods(QGeoPositionInfoSource::SatellitePositioningMethods); break; default: this->mvp_source->setPreferredPositioningMethods(QGeoPositionInfoSource::SatellitePositioningMethods); break; } this->mvp_source->requestUpdate(1000 * 30); }
I have a valid PublisherID and development certificates.Code:TEMPLATE = app TARGET = X QT += core \ gui \ network HEADERS += GPS.h \ X.h SOURCES += GPS.cpp \ X.rss \ X_reg.rss \ main.cpp \ X.cpp FORMS += X.ui RESOURCES += Resource.qrc CONFIG += mobility \ systeminfo TRANSLATIONS = X.ts MOBILITY += location \ sensors symbian: { TARGET.UID3 = 0x00000000 VERSION = 1.0.0 ICON = Pixmap/Icon128.svg MMP_RULES += DEBUGGABLE_UDEBONLY vendorInfo = "%{\"X\"}" \ ":\"X\"" myDeployment.pkg_prerules += vendorInfo TARGET.CAPABILITY = Location \ NetworkServices \ ReadUserData \ WriteUserData \ ReadDeviceData \ WriteDeviceData autoStartBlock = "SOURCEPATH ." \ "START RESOURCE X.rss" \ "END" MMP_RULES += autoStartBlock deployRscFile = "\"$${EPOCROOT}epoc32/data/X.rsc\" - \"C:/private/X/import/[X].rsc\"" deployFiles.pkg_postrules += deployRscFile pixmapFiles.sources = Pixmap/* pixmapFiles.path = . DEPLOYMENT += deployFiles DEPLOYMENT += pixmapFiles }
The App works fine except for the GPS coordinates part.



