telephonyserverplugins/simtsy/test/Te_Sim/Te_SimCellInfoTest.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-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_SimCellInfoTest.h"
       
    17 
       
    18 CSimCellInfoTest::CSimCellInfoTest() 
       
    19 	{ 
       
    20 	SetTestStepName(_L("CellInfoTest"));
       
    21 	}
       
    22 
       
    23 TVerdict CSimCellInfoTest::doTestStepL()
       
    24 	{
       
    25 	INFO_PRINTF1(_L("BeginCellInfoTest"));
       
    26 
       
    27  	CreateConfigFileL(_L("c:\\config3.txt"));
       
    28  	SetTestNumberL(0);
       
    29  	
       
    30  	const RMobilePhone::TCellMode KMode0 = RMobilePhone::ECellModeGsm;
       
    31  	const TUint KCellId0  = 21;
       
    32  	const RMobilePhone::TGsmTimingAdvance KTimingAdvance0 = 111;
       
    33  	const RMobilePhone::TCellInfoStatus KStatus0 = RMobilePhone::ECellInfoStatusNotCurrent;
       
    34 
       
    35  	const RMobilePhone::TCellMode KMode1 = RMobilePhone::ECellModeWcdma;
       
    36  	const TUint KCellId1  = 514;
       
    37  	const RMobilePhone::TGsmTimingAdvance KTimingAdvance1 = 73;
       
    38  	const RMobilePhone::TCellInfoStatus KStatus1 = RMobilePhone::ECellInfoStatusCurrent;
       
    39 
       
    40 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
    41 	INFO_PRINTF2(_L("Result: %d"),ret); 
       
    42 	TESTL(ret == KErrNone); 
       
    43 	INFO_PRINTF1(_L("Opened phone object"));
       
    44 
       
    45 	TESTL(iPhone.Initialise()==KErrNone);
       
    46 	INFO_PRINTF1(_L("Opened phone object"));
       
    47 
       
    48 	INFO_PRINTF1(_L("Test Retrieve current Cell Info information"));
       
    49 	TRequestStatus stat0;
       
    50 	RMobilePhone::TMobilePhoneCellInfoV9 cellInfo;
       
    51 	RMobilePhone::TMobilePhoneCellInfoV9Pckg cellInfoPckg(cellInfo);
       
    52 	
       
    53 	iPhone.GetCellInfo(stat0,cellInfoPckg);
       
    54 	User::WaitForRequest(stat0);
       
    55 	TESTL(stat0==KErrNone);
       
    56 	TESTL(cellInfo.iMode==KMode0);
       
    57 	TESTL(cellInfo.iCellId==KCellId0);
       
    58 	TESTL(cellInfo.iTimingAdvance==KTimingAdvance0);
       
    59 	TESTL(cellInfo.iStatus==KStatus0);
       
    60 
       
    61 	INFO_PRINTF1(_L("Test Notification of Cell information changing"));
       
    62 	iPhone.NotifyCellInfoChange(stat0,cellInfoPckg);
       
    63 	User::WaitForRequest(stat0);
       
    64 	TESTL(stat0==KErrNone);
       
    65 	TESTL(cellInfo.iMode==KMode1);
       
    66 	TESTL(cellInfo.iCellId==KCellId1);
       
    67 	TESTL(cellInfo.iTimingAdvance==KTimingAdvance1);
       
    68 	TESTL(cellInfo.iStatus==KStatus1);
       
    69 
       
    70 	INFO_PRINTF1(_L("Test Retrieve current Cell Info and cancellation"));
       
    71 	iPhone.GetCellInfo(stat0,cellInfoPckg);
       
    72 	iPhone.CancelAsyncRequest(EMobilePhoneGetCellInfo);
       
    73 	User::WaitForRequest(stat0);
       
    74 	TESTL((stat0==KErrNone) || (stat0==KErrCancel) );
       
    75 
       
    76 	INFO_PRINTF1(_L("Test Notification of Cell information changing and cancllation"));
       
    77 	iPhone.NotifyCellInfoChange(stat0,cellInfoPckg);
       
    78 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyCellInfoChange);
       
    79 	User::WaitForRequest(stat0);
       
    80 	TESTL((stat0==KErrNone) || (stat0==KErrCancel) );
       
    81 	
       
    82 	iPhone.Close();
       
    83 	ASSERT(RThread().RequestCount()==0);
       
    84 
       
    85 	return TestStepResult();
       
    86 	}
       
    87