os/mm/devsoundextensions/audiorouting/Output/AudioOutputProxy/src/AudioOutputProxy.cpp
Update contrib.
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Audio output proxy implementation
21 #include "AudioOutput.h"
22 #include "AudioOutputProxyAO.h"
23 #include "AudioOutputProxy.h"
24 #include "AudioOutputMessageTypes.h"
25 #include <CustomCommandUtility.h>
26 #include "CustomInterfaceUtility.h"
31 // ================= MEMBER FUNCTIONS =======================
33 // C++ default constructor can NOT contain any code, that
36 CAudioOutputProxy::CAudioOutputProxy(TMMFMessageDestinationPckg aMessageHandler,
37 MCustomCommand& aCustomCommand,
38 CCustomInterfaceUtility* aCustomInterfaceUtility) :
39 iCustomCommand(&aCustomCommand),
40 iMessageHandler(aMessageHandler),
41 iCustomInterfaceUtility(aCustomInterfaceUtility)
43 iOutput = ENoPreference;
44 iDefaultOutput = ENoPreference;
45 iSecureOutput = EFalse;
49 // Two-phased constructor.
50 EXPORT_C CAudioOutputProxy* CAudioOutputProxy::NewL(TMMFMessageDestinationPckg aMessageHandler,
51 MCustomCommand& aCustomCommand,
52 CCustomInterfaceUtility* aCustomInterfaceUtility)
54 CAudioOutputProxy* self = new(ELeave) CAudioOutputProxy(aMessageHandler,aCustomCommand,aCustomInterfaceUtility);
59 // -----------------------------------------------------------------------------
60 // CAudioOutputProxy::ConstructL
61 // Symbian 2nd phase constructor can leave.
62 // -----------------------------------------------------------------------------
64 void CAudioOutputProxy::ConstructL()
69 CAudioOutputProxy::~CAudioOutputProxy()
71 if (iRegistered != EFalse)
74 UnregisterObserver(*iObserver);
79 iCustomCommand->CustomCommandSync(iMessageHandler, EAofDelete, KNullDesC8, KNullDesC8);
88 if(iCustomInterfaceUtility)
90 iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
91 delete iCustomInterfaceUtility;
92 iCustomInterfaceUtility = NULL;
96 // ---------------------------------------------------------
98 // ?implementation_description
99 // (other items were commented in a header).
100 // ---------------------------------------------------------
102 EXPORT_C const TUid CAudioOutputProxy::Uid()
104 return KUidAudioOutput;
107 // ---------------------------------------------------------
108 // CAudioOutput::AudioOutput
109 // ?implementation_description
110 // (other items were commented in a header).
111 // ---------------------------------------------------------
113 CAudioOutput::TAudioOutputPreference CAudioOutputProxy::AudioOutput()
116 TPckgBuf<TAudioOutputPreference> outPutPckg;
117 TInt error = iCustomCommand->CustomCommandSync(iMessageHandler, (TInt)EAofGetAudioOutput, KNullDesC8, KNullDesC8, outPutPckg);
119 if (KErrNone == error)
120 iOutput = outPutPckg();
122 iOutput = ENoPreference;
126 // ---------------------------------------------------------
127 // CAudioOutput::DefaultAudioOutput
128 // ?implementation_description
129 // (other items were commented in a header).
130 // ---------------------------------------------------------
132 CAudioOutput::TAudioOutputPreference CAudioOutputProxy::DefaultAudioOutput()
134 return iDefaultOutput;
136 // ---------------------------------------------------------
137 // CAudioOutput::RegisterObserverL
138 // ?implementation_description
139 // (other items were commented in a header).
140 // ---------------------------------------------------------
142 void CAudioOutputProxy::RegisterObserverL(MAudioOutputObserver& aObserver)
146 iObserver = &aObserver;
147 iAsyncSender->SetObserver(aObserver);
152 iObserver = &aObserver;
156 iAsyncSender = CAudioOutputProxyAO::NewL(this,aObserver,iCustomCommand);
157 iAsyncSender->SetRegisterFlag(ETrue);
158 iAsyncSender->SendAsyncMessage(iMessageHandler,EAofRegisterObserver);
162 // ---------------------------------------------------------
163 // CAudioOutput::SecureOutput
164 // ?implementation_description
165 // (other items were commented in a header).
166 // ---------------------------------------------------------
168 TBool CAudioOutputProxy::SecureOutput()
170 return iSecureOutput;
173 // ---------------------------------------------------------
174 // CAudioOutput::SetAudioOutputL
175 // ?implementation_description
176 // (other items were commented in a header).
177 // ---------------------------------------------------------
179 void CAudioOutputProxy::SetAudioOutputL(TAudioOutputPreference aAudioOutput)
181 iOutput = aAudioOutput;
182 TPckgC<TAudioOutputPreference> outputPckg(aAudioOutput);
183 iCustomCommand->CustomCommandSync(iMessageHandler, EAofSetAudioOutput, outputPckg, KNullDesC8);
185 // ---------------------------------------------------------
186 // CAudioOutput::SetAudioOutputL
187 // ?implementation_description
188 // (other items were commented in a header).
189 // ---------------------------------------------------------
191 void CAudioOutputProxy::SetSecureOutputL(TBool aSecureOutput)
193 iSecureOutput = aSecureOutput;
194 TPckgC<TBool> outputPckg(aSecureOutput);
196 //ou1cimx1#454515 CAudioOutputConfigurator::SetSecureOutputL() is deprecated
197 err = iCustomCommand->CustomCommandSync(iMessageHandler, EAofSetSecureOutput, outputPckg, KNullDesC8);
205 // ---------------------------------------------------------
206 // CAudioOutput::RegisterObserverL
207 // ?implementation_description
208 // (other items were commented in a header).
209 // ---------------------------------------------------------
211 void CAudioOutputProxy::UnregisterObserver(MAudioOutputObserver& aObserver)
213 iRegistered = EFalse;
214 if (iObserver == &aObserver)
218 iAsyncSender->SetRegisterFlag(EFalse);
219 iCustomCommand->CustomCommandSync(iMessageHandler, EAofUnregisterObserver, KNullDesC8, KNullDesC8);
226 // ========================== OTHER EXPORTED FUNCTIONS =========================