25
|
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: Class Definition of CDiagAudioPlugin
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
|
|
21 |
// From System
|
|
22 |
#include <AknQueryDialog.h> // CAknQueryDialog
|
|
23 |
#include <aknmessagequerydialog.h> // CAknMessageQueryDialog
|
|
24 |
#include <AknProgressDialog.h> // CAknProgressDialog
|
|
25 |
#include <eikprogi.h> // CEikProgressInfo
|
|
26 |
#include <eikbtgpc.h> // CEikButtonGroupContainer
|
|
27 |
#include <AudioPreference.h> // KAudioPriorityRecording
|
|
28 |
#include <mdaaudiosampleeditor.h> // CMdaAudioRecorderUtility
|
|
29 |
#include <mdaaudiosampleplayer.h> // CMdaAudioPlayerUtility
|
|
30 |
#include <StringLoader.h> // StringLoader
|
|
31 |
#include <DiagTestObserver.h> // MDiagTestObserver
|
|
32 |
#include <DiagTestExecParam.h> // TDiagTestExecParam
|
|
33 |
#include <DiagEngineCommon.h> // MDiagEngine
|
|
34 |
#include <DiagPluginPool.h> // CDiagPluginPool
|
|
35 |
#include <DiagResultsDbItemBuilder.h> // CDiagResultsDbItemBuilder
|
|
36 |
#include <DiagResultDetailBasic.h> // CDiagResultDetailBasic
|
|
37 |
#include <DiagFrameworkDebug.h> // LOGSTRING
|
|
38 |
#include <DiagCommonDialog.h> // for EDiagCommonDialogConfirmCancelAll
|
|
39 |
#include <avkon.rsg> // AVKON Resource Definitions
|
|
40 |
|
|
41 |
// For Central Repository
|
|
42 |
#include <centralrepository.h>
|
|
43 |
#include "diagaudiorecorderprivatecrkeys.h"
|
|
44 |
|
|
45 |
// Audio Plugin Headerfile
|
|
46 |
#include "diagaudioplugin.h" // CDiagAudioPlugin
|
|
47 |
#include "diagaudioplugin.hrh" // Button Id defined
|
|
48 |
#include <devdiagaudiopluginrsc.rsg> // Resource Definitions
|
|
49 |
|
|
50 |
|
|
51 |
// Local Macro
|
|
52 |
#define ASSERT_ALWAYS(c) __ASSERT_ALWAYS((c), User::Invariant())
|
|
53 |
|
|
54 |
// Local Data Types
|
|
55 |
enum TAudioSteps
|
|
56 |
{
|
|
57 |
EStepTestTitle,
|
|
58 |
EStepAskRecord,
|
|
59 |
EStepProgressRecord,
|
|
60 |
EStepAskPlay,
|
|
61 |
EStepProgressPlay,
|
|
62 |
EStepAskHeard,
|
|
63 |
EStepAskRepeat,
|
|
64 |
EAudioPluginTotalSteps
|
|
65 |
};
|
|
66 |
|
|
67 |
// To Exit from Query it should be EAknSoftkeyOk
|
|
68 |
// can't include in .hrh because it requires <eikon.rh>
|
|
69 |
// leads compilation fail
|
|
70 |
enum TAudioExitCBA
|
|
71 |
{
|
|
72 |
ECBACmdPlay = EAknSoftkeyOk,
|
|
73 |
ECBACmdStop = EAknSoftkeyOk,
|
|
74 |
ECBACmdStart = EAknSoftkeyOk
|
|
75 |
};
|
|
76 |
|
|
77 |
// Local Constants
|
|
78 |
const TInt KFinished = 0;
|
|
79 |
const TInt KMinFileSize = 1024;
|
|
80 |
const TInt KSamplingRate = 8192;
|
|
81 |
const TInt KStereo = 2;
|
|
82 |
const TInt KFive = 5;
|
|
83 |
const TInt KMicroSecond = 1000*1000;
|
|
84 |
const TInt KProgressDelay = 200000;
|
|
85 |
const TInt KAudioServerRequestTimeoutValue = 16 * KMicroSecond;
|
|
86 |
|
|
87 |
const TInt KProgressFinished = 0;
|
|
88 |
const TInt KProgressNotFinished = 1;
|
|
89 |
const TUid KDiagAudioPluginUid = { DIAG_AUDIO_PLUGIN_UID };
|
|
90 |
|
|
91 |
_LIT( KDiagAudioPluginResourceFileName, "z:DevDiagAudioPluginRsc.rsc" );
|
|
92 |
_LIT( KDiagAudioPluginCategory,"DevDiagAudioPlugin" );
|
|
93 |
|
|
94 |
#ifdef __WINS__
|
|
95 |
const CTelephonyAudioRouting::TAudioOutput KTargetOutput = CTelephonyAudioRouting::ELoudspeaker;
|
|
96 |
#else
|
|
97 |
const CTelephonyAudioRouting::TAudioOutput KTargetOutput = CTelephonyAudioRouting::EHandset;
|
|
98 |
#endif
|
|
99 |
|
|
100 |
|
|
101 |
// ========================= MEMBER FUNCTIONS ================================
|
|
102 |
// ---------------------------------------------------------------------------
|
|
103 |
// CDiagAudioPlugin::NewL()
|
|
104 |
//
|
|
105 |
// Symbian OS default constructor
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
MDiagPlugin* CDiagAudioPlugin::NewL( TAny* aInitParams )
|
|
108 |
{
|
|
109 |
CDiagAudioPlugin* self;
|
|
110 |
CDiagPluginConstructionParam* param;
|
|
111 |
|
|
112 |
ASSERT_ALWAYS( aInitParams );
|
|
113 |
|
|
114 |
param = static_cast<CDiagPluginConstructionParam*>( aInitParams );
|
|
115 |
CleanupStack::PushL( param );
|
|
116 |
self = new( ELeave ) CDiagAudioPlugin ( param );
|
|
117 |
CleanupStack::Pop( param );
|
|
118 |
|
|
119 |
|
|
120 |
CleanupStack::PushL( self );
|
|
121 |
self->ConstructL();
|
|
122 |
CleanupStack::Pop( self ); // self
|
|
123 |
|
|
124 |
return self;
|
|
125 |
}
|
|
126 |
|
|
127 |
// ----------------------------------------------------------------------------
|
|
128 |
// CDiagAudioPlugin::~CDiagAudioPlugin
|
|
129 |
//
|
|
130 |
// Destructor
|
|
131 |
// ----------------------------------------------------------------------------
|
|
132 |
CDiagAudioPlugin::~CDiagAudioPlugin()
|
|
133 |
{
|
|
134 |
// Delete resources allocated during construction.
|
|
135 |
// Nothing to do since no new resource is allocated in constructor.
|
|
136 |
}
|
|
137 |
|
|
138 |
// ----------------------------------------------------------------------------
|
|
139 |
// CDiagAudioPlugin::CDiagAudioPlugin()
|
|
140 |
//
|
|
141 |
// Constructor
|
|
142 |
// ----------------------------------------------------------------------------
|
|
143 |
//
|
|
144 |
CDiagAudioPlugin::CDiagAudioPlugin( CDiagPluginConstructionParam* aParam )
|
|
145 |
: CDiagTestPluginBase( aParam )
|
|
146 |
{
|
|
147 |
}
|
|
148 |
|
|
149 |
// ---------------------------------------------------------------------------
|
|
150 |
// CDiagAudioPlugin::ConstructL()
|
|
151 |
//
|
|
152 |
// Symbian OS two-phased constructor
|
|
153 |
// ---------------------------------------------------------------------------
|
|
154 |
void CDiagAudioPlugin::ConstructL()
|
|
155 |
{
|
|
156 |
LOGSTRING( "CDiagAudioPlugin::ConstructL: Plugin created. IN" )
|
|
157 |
|
|
158 |
BaseConstructL ( KDiagAudioPluginResourceFileName );
|
|
159 |
|
|
160 |
TInt recording_time;
|
|
161 |
|
|
162 |
// Open Central Repository
|
|
163 |
CRepository* audioRecorderRepository;
|
|
164 |
audioRecorderRepository = CRepository::NewL( KCRUidDiagVoiceRecorderPlugin );
|
|
165 |
CleanupStack::PushL( audioRecorderRepository );
|
|
166 |
|
|
167 |
// Read File Path from CR
|
|
168 |
iRecordFilePath.FillZ();
|
|
169 |
User::LeaveIfError(
|
|
170 |
audioRecorderRepository->Get( KAudioRecorderFilePath, iRecordFilePath) );
|
|
171 |
|
|
172 |
// Read File Size from CR
|
|
173 |
User::LeaveIfError(
|
|
174 |
audioRecorderRepository->Get( KAudioRecorderRecordingTime , recording_time) );
|
|
175 |
|
|
176 |
iRecordFileSize = (recording_time * KSamplingRate * KStereo);
|
|
177 |
|
|
178 |
CleanupStack::PopAndDestroy( audioRecorderRepository );
|
|
179 |
audioRecorderRepository = NULL;
|
|
180 |
|
|
181 |
// Set Audio Output
|
|
182 |
iOutput = KTargetOutput;
|
|
183 |
|
|
184 |
LOGSTRING( "CDiagAudioPlugin::ConstructL: Plugin created. OUT" )
|
|
185 |
}
|
|
186 |
|
|
187 |
// ---------------------------------------------------------------------------
|
|
188 |
// CDiagAudioPlugin::StartRecordL
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
void CDiagAudioPlugin::StartRecordL()
|
|
192 |
{
|
|
193 |
LOGSTRING( "CDiagAudioPlugin::DoRunTest() IN" )
|
|
194 |
TBool goNext;
|
|
195 |
|
|
196 |
// Delete Record File
|
|
197 |
DeleteRecordFile();
|
|
198 |
|
|
199 |
// Check Free Space
|
|
200 |
if ( !EnoughFreeSpace() )
|
|
201 |
{
|
|
202 |
CompleteTestL( CDiagResultsDatabaseItem::ENotPerformed );
|
|
203 |
return;
|
|
204 |
}
|
|
205 |
|
|
206 |
// Show Init Message Query
|
|
207 |
do
|
|
208 |
{
|
|
209 |
goNext = ETrue;
|
|
210 |
|
|
211 |
// Check session before launch before dialog starts
|
|
212 |
if ( !iSessionValid )
|
|
213 |
{
|
|
214 |
LOGSTRING( "CDiagAudioPlugin::StartRecordL - !iSessionValid 1" )
|
|
215 |
return;
|
|
216 |
}
|
|
217 |
|
|
218 |
// Report current Progress to Engine
|
|
219 |
ReportTestProgressL( EStepTestTitle );
|
|
220 |
|
|
221 |
// Show Message Query Title
|
|
222 |
TInt buttonId;
|
|
223 |
TBool result = EFalse;
|
|
224 |
|
|
225 |
result = ShowMessageQueryL( R_MESSAGEQUERY_TITLE, buttonId );
|
|
226 |
|
|
227 |
// Check session is valid after dialog dismissed
|
|
228 |
if ( !result )
|
|
229 |
{
|
|
230 |
LOGSTRING( "CDiagAudioPlugin::StartRecordL - !iSessionValid 2" )
|
|
231 |
return;
|
|
232 |
}
|
|
233 |
|
|
234 |
// 1.1 Case for press Skip
|
|
235 |
|
|
236 |
// ADO & Platformization Changes
|
|
237 |
//if ( buttonId == ECBACmdSkip )
|
|
238 |
if ( buttonId == ECBACmdCancel )
|
|
239 |
{
|
|
240 |
LOGSTRING( "CDiagAudioPlugin::StartRecordL: Skip has pressed" )
|
|
241 |
CompleteTestL( CDiagResultsDatabaseItem::ESkipped );
|
|
242 |
return;
|
|
243 |
}
|
|
244 |
|
|
245 |
// 1.2 case for press Cancel
|
|
246 |
//else if ( buttonId == ECBACmdCancel )
|
|
247 |
else if ( buttonId == ECBACmdSkip )
|
|
248 |
{
|
|
249 |
LOGSTRING( "CDiagAudioPlugin::StartRecordL: Cancel has pressed" )
|
|
250 |
|
|
251 |
TInt cancelButtonId;
|
|
252 |
|
|
253 |
//cancelResult = AskCancelExecutionL( cancelButtonId );
|
|
254 |
CAknDialog* dlg = ExecutionParam().Engine().
|
|
255 |
CreateCommonDialogLC( EDiagCommonDialogConfirmSkipAll, NULL );
|
|
256 |
|
|
257 |
if ( !RunWaitingDialogL( dlg, cancelButtonId ) )
|
|
258 |
{
|
|
259 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL - !iSessionValid 3" )
|
|
260 |
return;
|
|
261 |
}
|
|
262 |
|
|
263 |
if(cancelButtonId)
|
|
264 |
return;
|
|
265 |
else
|
|
266 |
goNext = EFalse;
|
|
267 |
|
|
268 |
|
|
269 |
/*
|
|
270 |
switch ( cancelButtonId )
|
|
271 |
{
|
|
272 |
case EAknSoftkeyYes:
|
|
273 |
CompleteTestL( CDiagResultsDatabaseItem::ECancelled ); // Added for NTEI-7EZ9VQ
|
|
274 |
return;
|
|
275 |
default:
|
|
276 |
goNext = EFalse;
|
|
277 |
break;
|
|
278 |
}
|
|
279 |
*/
|
|
280 |
}
|
|
281 |
}
|
|
282 |
while ( goNext == EFalse );
|
|
283 |
|
|
284 |
|
|
285 |
// Show Record Message Query
|
|
286 |
do
|
|
287 |
{
|
|
288 |
goNext = ETrue;
|
|
289 |
|
|
290 |
// Check session before launch before dialog starts
|
|
291 |
if ( !iSessionValid )
|
|
292 |
{
|
|
293 |
LOGSTRING( "CDiagAudioPlugin::StartRecordL - !iSessionValid 4" )
|
|
294 |
return;
|
|
295 |
}
|
|
296 |
|
|
297 |
// Report current Progress to Engine
|
|
298 |
ReportTestProgressL( EStepAskRecord );
|
|
299 |
|
|
300 |
// Show Message Query Title
|
|
301 |
TInt buttonId;
|
|
302 |
TBool result = EFalse;
|
|
303 |
|
|
304 |
result = ShowMessageQueryL( R_MESSAGEQUERY_ASK_RECORD, buttonId );
|
|
305 |
|
|
306 |
// Check session is valid after dialog dismissed
|
|
307 |
if ( !result )
|
|
308 |
{
|
|
309 |
LOGSTRING( "CDiagAudioPlugin::StartRecordL - !iSessionValid 5" )
|
|
310 |
return;
|
|
311 |
}
|
|
312 |
|
|
313 |
// 2.2 Case for press Skip
|
|
314 |
if ( buttonId == ECBACmdStart )
|
|
315 |
{
|
|
316 |
LOGSTRING( "CDiagAudioPlugin::StartRecordL: Start has pressed" )
|
|
317 |
RecordL();
|
|
318 |
return;
|
|
319 |
}
|
|
320 |
else if ( buttonId == ECBACmdSkip )
|
|
321 |
{
|
|
322 |
LOGSTRING( "CDiagAudioPlugin::StartRecordL: Skip has pressed" )
|
|
323 |
CompleteTestL( CDiagResultsDatabaseItem::ESkipped );
|
|
324 |
return;
|
|
325 |
}
|
|
326 |
|
|
327 |
// 2.3 case for press Cancel
|
|
328 |
else if ( buttonId == ECBACmdCancel )
|
|
329 |
{
|
|
330 |
LOGSTRING( "CDiagAudioPlugin::StartRecordL: Cancel has pressed" )
|
|
331 |
|
|
332 |
TInt cancelButtonId;
|
|
333 |
TBool cancelResult = EFalse;
|
|
334 |
|
|
335 |
cancelResult = AskCancelExecutionL( cancelButtonId );
|
|
336 |
|
|
337 |
if ( !cancelResult )
|
|
338 |
{
|
|
339 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL - !iSessionValid 6" )
|
|
340 |
return;
|
|
341 |
}
|
|
342 |
|
|
343 |
if(cancelButtonId == EAknSoftkeyYes)
|
|
344 |
{
|
|
345 |
CompleteTestL( CDiagResultsDatabaseItem::ECancelled );
|
|
346 |
return;
|
|
347 |
}
|
|
348 |
else if(cancelButtonId)
|
|
349 |
{
|
|
350 |
return;
|
|
351 |
}
|
|
352 |
else
|
|
353 |
{
|
|
354 |
goNext = EFalse;
|
|
355 |
}
|
|
356 |
|
|
357 |
/*
|
|
358 |
switch ( cancelButtonId )
|
|
359 |
{
|
|
360 |
case EAknSoftkeyYes:
|
|
361 |
CompleteTestL( CDiagResultsDatabaseItem::ECancelled ); // Added for NTEI-7EZ9VQ
|
|
362 |
return;
|
|
363 |
default:
|
|
364 |
goNext = EFalse;
|
|
365 |
break;
|
|
366 |
}
|
|
367 |
*/
|
|
368 |
}
|
|
369 |
}
|
|
370 |
while ( goNext == EFalse );
|
|
371 |
|
|
372 |
}
|
|
373 |
|
|
374 |
// ---------------------------------------------------------------------------
|
|
375 |
// CDiagAudioPlugin::StartPlayL
|
|
376 |
// ---------------------------------------------------------------------------
|
|
377 |
//
|
|
378 |
void CDiagAudioPlugin::StartPlayL()
|
|
379 |
{
|
|
380 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL() IN" )
|
|
381 |
TBool goNext;
|
|
382 |
|
|
383 |
|
|
384 |
// Check Record File
|
|
385 |
if ( CheckRecordFile() == EFalse )
|
|
386 |
{
|
|
387 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL() CheckRecordFile == EFalse" )
|
|
388 |
CompleteTestL( CDiagResultsDatabaseItem::ENotPerformed );
|
|
389 |
return;
|
|
390 |
}
|
|
391 |
|
|
392 |
do
|
|
393 |
{
|
|
394 |
goNext = ETrue;
|
|
395 |
|
|
396 |
// Check session before launch before dialog starts
|
|
397 |
if ( !iSessionValid )
|
|
398 |
{
|
|
399 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL - !iSessionValid 1" )
|
|
400 |
return;
|
|
401 |
}
|
|
402 |
|
|
403 |
// Report current Progress to Engine
|
|
404 |
ReportTestProgressL( EStepAskPlay );
|
|
405 |
|
|
406 |
// Show ConfQuery to ask Play
|
|
407 |
TInt buttonId;
|
|
408 |
TBool result = EFalse;
|
|
409 |
|
|
410 |
result = ShowConfQueryL( R_CONFQUERY_ASK_PLAY, buttonId );
|
|
411 |
|
|
412 |
// Check session is valid after dialog dismissed
|
|
413 |
if ( !result )
|
|
414 |
{
|
|
415 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL - !iSessionValid 2" )
|
|
416 |
return;
|
|
417 |
}
|
|
418 |
|
|
419 |
// 1.1 Case for press Skip
|
|
420 |
if ( buttonId == ECBACmdSkip )
|
|
421 |
{
|
|
422 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL: Skip has pressed" )
|
|
423 |
CompleteTestL( CDiagResultsDatabaseItem::ESkipped );
|
|
424 |
return;
|
|
425 |
}
|
|
426 |
|
|
427 |
// 1.2 case for press Cancel
|
|
428 |
else if ( buttonId == ECBACmdCancel )
|
|
429 |
{
|
|
430 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL: Cancel has pressed" )
|
|
431 |
TInt cancelButtonId;
|
|
432 |
TBool cancelResult = EFalse;
|
|
433 |
|
|
434 |
cancelResult = AskCancelExecutionL( cancelButtonId );
|
|
435 |
|
|
436 |
if ( !cancelResult )
|
|
437 |
{
|
|
438 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL - !iSessionValid 3" )
|
|
439 |
return;
|
|
440 |
}
|
|
441 |
|
|
442 |
if(cancelButtonId == EAknSoftkeyYes)
|
|
443 |
{
|
|
444 |
CompleteTestL( CDiagResultsDatabaseItem::ECancelled );
|
|
445 |
return;
|
|
446 |
}
|
|
447 |
else if(cancelButtonId)
|
|
448 |
{
|
|
449 |
return;
|
|
450 |
}
|
|
451 |
else
|
|
452 |
{
|
|
453 |
goNext = EFalse;
|
|
454 |
}
|
|
455 |
/*
|
|
456 |
switch ( cancelButtonId )
|
|
457 |
{
|
|
458 |
case EAknSoftkeyYes:
|
|
459 |
CompleteTestL( CDiagResultsDatabaseItem::ECancelled ); // Added for NTEI-7EZ9VQ
|
|
460 |
return;
|
|
461 |
default:
|
|
462 |
goNext = EFalse;
|
|
463 |
break;
|
|
464 |
}
|
|
465 |
*/
|
|
466 |
}
|
|
467 |
// 1.3 case for press Play
|
|
468 |
else if ( buttonId == ECBACmdPlay )
|
|
469 |
{
|
|
470 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL: Play has pressed" )
|
|
471 |
iState = EStateRecorded;
|
|
472 |
PlayL();
|
|
473 |
}
|
|
474 |
} while ( !goNext );
|
|
475 |
}
|
|
476 |
|
|
477 |
// ---------------------------------------------------------------------------
|
|
478 |
// CDiagAudioPlugin::RecordingL
|
|
479 |
// ---------------------------------------------------------------------------
|
|
480 |
//
|
|
481 |
void CDiagAudioPlugin::RecordingL()
|
|
482 |
{
|
|
483 |
LOGSTRING( "CDiagAudioPlugin::RecordingL IN" )
|
|
484 |
const TTimeIntervalMicroSeconds position = 0;
|
|
485 |
|
|
486 |
iFinalValue = iRecordFileSize / KSamplingRate / KStereo;
|
|
487 |
|
|
488 |
ReportTestProgressL( EStepProgressRecord );
|
|
489 |
ShowProgressNoteL( R_PROGRESS_NOTE_RECORDING, iFinalValue );
|
|
490 |
|
|
491 |
iRecorder->SetPriority(
|
|
492 |
KAudioPriorityAlarm + 1,
|
|
493 |
TMdaPriorityPreference( KAudioPrefVoiceRec )
|
|
494 |
);
|
|
495 |
|
|
496 |
iRecorder->SetPosition( position );
|
|
497 |
iRecorder->CropL();
|
|
498 |
iRecorder->SetMaxWriteLength( iRecordFileSize );
|
|
499 |
|
|
500 |
ResetWatchdog( KAudioServerRequestTimeoutValue, CDiagResultsDatabaseItem::EFailed );
|
|
501 |
iRecorder->RecordL(); // MoscoStateChangeEvent() will be called as return
|
|
502 |
LOGSTRING( "CDiagAudioPlugin::RecordingL OUT" )
|
|
503 |
}
|
|
504 |
|
|
505 |
// ---------------------------------------------------------------------------
|
|
506 |
// CDiagAudioPlugin::PlayingL
|
|
507 |
// ---------------------------------------------------------------------------
|
|
508 |
//
|
|
509 |
void CDiagAudioPlugin::PlayingL()
|
|
510 |
{
|
|
511 |
LOGSTRING( "CDiagAudioPlugin::PlayingL IN" )
|
|
512 |
|
|
513 |
TInt64 interval = 0;
|
|
514 |
TInt finalValue = 0;
|
|
515 |
|
|
516 |
interval = iMaxDurationMicroSec.Int64() / KMicroSecond;
|
|
517 |
finalValue = ((I64INT(interval)));
|
|
518 |
iFinalValue = finalValue;
|
|
519 |
|
|
520 |
ReportTestProgressL( EStepProgressPlay );
|
|
521 |
ShowProgressNoteL( R_PROGRESS_NOTE_PLAYING, iFinalValue );
|
|
522 |
|
|
523 |
iAudioPlayer->SetPosition( iPositionMicroSec );
|
|
524 |
iAudioPlayer->Play();
|
|
525 |
|
|
526 |
LOGSTRING( "CDiagAudioPlugin::PlayingL OUT" )
|
|
527 |
}
|
|
528 |
|
|
529 |
// ---------------------------------------------------------------------------
|
|
530 |
// CDiagAudioPlugin::AfterRecordL
|
|
531 |
// ---------------------------------------------------------------------------
|
|
532 |
//
|
|
533 |
void CDiagAudioPlugin::AfterRecordL()
|
|
534 |
{
|
|
535 |
StartPlayL();
|
|
536 |
}
|
|
537 |
|
|
538 |
// ---------------------------------------------------------------------------
|
|
539 |
// CDiagAudioPlugin::AfterPlayL
|
|
540 |
// ---------------------------------------------------------------------------
|
|
541 |
//
|
|
542 |
void CDiagAudioPlugin::AfterPlayL()
|
|
543 |
{
|
|
544 |
LOGSTRING( "CDiagAudioPlugin::AfterPlayL IN" )
|
|
545 |
|
|
546 |
|
|
547 |
// Check session before launch before dialog starts
|
|
548 |
if ( !iSessionValid )
|
|
549 |
{
|
|
550 |
LOGSTRING( "CDiagAudioPlugin::AfterPlayL - !iSessionValid 1.1" )
|
|
551 |
return;
|
|
552 |
}
|
|
553 |
|
|
554 |
// Report current Progress to Engine
|
|
555 |
ReportTestProgressL( EStepAskHeard );
|
|
556 |
|
|
557 |
// Show ConfQuery to ask Heard
|
|
558 |
TInt buttonId;
|
|
559 |
TBool result = EFalse;
|
|
560 |
result = ShowConfQueryL( R_CONFQUERY_ASK_HEARD, buttonId );
|
|
561 |
|
|
562 |
// Check session is valid after dialog dismissed
|
|
563 |
if ( !result )
|
|
564 |
{
|
|
565 |
LOGSTRING( "CDiagAudioPlugin::AfterPlayL - !iSessionValid 1.2" )
|
|
566 |
return;
|
|
567 |
}
|
|
568 |
|
|
569 |
// Report Success on Yes
|
|
570 |
if ( buttonId == EAknSoftkeyYes )
|
|
571 |
{
|
|
572 |
LOGSTRING( "CDiagAudioPlugin::AfterPlayL - Yes has pressed - return ESuccess" )
|
|
573 |
CompleteTestL( CDiagResultsDatabaseItem::ESuccess );
|
|
574 |
return;
|
|
575 |
}
|
|
576 |
else if ( buttonId != ECBACmdCustomNo )
|
|
577 |
{
|
|
578 |
// return; // ADO & Platformization Changes
|
|
579 |
}
|
|
580 |
|
|
581 |
// Check session before launch before dialog starts
|
|
582 |
if ( !iSessionValid )
|
|
583 |
{
|
|
584 |
LOGSTRING( "CDiagAudioPlugin::AfterPlayL - !iSessionValid 2.1" )
|
|
585 |
return;
|
|
586 |
}
|
|
587 |
|
|
588 |
// Report current Progress to Engine
|
|
589 |
ReportTestProgressL( EStepAskRepeat );
|
|
590 |
|
|
591 |
// Show ConfQuery to ask Heard
|
|
592 |
result = ShowConfQueryL( R_CONFQUERY_ASK_REPEAT, buttonId );
|
|
593 |
|
|
594 |
// Check session is valid after dialog dismissed
|
|
595 |
if ( !result )
|
|
596 |
{
|
|
597 |
LOGSTRING( "CDiagAudioPlugin::AfterPlayL - !iSessionValid 2.2" )
|
|
598 |
return;
|
|
599 |
}
|
|
600 |
|
|
601 |
// Report Success on Yes
|
|
602 |
if ( buttonId == EAknSoftkeyYes )
|
|
603 |
{
|
|
604 |
LOGSTRING( "CDiagAudioPlugin::AfterPlayL - Yes has pressed - Start Record Again" )
|
|
605 |
StartRecordL();
|
|
606 |
return;
|
|
607 |
}
|
|
608 |
else if ( buttonId == ECBACmdCustomNo || buttonId == EAknSoftkeyNo)
|
|
609 |
{
|
|
610 |
LOGSTRING( "CDiagAudioPlugin::AfterPlayL - No has pressed - Start Record Again" )
|
|
611 |
CompleteTestL( CDiagResultsDatabaseItem::EFailed );
|
|
612 |
}
|
|
613 |
else
|
|
614 |
{
|
|
615 |
CompleteTestL( CDiagResultsDatabaseItem::EFailed ); // Temp change / As button ID from Ask_Repeat resource is not known
|
|
616 |
return;
|
|
617 |
}
|
|
618 |
}
|
|
619 |
|
|
620 |
// ---------------------------------------------------------------------------
|
|
621 |
// CDiagAudioPlugin::RecordL
|
|
622 |
// ---------------------------------------------------------------------------
|
|
623 |
//
|
|
624 |
void CDiagAudioPlugin::RecordL()
|
|
625 |
{
|
|
626 |
LOGSTRING( "CDiagAudioPlugin::RecordL IN" )
|
|
627 |
|
|
628 |
iAudioState = CMdaAudioRecorderUtility::ERecording;
|
|
629 |
iState = EStateUnknown;
|
|
630 |
|
|
631 |
if ( iRecorder )
|
|
632 |
{
|
|
633 |
ResetWatchdog( KAudioServerRequestTimeoutValue, CDiagResultsDatabaseItem::EFailed );
|
|
634 |
iRecorder->OpenFileL( iRecordFilePath ); // MoscoStateChangeEvent() will be called as return
|
|
635 |
}
|
|
636 |
|
|
637 |
LOGSTRING( "CDiagAudioPlugin::RecordL OUT" )
|
|
638 |
}
|
|
639 |
|
|
640 |
// ---------------------------------------------------------------------------
|
|
641 |
// CDiagAudioPlugin::PlayL
|
|
642 |
// ---------------------------------------------------------------------------
|
|
643 |
//
|
|
644 |
void CDiagAudioPlugin::PlayL()
|
|
645 |
{
|
|
646 |
LOGSTRING( "CDiagAudioPlugin::PlayL IN" )
|
|
647 |
iAudioState = CMdaAudioRecorderUtility::EPlaying;
|
|
648 |
|
|
649 |
// Save Current Audio Output
|
|
650 |
LOGSTRING( "CDiagAudioPlugin::PlayL:SaveAudioOutput" )
|
|
651 |
SaveAudioOutput();
|
|
652 |
|
|
653 |
// Invoke Play
|
|
654 |
if ( iAudioPlayer )
|
|
655 |
{
|
|
656 |
LOGSTRING( "CDiagAudioPlugin::PlayL:OpenFileL(iRecordFilePath);" )
|
|
657 |
ResetWatchdog( KAudioServerRequestTimeoutValue, CDiagResultsDatabaseItem::EFailed );
|
|
658 |
iAudioPlayer->OpenFileL( iRecordFilePath ); // MapcInitComplete() will be called as return
|
|
659 |
}
|
|
660 |
|
|
661 |
LOGSTRING( "CDiagAudioPlugin::PlayL OUT" )
|
|
662 |
}
|
|
663 |
|
|
664 |
// ---------------------------------------------------------------------------
|
|
665 |
// CDiagAudioPlugin::SaveAudioOutput()
|
|
666 |
// ---------------------------------------------------------------------------
|
|
667 |
//
|
|
668 |
void CDiagAudioPlugin::SaveAudioOutput()
|
|
669 |
{
|
|
670 |
LOGSTRING( "CDiagAudioPlugin::SaveAudioOutput IN" )
|
|
671 |
|
|
672 |
iPrevAudioOutput = iRouting->Output();
|
|
673 |
|
|
674 |
LOGSTRING( "CDiagAudioPlugin::SaveAudioOutput OUT" )
|
|
675 |
}
|
|
676 |
|
|
677 |
// ---------------------------------------------------------------------------
|
|
678 |
// CDiagAudioPlugin::RestoreAudioOutputL()
|
|
679 |
// ---------------------------------------------------------------------------
|
|
680 |
//
|
|
681 |
void CDiagAudioPlugin::RestoreAudioOutputL()
|
|
682 |
{
|
|
683 |
LOGSTRING( "CDiagAudioPlugin::RestoreAudioOutputL IN" )
|
|
684 |
|
|
685 |
if ( iRouting )
|
|
686 |
{
|
|
687 |
iRouting->SetOutputL( iPrevAudioOutput );
|
|
688 |
}
|
|
689 |
|
|
690 |
LOGSTRING( "CDiagAudioPlugin::RestoreAudioOutputL OUT" )
|
|
691 |
}
|
|
692 |
|
|
693 |
// ---------------------------------------------------------------------------
|
|
694 |
// CDiagAudioPlugin::ClosePeriodic
|
|
695 |
// ---------------------------------------------------------------------------
|
|
696 |
//
|
|
697 |
void CDiagAudioPlugin::ClosePeriodic()
|
|
698 |
{
|
|
699 |
LOGSTRING( "CDiagAudioPlugin::ClosePeriodic IN" )
|
|
700 |
|
|
701 |
if ( iPeriodic )
|
|
702 |
{
|
|
703 |
delete iPeriodic;
|
|
704 |
iPeriodic = NULL;
|
|
705 |
}
|
|
706 |
|
|
707 |
LOGSTRING( "CDiagAudioPlugin::ClosePeriodic OUT" )
|
|
708 |
}
|
|
709 |
|
|
710 |
// ---------------------------------------------------------------------------
|
|
711 |
// CDiagAudioPlugin::CheckRecordFile
|
|
712 |
// ---------------------------------------------------------------------------
|
|
713 |
//
|
|
714 |
TBool CDiagAudioPlugin::CheckRecordFile()
|
|
715 |
{
|
|
716 |
LOGSTRING( "CDiagAudioPlugin::CheckRecordFile IN" )
|
|
717 |
|
|
718 |
TInt err;
|
|
719 |
TEntry entry;
|
|
720 |
TBool ret = EFalse;
|
|
721 |
|
|
722 |
err = CoeEnv().FsSession().Entry( iRecordFilePath, entry );
|
|
723 |
|
|
724 |
// Check if there was an error
|
|
725 |
if ( err != KErrNone)
|
|
726 |
{
|
|
727 |
ret = EFalse;
|
|
728 |
}
|
|
729 |
|
|
730 |
// Check File Size
|
|
731 |
else
|
|
732 |
{
|
|
733 |
ret = entry.iSize >= KMinFileSize;
|
|
734 |
}
|
|
735 |
|
|
736 |
LOGSTRING2( "CDiagAudioPlugin::CheckRecordFile OUT ret=%d", ret )
|
|
737 |
return ret;
|
|
738 |
}
|
|
739 |
|
|
740 |
// ---------------------------------------------------------------------------
|
|
741 |
// CDiagAuioPlugin::DeleteRecordFile
|
|
742 |
// ---------------------------------------------------------------------------
|
|
743 |
//
|
|
744 |
void CDiagAudioPlugin::DeleteRecordFile()
|
|
745 |
{
|
|
746 |
LOGSTRING( "CDiagAudioPlugin::DeleteRecordFile IN" )
|
|
747 |
|
|
748 |
CoeEnv().FsSession().Delete( iRecordFilePath );
|
|
749 |
|
|
750 |
LOGSTRING( "CDiagAudioPlugin::DeleteRecordFile OUT" )
|
|
751 |
}
|
|
752 |
|
|
753 |
// ---------------------------------------------------------------------------
|
|
754 |
// CDiagAudioPlugin::EnoughFreeSpace
|
|
755 |
// ---------------------------------------------------------------------------
|
|
756 |
//
|
|
757 |
TBool CDiagAudioPlugin::EnoughFreeSpace()
|
|
758 |
{
|
|
759 |
LOGSTRING( "CDiagAudioPlugin::EnoughFreeSpace IN" )
|
|
760 |
|
|
761 |
TInt64 RecordFileSize64;
|
|
762 |
TVolumeInfo vol_info;
|
|
763 |
TBool ret;
|
|
764 |
|
|
765 |
RecordFileSize64 = iRecordFileSize;
|
|
766 |
CoeEnv().FsSession().Volume( vol_info, EDriveC );
|
|
767 |
ret = vol_info.iFree >= RecordFileSize64;
|
|
768 |
|
|
769 |
LOGSTRING2( "CDiagAudioPlugin::EnoughFreeSpace OUT ret=%d", ret )
|
|
770 |
return ret;
|
|
771 |
}
|
|
772 |
|
|
773 |
// ---------------------------------------------------------------------------
|
|
774 |
// CDiagAudioPlugin::SetProgressDismissed
|
|
775 |
// ---------------------------------------------------------------------------
|
|
776 |
//
|
|
777 |
void CDiagAudioPlugin::SetProgressDismissed( TBool aDismissed )
|
|
778 |
{
|
|
779 |
LOGSTRING2( "CDiagAudioPlugin::SetProgressDismissed aDismissed=%d", aDismissed )
|
|
780 |
iProgressDismissed = aDismissed;
|
|
781 |
}
|
|
782 |
|
|
783 |
// ---------------------------------------------------------------------------
|
|
784 |
// CDiagAudioPlugin::ProgressDismissed
|
|
785 |
// ---------------------------------------------------------------------------
|
|
786 |
//
|
|
787 |
TBool CDiagAudioPlugin::ProgressDismissed() const
|
|
788 |
{
|
|
789 |
LOGSTRING2( "CDiagAudioPlugin::ProgressDismissed iProgressDismissed=%d", iProgressDismissed )
|
|
790 |
|
|
791 |
return iProgressDismissed;
|
|
792 |
}
|
|
793 |
|
|
794 |
// ---------------------------------------------------------------------------
|
|
795 |
// CDiagAudioPlugin::AskCancelExecutionL
|
|
796 |
// ---------------------------------------------------------------------------
|
|
797 |
//
|
|
798 |
TBool CDiagAudioPlugin::AskCancelExecutionL( TInt& aButtonId )
|
|
799 |
{
|
|
800 |
LOGSTRING( "CDiagAudioPlugin::AskCancelExecutionL() IN" )
|
|
801 |
|
|
802 |
CAknDialog* dialog;
|
|
803 |
TBool result;
|
|
804 |
|
|
805 |
|
|
806 |
// set softkey for single execution
|
|
807 |
if ( !SinglePluginExecution() )
|
|
808 |
{
|
|
809 |
// Create common dialog by invoking Engine
|
|
810 |
dialog = ExecutionParam().Engine().
|
|
811 |
CreateCommonDialogLC( EDiagCommonDialogConfirmCancelAll, NULL );
|
|
812 |
|
|
813 |
// Launch dialog and get result from it
|
|
814 |
result = RunWaitingDialogL( dialog, aButtonId );
|
|
815 |
}
|
|
816 |
else
|
|
817 |
{
|
|
818 |
//CompleteTestL( CDiagResultsDatabaseItem::ECancelled ); //commented for NTEI-7EZ9VQ
|
|
819 |
aButtonId = EAknSoftkeyYes;
|
|
820 |
return ETrue;
|
|
821 |
}
|
|
822 |
|
|
823 |
LOGSTRING3( "CDiagAudioPlugin::AskCancelExecutionL() OUT aButtonId=%d result=%d", aButtonId, result )
|
|
824 |
return result;
|
|
825 |
}
|
|
826 |
|
|
827 |
// ---------------------------------------------------------------------------
|
|
828 |
// CDiagAudioPlugin::ShowConfQueryL
|
|
829 |
// ---------------------------------------------------------------------------
|
|
830 |
//
|
|
831 |
TBool CDiagAudioPlugin::ShowConfQueryL( TInt aResourceId, TInt &aButtonId )
|
|
832 |
{
|
|
833 |
LOGSTRING( "CDiagAudioPlugin::ShowConfQueryL IN" )
|
|
834 |
CAknQueryDialog* dlg = NULL;
|
|
835 |
TBool result = EFalse;
|
|
836 |
|
|
837 |
// Create CAknQueryDialog instance
|
|
838 |
dlg = new ( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone );
|
|
839 |
|
|
840 |
dlg->PrepareLC( aResourceId );
|
|
841 |
|
|
842 |
// set softkey for single execution
|
|
843 |
/*
|
|
844 |
if ( SinglePluginExecution() )
|
|
845 |
{ */ // ADO & Platformization Changes
|
|
846 |
CEikButtonGroupContainer& cba = dlg->ButtonGroupContainer();
|
|
847 |
|
|
848 |
switch ( aResourceId )
|
|
849 |
{
|
|
850 |
case R_CONFQUERY_ASK_PLAY:
|
|
851 |
cba.SetCommandSetL( R_DIAG_AUDIO_SOFTKEYS_PLAY_CANCEL );
|
|
852 |
break;
|
|
853 |
default:
|
|
854 |
break;
|
|
855 |
}
|
|
856 |
/* } */
|
|
857 |
|
|
858 |
result = RunWaitingDialogL( dlg, aButtonId );
|
|
859 |
|
|
860 |
LOGSTRING3( "CDiagAudioPlugin::ShowConfQueryL() OUT aButtonId=%d result=%d", aButtonId, result )
|
|
861 |
return result;
|
|
862 |
}
|
|
863 |
|
|
864 |
// ---------------------------------------------------------------------------
|
|
865 |
// CDiagAudioPlugin::ShowMessageQueryL
|
|
866 |
// ---------------------------------------------------------------------------
|
|
867 |
//
|
|
868 |
TBool CDiagAudioPlugin::ShowMessageQueryL( TInt aResourceId, TInt &aButtonId )
|
|
869 |
{
|
|
870 |
LOGSTRING( "CDiagAudioPlugin::ShowMessageQueryL IN" )
|
|
871 |
CAknMessageQueryDialog* dlg = NULL;
|
|
872 |
TBool result = EFalse;
|
|
873 |
|
|
874 |
// Create CAknMessageQueryDialog instance
|
|
875 |
dlg = new ( ELeave ) CAknMessageQueryDialog();
|
|
876 |
|
|
877 |
dlg->PrepareLC( aResourceId );
|
|
878 |
|
|
879 |
CEikButtonGroupContainer& cba = dlg->ButtonGroupContainer();
|
|
880 |
|
|
881 |
switch ( aResourceId )
|
|
882 |
{
|
|
883 |
case R_MESSAGEQUERY_TITLE:
|
|
884 |
{
|
|
885 |
if ( SinglePluginExecution() )
|
|
886 |
{
|
|
887 |
cba.SetCommandSetL( R_DIAG_AUDIO_SOFTKEYS_OK_CANCEL );
|
|
888 |
}
|
|
889 |
else
|
|
890 |
{
|
|
891 |
cba.SetCommandSetL( R_DIAG_AUDIO_SOFTKEYS_OK_SKIP );
|
|
892 |
}
|
|
893 |
}
|
|
894 |
break;
|
|
895 |
case R_MESSAGEQUERY_ASK_RECORD:
|
|
896 |
cba.SetCommandSetL( R_DIAG_AUDIO_SOFTKEYS_START_CANCEL );
|
|
897 |
break;
|
|
898 |
default:
|
|
899 |
break;
|
|
900 |
}
|
|
901 |
|
|
902 |
result = RunWaitingDialogL( dlg, aButtonId );
|
|
903 |
|
|
904 |
LOGSTRING3( "CDiagAudioPlugin::ShowMessageQueryL() OUT aButtonId=%d result=%d", aButtonId, result )
|
|
905 |
return result;
|
|
906 |
}
|
|
907 |
|
|
908 |
// ---------------------------------------------------------------------------
|
|
909 |
// CDiagAudioPlugin::ShowProgressNoteL
|
|
910 |
// ---------------------------------------------------------------------------
|
|
911 |
//
|
|
912 |
void CDiagAudioPlugin::ShowProgressNoteL( TInt aResourceId, TInt aFinalValue )
|
|
913 |
{
|
|
914 |
LOGSTRING( "CDiagAudioPlugin::ShowProgressNoteL IN" )
|
|
915 |
|
|
916 |
//CAknProgressDialog* dlg;
|
|
917 |
|
|
918 |
if ( iProgressDialog )
|
|
919 |
{
|
|
920 |
delete iProgressDialog;
|
|
921 |
iProgressDialog = NULL;
|
|
922 |
}
|
|
923 |
|
|
924 |
SetProgressDismissed( EFalse );
|
|
925 |
|
|
926 |
//G iProgressDialog = dlg = new ( ELeave ) CAknProgressDialog(
|
|
927 |
iProgressDialog = new ( ELeave ) CAknProgressDialog(
|
|
928 |
reinterpret_cast <CEikDialog**> (&iProgressDialog),
|
|
929 |
ETrue
|
|
930 |
);
|
|
931 |
|
|
932 |
//G dlg->SetCallback( this );
|
|
933 |
iProgressDialog->SetCallback( this );
|
|
934 |
//G dlg->PrepareLC( aResourceId );
|
|
935 |
iProgressDialog->PrepareLC( aResourceId );
|
|
936 |
|
|
937 |
// set softkey for single execution
|
|
938 |
/* if ( SinglePluginExecution() )
|
|
939 |
{ */ // ADO & Platformization Changes
|
|
940 |
//G CEikButtonGroupContainer& cba = dlg->ButtonGroupContainer();
|
|
941 |
CEikButtonGroupContainer& cba = iProgressDialog->ButtonGroupContainer();
|
|
942 |
|
|
943 |
cba.SetCommandSetL( R_DIAG_AUDIO_SOFTKEYS_STOP_CANCEL );
|
|
944 |
/* } */ // ADO & Platformization Changes
|
|
945 |
|
|
946 |
//G iProgressInfo = dlg->GetProgressInfoL();
|
|
947 |
iProgressInfo = iProgressDialog->GetProgressInfoL();
|
|
948 |
iProgressInfo->SetFinalValue( aFinalValue * KFive );
|
|
949 |
|
|
950 |
//G dlg->RunLD();
|
|
951 |
iProgressDialog->RunLD();
|
|
952 |
|
|
953 |
// Set up Periodic
|
|
954 |
ClosePeriodic();
|
|
955 |
|
|
956 |
iPeriodic = CPeriodic::NewL( EPriorityNormal );
|
|
957 |
TCallBack callback( CallbackIncrementProgressNoteL, this );
|
|
958 |
iPeriodic->Start( 0, KProgressDelay, callback );
|
|
959 |
|
|
960 |
LOGSTRING( "CDiagAudioPlugin::ShowProgressNoteL OUT" )
|
|
961 |
}
|
|
962 |
|
|
963 |
// ---------------------------------------------------------------------------
|
|
964 |
// CDiagAudioPlugin::CallbackIncrementProgressNoteL
|
|
965 |
// ---------------------------------------------------------------------------
|
|
966 |
//
|
|
967 |
TInt CDiagAudioPlugin::CallbackIncrementProgressNoteL( TAny* aThis )
|
|
968 |
{
|
|
969 |
TInt err = KErrNone;
|
|
970 |
CDiagAudioPlugin* myThis = (CDiagAudioPlugin *)aThis;
|
|
971 |
|
|
972 |
TRAP( err, myThis->UpdateProgressNoteL() );
|
|
973 |
if ( err != KErrNone )
|
|
974 |
{
|
|
975 |
LOGSTRING( "CDiagAudioPlugin::CallbackIncrementProgressNoteL:User::Panic() on UpdateProgressNoteL()" )
|
|
976 |
User::Panic( KDiagAudioPluginCategory, err );
|
|
977 |
}
|
|
978 |
|
|
979 |
return KFinished;
|
|
980 |
}
|
|
981 |
|
|
982 |
// ---------------------------------------------------------------------------
|
|
983 |
// CDiagAudioPlugin::UpdateProgressNoteL
|
|
984 |
// ---------------------------------------------------------------------------
|
|
985 |
//
|
|
986 |
TInt CDiagAudioPlugin::UpdateProgressNoteL()
|
|
987 |
{
|
|
988 |
TTime intervalTime;
|
|
989 |
TTime currentTime;
|
|
990 |
|
|
991 |
// Prevent from Screen Saver
|
|
992 |
User::ResetInactivityTime();
|
|
993 |
|
|
994 |
if ( iProgressDialog )
|
|
995 |
{
|
|
996 |
iProgressInfo->IncrementAndDraw(1);
|
|
997 |
|
|
998 |
if ( (iFinalValue * KFive) <= iProgressInfo->CurrentValue() )
|
|
999 |
{
|
|
1000 |
if ( ProgressDismissed() == EFalse )
|
|
1001 |
{
|
|
1002 |
iProgressDialog->ProcessFinishedL();
|
|
1003 |
}
|
|
1004 |
|
|
1005 |
return KProgressFinished;
|
|
1006 |
}
|
|
1007 |
}
|
|
1008 |
|
|
1009 |
return KProgressNotFinished;
|
|
1010 |
}
|
|
1011 |
|
|
1012 |
// ---------------------------------------------------------------------------
|
|
1013 |
// From MDiagPlugin
|
|
1014 |
// CDiagAudioPlugin::IsVisible()
|
|
1015 |
// ---------------------------------------------------------------------------
|
|
1016 |
TBool CDiagAudioPlugin::IsVisible() const
|
|
1017 |
{
|
|
1018 |
return ETrue;
|
|
1019 |
}
|
|
1020 |
|
|
1021 |
// ---------------------------------------------------------------------------
|
|
1022 |
// From MDiagTestPlugin
|
|
1023 |
// CDiagAudioPlugin::RunMode()
|
|
1024 |
// ---------------------------------------------------------------------------
|
|
1025 |
MDiagTestPlugin::TRunMode CDiagAudioPlugin::RunMode() const
|
|
1026 |
{
|
|
1027 |
return EInteractiveDialog;
|
|
1028 |
}
|
|
1029 |
|
|
1030 |
// ---------------------------------------------------------------------------
|
|
1031 |
// From MDiagTestPlugin
|
|
1032 |
// CDiagAudioPlugin::TotalSteps()
|
|
1033 |
// ---------------------------------------------------------------------------
|
|
1034 |
TUint CDiagAudioPlugin::TotalSteps() const
|
|
1035 |
{
|
|
1036 |
return EAudioPluginTotalSteps;
|
|
1037 |
}
|
|
1038 |
|
|
1039 |
// ---------------------------------------------------------------------------
|
|
1040 |
// From MDiagPlugin
|
|
1041 |
// CDiagAudioPlugin::GetPluginNameL
|
|
1042 |
// ---------------------------------------------------------------------------
|
|
1043 |
HBufC* CDiagAudioPlugin::GetPluginNameL( TNameLayoutType aLayoutType ) const
|
|
1044 |
{
|
|
1045 |
switch ( aLayoutType )
|
|
1046 |
{
|
|
1047 |
case ENameLayoutHeadingPane:
|
|
1048 |
return StringLoader::LoadL( R_DIAG_AUDIO_PLUGIN_HEADING_PANE );
|
|
1049 |
|
|
1050 |
case ENameLayoutPopupInfoPane:
|
|
1051 |
return StringLoader::LoadL( R_DIAG_AUDIO_PLUGIN_POPUP_INFO_LIST_PANE );
|
|
1052 |
|
|
1053 |
case ENameLayoutTitlePane:
|
|
1054 |
return StringLoader::LoadL( R_DIAG_AUDIO_PLUGIN_TITLE_PANE );
|
|
1055 |
|
|
1056 |
case ENameLayoutListSingleGraphic:
|
|
1057 |
return StringLoader::LoadL( R_DIAG_AUDIO_PLUGIN_LIST_SINGLE_GRAPHIC_PANE );
|
|
1058 |
|
|
1059 |
case ENameLayoutListSingle:
|
|
1060 |
return StringLoader::LoadL( R_DIAG_AUDIO_PLUGIN_LIST_SINGLE_GRAPHIC_HEADING_PANE );
|
|
1061 |
|
|
1062 |
default:
|
|
1063 |
LOGSTRING2( "CDiagAudioPlugin::GetPluginNameL: "
|
|
1064 |
L"ERROR: Unsupported layout type %d", aLayoutType )
|
|
1065 |
__ASSERT_DEBUG( 0, User::Invariant() );
|
|
1066 |
return StringLoader::LoadL ( R_DIAG_AUDIO_PLUGIN_LIST_SINGLE_GRAPHIC_HEADING_PANE );
|
|
1067 |
}
|
|
1068 |
}
|
|
1069 |
|
|
1070 |
// ---------------------------------------------------------------------------
|
|
1071 |
// From MDiagPlugin
|
|
1072 |
// CDiagAudioPlugin::Uid
|
|
1073 |
// ---------------------------------------------------------------------------
|
|
1074 |
TUid CDiagAudioPlugin::Uid() const
|
|
1075 |
{
|
|
1076 |
return KDiagAudioPluginUid;
|
|
1077 |
}
|
|
1078 |
|
|
1079 |
// ---------------------------------------------------------------------------
|
|
1080 |
// From CDiagTestPluginBase
|
|
1081 |
// CDiagAudioPlugin::InitializeL()
|
|
1082 |
// ---------------------------------------------------------------------------
|
|
1083 |
void CDiagAudioPlugin::TestSessionBeginL(
|
|
1084 |
MDiagEngineCommon& /*aEngine*/,
|
|
1085 |
TBool /*aSkipDependencyCheck*/,
|
|
1086 |
TAny* /*aCustomParams*/)
|
|
1087 |
{
|
|
1088 |
LOGSTRING( "CDiagAudioPlugin::TestSessionBeginL:: Deleting record file..." )
|
|
1089 |
DeleteRecordFile();
|
|
1090 |
}
|
|
1091 |
|
|
1092 |
// ---------------------------------------------------------------------------
|
|
1093 |
// From CDiagTestPluginBase
|
|
1094 |
// CDiagAudioPlugin::CleanupL()
|
|
1095 |
// ---------------------------------------------------------------------------
|
|
1096 |
void CDiagAudioPlugin::TestSessionEndL(
|
|
1097 |
MDiagEngineCommon& /*aEngine*/,
|
|
1098 |
TBool /*aSkipDependencyCheck*/,
|
|
1099 |
TAny* /*aCustomParams*/)
|
|
1100 |
{
|
|
1101 |
LOGSTRING( "CDiagAudioPlugin::TestSessionEndL:: Deleting record file..." )
|
|
1102 |
DeleteRecordFile();
|
|
1103 |
}
|
|
1104 |
|
|
1105 |
// ---------------------------------------------------------------------------
|
|
1106 |
// From CDiagTestPluginBase
|
|
1107 |
// CDiagAudioPlugin::DoRunTestL()
|
|
1108 |
// ---------------------------------------------------------------------------
|
|
1109 |
void CDiagAudioPlugin::DoRunTestL()
|
|
1110 |
{
|
|
1111 |
LOGSTRING( "CDiagAudioPlugin::DoRunTest() IN" )
|
|
1112 |
|
|
1113 |
// Framework should never call DoRunTestL() before previous test
|
|
1114 |
ASSERT_ALWAYS( iRecorder == NULL );
|
|
1115 |
ASSERT_ALWAYS( iAudioPlayer == NULL );
|
|
1116 |
ASSERT_ALWAYS( iRouting == NULL );
|
|
1117 |
|
|
1118 |
iSessionValid = ETrue;
|
|
1119 |
|
|
1120 |
// Create Recorder
|
|
1121 |
iRecorder = CMdaAudioRecorderUtility::NewL(
|
|
1122 |
*this,
|
|
1123 |
NULL,
|
|
1124 |
KAudioPriorityRecording,
|
|
1125 |
TMdaPriorityPreference( KAudioPrefRealOneLocalPlayback )
|
|
1126 |
);
|
|
1127 |
|
|
1128 |
// Create Audio Player
|
|
1129 |
iAudioPlayer = CMdaAudioPlayerUtility::NewL( *this );
|
|
1130 |
|
|
1131 |
// Create Audio Routing
|
|
1132 |
iRouting = CTelephonyAudioRouting::NewL( *this );
|
|
1133 |
|
|
1134 |
// Check it has been recorded
|
|
1135 |
if ( CheckRecordFile() == EFalse )
|
|
1136 |
{
|
|
1137 |
LOGSTRING( "CDiagAudioPlugin::DoRunTest() Record file does not exist. StartRecordL()" )
|
|
1138 |
StartRecordL();
|
|
1139 |
}
|
|
1140 |
else
|
|
1141 |
{
|
|
1142 |
LOGSTRING( "CDiagAudioPlugin::DoRunTest() Record file exists. StartPlayL()" )
|
|
1143 |
StartPlayL();
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
LOGSTRING( "CDiagAudioPlugin::DoRunTest() OUT" )
|
|
1147 |
}
|
|
1148 |
|
|
1149 |
// ---------------------------------------------------------------------------
|
|
1150 |
// CDiagAudioPlugin::DoStopAndCleanupL
|
|
1151 |
// ---------------------------------------------------------------------------
|
|
1152 |
//
|
|
1153 |
void CDiagAudioPlugin::DoStopAndCleanupL()
|
|
1154 |
{
|
|
1155 |
LOGSTRING( "CDiagAudioPlugin::DoStopAndCleanupL IN" )
|
|
1156 |
// All memory and resource allocated during test execution should be
|
|
1157 |
// cleaned up here.
|
|
1158 |
|
|
1159 |
// Set Session
|
|
1160 |
iSessionValid = EFalse;
|
|
1161 |
|
|
1162 |
// Close Recorder
|
|
1163 |
if ( iRecorder )
|
|
1164 |
{
|
|
1165 |
LOGSTRING( "CDiagAudioPlugin::DoStopAndCleanupL: Stop & Close AudioPlayer" )
|
|
1166 |
iRecorder->Stop();
|
|
1167 |
iRecorder->Close();
|
|
1168 |
}
|
|
1169 |
|
|
1170 |
// Close Audio
|
|
1171 |
if ( iAudioPlayer )
|
|
1172 |
{
|
|
1173 |
LOGSTRING( "CDiagAudioPlugin::DoStopAndCleanupL: Stop & Close AudioPlayer" )
|
|
1174 |
iAudioPlayer->Stop();
|
|
1175 |
iAudioPlayer->Close();
|
|
1176 |
}
|
|
1177 |
|
|
1178 |
// Restore AudioOutput
|
|
1179 |
RestoreAudioOutputL();
|
|
1180 |
|
|
1181 |
if ( ResultsDbItemBuilder().TestResult() == CDiagResultsDatabaseItem::ESuccess )
|
|
1182 |
{
|
|
1183 |
// Test was successful. Do not delete the temporary file.
|
|
1184 |
LOGSTRING( "CDiagAudioPlugin::DoStopAndCleanupL: Keep file for next test." )
|
|
1185 |
}
|
|
1186 |
else
|
|
1187 |
{
|
|
1188 |
// test was not successful. Delete recorded file.
|
|
1189 |
LOGSTRING( "CDiagAudioPlugin::DoStopAndCleanupL:DeleteRecordFile()" )
|
|
1190 |
DeleteRecordFile();
|
|
1191 |
}
|
|
1192 |
|
|
1193 |
if ( iAudioState == CMdaAudioRecorderUtility::EPlaying )
|
|
1194 |
{
|
|
1195 |
LOGSTRING( "CDiagAudioPlugin::DoStopAndCleanupL:RestoreAudioOutputL" )
|
|
1196 |
TRAP_IGNORE( RestoreAudioOutputL() );
|
|
1197 |
}
|
|
1198 |
|
|
1199 |
// Call Engine to Dismiss Any Dialog
|
|
1200 |
DismissWaitingDialog();
|
|
1201 |
|
|
1202 |
// Close which can be recovered by running doRunTestL()
|
|
1203 |
ClosePeriodic();
|
|
1204 |
|
|
1205 |
// Clean up resources allocated during object creation.
|
|
1206 |
delete iRecorder;
|
|
1207 |
iRecorder = NULL;
|
|
1208 |
|
|
1209 |
delete iAudioPlayer;
|
|
1210 |
iAudioPlayer = NULL;
|
|
1211 |
|
|
1212 |
delete iRouting;
|
|
1213 |
iRouting = NULL;
|
|
1214 |
|
|
1215 |
// Cleanup Progress Dialog
|
|
1216 |
LOGSTRING( "Cleanup Progress Dialog" )
|
|
1217 |
if ( iProgressDialog )
|
|
1218 |
{
|
|
1219 |
delete iProgressDialog;
|
|
1220 |
iProgressDialog = NULL;
|
|
1221 |
}
|
|
1222 |
|
|
1223 |
SetProgressDismissed( ETrue );
|
|
1224 |
|
|
1225 |
LOGSTRING( "CDiagAudioPlugin::DoStopAndCleanupL OUT" )
|
|
1226 |
}
|
|
1227 |
|
|
1228 |
// ---------------------------------------------------------------------------
|
|
1229 |
// From CActive
|
|
1230 |
// CDiagAudioPlugin::RunL
|
|
1231 |
// ---------------------------------------------------------------------------
|
|
1232 |
void CDiagAudioPlugin::RunL()
|
|
1233 |
{
|
|
1234 |
switch(iState)
|
|
1235 |
{
|
|
1236 |
case EStateCancelled:
|
|
1237 |
CompleteTestL( CDiagResultsDatabaseItem::ESkipped );
|
|
1238 |
return;
|
|
1239 |
case EStateRecorded:
|
|
1240 |
AfterRecordL();
|
|
1241 |
break;
|
|
1242 |
case EStatePlayed:
|
|
1243 |
AfterPlayL();
|
|
1244 |
break;
|
|
1245 |
}
|
|
1246 |
}
|
|
1247 |
|
|
1248 |
// ---------------------------------------------------------------------------
|
|
1249 |
// CDiagAudioPlugin::RunError
|
|
1250 |
// ---------------------------------------------------------------------------
|
|
1251 |
//
|
|
1252 |
TInt CDiagAudioPlugin::RunError( TInt aError )
|
|
1253 |
{
|
|
1254 |
LOGSTRING2( "CDiagAudioPlugin::RunError( %d )", aError )
|
|
1255 |
return KErrNone;
|
|
1256 |
}
|
|
1257 |
|
|
1258 |
// ---------------------------------------------------------------------------
|
|
1259 |
// From CActive
|
|
1260 |
// CDiagAudioPlugin::DoCancel
|
|
1261 |
// ---------------------------------------------------------------------------
|
|
1262 |
void CDiagAudioPlugin::DoCancel()
|
|
1263 |
{
|
|
1264 |
// Stop active request. This class does not use Async request using iStatus.
|
|
1265 |
}
|
|
1266 |
|
|
1267 |
// ---------------------------------------------------------------------------
|
|
1268 |
// CDiagAudioPlugin::DialogDismissedL
|
|
1269 |
// ---------------------------------------------------------------------------
|
|
1270 |
//
|
|
1271 |
void CDiagAudioPlugin::DialogDismissedL( TInt aButtonId )
|
|
1272 |
{
|
|
1273 |
LOGSTRING2( "CDiagAudioPlugin::DialogDismissedL: aButtonId = %d", aButtonId )
|
|
1274 |
|
|
1275 |
TInt prevState;
|
|
1276 |
|
|
1277 |
SetProgressDismissed( ETrue );
|
|
1278 |
|
|
1279 |
// Restore Audio Output in case of Playing
|
|
1280 |
if ( iAudioState == CMdaAudioRecorderUtility::EPlaying )
|
|
1281 |
{
|
|
1282 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL: Calling RestoreAudioOutputL" )
|
|
1283 |
RestoreAudioOutputL();
|
|
1284 |
}
|
|
1285 |
|
|
1286 |
// Stop Recording / Playing
|
|
1287 |
if ( iAudioState == CMdaAudioRecorderUtility::ERecording )
|
|
1288 |
{
|
|
1289 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: Stop. Record" )
|
|
1290 |
if ( iRecorder )
|
|
1291 |
{
|
|
1292 |
iRecorder->Stop();
|
|
1293 |
iRecorder->Close();
|
|
1294 |
}
|
|
1295 |
}
|
|
1296 |
else if ( iAudioState == CMdaAudioRecorderUtility::EPlaying )
|
|
1297 |
{
|
|
1298 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: Stop. Play" )
|
|
1299 |
if ( iAudioPlayer )
|
|
1300 |
{
|
|
1301 |
iAudioPlayer->Stop();
|
|
1302 |
iAudioPlayer->Close();
|
|
1303 |
}
|
|
1304 |
}
|
|
1305 |
|
|
1306 |
// If button has not pressed
|
|
1307 |
if ( ( aButtonId != ECBACmdSkip ) &&
|
|
1308 |
( aButtonId != ECBACmdCancel ) &&
|
|
1309 |
( aButtonId != EEikBidCancel ) && // for NTEI-7EZ9VQ
|
|
1310 |
( aButtonId != EAknSoftkeyOk ) &&
|
|
1311 |
( aButtonId != EAknSoftkeyDone) )
|
|
1312 |
{
|
|
1313 |
LOGSTRING2( "CDiagAudioPlugin::DialogDismissedL: Button not pressed. aButtonId = %d", aButtonId )
|
|
1314 |
return;
|
|
1315 |
}
|
|
1316 |
|
|
1317 |
// Skip
|
|
1318 |
if ( aButtonId == ECBACmdSkip )
|
|
1319 |
{
|
|
1320 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: aButtonId == ECBACmdSkip" )
|
|
1321 |
CompleteTestL( CDiagResultsDatabaseItem::ESkipped );
|
|
1322 |
return;
|
|
1323 |
}
|
|
1324 |
|
|
1325 |
// Cancel
|
|
1326 |
else if ( aButtonId == ECBACmdCancel || aButtonId == EEikBidCancel) // for NTEI-7EZ9VQ
|
|
1327 |
{
|
|
1328 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: aButtonId == ECBACmdCancel" )
|
|
1329 |
|
|
1330 |
prevState = iAudioState;
|
|
1331 |
iAudioState = CMdaAudioRecorderUtility::EOpen;
|
|
1332 |
|
|
1333 |
TInt cancelButtonId;
|
|
1334 |
TBool cancelResult = EFalse;
|
|
1335 |
|
|
1336 |
cancelResult = AskCancelExecutionL( cancelButtonId );
|
|
1337 |
|
|
1338 |
if ( !cancelResult )
|
|
1339 |
{
|
|
1340 |
LOGSTRING( "CDiagAudioPlugin::StartPlayL - !iSessionValid 6" )
|
|
1341 |
return;
|
|
1342 |
}
|
|
1343 |
|
|
1344 |
switch ( cancelButtonId ) // for NTEI-7EZ9VQ
|
|
1345 |
{
|
|
1346 |
case EAknSoftkeyYes:
|
|
1347 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: EAknSoftkeyYes return NOW!!" )
|
|
1348 |
SetAudioEvent(EStateCancelled);
|
|
1349 |
return;
|
|
1350 |
|
|
1351 |
default:
|
|
1352 |
if ( prevState == CMdaAudioRecorderUtility::ERecording )
|
|
1353 |
{
|
|
1354 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: Start RecordL" )
|
|
1355 |
RecordL();
|
|
1356 |
}
|
|
1357 |
else if ( prevState == CMdaAudioRecorderUtility::EPlaying )
|
|
1358 |
{
|
|
1359 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: Start PlayL" )
|
|
1360 |
PlayL();
|
|
1361 |
}
|
|
1362 |
break;
|
|
1363 |
}
|
|
1364 |
return;
|
|
1365 |
}
|
|
1366 |
|
|
1367 |
// Stop
|
|
1368 |
else
|
|
1369 |
{
|
|
1370 |
LOGSTRING2( "CDiagAudioPlugin::DialogDismissedL: AudioState = %d", iAudioState )
|
|
1371 |
if ( iAudioState == CMdaAudioRecorderUtility::ERecording )
|
|
1372 |
{
|
|
1373 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: Stop. Record" )
|
|
1374 |
if ( iRecorder && iState == EStateUnknown)
|
|
1375 |
{
|
|
1376 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: Stop. Call AfterRecordL()" )
|
|
1377 |
SetAudioEvent(EStateRecorded);
|
|
1378 |
}
|
|
1379 |
}
|
|
1380 |
else if ( iAudioState == CMdaAudioRecorderUtility::EPlaying )
|
|
1381 |
{
|
|
1382 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: Stop. Play" )
|
|
1383 |
if ( iAudioPlayer && iState == EStateRecorded)
|
|
1384 |
{
|
|
1385 |
LOGSTRING( "CDiagAudioPlugin::DialogDismissedL:: Stop. Call AfterPlayL()" )
|
|
1386 |
// Stop playback/recording
|
|
1387 |
SetAudioEvent(EStatePlayed);
|
|
1388 |
}
|
|
1389 |
}
|
|
1390 |
}
|
|
1391 |
}
|
|
1392 |
|
|
1393 |
|
|
1394 |
void CDiagAudioPlugin::SetAudioEvent(TState aState)
|
|
1395 |
{
|
|
1396 |
iState = aState;
|
|
1397 |
SetActive();
|
|
1398 |
TRequestStatus* status = &iStatus;
|
|
1399 |
User::RequestComplete(status, KErrNone);
|
|
1400 |
}
|
|
1401 |
|
|
1402 |
// ---------------------------------------------------------------------------
|
|
1403 |
// CDiagAudioPlugin::MoscoStateChangeEvent
|
|
1404 |
// ---------------------------------------------------------------------------
|
|
1405 |
//
|
|
1406 |
void CDiagAudioPlugin::MoscoStateChangeEvent(
|
|
1407 |
CBase* /*aObject*/,
|
|
1408 |
TInt aPreviousState,
|
|
1409 |
TInt aCurrentState,
|
|
1410 |
TInt aErrorCode
|
|
1411 |
)
|
|
1412 |
{
|
|
1413 |
TInt err = KErrNone;
|
|
1414 |
|
|
1415 |
LOGSTRING4( "CDiagAudioPlugin::MoscoStateChangeEvent:IN (%d -> %d, %d )", aPreviousState, aCurrentState, aErrorCode )
|
|
1416 |
|
|
1417 |
// 1. Record reaches to the end of file
|
|
1418 |
if ( aErrorCode == KErrEof )
|
|
1419 |
{
|
|
1420 |
iAudioState = CMdaAudioRecorderUtility::EOpen;
|
|
1421 |
iState = EStateRecorded;
|
|
1422 |
TRAP( err, AfterRecordL() );
|
|
1423 |
}
|
|
1424 |
|
|
1425 |
// 2. Start - Recording
|
|
1426 |
else if ( ( aPreviousState == CMdaAudioRecorderUtility::ENotReady) &&
|
|
1427 |
( aCurrentState == CMdaAudioRecorderUtility::EOpen ) )
|
|
1428 |
{
|
|
1429 |
LOGSTRING( "CDiagAudioPlugin::MoscoStateChangeEvent: Leave on RecordingL()" )
|
|
1430 |
TRAP( err, RecordingL() );
|
|
1431 |
LOGSTRING2( "CDiagAudioPlugin::MoscoStateChangeEvent: RecordingL() err = %d", err )
|
|
1432 |
}
|
|
1433 |
|
|
1434 |
// 3. Stopped - Recording
|
|
1435 |
else if ( ( aPreviousState == CMdaAudioRecorderUtility::ERecording ) &&
|
|
1436 |
( aCurrentState == CMdaAudioRecorderUtility::EOpen )
|
|
1437 |
)
|
|
1438 |
{
|
|
1439 |
LOGSTRING( "CDiagAudioPlugin::MoscoStateChangeEvent: Leave on AfterRecordL()" )
|
|
1440 |
iState = EStateRecorded;
|
|
1441 |
TRAP( err, AfterRecordL() );
|
|
1442 |
LOGSTRING2( "CDiagAudioPlugin::MoscoStateChangeEvent: AfterRecordL() err = %d", err )
|
|
1443 |
}
|
|
1444 |
|
|
1445 |
// Handle for Trap
|
|
1446 |
if (err != KErrNone)
|
|
1447 |
{
|
|
1448 |
LOGSTRING2( "CDiagAudioPlugin::MoscoStateChangeEvent:Call CompleteTestL with error = %d", err )
|
|
1449 |
TRAP( err, CompleteTestL(CDiagResultsDatabaseItem::EFailed) );
|
|
1450 |
if ( err != KErrNone )
|
|
1451 |
{
|
|
1452 |
LOGSTRING( "CDiagAudioPlugin::MoscoStateChangeEvent:User::Panic()" )
|
|
1453 |
User::Panic( KDiagAudioPluginCategory, err );
|
|
1454 |
}
|
|
1455 |
return; // Fail Test
|
|
1456 |
}
|
|
1457 |
LOGSTRING( "CDiagAudioPlugin::MoscoStateChangeEvent OUT" )
|
|
1458 |
}
|
|
1459 |
|
|
1460 |
// ---------------------------------------------------------------------------
|
|
1461 |
// CDiagAudioPlugin::MapcInitComplete
|
|
1462 |
// ---------------------------------------------------------------------------
|
|
1463 |
//
|
|
1464 |
void CDiagAudioPlugin::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration)
|
|
1465 |
{
|
|
1466 |
LOGSTRING2( "CDiagAudioPlugin::MapcInitComplete: aError=%d", aError )
|
|
1467 |
|
|
1468 |
// Set Duration
|
|
1469 |
iPositionMicroSec = 0;
|
|
1470 |
iMaxDurationMicroSec = aDuration;
|
|
1471 |
|
|
1472 |
// Set Priority of AudioPlayer
|
|
1473 |
iAudioPlayer->SetPriority(
|
|
1474 |
KAudioPriorityAlarm + 1,
|
|
1475 |
TMdaPriorityPreference( KAudioPrefVoiceRec )
|
|
1476 |
);
|
|
1477 |
|
|
1478 |
TInt err = KErrNone;
|
|
1479 |
// Set Audio Output
|
|
1480 |
TRAP(err,iRouting->SetOutputL( iOutput ));
|
|
1481 |
if(err != KErrNone) // Added TRAP for removing code scanner warning
|
|
1482 |
{
|
|
1483 |
LOGSTRING2( "CDiagAudioPlugin::MapcInitComplete:Call CompleteTestL with error = %d", err )
|
|
1484 |
TRAP( err, CompleteTestL(CDiagResultsDatabaseItem::EFailed) );
|
|
1485 |
|
|
1486 |
if ( err != KErrNone )
|
|
1487 |
{
|
|
1488 |
LOGSTRING( "CDiagAudioPlugin::MapcInitComplete:User::Panic()" )
|
|
1489 |
User::Panic( KDiagAudioPluginCategory, err );
|
|
1490 |
}
|
|
1491 |
return;
|
|
1492 |
}
|
|
1493 |
|
|
1494 |
// Start Playing
|
|
1495 |
TRAP( err, PlayingL() );
|
|
1496 |
|
|
1497 |
// Handle for Trap
|
|
1498 |
if ( err != KErrNone )
|
|
1499 |
{
|
|
1500 |
LOGSTRING2( "CDiagAudioPlugin::MapcInitComplete:Call CompleteTestL with error = %d", err )
|
|
1501 |
TRAP( err, CompleteTestL(CDiagResultsDatabaseItem::EFailed) );
|
|
1502 |
|
|
1503 |
if ( err != KErrNone )
|
|
1504 |
{
|
|
1505 |
LOGSTRING( "CDiagAudioPlugin::MapcInitComplete:User::Panic()" )
|
|
1506 |
User::Panic( KDiagAudioPluginCategory, err );
|
|
1507 |
}
|
|
1508 |
|
|
1509 |
return; // Fail Test
|
|
1510 |
}
|
|
1511 |
}
|
|
1512 |
|
|
1513 |
// ---------------------------------------------------------------------------
|
|
1514 |
// CDiagAudioPlugin::MapcPlayComplete
|
|
1515 |
// ---------------------------------------------------------------------------
|
|
1516 |
//
|
|
1517 |
void CDiagAudioPlugin::MapcPlayComplete(TInt aError)
|
|
1518 |
{
|
|
1519 |
TInt err = KErrNone;
|
|
1520 |
LOGSTRING2( "CDiagAudioPlugin::MapcPlayComplete: aError=%d", aError )
|
|
1521 |
|
|
1522 |
if ( aError == KErrNone)
|
|
1523 |
{
|
|
1524 |
LOGSTRING( "CDiagAudioPlugin::MapcPlayComplete KErrNone" )
|
|
1525 |
TRAP(err,RestoreAudioOutputL());
|
|
1526 |
|
|
1527 |
if ( err != KErrNone )
|
|
1528 |
{
|
|
1529 |
LOGSTRING2( "CDiagAudioPlugin::MapcInitComplete:Call CompleteTestL with error = %d", err )
|
|
1530 |
TRAP( err, CompleteTestL(CDiagResultsDatabaseItem::EFailed) );
|
|
1531 |
|
|
1532 |
if ( err != KErrNone )
|
|
1533 |
{
|
|
1534 |
LOGSTRING( "CDiagAudioPlugin::MapcInitComplete:User::Panic()" )
|
|
1535 |
User::Panic( KDiagAudioPluginCategory, err );
|
|
1536 |
}
|
|
1537 |
|
|
1538 |
return; // Fail Test
|
|
1539 |
}
|
|
1540 |
|
|
1541 |
if(iState == EStateRecorded)
|
|
1542 |
{
|
|
1543 |
// Stop and Close Audio Player
|
|
1544 |
if ( iAudioPlayer )
|
|
1545 |
{
|
|
1546 |
iAudioPlayer->Stop();
|
|
1547 |
iAudioPlayer->Close();
|
|
1548 |
iState = EStatePlayed;
|
|
1549 |
}
|
|
1550 |
|
|
1551 |
TRAP(err,AfterPlayL());
|
|
1552 |
|
|
1553 |
if ( err != KErrNone )
|
|
1554 |
{
|
|
1555 |
LOGSTRING2( "CDiagAudioPlugin::MapcInitComplete:Call CompleteTestL with error = %d", err )
|
|
1556 |
TRAP( err, CompleteTestL(CDiagResultsDatabaseItem::EFailed) );
|
|
1557 |
|
|
1558 |
if ( err != KErrNone )
|
|
1559 |
{
|
|
1560 |
LOGSTRING( "CDiagAudioPlugin::MapcInitComplete:User::Panic()" )
|
|
1561 |
User::Panic( KDiagAudioPluginCategory, err );
|
|
1562 |
}
|
|
1563 |
|
|
1564 |
return; // Fail Test
|
|
1565 |
}
|
|
1566 |
|
|
1567 |
}
|
|
1568 |
return;
|
|
1569 |
}
|
|
1570 |
}
|
|
1571 |
|
|
1572 |
// ---------------------------------------------------------------------------
|
|
1573 |
// CDiagAudioPlugin::AvailableOutputsChanged
|
|
1574 |
// ---------------------------------------------------------------------------
|
|
1575 |
//
|
|
1576 |
void CDiagAudioPlugin::AvailableOutputsChanged( CTelephonyAudioRouting& /*aTelephonyAudioRouting */ )
|
|
1577 |
{
|
|
1578 |
LOGSTRING( "CDiagAudioPlugin::AvailableOutputsChanged" )
|
|
1579 |
}
|
|
1580 |
|
|
1581 |
// ---------------------------------------------------------------------------
|
|
1582 |
// CDiagAudioPlugin::OutputChanged
|
|
1583 |
// ---------------------------------------------------------------------------
|
|
1584 |
//
|
|
1585 |
void CDiagAudioPlugin::OutputChanged( CTelephonyAudioRouting& /* aTelephonyAudioRouting */)
|
|
1586 |
{
|
|
1587 |
LOGSTRING( "CDiagAudioPlugin::OutputChanged" )
|
|
1588 |
}
|
|
1589 |
|
|
1590 |
// ---------------------------------------------------------------------------
|
|
1591 |
// CDiagAudioPlugin::SetOutputComplete
|
|
1592 |
// ---------------------------------------------------------------------------
|
|
1593 |
//
|
|
1594 |
void CDiagAudioPlugin::SetOutputComplete(
|
|
1595 |
CTelephonyAudioRouting& /*aTelephonyAudioRouting */,
|
|
1596 |
TInt aError
|
|
1597 |
)
|
|
1598 |
{
|
|
1599 |
LOGSTRING2( "CDiagAudioPlugin::SetOutputComplete aError=%d", aError )
|
|
1600 |
}
|
|
1601 |
// End of File
|