common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4708.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 "ctlbsclientpostp4708.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_LbsClientPosTp4708::CT_LbsClientPosTp4708(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
       
    31     {
       
    32     _LIT(KTestName, "TP4708 - Default Proxy-Configure time-shift values");
       
    33     SetTestStepName(KTestName); 
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------
       
    37 // Destructor.
       
    38 // ---------------------------------------------------------
       
    39 CT_LbsClientPosTp4708::~CT_LbsClientPosTp4708()
       
    40     {
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CPosTp4708::CloseTest
       
    45 //
       
    46 // (other items were commented in a header).
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 void CT_LbsClientPosTp4708::CloseTest()
       
    50     {
       
    51     ClosePositioner();
       
    52     Disconnect();
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------
       
    56 // CPosTp4708::StartL
       
    57 //
       
    58 // (other items were commented in a header).
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 void CT_LbsClientPosTp4708::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, "TP4708");
       
    72     iPositioner.SetRequestor(CRequestor::ERequestorService, 
       
    73     		CRequestor::EFormatApplication, KServiceName);
       
    74         
       
    75     /////////////////////////////////////////////
       
    76 	// Request 1
       
    77 	/////////////////////////////////////////////
       
    78     TInt request = 4708;
       
    79     TPositionInfo posInfo;
       
    80     RequestL(posInfo, request, KEspectedErrorCodePSY1);    
       
    81       
       
    82     VerifyPositionFromL(posInfo, iUidTestProxyPsy2);    
       
    83     VerifyRequestTimeLessThanL(8000000);
       
    84     
       
    85     // Default proxy fallbacks to testproxypsy2 
       
    86     // because of time-shift,fix will 
       
    87     // be given by TestProxyPsy2 first.
       
    88     VerifyPsyLoadedL(iUidTestProxyPsy1);
       
    89     VerifyPsyLoadedL(iUidTestProxyPsy2);
       
    90 
       
    91     VerifyPositionL(posInfo, 10, 20, 30);
       
    92     
       
    93     /////////////////////////////////////////////
       
    94 	// Request 2
       
    95 	/////////////////////////////////////////////
       
    96     request = 100;    
       
    97     RequestL(posInfo, request, KEspectedErrorCodePSY1);
       
    98 
       
    99     request = 4708;
       
   100     RequestL(posInfo, request, KEspectedErrorCodePSY1);
       
   101       
       
   102     VerifyPositionFromL(posInfo, iUidTestProxyPsy2);
       
   103     VerifyRequestTimeLessThanL(5001000);
       
   104     
       
   105     VerifyPositionL(posInfo, 10, 20, 30);    
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // CPosTp4708::SetupProxyPSYsL
       
   110 //
       
   111 // (other items were commented in a header).
       
   112 // ---------------------------------------------------------
       
   113 //
       
   114 void CT_LbsClientPosTp4708::SetupProxyPSYsL()
       
   115     {
       
   116     CPosModules* db = CPosModules::OpenL();
       
   117     CleanupStack::PushL(db);
       
   118 
       
   119     CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC();
       
   120     moduleUpdate->SetUpdateAvailability(EFalse);
       
   121     	
       
   122     // Disable all PSY:s except PSYs used by this test case
       
   123     CPosModuleIdList* prioList = db->ModuleIdListLC();
       
   124     for (TInt i = 0 ; i < prioList->Count(); i++)
       
   125         {
       
   126         if ((*prioList)[i] !=  iUidTestProxyPsy1 &&
       
   127             (*prioList)[i] != iUidTestProxyPsy2)
       
   128             {
       
   129             db->UpdateModuleL((*prioList)[i], *moduleUpdate);
       
   130             }
       
   131         }
       
   132     moduleUpdate->SetUpdateAvailability(ETrue);
       
   133     db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate);
       
   134     db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate);
       
   135     
       
   136     db->SetModulePriorityL(iUidTestProxyPsy1, 0);
       
   137     db->SetModulePriorityL(iUidTestProxyPsy2, 1);
       
   138     
       
   139     CleanupStack::PopAndDestroy(prioList);
       
   140     CleanupStack::PopAndDestroy(moduleUpdate);
       
   141     CleanupStack::PopAndDestroy(db);
       
   142     } 
       
   143 
       
   144 //  End of File