qtmobility/src/location/qgeosatelliteinfosource_s60_p.h
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 #ifndef QGEOSATELLITEINFOSOURCE60_H_
       
    43 #define QGEOSATELLITEINFOSOURCE60_H_
       
    44 
       
    45 // INCLUDES
       
    46 #include <e32std.h>
       
    47 #include <e32base.h>
       
    48 #include <lbs.h>
       
    49 #include "qgeosatelliteinfosource.h"
       
    50 #include "notificationsatellitecallback_s60_p.h"
       
    51 
       
    52 #define MAX_SIZE 5
       
    53 
       
    54 QTM_BEGIN_NAMESPACE
       
    55 
       
    56 // CLASS DECLARATION
       
    57 //forward declaration
       
    58 class CQMLBackendAO;
       
    59 
       
    60 class CSatMethodInfo
       
    61 {
       
    62 public:
       
    63     // A unique id for the positioning module
       
    64     TPositionModuleId  mUid;
       
    65 
       
    66     // current status of the module
       
    67     int  mStatus;
       
    68 
       
    69     // time to first and next fix from the location server
       
    70     TTimeIntervalMicroSeconds  mTimeToFirstFix;
       
    71     TTimeIntervalMicroSeconds  mTimeToNextFix;
       
    72 
       
    73     // Accuracy
       
    74     double mHorizontalAccuracy;
       
    75 
       
    76     // Flags whether the positioning technology is currently available or not.
       
    77     bool mIsAvailable;
       
    78 };
       
    79 
       
    80 
       
    81 /**
       
    82  *  CQGeoSatelliteInfoSourceS60
       
    83  *
       
    84  */
       
    85 class CQGeoSatelliteInfoSourceS60 : public INotificationSatelliteCallback,
       
    86             public QGeoSatelliteInfoSource
       
    87 
       
    88 {
       
    89 public:
       
    90     // Constructors and destructor
       
    91     /**
       
    92      * Destructor.
       
    93      */
       
    94     ~CQGeoSatelliteInfoSourceS60();
       
    95 
       
    96     /**
       
    97      * Two-phased constructor.
       
    98      */
       
    99     static CQGeoSatelliteInfoSourceS60* NewL(QObject* aParent);
       
   100 
       
   101     /**
       
   102      * Two-phased constructor.
       
   103      */
       
   104     static CQGeoSatelliteInfoSourceS60* NewLC(QObject* aParent);
       
   105 
       
   106     /**
       
   107      * Notification methods from active object.
       
   108      * Notifies device status, position value, and status
       
   109      */
       
   110     void updateDeviceStatus(void) ;
       
   111 
       
   112     /**
       
   113      * Update the position info
       
   114      */
       
   115     void updatePosition(TPositionSatelliteInfo aPosSatInfo, int aError , bool isStartUpdate);
       
   116 
       
   117 
       
   118     /**
       
   119      * Gets the handle of the PositionServer
       
   120      */
       
   121     RPositionServer& getPositionServer() {
       
   122         return mPositionServer;
       
   123     }
       
   124 
       
   125     int minimumUpdateInterval() const;
       
   126 
       
   127     /*
       
   128      * checks whether the object is valid
       
   129      */
       
   130     inline TBool isValid() {
       
   131         if (mDevStatusUpdateAO && mRegUpdateAO)
       
   132             return TRUE;
       
   133         else
       
   134             return FALSE;
       
   135     }
       
   136 
       
   137     inline TPositionModuleId getCurrentPositonModuleID() {
       
   138         return mCurrentModuleId;
       
   139     }
       
   140 
       
   141     inline TPositionModuleId getRequestUpdateModuleID() {
       
   142         return mReqModuleId;
       
   143     }
       
   144 
       
   145 public slots :
       
   146     // for request update
       
   147     void requestUpdate(int timeout = 5000);
       
   148 
       
   149     // starts the regular updates
       
   150     virtual void startUpdates();
       
   151 
       
   152     // stops the regular updates
       
   153     virtual void stopUpdates();
       
   154 
       
   155 
       
   156 private:
       
   157 
       
   158     /**
       
   159      * Constructor for performing 1st stage construction
       
   160      */
       
   161     CQGeoSatelliteInfoSourceS60(QObject* aParent = 0);
       
   162 
       
   163     /**
       
   164      * EPOC default constructor for performing 2nd stage construction
       
   165      */
       
   166     void ConstructL();
       
   167 
       
   168     void updateStatus(TPositionModuleInfo aModInfo, TInt aStatus);
       
   169 
       
   170     //get the index of the module in the List array
       
   171     TInt checkModule(TPositionModuleId aId) const;
       
   172 
       
   173     //get the index of the position module based on the preferred methods
       
   174     TInt getIndexPositionModule(TUint8 aBits) const;
       
   175 
       
   176     //get the more accuarte method with time to first fix < than timeout
       
   177     TInt getMoreAccurateMethod(TInt aTimeout, TUint8 aBits);
       
   178 
       
   179     void TPositionSatelliteInfo2QGeoSatelliteInfo(TPositionSatelliteInfo aSatInfo,
       
   180             QList<QGeoSatelliteInfo> &qListSatInView,
       
   181             QList<QGeoSatelliteInfo> &qListSatInUse);
       
   182 
       
   183 
       
   184 protected:
       
   185     void connectNotify(const char *aSignal);
       
   186 
       
   187     void disconnectNotify(const char *aSignal);
       
   188 
       
   189 private:
       
   190     /**
       
   191     * Active object for requestUpdate
       
   192     */
       
   193     CQMLBackendAO * mReqUpdateAO;
       
   194 
       
   195     /**
       
   196     *prvmoduleID
       
   197     */
       
   198     TPositionModuleId mReqModuleId;
       
   199 
       
   200     /**
       
   201     * Active object for device status updates
       
   202     */
       
   203     CQMLBackendAO * mDevStatusUpdateAO;
       
   204 
       
   205     /**
       
   206      * Positioner server
       
   207      */
       
   208     RPositionServer mPositionServer;
       
   209 
       
   210 
       
   211     /**
       
   212     * Active object for regular updates.
       
   213     */
       
   214     CQMLBackendAO * mRegUpdateAO;
       
   215 
       
   216     /*
       
   217      * Number of Satellites in View
       
   218      */
       
   219     QList<QGeoSatelliteInfo> mqListSatInView;
       
   220 
       
   221     /*
       
   222      * Numberof Satellites in Use
       
   223      */
       
   224     QList<QGeoSatelliteInfo> mqListSatInUse;
       
   225 
       
   226     /**
       
   227     *  list of supported position methods
       
   228     */
       
   229     CSatMethodInfo mList[MAX_SIZE];
       
   230 
       
   231     /**
       
   232     *  current module ID
       
   233     */
       
   234     TPositionModuleId mCurrentModuleId;
       
   235 
       
   236     /**
       
   237      * maintaiss the size of thr CPosMethodInfo array
       
   238      */
       
   239     int mListSize;
       
   240 
       
   241     /*
       
   242      * query for the status
       
   243      */
       
   244     TPositionModuleStatusEvent  mStatusEvent;
       
   245 
       
   246     /*
       
   247      * maintain the startUpdates status
       
   248      */
       
   249     TBool mStartUpdates;
       
   250 
       
   251     /*
       
   252      * flags for the modules
       
   253      */
       
   254     TUint8  mModuleFlags;
       
   255 };
       
   256 
       
   257 QTM_END_NAMESPACE
       
   258 
       
   259 #endif /* QGEOSATELLITEINFOSOURCE60_H_ */