|
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 |
|
17 |
|
18 /** |
|
19 @file base class for SAT component tests |
|
20 */ |
|
21 |
|
22 #ifndef CCSATCOMPONENTTESTBASE_H |
|
23 #define CCSATCOMPONENTTESTBASE_H |
|
24 |
|
25 #include <test/tefunit.h> |
|
26 |
|
27 #include <etelmm.h> |
|
28 #include <etelmmcs.h> |
|
29 #include <etelpckt.h> |
|
30 #include <etelsat.h> |
|
31 #include <ctsy/mmtsy_names.h> |
|
32 |
|
33 #include <test/rmockltsy.h> |
|
34 #include <ctsy/serviceapi/cmmutility.h> |
|
35 #include <ctsy/ltsy/sat_defs.h> |
|
36 |
|
37 #include <cstktsy/ttlv.h> |
|
38 |
|
39 // Delay constants for MockLtsy completion delay |
|
40 const TInt KDefaultNoDelay = 1; |
|
41 const TInt KDefaultDelay = 10; |
|
42 |
|
43 |
|
44 class CCSatComponentTestBase : public CTestFixture |
|
45 { |
|
46 |
|
47 protected: |
|
48 enum TExtendedErrorClient |
|
49 { |
|
50 EUseBasicError, |
|
51 EUseExtendedError |
|
52 }; |
|
53 void OpenEtelServerL(TExtendedErrorClient aSetExtendedErrorClient = EUseBasicError); |
|
54 void OpenPhoneL(); |
|
55 |
|
56 void DialL(RMobileCall& aCall, TInt aCallId, RMobilePhone::TMobileService aService); |
|
57 void OpenPacketServiceL(RPacketService& aRPacketService, RPacketService::TStatus aStartAttachStatus = RPacketService::EStatusUnattached, RPacketService::TAttachMode aStartAttachMode = RPacketService::EAttachWhenNeeded); |
|
58 |
|
59 TInt InitContextL(RPacketContext& aPacketContext, TInfoName& aContextName, TInfoName aHostCidName = _L("")); |
|
60 TInt SetContextActiveL(TInfoName& aContextName); |
|
61 TInt SetContextStatusL(TInfoName& aContextName, RPacketContext::TContextStatus aStatus); |
|
62 TInt CreateQoSAndSetProfileParamLC(RPacketQoS& aPacketQoS, |
|
63 RPacketContext& aPacketContext, |
|
64 TInfoName& aContextName, |
|
65 TPacketDataConfigBase& aRequested, |
|
66 TInfoName aPrimaryContextName = _L("")); |
|
67 |
|
68 TInt SetPacketServiceStatusL(RPacketService::TStatus& aStatus, TBool aIsResumed); |
|
69 |
|
70 TInt AddContextPacketFilterL(RPacketContext& aContext, TInfoName& aContextName, |
|
71 RPacketContext::TPacketFilterV2& aFilter, TBool aIsFailInCSAT = 0); |
|
72 |
|
73 TInt OpenNewCall(RLine& aLine, |
|
74 RCall& aCall, |
|
75 const TDesC& aLineName); |
|
76 |
|
77 TInt OpenNewCall(RLine& aLine, RCall& aCall, const TDesC& aLineName, TName& aNewName); |
|
78 |
|
79 TInt CreateIncomingCall(RLine& aLine, |
|
80 const TInt aCallId, |
|
81 const TDesC& aLineName, |
|
82 TName& aIncomingCallName, |
|
83 RMobilePhone::TMobileService aMobileService); |
|
84 |
|
85 void CloseIncomingCall(RCall& aCall, const TInt aCallId, |
|
86 RMobilePhone::TMobileService aMobileService); |
|
87 |
|
88 void CloseLineL(RLine& aLine, TInt aCallId = 0, RMobilePhone::TMobileService aMobileService = RMobilePhone::EServiceUnspecified); |
|
89 |
|
90 void AssertMockLtsyStatusL(); |
|
91 |
|
92 // to push a CleanupItem ont the cleanupstack to close the phone |
|
93 static void Cleanup(TAny* self); |
|
94 virtual void DoCleanup(); |
|
95 |
|
96 void PrepInternalGettersMockLtsy(); |
|
97 |
|
98 void DriverPrepInternalGettersMockLtsyL(); |
|
99 |
|
100 void WaitForMockLTSYTerminated(); |
|
101 |
|
102 CActiveScheduler* InstallSchedulerLC(); |
|
103 // Fake type used for bad parameter testing. |
|
104 // These will have the correct extension ID but the wrong descriptor |
|
105 // size compared to the T-class which the API expects. |
|
106 class TTestMultimodeType |
|
107 { |
|
108 public: |
|
109 TTestMultimodeType(TInt aExtensionId) { iExtensionId = aExtensionId; } |
|
110 TInt ExtensionId() const { return iExtensionId; } |
|
111 |
|
112 private: |
|
113 TInt iExtensionId; |
|
114 }; |
|
115 |
|
116 typedef TPckg<TTestMultimodeType> TTestMultimodeTypePckg; |
|
117 |
|
118 void CallGetMobileCallInfoL(TInt aCallId, |
|
119 RMobilePhone::TMobileService aService, |
|
120 const TDesC &aTelNumber); |
|
121 |
|
122 void OpenSatL(TUint8 aEnabled = 0x00); |
|
123 |
|
124 protected: |
|
125 void PrepareMockWithExpDataForPCmdNotifyL( TUint8 aPCmdNumber ); |
|
126 void PrepareMockWithCompleteDataForPCmdNotifyL( TPtrC8 aCompleteTlv, TInt aError = RSat::KSuccess, TInt aDelay = KDefaultNoDelay); |
|
127 |
|
128 void GenerateTermRspTlv( |
|
129 RBuf8& aBuf, |
|
130 TUint8 aPCmdNumber, |
|
131 TUint8 aTypeOfCommand, |
|
132 TUint8 aCommandQualifier, |
|
133 RSat::TPCmdResult aGeneralResult = RSat::KSuccess, |
|
134 const TDesC& aGeneralResultAddInfo = KNullDesC, |
|
135 const TDesC8& aAdditionalInfoTlv = KNullDesC8); |
|
136 void PrepareTerminalResponseMockDataL( |
|
137 TUint8 aPCmdNumber, |
|
138 TUint8 aTypeOfCommand, |
|
139 TUint8 aCommandQualifier, |
|
140 const TDesC& aGeneralResultAddInfo = KNullDesC, |
|
141 RSat::TPCmdResult aGeneralResult = RSat::KSuccess, |
|
142 const TDesC8& aAdditionalInfoTlv = KNullDesC8, |
|
143 const TInt aResultForExpect = KErrNone); |
|
144 void TerminalResponseL( |
|
145 RSat::TPCmd aRSatTypeOfCommand, |
|
146 const TDesC8& aRspPckg, |
|
147 const TInt aExpResult = KErrNone); |
|
148 void GenerateTerminalResponseL( |
|
149 TUint8 aPCmdNumber, |
|
150 TUint8 aTypeOfCommand, |
|
151 TUint8 aCommandQualifier, |
|
152 RSat::TPCmd aRSatTypeOfCommand, |
|
153 const TDesC8& aRspPckg, |
|
154 const TDesC& aGeneralResultAddInfo = KNullDesC, |
|
155 RSat::TPCmdResult aGeneralResult = RSat::KSuccess, |
|
156 const TDesC8& aAdditionalInfoTlv = KNullDesC8, |
|
157 const TInt aExpResult = KErrNone); |
|
158 |
|
159 void EndPSimSessionL(); |
|
160 |
|
161 TBool CommandPerformedSuccessfully( TUint8 aGeneralResult ); |
|
162 |
|
163 TInt UnicodeToPacked7L(const TDesC16& aInput, TDes8& aOutput); |
|
164 |
|
165 protected: |
|
166 RTelServer iTelServer; |
|
167 RMobilePhone iPhone; |
|
168 |
|
169 RMockLtsy iMockLTSY; |
|
170 RSat iSat; |
|
171 RMobileSmsMessaging iSms; |
|
172 }; // class CCSatComponentTestBase |
|
173 |
|
174 |
|
175 void ProactiveCmdTlvBegin( |
|
176 TTlv& aTlv, |
|
177 TUint8 aPCmdNumber, |
|
178 TUint8 aTypeOfCommand, |
|
179 TUint8 aCommandQualifier, |
|
180 TUint8 aDestDeviceId); |
|
181 |
|
182 TInt Compare16bitDesWith8bitDesL(const TDesC8& aStringToCompareWith, const TDesC16& aStringToCompare); |
|
183 |
|
184 // ------------------------------------------------------------------------ // |
|
185 |
|
186 // |
|
187 // Defintions of various Network Information type data for use in test-steps |
|
188 // |
|
189 |
|
190 // Data values for RMobilePhone::TMobilePhoneNetworkInfoV5 |
|
191 const RMobilePhone::TMobilePhoneNetworkCountryCode KCountryCode= _L("011"); |
|
192 const RMobilePhone::TMobilePhoneNetworkIdentity KCdmaSID = _L("666"); |
|
193 const RMobilePhone::TMobilePhoneNetworkIdentity KAnalogSID = _L("777"); |
|
194 const RMobilePhone::TMobilePhoneNetworkIdentity KNetworkId = _L("88888"); |
|
195 const RMobilePhone::TMobilePhoneNetworkDisplayTag KDisplayTag = _L("MyNet"); |
|
196 const RMobilePhone::TMobilePhoneNetworkShortName KShortName = _L("MyNetwork"); |
|
197 const RMobilePhone::TMobilePhoneNetworkLongName KLongName = _L("MyNetworkLongName"); |
|
198 const RMobilePhone::TMobilePhoneNetworkAccess KAccess = RMobilePhone::ENetworkAccessGsm; |
|
199 const RMobilePhone::TMobilePhoneNetworkMode KMode = RMobilePhone::ENetworkModeCdma95; |
|
200 const RMobilePhone::TMobilePhoneNetworkStatus KStatus = RMobilePhone::ENetworkStatusAvailable; |
|
201 const RMobilePhone::TMobilePhoneNetworkBandInfo KBandInfo = RMobilePhone::E1900BandF; |
|
202 const TBool KEgprsAvailable = ETrue; |
|
203 const TBool KHsdpaAvailable = EFalse; |
|
204 |
|
205 // Data values for RMobilePhone::TMobilePhoneLocationAreaV1 |
|
206 const TBool KAreaKnown = ETrue; |
|
207 const TUint KLocationAreaCode = 9999; |
|
208 const TUint KCellId = 111; |
|
209 |
|
210 // Data values for RMobilePhone::TMobilePhoneNetworkMode |
|
211 const RMobilePhone::TMobilePhoneNetworkMode KNetworkMode = RMobilePhone::ENetworkModeWcdma; |
|
212 |
|
213 // Data values for RMobilePhone::TMobilePhoneNITZ |
|
214 const TInt32 KNitzFieldsUsed = RMobilePhone::KCapsTimeAvailable | |
|
215 RMobilePhone::KCapsTimezoneAvailable | |
|
216 RMobilePhone::KCapsDSTAvailable | |
|
217 RMobilePhone::KCapsShortNameAvailable | |
|
218 RMobilePhone::KCapsLongNameAvailable; |
|
219 |
|
220 const TInt KTimeZone = 10; |
|
221 const TInt KDst = 5; |
|
222 |
|
223 // Data values for Signal Strength |
|
224 const TInt32 KSignalStrength = 99; |
|
225 const TInt8 KBar = 5; |
|
226 |
|
227 // Data values for RMobilePhone::TMobilePhoneBatteryInfoV1 |
|
228 const RMobilePhone::TMobilePhoneBatteryStatus KBatteryStatus = RMobilePhone::EPoweredByBattery; |
|
229 const TUint KBatteryChargeLevel = 77; |
|
230 |
|
231 const TUint8 KSmsMoControlEnabled = 0x01; |
|
232 const TUint8 KSmsPpDownloadEnabled = 0x02; |
|
233 const TUint8 KUssdEnabled = 0x04; |
|
234 |
|
235 // Flags for Text Formatting Mode coding in Text Attribute Tlv tag data. |
|
236 // See ETSI TS 123 040 in subclause 9.2.3.24.10.1.1 |
|
237 const TUint8 KTlvTextAttributeAlignmentLeft = 0x00; |
|
238 const TUint8 KTlvTextAttributeAlignmentCentre = 0x01; |
|
239 const TUint8 KTlvTextAttributeAlignmentRight = 0x02; |
|
240 const TUint8 KTlvTextAttributeAlignmentDefault = 0x03; |
|
241 const TUint8 KTlvTextAttributeFontSizeNormal = 0x00; |
|
242 const TUint8 KTlvTextAttributeFontSizeLarge = 0x04; |
|
243 const TUint8 KTlvTextAttributeFontSizeSmall = 0x08; |
|
244 const TUint8 KTlvTextAttributeStyleNormal = 0x00; |
|
245 const TUint8 KTlvTextAttributeStyleBold = 0x10; |
|
246 const TUint8 KTlvTextAttributeStyleItalic = 0x20; |
|
247 const TUint8 KTlvTextAttributeStyleUnderline = 0x40; |
|
248 const TUint8 KTlvTextAttributeStyleStrikethrough = 0x80; |
|
249 |
|
250 // Flags for Text Foreground Colour coding in Text Attribute Tlv tag data. |
|
251 // See ETSI TS 123 040 in subclause 9.2.3.24.10.1.1 |
|
252 const TUint8 KTlvTextAttributeForegroundColourBlack = 0x00; |
|
253 const TUint8 KTlvTextAttributeForegroundColourDarkGrey = 0x01; |
|
254 const TUint8 KTlvTextAttributeForegroundColourDarkRed = 0x02; |
|
255 const TUint8 KTlvTextAttributeForegroundColourDarkYellow = 0x03; |
|
256 const TUint8 KTlvTextAttributeForegroundColourDarkGreen = 0x04; |
|
257 const TUint8 KTlvTextAttributeForegroundColourDarkCyan = 0x05; |
|
258 const TUint8 KTlvTextAttributeForegroundColourDarkBlue = 0x06; |
|
259 const TUint8 KTlvTextAttributeForegroundColourDarkMagenta = 0x07; |
|
260 const TUint8 KTlvTextAttributeForegroundColourGrey = 0x08; |
|
261 const TUint8 KTlvTextAttributeForegroundColourWhite = 0x09; |
|
262 const TUint8 KTlvTextAttributeForegroundColourBrightRed = 0x0A; |
|
263 const TUint8 KTlvTextAttributeForegroundColourBrightYellow = 0x0B; |
|
264 const TUint8 KTlvTextAttributeForegroundColourBrightGreen = 0x0C; |
|
265 const TUint8 KTlvTextAttributeForegroundColourBrightCyan = 0x0D; |
|
266 const TUint8 KTlvTextAttributeForegroundColourBrightBlue = 0x0E; |
|
267 const TUint8 KTlvTextAttributeForegroundColourBrightMagenta = 0x0F; |
|
268 |
|
269 // Flags for Text Background Colour coding in Text Attribute Tlv tag data. |
|
270 // See ETSI TS 123 040 in subclause 9.2.3.24.10.1.1 |
|
271 const TUint8 KTlvTextAttributeBackgroundColourBlack = 0x00; |
|
272 const TUint8 KTlvTextAttributeBackgroundColourDarkGrey = 0x10; |
|
273 const TUint8 KTlvTextAttributeBackgroundColourDarkRed = 0x20; |
|
274 const TUint8 KTlvTextAttributeBackgroundColourDarkYellow = 0x30; |
|
275 const TUint8 KTlvTextAttributeBackgroundColourDarkGreen = 0x40; |
|
276 const TUint8 KTlvTextAttributeBackgroundColourDarkCyan = 0x50; |
|
277 const TUint8 KTlvTextAttributeBackgroundColourDarkBlue = 0x60; |
|
278 const TUint8 KTlvTextAttributeBackgroundColourDarkMagenta = 0x70; |
|
279 const TUint8 KTlvTextAttributeBackgroundColourGrey = 0x80; |
|
280 const TUint8 KTlvTextAttributeBackgroundColourWhite = 0x90; |
|
281 const TUint8 KTlvTextAttributeBackgroundColourBrightRed = 0xA0; |
|
282 const TUint8 KTlvTextAttributeBackgroundColourBrightYellow = 0xB0; |
|
283 const TUint8 KTlvTextAttributeBackgroundColourBrightGreen = 0xC0; |
|
284 const TUint8 KTlvTextAttributeBackgroundColourBrightCyan = 0xD0; |
|
285 const TUint8 KTlvTextAttributeBackgroundColourBrightBlue = 0xE0; |
|
286 const TUint8 KTlvTextAttributeBackgroundColourBrightMagenta = 0xF0; |
|
287 |
|
288 // Proactive command destination device Ids |
|
289 const TUint8 KDeviceIdNotSet = 0x00; |
|
290 |
|
291 #endif // CCSATCOMPONENTTESTBASE_H |
|
292 |