lbs/lbsclient/src/ctlbsclientpostp4722.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2001-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 //
       
    15 
       
    16 
       
    17 
       
    18 //  INCLUDES
       
    19 #include "ctlbsclientpostp4722.h"
       
    20 #include <EPos_CPosModules.h>
       
    21 #include <EPos_CPosModuleUpdate.h>
       
    22 #include <EPos_CPosModuleIdList.h>
       
    23 
       
    24 
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 
       
    27 // ---------------------------------------------------------
       
    28 // Constructor.
       
    29 // ---------------------------------------------------------
       
    30 CT_LbsClientPosTp4722::CT_LbsClientPosTp4722(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
       
    31     {  
       
    32     _LIT(KTestName, "TP4722 - Default Proxy -Prefer working GPS PSY");
       
    33     SetTestStepName(KTestName); 
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------
       
    37 // Destructor.
       
    38 // ---------------------------------------------------------
       
    39 CT_LbsClientPosTp4722::~CT_LbsClientPosTp4722()
       
    40     {
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CPosTp4722::CloseTest
       
    45 //
       
    46 // (other items were commented in a header).
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 void CT_LbsClientPosTp4722::CloseTest()
       
    50     {
       
    51     ClosePositioner();
       
    52     Disconnect();
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------
       
    56 // CPosTp4722::StartL
       
    57 //
       
    58 // (other items were commented in a header).
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 void CT_LbsClientPosTp4722::StartL()
       
    62     {
       
    63     ConnectL();
       
    64 
       
    65     SetupProxyPSYsL();
       
    66 	ResetDefaultPSYLastWorkingExtGPSPSYL();
       
    67 	
       
    68     TInt err = OpenPositioner();
       
    69     _LIT(KOpenErr, "Error when opening positioner, %d");
       
    70     AssertTrueL(err == KErrNone, KOpenErr, err);
       
    71     
       
    72     _LIT(KServiceName, "TP4722");
       
    73     iPositioner.SetRequestor(CRequestor::ERequestorService, 
       
    74     		CRequestor::EFormatApplication, KServiceName);
       
    75 
       
    76     TPositionSatelliteInfo posInfo;
       
    77 
       
    78     // Pre request
       
    79     TInt request = 100;
       
    80     RequestL(posInfo, request, KErrNone);
       
    81     
       
    82     /////////////////////////////////////////////
       
    83 	// Request 1
       
    84 	/////////////////////////////////////////////
       
    85     request = 4722;    
       
    86     RequestL(posInfo, request, KErrNone);
       
    87     VerifyPositionFromL(posInfo, iUidSatInfoPsy);    
       
    88     VerifyRequestTimeLessThanL(4001000);
       
    89 
       
    90     VerifyPositionL(posInfo, 40, 50, 60);
       
    91 
       
    92 	// Default PSY should pre-load SetInfo PSY since it is External and supports GPS
       
    93     VerifyPsyLoadedL(iUidSatInfoPsy);
       
    94  
       
    95     ClosePositioner();
       
    96     Disconnect();
       
    97     
       
    98     const TTimeIntervalMicroSeconds32 KPosWaitServerShutDown( 6000000 );
       
    99     User::After(KPosWaitServerShutDown);
       
   100 
       
   101     ConnectL();
       
   102     SetupProxyPSYsL();
       
   103     err = OpenPositioner();
       
   104     AssertTrueL(err == KErrNone, KOpenErr, err);
       
   105 
       
   106     iPositioner.SetRequestor(CRequestor::ERequestorService, 
       
   107     		CRequestor::EFormatApplication, KServiceName);
       
   108     
       
   109     /////////////////////////////////////////////
       
   110 	// Request 2
       
   111 	/////////////////////////////////////////////
       
   112     RequestL(posInfo, request, KErrNone);    
       
   113 
       
   114     VerifyPositionFromL(posInfo, iUidSatInfoPsy);    
       
   115     VerifyRequestTimeLessThanL(4001000);
       
   116 
       
   117     VerifyPositionL(posInfo, 40, 50, 60);
       
   118 
       
   119 	// Default PSY won't pre-load Multi PSY since it is Internal
       
   120 	VerifyPsyUnloadedL(iUidMultiPsy);
       
   121 	// Default PSY should pre-load SetInfo PSY since it is External and supports GPS
       
   122     VerifyPsyLoadedL(iUidSatInfoPsy);
       
   123     }
       
   124 
       
   125 // ---------------------------------------------------------
       
   126 // CPosTp4722::SetupProxyPSYsL
       
   127 //
       
   128 // (other items were commented in a header).
       
   129 // ---------------------------------------------------------
       
   130 //
       
   131 void CT_LbsClientPosTp4722::SetupProxyPSYsL()
       
   132     {
       
   133     CPosModules* db = CPosModules::OpenL();
       
   134     CleanupStack::PushL(db);
       
   135 
       
   136     CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC();
       
   137 
       
   138     moduleUpdate->SetUpdateAvailability(EFalse);
       
   139     
       
   140     CPosModuleIdList* prioList = db->ModuleIdListLC();
       
   141 	
       
   142     // Disable all PSY:s except PSYs used by this test case
       
   143     
       
   144     for (TInt i = 0 ; i < prioList->Count(); i++)
       
   145         {
       
   146         if ((*prioList)[i] != iUidMultiPsy &&
       
   147             (*prioList)[i] != iUidSatInfoPsy)
       
   148             {
       
   149             db->UpdateModuleL((*prioList)[i], *moduleUpdate);
       
   150             }
       
   151         }
       
   152     moduleUpdate->SetUpdateAvailability(ETrue);
       
   153     db->UpdateModuleL(iUidMultiPsy, *moduleUpdate);
       
   154     db->UpdateModuleL(iUidSatInfoPsy, *moduleUpdate);
       
   155     
       
   156     db->SetModulePriorityL(iUidMultiPsy, 0);
       
   157     db->SetModulePriorityL(iUidSatInfoPsy, 1);
       
   158     
       
   159     CleanupStack::PopAndDestroy(prioList);
       
   160     CleanupStack::PopAndDestroy(moduleUpdate);
       
   161     CleanupStack::PopAndDestroy(db);
       
   162     } 
       
   163 
       
   164 //  End of File
       
   165 
       
   166