|
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 call classes. The call classes |
|
15 // process the call-based requests made by ETel clients and passed down to the TSY by the |
|
16 // ETel Server. |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalAll |
|
23 */ |
|
24 |
|
25 #ifndef __CSIMCALL_H__ |
|
26 #define __CSIMCALL_H__ |
|
27 |
|
28 #include <e32base.h> |
|
29 #include <etelmm.h> |
|
30 #include <et_phone.h> |
|
31 #include "utils.h" |
|
32 #include "SimConstants.h" |
|
33 #include "csimtimer.h" |
|
34 |
|
35 /** |
|
36 * This class 'CSimCall' is the Call class for the Simulator TSY. |
|
37 * This class is the base classs voice and data calls. It is an abstract class so it will |
|
38 * not be instantiated. It handles all the call-based ETel requests common to voice and data calls. |
|
39 * Requests are passed down from the ETel Server through virtual functions. |
|
40 * Core ETel API requests appear as individual virtual functions, |
|
41 * while extension API requests are passed through the ExtFunc requests. |
|
42 */ |
|
43 class CSimLine; |
|
44 class CSimCallDuration; |
|
45 class CSimCallRemotePartyInfoChange; |
|
46 class CSimCall : public CCallBase |
|
47 { |
|
48 friend class CSimCallDuration; |
|
49 friend class CSimCallRemotePartyInfoChange; |
|
50 |
|
51 public: |
|
52 enum TCallEvent |
|
53 { |
|
54 ECallEventDial, |
|
55 ECallEventHangUp, |
|
56 ECallEventAnswerIncoming, |
|
57 ECallEventIncomingCall, |
|
58 ECallEventTimeOut, |
|
59 ECallEventNtRasConnected, |
|
60 ECallEventHold, |
|
61 ECallEventResume, |
|
62 ECallEventSwap, |
|
63 ECallEventConnectContinue, |
|
64 ECallEventRemoteHangup |
|
65 }; |
|
66 |
|
67 public: |
|
68 CSimCall(CSimLine* aLine,const TName& aName, CSimPhone* aPhone); |
|
69 ~CSimCall(); |
|
70 void ConstructL(); |
|
71 virtual void Init(); |
|
72 virtual TInt RegisterNotification(const TInt aIpc); |
|
73 virtual TInt DeregisterNotification(const TInt aIpc); |
|
74 static void CloseCall(TAny* aObj); |
|
75 virtual CTelObject::TReqMode ReqModeL(const TInt aIpc); |
|
76 |
|
77 // MCallBaseTSY pure virtuals |
|
78 virtual TInt GetInfo(const TTsyReqHandle aTsyReqHandle,RCall::TCallInfo* aCallInfo); |
|
79 virtual TInt GetCaps(const TTsyReqHandle aTsyReqHandle,RCall::TCaps* aCaps); |
|
80 virtual TInt NotifyCapsChange(const TTsyReqHandle aTsyReqHandle,RCall::TCaps* aCaps); |
|
81 virtual TInt NotifyCapsChangeCancel(const TTsyReqHandle aTsyReqHandle); |
|
82 virtual TInt NotifyHookChange(const TTsyReqHandle aTsyReqHandle, RCall::THookStatus* aHookStatus); |
|
83 virtual TInt NotifyHookChangeCancel(const TTsyReqHandle aTsyReqHandle); |
|
84 virtual TInt NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aStatus); |
|
85 virtual TInt NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle); |
|
86 virtual TInt NotifyDurationChange(const TTsyReqHandle aTsyReqHandle,TTimeIntervalSeconds* aTime); |
|
87 virtual TInt NotifyDurationChangeCancel(const TTsyReqHandle aTsyReqHandle); |
|
88 virtual TInt RecoverDataPortAndRelinquishOwnership(); |
|
89 virtual TInt GetStatus(const TTsyReqHandle aTsyReqHandle,RCall::TStatus* aCallStatus); |
|
90 virtual TInt TransferOwnership(const TTsyReqHandle aTsyReqHandle); |
|
91 virtual TInt AcquireOwnership(const TTsyReqHandle aTsyReqHandle); |
|
92 virtual TInt AcquireOwnershipCancel(const TTsyReqHandle aTsyReqHandle); |
|
93 virtual TInt GetCallDuration(const TTsyReqHandle aTsyReqHandle, TTimeIntervalSeconds* aTime); |
|
94 virtual TInt GetFaxSettings(const TTsyReqHandle aTsyReqHandle,RCall::TFaxSessionSettings* aSettings); |
|
95 virtual TInt SetFaxSettings(const TTsyReqHandle aTsyReqHandle,const RCall::TFaxSessionSettings* aSettings); |
|
96 virtual void UpdateNotifiers(); |
|
97 //MM |
|
98 virtual TInt GetMobileCallStatus(const TTsyReqHandle aTsyReqHandle, RMobileCall::TMobileCallStatus* aCallStatus); |
|
99 TInt GetMobileCallInfo(const TTsyReqHandle aTsyReqHandle, TDes8* aMobileCallInfo); |
|
100 virtual TInt NotifyMobileCallStatusChange(const TTsyReqHandle aTsyReqHandle,RMobileCall::TMobileCallStatus* aStatus); |
|
101 TInt NotifyMobileCallStatusChangeCancel(const TTsyReqHandle aTsyReqHandle); |
|
102 virtual TInt NumberOfSlotsL(const TInt aIpc); |
|
103 TInt GetMobileCallCaps(const TTsyReqHandle aTsyReqHandle, TDes8* aCaps); |
|
104 TInt NotifyMobileCallCapsChange(const TTsyReqHandle aTsyReqHandle, TDes8* aCaps); |
|
105 TInt NotifyMobileCallCapsChangeCancel(const TTsyReqHandle aTsyReqHandle); |
|
106 virtual TInt NotifyRemotePartyInfoChange(const TTsyReqHandle aTsyReqHandle, TDes8* aRemoteParty); |
|
107 virtual TInt NotifyRemotePartyInfoChangeCancel(); |
|
108 |
|
109 // MTelObjectTSY pure virtuals |
|
110 virtual CTelObject* OpenNewObjectByNameL(const TDesC&); |
|
111 virtual CTelObject* OpenNewObjectL(TDes& aNewName); |
|
112 |
|
113 TBool Used(); |
|
114 void SetUsed(); |
|
115 void SetUnused(); |
|
116 virtual TInt ActionEvent(TCallEvent aEvent,TInt aStatus); //< The state machine for the calls |
|
117 TInt ChangeStateL(RMobileCall::TMobileCallStatus aState,TBool aSwap, TBool aNoPropagation); //< Changes the state of the call |
|
118 void ResetIfRingingL(); |
|
119 virtual TUint Caps()=0; |
|
120 |
|
121 protected: |
|
122 void GenerateCoreCallCaps(TUint& aCaps); |
|
123 |
|
124 private: |
|
125 RCall::TStatus GetCoreCallStatus(); //< Converts Multimode Line status to Core line status |
|
126 |
|
127 public: |
|
128 TName iName; |
|
129 RMobileCall::TMobileCallStatus iState; //< Holds the current state of the call |
|
130 |
|
131 CSimCallDuration* iCallDurationHandler; // < Pointer to the owned timer class. |
|
132 |
|
133 protected: |
|
134 TNotifyData iAnswerIncomingCall; //< Holds the notification data (a flag, TsyReqHandle and any raw data) |
|
135 //< for Answer incoming call notifications |
|
136 TTsyReqHandle iDialRequestHandle; //< Request handle for the Dial request |
|
137 TTsyReqHandle iHangUpRequestHandle; //< Request handle for the Hang up request |
|
138 CSimLine* iLine; //< Pointer to the line class |
|
139 TNotifyData iNotifyStatusChange; //< Holds the notification data (a flag, TsyReqHandle and any raw data) for core call status change. |
|
140 TNotifyData iMobileNotifyStatusChange; //< Holds the notification data (a flag, TsyReqHandle and any raw data) for multimode call status change. |
|
141 //< for the line status |
|
142 RCall::THookStatus iHookState; //< The current call hook state. |
|
143 TNotifyData iNotifyHookChange; //< Holds the notification data (a flag, TsyReqHandle and any raw data) |
|
144 //< for the line hook status |
|
145 TNotifyData iNotifyCapsChange; //< Holds the notification data (a flag, TsyReqHandle and any raw data) |
|
146 //< for the core caps changes |
|
147 TNotifyData iNotifyMobileCapsChange; //< Holds the notification data (a flag, TsyReqHandle and any raw data) |
|
148 //< for the mobile caps changes |
|
149 TUint iCaps; //< The capability flags associated with the call. |
|
150 CSimCallRemotePartyInfoChange* iNotifyRemotePartyInfoTimer; //< active object that similates retrieval of remote party info after certain amount of time. |
|
151 |
|
152 CSimPhone* iPhone; |
|
153 }; |
|
154 |
|
155 class CSimCallDuration : public CBase, MTimerCallBack |
|
156 { |
|
157 public: |
|
158 static CSimCallDuration* NewL(CSimCall* aCall); |
|
159 CSimCallDuration(CSimCall* aCall); |
|
160 ~CSimCallDuration(); |
|
161 void StartDuration(); |
|
162 void StopDuration(); |
|
163 void StartNotification(TTsyReqHandle aTsyReqHandle, TTimeIntervalSeconds* aTime); |
|
164 void StopNotification(); |
|
165 void GetDuration(TTimeIntervalSeconds* aTime); |
|
166 void TimerCallBack(TInt aId); |
|
167 TTimeIntervalSeconds iCallDuration; |
|
168 |
|
169 private: |
|
170 void ConstructL(); |
|
171 |
|
172 private: |
|
173 CSimCall* iCall; |
|
174 CSimTimer* iDurationTimer; // < Pointer to the owned timer class. |
|
175 // <stores the call duration (since connected) |
|
176 TNotifyData iNotifyDurationChange; |
|
177 }; |
|
178 |
|
179 class CSimCallRemotePartyInfoChange : public CBase, MTimerCallBack |
|
180 { |
|
181 public: |
|
182 static CSimCallRemotePartyInfoChange* NewL(CSimCall* aCall); |
|
183 CSimCallRemotePartyInfoChange(CSimCall* aCall); |
|
184 ~CSimCallRemotePartyInfoChange(); |
|
185 void TimerCallBack(TInt aId); |
|
186 void Start(); |
|
187 private: |
|
188 void ConstructL(); |
|
189 public: |
|
190 |
|
191 RMobileCall::TMobileCallRemotePartyInfoV1 iRemotePartyInfoV1; |
|
192 TNotifyData iNotifyRemotePartyInfo; |
|
193 CSimTimer* iRemoteInfoTimer; |
|
194 TInt iDelay; |
|
195 CSimCall* iCall; |
|
196 }; |
|
197 |
|
198 #endif // CSIMCALL_H__ |