58
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: View for Data call settings.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef DIAGAUDIOPLUGIN_H
|
|
20 |
#define DIAGAUDIOPLUGIN_H
|
|
21 |
|
|
22 |
#include <AknProgressDialog.h> // MProgressDialogCallback
|
|
23 |
#include <DiagTestPluginBase.h> // CDiagTestPluginBase
|
|
24 |
#include <DiagResultsDatabaseItem.h> // CDiagResultsDatabaseItem::TResult
|
|
25 |
#include <mdaaudiosampleplayer.h> // MMdaAudioPlayerCallback
|
|
26 |
#include <AudioOutput.h> // TAudioOutputPreference
|
|
27 |
#include <MTelephonyAudioRoutingObserver.h> // MTelephonyAudioRoutingObserver
|
|
28 |
|
|
29 |
// FORWARD DECLARATIONS
|
|
30 |
class CPeriodic;
|
|
31 |
class CDiagResultsDbItemBuilder;
|
|
32 |
class CEikDialog;
|
|
33 |
class CAknNoteDialog;
|
|
34 |
class CAknProgressDialog;
|
|
35 |
class CEikProgressInfo;
|
|
36 |
|
|
37 |
// CLASS DEFINITION
|
|
38 |
class CDiagAudioPlugin : public CDiagTestPluginBase,
|
|
39 |
public MProgressDialogCallback,
|
|
40 |
public MMdaObjectStateChangeObserver,
|
|
41 |
public MMdaAudioPlayerCallback,
|
|
42 |
public MTelephonyAudioRoutingObserver
|
|
43 |
{
|
|
44 |
public: // Constructors and destructor
|
|
45 |
/**
|
|
46 |
* Symbian OS two-phased constructor
|
|
47 |
*
|
|
48 |
* @return Timer Test Plugin
|
|
49 |
*/
|
|
50 |
static MDiagPlugin* NewL( TAny* aInitParams );
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Destructor
|
|
54 |
*/
|
|
55 |
virtual ~CDiagAudioPlugin();
|
|
56 |
|
|
57 |
|
|
58 |
private: // private functions
|
|
59 |
/**
|
|
60 |
* C++ default constructor.
|
|
61 |
*/
|
|
62 |
CDiagAudioPlugin( CDiagPluginConstructionParam* aInitParams );
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Symbian OS default constructor.
|
|
66 |
*
|
|
67 |
*/
|
|
68 |
void ConstructL();
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Start Audio Recording with Dialogs
|
|
72 |
*
|
|
73 |
*/
|
|
74 |
void StartRecordL();
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Start Audio Playing with Dialogs
|
|
78 |
*
|
|
79 |
*/
|
|
80 |
void StartPlayL();
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Audio Recording
|
|
84 |
*
|
|
85 |
*/
|
|
86 |
void RecordingL();
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Audio Playing
|
|
90 |
*
|
|
91 |
*/
|
|
92 |
void PlayingL();
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Actions after Recording has finished
|
|
96 |
*
|
|
97 |
*/
|
|
98 |
void AfterRecordL();
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Actions after Playing has finished
|
|
102 |
*
|
|
103 |
*/
|
|
104 |
void AfterPlayL();
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Invoke CMdaAudioRecorderUtility::RecordL to start record
|
|
108 |
*
|
|
109 |
*/
|
|
110 |
void RecordL();
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Invoke CMdaAudioRecorderUtility::PlayL to start play
|
|
114 |
*
|
|
115 |
*/
|
|
116 |
void PlayL();
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Set Audio to Current Output
|
|
120 |
*
|
|
121 |
*/
|
|
122 |
void SaveAudioOutput();
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Set Audio to previous Output
|
|
126 |
*
|
|
127 |
*/
|
|
128 |
void RestoreAudioOutputL();
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Clean up instance of CPeriodic
|
|
132 |
*
|
|
133 |
*/
|
|
134 |
void ClosePeriodic();
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Check whether Recorded file exist
|
|
138 |
*/
|
|
139 |
TBool CheckRecordFile();
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Delete Recorded file
|
|
143 |
*/
|
|
144 |
void DeleteRecordFile();
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Check whether there are enough space to record
|
|
148 |
*
|
|
149 |
* @return ETure when there is enough free space
|
|
150 |
*/
|
|
151 |
TBool EnoughFreeSpace();
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Set Dialog has dismissed
|
|
155 |
*
|
|
156 |
* @param aDismissed - ETrue for Dialog dismissed
|
|
157 |
* - EFalse for Dialog has not dismissed
|
|
158 |
*/
|
|
159 |
void SetProgressDismissed( TBool aDismissed );
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Check whether Dialog has dismissed
|
|
163 |
*
|
|
164 |
* @return ETure when Dialog has dismissed
|
|
165 |
*/
|
|
166 |
TBool ProgressDismissed() const;
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Ask Cancel all Test
|
|
170 |
*
|
|
171 |
* @param aButtonId - reference of button id pressed
|
|
172 |
* @return ETure when current state is valid
|
|
173 |
*/
|
|
174 |
TBool AskCancelExecutionL( TInt& aButtonId );
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Display Confirmation Query
|
|
178 |
*
|
|
179 |
* @param aResourceId - Resource ID of Confimation Query
|
|
180 |
*
|
|
181 |
*/
|
|
182 |
TBool ShowConfQueryL( TInt aResourceId, TInt &aButtonId );
|
|
183 |
|
|
184 |
/**
|
|
185 |
* Display Message Query
|
|
186 |
*
|
|
187 |
* @param aResourceId - Resource ID of Message Query
|
|
188 |
* @param aButtonId - Reference of button id to exit
|
|
189 |
*/
|
|
190 |
TBool ShowMessageQueryL( TInt aResourceId, TInt &aButtonId );
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Display Progress Dialog
|
|
194 |
*
|
|
195 |
* @param aResourceId - Resource ID of Progress
|
|
196 |
* @param aFinalValue - Final value of Progress Note to display
|
|
197 |
*/
|
|
198 |
void ShowProgressNoteL( TInt aResourceId, TInt aFinalValue );
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Callback function to update Progress Dialog
|
|
202 |
*
|
|
203 |
* @param aThis - Object to receive call back
|
|
204 |
* @return 0 on finish
|
|
205 |
*/
|
|
206 |
static TInt CallbackIncrementProgressNoteL( TAny* aThis );
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Called from CallbackIncrementProgressNoteL
|
|
210 |
* Actual Function to update Progress Dialog
|
|
211 |
*
|
|
212 |
* @return 0 on finish
|
|
213 |
*/
|
|
214 |
TInt UpdateProgressNoteL();
|
|
215 |
|
|
216 |
|
|
217 |
private: // From CDiagTestPluginBase
|
|
218 |
|
|
219 |
/**
|
|
220 |
* @see CDiagTestPluginBase::Visible()
|
|
221 |
*/
|
|
222 |
virtual TBool IsVisible() const;
|
|
223 |
|
|
224 |
/**
|
|
225 |
* @see CDiagTestPluginBase::RunMode()
|
|
226 |
*/
|
|
227 |
virtual TRunMode RunMode() const;
|
|
228 |
|
|
229 |
/**
|
|
230 |
* @see CDiagTestPluginBase::TotalSteps()
|
|
231 |
*/
|
|
232 |
virtual TUint TotalSteps() const;
|
|
233 |
|
|
234 |
/**
|
|
235 |
* @see CDiagTestPluginBase::GetPluginNameL
|
|
236 |
*/
|
|
237 |
virtual HBufC* GetPluginNameL( TNameLayoutType aLayoutType ) const;
|
|
238 |
|
|
239 |
/**
|
|
240 |
* @see CDiagTestPluginBase::Uid
|
|
241 |
*/
|
|
242 |
virtual TUid Uid() const;
|
|
243 |
|
|
244 |
/**
|
|
245 |
* @see CDiagTestPluginBase::TestSessionBeginL
|
|
246 |
*/
|
|
247 |
virtual void TestSessionBeginL( MDiagEngineCommon& aEngine,
|
|
248 |
TBool aSkipDependencyCheck,
|
|
249 |
TAny* aCustomParams );
|
|
250 |
|
|
251 |
/**
|
|
252 |
* @see CDiagTestPluginBase::TestSessionEndL
|
|
253 |
*/
|
|
254 |
virtual void TestSessionEndL( MDiagEngineCommon& aEngine,
|
|
255 |
TBool aSkipDependencyCheck,
|
|
256 |
TAny* aCustomParams );
|
|
257 |
|
|
258 |
/**
|
|
259 |
* Handle plug-in execution.
|
|
260 |
* @see CDiagTestPluginBase::DoRunTestL()
|
|
261 |
*/
|
|
262 |
virtual void DoRunTestL();
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Handle plug-in execution stop and clean up
|
|
266 |
* @see CDiagTestPluginBase::DoStopAndCleanupL()
|
|
267 |
*/
|
|
268 |
virtual void DoStopAndCleanupL();
|
|
269 |
|
|
270 |
|
|
271 |
private: // from CActive
|
|
272 |
/**
|
|
273 |
* Handle active object completion event
|
|
274 |
*/
|
|
275 |
virtual void RunL();
|
|
276 |
|
|
277 |
/**
|
|
278 |
* Handle RunL leaves
|
|
279 |
*/
|
|
280 |
virtual TInt RunError( TInt aError );
|
|
281 |
|
|
282 |
/**
|
|
283 |
* Handle cancel
|
|
284 |
*/
|
|
285 |
virtual void DoCancel();
|
|
286 |
|
|
287 |
enum TState
|
|
288 |
{
|
|
289 |
EStateUnknown = 0,
|
|
290 |
EStateFailed,
|
|
291 |
EStateCancelled,
|
|
292 |
EStateSkipped,
|
|
293 |
EStateIdle,
|
|
294 |
EStateRecorded,
|
|
295 |
EStatePlayed,
|
|
296 |
EStateUserQuery
|
|
297 |
};
|
|
298 |
|
|
299 |
|
|
300 |
private: // from MProgressDialogCallback
|
|
301 |
/**
|
|
302 |
* Callback method Get's called when a dialog is dismissed
|
|
303 |
*
|
|
304 |
* @param aButtonId - indicate which button made dialog to dismiss
|
|
305 |
*/
|
|
306 |
virtual void DialogDismissedL( TInt aButtonId );
|
|
307 |
|
|
308 |
|
|
309 |
private: // from MMdaObjectStateChangeObserver
|
|
310 |
/**
|
|
311 |
* Handling the change of state of an audio data sample object
|
|
312 |
*
|
|
313 |
* @param aObject - indicate which button made dialog to dismiss
|
|
314 |
* @param aPreviousState - previous state
|
|
315 |
* @param aCurrentState - current state
|
|
316 |
* @param aErrorCode - error code
|
|
317 |
*/
|
|
318 |
virtual void MoscoStateChangeEvent(
|
|
319 |
CBase *aObject,
|
|
320 |
TInt aPreviousState,
|
|
321 |
TInt aCurrentState,
|
|
322 |
TInt aErrorCode);
|
|
323 |
|
|
324 |
|
|
325 |
private: // MMdaAudioPlayerCallback
|
|
326 |
/**
|
|
327 |
* Defines required client behaviour when an attempt to open and initialise an audio sample has completed
|
|
328 |
*
|
|
329 |
* @param aError - The status of the audio sample after initialisation
|
|
330 |
* @param aDuration - Duration of the audio sample
|
|
331 |
*/
|
|
332 |
virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
|
|
333 |
|
|
334 |
/**
|
|
335 |
* Defines required client behaviour when an attempt to playback an audio sample has completed
|
|
336 |
*
|
|
337 |
* @param aError - The status of playback
|
|
338 |
*/
|
|
339 |
virtual void MapcPlayComplete(TInt aError);
|
|
340 |
|
|
341 |
|
|
342 |
private: // from MTelephonyAudioRoutingObserver
|
|
343 |
/**
|
|
344 |
* Callback Available Audio Output has changed
|
|
345 |
*
|
|
346 |
* @param aTelephonyAudioRouting - Reference of Telephony AudioRouting
|
|
347 |
*/
|
|
348 |
virtual void AvailableOutputsChanged( CTelephonyAudioRouting& aTelephonyAudioRouting );
|
|
349 |
|
|
350 |
/**
|
|
351 |
* Callback when Routing Audio Output has chaged
|
|
352 |
*
|
|
353 |
* @param aTelephonyAudioRouting - Reference of Telephony AudioRouting
|
|
354 |
*/
|
|
355 |
virtual void OutputChanged( CTelephonyAudioRouting& aTelephonyAudioRouting );
|
|
356 |
|
|
357 |
/**
|
|
358 |
* Callback when Set new Telephony Audio Routing is done
|
|
359 |
*
|
|
360 |
* @param aTelephonyAudioRouting - Reference of Telephony AudioRouting
|
|
361 |
* @param aError - The status of set AudioRouting
|
|
362 |
*/
|
|
363 |
virtual void SetOutputComplete( CTelephonyAudioRouting& aTelephonyAudioRouting, TInt aError );
|
|
364 |
|
|
365 |
|
|
366 |
void SetAudioEvent(TState aState);
|
|
367 |
|
|
368 |
|
|
369 |
private: // Data
|
|
370 |
/**
|
|
371 |
* Tells session is Valid
|
|
372 |
*/
|
|
373 |
TBool iSessionValid;
|
|
374 |
|
|
375 |
/**
|
|
376 |
* Indicate Progress has dismissed
|
|
377 |
*/
|
|
378 |
TBool iProgressDismissed;
|
|
379 |
|
|
380 |
/**
|
|
381 |
* AudioState for Recording/Playing
|
|
382 |
*/
|
|
383 |
TInt iAudioState;
|
|
384 |
|
|
385 |
/**
|
|
386 |
* Recorder for Recording Audio
|
|
387 |
* OWN
|
|
388 |
*/
|
|
389 |
CMdaAudioRecorderUtility* iRecorder;
|
|
390 |
|
|
391 |
/**
|
|
392 |
* Player for Playing Audio
|
|
393 |
* OWN
|
|
394 |
*/
|
|
395 |
CMdaAudioPlayerUtility* iAudioPlayer;
|
|
396 |
|
|
397 |
/**
|
|
398 |
* Maxmium Size of Record File
|
|
399 |
*/
|
|
400 |
TInt iRecordFileSize;
|
|
401 |
|
|
402 |
/**
|
|
403 |
* Path of Record File
|
|
404 |
*/
|
|
405 |
TFileName iRecordFilePath;
|
|
406 |
|
|
407 |
/**
|
|
408 |
* Progress Dialog
|
|
409 |
* OWN
|
|
410 |
*/
|
|
411 |
CAknProgressDialog* iProgressDialog;
|
|
412 |
|
|
413 |
/**
|
|
414 |
* Info for Progress Dialog
|
|
415 |
* OWN
|
|
416 |
*/
|
|
417 |
CEikProgressInfo* iProgressInfo;
|
|
418 |
|
|
419 |
/**
|
|
420 |
* Timer for Update Progress
|
|
421 |
* OWN
|
|
422 |
*/
|
|
423 |
CPeriodic* iPeriodic;
|
|
424 |
|
|
425 |
/**
|
|
426 |
* Duration of Audio in usec
|
|
427 |
*/
|
|
428 |
TTimeIntervalMicroSeconds iMaxDurationMicroSec;
|
|
429 |
|
|
430 |
/**
|
|
431 |
* Position of Audio in usec
|
|
432 |
*/
|
|
433 |
TTimeIntervalMicroSeconds iPositionMicroSec;
|
|
434 |
|
|
435 |
/**
|
|
436 |
* Maximum time(sec) to record
|
|
437 |
*/
|
|
438 |
TInt iFinalValue;
|
|
439 |
|
|
440 |
/**
|
|
441 |
* Previous Audio Output
|
|
442 |
*/
|
|
443 |
CTelephonyAudioRouting::TAudioOutput iPrevAudioOutput;
|
|
444 |
|
|
445 |
/**
|
|
446 |
* Current Audio Output
|
|
447 |
*/
|
|
448 |
CTelephonyAudioRouting::TAudioOutput iOutput;
|
|
449 |
|
|
450 |
/**
|
|
451 |
* Audio Output to route
|
|
452 |
* OWN
|
|
453 |
*/
|
|
454 |
CTelephonyAudioRouting* iRouting;
|
|
455 |
|
|
456 |
/*
|
|
457 |
* State of the Audio Plugin.
|
|
458 |
*/
|
|
459 |
TState iState;
|
|
460 |
};
|
|
461 |
|
|
462 |
#endif //DIAGAUDIOPLUGIN_H
|
|
463 |
|
|
464 |
// End of File
|
|
465 |
|