common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4723.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 "ctlbsclientpostp4723.h"
       
    20 #include <EPos_CPosModules.h>
       
    21 #include <EPos_CPosModuleUpdate.h>
       
    22 #include <EPos_CPosModuleIdList.h>
       
    23 
       
    24 // ================= MEMBER FUNCTIONS =======================
       
    25 
       
    26 // ---------------------------------------------------------
       
    27 // Constructor.
       
    28 // ---------------------------------------------------------
       
    29 CT_LbsClientPosTp4723::CT_LbsClientPosTp4723(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
       
    30     {
       
    31     _LIT(KTestName, "TP4723 - Default Proxy -Configure working GPS PSY");
       
    32     SetTestStepName(KTestName); 
       
    33     }
       
    34 
       
    35 // ---------------------------------------------------------
       
    36 // Destructor.
       
    37 // ---------------------------------------------------------
       
    38 CT_LbsClientPosTp4723::~CT_LbsClientPosTp4723()
       
    39     {
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------
       
    43 // CPosTp4723::CloseTest
       
    44 //
       
    45 // (other items were commented in a header).
       
    46 // ---------------------------------------------------------
       
    47 //
       
    48 void CT_LbsClientPosTp4723::CloseTest()
       
    49     {
       
    50     ClosePositioner();
       
    51     Disconnect();
       
    52     }
       
    53 
       
    54 // ---------------------------------------------------------
       
    55 // CPosTp4723::StartL
       
    56 //
       
    57 // (other items were commented in a header).
       
    58 // ---------------------------------------------------------
       
    59 //
       
    60 void CT_LbsClientPosTp4723::StartL()
       
    61     {
       
    62     ConnectL();
       
    63     SetupProxyPSYsL();
       
    64 	
       
    65 	TPositionModuleId modId = iUidSatInfoPsy;
       
    66     CRepository* repos = CRepository::NewL( KCRUidDefaultProxyConfiguration );    
       
    67     TBuf<40> idBuf;
       
    68     idBuf.AppendNumFixedWidth( modId.iUid, EHex, 8);
       
    69     TInt error = repos->Set(KDefaultProxyLastWorkingGpsPsy, idBuf);
       
    70     delete repos;
       
    71     User::LeaveIfError(error);
       
    72 	
       
    73     TInt err = OpenPositioner();
       
    74     _LIT(KOpenErr, "Error when opening positioner, %d");
       
    75     AssertTrueL(err == KErrNone, KOpenErr, err);
       
    76     
       
    77     _LIT(KServiceName, "TP4723");
       
    78     iPositioner.SetRequestor(CRequestor::ERequestorService, 
       
    79 		CRequestor::EFormatApplication, KServiceName);
       
    80 
       
    81     TPositionSatelliteInfo posInfo;
       
    82     // Request value should be 4722, even for TP4723...
       
    83     TInt request = 4722;
       
    84     
       
    85     // Default PSY won't pre-load Multi PSY since it is Internal
       
    86     VerifyPsyUnloadedL(iUidMultiPsy);
       
    87     // Default PSY should pre-load SetInfo PSY since it is External and supports GPS
       
    88     VerifyPsyLoadedL(iUidSatInfoPsy);
       
    89     
       
    90 	/////////////////////////////////////////////
       
    91 	// Request 1
       
    92 	/////////////////////////////////////////////
       
    93     RequestL(posInfo, request, KEspectedErrorCodePSY1);    
       
    94       
       
    95     VerifyPositionFromL(posInfo, iUidSatInfoPsy);    
       
    96     VerifyRequestTimeLessThanL(1200000);
       
    97     
       
    98     VerifyPsyLoadedL(iUidSatInfoPsy);
       
    99     
       
   100     VerifyPositionL(posInfo, 40, 50, 60);
       
   101     }
       
   102 
       
   103 // ---------------------------------------------------------
       
   104 // CPosTp4723::SetupProxyPSYsL
       
   105 //
       
   106 // (other items were commented in a header).
       
   107 // ---------------------------------------------------------
       
   108 //
       
   109 void CT_LbsClientPosTp4723::SetupProxyPSYsL()
       
   110     {
       
   111     CPosModules* db = CPosModules::OpenL();
       
   112     CleanupStack::PushL(db);
       
   113 
       
   114     CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC();
       
   115 
       
   116     moduleUpdate->SetUpdateAvailability(EFalse);
       
   117     
       
   118     CPosModuleIdList* prioList = db->ModuleIdListLC();
       
   119 	
       
   120     // Disable all PSY:s except PSYs used by this test case
       
   121     
       
   122     for (TInt i = 0 ; i < prioList->Count(); i++)
       
   123         {
       
   124         if ((*prioList)[i] != iUidMultiPsy &&
       
   125             (*prioList)[i] != iUidSatInfoPsy)
       
   126             {
       
   127             db->UpdateModuleL((*prioList)[i], *moduleUpdate);
       
   128             }
       
   129         }
       
   130     moduleUpdate->SetUpdateAvailability(ETrue);
       
   131     db->UpdateModuleL(iUidMultiPsy, *moduleUpdate);
       
   132     db->UpdateModuleL(iUidSatInfoPsy, *moduleUpdate);
       
   133     
       
   134     db->SetModulePriorityL(iUidMultiPsy, 0);
       
   135     db->SetModulePriorityL(iUidSatInfoPsy, 1);
       
   136     
       
   137     CleanupStack::PopAndDestroy(prioList);
       
   138     CleanupStack::PopAndDestroy(moduleUpdate);
       
   139     CleanupStack::PopAndDestroy(db);
       
   140     } 
       
   141 
       
   142 //  End of File
       
   143 
       
   144