sl@0: /* sl@0: * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: AudioOutput Proxy Active Object sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include "AudioOutput.h" sl@0: #include "AudioOutputMessageTypes.h" sl@0: #include sl@0: #include "AudioOutputProxyAO.h" sl@0: #include sl@0: #include sl@0: sl@0: sl@0: // Two-phased constructor. sl@0: CAudioOutputProxyAO* CAudioOutputProxyAO::NewL(CAudioOutput *aOutputProxy,MAudioOutputObserver& aObserver,MCustomCommand* aUtility) sl@0: { sl@0: CAudioOutputProxyAO* self = new(ELeave) CAudioOutputProxyAO(aOutputProxy,aObserver,aUtility); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: // Destructor sl@0: CAudioOutputProxyAO::~CAudioOutputProxyAO() sl@0: { sl@0: Cancel(); sl@0: } sl@0: sl@0: // C++ default constructor can NOT contain any code, that sl@0: // might leave. sl@0: // sl@0: CAudioOutputProxyAO::CAudioOutputProxyAO(CAudioOutput *aOutputProxy,MAudioOutputObserver& aObserver,MCustomCommand* aUtility): sl@0: CActive(CActive::EPriorityStandard), sl@0: iAudioOutputProxy(aOutputProxy), sl@0: iCustomCommandUtility(aUtility), sl@0: iObserver(&aObserver) sl@0: { sl@0: } sl@0: sl@0: void CAudioOutputProxyAO::ConstructL() sl@0: { sl@0: CActiveScheduler::Add(this); sl@0: } sl@0: sl@0: // --------------------------------------------------------- sl@0: // CAudioOutputProxyAO::RunL sl@0: // ?implementation_description sl@0: // (other items were commented in a header). sl@0: // --------------------------------------------------------- sl@0: // sl@0: void CAudioOutputProxyAO::RunL() sl@0: { sl@0: #ifdef _DEBUG sl@0: RDebug::Print(_L("CAudioOutputProxyAO::RunL")); sl@0: #endif sl@0: if ( iRegistered != EFalse ) sl@0: { sl@0: iCustomCommandUtility->CustomCommandAsync( *iDestination,iFunction,KNullDesC8,KNullDesC8,iCallbackData,iStatus ); sl@0: SetActive(); sl@0: iObserver->DefaultAudioOutputChanged(*iAudioOutputProxy,iCallbackData()); sl@0: } sl@0: } sl@0: sl@0: // --------------------------------------------------------- sl@0: // CAudioOutputProxyAO::DoCancel sl@0: // ?implementation_description sl@0: // (other items were commented in a header). sl@0: // --------------------------------------------------------- sl@0: // sl@0: void CAudioOutputProxyAO::DoCancel() sl@0: { sl@0: if ( iRegistered != EFalse ) sl@0: { sl@0: iCustomCommandUtility->CustomCommandSync( *iDestination, EAofUnregisterObserver, KNullDesC8, KNullDesC8); sl@0: } sl@0: } sl@0: sl@0: // --------------------------------------------------------- sl@0: // CAudioOutputProxyAO::SendAsyncMessage sl@0: // ?implementation_description sl@0: // (other items were commented in a header). sl@0: // --------------------------------------------------------- sl@0: // sl@0: void CAudioOutputProxyAO::SendAsyncMessage(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction) sl@0: { sl@0: iDestination = &aDestination; sl@0: iFunction = aFunction; sl@0: iCustomCommandUtility->CustomCommandAsync( aDestination,aFunction,KNullDesC8,KNullDesC8,iCallbackData,iStatus ); sl@0: SetActive(); sl@0: } sl@0: sl@0: sl@0: // --------------------------------------------------------- sl@0: // CAudioOutputProxyAO::SetRegisterFlag sl@0: // ?implementation_description sl@0: // (other items were commented in a header). sl@0: // --------------------------------------------------------- sl@0: // sl@0: void CAudioOutputProxyAO::SetRegisterFlag(TBool aFlag) sl@0: { sl@0: iRegistered = aFlag; sl@0: } sl@0: // --------------------------------------------------------- sl@0: // CAudioOutputProxyAO::SetObserver sl@0: // ?implementation_description sl@0: // (other items were commented in a header). sl@0: // --------------------------------------------------------- sl@0: // sl@0: void CAudioOutputProxyAO::SetObserver(MAudioOutputObserver& aObserver) sl@0: { sl@0: iObserver = &aObserver; sl@0: }