common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4702.cpp
changeset 748 e13acd883fbe
child 872 17498133d9ad
equal deleted inserted replaced
747:76f9aaeefbab 748:e13acd883fbe
       
     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 "ctlbsclientpostp4702.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_LbsClientPosTp4702::CT_LbsClientPosTp4702(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
       
    31     {  
       
    32     _LIT(KTestName, "TP4702 - Default Proxy fallback-Active\\Ready Status2");
       
    33     SetTestStepName(KTestName); 
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------
       
    37 // Destructor.
       
    38 // ---------------------------------------------------------
       
    39 CT_LbsClientPosTp4702::~CT_LbsClientPosTp4702()
       
    40     {
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CPosTp4702::CloseTest
       
    45 //
       
    46 // (other items were commented in a header).
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 void CT_LbsClientPosTp4702::CloseTest()
       
    50     {
       
    51     ClosePositioner();
       
    52     Disconnect();
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------
       
    56 // CPosTp4702::StartL
       
    57 //
       
    58 // (other items were commented in a header).
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 void CT_LbsClientPosTp4702::StartL()
       
    62     {   
       
    63     ConnectL();
       
    64    
       
    65     SetupProxyPSYsL();
       
    66 
       
    67     TInt err = OpenPositioner();
       
    68     _LIT(KOpenErr, "Error when opening positioner, %d");
       
    69     AssertTrueL(err == KErrNone, KOpenErr, err);
       
    70     
       
    71     _LIT(KServiceName, "TP4702");
       
    72     iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName);
       
    73 
       
    74     /////////////////////////////////////////////
       
    75 	// Request 1
       
    76 	/////////////////////////////////////////////
       
    77     TInt request = 4702;
       
    78     TPositionInfo posInfo;
       
    79     RequestL(posInfo, request, KEspectedErrorCodePSY1);    
       
    80 
       
    81     VerifyPositionFromL(posInfo, iUidTestProxyPsy1);
       
    82     VerifyRequestTimeLessThanL(7500000);    
       
    83     
       
    84     /*Default proxy fallbacks to testproxypsy2 because of time-shift,fix will 
       
    85       be given by TestProxyPsy1 first.*/
       
    86     VerifyPsyLoadedL(iUidTestProxyPsy1);
       
    87     VerifyPsyLoadedL(iUidTestProxyPsy2);
       
    88 
       
    89     VerifyPositionL(posInfo, 5, 15, 25);
       
    90     }
       
    91  
       
    92 // ---------------------------------------------------------
       
    93 // CPosTp4702::SetupProxyPSYsL
       
    94 //
       
    95 // (other items were commented in a header).
       
    96 // ---------------------------------------------------------
       
    97 //
       
    98 void CT_LbsClientPosTp4702::SetupProxyPSYsL()
       
    99     {
       
   100     CPosModules* db = CPosModules::OpenL();
       
   101     CleanupStack::PushL(db);
       
   102 
       
   103     CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC();
       
   104 
       
   105     moduleUpdate->SetUpdateAvailability(EFalse);
       
   106     
       
   107     CPosModuleIdList* prioList = db->ModuleIdListLC();
       
   108 	
       
   109     // Disable all PSY:s except PSYs used by this test case
       
   110     
       
   111     for (TInt i = 0 ; i < prioList->Count(); i++)
       
   112         {
       
   113         if ((*prioList)[i] != iUidTestProxyPsy1 &&
       
   114             (*prioList)[i] != iUidTestProxyPsy2)
       
   115             {
       
   116             db->UpdateModuleL((*prioList)[i], *moduleUpdate);
       
   117             }
       
   118         }
       
   119     moduleUpdate->SetUpdateAvailability(ETrue);
       
   120     db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate);
       
   121     db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate);
       
   122     
       
   123     db->SetModulePriorityL(iUidTestProxyPsy1, 0);
       
   124     db->SetModulePriorityL(iUidTestProxyPsy2, 1);
       
   125     
       
   126     CleanupStack::PopAndDestroy(prioList);
       
   127     CleanupStack::PopAndDestroy(moduleUpdate);
       
   128     CleanupStack::PopAndDestroy(db);
       
   129     } 
       
   130 
       
   131 //  End of File