diff options
author | alex <alex.blasche@nokia.com> | 2011-11-10 15:47:51 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-10 06:51:27 +0100 |
commit | 1a39ae8253d4b4a2fc7dc984531d48fe6c07511b (patch) | |
tree | 21f5df92e9e45ba6f2b45f44ddffb8b80dfd985b /src | |
parent | 65a550ecfb9c3ed8adf452c923b2b43d71501aca (diff) | |
download | qtlocation-1a39ae8253d4b4a2fc7dc984531d48fe6c07511b.tar.gz |
QtLocation doesn't support Symbian anymore.
Change-Id: I1f90ecd180ce08976338fc9683a7cef5c1389f59
Reviewed-by: Alex <alex.blasche@nokia.com>
Diffstat (limited to 'src')
18 files changed, 4 insertions, 3679 deletions
diff --git a/src/imports/location/qdeclarativepositionsource.cpp b/src/imports/location/qdeclarativepositionsource.cpp index b9851b7a..e5f29353 100644 --- a/src/imports/location/qdeclarativepositionsource.cpp +++ b/src/imports/location/qdeclarativepositionsource.cpp @@ -46,9 +46,6 @@ #include <qnmeapositioninfosource.h> #include <QFile> #include <QTimer> -#if defined(Q_OS_SYMBIAN) -#include <e32std.h> -#endif QT_BEGIN_NAMESPACE @@ -88,13 +85,6 @@ QDeclarativePositionSource::QDeclarativePositionSource() connect(m_positionSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdateReceived(QGeoPositionInfo))); m_positioningMethod = positioningMethod(); -#if defined(Q_OS_SYMBIAN) - } else { - RProcess thisProcess; - if (!thisProcess.HasCapability(ECapabilityLocation)) { - qmlInfo(this) << tr("PositionSource requires the Symbian Location capability to succeed on the Symbian platform."); - } -#endif } #ifdef QDECLARATIVE_POSITION_DEBUG if (m_positionSource) diff --git a/src/imports/location/qlocationimport.pri b/src/imports/location/qlocationimport.pri index c4d502ed..303c1ee9 100644 --- a/src/imports/location/qlocationimport.pri +++ b/src/imports/location/qlocationimport.pri @@ -1,6 +1,5 @@ load(qt_module) -symbian:load(qt_plugin) TEMPLATE = lib CONFIG += qt plugin @@ -30,9 +29,3 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols load(qt_targets) wince*:LIBS += $$QMAKE_LIBS_GUI - -symbian: { - TARGET.EPOCALLOWDLLDATA=1 - TARGET.CAPABILITY = All -Tcb - load(armcc_warnings) -} diff --git a/src/location/location.pro b/src/location/location.pro index 78b3277e..ecb9cee3 100644 --- a/src/location/location.pro +++ b/src/location/location.pro @@ -50,38 +50,6 @@ PRIVATE_HEADERS += \ qgeoareamonitor_polling_p.h \ qgeocoordinate_p.h -symbian { - PRIVATE_HEADERS += qgeopositioninfosource_s60_p.h \ - qmlbackendao_s60_p.h \ - qgeosatelliteinfosource_s60_p.h \ - notificationcallback_s60_p.h \ - notificationsatellitecallback_s60_p.h - - contains(lbt_enabled, yes) { - PRIVATE_HEADERS += \ - qgeoareamonitor_s60_p.h \ - qmlbackendmonitorao_s60_p.h \ - qmlbackendmonitorcreatetriggerao_s60_p.h \ - qmlbackendmonitorinfo_s60_p.h \ - qmlbackendtriggerchangeao_s60_p.h \ - notificationmonitorcallback_s60_p.h - } - - SOURCES += qgeopositioninfosource_s60.cpp \ - qgeosatelliteinfosource_s60.cpp \ - qmlbackendao_s60.cpp - - contains(lbt_enabled, yes) { - SOURCES += \ - qgeoareamonitor_s60.cpp \ - qmlbackendmonitorao_s60.cpp \ - qmlbackendmonitorcreatetriggerao_s60.cpp \ - qmlbackendmonitorinfo_s60.cpp \ - qmlbackendtriggerchangeao_s60.cpp - } -} - - maemo6|meego { CONFIG += qdbus link_pkgconfig SOURCES += qgeopositioninfosource_maemo.cpp \ @@ -158,25 +126,6 @@ SOURCES += \ qgeopositioninfosourcefactory.cpp \ qtlocation.cpp -symbian { - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - TARGET.CAPABILITY = ALL -TCB - TARGET.UID3 = 0x2002AC83 - - INCLUDEPATH += $${EPOCROOT}epoc32/include/osextensions \ - $${EPOCROOT}epoc32/include/LBTHeaders \ - $${EPOCROOT}epoc32/include/platform - LIBS += -llbs - LIBS += -lefsrv - contains(lbt_enabled, yes) { - LIBS += -llbt - } - - QtLocationDeployment.sources = QtLocation.dll - QtLocationDeployment.path = /sys/bin - DEPLOYMENT += QtLocationDeployment -} - simulator { QT += gui SOURCES += qgeopositioninfosource_simulator.cpp \ diff --git a/src/location/qgeoareamonitor.cpp b/src/location/qgeoareamonitor.cpp index def302ed..2eec0923 100644 --- a/src/location/qgeoareamonitor.cpp +++ b/src/location/qgeoareamonitor.cpp @@ -40,9 +40,6 @@ ****************************************************************************/ #include "qgeoareamonitor.h" -#if defined(Q_OS_SYMBIAN) && defined(QT_LOCATION_S60_MONITORING) -#include "qgeoareamonitor_s60_p.h" -#endif #include "qgeoareamonitor_polling_p.h" /*! @@ -171,9 +168,6 @@ qreal QGeoAreaMonitor::radius() const monitors areas using resources on the underlying system. Returns 0 if the system has no support for position monitoring. - - Note: Symbian applications will need to have the Location capability - otherwise this will return 0. */ QGeoAreaMonitor *QGeoAreaMonitor::createDefaultMonitor(QObject *parent) { diff --git a/src/location/qgeoareamonitor_s60.cpp b/src/location/qgeoareamonitor_s60.cpp deleted file mode 100644 index 5e3cca8d..00000000 --- a/src/location/qgeoareamonitor_s60.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QDebug> -#include "qgeoareamonitor_s60_p.h" -#include "qgeopositioninfo.h" -#include "qmlbackendmonitorinfo_s60_p.h" -#include "qmlbackendmonitorcreatetriggerao_s60_p.h" - -QT_BEGIN_NAMESPACE - -TInt QGeoAreaMonitorS60::refCount = 0; - -QGeoAreaMonitorS60* QGeoAreaMonitorS60::NewL(QObject *aParent) -{ - RProcess thisProcess; - if (!thisProcess.HasCapability(ECapabilityLocation)) { - qWarning() << "QGeoAreaMonitor::createDefaultMonitor() requires the Symbian Location capability to succeed on the Symbian platform."; - return 0; - } - - QGeoAreaMonitorS60 *self = QGeoAreaMonitorS60::NewLC(aParent); - CleanupStack::Pop(); - if (!self->isValid()) { - delete self; - self = NULL; - } - return self; -} - -//creates an entry and exit trigger based on the aCoordinate and -//aRadius values passed as argument -void QGeoAreaMonitorS60::setMonitoredArea(const QGeoCoordinate & aCoordinate, qreal aRadius) -{ - TCoordinate coord; - - TInt ret1 = QCoordinateToTCoordinate(aCoordinate, coord); - - TInt ret2 = iTriggerCreateAO->getRadius(aRadius); - - if (ret2 == KErrNone) - QGeoAreaMonitor::setRadius(aRadius); - - if ((ret1 != KErrNone) || (ret2 != KErrNone)) - return; - - //Initialize the trigger and enable the trigger if atleast one slot is connected to the areaEntered - //signal - if ((iTriggerCreateAO->InitializeTrigger(this, EntryTrigger, coord, aRadius)) && - (receivers(SIGNAL(areaEntered(const QGeoPositionInfo&))) > 0)) { - iTriggerCreateAO->SetTriggerState(this, EntryTrigger, true); - iTriggerAO->NotifyFiredEvent(); - } - - //Initialize the trigger and enable the trigger if atleast one slot is connected to the areaExited - //signal - if ((iTriggerCreateAO->InitializeTrigger(this, ExitTrigger, coord, aRadius)) && - (receivers(SIGNAL(areaExited(const QGeoPositionInfo&))) > 0)) { - iTriggerCreateAO->SetTriggerState(this, ExitTrigger, true); - iTriggerAO->NotifyFiredEvent(); - } - - //request for the trigger change notification events - iNotifyTriggerAO->NotifyChangeEvent(); -} - -//virtual function sets the Center of the monitoring area to coordinate -void QGeoAreaMonitorS60::setCenter(const QGeoCoordinate& coordinate) -{ - if (coordinate.isValid()) - QGeoAreaMonitor::setCenter(coordinate); - else - return; - - if (QGeoAreaMonitor::radius() != 0) //if radius is not initialised - setMonitoredArea(coordinate, QGeoAreaMonitor::radius()); -} - -//virtual function sets the radius of the monitorijng area to the radius -void QGeoAreaMonitorS60::setRadius(qreal radius) -{ - setMonitoredArea(QGeoAreaMonitor::center(), radius); -} - -//callback from the QMLBackendMonitorAO object for the entry/exit event -void QGeoAreaMonitorS60::handleTriggerEvent(TPositionInfo aPosInfo, enTriggerType aStatus) -{ - QGeoPositionInfo posInfo; - - TPositionInfoToQGeoPositionInfo(aPosInfo, posInfo); - - if (!posInfo.isValid()) - return; - - switch (aStatus) { - case EntryTrigger : //emit areaEntered trigger - emit areaEntered(posInfo); - break; - case ExitTrigger : //emit areaExited trigger - emit areaExited(posInfo); - break; - case NotifyChangesTrigger: - case InvalidTrigger: - break; - } - -} - - - -//destructor cleaning up the resources -QGeoAreaMonitorS60::~QGeoAreaMonitorS60() -{ - - if (iTriggerAO || iNotifyTriggerAO || iTriggerCreateAO) { - QMLBackendMonitorAO::DeleteAO(this); - iTriggerAO = NULL; - QMLBackendTriggerChangeAO::DeleteAO(); - iNotifyTriggerAO = NULL; - delete iTriggerCreateAO; - iTriggerCreateAO = NULL; - } - if (connectedLbt) { - --refCount; - if (refCount == 0) { - lbtServ.Close(); - } - } -} - -QGeoAreaMonitorS60* QGeoAreaMonitorS60::NewLC(QObject* aParent) -{ - QGeoAreaMonitorS60 *self = new(ELeave) QGeoAreaMonitorS60(aParent); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -//second level construction : creating the QMLBackendMonitorAO : for -//monitoring the trigger fired event,QMLBackendMonitorCreateTriggerAO: -//instance object for creating the trigger and QMLBackendTriggerChangeAO : -//for monitoring the changes to the trigger properties -void QGeoAreaMonitorS60::ConstructL() -{ - if (lbtServ.Connect() == KErrNone) { - CleanupClosePushL(lbtServ); - - connectedLbt = true; - ++refCount; - - iTriggerAO = QMLBackendMonitorAO::NewL(lbtServ); - - if (!iTriggerAO) - return; - - iTriggerCreateAO = QMLBackendMonitorCreateTriggerAO::NewL(this, lbtServ); - - if (!iTriggerCreateAO) - return; - - iNotifyTriggerAO = QMLBackendTriggerChangeAO::NewL(lbtServ); - - CleanupStack::Pop(1); - } else { - connectedLbt = false; - } -} - -//constructor initializing the default values -QGeoAreaMonitorS60::QGeoAreaMonitorS60(QObject* aParent) : QGeoAreaMonitor(aParent), - iTriggerAO(NULL), iNotifyTriggerAO(NULL) -{ - -} - -//convert a symbian-TPositionInfo value to corresponding QT-QGeoPositionInfo -void QGeoAreaMonitorS60::TPositionInfoToQGeoPositionInfo(TPositionInfo& aPosInfo, QGeoPositionInfo& aQInfo) -{ - QGeoCoordinate coord; - TPosition pos; - aPosInfo.GetPosition(pos); - - coord.setLatitude(pos.Latitude()); - coord.setLongitude(pos.Longitude()); - coord.setAltitude(pos.Altitude()); - - //store the QGeoCoordinate values - aQInfo.setCoordinate(coord); - - TDateTime datetime = pos.Time().DateTime(); - QDateTime dt(QDate(datetime.Year(), datetime.Month() + 1, datetime.Day() + 1), - QTime(datetime.Hour(), datetime.Minute(), datetime.Second(), - datetime.MicroSecond() / 1000), - Qt::UTC); - - //store the time stamp - aQInfo.setTimestamp(dt); - - //store the horizontal accuracy - aQInfo.setAttribute(QGeoPositionInfo::HorizontalAccuracy, pos.HorizontalAccuracy()); - - //store the vertical accuracy - aQInfo.setAttribute(QGeoPositionInfo::VerticalAccuracy, pos.VerticalAccuracy()); - -} - - -//convert QT-QCoordinate value to Symbian-TCoordinate value -int QGeoAreaMonitorS60::QCoordinateToTCoordinate(const QGeoCoordinate& aQCoord, TCoordinate& aTCoord) -{ - if (!aQCoord.isValid()) - return KErrGeneral; - - QGeoAreaMonitor::setCenter(aQCoord); - aTCoord.SetCoordinate(aQCoord.latitude(), aQCoord.longitude(), aQCoord.altitude()); - return KErrNone; -} - -//Notification called when a sot is connected to the areaEntered or -//areaExited signal -void QGeoAreaMonitorS60::connectNotify(const char* signal) -{ - if ((iTriggerCreateAO->isTriggerInitialized(this, EntryTrigger)) && (QLatin1String(signal) == SIGNAL(areaEntered(QGeoPositionInfo))) && (receivers(SIGNAL(areaEntered(const QGeoPositionInfo&))) <= 1)) { - iTriggerCreateAO->SetTriggerState(this, EntryTrigger, true); - iTriggerAO-> NotifyFiredEvent(); - } - - if ((iTriggerCreateAO->isTriggerInitialized(this, ExitTrigger)) && (QLatin1String(signal) == SIGNAL(areaExited(QGeoPositionInfo))) && (receivers(SIGNAL(areaExited(const QGeoPositionInfo&))) <= 1)) { - iTriggerCreateAO->SetTriggerState(this, ExitTrigger, true); - iTriggerAO-> NotifyFiredEvent(); - } -} - -//Notification called when a sot is disconnected from the areaEntered or -//areaExited signal -void QGeoAreaMonitorS60::disconnectNotify(const char* signal) -{ - // Disable the trigger, if no slot connected to signal - if ((iTriggerCreateAO->isTriggerInitialized(this, EntryTrigger)) && (QLatin1String(signal) == SIGNAL(areaEntered(QGeoPositionInfo))) && (receivers(SIGNAL(areaEntered(const QGeoPositionInfo&))) == 0)) { - // iEnterTrigger->NotifyFiredEvent (FALSE); - iTriggerCreateAO->SetTriggerState(this, EntryTrigger, FALSE); - } - - if ((iTriggerCreateAO->isTriggerInitialized(this, ExitTrigger)) && (QLatin1String(signal) == SIGNAL(areaExited(QGeoPositionInfo))) && (receivers(SIGNAL(areaExited(const QGeoPositionInfo&))) == 0)) { - // iExitTrigger->NotifyFiredEvent (FALSE); - iTriggerCreateAO->SetTriggerState(this, ExitTrigger, FALSE); - } -} - -QT_END_NAMESPACE - diff --git a/src/location/qgeopositioninfosource.cpp b/src/location/qgeopositioninfosource.cpp index ceeb4265..4b8e1acb 100644 --- a/src/location/qgeopositioninfosource.cpp +++ b/src/location/qgeopositioninfosource.cpp @@ -48,9 +48,7 @@ #include <QCryptographicHash> #include <QtCore/private/qfactoryloader_p.h> -#if defined(Q_OS_SYMBIAN) -# include "qgeopositioninfosource_s60_p.h" -#elif defined(QT_SIMULATOR) +#if defined(QT_SIMULATOR) # include "qgeopositioninfosource_simulator_p.h" #elif defined(Q_OS_WINCE) # include "qgeopositioninfosource_wince_p.h" @@ -115,10 +113,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, \warning On Windows CE it is not possible to detect if a device is GPS enabled. The default position source on a Windows CE device without GPS support will never provide any position data. - - \warning On Symbian it is currently only possible to instantiate and use the position sources in the main thread - of the application. - */ /*! @@ -368,9 +362,6 @@ QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSource::preferredPosi Returns 0 if the system has no default position source and no valid plugins could be found. - - Note: Symbian applications will need to have the Location capability - otherwise this will return 0. */ QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(QObject *parent) @@ -386,12 +377,7 @@ QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(QObject *par } } -#if defined(Q_OS_SYMBIAN) - QGeoPositionInfoSource *ret = NULL; - TRAPD(error, QT_TRYCATCH_LEAVING(ret = CQGeoPositionInfoSourceS60::NewL(parent))); - if (error == KErrNone) - return ret; -#elif defined(QT_SIMULATOR) +#if defined(QT_SIMULATOR) return new QGeoPositionInfoSourceSimulator(parent); #elif defined(Q_OS_WINCE) return new QGeoPositionInfoSourceWinCE(parent); diff --git a/src/location/qgeopositioninfosource_s60.cpp b/src/location/qgeopositioninfosource_s60.cpp deleted file mode 100644 index 95d398c2..00000000 --- a/src/location/qgeopositioninfosource_s60.cpp +++ /dev/null @@ -1,963 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QObject> -#include <QDateTime> -#include <QDebug> -#include <limits.h> -#include "qgeopositioninfosource_s60_p.h" -#include "qgeopositioninfosource.h" -#include "qmlbackendao_s60_p.h" - - - -QT_BEGIN_NAMESPACE - -// constructor -CQGeoPositionInfoSourceS60::CQGeoPositionInfoSourceS60(QObject* aParent) : QGeoPositionInfoSource(aParent), - mCurrentModuleId(TUid::Null()), - mReqModuleId(TUid::Null()), - mDevStatusUpdateAO(NULL), - mReqUpdateAO(NULL), - mRegUpdateAO(NULL), - mSupportedMethods(PositioningMethod(0)), - mCurrentMethod(PositioningMethod(0)), - mListSize(0), - mMinUpdateInterval(100), - mStartUpdates(FALSE), - mRegularUpdateTimedOut(FALSE), - mUpdateIntervalSet(FALSE), - mModuleFlags(0) -{ - memset(mList, 0 , MAX_SIZE * sizeof(CPosMethodInfo)); -} - -// destructor -CQGeoPositionInfoSourceS60::~CQGeoPositionInfoSourceS60() -{ - if (mReqUpdateAO) - delete mReqUpdateAO; - - if (mRegUpdateAO) - delete mRegUpdateAO; - - if (mDevStatusUpdateAO) - delete mDevStatusUpdateAO; - - -} - -// static function NewLC -CQGeoPositionInfoSourceS60* CQGeoPositionInfoSourceS60::NewLC(QObject* aParent) -{ - CQGeoPositionInfoSourceS60* self = - new(ELeave) CQGeoPositionInfoSourceS60(aParent); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -// static function NewL -CQGeoPositionInfoSourceS60* CQGeoPositionInfoSourceS60::NewL(QObject * aParent) -{ - RProcess thisProcess; - if (!thisProcess.HasCapability(ECapabilityLocation)) { - qWarning() << "QGeoPositionInfoSource::createDefaultSource() requires the Symbian Location capability to succeed on the Symbian platform."; - return 0; - } - - CQGeoPositionInfoSourceS60* self = CQGeoPositionInfoSourceS60::NewLC(aParent); - CleanupStack::Pop(); - - //check if the second phase construction is successful - // commented to return the pointer and the application can check if it - //is valid or not - /* if (!self->isValid()) { - delete self; - self = NULL; - }*/ - - return self; -} - -// 2nd phase constructor -void CQGeoPositionInfoSourceS60::ConstructL() -{ - TInt error = mPositionServer.Connect(); - - if (error == KErrNone) { - CleanupClosePushL(mPositionServer); - - mDevStatusUpdateAO = CQMLBackendAO::NewL(this, DeviceStatus); - - if (mDevStatusUpdateAO == NULL) { - CleanupStack::Pop(1); - - return; - } - - //update the list array with the available method initially - updateDeviceStatus(); - - // Set the PreferredPositioningMethods based on Supported methods - QGeoPositionInfoSource::setPreferredPositioningMethods(mSupportedMethods); - - //devStatusUpdateAO->NotifyDeviceStatus(mStatusEvent); - - CleanupStack::PushL(mDevStatusUpdateAO); - - if (mCurrentModuleId != TUid::Null()) { - mRegUpdateAO = CQMLBackendAO::NewL(this, RegularUpdate, mCurrentModuleId); - mRegUpdateAO->setUpdateInterval(updateInterval()); - } - CleanupStack::Pop(2); - } - -} - -QGeoPositionInfo CQGeoPositionInfoSourceS60::lastKnownPosition(bool aFromSatellitePositioningMethodsOnly) const -{ - - QGeoPositionInfo posUpdate; - TPosition pos; - TInt error = KErrNone; - RPositioner iLastKnownpositioner; - TRequestStatus status; - - error = iLastKnownpositioner.Open(*const_cast<RPositionServer*>(&mPositionServer)); - //request for lastknown position update and wait for the request to complete - if (error == KErrNone) { - - TPositionInfo posInfo; - - iLastKnownpositioner.SetRequestor(CRequestor::ERequestorService , - CRequestor::EFormatApplication, _L("QTmobility_Location")); - - - iLastKnownpositioner.GetLastKnownPosition(posInfo, status); - - User::WaitForRequest(status); - - error = status.Int(); - - iLastKnownpositioner.Close(); - - if ((error == KErrNone) || (error == KPositionPartialUpdate)) { - - TPositionModuleInfo modInfo; - mPositionServer.GetModuleInfoById(posInfo.ModuleId(), modInfo); - - if (!aFromSatellitePositioningMethodsOnly || (aFromSatellitePositioningMethodsOnly && (modInfo.Capabilities() & TPositionModuleInfo::ECapabilitySatellite))) { - QGeoCoordinate coord; - - posInfo.GetPosition(pos); - - coord.setLatitude(pos.Latitude()); - coord.setLongitude(pos.Longitude()); - coord.setAltitude(pos.Altitude()); - - //store the QGeoCoordinate values - posUpdate.setCoordinate(coord); - - TDateTime datetime = pos.Time().DateTime(); - QDateTime dt(QDate(datetime.Year(), datetime.Month() + 1, datetime.Day() + 1), - QTime(datetime.Hour(), datetime.Minute(), datetime.Second(), - datetime.MicroSecond() / 1000), - Qt::UTC); - - //store the time stamp - posUpdate.setTimestamp(dt); - - //store the horizontal accuracy - posUpdate.setAttribute(QGeoPositionInfo::HorizontalAccuracy, pos.HorizontalAccuracy()); - - //store the vertical accuracy - posUpdate.setAttribute(QGeoPositionInfo::VerticalAccuracy, pos.VerticalAccuracy()); - - } - } - } - - return posUpdate; -} - -// -int CQGeoPositionInfoSourceS60::minimumUpdateInterval() const -{ - if (mCurrentModuleId == TUid::Null()) - return 0; - - return mMinUpdateInterval; -} - - - -//private function : to derive the supported positioning methods -void CQGeoPositionInfoSourceS60::updateAvailableTypes() -{ - PositioningMethods types; - - for (TInt i = 0; i < mListSize ; i++) { - //check only for the available module without any device errors - if (mList[i].mIsAvailable && - (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown) && - (mList[i].mStatus != TPositionModuleStatus::EDeviceError)) { - types |= mList[i].mPosMethod; - - } - - //if both SatellitePositioningMethods and NonSatellitePositioningMethods return - if (types.testFlag(AllPositioningMethods)) - break; - } - - //update the supported methods based on types value, derived from the above steps - mSupportedMethods = types; -} - -//private function : to retrieve the index of the supplied module id from the mList array -TInt CQGeoPositionInfoSourceS60::checkModule(TPositionModuleId aId)//const -{ - - TInt i; - for (i = 0; i < mListSize; i++) - if (mList[i].mUid == aId) { - return i; - } - - return -1; -} - -//private function : get the index of the mList that supports the preferred method if -//available,else returns the index of the default module -TInt CQGeoPositionInfoSourceS60::getIndexPositionModule(TUint8 aBits, PositioningMethods aPosMethods) const -{ - TInt index, error; - - TPositionModuleId modID; - - //get the default module Id, whose index is returned if the preferred methods are not - //available - error = mPositionServer.GetDefaultModuleId(modID); - - if (error != KErrNone) - modID = TUid::Null(); - - //index = -1 : no methods available in the mList that supports preferred methods - index = -1; - - - for (TInt i = 0; i < mListSize ; i++) { - //check the module properties to select the preferred method,search should not - //not select an unavailable method,error device or index matching aLastIndex - if (mList[i].mIsAvailable && aPosMethods.testFlag(mList[i].mPosMethod) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceError) - && (((aBits >> i) & 1))) { - return i; - } - - //store the index of the default module - if ((modID == mList[i].mUid) && ((aBits >> i) & 1)) - index = i; - } - - - return index; -} - -//private function : to get the index of the positioning method with time to first fix -//lesser than timeout -TInt CQGeoPositionInfoSourceS60::getMoreAccurateMethod(TInt aTimeout, TUint8 aBits) -{ - TInt index = -1; - double temp = -1.0; - PositioningMethods posMethods; - TTimeIntervalMicroSeconds microSeconds; - - posMethods = preferredPositioningMethods(); - - //convert the timeout --> micro seconds - microSeconds = aTimeout * 1000; - - for (TInt i = 0 ; i < mListSize; i++) { - if (mList[i].mIsAvailable - && posMethods.testFlag(mList[i].mPosMethod) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceError) - && (((aBits >> i) & 1)) - && (mList[i].mTimeToFirstFix < microSeconds)) { - if ((temp == -1.0) || (mList[i].mHorizontalAccuracy < temp)) { - index = i; - temp = mList[i].mHorizontalAccuracy; - } - } - } - - if (index != -1) { - return index; - } - - bool minSet = false; - microSeconds = 0; - - for (TInt i = 0 ; i < mListSize; i++) { - if (mList[i].mIsAvailable - && posMethods.testFlag(mList[i].mPosMethod) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceError) - && (((aBits >> i) & 1))) { - if (!minSet || (mList[i].mTimeToFirstFix < microSeconds)) { - index = i; - minSet = true; - microSeconds = mList[i].mTimeToFirstFix; - } - } - } - - return index; -} - -//private function : to update the mList array -void CQGeoPositionInfoSourceS60::updateStatus(TPositionModuleInfo &aModInfo, TInt aStatus) -{ - - TInt i, index; - TPositionModuleId id; - PositioningMethod method; - TBool available; - TReal32 accuracy; - TTimeIntervalMicroSeconds time_to_first_fix, time_to_next_fix; - TPositionQuality quality; - CQMLBackendAO *temp = NULL; - - //query for the following parameters - id = aModInfo.ModuleId(); - - //module with a satellite capability is assumed to be provided satellite based positioning - //method - method = (aModInfo.Capabilities() & TPositionModuleInfo::ECapabilitySatellite) ? - SatellitePositioningMethods : NonSatellitePositioningMethods; - - //gets the device availability based on the user settings - available = aModInfo.IsAvailable(); - - //quality : holds the required metrics - aModInfo.GetPositionQuality(quality); - - //Accuracy - accuracy = quality.HorizontalAccuracy(); - - //time taken for the first fix - time_to_first_fix = quality.TimeToFirstFix(); - - //time taken for the subsequent fix - time_to_next_fix = quality.TimeToNextFix(); - - - - if ((i = checkModule(id)) == -1) { - //update the properties of the module - QMutexLocker lLocker(&m_mutex); - - //TPositionModuleId of the module - mList[mListSize].mUid = id; - - //positioning method method type - mList[mListSize].mPosMethod = method; - - //status of the device - mList[mListSize].mStatus = aStatus; - - //availablility of the module - mList[mListSize].mIsAvailable = available; - - //horizontal accuracy of the module - mList[mListSize].mHorizontalAccuracy = accuracy; - - //time required to get the first fix - mList[mListSize].mTimeToFirstFix = time_to_first_fix; - - //time required for subsequent fix - mList[mListSize].mTimeToNextFix = time_to_next_fix; - - //count on the mList array size - mListSize++; - - //update the supported source types based on the device status - updateAvailableTypes(); - - //store the correct method in use from the mCurrentModuleId retireved earlier - if (id == mCurrentModuleId) { - mCurrentMethod = method; - mMinUpdateInterval = mList[mListSize-1].mTimeToNextFix.Int64() / 1000; - } - lLocker.unlock(); - } else { - - QMutexLocker lLocker(&m_mutex); - //module's status has changed - if (mList[i].mStatus != aStatus) - mList[i].mStatus = aStatus; - - //module's availability has changed - if (mList[i].mIsAvailable != available) - mList[i].mIsAvailable = available; - - //module's horizontal accuracy has changed - if (mList[i].mHorizontalAccuracy != accuracy) - mList[i].mHorizontalAccuracy = accuracy; - - //module's time to first fix has changed - if (mList[i].mTimeToFirstFix != time_to_first_fix) - mList[i].mTimeToFirstFix = time_to_first_fix; - - //module's time to subsequent fix has changed - if (mList[i].mTimeToNextFix != time_to_next_fix) - mList[i].mTimeToFirstFix = time_to_next_fix; - - //update the supported source types based on the device status - updateAvailableTypes(); - - lLocker.unlock(); - - //if the mCurrentModuleId is NULL, try updating the reg update with the available - //positioning method - if (mCurrentModuleId == TUid::Null() && (available == TRUE) && - (aStatus != TPositionModuleStatus::EDeviceUnknown) && - (aStatus != TPositionModuleStatus::EDeviceError)) { - TInt interval; - - interval = QGeoPositionInfoSource::updateInterval(); - - TRAPD(ret, QT_TRYCATCH_LEAVING(temp = CQMLBackendAO::NewL(this, RegularUpdate, - mList[i].mUid))); - - QMutexLocker lRegLocker_interval(&m_mutex_interval); - mMinUpdateInterval = interval; - lRegLocker_interval.unlock(); - - if ((ret == KErrNone) && (temp != NULL)) { - temp->setUpdateInterval(interval); - - QMutexLocker lRegLocker(&m_mutex_RegUpAO); - if (mRegUpdateAO) - delete mRegUpdateAO; - mRegUpdateAO = temp; - lRegLocker.unlock(); - - //to be uncommented when startUpdates are done - - if (mStartUpdates) - mRegUpdateAO->startUpdates(); - - QMutexLocker lRegLocker_interval1(&m_mutex_interval); - mCurrentModuleId = mList[i].mUid; - mMinUpdateInterval = mList[i].mTimeToNextFix.Int64() / 1000; - - mCurrentMethod = mList[i].mPosMethod; - lRegLocker_interval1.unlock(); - - } - } - - //check if the status of the currently used modules for regular update or - //request update has changed - if (((id == mCurrentModuleId) || (id == mReqModuleId)) && - ((aStatus == TPositionModuleStatus::EDeviceUnknown) || - (aStatus == TPositionModuleStatus::EDeviceError) || - (available == FALSE))) { - //if the change happened for regular update - if (id == mCurrentModuleId) { - TInt interval; - - TUint8 bits; - - interval = QGeoPositionInfoSource::updateInterval(); - - QMutexLocker lRegLocker1(&m_mutex_RegUpAO); - if (mRegUpdateAO) - delete mRegUpdateAO; - lRegLocker1.unlock(); - - bits = mModuleFlags; - - do { - //error = Get the index of the positioning module based on - //the preferred method if available , else get the default - //position module - index = getIndexPositionModule(bits); - - if (index >= 0) { - TRAPD(ret, QT_TRYCATCH_LEAVING(temp = CQMLBackendAO::NewL(this, RegularUpdate, - mList[index].mUid))); - - if ((ret == KErrNone) && (temp != NULL)) - break; - - bits = bits & (0XFF ^(1 << index)); - } - } while (index >= 0); - - - if (temp != NULL) { - //successful in creating the subsession for the required - //method - - QMutexLocker lRegLocker2(&m_mutex_RegUpAO); - mRegUpdateAO = temp; - lRegLocker2.unlock(); - - QMutexLocker lRegLocker_interval2(&m_mutex_interval); - mCurrentModuleId = mList[index].mUid; - mCurrentMethod = mList[index].mPosMethod; - mMinUpdateInterval = mList[index].mTimeToNextFix.Int64() / 1000; - lRegLocker_interval2.unlock(); - - mRegUpdateAO->setUpdateInterval(interval); - - //to be uncommented when startUpdates are done - - if (mStartUpdates) - mRegUpdateAO->startUpdates(); - - } else { - //no methods available,clean up the resources - QMutexLocker lRegLocker3(&m_mutex_RegUpAO); - mRegUpdateAO = NULL; - lRegLocker3.unlock(); - - QMutexLocker lRegLocker_interval3(&m_mutex_interval); - mCurrentModuleId = TUid::Null(); - mMinUpdateInterval = interval; - mCurrentMethod = PositioningMethod(0); - lRegLocker_interval3.unlock(); - - emit updateTimeout(); - } - - } - - //check if device status of the request update module changed - if (id == mReqModuleId) { - QMutexLocker lReqLocker(&m_mutex_ReqUpAO); - if (mRegUpdateAO) - delete mReqUpdateAO; - mReqUpdateAO = NULL; - mReqModuleId = TUid::Null(); - lReqLocker.unlock(); - - emit updateTimeout(); - } - - } - - } //end else - -} - - -// Notification methods from active object. Notifies device status changes -void CQGeoPositionInfoSourceS60::updateDeviceStatus(void) -{ - TPositionModuleStatus moduleStatus; - TPositionModuleInfo moduleInfo; - TInt error; - - //mListSize = 0 : called updateDeviceStatus() first time to initialise the array - if (mListSize == 0) { - TUint modCount; - - //count on the modules currently supported by the device - mPositionServer.GetNumModules(modCount); - - //module ID of the default module - error = mPositionServer.GetDefaultModuleId(mCurrentModuleId); - - if (error != KErrNone) - mCurrentModuleId = TUid::Null(); - - for (TUint i = 0; i < modCount; i++) { - //get module information - mPositionServer.GetModuleInfoByIndex(i, moduleInfo); - - //get module status - mPositionServer.GetModuleStatus(moduleStatus, moduleInfo.ModuleId()); - - //update the properties of the module in the mList array - updateStatus(moduleInfo, moduleStatus.DeviceStatus()); - - mModuleFlags |= (1 << i); - } - } else { - //UpdateDeviceStatus() called after registering for NotifyModuleStatusEvent - - //get the module id from the status event - TPositionModuleId id = mStatusEvent.ModuleId(); - - //get module information - mPositionServer.GetModuleInfoById(id, moduleInfo); - - //get current status of the module - mStatusEvent.GetModuleStatus(moduleStatus); - - //update the properties of the module in the mList array - updateStatus(moduleInfo, moduleStatus.DeviceStatus()); - - - } - - //register for next NotifyModuleStatusEvent - mDevStatusUpdateAO->notifyDeviceStatus(mStatusEvent); - -} - -// -void CQGeoPositionInfoSourceS60::TPositionInfo2QGeoPositionInfo( - HPositionGenericInfo *aPosInfo1, QGeoPositionInfo& aPosInfo2) -{ - TPosition pos; - QGeoCoordinate coord; - float val; - - aPosInfo1->GetPosition(pos); - - - coord.setLatitude(pos.Latitude()); - coord.setLongitude(pos.Longitude()); - coord.setAltitude(pos.Altitude()); - - //store the QGeoCoordinate values - aPosInfo2.setCoordinate(coord); - - TDateTime datetime = pos.Time().DateTime(); - QDateTime dt(QDate(datetime.Year() , datetime.Month() + 1, datetime.Day() + 1), - QTime(datetime.Hour() , datetime.Minute(), datetime.Second(), - datetime.MicroSecond() / 1000), - Qt::UTC); - - //store the time stamp - aPosInfo2.setTimestamp(dt); - - //store the horizontal accuracy - aPosInfo2.setAttribute(QGeoPositionInfo::HorizontalAccuracy, pos.HorizontalAccuracy()); - - //store the vertical accuracy - aPosInfo2.setAttribute(QGeoPositionInfo::VerticalAccuracy, pos.VerticalAccuracy()); - - //check for the horizontal speed - if (aPosInfo1->IsFieldAvailable(EPositionFieldHorizontalSpeed)) { - aPosInfo1->GetValue(EPositionFieldHorizontalSpeed, val); - aPosInfo2.setAttribute(QGeoPositionInfo::GroundSpeed, val); - } - - //check for the vertcal speed - if (aPosInfo1->IsFieldAvailable(EPositionFieldVerticalSpeed)) { - aPosInfo1->GetValue(EPositionFieldVerticalSpeed, val); - aPosInfo2.setAttribute(QGeoPositionInfo::VerticalSpeed, val); - } - - //check for the magnetic variation - if (aPosInfo1->IsFieldAvailable(EPositionFieldMagneticCourseError)) { - aPosInfo1->GetValue(EPositionFieldMagneticCourseError, val); - aPosInfo2.setAttribute(QGeoPositionInfo::MagneticVariation, val); - } - - //check for the heading - if (aPosInfo1->IsFieldAvailable(EPositionFieldHeading)) { - aPosInfo1->GetValue(EPositionFieldHeading, val); - aPosInfo2.setAttribute(QGeoPositionInfo::Direction, val); - } -} -// -void CQGeoPositionInfoSourceS60::updatePosition(HPositionGenericInfo *aPosInfo, int aError) -{ - QGeoPositionInfo posInfo; - - if (aError == KErrNone && aPosInfo) { - //fill posUpdate - TPositionInfo2QGeoPositionInfo(aPosInfo, posInfo); - - mRegularUpdateTimedOut = false; - - //emit posUpdate - emit positionUpdated(posInfo); - } else if (aError == KErrTimedOut) { - //request has timed out - if (mStartUpdates) { - if (!mRegularUpdateTimedOut) { - mRegularUpdateTimedOut = true; - emit updateTimeout(); - } - } else { - emit updateTimeout(); - } - } else { - //posiitoning module is unable to return any position information - emit updateTimeout(); - } -} - -// Returns the PositionServer handle -RPositionServer& CQGeoPositionInfoSourceS60:: getPositionServer() -{ - return mPositionServer; -} - - -// for request update -void CQGeoPositionInfoSourceS60::requestUpdate(int aTimeout) -{ - TInt index = -1; - TUint8 bits; - - CQMLBackendAO *temp = NULL; - - if (mRegUpdateAO == NULL || mCurrentModuleId == TUid::Null()) { - emit updateTimeout(); - return; - } - - //return if already a request update is pending - if (mReqUpdateAO && mReqUpdateAO->isRequestPending()) - return; - - if (aTimeout < 0 || (aTimeout != 0 && aTimeout < minimumUpdateInterval())) { - emit updateTimeout(); - return; - } - - if (aTimeout == 0) - aTimeout = 20000; - - bits = mModuleFlags; - - do { - - //index of the more accurate method in the array - index = getMoreAccurateMethod(aTimeout, bits); - - //no positioning method method available : emit updateTimeout - if (index < 0) { - emit updateTimeout(); - break; - } - //if the selected module for request update is same as the previous one reuse the request - if (mList[index].mUid == mReqModuleId) { - if (mReqUpdateAO) { - mReqUpdateAO->requestUpdate(aTimeout); - return; - } - } - - TRAPD(ret, QT_TRYCATCH_LEAVING(temp = CQMLBackendAO::NewL(this, OnceUpdate, mList[index].mUid))); - - if ((ret == KErrNone) && (temp != NULL)) { - QMutexLocker lReqLocker(&m_mutex_ReqUpAO); - //delete the old reqest update - if (mReqUpdateAO) - delete mReqUpdateAO; - - //set the requestAO to the newly created AO - mReqUpdateAO = temp; - //set the request module ID - mReqModuleId = mList[index].mUid; - lReqLocker.unlock(); - - //start the update - mReqUpdateAO->requestUpdate(aTimeout); - - return; - } - - bits = bits & (0XFF ^(1 << index)); - - } while (index >= 0); - - //cleanup resources if the invalid requpdate is still stored - if (mReqUpdateAO) { - QMutexLocker lReqLocker(&m_mutex_ReqUpAO); - delete mReqUpdateAO; - mReqUpdateAO = NULL; - mReqModuleId = TUid::Null(); - lReqLocker.unlock(); - } - -} - -// starts the regular updates -void CQGeoPositionInfoSourceS60::startUpdates() -{ - //SetUpdateInterval if it is not already set from application - if (!mUpdateIntervalSet) - setUpdateInterval(1000); - - if (mRegUpdateAO == NULL || mCurrentModuleId == TUid::Null()) { - emit updateTimeout(); - return; - } - - if (receivers(SIGNAL(positionUpdated(QGeoPositionInfo))) > 0 && !mStartUpdates) - mRegUpdateAO->startUpdates(); - mRegularUpdateTimedOut = false; - mStartUpdates = true; -} - -// stops the regular updates -void CQGeoPositionInfoSourceS60::stopUpdates() -{ - mStartUpdates = false; - - if (mRegUpdateAO == NULL || mCurrentModuleId == TUid::Null()) { - emit updateTimeout(); - return; - } - - mRegUpdateAO->cancelUpdate(); -} - -void CQGeoPositionInfoSourceS60::setPreferredPositioningMethods(PositioningMethods aMethods) -{ - - - QGeoPositionInfoSource::setPreferredPositioningMethods(aMethods); - - PositioningMethods preferredMethod(PositioningMethods(0)); - TInt index = -1; - // the poistioning methods are not supported - // if the preferred positioning method is the current poistioning - - if (!(mSupportedMethods & aMethods) || (aMethods == PositioningMethods(AllPositioningMethods)) || - (aMethods == PositioningMethods(mCurrentMethod))) - - return; - - //TPositionModuleId moduleId = getPreferredPoistionModuleId(methods); - - //if(moduleId == TUid::Null()) - //return; - CQMLBackendAO *temp = NULL; - TUint8 bits; - bits = mModuleFlags; - do { - //index = Get the index of the positioning module based on - //the preferred method if available , else get the default - //position module - index = getIndexPositionModule(bits, aMethods); - - if (index == -1) - return; - - if (index >= 0) { - - TRAPD(error, QT_TRYCATCH_LEAVING(temp = CQMLBackendAO::NewL(this, RegularUpdate, - mList[index].mUid))); - if ((temp != NULL) && (error == KErrNone)) - break; - - bits = bits & (0XFF ^(1 << index)); - } - } while (index >= 0); - - - - if (temp != NULL) { - // this is needed as the previous setupdateinterval value should not be lost - int updateInterval = QGeoPositionInfoSource::updateInterval(); - QMutexLocker lRegLocker(&m_mutex_RegUpAO); - if (mRegUpdateAO) - delete mRegUpdateAO; - mRegUpdateAO = temp; - - mCurrentModuleId = mList[index].mUid ; - lRegLocker.unlock(); - - index = checkModule(mCurrentModuleId); - - if (index >= 0 && index < mListSize) { - QMutexLocker lRegLocker_interval(&m_mutex_interval); - mCurrentMethod = mList[index].mPosMethod ; - mMinUpdateInterval = mList[index].mTimeToNextFix.Int64() / 1000; - lRegLocker_interval.unlock(); - } - - int value = mRegUpdateAO->setUpdateInterval(updateInterval); - //as the positioning module has changed, - //possibility of the minimumupdateinterval being changed - if (value != updateInterval) - QGeoPositionInfoSource::setUpdateInterval(value); - - } - -} - -void CQGeoPositionInfoSourceS60::setUpdateInterval(int aMilliSec) -{ - - - if (mRegUpdateAO) { - int interval = mRegUpdateAO->setUpdateInterval(aMilliSec); - // as the above set value can be minimum value so - // assigning to the base class data member - QGeoPositionInfoSource::setUpdateInterval(interval); - - mUpdateIntervalSet = true; - } -} - -void CQGeoPositionInfoSourceS60::connectNotify(const char *aSignal) -{ - // start update if it already connected - if (mStartUpdates && mRegUpdateAO && QLatin1String(aSignal) == SIGNAL(positionUpdated(QGeoPositionInfo))) - mRegUpdateAO->startUpdates(); - -} - -void CQGeoPositionInfoSourceS60::disconnectNotify(const char *aSignal) -{ - // Cancel updates if slot is disconnected for the positionUpdate() signal. - - if ((mRegUpdateAO) && (QLatin1String(aSignal) == SIGNAL(positionUpdated(QGeoPositionInfo))) && receivers(SIGNAL(positionUpdated(QGeoPositionInfo))) == 0) - mRegUpdateAO->cancelUpdate(); - -} - -QT_END_NAMESPACE diff --git a/src/location/qgeosatelliteinfosource.cpp b/src/location/qgeosatelliteinfosource.cpp index 69a72a1f..b7a586df 100644 --- a/src/location/qgeosatelliteinfosource.cpp +++ b/src/location/qgeosatelliteinfosource.cpp @@ -47,9 +47,7 @@ #include <QtCore/private/qfactoryloader_p.h> #include <QFile> -#if defined(Q_OS_SYMBIAN) -# include "qgeosatelliteinfosource_s60_p.h" -#elif defined(QT_SIMULATOR) +#if defined(QT_SIMULATOR) # include "qgeosatelliteinfosource_simulator_p.h" #elif defined(Q_OS_WINCE) # include "qgeosatelliteinfosource_wince_p.h" @@ -241,9 +239,6 @@ void QGeoSatelliteInfoSourcePrivate::loadStaticPlugins(QHash<QString, QGeoPositi \warning On Windows CE it is not possible to detect if a device is GPS enabled. The default satellite source on a Windows CE device without GPS support will never provide any satellite data. - - \warning On Symbian it is currently only possible to instantiate and use the satellite sources in the main thread - of the application. */ /*! @@ -261,9 +256,6 @@ QGeoSatelliteInfoSource::QGeoSatelliteInfoSource(QObject *parent) Returns 0 if the system has no default source and no valid plugins could be found. - - Note: Symbian applications will need to have the Location capability - otherwise this will return 0. */ QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *parent) { @@ -278,12 +270,7 @@ QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *p } } -#if defined(Q_OS_SYMBIAN) - CQGeoSatelliteInfoSourceS60 *ret = NULL; - TRAPD(error, QT_TRYCATCH_LEAVING(ret = CQGeoSatelliteInfoSourceS60::NewL(parent))); - if (error == KErrNone) - return ret; -#elif defined(Q_OS_WINCE) +#if defined(Q_OS_WINCE) return new QGeoSatelliteInfoSourceWinCE(parent); #elif (defined(Q_WS_MAEMO_6)) || (defined(Q_WS_MAEMO_5)) QGeoSatelliteInfoSourceMaemo *source = new QGeoSatelliteInfoSourceMaemo(parent); diff --git a/src/location/qgeosatelliteinfosource_s60.cpp b/src/location/qgeosatelliteinfosource_s60.cpp deleted file mode 100644 index 5df2e36e..00000000 --- a/src/location/qgeosatelliteinfosource_s60.cpp +++ /dev/null @@ -1,708 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QObject> -#include <QDateTime> -#include <QDebug> -#include <limits.h> -#include "qgeopositioninfosource_s60_p.h" -#include "qgeosatelliteinfosource_s60_p.h" -#include "qgeosatelliteinfosource.h" -#include "qgeosatelliteinfo.h" - -#include <QList> - -QT_BEGIN_NAMESPACE - -// constructor -CQGeoSatelliteInfoSourceS60::CQGeoSatelliteInfoSourceS60(QObject* aParent) : QGeoSatelliteInfoSource(aParent), - mCurrentModuleId(TUid::Null()), - mReqModuleId(TUid::Null()), - mDevStatusUpdateAO(NULL), - mReqUpdateAO(NULL), - mRegUpdateAO(NULL), - mListSize(0), - mMinUpdateInterval(0), - mStartUpdates(FALSE), - mModuleFlags(0) -{ - memset(mList, 0 , MAX_SIZE * sizeof(CSatMethodInfo)); -} - -// destructor -CQGeoSatelliteInfoSourceS60::~CQGeoSatelliteInfoSourceS60() -{ - if (mReqUpdateAO) - delete mReqUpdateAO; - - if (mRegUpdateAO) - delete mRegUpdateAO; - - if (mDevStatusUpdateAO) - delete mDevStatusUpdateAO; -} - -// static function NewLC -CQGeoSatelliteInfoSourceS60* CQGeoSatelliteInfoSourceS60::NewLC(QObject* aParent) -{ - CQGeoSatelliteInfoSourceS60* self = - new(ELeave) CQGeoSatelliteInfoSourceS60(aParent); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -// static function NewL -CQGeoSatelliteInfoSourceS60* CQGeoSatelliteInfoSourceS60::NewL(QObject * aParent) -{ - RProcess thisProcess; - if (!thisProcess.HasCapability(ECapabilityLocation)) { - qWarning() << "QGeoSatelliteInfoSource::createDefaultSource() requires the Symbian Location capability to succeed on the Symbian platform."; - return 0; - } - - CQGeoSatelliteInfoSourceS60* self = CQGeoSatelliteInfoSourceS60::NewLC(aParent); - CleanupStack::Pop(); - - //check if the second phase construction is successful - if (!self->isValid()) { - delete self; - self = NULL; - } - - return self; -} - -// 2nd phase constructor -void CQGeoSatelliteInfoSourceS60::ConstructL() -{ - TInt error = mPositionServer.Connect(); - - if (error == KErrNone) { - CleanupClosePushL(mPositionServer); - - mDevStatusUpdateAO = CQMLBackendAO::NewL(this, DeviceStatus); - - if (mDevStatusUpdateAO == NULL) { - CleanupStack::Pop(1); - - return; - } - - //update the list array with the available method initially - updateDeviceStatus(); - - CleanupStack::PushL(mDevStatusUpdateAO); - - /* - if(mCurrentModuleId != TUid::Null()) - mRegUpdateAO = CQMLBackendAOSatellite::NewL(this,RegularUpdate,mCurrentModuleId); - */ - TUint8 bits; - TInt index = -1; - - CQMLBackendAO *temp = NULL; - - bits = mModuleFlags; - - do { - //error = Get the index of the positioning module based on - //priority position module providing the satellite fix - index = getIndexPositionModule(bits); - - if (index >= 0) { - TRAPD(ret, QT_TRYCATCH_LEAVING(temp = CQMLBackendAO::NewL(this, RegularUpdate, - mList[index].mUid))); - - if ((ret == KErrNone) && (temp != NULL)) - break; - - bits = bits & (0XFF ^(1 << index)); - } - } while (index >= 0); - - if (index >= 0) { - mRegUpdateAO = temp; - mRegUpdateAO->setUpdateInterval(0); - mCurrentModuleId = mList[index].mUid; - } else { - delete temp; - } - - CleanupStack::Pop(2); - } - -} - -//private function : to retrieve the index of the supplied module id from the mList array -TInt CQGeoSatelliteInfoSourceS60::checkModule(TPositionModuleId aId)//const -{ - QMutexLocker locker(&m_mutex); - TInt i; - for (i = 0; i < mListSize; i++) - if (mList[i].mUid == aId) - return i; - return -1; -} - -// -int CQGeoSatelliteInfoSourceS60::minimumUpdateInterval() const -{ - if (mCurrentModuleId == TUid::Null()) - return 0; - - return mMinUpdateInterval; - - /*TInt i = checkModule(mCurrentModuleId); - if (i != -1) - return mList[i].mTimeToNextFix.Int64() / 1000; //divide by 1000, to convert microsecond to milisecond - return 0;*/ -} - -//private function : get the index of the mList that supports the preferred method if -//available,else returns the index of the default module -TInt CQGeoSatelliteInfoSourceS60::getIndexPositionModule(TUint8 aBits) const -{ - TInt index; - - TPositionModuleId modID = TUid::Null(); - - //index = -1 : no methods available in the mList that supports preferred methods - index = -1; - - for (TInt i = 0; i < mListSize ; i++) { - //check the module properties to select the preferred method,search should not - //not select an unavailable method,error device or index matching aLastIndex - if ((mList[i].mIsAvailable) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceError) - && (((aBits >> i) & 1))) { - return i; - } - } - - return index; -} - -//private function : to get the index of the positioning method with time to first fix -//lesser than timeout -TInt CQGeoSatelliteInfoSourceS60::getMoreAccurateMethod(TInt aTimeout, TUint8 aBits) -{ - TInt index = -1; - double temp = -1.0; - - TTimeIntervalMicroSeconds microSeconds; - - //convert the timeout --> micro seconds - microSeconds = aTimeout * 1000; - - if (microSeconds == 0) - microSeconds = INT_MAX; - - for (TInt i = 0 ; i < mListSize; i++) { - if (mList[i].mIsAvailable - && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceError) - && (((aBits >> i) & 1)) - && (mList[i].mTimeToFirstFix < microSeconds)) { - if ((temp == -1.0) || (mList[i].mHorizontalAccuracy < temp)) { - index = i; - temp = mList[i].mHorizontalAccuracy; - } - } - } - - if (index != -1) - return index; - - bool minSet = false; - microSeconds = 0; - - for (TInt i = 0 ; i < mListSize; i++) { - if (mList[i].mIsAvailable - && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown) - && (mList[i].mStatus != TPositionModuleStatus::EDeviceError) - && (((aBits >> i) & 1))) { - if (!minSet || (mList[i].mTimeToFirstFix < microSeconds)) { - index = i; - minSet = true; - microSeconds = mList[i].mTimeToFirstFix; - } - } - } - - return index; -} - -//private function : to update the mList array -void CQGeoSatelliteInfoSourceS60::updateStatus(TPositionModuleInfo &aModInfo, TInt aStatus) -{ - - TInt i, index; - TPositionModuleId id; - TBool available; - TReal32 accuracy; - TTimeIntervalMicroSeconds time_to_first_fix, time_to_next_fix; - TPositionQuality quality; - CQMLBackendAO *temp = NULL; - - //query for the following parameters - id = aModInfo.ModuleId(); - - //gets the device availability based on the user settings - available = aModInfo.IsAvailable(); - - //quality : holds the required metrics - aModInfo.GetPositionQuality(quality); - - //Accuracy - accuracy = quality.HorizontalAccuracy(); - - //time taken for the first fix - time_to_first_fix = quality.TimeToFirstFix(); - - //time taken for the subsequent fix - time_to_next_fix = quality.TimeToNextFix(); - - if ((i = checkModule(id)) == -1) { - //update the properties of the module - QMutexLocker lLocker(&m_mutex); - - //TPositionModuleId of the module - mList[mListSize].mUid = id; - - //status of the device - mList[mListSize].mStatus = aStatus; - - //availablility of the module - mList[mListSize].mIsAvailable = available; - - //horizontal accuracy of the module - mList[mListSize].mHorizontalAccuracy = accuracy; - - //time required to get the first fix - mList[mListSize].mTimeToFirstFix = time_to_first_fix; - - //time required for subsequent fix - mList[mListSize].mTimeToNextFix = time_to_next_fix; - - //count on the mList array size - mListSize++; - - mMinUpdateInterval = mList[mListSize-1].mTimeToNextFix.Int64() / 1000; - lLocker.unlock(); - } else { - - QMutexLocker lLocker(&m_mutex); - - //module's status has changed - if (mList[i].mStatus != aStatus) - mList[i].mStatus = aStatus; - - //module's availability has changed - if (mList[i].mIsAvailable != available) - mList[i].mIsAvailable = available; - - //module's horizontal accuracy has changed - if (mList[i].mHorizontalAccuracy != accuracy) - mList[i].mHorizontalAccuracy = accuracy; - - //module's time to first fix has changed - if (mList[i].mTimeToFirstFix != time_to_first_fix) - mList[i].mTimeToFirstFix = time_to_first_fix; - - //module's time to subsequent fix has changed - if (mList[i].mTimeToNextFix != time_to_next_fix) - mList[i].mTimeToFirstFix = time_to_next_fix; - - lLocker.unlock(); - - //if the mCurrentModuleId is NULL, try updating the reg update with the available - //positioning method - if (mCurrentModuleId == TUid::Null() && (available == TRUE) && - (aStatus != TPositionModuleStatus::EDeviceUnknown) && - (aStatus != TPositionModuleStatus::EDeviceError)) { - TInt interval = 0; - - TRAPD(ret, QT_TRYCATCH_LEAVING(temp = CQMLBackendAO::NewL(this, RegularUpdate, - mList[i].mUid))); - - if ((ret == KErrNone) && (temp != NULL)) { - temp->setUpdateInterval(interval); - - QMutexLocker lRegLocker(&m_mutex_RegUpAO); - if (mRegUpdateAO) - delete mRegUpdateAO; - mRegUpdateAO = temp; - - //to be uncommented when startUpdates are done - - if (mStartUpdates) - mRegUpdateAO->startUpdates(); - - - mCurrentModuleId = mList[i].mUid; - mMinUpdateInterval = mList[i].mTimeToNextFix.Int64() / 1000; - lRegLocker.unlock(); - - } - } - - //check if the status of the currently used modules for regular update or - //request update has changed - if (((id == mCurrentModuleId) || (id == mReqModuleId)) && - ((aStatus == TPositionModuleStatus::EDeviceUnknown) || - (aStatus == TPositionModuleStatus::EDeviceError) || - (available == FALSE))) { - //if the change happened for regular update - if (id == mCurrentModuleId) { - TInt interval = 0; - - TUint8 bits; - - QMutexLocker lRegLocker1(&m_mutex_RegUpAO); - if (mRegUpdateAO) - delete mRegUpdateAO; - lRegLocker1.unlock(); - - bits = mModuleFlags; - - do { - //error = Get the index of the positioning module based on - //priority position module providing the satellite fix - index = getIndexPositionModule(bits); - - if (index >= 0) { - TRAPD(ret, QT_TRYCATCH_LEAVING(temp = CQMLBackendAO::NewL(this, RegularUpdate, - mList[index].mUid))); - - if ((ret == KErrNone) && (temp != NULL)) - break; - - bits = bits & (0XFF ^(1 << index)); - } - } while (index >= 0); - - - if (temp != NULL) { - //successful in creating the subsession for the required - //method - QMutexLocker lRegLocker2(&m_mutex_RegUpAO); - mRegUpdateAO = temp; - - mCurrentModuleId = mList[index].mUid; - mMinUpdateInterval = mList[i].mTimeToNextFix.Int64() / 1000; - lRegLocker2.unlock(); - - mRegUpdateAO->setUpdateInterval(interval); - - if (mStartUpdates) - mRegUpdateAO->startUpdates(); - - } else { - //no methods available,clean up the resources - QMutexLocker lRegLocker3(&m_mutex_RegUpAO); - mRegUpdateAO = NULL; - mCurrentModuleId = TUid::Null(); - mMinUpdateInterval = interval; - lRegLocker3.unlock(); - } - - } - - //check if device status of the request update module changed - if (id == mReqModuleId) { - QMutexLocker lReqLocker(&m_mutex_ReqUpAO); - if (mRegUpdateAO) - delete mReqUpdateAO; - mReqUpdateAO = NULL; - mReqModuleId = TUid::Null(); - lReqLocker.unlock(); - emit requestTimeout(); - } - - } - - } //end else - -} - - -// Notification methods from active object. Notifies device status changes -void CQGeoSatelliteInfoSourceS60::updateDeviceStatus(void) -{ - TPositionModuleStatus moduleStatus; - TPositionModuleInfo moduleInfo; - - //mListSize = 0 : called updateDeviceStatus() first time to initialise the array - if (mListSize == 0) { - TUint modCount; - - //count on the modules currently supported by the device - mPositionServer.GetNumModules(modCount); - - for (TUint i = 0; i < modCount; i++) { - //get module information - mPositionServer.GetModuleInfoByIndex(i, moduleInfo); - - if (moduleInfo.Capabilities() & TPositionModuleInfo::ECapabilitySatellite) { - //get module status - mPositionServer.GetModuleStatus(moduleStatus, moduleInfo.ModuleId()); - - //update the properties of the module in the mList array - updateStatus(moduleInfo, moduleStatus.DeviceStatus()); - - mModuleFlags |= (1 << i); - } - } - } else { - //UpdateDeviceStatus() called afetr registering for NotifyModuleStatusEvent - - //get the module id from the status event - TPositionModuleId id = mStatusEvent.ModuleId(); - - //get module information - mPositionServer.GetModuleInfoById(id, moduleInfo); - - if (moduleInfo.Capabilities() & TPositionModuleInfo::ECapabilitySatellite) { - //get current status of the module - mStatusEvent.GetModuleStatus(moduleStatus); - - //update the properties of the module in the mList array - updateStatus(moduleInfo, moduleStatus.DeviceStatus()); - } - - } - - //register for next NotifyModuleStatusEvent - mDevStatusUpdateAO->notifyDeviceStatus(mStatusEvent); - -} - -// -void CQGeoSatelliteInfoSourceS60::TPositionSatelliteInfo2QGeoSatelliteInfo( - TPositionSatelliteInfo &aSatInfo, QList<QGeoSatelliteInfo> &qListSatInView, - QList<QGeoSatelliteInfo> &qListSatInUse) -{ - TInt satInView = aSatInfo.NumSatellitesInView(); - TSatelliteData satData; - QGeoSatelliteInfo qInfo; - - for (TInt i = 0; i < satInView; i++) { - aSatInfo.GetSatelliteData(i, satData); - qInfo.setSignalStrength(satData.SignalStrength()); - qInfo.setPrnNumber(satData.SatelliteId()); - qInfo.setAttribute(QGeoSatelliteInfo::Elevation, satData.Elevation()); - qInfo.setAttribute(QGeoSatelliteInfo::Azimuth, satData.Azimuth()); - if (satData.IsUsed() == TRUE) { - qListSatInUse.append(qInfo); - } - qListSatInView.append(qInfo); - } -} -// -void CQGeoSatelliteInfoSourceS60::updatePosition(TPositionSatelliteInfo &aSatInfo, - int aError, bool isStartUpdate) -{ - QList<QGeoSatelliteInfo> qListSatInUse; - QList<QGeoSatelliteInfo> qListSatInView; - if (aError == KErrNone) { - //fill posUpdate - TPositionSatelliteInfo2QGeoSatelliteInfo(aSatInfo, qListSatInView, - qListSatInUse); - if ((receivers(SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) > 0)) { - if ((isStartUpdate == FALSE) || (mqListSatInView != qListSatInView)) { - emit satellitesInViewUpdated(qListSatInView); - mqListSatInView = qListSatInView; - } - } - - if ((receivers(SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&))) > 0)) { - if ((isStartUpdate == FALSE) || (mqListSatInUse != qListSatInUse)) { - emit satellitesInUseUpdated(qListSatInUse); - mqListSatInUse = qListSatInUse; - } - } - } - - else if (aError == KErrTimedOut) { - //request has timed out - emit requestTimeout(); - } - - else { - //request has resulted in an error. could be changed to emit error signal when available. - emit requestTimeout(); - } -} - -// for request update -void CQGeoSatelliteInfoSourceS60::requestUpdate(int aTimeout) -{ - TInt index = -1; - TUint8 bits; - - CQMLBackendAO *temp = NULL; - - if (mRegUpdateAO == NULL || mCurrentModuleId == TUid::Null()) { - emit requestTimeout(); - return; - } - - //requestupdate - //return if already a request update is pending - if (mReqUpdateAO && mReqUpdateAO->isRequestPending()) - return; - - if (aTimeout < 0) { - emit requestTimeout(); - return; - } - - bits = mModuleFlags; - - do { - - //index of the more accurate method in the array - index = getMoreAccurateMethod(aTimeout, bits); - - //no positioning method method available : emit requestTimeout - if (index < 0) { - emit requestTimeout(); - break; - } - //if the selected module for request update is same as the previous one reuse the request - if (mList[index].mUid == mReqModuleId) { - if (mReqUpdateAO) { - mReqUpdateAO->requestUpdate(aTimeout); - return; - } - } - - TRAPD(ret, QT_TRYCATCH_LEAVING(temp = CQMLBackendAO::NewL(this, OnceUpdate, mList[index].mUid))); - - if ((ret == KErrNone) && (temp != NULL)) { - - QMutexLocker lReqLocker(&m_mutex_ReqUpAO); - //delete the old reqest update - if (mReqUpdateAO) - delete mReqUpdateAO; - - //set the requestAO to the newly created AO - mReqUpdateAO = temp; - - //set the request module ID - mReqModuleId = mList[index].mUid; - lReqLocker.unlock(); - - //start the update - mReqUpdateAO->requestUpdate(aTimeout); - - return; - } - - bits = bits & (0XFF ^(1 << index)); - - } while (index >= 0); - - //cleanup resources if the invalid requpdate is still stored - if (mReqUpdateAO) { - QMutexLocker lReqLocker(&m_mutex_ReqUpAO); - delete mReqUpdateAO; - mReqUpdateAO = NULL; - lReqLocker.unlock(); - mReqModuleId = TUid::Null(); - } - -} - -// starts the regular updates -void CQGeoSatelliteInfoSourceS60::startUpdates() -{ - if (mRegUpdateAO == NULL || mCurrentModuleId == TUid::Null()) { - emit requestTimeout(); - return; - } - - if (mRegUpdateAO && ((receivers(SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) > 0) || - (receivers(SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&))) > 0))) - mRegUpdateAO->startUpdates(); - - mStartUpdates = true; -} - -// stops the regular updates -void CQGeoSatelliteInfoSourceS60::stopUpdates() -{ - mStartUpdates = false; - - if (mRegUpdateAO == NULL || mCurrentModuleId == TUid::Null()) { - emit requestTimeout(); - return; - } - - if (mReqUpdateAO) - mRegUpdateAO->cancelUpdate(); -} - - -void CQGeoSatelliteInfoSourceS60::connectNotify(const char *aSignal) -{ - // start update if it already connected - if (mStartUpdates && mRegUpdateAO && ((QLatin1String(aSignal) == SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) || - (QLatin1String(aSignal) == SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&))))) - mRegUpdateAO->startUpdates(); - -} - -void CQGeoSatelliteInfoSourceS60::disconnectNotify(const char *aSignal) -{ - // Cancel updates if slot is disconnected for the positionUpdate() signal. - - if ((mRegUpdateAO) && (QLatin1String(aSignal) == SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) && (receivers(SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) == 0) && - (QLatin1String(aSignal) == SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&))) && (receivers(SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&))) == 0)) - mRegUpdateAO->cancelUpdate(); - -} - -QT_END_NAMESPACE - diff --git a/src/location/qmlbackendao_s60.cpp b/src/location/qmlbackendao_s60.cpp deleted file mode 100644 index e70d8867..00000000 --- a/src/location/qmlbackendao_s60.cpp +++ /dev/null @@ -1,478 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeopositioninfosource_s60_p.h" -#include "qgeosatelliteinfosource_s60_p.h" -#include "qmlbackendao_s60_p.h" - -QT_BEGIN_NAMESPACE - -//The name of the requestor //Added by PM -//_LIT(KRequestor,"QTMobility Location"); - -// constructor -CQMLBackendAO::CQMLBackendAO() : - CActive(EPriorityStandard), // Standard priority - mPosInfo(NULL), - mRequester(NULL), - mRequesterSatellite(NULL), - mRequestType(RequestType(0)) -{ -} - -// -// -// -CQMLBackendAO* CQMLBackendAO::NewLC(QObject *aRequester, - RequestType aRequestType, TPositionModuleId aModId) -{ - CQMLBackendAO* self = new(ELeave) CQMLBackendAO(); - CleanupStack::PushL(self); - self->ConstructL(aRequester, aRequestType, aModId); - return self; -} - -// -// -// -CQMLBackendAO* CQMLBackendAO::NewL(QObject *aRequester, - RequestType aRequestType, TPositionModuleId aModId) -{ - CQMLBackendAO* self = CQMLBackendAO::NewLC(aRequester, aRequestType, aModId); - CleanupStack::Pop(); // self; - return self; -} - -// -// -// -TInt CQMLBackendAO::ConstructL(QObject *aRequester, RequestType aRequestType, - TPositionModuleId aModId) -{ - TInt error = KErrNone; - RPositionServer PosServer; - - if (aRequester->inherits("QGeoSatelliteInfoSource")) - mRequesterSatellite = static_cast<CQGeoSatelliteInfoSourceS60*>(aRequester); - else - mRequester = static_cast<CQGeoPositionInfoSourceS60*>(aRequester); - - mRequestType = aRequestType; - - if ((mRequestType == RegularUpdate) || (mRequestType == OnceUpdate)) { - if (aRequester->inherits("QGeoSatelliteInfoSource")) - PosServer = mRequesterSatellite->getPositionServer(); - else - PosServer = mRequester->getPositionServer(); - - error = mPositioner.Open(PosServer, aModId); - - if (error != KErrNone) - return error; - - CleanupClosePushL(mPositioner); - - error = mPositioner.SetRequestor(CRequestor::ERequestorService , - CRequestor::EFormatApplication, _L("QTmobility_Location")); - - CleanupStack::Pop(1); - - if (error != KErrNone) - return error; - - } - - CActiveScheduler::Add(this); // Add to scheduler - - return error; -} - -// -CQMLBackendAO::~CQMLBackendAO() -{ - Cancel(); - - if ((mRequestType == OnceUpdate) || (mRequestType == RegularUpdate)) { - //close the subsession - mPositioner.Close(); - - if (mPosInfo) { - mPosInfo->ClearRequestedFields(); - - mPosInfo->ClearPositionData(); - //delete the HPositionGenericInfo - delete mPosInfo; - } - } else if (mRequestType == DeviceStatus) { - RPositionServer posServer; - - //done only by the position server Active Object - if (mRequester) - posServer = mRequester->getPositionServer(); - else - posServer = mRequesterSatellite->getPositionServer(); - - posServer.Close(); - } -} - -// -void CQMLBackendAO::DoCancel() -{ - CancelAll(); -} - - -// -void CQMLBackendAO::RunL() -{ - switch (mRequestType) { - case DeviceStatus : - handleDeviceNotification(iStatus.Int()); - break; - case RegularUpdate : - case OnceUpdate: - handlePosUpdateNotification(iStatus.Int()); - break; - default : - break; - } -} - -// -TInt CQMLBackendAO::RunError(TInt aError) -{ - return aError; -} - - -// checks any pending request in activeobject -bool CQMLBackendAO::isRequestPending() -{ - if (IsActive()) - return true; - else - return false; -} - - - -// Async call to get notifications about device status. -void CQMLBackendAO::notifyDeviceStatus(TPositionModuleStatusEventBase &aStatusEvent) -{ - RPositionServer PosServ; - - if (mRequester) - PosServ = mRequester->getPositionServer(); - else - PosServ = mRequesterSatellite->getPositionServer(); - - //register for device status events - TPositionModuleStatusEventBase::TModuleEvent RequestedEvents( - TPositionModuleStatusEventBase::EEventDeviceStatus); - - aStatusEvent.SetRequestedEvents(RequestedEvents); - - PosServ.NotifyModuleStatusEvent(aStatusEvent, iStatus); - - SetActive(); - -} - -void CQMLBackendAO::CancelAll() -{ - - RPositionServer PosServer; - if (mRequestType == DeviceStatus) { - if (mRequester) - PosServer = mRequester->getPositionServer(); - else - PosServer = mRequesterSatellite->getPositionServer(); - - PosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); - } else if ((mRequestType == OnceUpdate) || (mRequestType == RegularUpdate)) { - mPositioner.CancelRequest(EPositionerNotifyPositionUpdate); - } - -} - -//Initialize the posInfo with appropriate fields -bool CQMLBackendAO::initializePosInfo() -{ - if (!mPosInfo) { - mPosInfo = HPositionGenericInfo::New(); - - if (mPosInfo == NULL) - return FALSE; - } else { - mPosInfo->ClearRequestedFields(); - - mPosInfo->ClearPositionData(); - } - RPositionServer posServer; - TPositionModuleInfo moduleInfo; - TInt error = KErrNone; - - //get the posiiton server - posServer = mRequester->getPositionServer(); - - //retrieve the module id used by the posiitoner - if (mRequestType == RegularUpdate) - error = posServer.GetModuleInfoById(mRequester->getCurrentPositonModuleID(), moduleInfo); - else - error = posServer.GetModuleInfoById(mRequester->getRequestUpdateModuleID(), moduleInfo); - - if (error == KErrNone) { - - //get capabilities of the module - TPositionModuleInfo::TCapabilities caps = moduleInfo.Capabilities(); - - if (caps & TPositionModuleInfo::ECapabilitySatellite) { - mPosInfo->SetRequestedField(EPositionFieldSatelliteNumInView); - mPosInfo->SetRequestedField(EPositionFieldSatelliteNumUsed); - } - - if (caps & TPositionModuleInfo::ECapabilitySpeed) { - mPosInfo->SetRequestedField(EPositionFieldHorizontalSpeed); - mPosInfo->SetRequestedField(EPositionFieldVerticalSpeed); - } - if (caps & TPositionModuleInfo::ECapabilityCompass) { - mPosInfo->SetRequestedField(EPositionFieldMagneticCourseError); - mPosInfo->SetRequestedField(EPositionFieldHeading); - } - return TRUE; - } - return FALSE; -} - -//requestUpdate : request for position update once -void CQMLBackendAO::requestUpdate(int aTimeout) -{ - TPositionUpdateOptions aPosOption; - - mPositioner.GetUpdateOptions(aPosOption); - - aPosOption.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); - - aPosOption.SetUpdateTimeOut(TTimeIntervalMicroSeconds(aTimeout * 1000)); - - mPositioner.SetUpdateOptions(aPosOption); - - startUpdates(); -} - - -// -void CQMLBackendAO::cancelUpdate() -{ - Cancel(); - -} - - -// -void CQMLBackendAO::handleDeviceNotification(int aError) -{ - switch (aError) { - //NotifyPositionModulestatusEvent successfully completed - case KErrNone : - - //module not found - case KErrNotFound : - if (mRequester) - mRequester->updateDeviceStatus(); - else - mRequesterSatellite->updateDeviceStatus(); - break; - - //request has been successfully cancelled - case KErrCancel : - break; - - //unrecoverabe errors - default : - break; - } -} - - -// -void CQMLBackendAO::handlePosUpdateNotification(int aError) -{ - - HPositionGenericInfo *positionInfo = NULL; - - TPositionSatelliteInfo satInfo; - switch (aError) { - //NotifyPositionUpdate successfully completed - case KErrNone : - - - //requested information could not be retrieved within the maximum peroid - case KErrTimedOut: - - - - if (mRequester) { - positionInfo = HPositionGenericInfo::New(); - - if (positionInfo == NULL) - return; - - //copy the buffer contents into a new HPositionGenericInfo buffer,to be used - //for creating QGeoPositionInfo object later - memcpy(positionInfo , mPosInfo , mPosInfo->BufferSize()); - } else { - satInfo = mPosSatInfo; - } - - //if regUpdateAO, request for the next update - if (mRequestType == RegularUpdate) { - if (mRequester) { - initializePosInfo(); - mPositioner.NotifyPositionUpdate(*mPosInfo, iStatus); - } else { - mPosSatInfo.ClearSatellitesInView(); - mPositioner.NotifyPositionUpdate(mPosSatInfo, iStatus); - } - - SetActive(); - } - - if (mRequester) { - mRequester->updatePosition(positionInfo, aError); - delete positionInfo; - } else { - if ((aError != KErrTimedOut) || (mRequestType != RegularUpdate)) { - mRequesterSatellite->updatePosition(satInfo, aError, (mRequestType == RegularUpdate)); - } - } - - break; - - default : - if (mRequester) { - mRequester->updatePosition(positionInfo, aError); // positionInfo will be NULL - } else { - mRequesterSatellite->updatePosition(satInfo, aError, (mRequestType == RegularUpdate)); - } - break; - - } -} - -////////////////////////////////////////////////////////////// -// Sets the interval for getting the regular notification // -// the time interval set is in milli seconds // -////////////////////////////////////////////////////////////// -int CQMLBackendAO::setUpdateInterval(int aMilliSec) -{ - int minimumUpdateInterval = 0; - TInt64 mUpdateInterval = 0 ; - - - if (mRequester) - minimumUpdateInterval = mRequester->minimumUpdateInterval(); - else - minimumUpdateInterval = mRequesterSatellite->minimumUpdateInterval(); - - if (minimumUpdateInterval < 0) - minimumUpdateInterval = 100; - // if the current requesttype is regular updates - // then set the updateinterval otherwise ignore - //if(mRequestType != REQ_REG_UPDATE) - // return; - - TPositionUpdateOptions aPosOption; - - TInt error = mPositioner.GetUpdateOptions(aPosOption); - - // TTimeIntervalMicroSeconds is converted seconds - TInt currentUpdateInterval = aPosOption.UpdateInterval().Int64() / 1000; - - // If msec is not 0 and is less than the value returned by minimumUpdateInterval(), - // the interval will be set to the minimum interval. - // if (aMilliSec != 0 && aMilliSec <= minimumUpdateInterval) { - // workaround, not accepting zero as value, see QTMOBILITY-995 - if (aMilliSec <= minimumUpdateInterval) { - mUpdateInterval = minimumUpdateInterval; - } else { - mUpdateInterval = aMilliSec; - } - - // if the same value is being set then just ignore it. - if (currentUpdateInterval == mUpdateInterval) { - return mUpdateInterval; - } - - // will set Either zero, minimum or +ve value - // seconds converted to TTimeIntervalMicroSeconds - aPosOption.SetUpdateInterval(TTimeIntervalMicroSeconds(mUpdateInterval * 1000)); - // set the timeout to the smaller of 150% of interval or update interval + 10 seconds - TInt64 mUpdateTimeout = (mUpdateInterval * 3) / 2; - if (mUpdateTimeout > mUpdateInterval + 10000) - mUpdateTimeout = mUpdateInterval + 10000; - - if (aMilliSec > 0) - aPosOption.SetUpdateTimeOut(TTimeIntervalMicroSeconds(mUpdateTimeout * 1000)); - - error = mPositioner.SetUpdateOptions(aPosOption); - - return mUpdateInterval; -} - -void CQMLBackendAO::startUpdates() -{ - if (!IsActive()) { - if (mRequester) { - initializePosInfo(); - mPositioner.NotifyPositionUpdate(*mPosInfo , iStatus); - } else { - mPosSatInfo.ClearSatellitesInView(); - mPositioner.NotifyPositionUpdate(mPosSatInfo , iStatus); - } - - SetActive(); - - } -} - -QT_END_NAMESPACE diff --git a/src/location/qmlbackendmonitorao_s60.cpp b/src/location/qmlbackendmonitorao_s60.cpp deleted file mode 100644 index 1ad3161b..00000000 --- a/src/location/qmlbackendmonitorao_s60.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlbackendmonitorao_s60_p.h" -#include "qgeoareamonitor_s60_p.h" -#include "qmlbackendmonitorinfo_s60_p.h" - -#include <lbtsessiontrigger.h> -#include <lbtgeocircle.h> -#include <lbttriggerconditionarea.h> -#include <lbttriggerentry.h> - -QT_BEGIN_NAMESPACE - - -//static member of the QMLBackendMonitorAO object holding the address of the object -QMLBackendMonitorAO* QMLBackendMonitorAO::iBackendMonitorAO = NULL; - -//static member of the QMLBackendMonitorAO object maintaining the reference count -TInt QMLBackendMonitorAO::refCount = 0; - -//request for notification of the trigger fired events -void QMLBackendMonitorAO::NotifyFiredEvent() -{ - if (!IsActive()) { - iLbt.NotifyTriggerFired(iTriggerInfo, iStatus); - SetActive(); - } -} - -//static function called prior to the destruction of the -//singleton QMLBackendMonitorAO object -void QMLBackendMonitorAO::DeleteAO(QGeoAreaMonitorS60* aParent) -{ - //decrement the reference count - refCount--; - if (refCount == 0) { - delete iBackendMonitorAO; - iBackendMonitorAO = NULL; - } -} - -QMLBackendMonitorAO::~QMLBackendMonitorAO() -{ - Cancel(); - delete iTriggerMonitorInfo; //deletes the CBackendMonitorInfo object holding the linked list - iLbt.Close(); //closes the subsession -} - - -void QMLBackendMonitorAO::DoCancel() -{ - if (IsActive()) { //if request is still active,cancel the CancelNotifyTriggerFired request - iLbt.CancelNotifyTriggerFired(); - } -} - -void QMLBackendMonitorAO::RunL() -{ - CMonitorTriggerInfo *triggerInfo = NULL; - switch (iStatus.Int()) { - case KErrNone : - //retrieve the triggerInfo corresponding to iTriggerInfo.iTriggerId - triggerInfo = iTriggerMonitorInfo->getMonitorTriggerInfo( - iTriggerInfo.iTriggerId); - if (triggerInfo) { - //callback called only if generated for the current AO - Trigger ID - (triggerInfo->iParent)->handleTriggerEvent(iTriggerInfo.iFiredPositionInfo , - triggerInfo->iType); - } - break; - default : - break; - } - - //request for any trigger fired event, for any triggers owned by the client - NotifyFiredEvent(); -} - -QMLBackendMonitorAO* QMLBackendMonitorAO::NewL(RLbtServer &aLbt) -{ - //increment the reference count - refCount++; - if (!iBackendMonitorAO) { - iBackendMonitorAO = QMLBackendMonitorAO::NewLC(aLbt); - CleanupStack::Pop(); - } - return iBackendMonitorAO; -} - -QMLBackendMonitorAO* QMLBackendMonitorAO::NewLC(RLbtServer &aLbtServer) -{ - QMLBackendMonitorAO *self = new(ELeave) QMLBackendMonitorAO; - CleanupStack::PushL(self); - self->ConstructL(aLbtServer); - if (!self->isValid()) { - delete self; - self = NULL; - } - return self; -} - -void QMLBackendMonitorAO::ConstructL(RLbtServer &aLbtServ) -{ - if (iLbt.Open(aLbtServ) == KErrNone) { //opens the subsession - subsessionCreated = TRUE; - iTriggerMonitorInfo = CBackendMonitorInfo::NewL(); - } -} - -QMLBackendMonitorAO::QMLBackendMonitorAO() - : CActive(EPriorityStandard), // Standard priority - subsessionCreated(FALSE) -{ - CActiveScheduler::Add(this); -} - -QT_END_NAMESPACE - diff --git a/src/location/qmlbackendmonitorcreatetriggerao_s60.cpp b/src/location/qmlbackendmonitorcreatetriggerao_s60.cpp deleted file mode 100644 index 8b2962be..00000000 --- a/src/location/qmlbackendmonitorcreatetriggerao_s60.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlbackendmonitorao_s60_p.h" -#include "qgeoareamonitor_s60_p.h" -#include "qmlbackendmonitorinfo_s60_p.h" -#include "qmlbackendmonitorcreatetriggerao_s60_p.h" - -QT_BEGIN_NAMESPACE - -//Sets the radius of the monitoring area, to aRadius.If the Radius is less than the MinimumTriggerAreaSize(), -//then aRadius will be set to MinimumTriggerAreaSize() supported by the LBT implementation.If the aRadius is -//greater than the MinimumTriggerAreaSize() it is unaltered. -TInt QMLBackendMonitorCreateTriggerAO::getRadius(qreal& aRadius) -{ - TInt ret = KErrNone; - - qreal minimumRadius; - - TLbtTriggeringSystemSettings triggerSettings; - - //gets the triggering System Setting - TRAP(ret, iLbt.GetTriggeringSystemSettingsL(triggerSettings)); - - if (ret != KErrNone) - return ret; - - minimumRadius = triggerSettings.MinimumTriggerAreaSize(); - - if (aRadius < minimumRadius) - aRadius = minimumRadius; - - return ret; -} - -//creates a trigger of type aType(EntryTrigger/ExitTrigger), with the coordinates and radius as -//supplied in the argument -bool QMLBackendMonitorCreateTriggerAO::InitializeTrigger(QGeoAreaMonitorS60* aParent , - enTriggerType aType, - TCoordinate& aCoordinate, - qreal& aRadius) -{ - TInt ret = KErrGeneral; - - TLbtTriggerId triggerID = NULL; - - //try retrieving the trigger information from the linked list corresponding to the aParent and aType - CMonitorTriggerInfo* triggerInfo = iTriggerMonitorInfo->getMonitorTriggerInfo(aParent, aType); - - //if no triggerinfo available in the linked list - if (triggerInfo == NULL) { - //Define the triggering area - CLbtGeoCircle* trigArea = NULL; - - TRAP(ret, trigArea = CLbtGeoCircle::NewL( - aCoordinate ,//center coordinate - aRadius //radius in meters. If - //NaN is used, Location - //Triggering Server will - //use minimal size of trigger - //area as the radius of the - //trigger - )); - - if ((ret != KErrNone) || !trigArea) - return FALSE; - - CleanupStack::PushL(trigArea); - - CLbtTriggerConditionArea* cond = NULL; - - if (aType == EntryTrigger) { - //2: Construct a entry type of trigger condition - TRAP(ret, cond = CLbtTriggerConditionArea::NewL( - trigArea, - CLbtTriggerConditionArea::EFireOnEnter - )); - } else if (aType == ExitTrigger) { - TRAP(ret, cond = CLbtTriggerConditionArea::NewL( - trigArea, - CLbtTriggerConditionArea::EFireOnExit - )); - } - - - if ((ret != KErrNone) || !cond) { - CleanupStack::PopAndDestroy(trigArea); - return FALSE; - } - - CleanupStack::Pop(trigArea); //ownership of trigArea is transferred. - - CleanupStack::PushL(cond); - - RRequestorStack reqStack; - - CleanupClosePushL(reqStack); - - //trigger name. - _LIT(KMyTriggerName, "EntryTrigger"); - TDesC triggerName(KMyTriggerName); - - if (aType == ExitTrigger) { - _LIT(KMyTriggerName, "ExitTrigger"); - triggerName = KMyTriggerName; - } - - //Construct requestor - _LIT(KMyRequestorName, "QTLBTBackend"); //Application name used as requestor identifier - - CRequestor *req = NULL; - - TRAP(ret, req = CRequestor::NewL( - CRequestorBase::ERequestorService, - CRequestorBase::EFormatApplication, - KMyRequestorName - )); - - if ((ret != KErrNone) || !req) { - CleanupStack::PopAndDestroy(&reqStack); - CleanupStack::PopAndDestroy(cond); - return FALSE; - } - - CleanupStack::PushL(req); - - TRAP(ret, reqStack.AppendL(req)); - - CleanupStack::Pop(req); - - if (ret != KErrNone) { - CleanupStack::PopAndDestroy(&reqStack); - CleanupStack::PopAndDestroy(cond); - return FALSE; - } - - TUid managerUid = TUid::Uid(0); - - CLbtSessionTrigger* trig = NULL; - - TRAP(ret, trig = CLbtSessionTrigger::NewL( - triggerName, - CLbtTriggerEntry::EStateDisabled, - reqStack, - managerUid, - cond - )); - - CleanupStack::PopAndDestroy(&reqStack); - - CleanupStack::Pop(cond); - - trig->SetTimeToRearm(0); - - if ((ret != KErrNone) || (!trig)) { - CleanupStack::PopAndDestroy(cond); - return FALSE; - } - - CleanupStack::PushL(trig); - - //iLbt.CreateTrigger(*trig, triggerID, ETrue, iStatus); - - //CleanupStack::PopAndDestroy(trig ); - - TRAP(ret, iActiveSchedulerwait = new(ELeave) CActiveSchedulerWait); - - if ((ret != KErrNone) || !iActiveSchedulerwait) { - CleanupStack::PopAndDestroy(trig); - return FALSE; - } - - iTriggerCreation = FALSE; - - //create a trigger asynchronously - iLbt.CreateTrigger(*trig, triggerID, ETrue, iStatus); - - SetActive(); - - //wait till the iActiveSchedularwait->AsyncStop() is called in RunL - iActiveSchedulerwait->Start(); - - delete iActiveSchedulerwait; - - CleanupStack::PopAndDestroy(trig); - - //if the trigger creation is successful, add the triggerinfo to the linked list - if (iTriggerCreation == TRUE) - iTriggerMonitorInfo->addMonitorTriggerInfo(aParent, triggerID, aType); - - delete req; - - return iTriggerCreation; - } else { //triggerinfo available in the linked list - - CLbtSessionTrigger* trig = NULL; - - //Define the triggering area - CLbtGeoCircle* trigArea = NULL; - - TRAP(ret, trigArea = CLbtGeoCircle::NewL( - aCoordinate , //center coordinate - aRadius //radius in meters. If - //NaN is used, Location - //Triggering Server will - //use minimal size of trigger - //area as the radius of the - //trigger - )); - - if ((ret != KErrNone) || (!trigArea)) { - - return FALSE; - } - - CleanupStack::PushL(trigArea); - - //2: Construct a entry type of trigger condition - CLbtTriggerConditionArea* cond = NULL; - - if (aType == EntryTrigger) { - //2: Construct a entry type of trigger condition - TRAP(ret, cond = CLbtTriggerConditionArea::NewL( - trigArea, - CLbtTriggerConditionArea::EFireOnEnter - )); - } else if (aType == ExitTrigger) { - TRAP(ret, cond = CLbtTriggerConditionArea::NewL( - trigArea, - CLbtTriggerConditionArea::EFireOnExit - )); - } - - - if ((ret != KErrNone) || !cond) { - CleanupStack::PopAndDestroy(trigArea); - return FALSE; - } - - CleanupStack::Pop(trigArea); //ownership of trigArea is transferred. - - CleanupStack::PushL(cond); - - //create a session trigger - TRAP(ret, trig = CLbtSessionTrigger::NewL()); - - if ((ret != KErrNone) || (!trig)) { - CleanupStack::PopAndDestroy(cond); - return FALSE; - } - - //set the condition for the trigger - trig->SetCondition(cond); - - CleanupStack::Pop(cond); - - CleanupStack::PushL(trig); - - //set the trigger ID - trig->SetId(triggerInfo->iTriggerID); - - iLbt.SetTriggerStateL(triggerInfo->iTriggerID, CLbtTriggerEntry::EStateDisabled, ELbtTrue); - - //update the trigger with the new condition in LBT server - TRAP(ret, iLbt.UpdateTriggerL(*trig, CLbtTriggerEntry::EAttributeCondition, ELbtTrue)); - - CleanupStack::PopAndDestroy(trig); - - - if (ret != KErrNone) { - return FALSE;; - } - - return TRUE; - } -} - - -QMLBackendMonitorCreateTriggerAO::~QMLBackendMonitorCreateTriggerAO() -{ - Cancel(); - iLbt.Close(); //closes the subsession -} - - -void QMLBackendMonitorCreateTriggerAO::DoCancel() -{ - if (!IsActive()) { - iActiveSchedulerwait->AsyncStop(); - } -} - -void QMLBackendMonitorCreateTriggerAO::RunL() -{ - switch (iStatus.Int()) { - case KErrNone : - iTriggerCreation = TRUE; - break; - default : - break; - } - //stops the AO, waiting in the iActiveSchedulerwait->Start() - iActiveSchedulerwait->AsyncStop(); -} - -QMLBackendMonitorCreateTriggerAO* QMLBackendMonitorCreateTriggerAO::NewL(QGeoAreaMonitorS60* aParent , RLbtServer &aLbt) -{ - - QMLBackendMonitorCreateTriggerAO* self = QMLBackendMonitorCreateTriggerAO:: - NewLC(aParent, aLbt); - CleanupStack::Pop(); - - return self; -} - -QMLBackendMonitorCreateTriggerAO* QMLBackendMonitorCreateTriggerAO::NewLC(QGeoAreaMonitorS60* aParent , RLbtServer &aLbtServer) -{ - QMLBackendMonitorCreateTriggerAO *self = new(ELeave) QMLBackendMonitorCreateTriggerAO; - CleanupStack::PushL(self); - self->ConstructL(aLbtServer); - if (!self->isValid()) { - delete self; - self = NULL; - } - return self; -} - -void QMLBackendMonitorCreateTriggerAO::ConstructL(RLbtServer &aLbtServ) -{ - if (iLbt.Open(aLbtServ) == KErrNone) { //opens the subseesion - subsessionCreated = TRUE; - //get the singleton object of CBackendMonitorInfo class - iTriggerMonitorInfo = CBackendMonitorInfo::NewL(); - } -} - -QMLBackendMonitorCreateTriggerAO::QMLBackendMonitorCreateTriggerAO() - : CActive(EPriorityStandard), // Standard priority - subsessionCreated(FALSE), iTriggerCreation(FALSE) -{ - CActiveScheduler::Add(this); //add AO to the Schedular -} - -//Enables/Disables the trigger state depending on the aStatus -void QMLBackendMonitorCreateTriggerAO::SetTriggerState(QGeoAreaMonitorS60* aParent, enTriggerType aType, bool aStatus) -{ - //retrieve the triggerinfo from the linked list from the supplied aPrent and aType - CMonitorTriggerInfo* triggerInfo = iTriggerMonitorInfo->getMonitorTriggerInfo(aParent, aType); - - if (aStatus == true) { - TRAPD(err, iLbt.SetTriggerStateL(triggerInfo->iTriggerID, CLbtTriggerEntry::EStateEnabled, ELbtTrue)); - } else { - TRAPD(err, iLbt.SetTriggerStateL(triggerInfo->iTriggerID, CLbtTriggerEntry::EStateDisabled, ELbtTrue)); - } -} - -//checks whether trigger is Initialized. The trigger entry corresponding to the aParent and aType is -//searched in the linked list -bool QMLBackendMonitorCreateTriggerAO::isTriggerInitialized(QGeoAreaMonitorS60* aParent, enTriggerType aType) -{ - CMonitorTriggerInfo* triggerInfo = iTriggerMonitorInfo->getMonitorTriggerInfo(aParent, aType); - - return (triggerInfo != NULL) ? TRUE : FALSE; -} - -QT_END_NAMESPACE diff --git a/src/location/qmlbackendmonitorinfo_s60.cpp b/src/location/qmlbackendmonitorinfo_s60.cpp deleted file mode 100644 index e7b3f125..00000000 --- a/src/location/qmlbackendmonitorinfo_s60.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "qmlbackendmonitorinfo_s60_p.h" - -QT_BEGIN_NAMESPACE - -//singleton class object -CBackendMonitorInfo* CBackendMonitorInfo::iBackendMonitorInfo = NULL; - -CBackendMonitorInfo* CBackendMonitorInfo::NewL() -{ - if (!iBackendMonitorInfo) - iBackendMonitorInfo = new CBackendMonitorInfo; - - return iBackendMonitorInfo; -} - -//returns the CMonitorTriggerInfo info based on the aTrigID -CMonitorTriggerInfo* CBackendMonitorInfo::getMonitorTriggerInfo(TLbtTriggerId aTrigID) -{ - CMonitorTriggerInfo* currentNode = iMonitorInfo; - while (currentNode && (currentNode->iTriggerID != aTrigID)) { - currentNode = currentNode->next; - } - return currentNode; -} - -//returns the CMonitorTriggerInfo info based on the aParent,aType from the linked list -CMonitorTriggerInfo* CBackendMonitorInfo::getMonitorTriggerInfo(QGeoAreaMonitorS60* aParent, enTriggerType aType) -{ - CMonitorTriggerInfo* currentNode = iMonitorInfo; - while (currentNode) { - if ((currentNode->iParent == aParent) && (currentNode->iType == aType)) - break; - - currentNode = currentNode->next; - } - return currentNode; -} - -//creates and adds a new CMonitorTriggerInfo object to the end of linked list -bool CBackendMonitorInfo::addMonitorTriggerInfo(QGeoAreaMonitorS60* aParent, TLbtTriggerId aTriggerID, enTriggerType aType) -{ - CMonitorTriggerInfo* currentNode = NULL; - - CMonitorTriggerInfo* temp = new CMonitorTriggerInfo; - - if (!temp) { - return FALSE; - } - - temp->iTriggerID = aTriggerID; - temp->iParent = aParent; - temp->iType = aType; - temp->next = NULL; - - currentNode = iMonitorInfo; - - while (currentNode && (currentNode->next != NULL)) - currentNode = currentNode->next; - - if (!currentNode) { - iMonitorInfo = temp; - } else { - currentNode->next = temp; - } - - return TRUE; -} - -//deletes the node corresponding to aTrigID -void CBackendMonitorInfo::removeMonitorTriggerInfo(TLbtTriggerId aTrigID) -{ - CMonitorTriggerInfo* currentNode = NULL; - - CMonitorTriggerInfo* prevNode = NULL; - - currentNode = prevNode = iMonitorInfo; - - while (currentNode && (currentNode->iTriggerID != aTrigID)) { - prevNode = currentNode; - currentNode = currentNode->next; - } - - if (currentNode == NULL) - return; - - else if (currentNode == iMonitorInfo) { - iMonitorInfo = currentNode->next; - } - - else { - prevNode->next = currentNode->next; - } - - delete currentNode; -} - -//deletes all the nodes in the linked list -CBackendMonitorInfo::~CBackendMonitorInfo() -{ - CMonitorTriggerInfo* currentNode = NULL; - CMonitorTriggerInfo* prevNode = NULL; - - prevNode = iMonitorInfo; - - while (prevNode) { - currentNode = prevNode; - prevNode = prevNode->next; - delete currentNode; - } - - iMonitorInfo = NULL; - iBackendMonitorInfo = NULL; -} - -QT_END_NAMESPACE diff --git a/src/location/qmlbackendtriggerchangeao_s60.cpp b/src/location/qmlbackendtriggerchangeao_s60.cpp deleted file mode 100644 index 2c157680..00000000 --- a/src/location/qmlbackendtriggerchangeao_s60.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlbackendmonitorao_s60_p.h" -#include "qgeoareamonitor_s60_p.h" -#include "qmlbackendmonitorinfo_s60_p.h" -#include "qmlbackendtriggerchangeao_s60_p.h" - -#include <lbtsessiontrigger.h> -#include <lbttriggerentry.h> - -QT_BEGIN_NAMESPACE - -//Design chnages - -QMLBackendTriggerChangeAO* QMLBackendTriggerChangeAO::instance = NULL; -TInt QMLBackendTriggerChangeAO::refCount = 0; - - -//request for the notification of trigger change event with the -//LBT server -void QMLBackendTriggerChangeAO::NotifyChangeEvent() -{ - if (!IsActive()) { - iStatus = KRequestPending; - iLbt.NotifyTriggerChangeEvent(iTriggerChangeEvent, iStatus); - SetActive(); - } -} - - -QMLBackendTriggerChangeAO::~QMLBackendTriggerChangeAO() -{ - Cancel(); - iLbt.Close(); -} - -void QMLBackendTriggerChangeAO::DoCancel() -{ - if (IsActive()) { //if AO is active,cancel the trigger change event request - iLbt.CancelNotifyTriggerChangeEvent(); - } -} - -void QMLBackendTriggerChangeAO::RunL() -{ - switch (iStatus.Int()) { - case KErrNone : -#if 0 - //implementation takes the updation, deletion into consideration - //from the UI, which isn't possible with the current UI for LBT. - //The same should be considered once made availbale as part of the UI - //check for Multiple trigger change events - if (iTriggerChangeEvent.iEventType == ELbtTriggerChangeEventMultiple) { - CMonitorTriggerInfo* triggerInfo1 = NULL; - - CMonitorTriggerInfo* triggerInfo2 = NULL; - - CMonitorTriggerInfo* triggerInfo3 = NULL; - - TInt i = 0, count = 0; - - RPointerArray < CLbtTriggerInfo > trigInfoList; - - CLbtTriggerEntry* entry = NULL; - - //retrieve the list of triggers created by the client - iLbt.GetTriggersL(trigInfoList); - - CleanupClosePushL(trigInfoList); - - count = trigInfoList.Count(); - - //get the header of the linked list holding the information - //of the trigger - triggerInfo1 = iTriggerMonitorInfo->getMonitorTriggerInfo(); - - while (triggerInfo1) { - for (i = 0; i < count; i++) { - //get the trigger entryinfo - entry = trigInfoList[i]->TriggerEntry(); - - //if the triggerinfo retrieved matches the trigInfoList - //id break - if (triggerInfo1->iTriggerID == entry->Id()) - break; - } - - triggerInfo2 = triggerInfo1->next; - - if (i == count) //if the triggerinfo1->triggerid not found - //in the trigger list of the LBT server, - //remove the triggerinfo from the linked list - { - iTriggerMonitorInfo->removeMonitorTriggerInfo( - triggerInfo1->iTriggerID); - } else { - - //if triggerinfo1->triggerid is found in the trigger list, - //and if it is an entry trigger, search for the corresponding - //exit trigger in the linked list - if (triggerInfo1->iType == EntryTrigger) - triggerInfo3 = iTriggerMonitorInfo->getMonitorTriggerInfo( - triggerInfo1->iParent , ExitTrigger); - - //if triggerinfo1->triggerid is found in the trigger list, - //and if it is an entry trigger, search for the corresponding - //entry trigger in the linked list - else if (triggerInfo1->iType == ExitTrigger) - triggerInfo3 = iTriggerMonitorInfo->getMonitorTriggerInfo( - triggerInfo1->iParent, EntryTrigger); - - //callback called for the notification change event of the trigger - if (triggerInfo3) { - - (triggerInfo1->iParent)->handleTriggerChangeEvent(iTriggerChangeEvent.iEventType, trigInfoList[i], - triggerInfo3->iTriggerID); - } else { - (triggerInfo1->iParent)->handleTriggerChangeEvent(iTriggerChangeEvent.iEventType, trigInfoList[i], - NULL); - } - - } - triggerInfo3 = NULL; - - triggerInfo1 = triggerInfo2; - } - - CleanupStack::Pop(1); - - //cloae the trigInfoList, holding the list of trigger - //info - trigInfoList.Close(); - - } - //check for trigger delete event - else if (iTriggerChangeEvent.iEventType == ELbtTriggerChangeEventDeleted) { - //delete the entry from the linked list,corresponding to the - //iTriggerChangeEvent.iTriggerId - iTriggerMonitorInfo->removeMonitorTriggerInfo( - iTriggerChangeEvent.iTriggerId); - } - //check for trigger updation event - else if (iTriggerChangeEvent.iEventType == ELbtTriggerChangeEventUpdated) { - CLbtTriggerInfo *info = NULL; - - //get the triggerinfo from the linked list corresponding - //to the iTriggerChangeEvent.iTriggerId - CMonitorTriggerInfo* triggerInfo1 = iTriggerMonitorInfo->getMonitorTriggerInfo( - iTriggerChangeEvent.iTriggerId); - - if (!triggerInfo1) - break; - - //get the triggerinfo of trigger with id - iTriggerChangeEvent.iTriggerId - //from the LBT server - info = iLbt.GetTriggerLC(iTriggerChangeEvent.iTriggerId); - - if (info == NULL) - break; - - //change in one-trigger,must update the corresponding entry/exit - //trigger - if (triggerInfo1) { - CMonitorTriggerInfo* triggerInfo2 = NULL; - - //if the trigger updated is EntryTrigger, get the information - //of the corresponding ExitTrigger if any,from the - //linked list - if (triggerInfo1->iType == EntryTrigger) - triggerInfo2 = iTriggerMonitorInfo->getMonitorTriggerInfo( - triggerInfo1->iParent, ExitTrigger); - - //if the trigger updated is ExitTrigger, get the information - //of the corresponding EntryTrigger if any,fro mthe - //linked list - else if (triggerInfo1->iType == ExitTrigger) - triggerInfo2 = iTriggerMonitorInfo->getMonitorTriggerInfo( - triggerInfo1->iParent, EntryTrigger); - - //callback called for the notification change event for the trigger - if (triggerInfo2) { - (triggerInfo1->iParent)->handleTriggerChangeEvent(iTriggerChangeEvent.iEventType, info, - triggerInfo2->iTriggerID); - } else { - (triggerInfo1->iParent)->handleTriggerChangeEvent(iTriggerChangeEvent.iEventType, info, - NULL); - } - } - - //pop and destroy the triggerinfo retrived from GetTriggerLC() - CleanupStack::PopAndDestroy(info); - } -#endif - if (iTriggerChangeEvent.iEventType == ELbtTriggerChangeEventMultiple) { - - CMonitorTriggerInfo* triggerInfo1 = NULL; - - CMonitorTriggerInfo* triggerInfo2 = NULL; - - TInt i = 0, count = 0; - - RArray < TLbtTriggerId > triggerIdList; - - - //retrieve the list of trigger IDs created by the client - TRAPD(ret, iLbt.ListTriggerIdsL(triggerIdList)); - - if (ret != KErrNone) { - break; - } - - CleanupClosePushL(triggerIdList); - - count = triggerIdList.Count(); - - //get the header of the linked list holding the information - //of the trigger - triggerInfo1 = iTriggerMonitorInfo->getMonitorTriggerInfo(); - - while (triggerInfo1) { - for (i = 0; i < count; i++) { - //if the triggerinfo retrieved matches the triggerIdList - //id break - if (triggerInfo1->iTriggerID == triggerIdList[i]) - break; - } - - triggerInfo2 = triggerInfo1->next; - - if (i == count) //if the triggerinfo1->triggerid not found - //in the trigger list of the LBT server, - //remove the triggerinfo from the linked list - { - iTriggerMonitorInfo->removeMonitorTriggerInfo( - triggerInfo1->iTriggerID); - } - - triggerInfo1 = triggerInfo2; - } - - CleanupStack::Pop(1); - - //close the trigInfoList, holding the list of trigger - //info - triggerIdList.Close(); - } - - //check for trigger delete event - else if (iTriggerChangeEvent.iEventType == ELbtTriggerChangeEventDeleted) { - //delete the entry from the linked list,corresponding to the - //iTriggerChangeEvent.iTriggerId - iTriggerMonitorInfo->removeMonitorTriggerInfo( - iTriggerChangeEvent.iTriggerId); - } - break; - - default : - break; - } - - //request for the notification of any notification change events - NotifyChangeEvent(); -} - - -//static function called prior to the destruction of the -//singleton QMLBackendTriggerChangeAO object -void QMLBackendTriggerChangeAO::DeleteAO() -{ - //decrement the referent count - refCount--; - - if (!refCount) { //if reference count becomes 0 delete the instance - delete instance; - instance = NULL; - } -} - -QMLBackendTriggerChangeAO* QMLBackendTriggerChangeAO::NewL(RLbtServer& aLbtServ) -{ - - if (!instance) { - instance = new QMLBackendTriggerChangeAO; - instance->ConstructL(aLbtServ); - if (!instance->isValid()) { - delete instance; - instance = NULL; - return NULL; - } - } - refCount++; - return instance; - -} - -QMLBackendTriggerChangeAO::QMLBackendTriggerChangeAO() : CActive(EPriorityNormal), iTriggerMonitorInfo(NULL) -{ - CActiveScheduler::Add(this); //add current AO, to the Schedular -} - -void QMLBackendTriggerChangeAO::ConstructL(RLbtServer& aLbtServ) -{ - if (iLbt.Open(aLbtServ) == KErrNone) { //open the RLBT subsesion - subsessionCreated = TRUE; - //Get the pointer to the CBackendMonitorInfo singleton object - iTriggerMonitorInfo = CBackendMonitorInfo::NewL(); - } -} - -QT_END_NAMESPACE diff --git a/src/plugins/geoservices/nokia/nokia.pro b/src/plugins/geoservices/nokia/nokia.pro index 82080215..0434259a 100644 --- a/src/plugins/geoservices/nokia/nokia.pro +++ b/src/plugins/geoservices/nokia/nokia.pro @@ -37,16 +37,6 @@ RESOURCES += resource.qrc INCLUDEPATH += $$QT.location.includes -symbian { - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = ALL -TCB - TARGET.UID3 = 0x2002BFCA - pluginDep.sources = $${TARGET}.dll - pluginDep.path = $${QT_PLUGINS_BASE_DIR}/$${PLUGIN_TYPE} - DEPLOYMENT += pluginDep - LIBS += -lefsrv -} - target.path += $$[QT_INSTALL_PLUGINS]/geoservices INSTALLS += target diff --git a/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.cpp index 74475d5d..a20f798d 100644 --- a/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.cpp @@ -70,42 +70,8 @@ #undef DISK_CACHE_ENABLED -#ifdef Q_OS_SYMBIAN -#include <f32file.h> -#endif - QT_BEGIN_NAMESPACE -#if defined(Q_OS_SYMBIAN) -QChar QGeoMappingManagerEngineNokia::findFirstInternalFlashDrive() -{ - QChar flashDrive; - RFs fsSession; - // if something leaves just return an empty QChar - TRAP_IGNORE( - User::LeaveIfError(fsSession.Connect()); - CleanupClosePushL(fsSession); - TDriveList drivelist; - User::LeaveIfError(fsSession.DriveList(drivelist)); - for (int i = 0; i < KMaxDrives; ++i) { - if (drivelist[i] != 0) { - TChar driveChar; - User::LeaveIfError(RFs::DriveToChar(i, driveChar)); - TDriveInfo driveInfo; - if (fsSession.Drive(driveInfo, i) != KErrNone) - continue; - if ((driveInfo.iDriveAtt & KDriveAttInternal) && driveInfo.iType == EMediaHardDisk) { - flashDrive = QChar(driveChar); - break; - } - } - } - CleanupStack::PopAndDestroy(&fsSession); - ) - return flashDrive; -} -#endif //Q_OS_SYMBIAN - QGeoMappingManagerEngineNokia::QGeoMappingManagerEngineNokia(const QMap<QString, QVariant> ¶meters, QGeoServiceProvider::Error *error, QString *errorString) : QGeoMappingManagerEngine(parameters), m_cache(0), @@ -174,15 +140,7 @@ void QGeoMappingManagerEngineNokia::init() cacheDir = parameters.value("mapping.cache.directory").toString(); if (cacheDir.isEmpty()) { -#if defined(Q_OS_SYMBIAN) - QChar driveLetter(findFirstInternalFlashDrive()); - if (!driveLetter.isNull()) { - cacheDir = driveLetter; - cacheDir += ":/data/nokia/maptiles"; - } -#else cacheDir = QDir::temp().path()+"/maptiles"; -#endif } if (!cacheDir.isEmpty()) { m_cache = new QNetworkDiskCache(this); @@ -255,11 +213,7 @@ QString QGeoMappingManagerEngineNokia::getRequestString(const TileSpec &spec) co requestString += QString::number(spec.y()); requestString += slash; requestString += sizeToStr(tileSize()); -//#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE_WM) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) static const QString slashpng("/png8"); -//#else -// static const QString slashpng("/png"); -//#endif requestString += slashpng; if (!m_token.isEmpty()) { diff --git a/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.h b/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.h index df4b15f1..e7bf148f 100644 --- a/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.h +++ b/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.h @@ -82,9 +82,6 @@ private: static QString sizeToStr(const QSize &size); // static QString mapTypeToStr(QGraphicsGeoMap::MapType type); -#if defined(Q_OS_SYMBIAN) - QChar findFirstInternalFlashDrive(); -#endif //Q_OS_SYMBIAN QNetworkAccessManager *m_networkManager; QNetworkDiskCache *m_cache; diff --git a/src/plugins/geoservices/nokia_places_jsondb/nokia_places_jsondb.pro b/src/plugins/geoservices/nokia_places_jsondb/nokia_places_jsondb.pro index 369335b9..1132619b 100644 --- a/src/plugins/geoservices/nokia_places_jsondb/nokia_places_jsondb.pro +++ b/src/plugins/geoservices/nokia_places_jsondb/nokia_places_jsondb.pro @@ -35,15 +35,5 @@ INCLUDEPATH += $$QT.location.includes DEFINES += QT_ADDON_JSONDB_LIB QT += jsondb -symbian { - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = ALL -TCB - TARGET.UID3 = 0x2002BFCA - pluginDep.sources = $${TARGET}.dll - pluginDep.path = $${QT_PLUGINS_BASE_DIR}/$${PLUGIN_TYPE} - DEPLOYMENT += pluginDep - LIBS += -lefsrv -} - target.path += $$[QT_INSTALL_PLUGINS]/geoservices INSTALLS += target |