24
|
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_SimSignalStrengthTest.h"
|
|
17 |
|
|
18 |
CSimSignalStrengthTest::CSimSignalStrengthTest()
|
|
19 |
{
|
|
20 |
SetTestStepName(_L("SignalStrengthTest"));
|
|
21 |
}
|
|
22 |
|
|
23 |
TVerdict CSimSignalStrengthTest::doTestStepL()
|
|
24 |
{
|
|
25 |
INFO_PRINTF1(_L("BeginSignalStrengthTest"));
|
|
26 |
|
|
27 |
CreateConfigFileL(_L("c:\\config3.txt"));
|
|
28 |
SetTestNumberL(0);
|
|
29 |
|
|
30 |
TInt ret = iPhone.Open(iTelServer,KPhoneName);
|
|
31 |
INFO_PRINTF2(_L("Result: %d"),ret);
|
|
32 |
TESTL(ret == KErrNone);
|
|
33 |
INFO_PRINTF1(_L("Opened phone object"));
|
|
34 |
|
|
35 |
TESTL(iPhone.Initialise()==KErrNone);
|
|
36 |
INFO_PRINTF1(_L("Opened phone object"));
|
|
37 |
|
|
38 |
INFO_PRINTF1(_L("Testing Signal Strength Caps"));
|
|
39 |
TUint32 caps;
|
|
40 |
TESTL(iPhone.GetSignalCaps(caps)==KErrNone);
|
|
41 |
TESTL(caps== (RMobilePhone::KCapsGetSignalStrength
|
|
42 |
| RMobilePhone::KCapsNotifySignalStrengthChange));
|
|
43 |
|
|
44 |
INFO_PRINTF1(_L("Testing Get Current Signal Strength"));
|
|
45 |
TRequestStatus stat0;
|
|
46 |
TInt32 signalStrength;
|
|
47 |
TInt8 barLevel;
|
|
48 |
iPhone.GetSignalStrength(stat0,signalStrength,barLevel);
|
|
49 |
iPhone.CancelAsyncRequest(EMobilePhoneGetSignalStrength);
|
|
50 |
User::WaitForRequest(stat0);
|
|
51 |
TESTL(stat0==KErrNone);
|
|
52 |
TESTL(signalStrength==-20);
|
|
53 |
TESTL(barLevel==3);
|
|
54 |
|
|
55 |
INFO_PRINTF1(_L("Testing Signal Strength Notification"));
|
|
56 |
iPhone.NotifySignalStrengthChange(stat0,signalStrength,barLevel);
|
|
57 |
User::WaitForRequest(stat0);
|
|
58 |
TESTL(stat0==KErrNone);
|
|
59 |
TESTL(signalStrength==-30);
|
|
60 |
TESTL(barLevel==2);
|
|
61 |
CHECKPOINTL(stat0, KErrNone, CHP_NTWK_CASE("D.8"));
|
|
62 |
|
|
63 |
INFO_PRINTF1(_L("Testing Signal Strength Caps"));
|
|
64 |
TESTL(iPhone.GetSignalCaps(caps)==KErrNone);
|
|
65 |
TESTL(caps== (RMobilePhone::KCapsGetSignalStrength
|
|
66 |
| RMobilePhone::KCapsNotifySignalStrengthChange));
|
|
67 |
|
|
68 |
INFO_PRINTF1(_L("Testing Signal Strength Notification Cancel"));
|
|
69 |
iPhone.NotifySignalStrengthChange(stat0,signalStrength,barLevel);
|
|
70 |
User::After(1000000L);
|
|
71 |
iPhone.CancelAsyncRequest(EMobilePhoneNotifySignalStrengthChange);
|
|
72 |
User::WaitForRequest(stat0);
|
|
73 |
TESTL(stat0==KErrCancel);
|
|
74 |
|
|
75 |
User::After(2000000L);
|
|
76 |
INFO_PRINTF1(_L("Testing a final Get Current Signal Strength"));
|
|
77 |
iPhone.GetSignalStrength(stat0,signalStrength,barLevel);
|
|
78 |
User::WaitForRequest(stat0);
|
|
79 |
TESTL(stat0==KErrNone);
|
|
80 |
TESTL(signalStrength==-40);
|
|
81 |
TESTL(barLevel==1);
|
|
82 |
CHECKPOINTL(stat0, KErrNone, CHP_NTWK_CASE("D.7"));
|
|
83 |
|
|
84 |
INFO_PRINTF1(_L("Testing Signal Strength Caps again"));
|
|
85 |
TESTL(iPhone.GetSignalCaps(caps)==KErrNone);
|
|
86 |
TESTL(caps == RMobilePhone::KCapsGetSignalStrength);
|
|
87 |
|
|
88 |
iPhone.Close();
|
|
89 |
ASSERT(RThread().RequestCount()==0);
|
|
90 |
|
|
91 |
return TestStepResult();
|
|
92 |
}
|
|
93 |
|