0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
|
|
17 |
#include "TestStepCtrlSetRepeatsCustomCommands.h"
|
|
18 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
19 |
#include <mmf/common/mmfstandardcustomcommandsenums.h>
|
|
20 |
#include <mmf/common/mmfstandardcustomcommandsimpl.h>
|
|
21 |
#endif
|
|
22 |
|
|
23 |
|
|
24 |
CAsyncTestStepCtrlSetRepeatsCustomCommands::CAsyncTestStepCtrlSetRepeatsCustomCommands(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
|
|
25 |
{
|
|
26 |
iTestStepName=aTestName;
|
|
27 |
iSectName = aSectName;
|
|
28 |
iKeyName = aKeyName;
|
|
29 |
}
|
|
30 |
|
|
31 |
|
|
32 |
CAsyncTestStepCtrlSetRepeatsCustomCommands * CAsyncTestStepCtrlSetRepeatsCustomCommands::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
|
|
33 |
{
|
|
34 |
return new (ELeave) CAsyncTestStepCtrlSetRepeatsCustomCommands(aTestName, aSectName, aKeyName);
|
|
35 |
}
|
|
36 |
|
|
37 |
// from RAsyncTestStep
|
|
38 |
void CAsyncTestStepCtrlSetRepeatsCustomCommands::KickoffTestL()
|
|
39 |
{
|
|
40 |
INFO_PRINTF1(_L("This a test for Controller SetRepeat custom command "));
|
|
41 |
iPriority.iPriority = KDefaultPriority; // set the priority to some default value
|
|
42 |
iPriority.iPref = EMdaPriorityPreferenceQuality;
|
|
43 |
iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
|
|
44 |
|
|
45 |
//Prepare the TMMFFileConfig from filename to pass it to the AddDataSource
|
|
46 |
TPtrC fileName;
|
|
47 |
if(!GetStringFromConfig(iSectName, iKeyName, fileName))
|
|
48 |
{
|
|
49 |
INFO_PRINTF1(_L("GetStringFromConfig: Failed "));
|
|
50 |
StopTest(KErrGeneral, EFail);
|
|
51 |
return;
|
|
52 |
}
|
|
53 |
iFileConfig().iPath = fileName;
|
|
54 |
|
|
55 |
// Open the controller
|
|
56 |
INFO_PRINTF1(_L("Controller: Open"));
|
|
57 |
TInt errorCode = iController.Open(KMmfAudioControllerUid, iPriority);
|
|
58 |
if(errorCode)
|
|
59 |
{
|
|
60 |
INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode);
|
|
61 |
StopTest(errorCode, EFail);
|
|
62 |
User::Leave( errorCode );
|
|
63 |
}
|
|
64 |
// Start the event monitor
|
|
65 |
iControllerEventMonitor->Start();
|
|
66 |
|
|
67 |
// Add the DataSource
|
|
68 |
INFO_PRINTF1(_L("Controller: AddDataSource "));
|
|
69 |
errorCode = iController.AddDataSource(KUidMmfFileSource, iFileConfig);
|
|
70 |
if(errorCode)
|
|
71 |
{
|
|
72 |
INFO_PRINTF2(_L("AddDataSource failed with %d "), errorCode);
|
|
73 |
StopTest(errorCode, EFail);
|
|
74 |
User::Leave( errorCode );
|
|
75 |
}
|
|
76 |
// Add the DataSink
|
|
77 |
INFO_PRINTF1(_L("Controller: AddDataSink "));
|
|
78 |
errorCode = iController.AddDataSink(KUidMmfAudioOutput,KNullDesC8);
|
|
79 |
if(errorCode)
|
|
80 |
{
|
|
81 |
INFO_PRINTF2(_L("AddDataSink failed with %d "), errorCode);
|
|
82 |
StopTest(errorCode, EFail);
|
|
83 |
User::Leave( errorCode );
|
|
84 |
}
|
|
85 |
INFO_PRINTF1(_L("RMMFAudioPlayControllerSetRepeatsCustomCommands::SetRepeats"));
|
|
86 |
RMMFAudioPlayControllerSetRepeatsCustomCommands theCommander(iController);
|
|
87 |
errorCode = theCommander.SetRepeats(1, TTimeIntervalMicroSeconds(3000000) );
|
|
88 |
#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
|
|
89 |
if(errorCode == KErrNotSupported)
|
|
90 |
{//controller on old devsound does not support this custom command
|
|
91 |
INFO_PRINTF2(_L("SetRepeats is failed with %d on legacy devsound"), errorCode);
|
|
92 |
StopTest();
|
|
93 |
return;
|
|
94 |
}
|
|
95 |
else
|
|
96 |
{
|
|
97 |
INFO_PRINTF2(_L("SetRepeats is not failed with KErrNotSupported but failed with %d on legacy devsound"), errorCode);
|
|
98 |
StopTest(errorCode, EFail);
|
|
99 |
User::Leave(errorCode);
|
|
100 |
}
|
|
101 |
#else
|
|
102 |
if(errorCode)
|
|
103 |
{
|
|
104 |
INFO_PRINTF2(_L("SetRepeats is failed with %d "), errorCode);
|
|
105 |
StopTest(errorCode, EFail);
|
|
106 |
User::Leave( errorCode );
|
|
107 |
}
|
|
108 |
#endif
|
|
109 |
// Prime The Controller
|
|
110 |
INFO_PRINTF1(_L("Prime"));
|
|
111 |
errorCode = iController.Prime();
|
|
112 |
if(errorCode)
|
|
113 |
{
|
|
114 |
INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
|
|
115 |
StopTest(errorCode, EFail);
|
|
116 |
User::Leave( errorCode );
|
|
117 |
}
|
|
118 |
// Start Playing
|
|
119 |
INFO_PRINTF1(_L("Play"));
|
|
120 |
errorCode = iController.Play();
|
|
121 |
if(errorCode)
|
|
122 |
{
|
|
123 |
INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
|
|
124 |
StopTest(errorCode, EFail);
|
|
125 |
User::Leave( errorCode );
|
|
126 |
}
|
|
127 |
}
|
|
128 |
|
|
129 |
void CAsyncTestStepCtrlSetRepeatsCustomCommands::CloseTest()
|
|
130 |
{
|
|
131 |
iController.Stop();
|
|
132 |
iController.Reset();
|
|
133 |
iControllerEventMonitor->Cancel();
|
|
134 |
delete iControllerEventMonitor;
|
|
135 |
iController.Close();
|
|
136 |
}
|
|
137 |
|
|
138 |
|
|
139 |
/**
|
|
140 |
* This is from MMMFControllerEventMonitorObserver. CMMFControllerEventMonitor
|
|
141 |
* calls the method whenever it receives an event from PlayController. Basically
|
|
142 |
* checks for the Playcompletion event and passes the error back to the test step.
|
|
143 |
*/
|
|
144 |
void CAsyncTestStepCtrlSetRepeatsCustomCommands::HandleEvent(const TMMFEvent& aEvent)
|
|
145 |
{
|
|
146 |
if (aEvent.iEventType==KMMFEventCategoryPlaybackComplete)
|
|
147 |
{
|
|
148 |
if((aEvent.iErrorCode == KErrNone) || (aEvent.iErrorCode == KErrEof))
|
|
149 |
{
|
|
150 |
INFO_PRINTF2(_L("Playcompletion Error %d "), aEvent.iErrorCode);
|
|
151 |
StopTest();//Success
|
|
152 |
}
|
|
153 |
else
|
|
154 |
{
|
|
155 |
INFO_PRINTF2(_L("Playcompletion is failed with %d "), aEvent.iErrorCode);
|
|
156 |
StopTest(aEvent.iErrorCode, EFail);
|
|
157 |
}
|
|
158 |
}
|
|
159 |
else
|
|
160 |
{
|
|
161 |
INFO_PRINTF1(_L("Failed to receive Playcompletion Event "));
|
|
162 |
StopTest(KErrGeneral, EFail);
|
|
163 |
}
|
|
164 |
}
|