0
|
1 |
// Copyright (c) 2007-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 |
#include <ecom/implementationproxy.h>
|
|
17 |
#include <ecom/ecom.h>
|
|
18 |
#include <f32file.h>
|
|
19 |
#include "errorconcealmenttestdevice.h"
|
|
20 |
#include "devsoundciutestdevices.hrh"
|
|
21 |
|
|
22 |
|
|
23 |
/*
|
|
24 |
CMMFErrorConcealment implementation
|
|
25 |
*/
|
|
26 |
CMMFErrorConcealment* CMMFErrorConcealment::NewL()
|
|
27 |
{
|
|
28 |
CMMFErrorConcealment* self = new(ELeave) CMMFErrorConcealment();
|
|
29 |
return self;
|
|
30 |
}
|
|
31 |
|
|
32 |
CMMFErrorConcealment::~CMMFErrorConcealment()
|
|
33 |
{
|
|
34 |
}
|
|
35 |
|
|
36 |
//Actual implementation of method ConcealErrorForNextBuffer
|
|
37 |
TInt CMMFErrorConcealment::ConcealErrorForNextBuffer()
|
|
38 |
{
|
|
39 |
return KErrNone;
|
|
40 |
}
|
|
41 |
|
|
42 |
//Actual implementation of method SetFrameMode
|
|
43 |
TInt CMMFErrorConcealment::SetFrameMode(TBool aFrameModeOn)
|
|
44 |
{
|
|
45 |
RFs fs;
|
|
46 |
RFile file;
|
|
47 |
TInt err = KErrNone;
|
|
48 |
|
|
49 |
if ( KErrNone != (err = fs.Connect()) )
|
|
50 |
{
|
|
51 |
return err;
|
|
52 |
}
|
|
53 |
|
|
54 |
// this file name will be use on the testStep to compare the stored value.
|
|
55 |
_LIT(KFileName, "c:\\temp\\errorConcealment.txt");
|
|
56 |
fs.MkDirAll(KFileName);
|
|
57 |
|
|
58 |
if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) )
|
|
59 |
{
|
|
60 |
return err;
|
|
61 |
}
|
|
62 |
|
|
63 |
TBuf8<1> data;
|
|
64 |
data.Format(_L8("%d"), aFrameModeOn);
|
|
65 |
|
|
66 |
file.Write(data);
|
|
67 |
file.Close();
|
|
68 |
fs.Close();
|
|
69 |
|
|
70 |
return err;
|
|
71 |
}
|
|
72 |
|
|
73 |
//Actual implementation of method FrameModeRqrdForEC
|
|
74 |
TInt CMMFErrorConcealment::FrameModeRqrdForEC(TBool& aFrameModeRqrd)
|
|
75 |
{
|
|
76 |
RFs fs;
|
|
77 |
RFile file;
|
|
78 |
TInt err = KErrNone;
|
|
79 |
|
|
80 |
if ( KErrNone != (err = fs.Connect()) )
|
|
81 |
{
|
|
82 |
return err;
|
|
83 |
}
|
|
84 |
|
|
85 |
// this file name will be use on the testStep to compare the stored value.
|
|
86 |
_LIT(KFileName, "c:\\temp\\errorConcealment.txt");
|
|
87 |
|
|
88 |
if ( KErrNone != (err = file.Open(fs, KFileName, EFileRead)) )
|
|
89 |
{
|
|
90 |
return err;
|
|
91 |
}
|
|
92 |
|
|
93 |
TBuf8<1> data;
|
|
94 |
file.Read(data);
|
|
95 |
file.Close();
|
|
96 |
|
|
97 |
fs.Delete(KFileName);
|
|
98 |
fs.Close();
|
|
99 |
|
|
100 |
TLex8 lex(data);
|
|
101 |
lex.Val(aFrameModeRqrd);
|
|
102 |
|
|
103 |
return err;
|
|
104 |
}
|
|
105 |
|
|
106 |
|
|
107 |
/*
|
|
108 |
CErrorConcealmentTestDevice implementation
|
|
109 |
*/
|
|
110 |
CMMFHwDevice* CErrorConcealmentTestDevice::NewL()
|
|
111 |
{
|
|
112 |
CErrorConcealmentTestDevice* self=new(ELeave) CErrorConcealmentTestDevice();
|
|
113 |
CleanupStack::PushL(self);
|
|
114 |
self->ConstructL();
|
|
115 |
CleanupStack::Pop(self);
|
|
116 |
return self;
|
|
117 |
}
|
|
118 |
|
|
119 |
CErrorConcealmentTestDevice::~CErrorConcealmentTestDevice()
|
|
120 |
{
|
|
121 |
delete iErrorConcealment;
|
|
122 |
}
|
|
123 |
|
|
124 |
CErrorConcealmentTestDevice::CErrorConcealmentTestDevice()
|
|
125 |
{
|
|
126 |
}
|
|
127 |
|
|
128 |
void CErrorConcealmentTestDevice::ConstructL()
|
|
129 |
{
|
|
130 |
}
|
|
131 |
|
|
132 |
TInt CErrorConcealmentTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
|
|
133 |
{
|
|
134 |
return 0;
|
|
135 |
}
|
|
136 |
|
|
137 |
TInt CErrorConcealmentTestDevice::Stop()
|
|
138 |
{
|
|
139 |
return 0;
|
|
140 |
}
|
|
141 |
|
|
142 |
TInt CErrorConcealmentTestDevice::Pause()
|
|
143 |
{
|
|
144 |
return 0;
|
|
145 |
}
|
|
146 |
|
|
147 |
TInt CErrorConcealmentTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
|
|
148 |
{
|
|
149 |
return 0;
|
|
150 |
}
|
|
151 |
|
|
152 |
TAny* CErrorConcealmentTestDevice::CustomInterface(TUid aInterfaceId)
|
|
153 |
{
|
|
154 |
// Just return something non-NULL to keep the
|
|
155 |
// DevSound initialisation process happy
|
|
156 |
TAny* ret = static_cast<TAny*>(this);
|
|
157 |
|
|
158 |
// Now for the CIs we want to test...
|
|
159 |
if (aInterfaceId == KUidErrorConcealmentIntfc)
|
|
160 |
{
|
|
161 |
if (!iErrorConcealment)
|
|
162 |
{
|
|
163 |
TRAPD(err, iErrorConcealment = CMMFErrorConcealment::NewL());
|
|
164 |
if (err == KErrNone && iErrorConcealment)
|
|
165 |
{
|
|
166 |
MMMFErrorConcealmentIntfc* ptr = this;
|
|
167 |
ret = static_cast<TAny*>(ptr);
|
|
168 |
}
|
|
169 |
else
|
|
170 |
{
|
|
171 |
ret = NULL;
|
|
172 |
}
|
|
173 |
}
|
|
174 |
}
|
|
175 |
|
|
176 |
return ret;
|
|
177 |
}
|
|
178 |
|
|
179 |
TInt CErrorConcealmentTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
|
|
180 |
{
|
|
181 |
return 0;
|
|
182 |
}
|
|
183 |
|
|
184 |
TInt CErrorConcealmentTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
|
|
185 |
{
|
|
186 |
return 0;
|
|
187 |
}
|
|
188 |
|
|
189 |
TInt CErrorConcealmentTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
|
|
190 |
{
|
|
191 |
return 0;
|
|
192 |
}
|
|
193 |
|
|
194 |
TInt CErrorConcealmentTestDevice::StopAndDeleteCodec()
|
|
195 |
{
|
|
196 |
return 0;
|
|
197 |
}
|
|
198 |
|
|
199 |
TInt CErrorConcealmentTestDevice::DeleteCodec()
|
|
200 |
{
|
|
201 |
return 0;
|
|
202 |
}
|
|
203 |
|
|
204 |
CMMFSwCodec& CErrorConcealmentTestDevice::Codec()
|
|
205 |
{
|
|
206 |
return *iCodec;
|
|
207 |
}
|
|
208 |
|
|
209 |
TInt CErrorConcealmentTestDevice::ConcealErrorForNextBuffer()
|
|
210 |
{
|
|
211 |
TInt result = KErrBadHandle;
|
|
212 |
|
|
213 |
if (iErrorConcealment)
|
|
214 |
{
|
|
215 |
result = iErrorConcealment->ConcealErrorForNextBuffer();
|
|
216 |
}
|
|
217 |
|
|
218 |
return result;
|
|
219 |
}
|
|
220 |
|
|
221 |
TInt CErrorConcealmentTestDevice::SetFrameMode(TBool aFrameModeOn)
|
|
222 |
{
|
|
223 |
TInt result = KErrBadHandle;
|
|
224 |
|
|
225 |
if (iErrorConcealment)
|
|
226 |
{
|
|
227 |
result = iErrorConcealment->SetFrameMode(aFrameModeOn);
|
|
228 |
}
|
|
229 |
|
|
230 |
return result;
|
|
231 |
}
|
|
232 |
|
|
233 |
TInt CErrorConcealmentTestDevice::FrameModeRqrdForEC(TBool& aFrameModeRqrd)
|
|
234 |
{
|
|
235 |
TInt result = KErrBadHandle;
|
|
236 |
|
|
237 |
if (iErrorConcealment)
|
|
238 |
{
|
|
239 |
result = iErrorConcealment->FrameModeRqrdForEC(aFrameModeRqrd);
|
|
240 |
}
|
|
241 |
|
|
242 |
return result;
|
|
243 |
}
|