|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This file contains the header file of the CPEPhoneModel class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPEPHONEMODEL_H |
|
20 #define CPEPHONEMODEL_H |
|
21 |
|
22 //INCLUDES |
|
23 #include "mpeactivestarter.h" |
|
24 #include "mpephonemodelinternal.h" |
|
25 #include <apgtask.h> |
|
26 #include <coemain.h> |
|
27 #include <cpephonemodelif.h> |
|
28 #include <DosSvrServices.h> |
|
29 #include <e32base.h> |
|
30 #include <talogger.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CPEActiveStarter; |
|
34 class CCCE; |
|
35 class CPEEngineInfo; |
|
36 class CPEGsmAudioData; |
|
37 class CPEExternalDataHandler; |
|
38 class CPEMessageHandler; |
|
39 class CPESimStateMonitor; |
|
40 class CPEIdleStatusMonitor; |
|
41 class MEngineMonitor; |
|
42 class MPEContactHandling; |
|
43 class MPECallHandling; |
|
44 class MPELogHandling; |
|
45 class MCCEDtmfInterface; |
|
46 class CPEAudioFactory; |
|
47 class MPEServiceHandling; |
|
48 class CPERemotePartyInfoMediator; |
|
49 |
|
50 // CLASS DECLARATION |
|
51 |
|
52 // DESCRIPTION |
|
53 // Handles phone related events from the phone application. |
|
54 // |
|
55 NONSHARABLE_CLASS( CPEPhoneModel ) |
|
56 : public CPEPhoneModelIF, |
|
57 public MPEPhoneModelInternal, |
|
58 public MPEActiveStarter |
|
59 { |
|
60 public: //Constructors and destructor |
|
61 |
|
62 // Starting modules of active starter (StepL method) |
|
63 enum TActiveStarterSteps |
|
64 { |
|
65 EPEInitializeCceConnection = 0, |
|
66 EPEExternalData, |
|
67 EPECallHandling, |
|
68 EPEAudioHandling, |
|
69 EPELogHandlingPhaseOne, |
|
70 EPEContactHandlingPhaseOne, |
|
71 EPESimStateMonitor, |
|
72 EPEServiceHandling, |
|
73 EPEMessageHandler, |
|
74 EPESimChangedMonitor, |
|
75 EPESimStatusMonitorStart, |
|
76 EPELogHandlingPhaseTwo, |
|
77 EPEContactHandlingPhaseTwo, |
|
78 EPEMediatorCommandHandler |
|
79 }; |
|
80 |
|
81 /** |
|
82 * Two-phased constructor. |
|
83 * |
|
84 * @param aEngineMonitor, for phone application communication |
|
85 */ |
|
86 static CPEPhoneModel* NewL( MEngineMonitor& aEngineMonitor ); |
|
87 |
|
88 /** |
|
89 * Two-phased constructor for module tests. |
|
90 * |
|
91 * @param aEngineMonitor, for phone application communication |
|
92 * @param aAudioFactory for creating audio related classes. |
|
93 */ |
|
94 static CPEPhoneModel* NewL( |
|
95 MEngineMonitor& aEngineMonitor, |
|
96 CPEAudioFactory& aAudioFactory ); |
|
97 |
|
98 /** |
|
99 * Destructor. |
|
100 */ |
|
101 virtual ~CPEPhoneModel( ); |
|
102 |
|
103 public: //New functions |
|
104 |
|
105 /** |
|
106 * Recalls starting of modules after leave occured in the middle of StepL sequence. |
|
107 * |
|
108 */ |
|
109 void RecallSteps( ); |
|
110 |
|
111 /** |
|
112 * Starts modules of PhoneEngine. |
|
113 * |
|
114 * @return True or False depending on wether to continue stepping. |
|
115 */ |
|
116 TBool StepL( ); |
|
117 |
|
118 /** |
|
119 * Constructs Contact Handling Phase Two |
|
120 */ |
|
121 void ConstructContactHandlingPhaseTwoL(); |
|
122 |
|
123 // Functions from CPEPhonemodelIF |
|
124 |
|
125 /** |
|
126 * From CPEPhonemodelIF |
|
127 * Returns the name of the specified message to PhoneEngine |
|
128 * |
|
129 * @since S60 v.4.0 |
|
130 * @param aMessage is the message code |
|
131 * @return String containing the name of the message |
|
132 */ |
|
133 TPtrC NameByMessageToPhoneEngine( const TInt aMessage ) const; |
|
134 |
|
135 /** |
|
136 * From CPEPhonemodelIF |
|
137 * Returns the name of the specified message from PhoneEngine |
|
138 |
|
139 * @since S60 v.4.0 |
|
140 * @param aMessage is the message code |
|
141 * @return String containing the name of the message |
|
142 */ |
|
143 TPtrC NameByMessageFromPhoneEngine( const TInt aMessage ) const; |
|
144 |
|
145 // Functions from MPEPhoneModel base class |
|
146 |
|
147 /** |
|
148 * From MPEPhoneModel |
|
149 * Returns pointer to information object (CPEEngineInfo) |
|
150 * |
|
151 * @return Return pointer to CPEEngineInfo object as MPEEngineInfo. |
|
152 */ |
|
153 MPEEngineInfo* EngineInfo(); |
|
154 |
|
155 /** |
|
156 * From MPEPhoneModel |
|
157 * Reroutes messages from the phone application to the message handler |
|
158 * |
|
159 * @param aMessage is the message code. |
|
160 * @return Return possible error code. |
|
161 */ |
|
162 void HandleMessage( const TInt aMessage ); |
|
163 |
|
164 // Functions from MPEPhoneModelInternal base class |
|
165 |
|
166 /** |
|
167 * From MPEPhoneModelInternal |
|
168 * Returns pointer to information object (CPEEngineInfo) |
|
169 * |
|
170 * @return pointer to CPEEngineInfo object as MPEDataStore |
|
171 */ |
|
172 MPEDataStore* DataStore(); |
|
173 |
|
174 /** |
|
175 * From MPEPhoneModelInternal |
|
176 * Returns pointer to external data handler |
|
177 * |
|
178 * @return pointer to CPEExternalDataHandler as MPEExternalDataHandler |
|
179 */ |
|
180 MPEExternalDataHandler* DataStoreExt(); |
|
181 |
|
182 /** |
|
183 * From MPEPhoneModelInternal |
|
184 * Returns pointer to Mediator Command handler |
|
185 * |
|
186 * @return pointer to CPERemotePartyInfoMediator object |
|
187 */ |
|
188 CPERemotePartyInfoMediator* MediatorCommunicationHandler(); |
|
189 |
|
190 /** |
|
191 * From MPEPhoneModelInternal |
|
192 * Handle internal message |
|
193 * |
|
194 * @since S60 v4.0 |
|
195 * @param aMessage specifies the event that has taken place |
|
196 * @param aCallId is the call id number. |
|
197 */ |
|
198 void HandleInternalMessage( const TInt aMessage ); |
|
199 |
|
200 |
|
201 /** |
|
202 * From MPEPhoneModelInternal |
|
203 * Reroutes messages from the subsystems to the message handler |
|
204 * |
|
205 * @param aMessage is the message id. |
|
206 * @return None. |
|
207 */ |
|
208 void SendMessage( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage ); |
|
209 |
|
210 /** |
|
211 * From MPEPhoneModelInternal |
|
212 * Reroutes messages from the subsystems to the message handler. |
|
213 * |
|
214 * @param aMessage is the message id. |
|
215 * @param aCallId is the call id number. |
|
216 * @return None. |
|
217 */ |
|
218 void SendMessage( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage, |
|
219 const TInt aCallId ); |
|
220 |
|
221 |
|
222 private: |
|
223 |
|
224 /** |
|
225 * C++ default constructor. |
|
226 * @param aAudioFactory Makes copy of aAudioFactory |
|
227 */ |
|
228 CPEPhoneModel( |
|
229 MEngineMonitor& aEngineMonitor ); |
|
230 |
|
231 /** |
|
232 * C++ default constructor. |
|
233 * @param aAudioFactory Makes copy of aAudioFactory |
|
234 */ |
|
235 CPEPhoneModel( |
|
236 MEngineMonitor& aEngineMonitor, |
|
237 CPEAudioFactory& aAudioFactory ); |
|
238 |
|
239 /** |
|
240 * By default EPOC constructor is private. |
|
241 */ |
|
242 void ConstructL(); |
|
243 |
|
244 /** |
|
245 * Static callback function to send message |
|
246 * @param aSelf - pointer to itself |
|
247 * @return KErrNone |
|
248 */ |
|
249 static TInt CallBackMessageSend( TAny* aSelf ); |
|
250 |
|
251 /** |
|
252 * Process messages from the subsystems. |
|
253 * |
|
254 * @param aMessage is the message id. |
|
255 * @param aCallId is the call id number. |
|
256 * @return error from message handler. |
|
257 */ |
|
258 TInt ProcessMessage( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage, |
|
259 const TInt aCallId ); |
|
260 |
|
261 /** |
|
262 * Determines which messages needs to be delayed and delays |
|
263 * sending them to Engine monitor. |
|
264 * |
|
265 * @param aMessage is the message id. |
|
266 * @param aCallId is the call id number. |
|
267 * @return info indicating wheather message sending needs to be delayed. |
|
268 */ |
|
269 TBool DelayMessageSending( const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage, |
|
270 const TInt aCallId ); |
|
271 |
|
272 |
|
273 private: //Data |
|
274 |
|
275 // Starts Phone Engine's modules asynchronically. |
|
276 CPEActiveStarter* iActiveStarter; |
|
277 // MEngineMonitor is the message api to phone application |
|
278 MEngineMonitor& iEngineMonitor; |
|
279 // CPEEngineInfo object which handles engine information |
|
280 CPEEngineInfo* iEngineInfo; |
|
281 // CPEMessageHandler object which handles messages |
|
282 CPEMessageHandler* iMessageHandler; |
|
283 // MPECallHandling object which handles call related commands |
|
284 MPECallHandling* iCallHandling; |
|
285 // CPEAudioHandling object which handles audio related commands |
|
286 CPEGsmAudioData* iAudioData; |
|
287 // Handle to log handling |
|
288 MPELogHandling* iLogHandling; |
|
289 // Handle to contact handling |
|
290 MPEContactHandling* iContactHandling; |
|
291 MPEServiceHandling* iServiceHandling; |
|
292 // handle to file server session |
|
293 RFs iFsSession; |
|
294 // External data handler |
|
295 CPEExternalDataHandler* iExternalDataHandler; |
|
296 // SIM changed monitor |
|
297 CPESimStateMonitor* iSimChangedMonitor; |
|
298 // SIM state monitor |
|
299 CPESimStateMonitor* iSimStatusMonitor; |
|
300 // Idle status monitor |
|
301 CPEIdleStatusMonitor* iIdleStatusMonitor; |
|
302 // DosServer connect error code. |
|
303 TInt iErrorCode; |
|
304 // Stepper counter |
|
305 TInt iStep; |
|
306 // CCE interface |
|
307 CCCE* iConvergedCallEngine; |
|
308 // CCE dtmf interface |
|
309 MCCEDtmfInterface* iDtmfInterface; |
|
310 /* |
|
311 * Audio factory |
|
312 * Not own. |
|
313 */ |
|
314 CPEAudioFactory* iAudioFactory; |
|
315 // Callback |
|
316 CIdle* iCallStackCutter; |
|
317 // Message Id for callback |
|
318 MEngineMonitor::TPEMessagesFromPhoneEngine iCallBackMessage; |
|
319 // Call Id for callback |
|
320 TInt iCallBackCallId ; |
|
321 |
|
322 // Mediator command handler |
|
323 CPERemotePartyInfoMediator* iMediatorCommunicationHandler; |
|
324 |
|
325 }; |
|
326 |
|
327 #endif // CPEPHONEMODEL_H |
|
328 |
|
329 // End of File |