lbs/lbsclient/src/ctlbsclientpostp224.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     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 "ctlbsclientpostp224.h"
       
    20 #include <LbsCommon.h>
       
    21 #include <LbsPositionInfo.h>
       
    22 
       
    23 // CONSTANTS
       
    24 
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 
       
    27 // Constructor.
       
    28 CT_LbsClientPosTp224::CT_LbsClientPosTp224(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
       
    29     {  
       
    30     _LIT(KTestName, 
       
    31     		"TP224 - MPositionerStatus out of scope after closing PSY subsession");
       
    32     SetTestStepName(KTestName); 
       
    33     }
       
    34 
       
    35 // Destructor
       
    36 CT_LbsClientPosTp224::~CT_LbsClientPosTp224() 
       
    37 	{
       
    38     iPositioner.Close();
       
    39     iPositioner2.Close();
       
    40     iServer.Close();
       
    41 	}
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CT_LbsClientPosTp224::CloseTest
       
    45 //
       
    46 // (other items were commented in a header).
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 
       
    50 void CT_LbsClientPosTp224::CloseTest()
       
    51     {
       
    52     iPositioner.Close();
       
    53     iPositioner2.Close();
       
    54     iServer.Close();
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------
       
    58 // CT_LbsClientPosTp224::StartL
       
    59 //
       
    60 // (other items were commented in a header).
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 void CT_LbsClientPosTp224::StartL()
       
    64     {   
       
    65     _LIT(KConnectErr, "Error when connecting to EPos server, %d");
       
    66     _LIT(KOpenErr, "Error when opening positioner, %d");
       
    67 
       
    68     TInt err;
       
    69     err = iServer.Connect();	
       
    70     AssertTrueSecL(err == KErrNone, KConnectErr, err);
       
    71 
       
    72 	SetupPsyL(iUidTestSingPsy);
       
    73     err = iPositioner.Open(iServer, iUidTestSingPsy);
       
    74     AssertTrueSecL(err == KErrNone, KOpenErr, err);
       
    75 
       
    76     err = iPositioner2.Open(iServer, iUidTestSingPsy);
       
    77 	AssertTrueSecL(err == KErrNone, KOpenErr, err);
       
    78 
       
    79     iPositioner.Close();
       
    80     iPositioner2.Close(); // Before error correction -> Panic because of MPositionerStatus deleted  
       
    81 
       
    82     err = iPositioner.Open(iServer, iUidTestSingPsy);
       
    83     AssertTrueSecL(err == KErrNone, KOpenErr, err);
       
    84     err = iPositioner2.Open(iServer, iUidTestSingPsy);
       
    85     AssertTrueSecL(err == KErrNone, KOpenErr, err);
       
    86 
       
    87     iPositioner2.Close();
       
    88     iPositioner.Close();
       
    89 
       
    90     iServer.Close();
       
    91     }
       
    92 
       
    93 
       
    94 // ---------------------------------------------------------
       
    95 // CT_LbsClientPosTp224::AssertTrueSecL
       
    96 //
       
    97 // (other items were commented in a header).
       
    98 // ---------------------------------------------------------
       
    99 //
       
   100 void CT_LbsClientPosTp224::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode)
       
   101     {
       
   102   	if (!aCondition)
       
   103 		{
       
   104 		TBuf<100> buf;
       
   105 		buf.Format(aErrorMsg, aErrorCode);
       
   106 		LogErrorAndLeaveL(buf);
       
   107 		}
       
   108     }
       
   109 
       
   110