locationrequestmgmt/locationserver/inc/EPos_CPositionRequest.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 17 Sep 2010 08:37:32 +0300
changeset 60 9a7e3d5f461a
parent 51 95c570bf4a05
permissions -rw-r--r--
Revision: 201037 Kit: 201037
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
#ifndef CPOSITIONREQUEST_H
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
#define CPOSITIONREQUEST_H
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
// INCLUDE FILES
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <e32base.h>
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include "epos_proxypositionerconstructparams.h"
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
// CONSTANT DECLARATIONS
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
// FORWARD DECLARATIONS
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
class CPositioner;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
class CPosPositionLog;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
class CPosModuleSettings;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
struct TPosModulesEvent;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
class CPosCallbackTimer;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
class CPosLocMonitorReqHandlerHub;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
// CLASS DECLARATION
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
/**
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
*    Active object implementing a position request cycle. Handles
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
*    activities such as controlling logging and verifying privacy.
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
*
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
*/
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
class CPositionRequest : public CActive
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
    {
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
    public:  // Constructors and destructor
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
    	static CPositionRequest* NewL(CPosModuleSettings& aModuleSettings,
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
    			CPosLocMonitorReqHandlerHub& aLastPositionHandler,
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
    			TProxyPositionerConstructParams& aPositionerParams,
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
    			TBool aIsProxy);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
        virtual ~CPositionRequest();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
    public:  // New functions
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
        void MakeRequestL(const RMessage2& aMessage);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
        void SetUpdateOptions(const TPositionUpdateOptionsBase& aOptions);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
        void GetUpdateOptions(TPositionUpdateOptionsBase& aOptions) const;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
        void NewTrackingSessionIfTracking();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
        void HandleSettingsChangeL(TPosModulesEvent aEvent);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
        void NotifyServerShutdown();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
        void ExtendUpdateTimeOut(const TTimeIntervalMicroSeconds& aAdditionalTime);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
    protected:  // From CActive
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
        void RunL();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
        TInt RunError(TInt aError);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
        void DoCancel();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
    private:
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
        CPositionRequest(CPosModuleSettings& aModuleSettings,
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
        		CPosLocMonitorReqHandlerHub&    aLastPositionHandler,
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
        		TProxyPositionerConstructParams& aPositionerParams,
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
        		TBool aIsProxy);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
        void ConstructL();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
        CPositionRequest( const CPositionRequest& );
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
        CPositionRequest& operator= ( const CPositionRequest& );
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
        void CompleteRequest(TInt aReason);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
        void CompleteClient(TInt aReason);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
        void CompleteSelf(TInt aReason);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
        void StartPositionDataRequestPhase();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
        void StartTrackingTimerWaitPhase();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
        TInt PackPositionData();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
        void SaveAsLastKnownPosition();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
        static TInt HandleTimeOut(TAny* aPositionRequest);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
        static TInt TrackingCallback(TAny* aPositionRequest);
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
        void HandleTrackingStateL();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
        void RestartTrackingL();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
        void StopTracking();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
        void ContinueTrackingTimer();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
        void StartPsyTrackingL();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
        void StopPsyTracking();
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
        void LoadPositionerL();
60
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   100
        
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   101
        void ActivatePositioningStatusIfNeeded();
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   102
        
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   103
        void DeActivatePositioningStatusIfNeeded();
36
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
    private:  // Data
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
        enum TPosRequestStage
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
            {
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
            EPosReqInactive = 0,
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
            EPosReqPositionRequest,
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
            EPosWaitForTracking
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
            };
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
        enum TPosTrackingState
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
            {
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
            EPosNoTracking = 0,         /** No tracking is ongoing */
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
            EPosFirstTrackingRequest,   /** This request completes immediately
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
                                            Next will be delayed by interval */
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
            EPosTracking,               /** Internal and PSYs timers started */
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
            EPosStopTracking            /** Tracking marked to stop */
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
            };
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
        RMessage2                   	iMessage;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
    	HBufC8*                     	iPositionBuffer;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
        TPosRequestStage            	iRequestPhase;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
        TInt                        	iRequestId;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
        CPositioner*                	iPositioner; 
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
        TPositionModuleInfo         	iModuleInfo;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
        TProxyPositionerConstructParams  iPositionerParams;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
        TBool                       	iHasProxyPositioner;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
        TTime                       	iReqStartTime;        
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
        CPosCallbackTimer*          	iTimeoutTimer;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
        TTimeIntervalMicroSeconds   	iTimeOut;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
        TBool                       	iRequestTimedOut;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
        TBool                       	iPositionerTrackingStarted;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
        TPosTrackingState           	iTrackingState;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
        CPosCallbackTimer*          	iTrackingTimer;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
        TTimeIntervalMicroSeconds  	 	iTrackingUpdateInterval;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
        TBool                       	iTrackingOverridden;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
        const RRequestorStack*      	iTrackingRequestorStackPtr;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
        TBool                       	iNewTrackingInterval;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
//        CPosLocMonitorReqHandlerHub&    iLastPositionHandler;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
        CPosLocMonitorReqHandlerHub&    iLocMonitorReqHandler;
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
        CPosModuleSettings&         	iModuleSettings;
60
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   148
        
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   149
        TUid                            iPosStatusCategory;
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   150
        
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   151
        /**
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   152
         * Positioning state flag
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   153
         */
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   154
        TBool                           iPositioningActive;
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   155
        
9a7e3d5f461a Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 51
diff changeset
   156
        
36
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
    };  
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
#endif  // CPOSITIONREQUEST_H
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
b47902b73a93 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
// End of File