// ---------------------------------------------------------
// CListenerOrientationMessageHandler::DoObserveL
// Receives the observation request message and depending
// on the status of the effect data queue, the message is
// completed immediately or saved for later completion.
// ---------------------------------------------------------
//
void CListenerOrientationMessageHandler::DoObserveL(
	TMMFMessage& aMessage )
	{

#ifdef _DEBUG
    RDebug::Print(_L("CListenerOrientationMessageHandler::DoObserveL"));
#endif

	if ( !iRegistered ) // Don't register again if we're registered.
		{
		iListenerOrientation->RegisterObserverL(*this);
		iRegistered = ETrue;
		}

	if ( iEffectDataQue->IsEmpty() )
		{
		// Message is saved and completed when an event occurs
		iMessage = new(ELeave) TMMFMessage(aMessage);
		}
	else
		{
		TEfOrientationDataPckg dataPckg;
		CEffectDataQueItem* item = iEffectDataQue->First();
		dataPckg.Copy(item->EffectData());
		aMessage.WriteDataToClient(dataPckg);
		aMessage.Complete(KErrNone);
		iEffectDataQue->Remove(*item);
		delete item;
		}
	}
// ---------------------------------------------------------
// CEnvironmentalReverbMessageHandler::DoObserveL
// Receives the observation request message and depending
// on the status of the effect data queue, the message is
// completed immediately or saved for later completion.
// ---------------------------------------------------------
//
void CEnvironmentalReverbMessageHandler::DoObserveL(
	TMMFMessage& aMessage )
	{

#ifdef _DEBUG
    RDebug::Print(_L("CEnvironmentalReverbMessageHandler::DoObserveL"));
#endif

	if ( !iRegistered )
		{
		iEnvironmentalReverb->RegisterObserverL(*this);
		iRegistered = ETrue;
		}

	if ( iEffectDataQue->IsEmpty() )
		{
		//iMessage = &aMessage;
		iMessage = new(ELeave) TMMFMessage(aMessage);
		}
	else
		{
		TEfEnvReverbDataPckg dataPckg;
		CEffectDataQueItem* item = iEffectDataQue->First();
		dataPckg.Copy(item->EffectData());
		aMessage.WriteDataToClient(dataPckg);
		aMessage.Complete(KErrNone);
		iEffectDataQue->Remove(*item);
		delete item;
		}
	}
TInt CMMFDurationInfoCustomCommandParser::GetDurationInfo(TMMFMessage& aMessage)
	{
	TInt retRes = KErrNone;
	TPckgBuf<TMMFDurationInfo> enumPckg;
	iImplementor.GetDurationInfo( enumPckg() );
	aMessage.WriteDataToClient(enumPckg);
	return retRes;
	}
// ---------------------------------------------------------
// CEnvironmentalReverbMessageHandler::DoInitializeL
// ---------------------------------------------------------
//
void CEnvironmentalReverbMessageHandler::DoInitializeL(TMMFMessage& aMessage)
	{
#ifdef _DEBUG
    RDebug::Print(_L("CEnvironmentalReverbMessageHandler::DoInitializeL"));
#endif
	aMessage.WriteDataToClient(iEnvironmentalReverb->DoEffectData());
	aMessage.Complete(KErrNone);
	}
TInt CMMFDurationInfoCustomCommandParser2::GetDurationInfo(TMMFMessage& aMessage)
	{
	TInt err = KErrNone;
	TPckgBuf<TMMFDurationInfo> enumPckg;
	err = iImplementor.GetDurationInfo(enumPckg());
	if(err==KErrNone)
		{
		err = aMessage.WriteDataToClient(enumPckg);
		}
	return err;
	}
// ---------------------------------------------------------
// CListenerOrientationMessageHandler::DoInitializeL
// ---------------------------------------------------------
//
void CListenerOrientationMessageHandler::DoInitializeL(TMMFMessage& aMessage)
	{
	aMessage.WriteDataToClient(iListenerOrientation->DoEffectData());
	aMessage.Complete(KErrNone);
	}