sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <f32file.h>
|
sl@0
|
17 |
#include <e32math.h>
|
sl@0
|
18 |
#include <s32mem.h>
|
sl@0
|
19 |
#include "MmfBtDevSoundProxy.h"
|
sl@0
|
20 |
#include "MmfBtDevSoundServerStart.h"
|
sl@0
|
21 |
#include "../../../inc/common/mmfBtBase.hrh"
|
sl@0
|
22 |
#include "MmfBtAudioClientServer.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
|
sl@0
|
25 |
EXPORT_C void RMMFDevSoundProxy::Close()
|
sl@0
|
26 |
{
|
sl@0
|
27 |
RMmfSessionBase::Close();
|
sl@0
|
28 |
delete iBuffer;
|
sl@0
|
29 |
delete iSeqName;
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
EXPORT_C TInt RMMFDevSoundProxy::Open()
|
sl@0
|
33 |
{
|
sl@0
|
34 |
TInt err = KErrNone;
|
sl@0
|
35 |
RMMFAudioServerProxy* audioServerProxy = NULL;
|
sl@0
|
36 |
HBufC* devSoundServerName = NULL;
|
sl@0
|
37 |
iBuffer = NULL;
|
sl@0
|
38 |
iSeqName = NULL;
|
sl@0
|
39 |
TRAP(err, iSeqName = HBufC::NewL(KMaxFixedSequenceNameLength));
|
sl@0
|
40 |
if(err)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
iSeqName = NULL;
|
sl@0
|
43 |
return err;
|
sl@0
|
44 |
}
|
sl@0
|
45 |
|
sl@0
|
46 |
TRAP(err, audioServerProxy = new (ELeave) RMMFAudioServerProxy());
|
sl@0
|
47 |
if(err != KErrNone)
|
sl@0
|
48 |
{
|
sl@0
|
49 |
delete iSeqName;
|
sl@0
|
50 |
iSeqName = NULL;
|
sl@0
|
51 |
return err;
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|
sl@0
|
54 |
err = audioServerProxy->Open();
|
sl@0
|
55 |
if(err != KErrNone)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
delete audioServerProxy;
|
sl@0
|
58 |
delete iSeqName;
|
sl@0
|
59 |
iSeqName = NULL;
|
sl@0
|
60 |
return err;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
|
sl@0
|
64 |
TRAP(err, devSoundServerName = audioServerProxy->GetDevSoundServerNameL());
|
sl@0
|
65 |
if(err)
|
sl@0
|
66 |
{
|
sl@0
|
67 |
audioServerProxy->Close();
|
sl@0
|
68 |
delete audioServerProxy;
|
sl@0
|
69 |
delete iSeqName;
|
sl@0
|
70 |
iSeqName = NULL;
|
sl@0
|
71 |
return err;
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
TPtr devSoundServerNamePtr = devSoundServerName->Des();
|
sl@0
|
75 |
|
sl@0
|
76 |
TInt retry=2;
|
sl@0
|
77 |
for (;;)
|
sl@0
|
78 |
{
|
sl@0
|
79 |
err = CreateSession(devSoundServerNamePtr, TVersion(KMMFDevSoundServerVersion,
|
sl@0
|
80 |
KMMFDevSoundServerMinorVersionNumber,
|
sl@0
|
81 |
KMMFDevSoundServerBuildVersionNumber));
|
sl@0
|
82 |
|
sl@0
|
83 |
if (err!=KErrNotFound && err!=KErrServerTerminated)
|
sl@0
|
84 |
break;//return r;
|
sl@0
|
85 |
if (--retry==0)
|
sl@0
|
86 |
break;//return r;
|
sl@0
|
87 |
}
|
sl@0
|
88 |
|
sl@0
|
89 |
if(err)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
delete iSeqName;
|
sl@0
|
92 |
iSeqName = NULL;
|
sl@0
|
93 |
}
|
sl@0
|
94 |
audioServerProxy->Close();
|
sl@0
|
95 |
delete audioServerProxy;
|
sl@0
|
96 |
delete devSoundServerName;
|
sl@0
|
97 |
|
sl@0
|
98 |
return err;
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo()
|
sl@0
|
102 |
{
|
sl@0
|
103 |
return SendReceive(EMMFAudioLaunchRequests);
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TMMFState aMode)
|
sl@0
|
107 |
{
|
sl@0
|
108 |
TMMFDevSoundProxySettings set;
|
sl@0
|
109 |
set.iMode = aMode;
|
sl@0
|
110 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
111 |
return SendReceive(EMMFDevSoundProxyInitialize1, pckg);
|
sl@0
|
112 |
}
|
sl@0
|
113 |
|
sl@0
|
114 |
EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TUid aHWDev, TMMFState aMode)
|
sl@0
|
115 |
{
|
sl@0
|
116 |
TMMFDevSoundProxySettings set;
|
sl@0
|
117 |
set.iHWDev = aHWDev;
|
sl@0
|
118 |
set.iMode = aMode;
|
sl@0
|
119 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
120 |
return SendReceive(EMMFDevSoundProxyInitialize2, pckg);
|
sl@0
|
121 |
}
|
sl@0
|
122 |
|
sl@0
|
123 |
EXPORT_C TInt RMMFDevSoundProxy::InitializeL(CArrayPtr<TUid> /*aHWDevArray*/, TMMFState /*aMode*/)
|
sl@0
|
124 |
{
|
sl@0
|
125 |
return SendReceive(EMMFDevSoundProxyInitialize3);
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TFourCC aDesiredFourCC, TMMFState aMode)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
TMMFDevSoundProxySettings set;
|
sl@0
|
131 |
set.iDesiredFourCC = aDesiredFourCC;
|
sl@0
|
132 |
set.iMode = aMode;
|
sl@0
|
133 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
134 |
return SendReceive(EMMFDevSoundProxyInitialize4, pckg);
|
sl@0
|
135 |
}
|
sl@0
|
136 |
|
sl@0
|
137 |
EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities()
|
sl@0
|
138 |
{
|
sl@0
|
139 |
TMMFDevSoundProxySettings set;
|
sl@0
|
140 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
141 |
SendReceiveResult(EMMFDevSoundProxyCapabilities,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
142 |
return pckg().iCaps;
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config()
|
sl@0
|
146 |
{
|
sl@0
|
147 |
TMMFDevSoundProxySettings set;
|
sl@0
|
148 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
149 |
SendReceiveResult(EMMFDevSoundProxyConfig,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
150 |
return pckg().iConfig;
|
sl@0
|
151 |
}
|
sl@0
|
152 |
|
sl@0
|
153 |
EXPORT_C TInt RMMFDevSoundProxy::SetConfigL(const TMMFCapabilities& aConfig)
|
sl@0
|
154 |
{
|
sl@0
|
155 |
TMMFDevSoundProxySettings set;
|
sl@0
|
156 |
set.iConfig = aConfig;
|
sl@0
|
157 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
158 |
return SendReceive(EMMFDevSoundProxySetConfig, pckg);
|
sl@0
|
159 |
}
|
sl@0
|
160 |
|
sl@0
|
161 |
EXPORT_C TInt RMMFDevSoundProxy::MaxVolume()
|
sl@0
|
162 |
{
|
sl@0
|
163 |
TMMFDevSoundProxySettings set;
|
sl@0
|
164 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
165 |
SendReceiveResult(EMMFDevSoundProxyMaxVolume,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
166 |
return pckg().iMaxVolume;
|
sl@0
|
167 |
}
|
sl@0
|
168 |
|
sl@0
|
169 |
EXPORT_C TInt RMMFDevSoundProxy::Volume()
|
sl@0
|
170 |
{
|
sl@0
|
171 |
TMMFDevSoundProxySettings set;
|
sl@0
|
172 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
173 |
SendReceiveResult(EMMFDevSoundProxyVolume,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
174 |
return pckg().iVolume;
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume)
|
sl@0
|
178 |
{
|
sl@0
|
179 |
TMMFDevSoundProxySettings set;
|
sl@0
|
180 |
set.iVolume = aVolume;
|
sl@0
|
181 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
182 |
return SendReceive(EMMFDevSoundProxySetVolume, pckg);
|
sl@0
|
183 |
}
|
sl@0
|
184 |
|
sl@0
|
185 |
EXPORT_C TInt RMMFDevSoundProxy::MaxGain()
|
sl@0
|
186 |
{
|
sl@0
|
187 |
TMMFDevSoundProxySettings set;
|
sl@0
|
188 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
189 |
SendReceiveResult(EMMFDevSoundProxyMaxGain,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
190 |
return pckg().iMaxGain;
|
sl@0
|
191 |
}
|
sl@0
|
192 |
|
sl@0
|
193 |
EXPORT_C TInt RMMFDevSoundProxy::Gain()
|
sl@0
|
194 |
{
|
sl@0
|
195 |
TMMFDevSoundProxySettings set;
|
sl@0
|
196 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
197 |
SendReceiveResult(EMMFDevSoundProxyGain,KNullDesC8,KNullDesC8,pckg);
|
sl@0
|
198 |
return pckg().iGain;
|
sl@0
|
199 |
}
|
sl@0
|
200 |
|
sl@0
|
201 |
EXPORT_C TInt RMMFDevSoundProxy::SetGain(TInt aGain)
|
sl@0
|
202 |
{
|
sl@0
|
203 |
TMMFDevSoundProxySettings set;
|
sl@0
|
204 |
set.iGain = aGain;
|
sl@0
|
205 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
206 |
return SendReceive(EMMFDevSoundProxySetGain, pckg);
|
sl@0
|
207 |
}
|
sl@0
|
208 |
|
sl@0
|
209 |
EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
|
sl@0
|
210 |
{
|
sl@0
|
211 |
TMMFDevSoundProxySettings set;
|
sl@0
|
212 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
213 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance,KNullDesC8,KNullDesC8,pckg));
|
sl@0
|
214 |
aLeftPercentage = pckg().iLeftPercentage;
|
sl@0
|
215 |
aRightPercentage = pckg().iRightPercentage;
|
sl@0
|
216 |
}
|
sl@0
|
217 |
|
sl@0
|
218 |
EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
|
sl@0
|
219 |
{
|
sl@0
|
220 |
TMMFDevSoundProxySettings set;
|
sl@0
|
221 |
set.iLeftPercentage = aLeftPercentage;
|
sl@0
|
222 |
set.iRightPercentage = aRightPercentage;
|
sl@0
|
223 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
224 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance, pckg));
|
sl@0
|
225 |
}
|
sl@0
|
226 |
|
sl@0
|
227 |
EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
|
sl@0
|
228 |
{
|
sl@0
|
229 |
TMMFDevSoundProxySettings set;
|
sl@0
|
230 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
231 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance,KNullDesC8,KNullDesC8,pckg));
|
sl@0
|
232 |
aLeftPercentage = pckg().iLeftPercentage;
|
sl@0
|
233 |
aRightPercentage = pckg().iRightPercentage;
|
sl@0
|
234 |
}
|
sl@0
|
235 |
|
sl@0
|
236 |
EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
|
sl@0
|
237 |
{
|
sl@0
|
238 |
TMMFDevSoundProxySettings set;
|
sl@0
|
239 |
set.iLeftPercentage = aLeftPercentage;
|
sl@0
|
240 |
set.iRightPercentage = aRightPercentage;
|
sl@0
|
241 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
242 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance, pckg));
|
sl@0
|
243 |
}
|
sl@0
|
244 |
|
sl@0
|
245 |
EXPORT_C void RMMFDevSoundProxy::PlayInitL()
|
sl@0
|
246 |
{
|
sl@0
|
247 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit));
|
sl@0
|
248 |
}
|
sl@0
|
249 |
|
sl@0
|
250 |
EXPORT_C void RMMFDevSoundProxy::RecordInitL()
|
sl@0
|
251 |
{
|
sl@0
|
252 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit));
|
sl@0
|
253 |
}
|
sl@0
|
254 |
|
sl@0
|
255 |
EXPORT_C void RMMFDevSoundProxy::PlayData()
|
sl@0
|
256 |
{
|
sl@0
|
257 |
TMMFDevSoundProxyHwBuf set;
|
sl@0
|
258 |
set.iLastBuffer = iBuffer->LastBuffer();
|
sl@0
|
259 |
TMMFDevSoundProxyHwBufPckg pckg(set);
|
sl@0
|
260 |
|
sl@0
|
261 |
SendReceive(EMMFDevSoundProxyPlayData, pckg, iBuffer->Data());
|
sl@0
|
262 |
}
|
sl@0
|
263 |
|
sl@0
|
264 |
EXPORT_C void RMMFDevSoundProxy::RecordData()
|
sl@0
|
265 |
{
|
sl@0
|
266 |
SendReceive(EMMFDevSoundProxyRecordData);
|
sl@0
|
267 |
}
|
sl@0
|
268 |
|
sl@0
|
269 |
EXPORT_C void RMMFDevSoundProxy::Stop()
|
sl@0
|
270 |
{
|
sl@0
|
271 |
SendReceive(EMMFDevSoundProxyStop);
|
sl@0
|
272 |
}
|
sl@0
|
273 |
|
sl@0
|
274 |
EXPORT_C void RMMFDevSoundProxy::Pause()
|
sl@0
|
275 |
{
|
sl@0
|
276 |
SendReceive(EMMFDevSoundProxyPause);
|
sl@0
|
277 |
}
|
sl@0
|
278 |
|
sl@0
|
279 |
EXPORT_C void RMMFDevSoundProxy::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration)
|
sl@0
|
280 |
{
|
sl@0
|
281 |
TMMFDevSoundProxySettings set;
|
sl@0
|
282 |
set.iFrequencyOne = aFrequency;
|
sl@0
|
283 |
set.iDuration = aDuration;
|
sl@0
|
284 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
285 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone, pckg));
|
sl@0
|
286 |
}
|
sl@0
|
287 |
|
sl@0
|
288 |
EXPORT_C void RMMFDevSoundProxy::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration)
|
sl@0
|
289 |
{
|
sl@0
|
290 |
TMMFDevSoundProxySettings set;
|
sl@0
|
291 |
set.iFrequencyOne = aFrequencyOne;
|
sl@0
|
292 |
set.iFrequencyTwo = aFrequencyTwo;
|
sl@0
|
293 |
set.iDuration = aDuration;
|
sl@0
|
294 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
295 |
SendReceive(EMMFDevSoundProxyPlayDualTone, pckg);
|
sl@0
|
296 |
}
|
sl@0
|
297 |
|
sl@0
|
298 |
EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString)
|
sl@0
|
299 |
{
|
sl@0
|
300 |
SendReceive(EMMFDevSoundProxyPlayDTMFString, aDTMFString);
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData)
|
sl@0
|
304 |
{
|
sl@0
|
305 |
User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence, aData));
|
sl@0
|
306 |
}
|
sl@0
|
307 |
|
sl@0
|
308 |
EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber)
|
sl@0
|
309 |
{
|
sl@0
|
310 |
TPckgBuf<TInt> seqNum(aSequenceNumber);
|
sl@0
|
311 |
SendReceive(EMMFDevSoundProxyPlayFixedSequence, seqNum);
|
sl@0
|
312 |
}
|
sl@0
|
313 |
|
sl@0
|
314 |
EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
|
sl@0
|
315 |
TTimeIntervalMicroSeconds32& aToneOffLength,
|
sl@0
|
316 |
TTimeIntervalMicroSeconds32& aPauseLength)
|
sl@0
|
317 |
{
|
sl@0
|
318 |
TMMFDevSoundProxySettings set;
|
sl@0
|
319 |
set.iToneOnLength = aToneOnLength;
|
sl@0
|
320 |
set.iToneOffLength = aToneOffLength;
|
sl@0
|
321 |
set.iPauseLength = aPauseLength;
|
sl@0
|
322 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
323 |
SendReceive(EMMFDevSoundProxySetDTMFLengths, pckg);
|
sl@0
|
324 |
}
|
sl@0
|
325 |
|
sl@0
|
326 |
EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
|
sl@0
|
327 |
{
|
sl@0
|
328 |
TMMFDevSoundProxySettings set;
|
sl@0
|
329 |
set.iDuration = aRampDuration;
|
sl@0
|
330 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
331 |
SendReceive(EMMFDevSoundProxySetVolumeRamp, pckg);
|
sl@0
|
332 |
}
|
sl@0
|
333 |
|
sl@0
|
334 |
EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings)
|
sl@0
|
335 |
{
|
sl@0
|
336 |
aSupportedDataTypes.Reset();
|
sl@0
|
337 |
|
sl@0
|
338 |
TMMFPrioritySettings prioritySet = aPrioritySettings;
|
sl@0
|
339 |
TMMFPrioritySettingsPckg pckg(prioritySet);
|
sl@0
|
340 |
|
sl@0
|
341 |
TPckgBuf<TInt> numberOfElementsPckg;
|
sl@0
|
342 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedInputDataTypes, pckg, KNullDesC8, numberOfElementsPckg));
|
sl@0
|
343 |
|
sl@0
|
344 |
HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
|
sl@0
|
345 |
TPtr8 ptr = buf->Des();
|
sl@0
|
346 |
|
sl@0
|
347 |
|
sl@0
|
348 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr));
|
sl@0
|
349 |
RDesReadStream stream(ptr);
|
sl@0
|
350 |
CleanupClosePushL(stream);
|
sl@0
|
351 |
|
sl@0
|
352 |
for (TInt i=0; i<numberOfElementsPckg(); i++)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
TInt err = aSupportedDataTypes.Append(stream.ReadInt32L());
|
sl@0
|
355 |
if (err)
|
sl@0
|
356 |
{//note we don't destroy array because we don't own it
|
sl@0
|
357 |
//but we do reset it as it is incomplete
|
sl@0
|
358 |
aSupportedDataTypes.Reset();
|
sl@0
|
359 |
User::Leave(err);
|
sl@0
|
360 |
}
|
sl@0
|
361 |
}
|
sl@0
|
362 |
CleanupStack::PopAndDestroy(2, buf);//stream, buf
|
sl@0
|
363 |
}
|
sl@0
|
364 |
|
sl@0
|
365 |
|
sl@0
|
366 |
EXPORT_C void RMMFDevSoundProxy::GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings)
|
sl@0
|
367 |
{
|
sl@0
|
368 |
aSupportedDataTypes.Reset();
|
sl@0
|
369 |
|
sl@0
|
370 |
TMMFPrioritySettings prioritySet = aPrioritySettings;
|
sl@0
|
371 |
TMMFPrioritySettingsPckg pckg(prioritySet);
|
sl@0
|
372 |
|
sl@0
|
373 |
TPckgBuf<TInt> numberOfElementsPckg;
|
sl@0
|
374 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedOutputDataTypes, pckg, KNullDesC8, numberOfElementsPckg));
|
sl@0
|
375 |
|
sl@0
|
376 |
HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
|
sl@0
|
377 |
TPtr8 ptr = buf->Des();
|
sl@0
|
378 |
|
sl@0
|
379 |
|
sl@0
|
380 |
User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr));
|
sl@0
|
381 |
RDesReadStream stream(ptr);
|
sl@0
|
382 |
CleanupClosePushL(stream);
|
sl@0
|
383 |
|
sl@0
|
384 |
for (TInt i=0; i<numberOfElementsPckg(); i++)
|
sl@0
|
385 |
{
|
sl@0
|
386 |
TInt err = aSupportedDataTypes.Append(stream.ReadInt32L());
|
sl@0
|
387 |
if (err)
|
sl@0
|
388 |
{//note we don't destroy array because we don't own it
|
sl@0
|
389 |
//but we do reset it as it is incomplete
|
sl@0
|
390 |
aSupportedDataTypes.Reset();
|
sl@0
|
391 |
User::Leave(err);
|
sl@0
|
392 |
}
|
sl@0
|
393 |
}
|
sl@0
|
394 |
CleanupStack::PopAndDestroy(2, buf);//stream, buf
|
sl@0
|
395 |
}
|
sl@0
|
396 |
|
sl@0
|
397 |
EXPORT_C TInt RMMFDevSoundProxy::SamplesRecorded()
|
sl@0
|
398 |
{
|
sl@0
|
399 |
TPckgBuf<TInt> numSamples;
|
sl@0
|
400 |
SendReceiveResult(EMMFDevSoundProxySamplesRecorded, KNullDesC8, KNullDesC8, numSamples);
|
sl@0
|
401 |
return numSamples();
|
sl@0
|
402 |
}
|
sl@0
|
403 |
|
sl@0
|
404 |
EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed()
|
sl@0
|
405 |
{
|
sl@0
|
406 |
TPckgBuf<TInt> numSamples;
|
sl@0
|
407 |
SendReceiveResult(EMMFDevSoundProxySamplesPlayed, KNullDesC8, KNullDesC8, numSamples);
|
sl@0
|
408 |
return numSamples();
|
sl@0
|
409 |
}
|
sl@0
|
410 |
|
sl@0
|
411 |
EXPORT_C void RMMFDevSoundProxy::SetToneRepeats(TInt aRepeatCount, const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
|
sl@0
|
412 |
{
|
sl@0
|
413 |
TPckgBuf<TInt> countRepeat(aRepeatCount);
|
sl@0
|
414 |
TPckgBuf<TTimeIntervalMicroSeconds> repeatTS(aRepeatTrailingSilence);
|
sl@0
|
415 |
SendReceive(EMMFDevSoundProxySetToneRepeats, countRepeat, repeatTS);
|
sl@0
|
416 |
}
|
sl@0
|
417 |
|
sl@0
|
418 |
EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
|
sl@0
|
419 |
{
|
sl@0
|
420 |
TPckgBuf<TMMFPrioritySettings> prioritySet(aPrioritySettings);
|
sl@0
|
421 |
SendReceive(EMMFDevSoundProxySetPrioritySettings, prioritySet);
|
sl@0
|
422 |
}
|
sl@0
|
423 |
|
sl@0
|
424 |
EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt aSequenceNumber)
|
sl@0
|
425 |
{
|
sl@0
|
426 |
TPckgBuf<TInt> seqNum(aSequenceNumber);
|
sl@0
|
427 |
TPtr SeqNamePtr = iSeqName->Des();
|
sl@0
|
428 |
SeqNamePtr.FillZ();
|
sl@0
|
429 |
SendReceiveResult(EMMFDevSoundProxyFixedSequenceName, seqNum, KNullDesC8, SeqNamePtr);
|
sl@0
|
430 |
return *iSeqName;
|
sl@0
|
431 |
}
|
sl@0
|
432 |
|
sl@0
|
433 |
|
sl@0
|
434 |
EXPORT_C void RMMFDevSoundProxy::ConvertInitL()
|
sl@0
|
435 |
{
|
sl@0
|
436 |
SendReceive(EMMFDevSoundProxyConvertInit);
|
sl@0
|
437 |
}
|
sl@0
|
438 |
|
sl@0
|
439 |
EXPORT_C void RMMFDevSoundProxy::ConvertData()
|
sl@0
|
440 |
{
|
sl@0
|
441 |
SendReceive(EMMFDevSoundProxyConvertData);
|
sl@0
|
442 |
}
|
sl@0
|
443 |
|
sl@0
|
444 |
EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid /*aInterfaceId*/)
|
sl@0
|
445 |
{
|
sl@0
|
446 |
// No custom interfaces are supported at the moment so return NULL.
|
sl@0
|
447 |
//TO DO
|
sl@0
|
448 |
return NULL;
|
sl@0
|
449 |
}
|
sl@0
|
450 |
|
sl@0
|
451 |
EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount()
|
sl@0
|
452 |
{
|
sl@0
|
453 |
TPckgBuf<TInt> fixSeqCountPckg;
|
sl@0
|
454 |
SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount, fixSeqCountPckg);
|
sl@0
|
455 |
return fixSeqCountPckg();
|
sl@0
|
456 |
}
|
sl@0
|
457 |
|
sl@0
|
458 |
EXPORT_C void RMMFDevSoundProxy::ReceiveInitializeCompleteEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
|
sl@0
|
459 |
{
|
sl@0
|
460 |
aStatus = KRequestPending;
|
sl@0
|
461 |
SendReceive(EMMFDevSoundProxyReceiveICEvent, aSetPckg, aStatus);
|
sl@0
|
462 |
}
|
sl@0
|
463 |
|
sl@0
|
464 |
EXPORT_C void RMMFDevSoundProxy::CancelReceiveInitializeCompleteEvent()
|
sl@0
|
465 |
{
|
sl@0
|
466 |
SendReceive(EMMFDevSoundProxyCancelReceiveICEvent);
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
EXPORT_C void RMMFDevSoundProxy::ReceiveBufferToBeFilledEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
|
sl@0
|
470 |
{
|
sl@0
|
471 |
aStatus = KRequestPending;
|
sl@0
|
472 |
SendReceiveResult(EMMFDevSoundProxyReceiveBTBFEvent, aSetPckg, aStatus);
|
sl@0
|
473 |
}
|
sl@0
|
474 |
|
sl@0
|
475 |
EXPORT_C void RMMFDevSoundProxy::CancelReceiveBufferToBeFilledEvent()
|
sl@0
|
476 |
{
|
sl@0
|
477 |
SendReceive(EMMFDevSoundProxyCancelReceiveBTBFEvent);
|
sl@0
|
478 |
}
|
sl@0
|
479 |
|
sl@0
|
480 |
EXPORT_C void RMMFDevSoundProxy::ReceiveBufferToBeEmptiedEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
|
sl@0
|
481 |
{
|
sl@0
|
482 |
aStatus = KRequestPending;
|
sl@0
|
483 |
SendReceiveResult(EMMFDevSoundProxyReceiveBTBEEvent, aSetPckg, aStatus);
|
sl@0
|
484 |
}
|
sl@0
|
485 |
|
sl@0
|
486 |
EXPORT_C void RMMFDevSoundProxy::CancelReceiveBufferToBeEmptiedEvent()
|
sl@0
|
487 |
{
|
sl@0
|
488 |
SendReceive(EMMFDevSoundProxyCancelReceiveBTBEEvent);
|
sl@0
|
489 |
}
|
sl@0
|
490 |
|
sl@0
|
491 |
EXPORT_C void RMMFDevSoundProxy::ReceivePlayErrorEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
|
sl@0
|
492 |
{
|
sl@0
|
493 |
aStatus = KRequestPending;
|
sl@0
|
494 |
SendReceive(EMMFDevSoundProxyReceivePEEvent, aSetPckg, aStatus);
|
sl@0
|
495 |
}
|
sl@0
|
496 |
|
sl@0
|
497 |
EXPORT_C void RMMFDevSoundProxy::CancelReceivePlayErrorEvent()
|
sl@0
|
498 |
{
|
sl@0
|
499 |
SendReceive(EMMFDevSoundProxyCancelReceivePEEvent);
|
sl@0
|
500 |
}
|
sl@0
|
501 |
|
sl@0
|
502 |
EXPORT_C void RMMFDevSoundProxy::ReceiveRecordErrorEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
|
sl@0
|
503 |
{
|
sl@0
|
504 |
aStatus = KRequestPending;
|
sl@0
|
505 |
SendReceive(EMMFDevSoundProxyReceiveREEvent, aSetPckg, aStatus);
|
sl@0
|
506 |
}
|
sl@0
|
507 |
|
sl@0
|
508 |
EXPORT_C void RMMFDevSoundProxy::CancelReceiveRecordErrorEvent()
|
sl@0
|
509 |
{
|
sl@0
|
510 |
SendReceive(EMMFDevSoundProxyCancelReceiveREEvent);
|
sl@0
|
511 |
}
|
sl@0
|
512 |
|
sl@0
|
513 |
EXPORT_C void RMMFDevSoundProxy::ReceiveToneFinishedEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
|
sl@0
|
514 |
{
|
sl@0
|
515 |
aStatus = KRequestPending;
|
sl@0
|
516 |
SendReceive(EMMFDevSoundProxyReceiveTFEvent, aSetPckg, aStatus);
|
sl@0
|
517 |
}
|
sl@0
|
518 |
|
sl@0
|
519 |
EXPORT_C void RMMFDevSoundProxy::CancelReceiveToneFinishedEvent()
|
sl@0
|
520 |
{
|
sl@0
|
521 |
SendReceive(EMMFDevSoundProxyCancelReceiveTFEvent);
|
sl@0
|
522 |
}
|
sl@0
|
523 |
|
sl@0
|
524 |
EXPORT_C void RMMFDevSoundProxy::ReceiveSendEventToClientEvent(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus)
|
sl@0
|
525 |
{
|
sl@0
|
526 |
aStatus = KRequestPending;
|
sl@0
|
527 |
SendReceiveResult(EMMFDevSoundProxyReceiveSETCEvent, aEventPckg, aStatus);
|
sl@0
|
528 |
}
|
sl@0
|
529 |
|
sl@0
|
530 |
EXPORT_C void RMMFDevSoundProxy::CancelReceiveSendEventToClientEvent()
|
sl@0
|
531 |
{
|
sl@0
|
532 |
SendReceive(EMMFDevSoundProxyCancelReceiveSETCEvent);
|
sl@0
|
533 |
}
|
sl@0
|
534 |
|
sl@0
|
535 |
EXPORT_C void RMMFDevSoundProxy::SetBuffer(CMMFDataBuffer* aBuffer)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
if(iBuffer)
|
sl@0
|
538 |
delete iBuffer;
|
sl@0
|
539 |
iBuffer = aBuffer;
|
sl@0
|
540 |
}
|
sl@0
|
541 |
|
sl@0
|
542 |
EXPORT_C TInt RMMFDevSoundProxy::GetRecordedBufferL(CMMFDataBuffer& aBuffer)
|
sl@0
|
543 |
{
|
sl@0
|
544 |
return SendReceiveResult(EMMFDevSoundProxyGetRecordedBuffer, aBuffer.Data());
|
sl@0
|
545 |
}
|
sl@0
|
546 |
|
sl@0
|
547 |
EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
|
sl@0
|
548 |
{
|
sl@0
|
549 |
TMMFDevSoundProxySettings set;
|
sl@0
|
550 |
set.iNotificationEventUid = aEventType;
|
sl@0
|
551 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
552 |
return SendReceive(EMMFDevSoundProxyRequestResourceNotification, pckg, aNotificationRegistrationData);
|
sl@0
|
553 |
}
|
sl@0
|
554 |
|
sl@0
|
555 |
EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType)
|
sl@0
|
556 |
{
|
sl@0
|
557 |
TMMFDevSoundProxySettings set;
|
sl@0
|
558 |
set.iNotificationEventUid = aEventType;
|
sl@0
|
559 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
560 |
return SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, pckg);
|
sl@0
|
561 |
}
|
sl@0
|
562 |
|
sl@0
|
563 |
EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData)
|
sl@0
|
564 |
{
|
sl@0
|
565 |
TMMFDevSoundProxySettings set;
|
sl@0
|
566 |
set.iNotificationEventUid = aEventType;
|
sl@0
|
567 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
568 |
return SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, pckg,KNullDesC8,aNotificationData);
|
sl@0
|
569 |
}
|
sl@0
|
570 |
|
sl@0
|
571 |
EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay()
|
sl@0
|
572 |
{
|
sl@0
|
573 |
return SendReceive(EMMFDevSoundProxyWillResumePlay);
|
sl@0
|
574 |
}
|
sl@0
|
575 |
|
sl@0
|
576 |
EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid)
|
sl@0
|
577 |
{
|
sl@0
|
578 |
TPckgBuf<TThreadId> threadId(aTid);
|
sl@0
|
579 |
return SendReceive(EMMFDevSoundProxySetClientThreadInfo, threadId);
|
sl@0
|
580 |
}
|
sl@0
|
581 |
|