os/mm/devsound/devsoundrefplugin/src/platsec/client/MmfDevSoundProxy.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/devsoundrefplugin/src/platsec/client/MmfDevSoundProxy.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,545 @@
     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 "MmfDevSoundProxy.h"
    1.23 +#include "MmfDevSoundServerStart.h"
    1.24 +#include "MmfBase.hrh"
    1.25 +#include "MmfAudioClientServer.h"
    1.26 +#include <mmf/plugin/mmfdevsoundcustominterface.hrh>
    1.27 +#include <ecom/ecom.h>
    1.28 +
    1.29 +
    1.30 +/**
    1.31 +@internalTechnology
    1.32 +
    1.33 +This function raises a panic
    1.34 +
    1.35 +@param	aError
    1.36 +		one of the several panic codes that may be raised by this dll
    1.37 +
    1.38 +@panic	EMMFDevSoundProxyPlayDataWithoutInitialize is raised when playdata is called without initialization
    1.39 +@panic	EMMFDevSoundProxyRecordDataWithoutInitialize is raised when recorddata is called without initialization
    1.40 +@panic	EMMFDevSoundProxyConvertDataWithoutInitialize is raised when convertdata is called without initialization
    1.41 +*/
    1.42 +GLDEF_C void Panic(TMMFDevSoundProxyPanicCodes aPanicCode)
    1.43 +	{
    1.44 +	User::Panic(KMMFDevSoundProxyPanicCategory, aPanicCode);
    1.45 +	}
    1.46 +	
    1.47 +EXPORT_C RMMFDevSoundProxy::RMMFDevSoundProxy()
    1.48 + : iBuffer(NULL), iSeqName(NULL), iMsgQueueHandle(NULL), iAudioServerProxy (NULL)
    1.49 + 	{ 		
    1.50 + 	}
    1.51 +	
    1.52 +EXPORT_C void RMMFDevSoundProxy::Close()
    1.53 +	{
    1.54 +	RMmfSessionBase::Close();
    1.55 +	iState = EIdle;
    1.56 +	if(iAudioServerProxy)
    1.57 +		{
    1.58 +		iAudioServerProxy->Close();
    1.59 +		delete iAudioServerProxy;	
    1.60 +		}
    1.61 +	delete iBuffer;
    1.62 +	delete iSeqName;
    1.63 +	}
    1.64 +
    1.65 +EXPORT_C TInt RMMFDevSoundProxy::Open(RHandleBase& aMsgQueueHandle)
    1.66 +	{
    1.67 +	TInt err = KErrNone;
    1.68 +	iMsgQueueHandle = &aMsgQueueHandle;
    1.69 +	TRAP(err, iSeqName = HBufC::NewL(KMaxFixedSequenceNameLength));
    1.70 +	if(err == KErrNone)
    1.71 +		{
    1.72 +		TRAP(err, iAudioServerProxy = new (ELeave) RMMFAudioServerProxy());	
    1.73 +		if(err == KErrNone)
    1.74 +			{
    1.75 +			err = iAudioServerProxy->Open();
    1.76 +			if(err == KErrNone)
    1.77 +				{
    1.78 +				err = SetReturnedHandle(iAudioServerProxy->GetDevSoundSessionHandle());	
    1.79 +				}
    1.80 +			}
    1.81 +		}
    1.82 +	if(err)
    1.83 +		{
    1.84 +		Close();
    1.85 +		}
    1.86 +			
    1.87 +	return err;
    1.88 +	}
    1.89 +EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo()
    1.90 +	{
    1.91 +	return SendReceive(EMMFAudioLaunchRequests);
    1.92 +	}
    1.93 +
    1.94 +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TMMFState aMode)
    1.95 +	{
    1.96 +	TMMFDevSoundProxySettings set;
    1.97 +	set.iMode = aMode;
    1.98 +	TMMFDevSoundProxySettingsPckg pckg(set);
    1.99 +	TIpcArgs args(&pckg, *iMsgQueueHandle);
   1.100 +	return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize1, args);
   1.101 +	}
   1.102 +
   1.103 +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TUid aHWDev, TMMFState aMode)
   1.104 +	{
   1.105 +	TMMFDevSoundProxySettings set;
   1.106 +	set.iHWDev = aHWDev;
   1.107 +	set.iMode = aMode;
   1.108 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.109 +	TIpcArgs args(&pckg, *iMsgQueueHandle);
   1.110 +	return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize2, args);
   1.111 +	}
   1.112 +
   1.113 +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TFourCC aDesiredFourCC, TMMFState aMode)
   1.114 +	{
   1.115 +	TMMFDevSoundProxySettings set;
   1.116 +	set.iDesiredFourCC = aDesiredFourCC;
   1.117 +	set.iMode = aMode;
   1.118 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.119 +	TIpcArgs args(&pckg, *iMsgQueueHandle);
   1.120 +	return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize4, args);
   1.121 +	}
   1.122 +
   1.123 +EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities()
   1.124 +	{
   1.125 +	TMMFDevSoundProxySettings set;
   1.126 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.127 +	SendReceiveResult(EMMFDevSoundProxyCapabilities,KNullDesC8,KNullDesC8,pckg);
   1.128 +	return pckg().iCaps;
   1.129 +	}
   1.130 +
   1.131 +EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config()
   1.132 +	{
   1.133 +	TMMFDevSoundProxySettings set;
   1.134 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.135 +	SendReceiveResult(EMMFDevSoundProxyConfig,KNullDesC8,KNullDesC8,pckg);
   1.136 +	return pckg().iConfig;
   1.137 +	}
   1.138 +
   1.139 +EXPORT_C TInt RMMFDevSoundProxy::SetConfigL(const TMMFCapabilities& aConfig)
   1.140 +	{
   1.141 +	TMMFDevSoundProxySettings set;
   1.142 +	set.iConfig = aConfig;
   1.143 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.144 +	TInt err = SendReceive(EMMFDevSoundProxySetConfig, pckg);
   1.145 +	User::LeaveIfError(err);	
   1.146 +	return err;
   1.147 +	}
   1.148 +
   1.149 +EXPORT_C TInt RMMFDevSoundProxy::MaxVolume()
   1.150 +	{
   1.151 +	TMMFDevSoundProxySettings set;
   1.152 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.153 +	SendReceiveResult(EMMFDevSoundProxyMaxVolume,KNullDesC8,KNullDesC8,pckg);
   1.154 +	return pckg().iMaxVolume;
   1.155 +	}
   1.156 +
   1.157 +EXPORT_C TInt RMMFDevSoundProxy::Volume()
   1.158 +	{
   1.159 +	TMMFDevSoundProxySettings set;
   1.160 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.161 +	SendReceiveResult(EMMFDevSoundProxyVolume,KNullDesC8,KNullDesC8,pckg);
   1.162 +	return pckg().iVolume;
   1.163 +	}
   1.164 +
   1.165 +EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume)
   1.166 +	{
   1.167 +	TMMFDevSoundProxySettings set;
   1.168 +	set.iVolume = aVolume;
   1.169 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.170 +	return SendReceive(EMMFDevSoundProxySetVolume, pckg);
   1.171 +	}
   1.172 +
   1.173 +EXPORT_C TInt RMMFDevSoundProxy::MaxGain()
   1.174 +	{
   1.175 +	TMMFDevSoundProxySettings set;
   1.176 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.177 +	SendReceiveResult(EMMFDevSoundProxyMaxGain,KNullDesC8,KNullDesC8,pckg);
   1.178 +	return pckg().iMaxGain;
   1.179 +	}
   1.180 +
   1.181 +EXPORT_C TInt RMMFDevSoundProxy::Gain()
   1.182 +	{
   1.183 +	TMMFDevSoundProxySettings set;
   1.184 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.185 +	SendReceiveResult(EMMFDevSoundProxyGain,KNullDesC8,KNullDesC8,pckg);
   1.186 +	return pckg().iGain;
   1.187 +	}
   1.188 +
   1.189 +EXPORT_C TInt RMMFDevSoundProxy::SetGain(TInt aGain)
   1.190 +	{
   1.191 +	TMMFDevSoundProxySettings set;
   1.192 +	set.iGain = aGain;
   1.193 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.194 +	return SendReceive(EMMFDevSoundProxySetGain, pckg);
   1.195 +	}
   1.196 +
   1.197 +EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
   1.198 +	{
   1.199 +	TMMFDevSoundProxySettings set;
   1.200 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.201 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance,KNullDesC8,KNullDesC8,pckg));
   1.202 +	aLeftPercentage = pckg().iLeftPercentage;
   1.203 +	aRightPercentage = pckg().iRightPercentage;
   1.204 +	}
   1.205 +
   1.206 +EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
   1.207 +	{
   1.208 +	TMMFDevSoundProxySettings set;
   1.209 +	set.iLeftPercentage = aLeftPercentage;
   1.210 +	set.iRightPercentage = aRightPercentage;
   1.211 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.212 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance, pckg));
   1.213 +	}
   1.214 +
   1.215 +EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
   1.216 +	{
   1.217 +	TMMFDevSoundProxySettings set;
   1.218 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.219 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance,KNullDesC8,KNullDesC8,pckg));
   1.220 +	aLeftPercentage = pckg().iLeftPercentage;
   1.221 +	aRightPercentage = pckg().iRightPercentage;
   1.222 +	}
   1.223 +
   1.224 +EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
   1.225 +	{
   1.226 +	TMMFDevSoundProxySettings set;
   1.227 +	set.iLeftPercentage = aLeftPercentage;
   1.228 +	set.iRightPercentage = aRightPercentage;
   1.229 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.230 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance, pckg));
   1.231 +	}
   1.232 +
   1.233 +EXPORT_C void RMMFDevSoundProxy::PlayInitL()
   1.234 +	{
   1.235 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit));
   1.236 +	iState = EPlaying;
   1.237 +	}
   1.238 +
   1.239 +EXPORT_C void RMMFDevSoundProxy::RecordInitL()
   1.240 +	{
   1.241 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit));
   1.242 +	iState = ERecording;
   1.243 +	}
   1.244 +
   1.245 +EXPORT_C void RMMFDevSoundProxy::PlayData()
   1.246 +	{
   1.247 +	__ASSERT_ALWAYS(iState == EPlaying, Panic(EMMFDevSoundProxyPlayDataWithoutInitialize));
   1.248 +
   1.249 +	TMMFDevSoundProxyHwBuf set;
   1.250 +	set.iLastBuffer = iBuffer->LastBuffer();	
   1.251 +	TMMFDevSoundProxyHwBufPckg pckg(set);
   1.252 +	SendReceive(EMMFDevSoundProxyPlayData, pckg, iBuffer->Data());
   1.253 +	}
   1.254 +
   1.255 +EXPORT_C void RMMFDevSoundProxy::RecordData()
   1.256 +	{
   1.257 +	__ASSERT_ALWAYS(iState == ERecording, Panic(EMMFDevSoundProxyRecordDataWithoutInitialize));
   1.258 +	SendReceive(EMMFDevSoundProxyRecordData);
   1.259 +	}
   1.260 +
   1.261 +EXPORT_C void RMMFDevSoundProxy::Stop()
   1.262 +	{
   1.263 +	SendReceive(EMMFDevSoundProxyStop);
   1.264 +	iState = EIdle;
   1.265 +	}
   1.266 +
   1.267 +EXPORT_C void RMMFDevSoundProxy::Pause()
   1.268 +	{
   1.269 +	SendReceive(EMMFDevSoundProxyPause);
   1.270 +	}
   1.271 +
   1.272 +EXPORT_C void RMMFDevSoundProxy::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration)
   1.273 +	{
   1.274 +	TMMFDevSoundProxySettings set;
   1.275 +	set.iFrequencyOne = aFrequency;
   1.276 +	set.iDuration = aDuration;
   1.277 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.278 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone, pckg));
   1.279 +	}
   1.280 +
   1.281 +EXPORT_C void RMMFDevSoundProxy::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration)
   1.282 +	{
   1.283 +	TMMFDevSoundProxySettings set;
   1.284 +	set.iFrequencyOne = aFrequencyOne;
   1.285 +	set.iFrequencyTwo = aFrequencyTwo;
   1.286 +	set.iDuration = aDuration;
   1.287 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.288 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDualTone, pckg));
   1.289 +	}
   1.290 +
   1.291 +EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString)
   1.292 +	{
   1.293 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDTMFString, aDTMFString));
   1.294 +	}
   1.295 +
   1.296 +EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData)
   1.297 +	{
   1.298 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence, aData));
   1.299 +	}
   1.300 +
   1.301 +EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber)
   1.302 +	{
   1.303 +	TPckgBuf<TInt> seqNum(aSequenceNumber);	
   1.304 +	User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayFixedSequence, seqNum));
   1.305 +	}
   1.306 +
   1.307 +EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
   1.308 +											    TTimeIntervalMicroSeconds32& aToneOffLength,
   1.309 +											    TTimeIntervalMicroSeconds32& aPauseLength)
   1.310 +	{
   1.311 +	TMMFDevSoundProxySettings set;
   1.312 +	set.iToneOnLength = aToneOnLength;
   1.313 +	set.iToneOffLength = aToneOffLength;
   1.314 +	set.iPauseLength = aPauseLength;
   1.315 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.316 +	SendReceive(EMMFDevSoundProxySetDTMFLengths, pckg);
   1.317 +	}
   1.318 +
   1.319 +EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
   1.320 +	{
   1.321 +	TMMFDevSoundProxySettings set;
   1.322 +	set.iDuration = aRampDuration;
   1.323 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.324 +	SendReceive(EMMFDevSoundProxySetVolumeRamp, pckg);
   1.325 +	}
   1.326 +
   1.327 +EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings)
   1.328 +	{
   1.329 +	aSupportedDataTypes.Reset();
   1.330 +
   1.331 +	TMMFPrioritySettings prioritySet = aPrioritySettings;
   1.332 +	TMMFPrioritySettingsPckg pckg(prioritySet);
   1.333 +
   1.334 +	TPckgBuf<TInt> numberOfElementsPckg;
   1.335 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedInputDataTypes, pckg, KNullDesC8, numberOfElementsPckg));
   1.336 +
   1.337 +	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
   1.338 +	TPtr8 ptr = buf->Des();
   1.339 +
   1.340 +	
   1.341 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr));
   1.342 +	RDesReadStream stream(ptr);
   1.343 +	CleanupClosePushL(stream);
   1.344 +
   1.345 +	for (TInt i=0; i<numberOfElementsPckg(); i++)
   1.346 +		{
   1.347 +		TInt err = aSupportedDataTypes.Append(stream.ReadInt32L());
   1.348 +		if (err)
   1.349 +			{//note we don't destroy array because we don't own it
   1.350 +			//but we do reset it as it is incomplete
   1.351 +			aSupportedDataTypes.Reset();
   1.352 +			User::Leave(err);
   1.353 +			}
   1.354 +		}
   1.355 +	CleanupStack::PopAndDestroy(2, buf);//stream, buf
   1.356 +	}
   1.357 +
   1.358 +
   1.359 +EXPORT_C void RMMFDevSoundProxy::GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings)
   1.360 +	{
   1.361 +	aSupportedDataTypes.Reset();
   1.362 +
   1.363 +	TMMFPrioritySettings prioritySet = aPrioritySettings;
   1.364 +	TMMFPrioritySettingsPckg pckg(prioritySet);
   1.365 +
   1.366 +	TPckgBuf<TInt> numberOfElementsPckg;
   1.367 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedOutputDataTypes, pckg, KNullDesC8, numberOfElementsPckg));
   1.368 +
   1.369 +	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
   1.370 +	TPtr8 ptr = buf->Des();
   1.371 +
   1.372 +	
   1.373 +	User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr));
   1.374 +	RDesReadStream stream(ptr);
   1.375 +	CleanupClosePushL(stream);
   1.376 +
   1.377 +	for (TInt i=0; i<numberOfElementsPckg(); i++)
   1.378 +		{
   1.379 +		TInt err = aSupportedDataTypes.Append(stream.ReadInt32L());
   1.380 +		if (err)
   1.381 +			{//note we don't destroy array because we don't own it
   1.382 +			//but we do reset it as it is incomplete
   1.383 +			aSupportedDataTypes.Reset();
   1.384 +			User::Leave(err);
   1.385 +			}
   1.386 +		}
   1.387 +	CleanupStack::PopAndDestroy(2, buf);//stream, buf
   1.388 +	}
   1.389 +
   1.390 +EXPORT_C TInt RMMFDevSoundProxy::SamplesRecorded()
   1.391 +	{
   1.392 +	TPckgBuf<TInt> numSamples;	
   1.393 +	SendReceiveResult(EMMFDevSoundProxySamplesRecorded, KNullDesC8, KNullDesC8, numSamples);
   1.394 +	return numSamples();
   1.395 +	}
   1.396 +
   1.397 +EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed()
   1.398 +	{
   1.399 +	TPckgBuf<TInt> numSamples;	
   1.400 +	SendReceiveResult(EMMFDevSoundProxySamplesPlayed, KNullDesC8, KNullDesC8, numSamples);
   1.401 +	return numSamples();
   1.402 +	}
   1.403 +
   1.404 +EXPORT_C void RMMFDevSoundProxy::SetToneRepeats(TInt aRepeatCount, const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
   1.405 +	{
   1.406 +	TPckgBuf<TInt> countRepeat(aRepeatCount);
   1.407 +	TPckgBuf<TTimeIntervalMicroSeconds> repeatTS(aRepeatTrailingSilence);	
   1.408 +	SendReceive(EMMFDevSoundProxySetToneRepeats, countRepeat, repeatTS);
   1.409 +	}
   1.410 +
   1.411 +EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
   1.412 +	{
   1.413 +	TPckgBuf<TMMFPrioritySettings> prioritySet(aPrioritySettings);
   1.414 +	SendReceive(EMMFDevSoundProxySetPrioritySettings, prioritySet);
   1.415 +	}
   1.416 +
   1.417 +EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt aSequenceNumber)
   1.418 +	{
   1.419 +	TPckgBuf<TInt> seqNum(aSequenceNumber);
   1.420 +	TPtr SeqNamePtr = iSeqName->Des();
   1.421 +	SeqNamePtr.FillZ();
   1.422 +	SendReceiveResult(EMMFDevSoundProxyFixedSequenceName, seqNum, KNullDesC8, SeqNamePtr);
   1.423 +	return *iSeqName;
   1.424 +	}
   1.425 +
   1.426 +EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid /*aInterfaceId*/)
   1.427 +	{
   1.428 +	// No custom interfaces are supported at the moment so return NULL.
   1.429 +	//TO DO
   1.430 +	return NULL;
   1.431 +	}
   1.432 +
   1.433 +EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount()
   1.434 +	{
   1.435 +	TPckgBuf<TInt> fixSeqCountPckg;
   1.436 +	SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount, fixSeqCountPckg);
   1.437 +	return fixSeqCountPckg();
   1.438 +	}
   1.439 +
   1.440 +EXPORT_C TInt RMMFDevSoundProxy::BufferToBeFilledData(TMMFDevSoundProxyHwBufPckg& aSetPckg)
   1.441 +	{
   1.442 +	// Note that there will only ever be one of these requests outstanding per session
   1.443 +	return SendReceiveResult(EMMFDevSoundProxyBTBFData, aSetPckg);
   1.444 +	}
   1.445 +	
   1.446 +EXPORT_C TInt RMMFDevSoundProxy::BufferToBeEmptiedData(TMMFDevSoundProxyHwBufPckg& aSetPckg)
   1.447 +	{
   1.448 +	// Note that there will only ever be one of these requests outstanding per session
   1.449 +	return SendReceiveResult(EMMFDevSoundProxyBTBEData, aSetPckg);	
   1.450 +	}
   1.451 +
   1.452 +EXPORT_C void RMMFDevSoundProxy::SetBuffer(CMMFDataBuffer* aBuffer)
   1.453 +	{
   1.454 +	if(iBuffer)
   1.455 +		{
   1.456 +		delete iBuffer;
   1.457 +		}
   1.458 +	iBuffer = aBuffer;
   1.459 +	}
   1.460 +
   1.461 +EXPORT_C TInt RMMFDevSoundProxy::GetRecordedBufferL(CMMFDataBuffer& aBuffer)
   1.462 +	{
   1.463 +	return SendReceiveResult(EMMFDevSoundProxyGetRecordedBuffer, aBuffer.Data());
   1.464 +	}
   1.465 +	
   1.466 +EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
   1.467 +	{
   1.468 +	TMMFDevSoundProxySettings set;
   1.469 +	set.iNotificationEventUid = aEventType;
   1.470 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.471 +	return SendReceive(EMMFDevSoundProxyRequestResourceNotification, pckg, aNotificationRegistrationData);
   1.472 +	}
   1.473 +
   1.474 +EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType)
   1.475 +	{
   1.476 +	TMMFDevSoundProxySettings set;
   1.477 +	set.iNotificationEventUid = aEventType;
   1.478 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.479 +	return SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, pckg);
   1.480 +	}
   1.481 +	
   1.482 +EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData)
   1.483 +	{
   1.484 +	TMMFDevSoundProxySettings set;
   1.485 +	set.iNotificationEventUid = aEventType;
   1.486 +	TMMFDevSoundProxySettingsPckg pckg(set);
   1.487 +	return SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, pckg,KNullDesC8,aNotificationData);
   1.488 +	}
   1.489 +
   1.490 +EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay()
   1.491 +	{
   1.492 +	return SendReceive(EMMFDevSoundProxyWillResumePlay);
   1.493 +	}
   1.494 +
   1.495 +EXPORT_C TInt RMMFDevSoundProxy::EmptyBuffers()
   1.496 +	{
   1.497 +	return SendReceive(EMMFDevSoundProxyEmptyBuffers);
   1.498 +	}
   1.499 +
   1.500 +EXPORT_C TInt RMMFDevSoundProxy::GetTimePlayed(TTimeIntervalMicroSeconds& aTime)
   1.501 +	{
   1.502 +	TTimeIntervalMicroSeconds time(0);
   1.503 +	TPckgBuf<TTimeIntervalMicroSeconds> timePckg(time);
   1.504 +	TInt err = SendReceiveResult(EMMFDevSoundProxyGetTimePlayed, KNullDesC8, KNullDesC8, timePckg);
   1.505 +	if(err==KErrNone)
   1.506 +		{
   1.507 +		aTime = timePckg();
   1.508 +		}
   1.509 +	return err;
   1.510 +	}
   1.511 +	
   1.512 +// implementation of a simple CustomCommand() scheme
   1.513 +EXPORT_C TInt RMMFDevSoundProxy::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
   1.514 +	{
   1.515 +	// the UID of the custom command is passed as an integer so as maintain consistency with the async methods below
   1.516 +	TInt command = aUid.iUid;
   1.517 +	
   1.518 +	if (aOutParam==NULL)
   1.519 +		{
   1.520 +		return SendReceive(EMMFDevSoundProxySyncCustomCommand, command, aParam1, aParam2);
   1.521 +		}
   1.522 +	else
   1.523 +		{
   1.524 +		return SendReceiveResult(EMMFDevSoundProxySyncCustomCommandResult, command, aParam1, aParam2, *aOutParam);		
   1.525 +		}
   1.526 +	}
   1.527 +
   1.528 +EXPORT_C void RMMFDevSoundProxy::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam)
   1.529 +	{
   1.530 +	// this seemingly only allows 1 simultaneous async call. Need an array of TRequestStatus for more than one call.
   1.531 +	// the UID of the custom command is passed as an integer so as to prevent the need of a consistent UID array.
   1.532 +	TInt command = aUid.iUid;
   1.533 +
   1.534 +	if (aOutParam==NULL)
   1.535 +		{
   1.536 +		SendReceive(EMMFDevSoundProxyAsyncCustomCommand, command, aParam1, aParam2, aStatus);
   1.537 +		}
   1.538 +	else
   1.539 +		{
   1.540 +		SendReceiveResult(EMMFDevSoundProxyAsyncCustomCommandResult, command, aParam1, aParam2, *aOutParam, aStatus);		
   1.541 +		}
   1.542 +	}
   1.543 +
   1.544 +EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid)
   1.545 +	{
   1.546 +	TPckgBuf<TThreadId> threadId(aTid);
   1.547 +	return SendReceive(EMMFDevSoundProxySetClientThreadInfo, threadId);
   1.548 +	}