|
1 // Copyright (c) 2001-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 contains the definitions of the Simulator TSY phone class. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalAll |
|
21 */ |
|
22 |
|
23 #ifndef __SIMPHONE_H__ |
|
24 #define __SIMPHONE_H__ |
|
25 |
|
26 #include <f32file.h> |
|
27 #include <et_phone.h> |
|
28 #include "CSimLine.h" |
|
29 #include "CSimDataLine.h" |
|
30 #include "CSimVoiceLine.h" |
|
31 #include "csimtimer.h" |
|
32 #include "SimConstants.h" |
|
33 #include "CSimPhoneSecurity.h" |
|
34 #include "CSimPhoneUSimApp.h" |
|
35 #include "CSimReduceTimers.h" |
|
36 #include "CSimPhoneSmartCardApp.h" |
|
37 #include "CSimPhoneInitialise.h" |
|
38 #include "CSimPhoneIMSAuth.h" |
|
39 #include "CSimUsimR6.h" |
|
40 |
|
41 #include <etelmm.h> |
|
42 #include <etelmmerr.h> |
|
43 #include <etelpckt.h> |
|
44 #include <etelsat.h> |
|
45 #include <pcktcs.h> |
|
46 #include "SimTsy.h" |
|
47 |
|
48 // Macro to create an extended error code. |
|
49 #define EXTENDEDERROR(aNormal,aExtended) ((aExtended << 16) | (aNormal & 0x0000ffff)) |
|
50 |
|
51 // Timer Values |
|
52 const TInt KSetCallProcessingSuspendStateTimeout=1; |
|
53 |
|
54 // Panics |
|
55 enum TSimPanic |
|
56 { |
|
57 ELineNotPreInstantiated, |
|
58 ESubsessionNotPreInstantiated, |
|
59 ECallStatusUnknownIllegal, |
|
60 ETimeOutEventActionFailed, |
|
61 EIllegalConfigFileIdentifier, |
|
62 ENotificationAlreadyPending, |
|
63 EIllegalStateInconsistancy, |
|
64 EIllegalAnswerNextIncomingCallInconsistancy, |
|
65 EIllegalNoCallObjectAssignedForNextIncomingCall, |
|
66 EPhoneModeUnknownIllegal, |
|
67 ENetworkModeUnknownIllegal, |
|
68 EIllegalHexCharacterInConfigFilePdu, |
|
69 EIllegalOddNumberOfCharactersInConfigFilePdu, |
|
70 EIllegalSmsRxEvent, |
|
71 EIllegalSmsTxEvent, |
|
72 EPhonebookNameOrNumberTooLarge, |
|
73 EOwnNumberNameOrNumberTooLarge, |
|
74 EIllegalCallNotRegisteredWithLine, |
|
75 EIlegalValueForSmsExpectedErrorInConfigFile, |
|
76 ENotificationReqAlreadyOutstanding, |
|
77 EIllegalCallBackId, |
|
78 ECommWriterNotConstructed, |
|
79 ECommReaderNotConstructed, |
|
80 EVoiceCallIllegalStatus, |
|
81 ECallEventIllegal, |
|
82 EIllegalCancelRequest, |
|
83 EIllegalDtmfEvent, |
|
84 EIllegalDtmfReq, |
|
85 EIllegalVoiceCallEvent, |
|
86 EPacketMSClassUnKnown, |
|
87 EOjectNotConstructed, |
|
88 EConstraintsOverlapping, |
|
89 EMobileSmsMessagingPhoneNotSetToAReceiveMode, |
|
90 EFailedToDefineProperty, |
|
91 EFailedToSetProperty, |
|
92 ETlsAlreadySet, |
|
93 ETlsNotSet, |
|
94 ECdmaModeRequired, |
|
95 EGeneral, |
|
96 EUnableToDefineProperties, |
|
97 EInvalidParameterFormatInConfigFile, |
|
98 EIllegalAnswerRemoteHangupCallInconsistency, |
|
99 EIllegalNullPtrParameter |
|
100 }; |
|
101 |
|
102 GLREF_C void SimPanic(TSimPanic aPanicNumber, TInt aLineNumber = -1); |
|
103 |
|
104 const TUint KDefaultNumberOfSlots=5; // < Default number of slots that the ETel Server should allocate for buffered requests. |
|
105 |
|
106 /** |
|
107 * This class 'CSimPhone' is the Phone class for Simulator TSY. |
|
108 * The CSimPhone class main responsibility is to handle all the functionality associated |
|
109 * with the RPhone class in the Core API and the RMobilePhone class in the Multimode API. |
|
110 * It will create and own most of the resources the phone will require during its session. |
|
111 * These include creating both voice and data lines, CConfigReader objects, CSimSysAgent objects, |
|
112 * CSimSmsMessaging object, CSimPhoneStore object, CSimPhoneBook object, and CSimPacket object. |
|
113 * |
|
114 */ |
|
115 class CSimCall; |
|
116 class CSimVoiceLine; |
|
117 class CSimSmsMessaging; |
|
118 class CSimPhBkStore; |
|
119 class CSimPhBkUSimStore; |
|
120 class CSimONStore; |
|
121 class CSimSignalStrength; |
|
122 class CSimNetworkStatus; |
|
123 class CSimIndicator; |
|
124 class CSimBatteryCharger; |
|
125 class CSimDtmf; |
|
126 class CTestConfig; |
|
127 class CTestConfigSection; |
|
128 class CSimPacketService; |
|
129 class CSimSat; |
|
130 class CSimTimer; |
|
131 class CSimCallBarring; |
|
132 class CSimCallForwarding; |
|
133 class CSimCallWaiting; |
|
134 class CSimSmartCardEapManager; |
|
135 class CSimSmartCardAuth; |
|
136 class CSimPhone : public CPhoneBase |
|
137 { |
|
138 public: |
|
139 static CSimPhone* NewL(CPhoneBase*& aPhoneBaseRef); |
|
140 CSimPhone(CPhoneBase*& aPhoneBaseRef); |
|
141 ~CSimPhone(); |
|
142 // |
|
143 static void CloseObj(TAny* aObj); |
|
144 virtual CTelObject::TReqMode ReqModeL(const TInt aIpc); |
|
145 |
|
146 // MTelObjectTSY pure virtual |
|
147 virtual TInt RegisterNotification(const TInt aIpc); |
|
148 virtual TInt DeregisterNotification(const TInt aIpc); |
|
149 virtual void Init(); |
|
150 virtual CTelObject* OpenNewObjectByNameL(const TDesC& aName); |
|
151 virtual CTelObject* OpenNewObjectL(TDes& aNewName); |
|
152 |
|
153 // MPhoneBaseTSY pure virtuals |
|
154 virtual TInt GetInfo(const TTsyReqHandle aTsyReqHandle, RPhone::TPhoneInfo* aPhoneNotifyInfo); |
|
155 virtual TInt NotifyCapsChange(const TTsyReqHandle aTsyReqHandle, RPhone::TCaps* aCaps); |
|
156 virtual TInt NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle); |
|
157 virtual TInt ControlledInitialisation(const TTsyReqHandle aTsyReqHandle); |
|
158 virtual TInt ControlledInitialisationCancel(const TTsyReqHandle aTsyReqHandle); |
|
159 virtual TInt NotifyModemDetected(const TTsyReqHandle aTsyReqHandle, RPhone::TModemDetection* aDetection); |
|
160 virtual TInt NotifyModemDetectedCancel(const TTsyReqHandle aTsyReqHandle); |
|
161 virtual TInt GetCaps(const TTsyReqHandle aTsyReqHandle,RPhone::TCaps* aCaps); |
|
162 virtual TInt GetStatus(const TTsyReqHandle aTsyReqHandle,RPhone::TStatus* aStatus); |
|
163 virtual TInt EnumerateLines(const TTsyReqHandle aTsyReqHandle,TInt*); |
|
164 virtual TInt GetLineInfo(const TTsyReqHandle aTsyReqHandle,TLineInfoIndex* aLineInfo); |
|
165 virtual TInt CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle); |
|
166 virtual TInt NumberOfSlotsL(const TInt aIpc); |
|
167 |
|
168 |
|
169 // MSubSessionExtBaseTSY pure virtual |
|
170 virtual TInt ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage); |
|
171 |
|
172 const CTestConfigSection* CfgFile(); // < Accessor function for the configuration file. |
|
173 const CTestConfigSection* DefaultCfgFile(); // < Accessor function for the default configuration file. |
|
174 |
|
175 CSimReduceTimers* GetReduceTimersSubject(); |
|
176 |
|
177 RMobilePhone::TAID GetActiveUSim(); |
|
178 TBool IsICCLocked(); |
|
179 TBool IsPIN2Locked(); |
|
180 TBool IsHiddenEnabled(); |
|
181 RMobilePhone::TMobilePhoneSubscriberId GetImsi(); |
|
182 |
|
183 void SecurityEvent(RMobilePhone::TMobilePhoneSecurityEvent aEvent); |
|
184 |
|
185 TInt FindActiveVoiceCall(CSimVoiceCall*& aCall); |
|
186 |
|
187 TInt ValidateChangeState(CSimLine* aOriginatingLine, RMobileCall::TMobileCallStatus aState); |
|
188 TInt ValidateChangeState(RPacketService::TStatus aState); |
|
189 |
|
190 TInt GetMultimodeCaps(const TTsyReqHandle aTsyReqHandle,TUint32* aCaps); |
|
191 TInt GetIccAccessCaps(const TTsyReqHandle aReqHandle, TUint32* aCaps); |
|
192 TInt GetCurrentMode(TTsyReqHandle aReqHandle,TDes8* aPckg1); |
|
193 void UpdateNetworkMode(RMobilePhone::TMobilePhoneNetworkMode aNetworkMode); |
|
194 |
|
195 TInt GetTestNumber(TInt& aTestNumber); |
|
196 TInt SetTestNumberInUse(TInt aTestNumber); |
|
197 inline RPhone::TMode Mode() const {return iMode; } |
|
198 |
|
199 RMobilePhone::TMobilePhoneNetworkMode NetworkMode(); |
|
200 void ResetTestNumber(); |
|
201 |
|
202 // Methods added to allow indicator object to retrieve information |
|
203 // from other objects owned by the phone |
|
204 RMobilePhone::TMobilePhoneBatteryStatus BatteryStatus(); |
|
205 RMobilePhone::TMobilePhoneRegistrationStatus RegistrationStatus(); |
|
206 void CheckIndicatorNotification(); |
|
207 |
|
208 // Simulated TSY version checking |
|
209 TInt iSimTsyVersion; |
|
210 // data structures deriving from TMultimodeType (the majority of cases) |
|
211 TInt CheckSimTsyVersion(RMobilePhone::TMultimodeType& aDataStruct); |
|
212 // data structures deriving from TPacketBase |
|
213 TInt CheckSimTsyVersion(TPacketBase& aDataStruct); |
|
214 // data structures deriving from TCallParams |
|
215 TInt CheckSimTsyVersion(RCall::TCallParams& aDataStruct); |
|
216 // data structures deriving from CBase (usually one-off cases) |
|
217 TInt CheckSimTsyVersion(RMobilePhone::CImsAuthorizationInfoV5& aDataStruct); |
|
218 TInt CheckSimTsyVersion(RPacketContext::CTFTMediaAuthorizationV3& aDataStruct); |
|
219 |
|
220 protected: |
|
221 void ConstructL(); |
|
222 |
|
223 private: |
|
224 |
|
225 void FindAndCreatePhBkStoresL(); |
|
226 void CreateONStoreL(); |
|
227 void InitPhoneStatus(); |
|
228 TInt GetPhoneStoreInfo(TTsyReqHandle aReqHandle,TDes8* aPckg1,TDes16* aPckg2); |
|
229 TInt GetPhoneStoreInfo(TTsyReqHandle aReqHandle,TDes8* aPckg1, |
|
230 RMobilePhone::TPhoneStoreNameAndIccType* aTable); |
|
231 TInt GetSubscriberInfo(TTsyReqHandle aReqHandle,TDes8* aPckg1); |
|
232 void GetPhoneIdAndCaps(); |
|
233 TInt GetIdentityCaps(TTsyReqHandle aReqHandle, TUint32& aCaps); |
|
234 TInt GetPhoneId(TTsyReqHandle aReqHandle,RMobilePhone::TMobilePhoneIdentityV1* aPhoneId); |
|
235 |
|
236 TInt SetCallProcessingSuspendState(const TTsyReqHandle aReqHandle, const TBool* aSuspend); |
|
237 TInt SetCallProcessingSuspendStateCancel(const TTsyReqHandle aTsyReqHandle); |
|
238 |
|
239 // Service Table IPC support functionality |
|
240 TInt EnumerateAPNEntries(TTsyReqHandle aReqHandle, TUint32* aIndex); |
|
241 TInt GetAPNname(TTsyReqHandle aReqHandle, TUint32& aIndex, RMobilePhone::TAPNEntryV3Pckg& aRetrieved); |
|
242 TInt AppendAPNName(TTsyReqHandle aReqHandle, RMobilePhone::TAPNEntryV3Pckg& aEntry); |
|
243 TInt DeleteAPNName(TTsyReqHandle aReqHandle, TUint32& aIndex); |
|
244 TInt NotifyAPNListChanged(TTsyReqHandle aReqHandle); |
|
245 TInt SetAPNControlListServiceStatus(TTsyReqHandle aReqHandle, RMobilePhone::TAPNControlListServiceStatus& aAPNControlListServiceStatus); |
|
246 TInt GetAPNControlListServiceStatus(TTsyReqHandle aReqHandle, RMobilePhone::TAPNControlListServiceStatus& aAPNControlListServiceStatus); |
|
247 TInt NotifyAPNControlListServiceStatusChange(TTsyReqHandle aReqHandle, RMobilePhone::TAPNControlListServiceStatus& aAPNControlListServiceStatus); |
|
248 TInt GetServiceTable(TTsyReqHandle aReqHandle, RMobilePhone::TMobilePhoneServiceTable aTable, TDes8* aSst); |
|
249 // Service Table utility functions |
|
250 void PopulateServiceTableL(TInt aMaxSupported, const TDesC8& aLookup, RMobilePhone::TMobilePhoneServiceTableV1** aTable); |
|
251 void PopulateServiceTableV8L(const TDesC8& aLookup,RMobilePhone::TMobilePhoneServiceTableV8** aTableV8 ); |
|
252 TBool ServiceEnabled(RMobilePhone::TMobilePhoneServiceTableV1* aTable, TInt aOffset, TUint8 aModifier); |
|
253 TInt CopyServiceTable(RMobilePhone::TMobilePhoneServiceTableV1* aFrom, RMobilePhone::TMobilePhoneServiceTableV1* aTo); |
|
254 TInt CopyServiceTableV8(RMobilePhone::TMobilePhoneServiceTableV8* aFrom, RMobilePhone::TMobilePhoneServiceTableV8* aTo); |
|
255 |
|
256 TInt NotifyModeChange(const TTsyReqHandle aTsyReqHandle, RMobilePhone::TMobilePhoneNetworkMode* aCaps); |
|
257 TInt NotifyModeChangeCancel(const TTsyReqHandle aTsyReqHandle); |
|
258 |
|
259 void TimerCallBackNetworkMode(); |
|
260 TNotifyData iNotifyNetworkModeChange; |
|
261 TInt iNetworkModeIndex; |
|
262 |
|
263 struct TNetworkModeBundle |
|
264 { |
|
265 TInt iDuration; //< Duration of dynamic caps value |
|
266 RMobilePhone::TMobilePhoneNetworkMode iNetworkMode; //< Dynamic Caps value that will be maintained through period iDuration |
|
267 }; |
|
268 CArrayFixFlat<TNetworkModeBundle>* iNetworkModeArray; //< List of Network Mode changes |
|
269 |
|
270 CPhoneBase*& iPhoneBaseRef; |
|
271 TNotifyData iAPNListNotify; |
|
272 TNotifyData iAPNStatusNotify; |
|
273 |
|
274 RArray<RMobilePhone::TAPNEntryV3> iAPNList; //< Pointer to the object that holds the Access Point Name List |
|
275 const TInt iAPNServiceOffset; |
|
276 |
|
277 // from the TMobilePhoneServiceTable enum |
|
278 RMobilePhone::TMobilePhoneServiceTableV1* iUSIMServiceTable; //< USIM service table from active USIM application on UICC. |
|
279 RMobilePhone::TMobilePhoneServiceTableV8* iUSIMServiceTableV8; //< USIM service table from active USIM application on UICC. |
|
280 RMobilePhone::TMobilePhoneServiceTableV1* iUSIMEnabledServiceTable; //< USIM Enabled Services Table to be used in conjunction with the USIM Service |
|
281 RMobilePhone::TMobilePhoneServiceTableV1* iSIMServiceTable; //< SIM service table on SIM (or from GSM application on UICC). |
|
282 |
|
283 RFs iFs; //< Connection to file server for config file access |
|
284 CSimSmsMessaging* iSmsMessaging; //< pointer to the SmsMessaging object |
|
285 CSimLine* iActiveLine; //< Pointer to the currently active line |
|
286 |
|
287 CSimVoiceLine* iVoiceLine; //< Pointer to the voice line |
|
288 CSimDataLine* iDataLine; //< Pointer to the Data line |
|
289 |
|
290 CSimSignalStrength* iSignalStrength; //< Pointer to the object that handles Signal Strength |
|
291 CSimNetworkStatus* iNetworkStatus; //< Pointer to the object that handles Network Information and Status |
|
292 CSimDtmf* iDtmf; //< Pointer to the object that handles DTMF transmission |
|
293 CArrayFixFlat<CSimPhBkStore*>* iPhBkStores; |
|
294 CArrayFixFlat<CSimPhBkUSimStore*>* iPhBkUSimStores; |
|
295 |
|
296 CSimONStore* iONStore; |
|
297 |
|
298 CTestConfig* iConfigFile; //< Pointer to the Configuration file reader |
|
299 TBuf8<KMaxName> iSectionName; |
|
300 CSimSat* iSat; //< Pointer to the Sat object |
|
301 CSimPacketService* iPacketService; //< Pointer to the Packet object |
|
302 CSimIndicator* iIndicator; //< Pointer to the Indicator object |
|
303 CSimBatteryCharger* iBatteryCharger; //< Pointer to the Battery Charger object |
|
304 CSimPhoneSecurity* iPhoneSecurity; //< Pointer to the Phone Security object |
|
305 CSimPhoneUSimApp* iPhoneUSimApp; //< Pointer to the Phone USimApp object |
|
306 CSimPhoneSmartCardApp* iPhoneSmartCardApp; //< Pointer to the Phone SmartCardApp object |
|
307 CSimPhoneIMSAuth* iPhoneIMSAuth; //< Pointer to the IMS Authorization/Authentication object |
|
308 CSimSmartCardAuth* iPhoneScAuth; //< Pointer to the object used for SmartCardAuthenticate requests |
|
309 CSimSmartCardEapManager* iPhoneScEapMan; //< Pointer to the Smart Card EAP sub-session object |
|
310 |
|
311 CSimReduceTimers* iReduceTimers; //< Pointer to the object used for reducing all simtsy timers; see KPSSimTsyTimersReduceTime |
|
312 CSimUsimR6* iUsimRelease6; //< Pointer to the object that handles USIM Release6 features |
|
313 |
|
314 RPhone::TModemDetection iModemDetection; //< Modem detection |
|
315 RPhone::TMode iMode; //< Phone mode |
|
316 RMobilePhone::TMobilePhoneNetworkMode iNtwkMode; //< current network mode |
|
317 |
|
318 struct TSimTsySubsriberId |
|
319 { |
|
320 RMobilePhone::TMobilePhoneSubscriberId iIMSI; //< Pointer to the subscriber ID |
|
321 TInt iError; |
|
322 }; |
|
323 TSimTsySubsriberId iSubscriberId; |
|
324 |
|
325 CSimCallBarring* iCallBarring; |
|
326 CSimCallForwarding* iCallForwarding; |
|
327 CSimCallWaiting* iCallWaiting; |
|
328 CSimPhoneInitialise* iSimPhoneInitialise; |
|
329 |
|
330 struct TSimTsyPhoneId |
|
331 { |
|
332 TBuf<RMobilePhone::KPhoneManufacturerIdSize> iManufacturerId; //Manufacturer identity |
|
333 TBuf<RMobilePhone::KPhoneModelIdSize> iModelId; //Model identity |
|
334 TBuf<RMobilePhone::KPhoneRevisionIdSize> iRevisionId; //Revision identity |
|
335 TBuf<RMobilePhone::KPhoneSerialNumberSize> iSerialId; //IMEI (or ESN) identity |
|
336 TInt iError; //Error code for failure |
|
337 }; |
|
338 |
|
339 TSimTsyPhoneId iPhoneId; |
|
340 TUint32 iPhoneIdCaps; |
|
341 |
|
342 // timer and callback classes for NetworkMode |
|
343 CSimTimer* iNetworkModeTimer; //< Timer for the Network Mode change simulation |
|
344 class CNetworkModeTimerCallBack : public MTimerCallBack |
|
345 { |
|
346 public: |
|
347 CNetworkModeTimerCallBack(); |
|
348 void TimerCallBack(TInt /*aId*/); |
|
349 void SetHandle(CSimPhone* aPhone); |
|
350 private: |
|
351 CSimPhone *iPhone; |
|
352 }; |
|
353 CNetworkModeTimerCallBack iTimerCallBackNetworkMode; |
|
354 |
|
355 |
|
356 // timer and callback classes for SetCallProcessingSuspendState |
|
357 CSimTimer* iSetCallProcessingSuspendStateTimer; |
|
358 class CSetCallProcessingSuspendStateTimerCallBack : public MTimerCallBack |
|
359 { |
|
360 public: |
|
361 CSetCallProcessingSuspendStateTimerCallBack(); |
|
362 void TimerCallBack(TInt aId); |
|
363 void SetHandle(CSimPhone* aPhone, const TTsyReqHandle aHandle); |
|
364 private: |
|
365 CSimPhone *iPhone; |
|
366 TTsyReqHandle iHandle; |
|
367 }; |
|
368 CSetCallProcessingSuspendStateTimerCallBack iTimerCallBackSetCallProcessingSuspendState; |
|
369 }; |
|
370 |
|
371 #endif |