qtmobility/src/location/qmlbackendao_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 
       
    43 #ifndef QMLBACKENDAO_H
       
    44 #define QMLBACKENDAO_H
       
    45 
       
    46 #include <e32base.h>    // For CActive, link against: euser.lib
       
    47 #include <lbs.h>
       
    48 #include <lbscommon.h>
       
    49 #include <lbssatellite.h>
       
    50 #include "qgeopositioninfosource.h"
       
    51 //#include "qgeopositioninfosources60.h"
       
    52 
       
    53 QTM_BEGIN_NAMESPACE
       
    54 
       
    55 class CQGeoPositionInfoSourceS60 ;
       
    56 class CQGeoSatelliteInfoSourceS60;
       
    57 
       
    58 // Types of request
       
    59 enum RequestType {
       
    60     RegularUpdate = 1,  // Regular updates
       
    61     OnceUpdate,     // request update
       
    62     DeviceStatus       // device updates
       
    63 };
       
    64 
       
    65 //
       
    66 class CQMLBackendAO : public CActive
       
    67 {
       
    68 public:
       
    69     // Cancel and destroy
       
    70     ~CQMLBackendAO();
       
    71 
       
    72     // Two-phased constructor.
       
    73     static CQMLBackendAO* NewL(QObject *aRequester,
       
    74                                RequestType  aRequestType, TPositionModuleId  aModId = TUid::Uid(0)
       
    75                               );
       
    76 
       
    77     // Two-phased constructor.
       
    78     static CQMLBackendAO* NewLC(QObject *aRequester,
       
    79                                 RequestType  aRequestType, TPositionModuleId  aModID);
       
    80 
       
    81     // checks any pending request in activeobject
       
    82     bool isRequestPending();
       
    83 
       
    84     // Async call to get notifications about device status.
       
    85     void notifyDeviceStatus(TPositionModuleStatusEventBase &aStatusEvent) ;
       
    86 
       
    87     // requesting for position update once
       
    88     void requestUpdate(int aTimeout);
       
    89 
       
    90     // cancels an outstanding update request
       
    91     void cancelUpdate();
       
    92 
       
    93     // Sets an interval in millisecs for regular notifications
       
    94     int setUpdateInterval(int aMilliSec);
       
    95 
       
    96     void startUpdates();
       
    97 
       
    98 
       
    99 
       
   100 private:
       
   101     // C++ constructor
       
   102     CQMLBackendAO();
       
   103 
       
   104     // Second-phase constructor
       
   105     TInt ConstructL(QObject *aRequester, RequestType  aRequestType,
       
   106                     TPositionModuleId  aModId);
       
   107 
       
   108     // Device Notifications are handled
       
   109     void handleDeviceNotification(int aError);
       
   110 
       
   111     // regular position notifications are handled
       
   112     void handlePosUpdateNotification(int aError);
       
   113 
       
   114     void CancelAll();
       
   115 
       
   116     bool initializePosInfo();
       
   117 
       
   118 private:
       
   119     // From CActive
       
   120     // Handle completion
       
   121     void RunL();
       
   122 
       
   123     // How to cancel me
       
   124     void DoCancel();
       
   125 
       
   126     // Override to handle leaves from RunL(). Default implementation causes
       
   127     // the active scheduler to panic.
       
   128     int RunError(int aError);
       
   129 
       
   130 private:
       
   131 
       
   132     // Request is a device or a regular
       
   133     CQGeoPositionInfoSourceS60 *mRequester;
       
   134 
       
   135     //Request is a device for Satellite update only
       
   136     CQGeoSatelliteInfoSourceS60 *mRequesterSatellite;
       
   137 
       
   138     // Request type once, regular, device
       
   139     RequestType  mRequestType;
       
   140 
       
   141     // Positioning Information
       
   142     RPositioner mPositioner;
       
   143 
       
   144     HPositionGenericInfo *mPosInfo;
       
   145 
       
   146     TPositionSatelliteInfo mPosSatInfo;
       
   147 };
       
   148 
       
   149 QTM_END_NAMESPACE
       
   150 
       
   151 #endif // QMLBACKENDAO_H