qtmobility/src/location/qgeosatelliteinfosource_s60.cpp
changeset 1 2b40d63a9c3d
child 4 90517678cc4f
equal deleted inserted replaced
0:cfcbf08528c4 1:2b40d63a9c3d
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #include <QObject>
       
    43 #include <QDateTime>
       
    44 #include <limits.h>
       
    45 #include "qgeopositioninfosource_s60_p.h"
       
    46 #include "qgeosatelliteinfosource_s60_p.h"
       
    47 #include "qgeosatelliteinfosource.h"
       
    48 
       
    49 #include <QList>
       
    50 
       
    51 QTM_BEGIN_NAMESPACE
       
    52 
       
    53 // constructor
       
    54 CQGeoSatelliteInfoSourceS60::CQGeoSatelliteInfoSourceS60(QObject* aParent) : QGeoSatelliteInfoSource(aParent),
       
    55         mCurrentModuleId(TUid::Null()),
       
    56         mReqModuleId(TUid::Null()),
       
    57         mDevStatusUpdateAO(NULL),
       
    58         mReqUpdateAO(NULL),
       
    59         mRegUpdateAO(NULL),
       
    60         mListSize(0),
       
    61         mStartUpdates(FALSE),
       
    62         mModuleFlags(0)
       
    63 {
       
    64     memset(mList, 0 , MAX_SIZE * sizeof(CSatMethodInfo));
       
    65 }
       
    66 
       
    67 // destructor
       
    68 CQGeoSatelliteInfoSourceS60::~CQGeoSatelliteInfoSourceS60()
       
    69 {
       
    70     if (mReqUpdateAO)
       
    71         delete mReqUpdateAO;
       
    72 
       
    73     if (mRegUpdateAO)
       
    74         delete mRegUpdateAO;
       
    75 
       
    76     if (mDevStatusUpdateAO)
       
    77         delete mDevStatusUpdateAO;
       
    78 }
       
    79 
       
    80 // static function NewLC
       
    81 CQGeoSatelliteInfoSourceS60* CQGeoSatelliteInfoSourceS60::NewLC(QObject* aParent)
       
    82 {
       
    83     CQGeoSatelliteInfoSourceS60* self =
       
    84         new(ELeave) CQGeoSatelliteInfoSourceS60(aParent);
       
    85     CleanupStack::PushL(self);
       
    86     self->ConstructL();
       
    87     return self;
       
    88 }
       
    89 
       
    90 // static function NewL
       
    91 CQGeoSatelliteInfoSourceS60* CQGeoSatelliteInfoSourceS60::NewL(QObject * aParent)
       
    92 {
       
    93     CQGeoSatelliteInfoSourceS60* self = CQGeoSatelliteInfoSourceS60::NewLC(aParent);
       
    94     CleanupStack::Pop();
       
    95 
       
    96     //check if the second phase construction is successful
       
    97     if (!self->isValid()) {
       
    98         delete self;
       
    99         self = NULL;
       
   100     }
       
   101 
       
   102     return self;
       
   103 }
       
   104 
       
   105 // 2nd phase constructor
       
   106 void CQGeoSatelliteInfoSourceS60::ConstructL()
       
   107 {
       
   108     TInt error = mPositionServer.Connect();
       
   109 
       
   110     if (error == KErrNone) {
       
   111         CleanupClosePushL(mPositionServer);
       
   112 
       
   113         mDevStatusUpdateAO = CQMLBackendAO::NewL(this, DeviceStatus);
       
   114 
       
   115         if (mDevStatusUpdateAO == NULL) {
       
   116             CleanupStack::Pop(1);
       
   117 
       
   118             return;
       
   119         }
       
   120 
       
   121         //update the list array with the available method initially
       
   122         updateDeviceStatus();
       
   123 
       
   124         CleanupStack::PushL(mDevStatusUpdateAO);
       
   125 
       
   126         /*
       
   127         if(mCurrentModuleId != TUid::Null())
       
   128             mRegUpdateAO = CQMLBackendAOSatellite::NewL(this,RegularUpdate,mCurrentModuleId);
       
   129         */
       
   130         TUint8 bits;
       
   131         TInt index = -1;
       
   132 
       
   133         CQMLBackendAO *temp = NULL;
       
   134 
       
   135         bits = mModuleFlags;
       
   136 
       
   137         do {
       
   138             //error = Get the index of the positioning module based on
       
   139             //priority position module providing the satellite fix
       
   140             index = getIndexPositionModule(bits);
       
   141 
       
   142             if (index >= 0) {
       
   143                 TRAPD(ret, temp = CQMLBackendAO::NewL(this, RegularUpdate,
       
   144                                                       mList[index].mUid));
       
   145 
       
   146                 if ((ret == KErrNone) && (temp != NULL))
       
   147                     break;
       
   148 
       
   149                 bits = bits & (0XFF ^(1 << index));
       
   150             }
       
   151         } while (index >= 0);
       
   152 
       
   153         if (index >= 0) {
       
   154             mRegUpdateAO = temp;
       
   155             mRegUpdateAO->setUpdateInterval(0);
       
   156             mCurrentModuleId = mList[index].mUid;
       
   157         }
       
   158 
       
   159         CleanupStack::Pop(2);
       
   160     }
       
   161 
       
   162 }
       
   163 
       
   164 //private function : to retrieve the index of the supplied module id from the mList array
       
   165 TInt CQGeoSatelliteInfoSourceS60::checkModule(TPositionModuleId aId)const
       
   166 {
       
   167     TInt i;
       
   168     for (i = 0; i < mListSize; i++)
       
   169         if (mList[i].mUid == aId)
       
   170             return i;
       
   171     return -1;
       
   172 }
       
   173 
       
   174 //
       
   175 int CQGeoSatelliteInfoSourceS60::minimumUpdateInterval() const
       
   176 {
       
   177     if (mCurrentModuleId == TUid::Null())
       
   178         return 0;
       
   179 
       
   180     TInt i = checkModule(mCurrentModuleId);
       
   181     if (i != -1)
       
   182         return mList[i].mTimeToNextFix.Int64() / 1000;           //divide by 1000, to convert microsecond to milisecond
       
   183     return 0;
       
   184 }
       
   185 
       
   186 //private function : get the index of the mList that supports the preferred method if
       
   187 //available,else returns the index of the default module
       
   188 TInt CQGeoSatelliteInfoSourceS60::getIndexPositionModule(TUint8 aBits) const
       
   189 {
       
   190     TInt index;
       
   191 
       
   192     TPositionModuleId modID = TUid::Null();
       
   193 
       
   194     //index = -1 : no methods available in the mList that supports preferred methods
       
   195     index = -1;
       
   196 
       
   197     for (TInt i = 0; i < mListSize ; i++) {
       
   198         //check the module properties to select the preferred method,search should not
       
   199         //not select an unavailable method,error device or index matching aLastIndex
       
   200         if ((mList[i].mIsAvailable)
       
   201                 && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown)
       
   202                 && (mList[i].mStatus != TPositionModuleStatus::EDeviceError)
       
   203                 && (((aBits >> i) & 1))) {
       
   204             return i;
       
   205         }
       
   206     }
       
   207 
       
   208     return index;
       
   209 }
       
   210 
       
   211 //private function : to get the index of the positioning method with time to first fix
       
   212 //lesser than timeout
       
   213 TInt CQGeoSatelliteInfoSourceS60::getMoreAccurateMethod(TInt aTimeout, TUint8 aBits)
       
   214 {
       
   215     TInt index = -1, temp = INT_MAX;
       
   216 
       
   217     TTimeIntervalMicroSeconds microSeconds;
       
   218 
       
   219     //convert the timeout --> micro seconds
       
   220     microSeconds = aTimeout * 1000;
       
   221 
       
   222     if (microSeconds == 0)
       
   223         microSeconds = INT_MAX;
       
   224 
       
   225     for (TInt i = 0 ; i < mListSize; i++) {
       
   226         if (mList[i].mIsAvailable
       
   227                 && (mList[i].mStatus != TPositionModuleStatus::EDeviceUnknown)
       
   228                 && (mList[i].mStatus != TPositionModuleStatus::EDeviceError)
       
   229                 && (((aBits >> i) & 1))
       
   230                 && (mList[i].mTimeToFirstFix < microSeconds)) {
       
   231             if (mList[i].mHorizontalAccuracy < temp) {
       
   232                 index = i;
       
   233                 temp = mList[i].mHorizontalAccuracy;
       
   234             }
       
   235         }
       
   236     }
       
   237     return index;
       
   238 }
       
   239 
       
   240 //private function : to update the mList array
       
   241 void CQGeoSatelliteInfoSourceS60::updateStatus(TPositionModuleInfo aModInfo, TInt aStatus)
       
   242 {
       
   243 
       
   244     TInt i, index;
       
   245     TPositionModuleId id;
       
   246     TBool available;
       
   247     TReal32 accuracy;
       
   248     TTimeIntervalMicroSeconds time_to_first_fix, time_to_next_fix;
       
   249     TPositionQuality quality;
       
   250     CQMLBackendAO *temp = NULL;
       
   251 
       
   252     //query for the following parameters
       
   253     id = aModInfo.ModuleId();
       
   254 
       
   255     //gets the device availability based on the user settings
       
   256     available = aModInfo.IsAvailable();
       
   257 
       
   258     //quality : holds the required metrics
       
   259     aModInfo.GetPositionQuality(quality);
       
   260 
       
   261     //Accuracy
       
   262     accuracy = quality.HorizontalAccuracy();
       
   263 
       
   264     //time taken for the first fix
       
   265     time_to_first_fix = quality.TimeToFirstFix();
       
   266 
       
   267     //time taken for the subsequent fix
       
   268     time_to_next_fix = quality.TimeToNextFix();
       
   269 
       
   270 
       
   271     if ((i = checkModule(id)) == -1) {
       
   272         //update the properties of the module
       
   273 
       
   274         //TPositionModuleId of the module
       
   275         mList[mListSize].mUid = id;
       
   276 
       
   277         //status of the device
       
   278         mList[mListSize].mStatus = aStatus;
       
   279 
       
   280         //availablility of the module
       
   281         mList[mListSize].mIsAvailable = available;
       
   282 
       
   283         //horizontal accuracy of the module
       
   284         mList[mListSize].mHorizontalAccuracy = accuracy;
       
   285 
       
   286         //time required to get the first fix
       
   287         mList[mListSize].mTimeToFirstFix = time_to_first_fix;
       
   288 
       
   289         //time required for subsequent fix
       
   290         mList[mListSize].mTimeToNextFix = time_to_next_fix;
       
   291 
       
   292         //count on the mList array size
       
   293         mListSize++;
       
   294     } else {
       
   295         //module's status has changed
       
   296         if (mList[i].mStatus != aStatus)
       
   297             mList[i].mStatus = aStatus;
       
   298 
       
   299         //module's availability has changed
       
   300         if (mList[i].mIsAvailable != available)
       
   301             mList[i].mIsAvailable = available;
       
   302 
       
   303         //module's horizontal accuracy has changed
       
   304         if (mList[i].mHorizontalAccuracy != accuracy)
       
   305             mList[i].mHorizontalAccuracy = accuracy;
       
   306 
       
   307         //module's time to first fix has changed
       
   308         if (mList[i].mTimeToFirstFix != time_to_first_fix)
       
   309             mList[i].mTimeToFirstFix = time_to_first_fix;
       
   310 
       
   311         //module's time to subsequent fix has changed
       
   312         if (mList[i].mTimeToNextFix != time_to_next_fix)
       
   313             mList[i].mTimeToFirstFix = time_to_next_fix;
       
   314 
       
   315         //if the mCurrentModuleId is NULL, try updating the reg update with the available
       
   316         //positioning method
       
   317         if (mCurrentModuleId == TUid::Null() && (available == TRUE) &&
       
   318                 (aStatus != TPositionModuleStatus::EDeviceUnknown) &&
       
   319                 (aStatus != TPositionModuleStatus::EDeviceError)) {
       
   320             TInt interval = 0;
       
   321 
       
   322             TRAPD(ret, temp = CQMLBackendAO::NewL(this, RegularUpdate,
       
   323                                                   mList[i].mUid));
       
   324 
       
   325             if ((ret == KErrNone) && (temp != NULL)) {
       
   326                 temp->setUpdateInterval(interval);
       
   327 
       
   328                 mRegUpdateAO = temp;
       
   329 
       
   330                 //to be uncommented when startUpdates are done
       
   331 
       
   332                 if (mStartUpdates)
       
   333                     mRegUpdateAO->startUpdates();
       
   334 
       
   335 
       
   336                 mCurrentModuleId = mList[i].mUid;
       
   337 
       
   338             }
       
   339         }
       
   340 
       
   341         //check if the status of the currently used modules for regular update or
       
   342         //request update has changed
       
   343         if (((id == mCurrentModuleId) || (id == mReqModuleId)) &&
       
   344                 ((aStatus == TPositionModuleStatus::EDeviceUnknown) ||
       
   345                  (aStatus == TPositionModuleStatus::EDeviceError) ||
       
   346                  (available == FALSE))) {
       
   347             //if the change happened for regular update
       
   348             if (id == mCurrentModuleId) {
       
   349                 TInt interval = 0;
       
   350 
       
   351                 TUint8 bits;
       
   352 
       
   353                 delete  mRegUpdateAO;
       
   354 
       
   355 
       
   356                 bits = mModuleFlags;
       
   357 
       
   358                 do {
       
   359                     //error = Get the index of the positioning module based on
       
   360                     //priority position module providing the satellite fix
       
   361                     index = getIndexPositionModule(bits);
       
   362 
       
   363                     if (index >= 0) {
       
   364                         TRAPD(ret, temp = CQMLBackendAO::NewL(this, RegularUpdate,
       
   365                                                               mList[index].mUid));
       
   366 
       
   367                         if ((ret == KErrNone) && (temp != NULL))
       
   368                             break;
       
   369 
       
   370                         bits = bits & (0XFF ^(1 << index));
       
   371                     }
       
   372                 } while (index >= 0);
       
   373 
       
   374 
       
   375                 if (temp != NULL) {
       
   376                     //successful in creating the subsession for the required
       
   377                     //method
       
   378                     mRegUpdateAO = temp;
       
   379 
       
   380                     mRegUpdateAO->setUpdateInterval(interval);
       
   381 
       
   382                     if (mStartUpdates)
       
   383                         mRegUpdateAO->startUpdates();
       
   384 
       
   385 
       
   386                     mCurrentModuleId = mList[index].mUid;
       
   387 
       
   388                 } else {
       
   389                     //no methods available,clean up the resources
       
   390                     mRegUpdateAO = NULL;
       
   391                     mCurrentModuleId = TUid::Null();
       
   392                 }
       
   393 
       
   394             }
       
   395 
       
   396             //check if device status of the request update module changed
       
   397             if (id == mReqModuleId) {
       
   398                 delete mReqUpdateAO;
       
   399                 mReqUpdateAO = NULL;
       
   400                 mReqModuleId = TUid::Null();
       
   401                 emit requestTimeout();
       
   402             }
       
   403 
       
   404         }
       
   405 
       
   406     }   //end else
       
   407 
       
   408 }
       
   409 
       
   410 
       
   411 // Notification methods from active object. Notifies device status changes
       
   412 void CQGeoSatelliteInfoSourceS60::updateDeviceStatus(void)
       
   413 {
       
   414     TPositionModuleStatus moduleStatus;
       
   415     TPositionModuleInfo moduleInfo;
       
   416 
       
   417     //mListSize = 0 : called updateDeviceStatus() first time to initialise the array
       
   418     if (mListSize == 0) {
       
   419         TUint modCount;
       
   420 
       
   421         //count on the modules currently supported by the device
       
   422         mPositionServer.GetNumModules(modCount);
       
   423 
       
   424         for (TInt i = 0; i < modCount; i++) {
       
   425             //get module information
       
   426             mPositionServer.GetModuleInfoByIndex(i, moduleInfo);
       
   427 
       
   428             if (moduleInfo.Capabilities() & TPositionModuleInfo::ECapabilitySatellite) {
       
   429                 //get module status
       
   430                 mPositionServer.GetModuleStatus(moduleStatus, moduleInfo.ModuleId());
       
   431 
       
   432                 //update the properties of the module in the mList array
       
   433                 updateStatus(moduleInfo, moduleStatus.DeviceStatus());
       
   434 
       
   435                 mModuleFlags |= (1 << i);
       
   436             }
       
   437         }
       
   438     } else {
       
   439         //UpdateDeviceStatus() called afetr registering for NotifyModuleStatusEvent
       
   440 
       
   441         //get the module id from the status event
       
   442         TPositionModuleId id = mStatusEvent.ModuleId();
       
   443 
       
   444         //get module information
       
   445         mPositionServer.GetModuleInfoById(id, moduleInfo);
       
   446 
       
   447         if (moduleInfo.Capabilities() & TPositionModuleInfo::ECapabilitySatellite) {
       
   448             //get current status of the module
       
   449             mStatusEvent.GetModuleStatus(moduleStatus);
       
   450 
       
   451             //update the properties of the module in the mList array
       
   452             updateStatus(moduleInfo, moduleStatus.DeviceStatus());
       
   453         }
       
   454 
       
   455     }
       
   456 
       
   457     //register for next NotifyModuleStatusEvent
       
   458     mDevStatusUpdateAO->notifyDeviceStatus(mStatusEvent);
       
   459 
       
   460 }
       
   461 
       
   462 //
       
   463 void CQGeoSatelliteInfoSourceS60::TPositionSatelliteInfo2QGeoSatelliteInfo(
       
   464     TPositionSatelliteInfo  aSatInfo, QList<QGeoSatelliteInfo> &qListSatInView,
       
   465     QList<QGeoSatelliteInfo> &qListSatInUse)
       
   466 {
       
   467     TInt satInView = aSatInfo.NumSatellitesInView();
       
   468     TInt satUsed  = aSatInfo.NumSatellitesUsed();
       
   469     TSatelliteData satData;
       
   470     QGeoSatelliteInfo qInfo;
       
   471 
       
   472     for (TInt i = 0; i < satInView; i++) {
       
   473         aSatInfo.GetSatelliteData(i, satData);
       
   474         qInfo.setSignalStrength(satData.SignalStrength());
       
   475         qInfo.setPrnNumber(satData.SatelliteId());
       
   476         qInfo.setAttribute(QGeoSatelliteInfo::Elevation, satData.Elevation());
       
   477         qInfo.setAttribute(QGeoSatelliteInfo::Azimuth, satData.Azimuth());
       
   478         if (satData.IsUsed() == TRUE) {
       
   479             qListSatInUse.append(qInfo);
       
   480         }
       
   481         qListSatInView.append(qInfo);
       
   482     }
       
   483 }
       
   484 //
       
   485 void CQGeoSatelliteInfoSourceS60::updatePosition(TPositionSatelliteInfo aSatInfo,
       
   486         int aError, bool isStartUpdate)
       
   487 {
       
   488     QList<QGeoSatelliteInfo> qListSatInUse;
       
   489     QList<QGeoSatelliteInfo> qListSatInView;
       
   490     if (aError == KErrNone) {
       
   491         //fill posUpdate
       
   492         TPositionSatelliteInfo2QGeoSatelliteInfo(aSatInfo, qListSatInView,
       
   493                 qListSatInUse);
       
   494         if ((receivers(SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) > 0)) {
       
   495             if ((isStartUpdate == FALSE) || (mqListSatInView != qListSatInView)) {
       
   496                 emit satellitesInViewUpdated(qListSatInView);
       
   497                 mqListSatInView = qListSatInView;
       
   498             }
       
   499         }
       
   500 
       
   501         if ((receivers(SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&))) > 0)) {
       
   502             if ((isStartUpdate == FALSE) || (mqListSatInUse != qListSatInUse)) {
       
   503                 emit satellitesInUseUpdated(qListSatInUse);
       
   504                 mqListSatInUse = qListSatInUse;
       
   505             }
       
   506         }
       
   507     }
       
   508 
       
   509     else if (aError == KErrTimedOut) {
       
   510         //request has timed out
       
   511         emit requestTimeout();
       
   512     }
       
   513 }
       
   514 
       
   515 // for request update
       
   516 void CQGeoSatelliteInfoSourceS60::requestUpdate(int aTimeout)
       
   517 {
       
   518     TInt index = -1;
       
   519     TUint8 bits;
       
   520 
       
   521     CQMLBackendAO *temp;
       
   522 
       
   523     //requestupdate
       
   524     //return if already a request update is pending
       
   525     if (mReqUpdateAO && mReqUpdateAO->isRequestPending())
       
   526         return;
       
   527 
       
   528     if (aTimeout < 0) {
       
   529         emit requestTimeout();
       
   530         return;
       
   531     }
       
   532 
       
   533     bits = mModuleFlags;
       
   534 
       
   535     do  {
       
   536 
       
   537         //index of the more accurate method in the array
       
   538         index = getMoreAccurateMethod(aTimeout, bits);
       
   539 
       
   540         //no positioning method method available : emit requestTimeout
       
   541         if (index < 0) {
       
   542             emit requestTimeout();
       
   543             break;
       
   544         }
       
   545         //if the selected module for request update is same as the previous one reuse the request
       
   546         if (mList[index].mUid == mReqModuleId) {
       
   547             mReqUpdateAO->requestUpdate(aTimeout);
       
   548             return;
       
   549         }
       
   550 
       
   551         TRAPD(ret, temp = CQMLBackendAO::NewL(this, OnceUpdate, mList[index].mUid));
       
   552 
       
   553         if ((ret == KErrNone) && (temp != NULL)) {
       
   554             //delete the old reqest update
       
   555             delete mReqUpdateAO;
       
   556 
       
   557             //set the requestAO to the newly created AO
       
   558             mReqUpdateAO = temp;
       
   559 
       
   560             //set the request module ID
       
   561             mReqModuleId = mList[index].mUid;
       
   562 
       
   563             //start the update
       
   564             mReqUpdateAO->requestUpdate(aTimeout);
       
   565 
       
   566             return;
       
   567         }
       
   568 
       
   569         bits = bits & (0XFF ^(1 << index));
       
   570 
       
   571     } while (index >= 0);
       
   572 
       
   573     //cleanup resources if the invalid requpdate is still stored
       
   574     if (mReqUpdateAO) {
       
   575         delete mReqUpdateAO;
       
   576         mReqModuleId = TUid::Null();
       
   577     }
       
   578 
       
   579 }
       
   580 
       
   581 // starts the regular updates
       
   582 void CQGeoSatelliteInfoSourceS60::startUpdates()
       
   583 {
       
   584     if (mRegUpdateAO && ((receivers(SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) > 0) ||
       
   585                          (receivers(SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&))) > 0)))
       
   586         mRegUpdateAO->startUpdates();
       
   587 
       
   588     mStartUpdates = true;
       
   589 }
       
   590 
       
   591 // stops the regular updates
       
   592 void CQGeoSatelliteInfoSourceS60::stopUpdates()
       
   593 {
       
   594     mStartUpdates = false;
       
   595     if (mReqUpdateAO)
       
   596         mRegUpdateAO->cancelUpdate();
       
   597 }
       
   598 
       
   599 
       
   600 void CQGeoSatelliteInfoSourceS60::connectNotify(const char *aSignal)
       
   601 {
       
   602     // start update if it already connected
       
   603     if (mStartUpdates && mRegUpdateAO && ((QLatin1String(aSignal) == SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) ||
       
   604                                           (QLatin1String(aSignal) == SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&)))))
       
   605         mRegUpdateAO->startUpdates();
       
   606 
       
   607 }
       
   608 
       
   609 void CQGeoSatelliteInfoSourceS60::disconnectNotify(const char *aSignal)
       
   610 {
       
   611     // Cancel updates if slot is disconnected for the positionUpdate() signal.
       
   612 
       
   613     if ((mRegUpdateAO) && (QLatin1String(aSignal) == SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) && (receivers(SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&))) == 0) &&
       
   614             (QLatin1String(aSignal) == SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&))) && (receivers(SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&))) == 0))
       
   615         mRegUpdateAO->cancelUpdate();
       
   616 
       
   617 }
       
   618 
       
   619 QTM_END_NAMESPACE
       
   620