|
1 // Copyright (c) 2004-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 <f32file.h> |
|
17 #include <e32math.h> |
|
18 #include <s32mem.h> |
|
19 #include "MmfDevSoundProxy.h" |
|
20 #include "MmfDevSoundServerStart.h" |
|
21 #include "MmfBase.hrh" |
|
22 #include "MmfAudioClientServer.h" |
|
23 #include <mmf/plugin/mmfdevsoundcustominterface.hrh> |
|
24 #include <ecom/ecom.h> |
|
25 |
|
26 |
|
27 /** |
|
28 @internalTechnology |
|
29 |
|
30 This function raises a panic |
|
31 |
|
32 @param aError |
|
33 one of the several panic codes that may be raised by this dll |
|
34 |
|
35 @panic EMMFDevSoundProxyPlayDataWithoutInitialize is raised when playdata is called without initialization |
|
36 @panic EMMFDevSoundProxyRecordDataWithoutInitialize is raised when recorddata is called without initialization |
|
37 @panic EMMFDevSoundProxyConvertDataWithoutInitialize is raised when convertdata is called without initialization |
|
38 */ |
|
39 GLDEF_C void Panic(TMMFDevSoundProxyPanicCodes aPanicCode) |
|
40 { |
|
41 User::Panic(KMMFDevSoundProxyPanicCategory, aPanicCode); |
|
42 } |
|
43 |
|
44 EXPORT_C RMMFDevSoundProxy::RMMFDevSoundProxy() |
|
45 : iBuffer(NULL), iSeqName(NULL), iMsgQueueHandle(NULL), iAudioServerProxy (NULL) |
|
46 { |
|
47 } |
|
48 |
|
49 EXPORT_C void RMMFDevSoundProxy::Close() |
|
50 { |
|
51 RMmfSessionBase::Close(); |
|
52 iState = EIdle; |
|
53 if(iAudioServerProxy) |
|
54 { |
|
55 iAudioServerProxy->Close(); |
|
56 delete iAudioServerProxy; |
|
57 } |
|
58 delete iBuffer; |
|
59 delete iSeqName; |
|
60 } |
|
61 |
|
62 EXPORT_C TInt RMMFDevSoundProxy::Open(RHandleBase& aMsgQueueHandle) |
|
63 { |
|
64 TInt err = KErrNone; |
|
65 iMsgQueueHandle = &aMsgQueueHandle; |
|
66 TRAP(err, iSeqName = HBufC::NewL(KMaxFixedSequenceNameLength)); |
|
67 if(err == KErrNone) |
|
68 { |
|
69 TRAP(err, iAudioServerProxy = new (ELeave) RMMFAudioServerProxy()); |
|
70 if(err == KErrNone) |
|
71 { |
|
72 err = iAudioServerProxy->Open(); |
|
73 if(err == KErrNone) |
|
74 { |
|
75 err = SetReturnedHandle(iAudioServerProxy->GetDevSoundSessionHandle()); |
|
76 } |
|
77 } |
|
78 } |
|
79 if(err) |
|
80 { |
|
81 Close(); |
|
82 } |
|
83 |
|
84 return err; |
|
85 } |
|
86 EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo() |
|
87 { |
|
88 return SendReceive(EMMFAudioLaunchRequests); |
|
89 } |
|
90 |
|
91 EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TMMFState aMode) |
|
92 { |
|
93 TMMFDevSoundProxySettings set; |
|
94 set.iMode = aMode; |
|
95 TMMFDevSoundProxySettingsPckg pckg(set); |
|
96 TIpcArgs args(&pckg, *iMsgQueueHandle); |
|
97 return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize1, args); |
|
98 } |
|
99 |
|
100 EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TUid aHWDev, TMMFState aMode) |
|
101 { |
|
102 TMMFDevSoundProxySettings set; |
|
103 set.iHWDev = aHWDev; |
|
104 set.iMode = aMode; |
|
105 TMMFDevSoundProxySettingsPckg pckg(set); |
|
106 TIpcArgs args(&pckg, *iMsgQueueHandle); |
|
107 return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize2, args); |
|
108 } |
|
109 |
|
110 EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TFourCC aDesiredFourCC, TMMFState aMode) |
|
111 { |
|
112 TMMFDevSoundProxySettings set; |
|
113 set.iDesiredFourCC = aDesiredFourCC; |
|
114 set.iMode = aMode; |
|
115 TMMFDevSoundProxySettingsPckg pckg(set); |
|
116 TIpcArgs args(&pckg, *iMsgQueueHandle); |
|
117 return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize4, args); |
|
118 } |
|
119 |
|
120 EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities() |
|
121 { |
|
122 TMMFDevSoundProxySettings set; |
|
123 TMMFDevSoundProxySettingsPckg pckg(set); |
|
124 SendReceiveResult(EMMFDevSoundProxyCapabilities,KNullDesC8,KNullDesC8,pckg); |
|
125 return pckg().iCaps; |
|
126 } |
|
127 |
|
128 EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config() |
|
129 { |
|
130 TMMFDevSoundProxySettings set; |
|
131 TMMFDevSoundProxySettingsPckg pckg(set); |
|
132 SendReceiveResult(EMMFDevSoundProxyConfig,KNullDesC8,KNullDesC8,pckg); |
|
133 return pckg().iConfig; |
|
134 } |
|
135 |
|
136 EXPORT_C TInt RMMFDevSoundProxy::SetConfigL(const TMMFCapabilities& aConfig) |
|
137 { |
|
138 TMMFDevSoundProxySettings set; |
|
139 set.iConfig = aConfig; |
|
140 TMMFDevSoundProxySettingsPckg pckg(set); |
|
141 TInt err = SendReceive(EMMFDevSoundProxySetConfig, pckg); |
|
142 User::LeaveIfError(err); |
|
143 return err; |
|
144 } |
|
145 |
|
146 EXPORT_C TInt RMMFDevSoundProxy::MaxVolume() |
|
147 { |
|
148 TMMFDevSoundProxySettings set; |
|
149 TMMFDevSoundProxySettingsPckg pckg(set); |
|
150 SendReceiveResult(EMMFDevSoundProxyMaxVolume,KNullDesC8,KNullDesC8,pckg); |
|
151 return pckg().iMaxVolume; |
|
152 } |
|
153 |
|
154 EXPORT_C TInt RMMFDevSoundProxy::Volume() |
|
155 { |
|
156 TMMFDevSoundProxySettings set; |
|
157 TMMFDevSoundProxySettingsPckg pckg(set); |
|
158 SendReceiveResult(EMMFDevSoundProxyVolume,KNullDesC8,KNullDesC8,pckg); |
|
159 return pckg().iVolume; |
|
160 } |
|
161 |
|
162 EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume) |
|
163 { |
|
164 TMMFDevSoundProxySettings set; |
|
165 set.iVolume = aVolume; |
|
166 TMMFDevSoundProxySettingsPckg pckg(set); |
|
167 return SendReceive(EMMFDevSoundProxySetVolume, pckg); |
|
168 } |
|
169 |
|
170 EXPORT_C TInt RMMFDevSoundProxy::MaxGain() |
|
171 { |
|
172 TMMFDevSoundProxySettings set; |
|
173 TMMFDevSoundProxySettingsPckg pckg(set); |
|
174 SendReceiveResult(EMMFDevSoundProxyMaxGain,KNullDesC8,KNullDesC8,pckg); |
|
175 return pckg().iMaxGain; |
|
176 } |
|
177 |
|
178 EXPORT_C TInt RMMFDevSoundProxy::Gain() |
|
179 { |
|
180 TMMFDevSoundProxySettings set; |
|
181 TMMFDevSoundProxySettingsPckg pckg(set); |
|
182 SendReceiveResult(EMMFDevSoundProxyGain,KNullDesC8,KNullDesC8,pckg); |
|
183 return pckg().iGain; |
|
184 } |
|
185 |
|
186 EXPORT_C TInt RMMFDevSoundProxy::SetGain(TInt aGain) |
|
187 { |
|
188 TMMFDevSoundProxySettings set; |
|
189 set.iGain = aGain; |
|
190 TMMFDevSoundProxySettingsPckg pckg(set); |
|
191 return SendReceive(EMMFDevSoundProxySetGain, pckg); |
|
192 } |
|
193 |
|
194 EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) |
|
195 { |
|
196 TMMFDevSoundProxySettings set; |
|
197 TMMFDevSoundProxySettingsPckg pckg(set); |
|
198 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance,KNullDesC8,KNullDesC8,pckg)); |
|
199 aLeftPercentage = pckg().iLeftPercentage; |
|
200 aRightPercentage = pckg().iRightPercentage; |
|
201 } |
|
202 |
|
203 EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage) |
|
204 { |
|
205 TMMFDevSoundProxySettings set; |
|
206 set.iLeftPercentage = aLeftPercentage; |
|
207 set.iRightPercentage = aRightPercentage; |
|
208 TMMFDevSoundProxySettingsPckg pckg(set); |
|
209 User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance, pckg)); |
|
210 } |
|
211 |
|
212 EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) |
|
213 { |
|
214 TMMFDevSoundProxySettings set; |
|
215 TMMFDevSoundProxySettingsPckg pckg(set); |
|
216 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance,KNullDesC8,KNullDesC8,pckg)); |
|
217 aLeftPercentage = pckg().iLeftPercentage; |
|
218 aRightPercentage = pckg().iRightPercentage; |
|
219 } |
|
220 |
|
221 EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage) |
|
222 { |
|
223 TMMFDevSoundProxySettings set; |
|
224 set.iLeftPercentage = aLeftPercentage; |
|
225 set.iRightPercentage = aRightPercentage; |
|
226 TMMFDevSoundProxySettingsPckg pckg(set); |
|
227 User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance, pckg)); |
|
228 } |
|
229 |
|
230 EXPORT_C void RMMFDevSoundProxy::PlayInitL() |
|
231 { |
|
232 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit)); |
|
233 iState = EPlaying; |
|
234 } |
|
235 |
|
236 EXPORT_C void RMMFDevSoundProxy::RecordInitL() |
|
237 { |
|
238 User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit)); |
|
239 iState = ERecording; |
|
240 } |
|
241 |
|
242 EXPORT_C void RMMFDevSoundProxy::PlayData() |
|
243 { |
|
244 __ASSERT_ALWAYS(iState == EPlaying, Panic(EMMFDevSoundProxyPlayDataWithoutInitialize)); |
|
245 |
|
246 TMMFDevSoundProxyHwBuf set; |
|
247 set.iLastBuffer = iBuffer->LastBuffer(); |
|
248 TMMFDevSoundProxyHwBufPckg pckg(set); |
|
249 SendReceive(EMMFDevSoundProxyPlayData, pckg, iBuffer->Data()); |
|
250 } |
|
251 |
|
252 EXPORT_C void RMMFDevSoundProxy::RecordData() |
|
253 { |
|
254 __ASSERT_ALWAYS(iState == ERecording, Panic(EMMFDevSoundProxyRecordDataWithoutInitialize)); |
|
255 SendReceive(EMMFDevSoundProxyRecordData); |
|
256 } |
|
257 |
|
258 EXPORT_C void RMMFDevSoundProxy::Stop() |
|
259 { |
|
260 SendReceive(EMMFDevSoundProxyStop); |
|
261 iState = EIdle; |
|
262 } |
|
263 |
|
264 EXPORT_C void RMMFDevSoundProxy::Pause() |
|
265 { |
|
266 SendReceive(EMMFDevSoundProxyPause); |
|
267 } |
|
268 |
|
269 EXPORT_C void RMMFDevSoundProxy::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) |
|
270 { |
|
271 TMMFDevSoundProxySettings set; |
|
272 set.iFrequencyOne = aFrequency; |
|
273 set.iDuration = aDuration; |
|
274 TMMFDevSoundProxySettingsPckg pckg(set); |
|
275 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone, pckg)); |
|
276 } |
|
277 |
|
278 EXPORT_C void RMMFDevSoundProxy::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) |
|
279 { |
|
280 TMMFDevSoundProxySettings set; |
|
281 set.iFrequencyOne = aFrequencyOne; |
|
282 set.iFrequencyTwo = aFrequencyTwo; |
|
283 set.iDuration = aDuration; |
|
284 TMMFDevSoundProxySettingsPckg pckg(set); |
|
285 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDualTone, pckg)); |
|
286 } |
|
287 |
|
288 EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString) |
|
289 { |
|
290 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDTMFString, aDTMFString)); |
|
291 } |
|
292 |
|
293 EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData) |
|
294 { |
|
295 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence, aData)); |
|
296 } |
|
297 |
|
298 EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber) |
|
299 { |
|
300 TPckgBuf<TInt> seqNum(aSequenceNumber); |
|
301 User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayFixedSequence, seqNum)); |
|
302 } |
|
303 |
|
304 EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, |
|
305 TTimeIntervalMicroSeconds32& aToneOffLength, |
|
306 TTimeIntervalMicroSeconds32& aPauseLength) |
|
307 { |
|
308 TMMFDevSoundProxySettings set; |
|
309 set.iToneOnLength = aToneOnLength; |
|
310 set.iToneOffLength = aToneOffLength; |
|
311 set.iPauseLength = aPauseLength; |
|
312 TMMFDevSoundProxySettingsPckg pckg(set); |
|
313 SendReceive(EMMFDevSoundProxySetDTMFLengths, pckg); |
|
314 } |
|
315 |
|
316 EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) |
|
317 { |
|
318 TMMFDevSoundProxySettings set; |
|
319 set.iDuration = aRampDuration; |
|
320 TMMFDevSoundProxySettingsPckg pckg(set); |
|
321 SendReceive(EMMFDevSoundProxySetVolumeRamp, pckg); |
|
322 } |
|
323 |
|
324 EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) |
|
325 { |
|
326 aSupportedDataTypes.Reset(); |
|
327 |
|
328 TMMFPrioritySettings prioritySet = aPrioritySettings; |
|
329 TMMFPrioritySettingsPckg pckg(prioritySet); |
|
330 |
|
331 TPckgBuf<TInt> numberOfElementsPckg; |
|
332 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedInputDataTypes, pckg, KNullDesC8, numberOfElementsPckg)); |
|
333 |
|
334 HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); |
|
335 TPtr8 ptr = buf->Des(); |
|
336 |
|
337 |
|
338 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr)); |
|
339 RDesReadStream stream(ptr); |
|
340 CleanupClosePushL(stream); |
|
341 |
|
342 for (TInt i=0; i<numberOfElementsPckg(); i++) |
|
343 { |
|
344 TInt err = aSupportedDataTypes.Append(stream.ReadInt32L()); |
|
345 if (err) |
|
346 {//note we don't destroy array because we don't own it |
|
347 //but we do reset it as it is incomplete |
|
348 aSupportedDataTypes.Reset(); |
|
349 User::Leave(err); |
|
350 } |
|
351 } |
|
352 CleanupStack::PopAndDestroy(2, buf);//stream, buf |
|
353 } |
|
354 |
|
355 |
|
356 EXPORT_C void RMMFDevSoundProxy::GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) |
|
357 { |
|
358 aSupportedDataTypes.Reset(); |
|
359 |
|
360 TMMFPrioritySettings prioritySet = aPrioritySettings; |
|
361 TMMFPrioritySettingsPckg pckg(prioritySet); |
|
362 |
|
363 TPckgBuf<TInt> numberOfElementsPckg; |
|
364 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedOutputDataTypes, pckg, KNullDesC8, numberOfElementsPckg)); |
|
365 |
|
366 HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); |
|
367 TPtr8 ptr = buf->Des(); |
|
368 |
|
369 |
|
370 User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr)); |
|
371 RDesReadStream stream(ptr); |
|
372 CleanupClosePushL(stream); |
|
373 |
|
374 for (TInt i=0; i<numberOfElementsPckg(); i++) |
|
375 { |
|
376 TInt err = aSupportedDataTypes.Append(stream.ReadInt32L()); |
|
377 if (err) |
|
378 {//note we don't destroy array because we don't own it |
|
379 //but we do reset it as it is incomplete |
|
380 aSupportedDataTypes.Reset(); |
|
381 User::Leave(err); |
|
382 } |
|
383 } |
|
384 CleanupStack::PopAndDestroy(2, buf);//stream, buf |
|
385 } |
|
386 |
|
387 EXPORT_C TInt RMMFDevSoundProxy::SamplesRecorded() |
|
388 { |
|
389 TPckgBuf<TInt> numSamples; |
|
390 SendReceiveResult(EMMFDevSoundProxySamplesRecorded, KNullDesC8, KNullDesC8, numSamples); |
|
391 return numSamples(); |
|
392 } |
|
393 |
|
394 EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed() |
|
395 { |
|
396 TPckgBuf<TInt> numSamples; |
|
397 SendReceiveResult(EMMFDevSoundProxySamplesPlayed, KNullDesC8, KNullDesC8, numSamples); |
|
398 return numSamples(); |
|
399 } |
|
400 |
|
401 EXPORT_C void RMMFDevSoundProxy::SetToneRepeats(TInt aRepeatCount, const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) |
|
402 { |
|
403 TPckgBuf<TInt> countRepeat(aRepeatCount); |
|
404 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS(aRepeatTrailingSilence); |
|
405 SendReceive(EMMFDevSoundProxySetToneRepeats, countRepeat, repeatTS); |
|
406 } |
|
407 |
|
408 EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) |
|
409 { |
|
410 TPckgBuf<TMMFPrioritySettings> prioritySet(aPrioritySettings); |
|
411 SendReceive(EMMFDevSoundProxySetPrioritySettings, prioritySet); |
|
412 } |
|
413 |
|
414 EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt aSequenceNumber) |
|
415 { |
|
416 TPckgBuf<TInt> seqNum(aSequenceNumber); |
|
417 TPtr SeqNamePtr = iSeqName->Des(); |
|
418 SeqNamePtr.FillZ(); |
|
419 SendReceiveResult(EMMFDevSoundProxyFixedSequenceName, seqNum, KNullDesC8, SeqNamePtr); |
|
420 return *iSeqName; |
|
421 } |
|
422 |
|
423 EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid /*aInterfaceId*/) |
|
424 { |
|
425 // No custom interfaces are supported at the moment so return NULL. |
|
426 //TO DO |
|
427 return NULL; |
|
428 } |
|
429 |
|
430 EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount() |
|
431 { |
|
432 TPckgBuf<TInt> fixSeqCountPckg; |
|
433 SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount, fixSeqCountPckg); |
|
434 return fixSeqCountPckg(); |
|
435 } |
|
436 |
|
437 EXPORT_C TInt RMMFDevSoundProxy::BufferToBeFilledData(TMMFDevSoundProxyHwBufPckg& aSetPckg) |
|
438 { |
|
439 // Note that there will only ever be one of these requests outstanding per session |
|
440 return SendReceiveResult(EMMFDevSoundProxyBTBFData, aSetPckg); |
|
441 } |
|
442 |
|
443 EXPORT_C TInt RMMFDevSoundProxy::BufferToBeEmptiedData(TMMFDevSoundProxyHwBufPckg& aSetPckg) |
|
444 { |
|
445 // Note that there will only ever be one of these requests outstanding per session |
|
446 return SendReceiveResult(EMMFDevSoundProxyBTBEData, aSetPckg); |
|
447 } |
|
448 |
|
449 EXPORT_C void RMMFDevSoundProxy::SetBuffer(CMMFDataBuffer* aBuffer) |
|
450 { |
|
451 if(iBuffer) |
|
452 { |
|
453 delete iBuffer; |
|
454 } |
|
455 iBuffer = aBuffer; |
|
456 } |
|
457 |
|
458 EXPORT_C TInt RMMFDevSoundProxy::GetRecordedBufferL(CMMFDataBuffer& aBuffer) |
|
459 { |
|
460 return SendReceiveResult(EMMFDevSoundProxyGetRecordedBuffer, aBuffer.Data()); |
|
461 } |
|
462 |
|
463 EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) |
|
464 { |
|
465 TMMFDevSoundProxySettings set; |
|
466 set.iNotificationEventUid = aEventType; |
|
467 TMMFDevSoundProxySettingsPckg pckg(set); |
|
468 return SendReceive(EMMFDevSoundProxyRequestResourceNotification, pckg, aNotificationRegistrationData); |
|
469 } |
|
470 |
|
471 EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType) |
|
472 { |
|
473 TMMFDevSoundProxySettings set; |
|
474 set.iNotificationEventUid = aEventType; |
|
475 TMMFDevSoundProxySettingsPckg pckg(set); |
|
476 return SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, pckg); |
|
477 } |
|
478 |
|
479 EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData) |
|
480 { |
|
481 TMMFDevSoundProxySettings set; |
|
482 set.iNotificationEventUid = aEventType; |
|
483 TMMFDevSoundProxySettingsPckg pckg(set); |
|
484 return SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, pckg,KNullDesC8,aNotificationData); |
|
485 } |
|
486 |
|
487 EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay() |
|
488 { |
|
489 return SendReceive(EMMFDevSoundProxyWillResumePlay); |
|
490 } |
|
491 |
|
492 EXPORT_C TInt RMMFDevSoundProxy::EmptyBuffers() |
|
493 { |
|
494 return SendReceive(EMMFDevSoundProxyEmptyBuffers); |
|
495 } |
|
496 |
|
497 EXPORT_C TInt RMMFDevSoundProxy::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) |
|
498 { |
|
499 TTimeIntervalMicroSeconds time(0); |
|
500 TPckgBuf<TTimeIntervalMicroSeconds> timePckg(time); |
|
501 TInt err = SendReceiveResult(EMMFDevSoundProxyGetTimePlayed, KNullDesC8, KNullDesC8, timePckg); |
|
502 if(err==KErrNone) |
|
503 { |
|
504 aTime = timePckg(); |
|
505 } |
|
506 return err; |
|
507 } |
|
508 |
|
509 // implementation of a simple CustomCommand() scheme |
|
510 EXPORT_C TInt RMMFDevSoundProxy::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) |
|
511 { |
|
512 // the UID of the custom command is passed as an integer so as maintain consistency with the async methods below |
|
513 TInt command = aUid.iUid; |
|
514 |
|
515 if (aOutParam==NULL) |
|
516 { |
|
517 return SendReceive(EMMFDevSoundProxySyncCustomCommand, command, aParam1, aParam2); |
|
518 } |
|
519 else |
|
520 { |
|
521 return SendReceiveResult(EMMFDevSoundProxySyncCustomCommandResult, command, aParam1, aParam2, *aOutParam); |
|
522 } |
|
523 } |
|
524 |
|
525 EXPORT_C void RMMFDevSoundProxy::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) |
|
526 { |
|
527 // this seemingly only allows 1 simultaneous async call. Need an array of TRequestStatus for more than one call. |
|
528 // the UID of the custom command is passed as an integer so as to prevent the need of a consistent UID array. |
|
529 TInt command = aUid.iUid; |
|
530 |
|
531 if (aOutParam==NULL) |
|
532 { |
|
533 SendReceive(EMMFDevSoundProxyAsyncCustomCommand, command, aParam1, aParam2, aStatus); |
|
534 } |
|
535 else |
|
536 { |
|
537 SendReceiveResult(EMMFDevSoundProxyAsyncCustomCommandResult, command, aParam1, aParam2, *aOutParam, aStatus); |
|
538 } |
|
539 } |
|
540 |
|
541 EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid) |
|
542 { |
|
543 TPckgBuf<TThreadId> threadId(aTid); |
|
544 return SendReceive(EMMFDevSoundProxySetClientThreadInfo, threadId); |
|
545 } |