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