lbstest/lbstestproduct/lbsclient/src/ctlbsclientstepmultiintgpsfallback.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDES
       
    20 #include "ctlbsclientstepmultiintgpsfallback.h"
       
    21 #include <epos_cposmodules.h>
       
    22 #include <epos_cposmoduleupdate.h>
       
    23 #include <epos_cposmoduleidlist.h>
       
    24 
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 
       
    27 // ---------------------------------------------------------
       
    28 // Constructor.
       
    29 // ---------------------------------------------------------
       
    30 CT_LbsClientStepMultiIntGpsFallback::CT_LbsClientStepMultiIntGpsFallback(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
       
    31     {
       
    32     _LIT(KTestName, "TP304 - Multiple integrated GPS PSYs during fallback");
       
    33     SetTestStepName(KTestName); 
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------
       
    37 // Destructor.
       
    38 // ---------------------------------------------------------
       
    39 CT_LbsClientStepMultiIntGpsFallback::~CT_LbsClientStepMultiIntGpsFallback()
       
    40     {
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CloseTest
       
    45 //
       
    46 // (other items were commented in a header).
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 void CT_LbsClientStepMultiIntGpsFallback::CloseTest()
       
    50     {
       
    51     ClosePositioner();
       
    52     Disconnect();
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------
       
    56 // StartL
       
    57 //
       
    58 // (other items were commented in a header).
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 void CT_LbsClientStepMultiIntGpsFallback::StartL()
       
    62     {
       
    63     ConnectL();
       
    64     SetupProxyPSYsL();
       
    65 	
       
    66     TInt err = OpenPositioner();
       
    67     _LIT(KOpenErr, "Error when opening positioner, %d");
       
    68     AssertTrueL(err == KErrNone, KOpenErr, err);
       
    69     
       
    70     _LIT(KServiceName, "TP304");
       
    71     iPositioner.SetRequestor(CRequestor::ERequestorService, 
       
    72 		CRequestor::EFormatApplication, KServiceName);
       
    73 
       
    74     TPositionInfo posInfo;
       
    75     TInt request = 304;
       
    76     
       
    77     // PSYs won't be pre-loaded since they are all internal
       
    78     VerifyPsyUnloadedL(iUidTestProxyPsy3);
       
    79     VerifyPsyUnloadedL(iUidTestProxyPsy5);
       
    80     VerifyPsyUnloadedL(iUidTestProxyPsy2);
       
    81     
       
    82 	/////////////////////////////////////////////
       
    83 	// Request 
       
    84 	/////////////////////////////////////////////
       
    85     RequestL(posInfo, request, KErrNone);    
       
    86       
       
    87     VerifyPositionFromL(posInfo, iUidTestProxyPsy2);    
       
    88     VerifyRequestTimeLessThanL(1200000);
       
    89     
       
    90     VerifyPsyLoadedL(iUidTestProxyPsy3);
       
    91     VerifyPsyUnloadedL(iUidTestProxyPsy5);
       
    92     
       
    93     VerifyPositionL(posInfo, 10, 20, 30);
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------
       
    97 // SetupProxyPSYsL
       
    98 //
       
    99 //	KTestProxyPsy3 	integrated gps. responds with error for this test case
       
   100 //	KTestProxyPsy5	integrated gps. should not be called during this test case. responds with KerrNone
       
   101 //	KTestProxyPsy2  integrated non-gps responds with KErrNone
       
   102 //
       
   103 // (other items were commented in a header).
       
   104 // ---------------------------------------------------------
       
   105 //
       
   106 void CT_LbsClientStepMultiIntGpsFallback::SetupProxyPSYsL()
       
   107     {
       
   108     CPosModules* db = CPosModules::OpenL();
       
   109     CleanupStack::PushL(db);
       
   110 
       
   111     CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC();
       
   112 
       
   113     moduleUpdate->SetUpdateAvailability(EFalse);
       
   114     
       
   115     CPosModuleIdList* prioList = db->ModuleIdListLC();
       
   116 	
       
   117     // Disable all PSY:s except PSYs used by this test case
       
   118     for (TInt i = 0 ; i < prioList->Count(); i++)
       
   119         {
       
   120         if ((*prioList)[i] != iUidTestProxyPsy3 &&
       
   121             (*prioList)[i] != iUidTestProxyPsy5 && 
       
   122             (*prioList)[i] != iUidTestProxyPsy2)
       
   123             {
       
   124             db->UpdateModuleL((*prioList)[i], *moduleUpdate);
       
   125             }
       
   126         }
       
   127     moduleUpdate->SetUpdateAvailability(ETrue);
       
   128     db->UpdateModuleL(iUidTestProxyPsy3, *moduleUpdate);
       
   129     db->UpdateModuleL(iUidTestProxyPsy5, *moduleUpdate);
       
   130     db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate);
       
   131     
       
   132     db->SetModulePriorityL(iUidTestProxyPsy3, 0);
       
   133     db->SetModulePriorityL(iUidTestProxyPsy5, 1);
       
   134     db->SetModulePriorityL(iUidTestProxyPsy2, 2);
       
   135     
       
   136     CleanupStack::PopAndDestroy(prioList);
       
   137     CleanupStack::PopAndDestroy(moduleUpdate);
       
   138     CleanupStack::PopAndDestroy(db);
       
   139     } 
       
   140 
       
   141 //  End of File
       
   142 
       
   143