|
1 /* |
|
2 * Copyright (c) 2009 Sony Ericsson Mobile Communications AB |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Sony Ericsson Mobile Communications AB - initial contribution. |
|
11 * Nokia Corporation - additional changes. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef TELEPHONYFUNCTIONS_H__ |
|
21 #define TELEPHONYFUNCTIONS_H__ |
|
22 |
|
23 /** @file |
|
24 * Definition of CTelephonyFunctions class. Used by CTelephony class. |
|
25 */ |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <etel.h> |
|
29 #include <etelmm.h> |
|
30 #include <e32property.h> |
|
31 |
|
32 #include <sacls.h> |
|
33 |
|
34 #include "Etel3rdParty.h" |
|
35 |
|
36 #include <commsdattypesv1_1.h> |
|
37 |
|
38 const TInt KTelephonyDllUidValue = 0x1000AA4F; ///< Unique to this Dll |
|
39 const TUid KTelephonyDllUid={KTelephonyDllUidValue}; ///< Unique to this Dll |
|
40 _LIT(KTelephonyCategory, "Telephony"); |
|
41 |
|
42 class CGetPhoneIdAct; |
|
43 class CGetSubscriberIdAct; |
|
44 class CGetIndicatorAct; |
|
45 class CGetBatteryInfoAct; |
|
46 class CGetSignalStrengthAct; |
|
47 class CGetIccLockInfoAct; |
|
48 class CSendDTMFTonesAct; |
|
49 class CFlightModeChangeAct; |
|
50 class CNotifyIndicatorAct; |
|
51 class CNotifyBatteryInfoAct; |
|
52 class CNotifySignalStrengthAct; |
|
53 class CNotifyIccLockInfoAct; |
|
54 class CGetSupplementaryServiceStatusAct; |
|
55 class CGetIdentityServiceStatusAct; |
|
56 class CNotifyLineStatusAct; |
|
57 class CDialNewCallAct; |
|
58 class CGetCallDynamicCapsAct; |
|
59 class CHoldAct; |
|
60 class CResumeAct; |
|
61 class CSwapAct; |
|
62 class CHangupAct; |
|
63 class CAnswerIncomingCallAct; |
|
64 class CNotifyCallStatusAct; |
|
65 class CNotifyRemotePartyInfoAct; |
|
66 class CGetNetworkRegistrationStatusAct; |
|
67 class CGetCurrentNetworkInfoAct; |
|
68 class CGetCurrentNetworkNameAct; |
|
69 class CGetOperatorNameAct; |
|
70 class CNotifyNetworkRegistrationStatusAct; |
|
71 class CNotifyCurrentNetworkInfoAct; |
|
72 class CNotifyIncomingCallAct; |
|
73 |
|
74 class CTelephonyFunctions : public CBase |
|
75 /** |
|
76 Class which uses Etel.DLL on behalf of CTelephony objects. |
|
77 */ |
|
78 { |
|
79 |
|
80 public: |
|
81 enum TState ///< State of the CTelephonyFunctions object |
|
82 { |
|
83 EIdle, |
|
84 EDialling, |
|
85 EAnswering, |
|
86 EEstablishingDataChannel, |
|
87 EDataChannelInUse, |
|
88 ECleaningUp |
|
89 }; |
|
90 |
|
91 |
|
92 enum TOperations ///< Operations of the CTelephonyFunctions object |
|
93 { |
|
94 EGetPhoneId, // 0 |
|
95 EGetSubscriberId, |
|
96 EGetFlightMode, |
|
97 EGetIndicator, |
|
98 EGetBatteryInfo, |
|
99 EGetSignalStrength, // 5 |
|
100 EGetIccLockInfo, |
|
101 ESendDTMFTones, |
|
102 EDialNewCall, |
|
103 EGetCallDynamicCaps, |
|
104 EGetCallStatus, // 10 |
|
105 EHold, |
|
106 EResume, |
|
107 ESwap, |
|
108 EHangup, |
|
109 EAnswerIncomingCall, // 15 |
|
110 ENotifyIncomingCall, |
|
111 EGetNetworkRegistrationStatus, |
|
112 EGetCurrentNetworkInfo, |
|
113 EGetCurrentNetworkName, |
|
114 EGetOperatorName, // 20 |
|
115 EGetCFSupplServicesStatus, |
|
116 EGetCBSupplServicesStatus, |
|
117 EGetCWSupplServicesStatus, |
|
118 EGetIdentityServiceStatus, |
|
119 |
|
120 EFlightModeChange, // 25 |
|
121 ENotifyIndicator, |
|
122 ENotifyBatteryInfo, |
|
123 ENotifySignalStrength, |
|
124 ENotifyPin1LockInfo, |
|
125 ENotifyPin2LockInfo, // 30 |
|
126 ENotifyNetworkRegistrationStatus, |
|
127 ENotifyCurrentNetworkInfo, |
|
128 ENotifyOwnedCall1Status, |
|
129 ENotifyOwnedCall2Status, |
|
130 ENotifyOwnedCall1RemoteInfo, // 35 |
|
131 ENotifyOwnedCall2RemoteInfo, |
|
132 ENotifyVoiceLineStatus, |
|
133 |
|
134 EMaxNumberOperations |
|
135 }; |
|
136 |
|
137 enum TCallPoolOperation |
|
138 { |
|
139 EUnset, |
|
140 EAnswer, |
|
141 EDial |
|
142 }; |
|
143 |
|
144 #define KErrTelephonyOutOfSequence (-1) |
|
145 |
|
146 #define KNoMultimodeTsy (-1) |
|
147 |
|
148 // Constructors |
|
149 static CTelephonyFunctions* NewLC(); |
|
150 static CTelephonyFunctions* NewL(); |
|
151 |
|
152 // Destructor - virtual and class not intended |
|
153 // for derivation, so not exported |
|
154 ~CTelephonyFunctions(); |
|
155 |
|
156 // Phone Functionality |
|
157 TInt GetPhoneIdL(TRequestStatus& aReqStatus, TDes8& aId); |
|
158 TInt GetSubscriberIdL(TRequestStatus& aReqStatus, TDes8& aId); |
|
159 TInt GetFlightMode(TRequestStatus& aReqStatus, TDes8& aMode); |
|
160 TInt GetIndicatorL(TRequestStatus& aReqStatus, TDes8& aIndicator); |
|
161 TInt GetBatteryInfoL(TRequestStatus& aReqStatus, TDes8& aBatteryInfo); |
|
162 TInt GetSignalStrengthL(TRequestStatus& aReqStatus, TDes8& aSignalStrength); |
|
163 TInt GetLockInfoL(TRequestStatus& aReqStatus, const CTelephony::TIccLock& aLock, TDes8& aLockInfo); |
|
164 TInt SendDTMFTonesL(TRequestStatus& aReqStatus, const TDesC& aTones); |
|
165 TInt GetLineStatus(const CTelephony::TPhoneLine& aLine, TDes8& aStatus); |
|
166 TInt GetCallInfoL(TDes8& aCallSelect, TDes8& aCallInfo, TDes8& aRemoteInfo); |
|
167 TInt DialNewCallL(TRequestStatus& aStatus, TDes8& aCallParams, |
|
168 const CTelephony::TTelNumber& aTelNumber, CTelephony::TCallId& aCallId, const CTelephony::TPhoneLine aLine = CTelephony::EVoiceLine); |
|
169 TInt GetCallDynamicCaps(const CTelephony::TCallId& aCallId, TDes8& aCallCaps); |
|
170 TInt GetCallStatusL(const CTelephony::TCallId& aCallId, TDes8& aCallStatus); |
|
171 TInt HoldL(TRequestStatus& aReqStatus, const CTelephony::TCallId& aCallId); |
|
172 TInt ResumeL(TRequestStatus& aReqStatus, const CTelephony::TCallId& aCallId); |
|
173 TInt SwapL(TRequestStatus& aReqStatus, const CTelephony::TCallId& aCallId1, |
|
174 const CTelephony::TCallId& aCallId2); |
|
175 TInt HangupL(TRequestStatus& aReqStatus, const CTelephony::TCallId& aCallId); |
|
176 TInt AnswerIncomingCallL(TRequestStatus& aReqStatus, CTelephony::TCallId& aCallId, |
|
177 const CTelephony::TPhoneLine aLine=CTelephony::EVoiceLine); |
|
178 // Network Functionality |
|
179 TInt GetNetworkRegistrationStatusL(TRequestStatus& aReqStatus, TDes8& aStatus); |
|
180 TInt GetCurrentNetworkInfoL(TRequestStatus& aReqStatus, TDes8& aNetworkInfo); |
|
181 TInt GetCurrentNetworkNameL(TRequestStatus& aReqStatus, TDes8& aNetworkName); |
|
182 TInt GetOperatorNameL(TRequestStatus& aReqStatus, TDes8& aOperator); |
|
183 // (Basic) Supplementary Services Functionality |
|
184 TInt GetCFSupplementaryServiceStatusL(TRequestStatus& aRequestStatus, const CTelephony::TCallForwardingCondition aCondition, TDes8& aDes, const CTelephony::TServiceGroup aServiceGroup); |
|
185 TInt GetCBSupplementaryServiceStatusL(TRequestStatus& aRequestStatus, const CTelephony::TCallBarringCondition aCondition, TDes8& aDes, const CTelephony::TServiceGroup aServiceGroup); |
|
186 TInt GetCWSupplementaryServiceStatusL(TRequestStatus& aRequestStatus, TDes8& aDes, const CTelephony::TServiceGroup aServiceGroup); |
|
187 TInt GetIdentityServiceStatusL(TRequestStatus& aReqStatus, |
|
188 const CTelephony::TIdentityService& aService, TDes8& aStatus); |
|
189 // Cancel Request Functionality |
|
190 TInt CancelAsync(CTelephony::TCancellationRequest aCancel); |
|
191 // Notification Functionality |
|
192 TInt NotifyChangeL(TRequestStatus& aReqStatus, const CTelephony::TNotificationEvent& aEvent, TDes8& aDes); |
|
193 void ResetPendingNotifyRequest(CTelephony::TNotificationEvent aEvent); |
|
194 void CompleteRequest(TOperations aOPeration, TInt aCompleteCode); |
|
195 |
|
196 // Deprecated functions |
|
197 |
|
198 void CleanUp(); // Close/Free outstanding "Open" objects etc. |
|
199 inline TRequestStatus** RequestStatus(); |
|
200 inline RMobileCall* Call(); |
|
201 inline RMobileCall* Call(const CTelephony::TCallId aCallId); |
|
202 inline RMobileLine* Line(const CTelephony::TPhoneLine aLine); |
|
203 inline RMobilePhone* Phone(); |
|
204 inline RProperty* PhonePowerProperty(); |
|
205 TInt GetISVCall(CTelephony::TCallId& aCallId); |
|
206 void CloseAndReset(const CTelephony::TCallId aCallId); |
|
207 |
|
208 static void CopyTelAddress(const RMobilePhone::TMobileAddress& aFromAddress, CTelephony::TTelAddress& aToAddress); |
|
209 static void GetCallStatus(const RMobileCall::TMobileCallStatus aMMCallStatus, CTelephony::TCallStatus& aTelCallStatus); |
|
210 |
|
211 inline void SetAsyncRequestOutstandingFalse(); |
|
212 inline TRequestStatus** GetRequestStatus(CTelephonyFunctions::TOperations aOp); |
|
213 inline TBool IsRequestPending(CTelephonyFunctions::TOperations aOp); |
|
214 inline void SetRequestPending(CTelephonyFunctions::TOperations aOp, TBool aBool); |
|
215 |
|
216 private: |
|
217 CTelephonyFunctions(); |
|
218 void ConstructL(); |
|
219 void GetCommDbTSYnameL(TDes& aTableName); // get TSY name from CommDb |
|
220 void InitialisePhoneL(); |
|
221 TBool IsFlightModeOn(); |
|
222 TInt NotifyFlightModeL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
223 TInt NotifyOwnedCall1RemotePartyInfoL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
224 TInt NotifyOwnedCall2RemotePartyInfoL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
225 TInt NotifyVoiceLineStatusL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
226 TInt NotifyOwnedCall1StatusL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
227 TInt NotifyOwnedCall2StatusL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
228 TInt NotifyIndicatorL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
229 TInt NotifyPinLockInfoL(TRequestStatus& aRequestStatus, const CTelephony::TNotificationEvent& aEvent, TDes8& aDes); |
|
230 TInt NotifyBatteryInfoL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
231 TInt NotifySignalStrengthL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
232 TInt NotifyNetworkRegistrationStatusL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
233 TInt NotifyCurrentNetworkInfoL(TRequestStatus& aRequestStatus, TDes8& aDes); |
|
234 |
|
235 private: |
|
236 RTelServer iTelServer; |
|
237 RMobilePhone iPhone; |
|
238 RMobileLine iLineData; |
|
239 RMobileLine iLineFax; |
|
240 RMobileLine iLineVoice; |
|
241 TName iLineVoiceName; |
|
242 TName iCallName; |
|
243 RProperty iPhonePowerProperty; |
|
244 //TSAPhoneStatus iFlightMode; |
|
245 TInt iTsyVersion; |
|
246 |
|
247 // Active Objects |
|
248 CGetPhoneIdAct* iGetPhoneId; |
|
249 CGetSubscriberIdAct* iGetSubscriberId; |
|
250 CGetIndicatorAct* iGetIndicator; |
|
251 CGetBatteryInfoAct* iGetBatteryInfo; |
|
252 CGetSignalStrengthAct* iGetSignalStrength; |
|
253 CGetIccLockInfoAct* iGetIccLockInfo; |
|
254 CSendDTMFTonesAct* iSendDTMFTones; |
|
255 CDialNewCallAct* iDialNewCall; |
|
256 CHoldAct* iHold; |
|
257 CResumeAct* iResume; |
|
258 CSwapAct* iSwap; |
|
259 CHangupAct* iHangup; |
|
260 CAnswerIncomingCallAct* iAnswerIncomingCall; |
|
261 |
|
262 CFlightModeChangeAct* iFlightModeChange; |
|
263 CNotifyIndicatorAct* iNotifyIndicator; |
|
264 CNotifyBatteryInfoAct* iNotifyBatteryInfo; |
|
265 CNotifySignalStrengthAct* iNotifySignalStrength; |
|
266 CNotifyIccLockInfoAct* iNotifyIccLockInfo; |
|
267 CNotifyNetworkRegistrationStatusAct* iNotifyNetworkRegStatus; |
|
268 CNotifyCurrentNetworkInfoAct* iNotifyCurrentNetworkInfo; |
|
269 CNotifyCallStatusAct* iNotifyOwnedCall1Status; |
|
270 CNotifyCallStatusAct* iNotifyOwnedCall2Status; |
|
271 CNotifyRemotePartyInfoAct* iNotifyOwnedCall1RemoteInfo; |
|
272 CNotifyRemotePartyInfoAct* iNotifyOwnedCall2RemoteInfo; |
|
273 |
|
274 // Internal Active Objects |
|
275 CNotifyLineStatusAct* iInternalNotifyVoiceLineStatus; |
|
276 CNotifyIncomingCallAct* iInternalNotifyIncomingCall; |
|
277 |
|
278 // Network Functionality |
|
279 CGetNetworkRegistrationStatusAct* iGetNetworkRegistrationStatus; |
|
280 CGetCurrentNetworkInfoAct* iGetCurrentNetworkInfo; |
|
281 CGetCurrentNetworkNameAct* iGetCurrentNetworkName; |
|
282 CGetOperatorNameAct* iGetOperatorName; |
|
283 |
|
284 // (Basic) Supplementary Services Functionality |
|
285 CGetSupplementaryServiceStatusAct* iGetCFSupplementaryServiceStatus; |
|
286 CGetSupplementaryServiceStatusAct* iGetCWSupplementaryServiceStatus; |
|
287 CGetSupplementaryServiceStatusAct* iGetCBSupplementaryServiceStatus; |
|
288 CGetIdentityServiceStatusAct* iGetIdentityServiceStatus; |
|
289 |
|
290 TRequestStatus* iRequestStatus; |
|
291 RMobileCall iCall; |
|
292 RMobileCall iIncomingCall; |
|
293 |
|
294 TState iState; |
|
295 TBool iTelServerIsOpen; ///< so destructor can Close() if necc. |
|
296 TBool iPhoneIsOpen; ///< so destructor/CleanUp() can Close() if necc. |
|
297 TBool iLineIsVoiceOpen; ///< so destructor/CleanUp() can Close() if necc. |
|
298 TBool iLineIsDataOpen; ///< so destructor/CleanUp() can Close() if necc. |
|
299 TBool iLineIsFaxOpen; ///< so destructor/CleanUp() can Close() if necc. |
|
300 TBool iAsyncRequestOutstanding; ///< ETrue if async call in progress. |
|
301 TBool iCallIsOpen; ///< so destructor/CleanUp() can Close() if necc. |
|
302 |
|
303 RPointerArray<TRequestStatus> iReqStatusTable; |
|
304 RArray<TBool> iReqPendingTable; |
|
305 RArray<RMobileCall> iCallPool; |
|
306 RArray<TCallPoolOperation> iCallPoolStatus; |
|
307 }; // class CTelephonyFunctions |
|
308 |
|
309 class CAsyncRequestBaseAct : public CActive |
|
310 { |
|
311 |
|
312 public: |
|
313 ~CAsyncRequestBaseAct(); |
|
314 CAsyncRequestBaseAct(); |
|
315 protected: |
|
316 void RunL(); // from CActive |
|
317 virtual void Complete() = 0; |
|
318 }; |
|
319 |
|
320 /** |
|
321 Interface implemented by classes which want to be notified when an |
|
322 event completes. These objects should register themselves with the |
|
323 relevant active object that handles the event in question using |
|
324 the RegisterObserver() function. |
|
325 The AO will call EventCompleted() when it completes. |
|
326 DeregisterObserver() can be called when the object no longer |
|
327 wishes to be notified. |
|
328 |
|
329 @see MIncomingCallNameSubject |
|
330 */ |
|
331 class MEventObserver |
|
332 { |
|
333 public: |
|
334 virtual void EventCompleted() = 0; |
|
335 }; |
|
336 |
|
337 /** |
|
338 Interface implemented by the CNotifyIncomingCallAct AO |
|
339 to allow other objects register themselves to be notified of |
|
340 when an incoming call arrives, obtain the call name and reset |
|
341 it when there is no longer an incoming call. |
|
342 |
|
343 Two AOs currently make use of the methods in this interface: |
|
344 CNotifyLineStatusAct resets the call name when the line |
|
345 is no longer ringing and CAnswerIncomingCallAct retrieves the |
|
346 call name when there is an incoming call so that the call can be |
|
347 opened. |
|
348 */ |
|
349 class MIncomingCallNameSubject |
|
350 { |
|
351 public: |
|
352 virtual void RegisterObserver(MEventObserver* aObserver) = 0; |
|
353 virtual void DeregisterObserver(MEventObserver* aObserver) = 0; |
|
354 virtual void ResetCallName() = 0; |
|
355 virtual TInt CallName(TName&) const = 0; |
|
356 }; |
|
357 |
|
358 #include "TelephonyFunctions.inl" |
|
359 |
|
360 #endif // TELEPHONYFUNCTIONS_H__ |