telephonyserverplugins/simtsy/test/Te_SimData/Te_SimDataTestStepBase.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "Te_SimDataTestStepBase.h"
       
    17 
       
    18 TVerdict CSimDataTestStepBase::doTestStepPreambleL()
       
    19 	{
       
    20 	__UHEAP_MARK;
       
    21 
       
    22 	TInt ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, 0);
       
    23 	if (ret != KErrNone)
       
    24 		{
       
    25 		INFO_PRINTF1(_L("Failed resetting"));
       
    26 		User::Leave(ret);
       
    27 		}
       
    28 
       
    29 	ret = iTelServer.Connect();
       
    30 	if (ret!=KErrNone)
       
    31 		{
       
    32 		INFO_PRINTF1(_L("Failed to connect to telephony server"));
       
    33 		User::Leave(ret);
       
    34 		}
       
    35    	ret=iTelServer.LoadPhoneModule(KSimtsyName);
       
    36 	if (ret!=KErrNone)
       
    37 		{
       
    38 		INFO_PRINTF1(_L("Failed to load phone module"));
       
    39 		iTelServer.Close();
       
    40 		User::Leave(ret);
       
    41 		}
       
    42 
       
    43 	ret=iPhone.Open(iTelServer,KPhoneName) ;
       
    44 	if (ret!=KErrNone)
       
    45 		{
       
    46 		INFO_PRINTF1(_L("Failed to open phone module"));
       
    47 		iTelServer.UnloadPhoneModule(KSimtsyName);
       
    48 		iTelServer.Close();
       
    49 		User::Leave(ret);
       
    50 		}
       
    51 	ret=iPhone.Initialise();
       
    52 	if (ret!=KErrNone)
       
    53 		{
       
    54 		INFO_PRINTF1(_L("Failed to initialise the phone"));
       
    55 		iPhone.Close();
       
    56 		iTelServer.UnloadPhoneModule(KSimtsyName);
       
    57 		iTelServer.Close();
       
    58 		User::Leave(ret);
       
    59 		}
       
    60 
       
    61 	RPhone::TCaps phoneCaps;
       
    62 	ret = iPhone.GetCaps(phoneCaps) ;
       
    63 	if ((KErrNone != ret) || !(phoneCaps.iFlags & RPhone::KCapsData))
       
    64 		{
       
    65 		INFO_PRINTF2(_L("This phone does not support data calls (caps=0x%x)"), phoneCaps.iFlags);
       
    66 		iPhone.Close();
       
    67 		iTelServer.UnloadPhoneModule(KSimtsyName);
       
    68 		iTelServer.Close();
       
    69 		User::Leave(ret);
       
    70 		}
       
    71 
       
    72 	return TestStepResult();
       
    73 	}
       
    74 
       
    75 TVerdict CSimDataTestStepBase::doTestStepPostambleL()
       
    76 	{
       
    77 	iPhone.Close();
       
    78 	iTelServer.UnloadPhoneModule(KSimtsyName);
       
    79 	iTelServer.Close();
       
    80 
       
    81 	__UHEAP_MARKEND;
       
    82 	return TestStepResult();
       
    83 	}