24
|
1 |
// Copyright (c) 1997-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 <e32test.h>
|
|
17 |
#include <etelmm.h>
|
|
18 |
#include "Te_LoopBackCNoCnmi.h"
|
|
19 |
|
|
20 |
#include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint
|
|
21 |
|
|
22 |
//
|
|
23 |
// Test-side class
|
|
24 |
// With the assistance of the base class, this class must start the emulator
|
|
25 |
// and drive the ETel API.
|
|
26 |
//
|
|
27 |
CTestDriveNoCnmi* CTestDriveNoCnmi::NewL(const TScriptList aScriptListEntry)
|
|
28 |
{
|
|
29 |
CTestDriveNoCnmi* cnmi=new(ELeave) CTestDriveNoCnmi(aScriptListEntry);
|
|
30 |
CleanupStack::PushL(cnmi);
|
|
31 |
cnmi->ConstructL();
|
|
32 |
CleanupStack::Pop();
|
|
33 |
return cnmi;
|
|
34 |
}
|
|
35 |
|
|
36 |
CTestDriveNoCnmi::CTestDriveNoCnmi(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry)
|
|
37 |
{}
|
|
38 |
|
|
39 |
TInt CTestDriveNoCnmi::RunTestL()
|
|
40 |
{
|
|
41 |
iCurrentScript=iScriptListEntry;
|
|
42 |
return StartEmulatorL();
|
|
43 |
}
|
|
44 |
|
|
45 |
TInt CTestDriveNoCnmi::DriveETelApiL()
|
|
46 |
/**
|
|
47 |
* This file contains a slightly different initialisation sequence. This iPhone does not
|
|
48 |
* return a response to the AT+CNMI=? Query.
|
|
49 |
* @return KErrNone
|
|
50 |
*/
|
|
51 |
{
|
|
52 |
// Open and initialise the iPhone object
|
|
53 |
_LIT(KMmPhoneName,"GsmPhone1");
|
|
54 |
TESTL(iCnPhone.Open(iServer,KMmPhoneName)==KErrNone);
|
|
55 |
|
|
56 |
TRequestStatus reqStatus;
|
|
57 |
INFO_PRINTF1(_L("Initialising the Phone...\n"));
|
|
58 |
|
|
59 |
RMobilePhone::TMMTableSettings tableSettings;
|
|
60 |
tableSettings.iLocId=KInternetAccessPoint;
|
|
61 |
RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
|
|
62 |
iCnPhone.InitialiseMM(reqStatus , tableSettingsPckg);
|
|
63 |
|
|
64 |
User::WaitForRequest(reqStatus);
|
|
65 |
|
|
66 |
TESTL(reqStatus == KErrNone);
|
|
67 |
|
|
68 |
|
|
69 |
// Post a Modem Notification request
|
|
70 |
TRequestStatus modemStatus;
|
|
71 |
RPhone::TModemDetection detected;
|
|
72 |
iCnPhone.NotifyModemDetected(modemStatus, detected);
|
|
73 |
|
|
74 |
// Get the iPhone's status
|
|
75 |
RPhone::TStatus phoneStatus1;
|
|
76 |
TInt ret=iCnPhone.GetStatus(phoneStatus1);
|
|
77 |
CHECKPOINT(ret, KErrNone, _L("*** Error retrieving the Phone's status ***\n"));
|
|
78 |
if (ret==KErrNone)
|
|
79 |
{
|
|
80 |
TESTL(phoneStatus1.iModemDetected==RPhone::EDetectedPresent);
|
|
81 |
INFO_PRINTF1(_L("The iPhone's modem has been detected\n"));
|
|
82 |
TESTL(phoneStatus1.iMode==RPhone::EModeIdle);
|
|
83 |
INFO_PRINTF1(_L("The iPhone is currently idle\n"));
|
|
84 |
}
|
|
85 |
|
|
86 |
// Establish a call in order to change the status of the iPhone.
|
|
87 |
// This should enable the modem notification request to complete.
|
|
88 |
_LIT(KVoiceLineName,"Voice");
|
|
89 |
RLine voiceLine;
|
|
90 |
TESTL(voiceLine.Open(iCnPhone,KVoiceLineName)==KErrNone);
|
|
91 |
RCall voiceCall;
|
|
92 |
TESTL(voiceCall.OpenNewCall(voiceLine)==KErrNone);
|
|
93 |
|
|
94 |
// Answer an incoming call
|
|
95 |
INFO_PRINTF1(_L("Answer incoming call...\n"));
|
|
96 |
TRequestStatus status;
|
|
97 |
voiceCall.AnswerIncomingCall(status);
|
|
98 |
User::WaitForRequest(status);
|
|
99 |
TESTL(status==KErrNone);
|
|
100 |
|
|
101 |
// Get the iPhone's current status
|
|
102 |
RPhone::TStatus phoneStatus2;
|
|
103 |
ret=iCnPhone.GetStatus(phoneStatus2);
|
|
104 |
CHECKPOINT(ret, KErrNone, _L("*** Error retrieving the Phone's status ***\n"));
|
|
105 |
|
|
106 |
// Confirm that the iPhone's current status is different from its initial status
|
|
107 |
if (ret==KErrNone)
|
|
108 |
{
|
|
109 |
TESTL(phoneStatus2.iMode!=phoneStatus1.iMode);
|
|
110 |
if (phoneStatus2.iMode == RPhone::EModeUnknown)
|
|
111 |
{
|
|
112 |
INFO_PRINTF1(_L("Phone mode: unknown\n"));
|
|
113 |
}
|
|
114 |
else if (phoneStatus2.iMode == RPhone::EModeEstablishingLink)
|
|
115 |
{
|
|
116 |
INFO_PRINTF1(_L("Phone mode: establishing link\n"));
|
|
117 |
}
|
|
118 |
else if (phoneStatus2.iMode == RPhone::EModeOnlineData)
|
|
119 |
{
|
|
120 |
INFO_PRINTF1(_L("Phone mode: on line data\n"));
|
|
121 |
}
|
|
122 |
else if (phoneStatus2.iMode == RPhone::EModeOnlineCommand)
|
|
123 |
{
|
|
124 |
INFO_PRINTF1(_L("Phone mode: on line command\n"));
|
|
125 |
}
|
|
126 |
else
|
|
127 |
{
|
|
128 |
ERR_PRINTF1(_L("Error: Phone mode undefined.\n"));
|
|
129 |
User::Leave(KErrGeneral) ;
|
|
130 |
}
|
|
131 |
}
|
|
132 |
|
|
133 |
// Complete the modem notification request
|
|
134 |
User::WaitForRequest(modemStatus);
|
|
135 |
|
|
136 |
// Hang up the call and Close the voice line and call
|
|
137 |
voiceCall.HangUp(status);
|
|
138 |
User::WaitForRequest(status);
|
|
139 |
TESTL(status==KErrNone);
|
|
140 |
voiceLine.Close();
|
|
141 |
voiceCall.Close();
|
|
142 |
|
|
143 |
// Close the iPhone
|
|
144 |
iCnPhone.Close();
|
|
145 |
return KErrNone;
|
|
146 |
}
|
|
147 |
|
|
148 |
|
|
149 |
//
|
|
150 |
// Emulator-side class
|
|
151 |
// With the assistance of the base class, this class must run the designated script
|
|
152 |
//
|
|
153 |
CTestNoCnmi* CTestNoCnmi::NewL(const TScript* aScript)
|
|
154 |
{
|
|
155 |
CTestNoCnmi* cnmi=new(ELeave) CTestNoCnmi(aScript);
|
|
156 |
CleanupStack::PushL(cnmi);
|
|
157 |
cnmi->ConstructL();
|
|
158 |
CleanupStack::Pop();
|
|
159 |
return cnmi;
|
|
160 |
}
|
|
161 |
|
|
162 |
CTestNoCnmi::CTestNoCnmi(const TScript* aScript) : iScript(aScript)
|
|
163 |
{}
|
|
164 |
|
|
165 |
void CTestNoCnmi::ConstructL()
|
|
166 |
{
|
|
167 |
CATScriptEng::ConstructL();
|
|
168 |
}
|
|
169 |
|
|
170 |
TInt CTestNoCnmi::Start()
|
|
171 |
{
|
|
172 |
StartScript(iScript);
|
|
173 |
return KErrNone;
|
|
174 |
}
|
|
175 |
|
|
176 |
void CTestNoCnmi::SpecificAlgorithmL(TInt /* aParam */)
|
|
177 |
{
|
|
178 |
}
|
|
179 |
|
|
180 |
void CTestNoCnmi::Complete(TInt aError)
|
|
181 |
{
|
|
182 |
iReturnValue=aError;
|
|
183 |
CActiveScheduler::Stop();
|
|
184 |
}
|