os/mm/devsound/sounddevbt/PlatSec/src/Client/MmfBtDevSoundProxy.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/sounddevbt/PlatSec/src/Client/MmfBtDevSoundProxy.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,581 @@
     1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include <f32file.h>
    1.20 +#include <e32math.h>
    1.21 +#include <s32mem.h> 
    1.22 +#include "MmfBtDevSoundProxy.h"
    1.23 +#include "MmfBtDevSoundServerStart.h"
    1.24 +#include "../../../inc/common/mmfBtBase.hrh"
    1.25 +#include "MmfBtAudioClientServer.h"
    1.26 +
    1.27 +
    1.28 +EXPORT_C void RMMFDevSoundProxy::Close()
    1.29 +	{
    1.30 +	RMmfSessionBase::Close();
    1.31 +	delete iBuffer;
    1.32 +	delete iSeqName;
    1.33 +	}
    1.34 +
    1.35 +EXPORT_C TInt RMMFDevSoundProxy::Open()
    1.36 +	{
    1.37 +	TInt err = KErrNone;
    1.38 +	RMMFAudioServerProxy* audioServerProxy = NULL;
    1.39 +	HBufC* devSoundServerName = NULL;
    1.40 +	iBuffer = NULL;
    1.41 +	iSeqName = NULL;
    1.42 +	TRAP(err, iSeqName = HBufC::NewL(KMaxFixedSequenceNameLength));
    1.43 +	if(err)
    1.44 +		{
    1.45 +		iSeqName = NULL;
    1.46 +		return err;
    1.47 +		}
    1.48 +
    1.49 +	TRAP(err, audioServerProxy = new (ELeave) RMMFAudioServerProxy());
    1.50 +	if(err != KErrNone)
    1.51 +		{
    1.52 +		delete iSeqName;
    1.53 +		iSeqName = NULL;
    1.54 +		return err;
    1.55 +		}
    1.56 +
    1.57 +	err = audioServerProxy->Open();
    1.58 +	if(err != KErrNone)
    1.59 +		{
    1.60 +		delete audioServerProxy;
    1.61 +		delete iSeqName;
    1.62 +		iSeqName = NULL;
    1.63 +		return err;
    1.64 +		}
    1.65 +
    1.66 +
    1.67 +	TRAP(err, devSoundServerName = audioServerProxy->GetDevSoundServerNameL());
    1.68 +	if(err)
    1.69 +		{
    1.70 +		audioServerProxy->Close();
    1.71 +		delete audioServerProxy;
    1.72 +		delete iSeqName;
    1.73 +		iSeqName = NULL;
    1.74 +		return err;
    1.75 +		}
    1.76 +
    1.77 +	TPtr devSoundServerNamePtr = devSoundServerName->Des();
    1.78 + 
    1.79 +	TInt retry=2;
    1.80 +	for (;;)
    1.81 +		{
    1.82 +		err = CreateSession(devSoundServerNamePtr, TVersion(KMMFDevSoundServerVersion,
    1.83 +														KMMFDevSoundServerMinorVersionNumber,
    1.84 +														KMMFDevSoundServerBuildVersionNumber));
    1.85 +
    1.86 +		if (err!=KErrNotFound && err!=KErrServerTerminated)
    1.87 +			break;//return r;
    1.88 +		if (--retry==0)
    1.89 +			break;//return r;
    1.90 +		}
    1.91 +
    1.92 +	if(err)
    1.93 +		{
    1.94 +		delete iSeqName;
    1.95 +		iSeqName = NULL;
    1.96 +		}
    1.97 +	audioServerProxy->Close();
    1.98 +	delete audioServerProxy;
    1.99 +	delete devSoundServerName;
   1.100 +
   1.101 +	return err;
   1.102 +	}
   1.103 +
   1.104 +EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo()
   1.105 +	{
   1.106 +	return SendReceive(EMMFAudioLaunchRequests);
   1.107 +	}
   1.108 +
   1.109 +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TMMFState aMode)
   1.110 +	{
   1.111 +	TMMFDevSoundProxySettings set;
   1.112 +	set.iMode = aMode;
   1.113 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.114 +	return SendReceive(EMMFDevSoundProxyInitialize1, pckg);
   1.115 +	}
   1.116 +
   1.117 +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TUid aHWDev, TMMFState aMode)
   1.118 +	{
   1.119 +	TMMFDevSoundProxySettings set;
   1.120 +	set.iHWDev = aHWDev;
   1.121 +	set.iMode = aMode;
   1.122 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.123 +	return SendReceive(EMMFDevSoundProxyInitialize2, pckg);
   1.124 +	}
   1.125 +
   1.126 +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(CArrayPtr<TUid> /*aHWDevArray*/, TMMFState /*aMode*/)
   1.127 +	{
   1.128 +	return SendReceive(EMMFDevSoundProxyInitialize3);
   1.129 +	}
   1.130 +
   1.131 +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TFourCC aDesiredFourCC, TMMFState aMode)
   1.132 +	{
   1.133 +	TMMFDevSoundProxySettings set;
   1.134 +	set.iDesiredFourCC = aDesiredFourCC;
   1.135 +	set.iMode = aMode;
   1.136 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.137 +	return SendReceive(EMMFDevSoundProxyInitialize4, pckg);
   1.138 +	}
   1.139 +
   1.140 +EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities()
   1.141 +	{
   1.142 +	TMMFDevSoundProxySettings set;
   1.143 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.144 +	SendReceiveResult(EMMFDevSoundProxyCapabilities,KNullDesC8,KNullDesC8,pckg);
   1.145 +	return pckg().iCaps;
   1.146 +	}
   1.147 +
   1.148 +EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config()
   1.149 +	{
   1.150 +	TMMFDevSoundProxySettings set;
   1.151 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.152 +	SendReceiveResult(EMMFDevSoundProxyConfig,KNullDesC8,KNullDesC8,pckg);
   1.153 +	return pckg().iConfig;
   1.154 +	}
   1.155 +
   1.156 +EXPORT_C TInt RMMFDevSoundProxy::SetConfigL(const TMMFCapabilities& aConfig)
   1.157 +	{
   1.158 +	TMMFDevSoundProxySettings set;
   1.159 +	set.iConfig = aConfig;
   1.160 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.161 +	return SendReceive(EMMFDevSoundProxySetConfig, pckg);
   1.162 +	}
   1.163 +
   1.164 +EXPORT_C TInt RMMFDevSoundProxy::MaxVolume()
   1.165 +	{
   1.166 +	TMMFDevSoundProxySettings set;
   1.167 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.168 +	SendReceiveResult(EMMFDevSoundProxyMaxVolume,KNullDesC8,KNullDesC8,pckg);
   1.169 +	return pckg().iMaxVolume;
   1.170 +	}
   1.171 +
   1.172 +EXPORT_C TInt RMMFDevSoundProxy::Volume()
   1.173 +	{
   1.174 +	TMMFDevSoundProxySettings set;
   1.175 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.176 +	SendReceiveResult(EMMFDevSoundProxyVolume,KNullDesC8,KNullDesC8,pckg);
   1.177 +	return pckg().iVolume;
   1.178 +	}
   1.179 +
   1.180 +EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume)
   1.181 +	{
   1.182 +	TMMFDevSoundProxySettings set;
   1.183 +	set.iVolume = aVolume;
   1.184 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.185 +	return SendReceive(EMMFDevSoundProxySetVolume, pckg);
   1.186 +	}
   1.187 +
   1.188 +EXPORT_C TInt RMMFDevSoundProxy::MaxGain()
   1.189 +	{
   1.190 +	TMMFDevSoundProxySettings set;
   1.191 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.192 +	SendReceiveResult(EMMFDevSoundProxyMaxGain,KNullDesC8,KNullDesC8,pckg);
   1.193 +	return pckg().iMaxGain;
   1.194 +	}
   1.195 +
   1.196 +EXPORT_C TInt RMMFDevSoundProxy::Gain()
   1.197 +	{
   1.198 +	TMMFDevSoundProxySettings set;
   1.199 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.200 +	SendReceiveResult(EMMFDevSoundProxyGain,KNullDesC8,KNullDesC8,pckg);
   1.201 +	return pckg().iGain;
   1.202 +	}
   1.203 +
   1.204 +EXPORT_C TInt RMMFDevSoundProxy::SetGain(TInt aGain)
   1.205 +	{
   1.206 +	TMMFDevSoundProxySettings set;
   1.207 +	set.iGain = aGain;
   1.208 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.209 +	return SendReceive(EMMFDevSoundProxySetGain, pckg);
   1.210 +	}
   1.211 +
   1.212 +EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
   1.213 +	{
   1.214 +	TMMFDevSoundProxySettings set;
   1.215 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.216 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance,KNullDesC8,KNullDesC8,pckg));
   1.217 +	aLeftPercentage = pckg().iLeftPercentage;
   1.218 +	aRightPercentage = pckg().iRightPercentage;
   1.219 +	}
   1.220 +
   1.221 +EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
   1.222 +	{
   1.223 +	TMMFDevSoundProxySettings set;
   1.224 +	set.iLeftPercentage = aLeftPercentage;
   1.225 +	set.iRightPercentage = aRightPercentage;
   1.226 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.227 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance, pckg));
   1.228 +	}
   1.229 +
   1.230 +EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
   1.231 +	{
   1.232 +	TMMFDevSoundProxySettings set;
   1.233 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.234 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance,KNullDesC8,KNullDesC8,pckg));
   1.235 +	aLeftPercentage = pckg().iLeftPercentage;
   1.236 +	aRightPercentage = pckg().iRightPercentage;
   1.237 +	}
   1.238 +
   1.239 +EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
   1.240 +	{
   1.241 +	TMMFDevSoundProxySettings set;
   1.242 +	set.iLeftPercentage = aLeftPercentage;
   1.243 +	set.iRightPercentage = aRightPercentage;
   1.244 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.245 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance, pckg));
   1.246 +	}
   1.247 +
   1.248 +EXPORT_C void RMMFDevSoundProxy::PlayInitL()
   1.249 +	{
   1.250 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit));
   1.251 +	}
   1.252 +
   1.253 +EXPORT_C void RMMFDevSoundProxy::RecordInitL()
   1.254 +	{
   1.255 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit));
   1.256 +	}
   1.257 +
   1.258 +EXPORT_C void RMMFDevSoundProxy::PlayData()
   1.259 +	{
   1.260 +	TMMFDevSoundProxyHwBuf set;
   1.261 +	set.iLastBuffer = iBuffer->LastBuffer();
   1.262 +	TMMFDevSoundProxyHwBufPckg pckg(set);
   1.263 +	
   1.264 +	SendReceive(EMMFDevSoundProxyPlayData, pckg, iBuffer->Data());
   1.265 +	}
   1.266 +
   1.267 +EXPORT_C void RMMFDevSoundProxy::RecordData()
   1.268 +	{
   1.269 +	SendReceive(EMMFDevSoundProxyRecordData);
   1.270 +	}
   1.271 +
   1.272 +EXPORT_C void RMMFDevSoundProxy::Stop()
   1.273 +	{
   1.274 +	SendReceive(EMMFDevSoundProxyStop);
   1.275 +	}
   1.276 +
   1.277 +EXPORT_C void RMMFDevSoundProxy::Pause()
   1.278 +	{
   1.279 +	SendReceive(EMMFDevSoundProxyPause);
   1.280 +	}
   1.281 +
   1.282 +EXPORT_C void RMMFDevSoundProxy::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration)
   1.283 +	{
   1.284 +	TMMFDevSoundProxySettings set;
   1.285 +	set.iFrequencyOne = aFrequency;
   1.286 +	set.iDuration = aDuration;
   1.287 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.288 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone, pckg));
   1.289 +	}
   1.290 +
   1.291 +EXPORT_C void RMMFDevSoundProxy::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration)
   1.292 +	{
   1.293 +	TMMFDevSoundProxySettings set;
   1.294 +	set.iFrequencyOne = aFrequencyOne;
   1.295 +	set.iFrequencyTwo = aFrequencyTwo;
   1.296 +	set.iDuration = aDuration;
   1.297 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.298 +	SendReceive(EMMFDevSoundProxyPlayDualTone, pckg);
   1.299 +	}
   1.300 +
   1.301 +EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString)
   1.302 +	{
   1.303 +	SendReceive(EMMFDevSoundProxyPlayDTMFString, aDTMFString);
   1.304 +	}
   1.305 +
   1.306 +EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData)
   1.307 +	{
   1.308 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence, aData));
   1.309 +	}
   1.310 +
   1.311 +EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber)
   1.312 +	{
   1.313 +	TPckgBuf<TInt> seqNum(aSequenceNumber);	
   1.314 +	SendReceive(EMMFDevSoundProxyPlayFixedSequence, seqNum);
   1.315 +	}
   1.316 +
   1.317 +EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
   1.318 +											    TTimeIntervalMicroSeconds32& aToneOffLength,
   1.319 +											    TTimeIntervalMicroSeconds32& aPauseLength)
   1.320 +	{
   1.321 +	TMMFDevSoundProxySettings set;
   1.322 +	set.iToneOnLength = aToneOnLength;
   1.323 +	set.iToneOffLength = aToneOffLength;
   1.324 +	set.iPauseLength = aPauseLength;
   1.325 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.326 +	SendReceive(EMMFDevSoundProxySetDTMFLengths, pckg);
   1.327 +	}
   1.328 +
   1.329 +EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
   1.330 +	{
   1.331 +	TMMFDevSoundProxySettings set;
   1.332 +	set.iDuration = aRampDuration;
   1.333 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.334 +	SendReceive(EMMFDevSoundProxySetVolumeRamp, pckg);
   1.335 +	}
   1.336 +
   1.337 +EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings)
   1.338 +	{
   1.339 +	aSupportedDataTypes.Reset();
   1.340 +
   1.341 +	TMMFPrioritySettings prioritySet = aPrioritySettings;
   1.342 +	TMMFPrioritySettingsPckg pckg(prioritySet);
   1.343 +
   1.344 +	TPckgBuf<TInt> numberOfElementsPckg;
   1.345 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedInputDataTypes, pckg, KNullDesC8, numberOfElementsPckg));
   1.346 +
   1.347 +	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
   1.348 +	TPtr8 ptr = buf->Des();
   1.349 +
   1.350 +	
   1.351 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr));
   1.352 +	RDesReadStream stream(ptr);
   1.353 +	CleanupClosePushL(stream);
   1.354 +
   1.355 +	for (TInt i=0; i<numberOfElementsPckg(); i++)
   1.356 +		{
   1.357 +		TInt err = aSupportedDataTypes.Append(stream.ReadInt32L());
   1.358 +		if (err)
   1.359 +			{//note we don't destroy array because we don't own it
   1.360 +			//but we do reset it as it is incomplete
   1.361 +			aSupportedDataTypes.Reset();
   1.362 +			User::Leave(err);
   1.363 +			}
   1.364 +		}
   1.365 +	CleanupStack::PopAndDestroy(2, buf);//stream, buf
   1.366 +	}
   1.367 +
   1.368 +
   1.369 +EXPORT_C void RMMFDevSoundProxy::GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings)
   1.370 +	{
   1.371 +	aSupportedDataTypes.Reset();
   1.372 +
   1.373 +	TMMFPrioritySettings prioritySet = aPrioritySettings;
   1.374 +	TMMFPrioritySettingsPckg pckg(prioritySet);
   1.375 +
   1.376 +	TPckgBuf<TInt> numberOfElementsPckg;
   1.377 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedOutputDataTypes, pckg, KNullDesC8, numberOfElementsPckg));
   1.378 +
   1.379 +	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
   1.380 +	TPtr8 ptr = buf->Des();
   1.381 +
   1.382 +	
   1.383 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr));
   1.384 +	RDesReadStream stream(ptr);
   1.385 +	CleanupClosePushL(stream);
   1.386 +
   1.387 +	for (TInt i=0; i<numberOfElementsPckg(); i++)
   1.388 +		{
   1.389 +		TInt err = aSupportedDataTypes.Append(stream.ReadInt32L());
   1.390 +		if (err)
   1.391 +			{//note we don't destroy array because we don't own it
   1.392 +			//but we do reset it as it is incomplete
   1.393 +			aSupportedDataTypes.Reset();
   1.394 +			User::Leave(err);
   1.395 +			}
   1.396 +		}
   1.397 +	CleanupStack::PopAndDestroy(2, buf);//stream, buf
   1.398 +	}
   1.399 +
   1.400 +EXPORT_C TInt RMMFDevSoundProxy::SamplesRecorded()
   1.401 +	{
   1.402 +	TPckgBuf<TInt> numSamples;	
   1.403 +	SendReceiveResult(EMMFDevSoundProxySamplesRecorded, KNullDesC8, KNullDesC8, numSamples);
   1.404 +	return numSamples();
   1.405 +	}
   1.406 +
   1.407 +EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed()
   1.408 +	{
   1.409 +	TPckgBuf<TInt> numSamples;	
   1.410 +	SendReceiveResult(EMMFDevSoundProxySamplesPlayed, KNullDesC8, KNullDesC8, numSamples);
   1.411 +	return numSamples();
   1.412 +	}
   1.413 +
   1.414 +EXPORT_C void RMMFDevSoundProxy::SetToneRepeats(TInt aRepeatCount, const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
   1.415 +	{
   1.416 +	TPckgBuf<TInt> countRepeat(aRepeatCount);
   1.417 +	TPckgBuf<TTimeIntervalMicroSeconds> repeatTS(aRepeatTrailingSilence);	
   1.418 +	SendReceive(EMMFDevSoundProxySetToneRepeats, countRepeat, repeatTS);
   1.419 +	}
   1.420 +
   1.421 +EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
   1.422 +	{
   1.423 +	TPckgBuf<TMMFPrioritySettings> prioritySet(aPrioritySettings);
   1.424 +	SendReceive(EMMFDevSoundProxySetPrioritySettings, prioritySet);
   1.425 +	}
   1.426 +
   1.427 +EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt aSequenceNumber)
   1.428 +	{
   1.429 +	TPckgBuf<TInt> seqNum(aSequenceNumber);
   1.430 +	TPtr SeqNamePtr = iSeqName->Des();
   1.431 +	SeqNamePtr.FillZ();
   1.432 +	SendReceiveResult(EMMFDevSoundProxyFixedSequenceName, seqNum, KNullDesC8, SeqNamePtr);
   1.433 +	return *iSeqName;
   1.434 +	}
   1.435 +
   1.436 +
   1.437 +EXPORT_C void RMMFDevSoundProxy::ConvertInitL()
   1.438 +	{
   1.439 +	SendReceive(EMMFDevSoundProxyConvertInit);
   1.440 +	}
   1.441 +
   1.442 +EXPORT_C void RMMFDevSoundProxy::ConvertData()
   1.443 +	{
   1.444 +	SendReceive(EMMFDevSoundProxyConvertData);
   1.445 +	}
   1.446 +
   1.447 +EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid /*aInterfaceId*/)
   1.448 +	{
   1.449 +	// No custom interfaces are supported at the moment so return NULL.
   1.450 +	//TO DO
   1.451 +	return NULL;
   1.452 +	}
   1.453 +
   1.454 +EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount()
   1.455 +	{
   1.456 +	TPckgBuf<TInt> fixSeqCountPckg;
   1.457 +	SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount, fixSeqCountPckg);
   1.458 +	return fixSeqCountPckg();
   1.459 +	}
   1.460 +
   1.461 +EXPORT_C void RMMFDevSoundProxy::ReceiveInitializeCompleteEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
   1.462 +	{
   1.463 +	aStatus = KRequestPending;
   1.464 +	SendReceive(EMMFDevSoundProxyReceiveICEvent, aSetPckg, aStatus);
   1.465 +	}
   1.466 +
   1.467 +EXPORT_C void RMMFDevSoundProxy::CancelReceiveInitializeCompleteEvent()
   1.468 +	{
   1.469 +	SendReceive(EMMFDevSoundProxyCancelReceiveICEvent);
   1.470 +	}
   1.471 +
   1.472 +EXPORT_C void RMMFDevSoundProxy::ReceiveBufferToBeFilledEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
   1.473 +	{
   1.474 +	aStatus = KRequestPending;
   1.475 +	SendReceiveResult(EMMFDevSoundProxyReceiveBTBFEvent, aSetPckg, aStatus);
   1.476 +	}
   1.477 +
   1.478 +EXPORT_C void RMMFDevSoundProxy::CancelReceiveBufferToBeFilledEvent()
   1.479 +	{
   1.480 +	SendReceive(EMMFDevSoundProxyCancelReceiveBTBFEvent);
   1.481 +	}
   1.482 +
   1.483 +EXPORT_C void RMMFDevSoundProxy::ReceiveBufferToBeEmptiedEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
   1.484 +	{
   1.485 +	aStatus = KRequestPending;
   1.486 +	SendReceiveResult(EMMFDevSoundProxyReceiveBTBEEvent, aSetPckg, aStatus);
   1.487 +	}
   1.488 +
   1.489 +EXPORT_C void RMMFDevSoundProxy::CancelReceiveBufferToBeEmptiedEvent()
   1.490 +	{
   1.491 +	SendReceive(EMMFDevSoundProxyCancelReceiveBTBEEvent);
   1.492 +	}
   1.493 +
   1.494 +EXPORT_C void RMMFDevSoundProxy::ReceivePlayErrorEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
   1.495 +	{
   1.496 +	aStatus = KRequestPending;
   1.497 +	SendReceive(EMMFDevSoundProxyReceivePEEvent, aSetPckg, aStatus);
   1.498 +	}
   1.499 +
   1.500 +EXPORT_C void RMMFDevSoundProxy::CancelReceivePlayErrorEvent()
   1.501 +	{
   1.502 +	SendReceive(EMMFDevSoundProxyCancelReceivePEEvent);
   1.503 +	}
   1.504 +
   1.505 +EXPORT_C void RMMFDevSoundProxy::ReceiveRecordErrorEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
   1.506 +	{
   1.507 +	aStatus = KRequestPending;
   1.508 +	SendReceive(EMMFDevSoundProxyReceiveREEvent, aSetPckg, aStatus);
   1.509 +	}
   1.510 +
   1.511 +EXPORT_C void RMMFDevSoundProxy::CancelReceiveRecordErrorEvent()
   1.512 +	{
   1.513 +	SendReceive(EMMFDevSoundProxyCancelReceiveREEvent);
   1.514 +	}
   1.515 +
   1.516 +EXPORT_C void RMMFDevSoundProxy::ReceiveToneFinishedEvent(TMMFDevSoundProxyHwBufPckg& aSetPckg, TRequestStatus& aStatus)
   1.517 +	{
   1.518 +	aStatus = KRequestPending;
   1.519 +	SendReceive(EMMFDevSoundProxyReceiveTFEvent, aSetPckg, aStatus);
   1.520 +	}
   1.521 +
   1.522 +EXPORT_C void RMMFDevSoundProxy::CancelReceiveToneFinishedEvent()
   1.523 +	{
   1.524 +	SendReceive(EMMFDevSoundProxyCancelReceiveTFEvent);
   1.525 +	}
   1.526 +
   1.527 +EXPORT_C void RMMFDevSoundProxy::ReceiveSendEventToClientEvent(TMMFEventPckg& aEventPckg, TRequestStatus& aStatus)
   1.528 +	{
   1.529 +	aStatus = KRequestPending;
   1.530 +	SendReceiveResult(EMMFDevSoundProxyReceiveSETCEvent, aEventPckg, aStatus);
   1.531 +	}
   1.532 +
   1.533 +EXPORT_C void RMMFDevSoundProxy::CancelReceiveSendEventToClientEvent()
   1.534 +	{
   1.535 +	SendReceive(EMMFDevSoundProxyCancelReceiveSETCEvent);
   1.536 +	}
   1.537 +
   1.538 +EXPORT_C void RMMFDevSoundProxy::SetBuffer(CMMFDataBuffer* aBuffer)
   1.539 +	{
   1.540 +	if(iBuffer)
   1.541 +		delete iBuffer;
   1.542 +	iBuffer = aBuffer;
   1.543 +	}
   1.544 +
   1.545 +EXPORT_C TInt RMMFDevSoundProxy::GetRecordedBufferL(CMMFDataBuffer& aBuffer)
   1.546 +	{
   1.547 +	return SendReceiveResult(EMMFDevSoundProxyGetRecordedBuffer, aBuffer.Data());
   1.548 +	}
   1.549 +	
   1.550 +EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
   1.551 +	{
   1.552 +	TMMFDevSoundProxySettings set;
   1.553 +	set.iNotificationEventUid = aEventType;
   1.554 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.555 +	return SendReceive(EMMFDevSoundProxyRequestResourceNotification, pckg, aNotificationRegistrationData);
   1.556 +	}
   1.557 +
   1.558 +EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType)
   1.559 +	{
   1.560 +	TMMFDevSoundProxySettings set;
   1.561 +	set.iNotificationEventUid = aEventType;
   1.562 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.563 +	return SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, pckg);
   1.564 +	}
   1.565 +	
   1.566 +EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData)
   1.567 +	{
   1.568 +	TMMFDevSoundProxySettings set;
   1.569 +	set.iNotificationEventUid = aEventType;
   1.570 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.571 +	return SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, pckg,KNullDesC8,aNotificationData);
   1.572 +	}
   1.573 +
   1.574 +EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay()
   1.575 +	{
   1.576 +	return SendReceive(EMMFDevSoundProxyWillResumePlay);
   1.577 +	}
   1.578 +
   1.579 +EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid)
   1.580 +	{
   1.581 +	TPckgBuf<TThreadId> threadId(aTid);
   1.582 +	return SendReceive(EMMFDevSoundProxySetClientThreadInfo, threadId);
   1.583 +	}
   1.584 +