lbs/common/inc/ctlbsportedstepbase.h
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file ctlbsportedstepbase.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __CT_LBS_PORTED_STEP_BASE_H__
       
    19 #define __CT_LBS_PORTED_STEP_BASE_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include <w32std.h>
       
    23 #include <LbsPositionInfo.h>
       
    24 #include <Lbs.h>
       
    25 #include <LbsCommon.h>
       
    26 #include <LbsRequestor.h>
       
    27 #include <centralrepository.h>
       
    28 #include "ctlbsstep.h"
       
    29 #include "ctlbsserver.h"
       
    30 
       
    31 // CONSTANTS
       
    32 enum TPosSetupPsyDirective
       
    33     {
       
    34     EPosDisableTheRest = 0
       
    35     };
       
    36 
       
    37 // UID:s for PSY:s
       
    38 const TInt32 KUidExternalGps        = 0x101f7a7d;
       
    39 const TInt32 KUidManualInput        = 0x101f7a7e;
       
    40 const TInt32 KUidDefault            = 0x101f7a7f;
       
    41 const TInt32 KUidStrategy           = 0x101f7a80;
       
    42 const TInt32 KUidSimulationPsy      = 0x101f7a81;
       
    43 const TInt32 KUidStubPositioner     = 0x01000019;
       
    44 const TInt32 KUidDynDbTestPsy       = 0x01000016;
       
    45 const TInt32 KUidInstallTestPsy     = 0x01000015;
       
    46 const TInt32 KUidTestPsySimulateIsa = 0x01000018;
       
    47 const TInt32 KUidTestPsy1           = 0x01000001;
       
    48 const TInt32 KUidTestPsy2           = 0x01000002;
       
    49 const TInt32 KUidTestPsy3           = 0x01000003;
       
    50 const TInt32 KUidTestPsy4           = 0x01000004;
       
    51 const TInt32 KUidTestPsy5           = 0x01000005;
       
    52 const TInt32 KUidTestPsy6           = 0x01000006;
       
    53 const TInt32 KUidTestPsy7           = 0x01000007;
       
    54 const TInt32 KUidTestPsy8           = 0x01000008;
       
    55 const TInt32 KUidTestPsy9           = 0x01000009;
       
    56 const TInt32 KUidTestPsy10          = 0x01000010;
       
    57 const TInt32 KUidTestPsy11          = 0x01000011;
       
    58 const TInt32 KUidTestPsy12          = 0x01000012;
       
    59 const TInt32 KUidTestPsy13          = 0x01000013;
       
    60 const TInt32 KUidTestPsy256         = 0x01000017;
       
    61 const TInt32 KUidTestPsyTp176       = 0x01000176;
       
    62 const TInt32 KUidMultiPsy           = 0x01010176;
       
    63 const TInt32 KUidTestStatusPsy      = 0x01000191;
       
    64 const TInt32 KUidTestTimerPsy       = 0x01000192;
       
    65 const TInt32 KUidExamplePsy         = 0x10001234; // TBD not impl UID
       
    66 const TInt32 KUidPanicPsy           = 0x01010210;
       
    67 const TInt32 KUidTestPsyPartialUpdate = 0x01000021;
       
    68 const TInt32 KUidPsySwitching       = 0x00000000; // TBD fill in when there ever is a switching psy
       
    69 const TInt32 KUidTestPsyMaxAge      = 0x01000020;
       
    70 const TInt32 KUidTestRangePsy       = 0x01000022;
       
    71 const TInt32 KUidTestSingPsy        = 0x01f0ff23;
       
    72 const TInt32 KUidTestTrackingPsy    = 0x01f0ff24;
       
    73 
       
    74 const TInt32 KTestProxyPsy1         = 0x01f0e001;
       
    75 const TInt32 KTestProxyPsy2         = 0x01f0e002;
       
    76 const TInt32 KTestProxyPsy3         = 0x01f0e003;
       
    77 const TInt32 KTestProxyPsy4         = 0x01f0e004;
       
    78 
       
    79 const TInt32 KInstallPsyTp273         = 0x01f0e005;
       
    80 
       
    81 const TInt32 KUidTestPsyPartialUpdate2 = 0x01000023;
       
    82 const TInt32 KUidSatInfoPsy         =    0x01010177;
       
    83 
       
    84 const TInt32 KUidBtgPsy         =    0x101FE999;
       
    85 const TInt32 KUidIgPsy          =    0x101FE999;
       
    86 
       
    87 const TInt KEspectedErrorCodePSY1 = KErrNone;
       
    88 const TInt KEspectedErrorCodePSY2 = KPositionPartialUpdate;
       
    89 const TInt KEspectedErrorCodePSY3 = KErrPositionBufferOverflow;
       
    90 const TInt KEspectedErrorCodePSY4 = KErrNone;
       
    91 
       
    92 // Central repository constants for Default Proxy.
       
    93 const TUid KCRUidDefaultProxyConfiguration = { 0x101f7a7f };
       
    94 const TUint32 KDefaultProxyLastWorkingGpsPsy = 0x10000001;
       
    95 
       
    96 
       
    97 // CLASS DECLARATION
       
    98 class CT_LbsClientLog;
       
    99 
       
   100 /****************************************************************************
       
   101 * The reason to have a new step base is that it is very much possible
       
   102 * that the all individual test steps have project related common variables 
       
   103 * and members 
       
   104 * and this is the place to define these common variable and members.
       
   105 * 
       
   106 ****************************************************************************/
       
   107 class CT_LbsPortedStepBase : public CT_LbsStep
       
   108 	{
       
   109 public:
       
   110 	virtual ~CT_LbsPortedStepBase();
       
   111 	CT_LbsPortedStepBase(CT_LbsServer& aParent);
       
   112 	virtual TVerdict doTestStepPreambleL(); 
       
   113     virtual TVerdict doTestStepL();
       
   114 	virtual TVerdict doTestStepPostambleL();
       
   115 
       
   116 //Please add your class members which will be common to all individual test steps:
       
   117 protected:
       
   118 	HBufC8*		iReadData;
       
   119 	HBufC8*		iWriteData;
       
   120     
       
   121 public: // New functions
       
   122     
       
   123     /**
       
   124     * Starts the test
       
   125     */
       
   126     virtual void StartL() = 0;
       
   127     
       
   128 public: // Functions from base classes
       
   129     
       
   130     /**
       
   131     * Runs the test in the module
       
   132     * @param aIndex Indicates which internal test to run.
       
   133     */
       
   134     void StartL(TInt aIndex);    
       
   135     
       
   136 protected: // New functions
       
   137     
       
   138     /**
       
   139     * Setup privacy and notification override settings
       
   140     * @param aPsyName   the name of the psy
       
   141     * @param aDirective how to setup the PSY:s
       
   142     *                   Enum def in this file.
       
   143     */
       
   144     void SetupPsyL(const TUid aPsyUid,
       
   145                    TPosSetupPsyDirective aDirective = EPosDisableTheRest);
       
   146     
       
   147     /**
       
   148     * Initialises the test.
       
   149     * By default does nothing.
       
   150     */
       
   151     virtual void InitTestL();
       
   152     
       
   153     /**
       
   154     * Cleans up after a test.
       
   155     * Always called, even if the test leaves.
       
   156     * By default does nothing.
       
   157     */
       
   158     virtual void CloseTest();
       
   159     
       
   160     /**
       
   161     * Connect to epos server.
       
   162     */
       
   163     void ConnectL();
       
   164     
       
   165     /**
       
   166     * Open a PSY by name.
       
   167     */
       
   168     TInt OpenPositionerByName(const TUid aPsyUid);
       
   169     
       
   170     /**
       
   171     * Open default PSY.
       
   172     */
       
   173     TInt OpenPositioner();
       
   174     
       
   175     /**
       
   176     * Close PSY by calling "iPositioner.Close()"
       
   177     */
       
   178     void ClosePositioner();
       
   179     
       
   180     /**
       
   181     * Close connection with epos server.
       
   182     */
       
   183     void Disconnect();
       
   184     
       
   185     /**
       
   186     * Perform a request to epos.
       
   187     * Use this methods when requesting from 
       
   188     * both a service and another requestor source, ie a Contact
       
   189     */
       
   190     void PerformRequestL(const TDesC& aService,
       
   191                          const TDesC& aContact, 
       
   192                          CRequestor::_TRequestorType aServiceIdType,
       
   193                          CRequestor::_TRequestorType aContactIdType,
       
   194                      // Set default values
       
   195                      CRequestor::_TRequestorFormat aServiceFormat = CRequestor::EFormatApplication,
       
   196                      CRequestor::_TRequestorFormat aContactFormat = CRequestor::EFormatTelephone
       
   197      );
       
   198     
       
   199     /**
       
   200     * Perform a request to epos. 
       
   201     */
       
   202     void PerformRequestL(const TDesC& aRequestor,
       
   203         CRequestor::_TRequestorType aRequestorType,
       
   204       CRequestor::_TRequestorFormat aRequestorFormat);
       
   205     
       
   206     /**
       
   207     * Perform a synchronous request to epos and return errorcode. 
       
   208     * Position info is returned in OUT parameter
       
   209     */
       
   210     TInt PerformSyncRequest(const TDesC& aServiceName,
       
   211                    /* OUT */TPositionInfoBase* aModuleInfo);
       
   212     
       
   213     /**
       
   214     * Check the result of a request to epos.
       
   215     * Leaves if the error code is not the expected one.
       
   216     * The log file is used to print the result from the request
       
   217     */
       
   218     void CheckRequestResultL(TInt aExpectedErrorCode, TBool aLogFlag = ETrue);
       
   219     
       
   220     /**
       
   221     * Leaves if aCondition is false.
       
   222     * @param aCondition something that should be true
       
   223     */
       
   224     void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode);
       
   225 
       
   226     /**
       
   227      * Leaves if aCondition is false.
       
   228      * @param aCondition something that should be true
       
   229      */
       
   230      void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg);
       
   231     
       
   232     /**
       
   233     * Get the last updated position info from positioner
       
   234     * Uses GetLastKnownPosition() method.
       
   235     * @return position info.
       
   236     */
       
   237     TPositionInfo AllocPositionInfoL();
       
   238     
       
   239     /**
       
   240     * Verifies that a PSY has been loaded by getting its last reported status.
       
   241     * Requires that the PSY report active in its constructor.
       
   242     * @param aUid the PSYs Uid 
       
   243     */ 
       
   244     void VerifyPsyLoadedL(TPositionModuleId aUid); 
       
   245     
       
   246     /**
       
   247     * Verifies that a PSY has been unloaded by getting its last reported status.
       
   248     * Requires that the PSY report inactive in its destructor.
       
   249     * @param aUid the PSYs Uid 
       
   250     */ 
       
   251     void VerifyPsyUnloadedL(TPositionModuleId aUid); 
       
   252     
       
   253     /**
       
   254     * Request a position from the default psy
       
   255     */ 
       
   256     void RequestL(TPositionInfo& aPosInfo, const TInt& aRequestIndex, 
       
   257     		const TInt& aExpectedErrorCode = 999);
       
   258     
       
   259     void LogErrorAndLeaveL(const TDesC& aErrorInfo,
       
   260             const TInt   aReason = KErrGeneral);
       
   261     
       
   262     void SetSimDataFileL(const TDesC& aFileName);
       
   263     
       
   264     void ResetDefaultPSYLastWorkingExtGPSPSYL();
       
   265 
       
   266     void VerifyPositionFromL(TPositionInfo& aPosInfo, TPositionModuleId& aModuleId);
       
   267 
       
   268     void VerifyPositionL(TPositionInfo& aPosInfo, TReal64 aLat, 
       
   269     		TReal64 aLong, TReal64 aAlt);
       
   270 
       
   271     void VerifyRequestTimeLessThanL(TInt aExpectedReqTime);
       
   272     
       
   273     void ConstructL();
       
   274     
       
   275 protected:  // Data
       
   276 
       
   277     TInt                    iNrOfRequests;
       
   278     TInt 					iRequestTime;
       
   279     
       
   280     TInt                    iModuleId;
       
   281     TUid                    iUidExternalGps;         
       
   282     TUid                    iUidManualInput;
       
   283     TUid                    iUidDefault;
       
   284     TUid                    iUidStrategy;
       
   285     TUid                    iUidSimulationPsy;
       
   286     TUid                    iUidStubPositioner;
       
   287     TUid                    iUidDynDbTestPsy;      
       
   288     TUid                    iUidInstallTestPsy;
       
   289     TUid                    iUidTestPsySimulateIsa;
       
   290     TUid                    iUidTestPsy1;
       
   291     TUid                    iUidTestPsy2;        
       
   292     TUid                    iUidTestPsy3;        
       
   293     TUid                    iUidTestPsy4;        
       
   294     TUid                    iUidTestPsy5;        
       
   295     TUid                    iUidTestPsy6;         
       
   296     TUid                    iUidTestPsy7;         
       
   297     TUid                    iUidTestPsy8;         
       
   298     TUid                    iUidTestPsy9;         
       
   299     TUid                    iUidTestPsy10;         
       
   300     TUid                    iUidTestPsy11;         
       
   301     TUid                    iUidTestPsy12;
       
   302     TUid                    iUidTestPsy13;        
       
   303     TUid                    iUidTestPsy256;
       
   304     TUid                    iUidTestPsyTp176;
       
   305     TUid                    iUidMultiPsy;
       
   306     TUid                    iUidExamplePsy;
       
   307     TUid                    iUidTestStatusPsy;
       
   308     TUid                    iUidTestTimerPsy;
       
   309     TUid                    iUidPsySwitching;
       
   310     TUid                    iUidPanicPsy;
       
   311     TUid                    iUidTestPsyPartialUpdate;
       
   312     TUid                    iUidTestPsyMaxAge;
       
   313     TUid                    iUidTestRangePsy;
       
   314     TUid                    iUidTestSingPsy;
       
   315     TUid                    iUidTestTrackingPsy;
       
   316     TUid                    iUidTestProxyPsy1;
       
   317     TUid                    iUidTestProxyPsy2;        
       
   318     TUid                    iUidTestProxyPsy3;        
       
   319     TUid                    iUidTestProxyPsy4;
       
   320     TUid                    iUidInstallPsyTp273;
       
   321     TUid                    iUidPartialUpdate2;
       
   322     TUid                    iUidSatInfoPsy;
       
   323     TUid                    iUidBtgPsy;
       
   324     TUid                    iUidIgPsy;
       
   325     RPositionServer         iPosServer;
       
   326     RPositioner             iPositioner;
       
   327     
       
   328     CActiveScheduler* 		iScheduler;
       
   329     TBool    				iErrors;
       
   330     RFs                 	iFileServer;
       
   331     
       
   332     CT_LbsClientLog*		iLog;
       
   333     
       
   334 private:    // Data
       
   335    
       
   336     TRequestStatus          iStatus;
       
   337     TPositionInfo           iModuleInfo;
       
   338 	};
       
   339 
       
   340 #endif // __CT_LBS_PORTED_STEP_BASE_H__