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