os/mm/devsoundextensions/audiorouting/Output/AudioOutputProxy/src/AudioOutputProxyAO.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsoundextensions/audiorouting/Output/AudioOutputProxy/src/AudioOutputProxyAO.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,127 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: AudioOutput Proxy Active Object
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#include "AudioOutput.h"
1.23 +#include "AudioOutputMessageTypes.h"
1.24 +#include <e32svr.h>
1.25 +#include "AudioOutputProxyAO.h"
1.26 +#include <CustomCommandUtility.h>
1.27 +#include <MAudioOutputObserver.h>
1.28 +
1.29 +
1.30 +// Two-phased constructor.
1.31 +CAudioOutputProxyAO* CAudioOutputProxyAO::NewL(CAudioOutput *aOutputProxy,MAudioOutputObserver& aObserver,MCustomCommand* aUtility)
1.32 + {
1.33 + CAudioOutputProxyAO* self = new(ELeave) CAudioOutputProxyAO(aOutputProxy,aObserver,aUtility);
1.34 + CleanupStack::PushL(self);
1.35 + self->ConstructL();
1.36 + CleanupStack::Pop(self);
1.37 + return self;
1.38 + }
1.39 +
1.40 +// Destructor
1.41 +CAudioOutputProxyAO::~CAudioOutputProxyAO()
1.42 + {
1.43 + Cancel();
1.44 + }
1.45 +
1.46 +// C++ default constructor can NOT contain any code, that
1.47 +// might leave.
1.48 +//
1.49 +CAudioOutputProxyAO::CAudioOutputProxyAO(CAudioOutput *aOutputProxy,MAudioOutputObserver& aObserver,MCustomCommand* aUtility):
1.50 + CActive(CActive::EPriorityStandard),
1.51 + iAudioOutputProxy(aOutputProxy),
1.52 + iCustomCommandUtility(aUtility),
1.53 + iObserver(&aObserver)
1.54 + {
1.55 + }
1.56 +
1.57 +void CAudioOutputProxyAO::ConstructL()
1.58 + {
1.59 + CActiveScheduler::Add(this);
1.60 + }
1.61 +
1.62 +// ---------------------------------------------------------
1.63 +// CAudioOutputProxyAO::RunL
1.64 +// ?implementation_description
1.65 +// (other items were commented in a header).
1.66 +// ---------------------------------------------------------
1.67 +//
1.68 +void CAudioOutputProxyAO::RunL()
1.69 + {
1.70 +#ifdef _DEBUG
1.71 + RDebug::Print(_L("CAudioOutputProxyAO::RunL"));
1.72 +#endif
1.73 + if ( iRegistered != EFalse )
1.74 + {
1.75 + iCustomCommandUtility->CustomCommandAsync( *iDestination,iFunction,KNullDesC8,KNullDesC8,iCallbackData,iStatus );
1.76 + SetActive();
1.77 + iObserver->DefaultAudioOutputChanged(*iAudioOutputProxy,iCallbackData());
1.78 + }
1.79 + }
1.80 +
1.81 +// ---------------------------------------------------------
1.82 +// CAudioOutputProxyAO::DoCancel
1.83 +// ?implementation_description
1.84 +// (other items were commented in a header).
1.85 +// ---------------------------------------------------------
1.86 +//
1.87 +void CAudioOutputProxyAO::DoCancel()
1.88 + {
1.89 + if ( iRegistered != EFalse )
1.90 + {
1.91 + iCustomCommandUtility->CustomCommandSync( *iDestination, EAofUnregisterObserver, KNullDesC8, KNullDesC8);
1.92 + }
1.93 + }
1.94 +
1.95 +// ---------------------------------------------------------
1.96 +// CAudioOutputProxyAO::SendAsyncMessage
1.97 +// ?implementation_description
1.98 +// (other items were commented in a header).
1.99 +// ---------------------------------------------------------
1.100 +//
1.101 +void CAudioOutputProxyAO::SendAsyncMessage(const TMMFMessageDestinationPckg& aDestination,
1.102 + TInt aFunction)
1.103 + {
1.104 + iDestination = &aDestination;
1.105 + iFunction = aFunction;
1.106 + iCustomCommandUtility->CustomCommandAsync( aDestination,aFunction,KNullDesC8,KNullDesC8,iCallbackData,iStatus );
1.107 + SetActive();
1.108 + }
1.109 +
1.110 +
1.111 +// ---------------------------------------------------------
1.112 +// CAudioOutputProxyAO::SetRegisterFlag
1.113 +// ?implementation_description
1.114 +// (other items were commented in a header).
1.115 +// ---------------------------------------------------------
1.116 +//
1.117 +void CAudioOutputProxyAO::SetRegisterFlag(TBool aFlag)
1.118 + {
1.119 + iRegistered = aFlag;
1.120 + }
1.121 +// ---------------------------------------------------------
1.122 +// CAudioOutputProxyAO::SetObserver
1.123 +// ?implementation_description
1.124 +// (other items were commented in a header).
1.125 +// ---------------------------------------------------------
1.126 +//
1.127 +void CAudioOutputProxyAO::SetObserver(MAudioOutputObserver& aObserver)
1.128 + {
1.129 + iObserver = &aObserver;
1.130 + }