common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp204.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 "ctlbsclientpostp204.h"
       
    20 #include "ctlbsclientobserver.h"
       
    21 #include <sbeclient.h>
       
    22 #include <babackup.h>
       
    23 #include <EPos_CPosModules.h>
       
    24 #include <EPos_CPosModuleUpdate.h>
       
    25 #include "ctlbsclientpositionconstants.h"
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // Constructor.
       
    30 CT_LbsClientPosTp204::CT_LbsClientPosTp204(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
       
    31     { 
       
    32     _LIT(KTestName, "TP204 - BackUpTest");
       
    33     SetTestStepName(KTestName); 
       
    34     }
       
    35 
       
    36 // Destructor
       
    37 CT_LbsClientPosTp204::~CT_LbsClientPosTp204()
       
    38     {
       
    39     }
       
    40 
       
    41 // ---------------------------------------------------------
       
    42 // CPosTp215::CloseTest
       
    43 // Always called after the test, even if the test leaves
       
    44 // (other items were commented in a header).
       
    45 // ---------------------------------------------------------
       
    46 //
       
    47 void CT_LbsClientPosTp204::CloseTest()
       
    48     {
       
    49     }
       
    50 
       
    51 
       
    52 // ================= MEMBER FUNCTIONS =======================
       
    53 
       
    54 // ---------------------------------------------------------
       
    55 // CPosTp204::StartL
       
    56 //
       
    57 // (other items were commented in a header).
       
    58 // ---------------------------------------------------------
       
    59 //
       
    60 void CT_LbsClientPosTp204::StartL()
       
    61     {
       
    62     
       
    63     TDriveList nullDriveList;
       
    64 	nullDriveList.Zero();
       
    65 	
       
    66 	using namespace conn;    
       
    67     CSBEClient* SbeClient = CSBEClient::NewL();
       
    68     CleanupStack::PushL(SbeClient);
       
    69     
       
    70     iCompletedRequests = 0;
       
    71     
       
    72     RPositionServer server;
       
    73     CleanupClosePushL(server);
       
    74     TInt err = server.Connect();
       
    75     if (err != KErrNone)
       
    76         {
       
    77 	  	_LIT(KBackupError1, "Cannot connect to Server");
       
    78 		INFO_PRINTF1(KBackupError1);				
       
    79         User::Leave(KErrGeneral);
       
    80         }
       
    81 
       
    82   	_LIT(KBackupLog1, "connect to server success");
       
    83 	INFO_PRINTF1(KBackupLog1);				
       
    84 	server.Close();
       
    85 	
       
    86     SbeClient->SetBURModeL(nullDriveList, EBURBackupFull, EBackupBase);
       
    87 	User::After(500000); // Wait for 500 milli seconds
       
    88 	
       
    89     err = server.Connect();
       
    90     if (err == KErrNone)
       
    91         {
       
    92 	  	_LIT(KBackupError2, "connect to server works :-(");
       
    93 		INFO_PRINTF1(KBackupError2);				
       
    94         User::Leave(KErrGeneral);
       
    95         }
       
    96 
       
    97 	server.Close();
       
    98 
       
    99     SbeClient->SetBURModeL(nullDriveList, EBURNormal, ENoBackup);
       
   100 	User::After(500000); // Wait for 500 milli seconds
       
   101 	
       
   102     err = server.Connect();
       
   103     if (err != KErrNone)
       
   104         {
       
   105 	  	_LIT(KBackupError3, "connect to server doesn't work :-(");
       
   106 		INFO_PRINTF1(KBackupError3);				
       
   107         User::Leave(KErrGeneral);
       
   108         }
       
   109 
       
   110     CleanupStack::PopAndDestroy(2);
       
   111     
       
   112 	}
       
   113 
       
   114 // ---------------------------------------------------------
       
   115 // CT_LbsClientPosTp25::RequestCompleteL
       
   116 //
       
   117 // (other items were commented in a header).
       
   118 // ---------------------------------------------------------
       
   119 //
       
   120 void CT_LbsClientPosTp204::RequestCompleteL()
       
   121     {
       
   122     const TInt KNofRequesters = 3;
       
   123     if (++iCompletedRequests == KNofRequesters)
       
   124         {
       
   125         CActiveScheduler::Stop();
       
   126         }
       
   127     }
       
   128 
       
   129 //  End of File