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 |
// This file implements SCA retrieval and setting tests.
|
|
15 |
// See CDataCall.cpp for fully documented test scenario.
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file
|
|
21 |
*/
|
|
22 |
|
|
23 |
|
|
24 |
#include "Te_LoopBackcsca.h"
|
|
25 |
#include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint
|
|
26 |
|
|
27 |
//
|
|
28 |
// Test-side class
|
|
29 |
// With the assistance of the base class, this class must start the emulator
|
|
30 |
// and drive the ETel API.
|
|
31 |
//
|
|
32 |
CTestDriveSca* CTestDriveSca::NewL(const TScriptList aScriptListEntry)
|
|
33 |
{
|
|
34 |
CTestDriveSca* aA = new (ELeave) CTestDriveSca(aScriptListEntry);
|
|
35 |
CleanupStack::PushL(aA);
|
|
36 |
aA->ConstructL();
|
|
37 |
CleanupStack::Pop();
|
|
38 |
return (aA);
|
|
39 |
}
|
|
40 |
|
|
41 |
CTestDriveSca::CTestDriveSca(const TScriptList aScriptListEntry) :
|
|
42 |
iScriptListEntry(aScriptListEntry)
|
|
43 |
{}
|
|
44 |
|
|
45 |
CTestDriveSca::~CTestDriveSca()
|
|
46 |
{}
|
|
47 |
|
|
48 |
TInt CTestDriveSca::RunTestL()
|
|
49 |
{
|
|
50 |
iCurrentScript = iScriptListEntry;
|
|
51 |
return (StartEmulatorL());
|
|
52 |
}
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
TInt CTestDriveSca::DriveETelApiL()
|
|
57 |
//
|
|
58 |
// This function contains the real meat of the Client-side test code
|
|
59 |
//
|
|
60 |
{
|
|
61 |
INFO_PRINTF1(_L("Opening SMS Messaging...\n"));
|
|
62 |
|
|
63 |
RMobileSmsMessaging sms;
|
|
64 |
TESTL(sms.Open(iPhone) == KErrNone);
|
|
65 |
|
|
66 |
INFO_PRINTF1(_L("Initialising the Phone...\n"));
|
|
67 |
|
|
68 |
TRequestStatus reqStatus;
|
|
69 |
|
|
70 |
RMobilePhone::TMMTableSettings tableSettings;
|
|
71 |
tableSettings.iLocId=KInternetAccessPoint;
|
|
72 |
RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
|
|
73 |
iPhone.InitialiseMM(reqStatus, tableSettingsPckg);
|
|
74 |
|
|
75 |
User::WaitForRequest(reqStatus);
|
|
76 |
TESTL(reqStatus == KErrNone);
|
|
77 |
|
|
78 |
RMobileSmsMessaging::TMobileSmspEntryV1 newSmspEntry;
|
|
79 |
RMobileSmsMessaging::TMobileSmspEntryV1 checkSmspEntry;
|
|
80 |
|
|
81 |
INFO_PRINTF1(_L("Retrieve default SMSP list\n"));
|
|
82 |
|
|
83 |
INFO_PRINTF1(_L("Store new SMSP list\n"));
|
|
84 |
|
|
85 |
newSmspEntry.iValidParams = RMobileSmsMessaging::KSCAIncluded;
|
|
86 |
newSmspEntry.iServiceCentre.iTypeOfNumber=RMobilePhone::EInternationalNumber;
|
|
87 |
newSmspEntry.iServiceCentre.iNumberPlan=RMobilePhone:: EIsdnNumberPlan;
|
|
88 |
newSmspEntry.iServiceCentre.iTelNumber.Copy(_L("441632960000"));
|
|
89 |
|
|
90 |
TRAP_IGNORE(SetSmspListL(newSmspEntry,sms));
|
|
91 |
|
|
92 |
INFO_PRINTF1(_L("Check SMSP list contains new entry\n"));
|
|
93 |
TRAP_IGNORE(GetSmspListL(checkSmspEntry,sms));
|
|
94 |
|
|
95 |
//Check SMSP list contains new entry
|
|
96 |
TESTL(checkSmspEntry.iValidParams == RMobileSmsMessaging::KSCAIncluded);
|
|
97 |
TESTL(checkSmspEntry.iServiceCentre.iTypeOfNumber==RMobilePhone::EInternationalNumber);
|
|
98 |
TESTL(checkSmspEntry.iServiceCentre.iNumberPlan==RMobilePhone:: EIsdnNumberPlan);
|
|
99 |
TESTL(checkSmspEntry.iServiceCentre.iTelNumber==_L("441632960000"));
|
|
100 |
|
|
101 |
INFO_PRINTF1(_L("Display SMSP list contains new entry\n"));
|
|
102 |
|
|
103 |
DisplaySmspEntry(checkSmspEntry);
|
|
104 |
|
|
105 |
INFO_PRINTF1(_L("Closing SMS Messaging...\n"));
|
|
106 |
sms.Close();
|
|
107 |
|
|
108 |
return (KErrNone);
|
|
109 |
}
|
|
110 |
|
|
111 |
|
|
112 |
void CTestDriveSca::GetSmspListL(RMobileSmsMessaging::TMobileSmspEntryV1& aSmspEntry,RMobileSmsMessaging& aSms)
|
|
113 |
/**
|
|
114 |
* This function tests CRetrieveMobilePhoneSmspList
|
|
115 |
*/
|
|
116 |
{
|
|
117 |
CTestGetSmspList* retrieveSmspList;
|
|
118 |
CMobilePhoneSmspList* smspList;
|
|
119 |
|
|
120 |
// We have ActiveScheduler already.
|
|
121 |
// CActiveScheduler* testActiveScheduler = new(ELeave) CActiveScheduler();
|
|
122 |
// TESTL(testActiveScheduler != NULL);
|
|
123 |
// CActiveScheduler::Install(testActiveScheduler);
|
|
124 |
|
|
125 |
retrieveSmspList = CTestGetSmspList::NewLC(aSms);
|
|
126 |
CleanupStack::PushL(retrieveSmspList);
|
|
127 |
|
|
128 |
retrieveSmspList->Start();
|
|
129 |
CActiveScheduler::Start();
|
|
130 |
|
|
131 |
smspList = retrieveSmspList->RetrieveList();
|
|
132 |
|
|
133 |
TInt count = smspList->Enumerate();
|
|
134 |
INFO_PRINTF2(_L("SMSP list has %d entries\n"), count);
|
|
135 |
|
|
136 |
TInt i;
|
|
137 |
for (i=0; i<count; i++)
|
|
138 |
{
|
|
139 |
aSmspEntry = smspList->GetEntryL(i);
|
|
140 |
INFO_PRINTF3(_L("Entry %d: Service Centre = >%S<\n"),i,&aSmspEntry.iServiceCentre.iTelNumber);
|
|
141 |
}
|
|
142 |
|
|
143 |
CleanupStack::PopAndDestroy();
|
|
144 |
delete smspList;
|
|
145 |
// delete testActiveScheduler;
|
|
146 |
// User::After(1000000); // Give user time to see the test results
|
|
147 |
}
|
|
148 |
|
|
149 |
|
|
150 |
void CTestDriveSca::SetSmspListL(RMobileSmsMessaging::TMobileSmspEntryV1& aSmspEntry,RMobileSmsMessaging& aSms)
|
|
151 |
/**
|
|
152 |
* This function tests writing service centre address
|
|
153 |
*/
|
|
154 |
{
|
|
155 |
CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL();
|
|
156 |
CleanupStack::PushL(smspList);
|
|
157 |
|
|
158 |
smspList->AddEntryL(aSmspEntry);
|
|
159 |
|
|
160 |
TRequestStatus reqStatus;
|
|
161 |
|
|
162 |
aSms.StoreSmspListL(reqStatus, smspList);
|
|
163 |
User::WaitForRequest(reqStatus);
|
|
164 |
TESTL(reqStatus.Int()==KErrNone);
|
|
165 |
|
|
166 |
CleanupStack::PopAndDestroy(); // smspList;
|
|
167 |
}
|
|
168 |
|
|
169 |
void CTestDriveSca::DisplaySmspEntry(RMobileSmsMessaging::TMobileSmspEntryV1& aSmspEntry)
|
|
170 |
{
|
|
171 |
INFO_PRINTF1(_L("SMS Param Entry:\n"));
|
|
172 |
INFO_PRINTF2(_L(" Index = %d:\n"), aSmspEntry.iIndex);
|
|
173 |
INFO_PRINTF2(_L(" Text = %S:\n"), &aSmspEntry.iText);
|
|
174 |
INFO_PRINTF2(_L(" Valid Params = %d\n"), aSmspEntry.iValidityPeriod);
|
|
175 |
|
|
176 |
INFO_PRINTF1(_L(" Destination:\n"));
|
|
177 |
DisplayMobileAddr(aSmspEntry.iDestination);
|
|
178 |
|
|
179 |
INFO_PRINTF1(_L(" SCA:\n"));
|
|
180 |
DisplayMobileAddr(aSmspEntry.iServiceCentre);
|
|
181 |
|
|
182 |
INFO_PRINTF2(_L(" Protocol Id = %d\n"), aSmspEntry.iProtocolId);
|
|
183 |
INFO_PRINTF2(_L(" DCS = %d\n"), aSmspEntry.iDcs);
|
|
184 |
INFO_PRINTF2(_L(" Validity Period = %d\n"), aSmspEntry.iValidityPeriod);
|
|
185 |
}
|
|
186 |
|
|
187 |
void CTestDriveSca::DisplayMobileAddr(RMobilePhone::TMobileAddress aMobileAddr)
|
|
188 |
{
|
|
189 |
switch (aMobileAddr.iTypeOfNumber)
|
|
190 |
{
|
|
191 |
case RMobilePhone::EUnknownNumber:
|
|
192 |
INFO_PRINTF1(_L(" Type of Number = Unknown\n"));
|
|
193 |
break;
|
|
194 |
case RMobilePhone::EInternationalNumber:
|
|
195 |
INFO_PRINTF1(_L(" Type of Number = International\n"));
|
|
196 |
break;
|
|
197 |
case RMobilePhone::ENationalNumber:
|
|
198 |
INFO_PRINTF1(_L(" Type of Number = National\n"));
|
|
199 |
break;
|
|
200 |
case RMobilePhone::ENetworkSpecificNumber:
|
|
201 |
INFO_PRINTF1(_L(" Type of Number = Network Specific\n"));
|
|
202 |
break;
|
|
203 |
case RMobilePhone::ESubscriberNumber:
|
|
204 |
INFO_PRINTF1(_L(" Type of Number = Subscriber\n"));
|
|
205 |
break;
|
|
206 |
case RMobilePhone::EAbbreviatedNumber:
|
|
207 |
INFO_PRINTF1(_L(" Type of Number = Abbreviated\n"));
|
|
208 |
break;
|
|
209 |
default:
|
|
210 |
INFO_PRINTF2(_L(" Type of Number = %d\n"), aMobileAddr.iTypeOfNumber);
|
|
211 |
break;
|
|
212 |
}
|
|
213 |
|
|
214 |
switch (aMobileAddr.iNumberPlan)
|
|
215 |
{
|
|
216 |
case RMobilePhone::EUnknownNumberingPlan:
|
|
217 |
INFO_PRINTF1(_L(" Number Plan = Unknown\n"));
|
|
218 |
break;
|
|
219 |
case RMobilePhone::EIsdnNumberPlan:
|
|
220 |
INFO_PRINTF1(_L(" Number Plan = ISDN\n"));
|
|
221 |
break;
|
|
222 |
case RMobilePhone::EDataNumberPlan:
|
|
223 |
INFO_PRINTF1(_L(" Number Plan = Data\n"));
|
|
224 |
break;
|
|
225 |
case RMobilePhone::ETelexNumberPlan:
|
|
226 |
INFO_PRINTF1(_L(" Number Plan = Telex\n"));
|
|
227 |
break;
|
|
228 |
case RMobilePhone::EPrivateNumberPlan:
|
|
229 |
INFO_PRINTF1(_L(" Number Plan = Private\n"));
|
|
230 |
break;
|
|
231 |
case RMobilePhone::ENationalNumberPlan:
|
|
232 |
INFO_PRINTF1(_L(" Number Plan = National\n"));
|
|
233 |
break;
|
|
234 |
default:
|
|
235 |
INFO_PRINTF2(_L(" Number Plan = %d\n"), aMobileAddr.iNumberPlan);
|
|
236 |
break;
|
|
237 |
}
|
|
238 |
|
|
239 |
INFO_PRINTF2(_L(" Tel # = %S\n"), &aMobileAddr.iTelNumber);
|
|
240 |
|
|
241 |
}
|