|
1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: AudioOutput Proxy Active Object |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "AudioOutput.h" |
|
20 #include <e32svr.h> |
|
21 #include "AudioOutputProxyAO.h" |
|
22 #include <CustomCommandUtility.h> |
|
23 #include <MAudioOutputObserver.h> |
|
24 |
|
25 |
|
26 // Two-phased constructor. |
|
27 CAudioOutputProxyAO* CAudioOutputProxyAO::NewL(CAudioOutput *aOutputProxy,MAudioOutputObserver& aObserver,MCustomCommand* aUtility) |
|
28 { |
|
29 CAudioOutputProxyAO* self = new(ELeave) CAudioOutputProxyAO(aOutputProxy,aObserver,aUtility); |
|
30 CleanupStack::PushL(self); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop(self); |
|
33 return self; |
|
34 } |
|
35 |
|
36 // Destructor |
|
37 CAudioOutputProxyAO::~CAudioOutputProxyAO() |
|
38 { |
|
39 Cancel(); |
|
40 } |
|
41 |
|
42 // C++ default constructor can NOT contain any code, that |
|
43 // might leave. |
|
44 // |
|
45 CAudioOutputProxyAO::CAudioOutputProxyAO(CAudioOutput *aOutputProxy,MAudioOutputObserver& aObserver,MCustomCommand* aUtility): |
|
46 CActive(CActive::EPriorityStandard), |
|
47 iAudioOutputProxy(aOutputProxy), |
|
48 iCustomCommandUtility(aUtility), |
|
49 iObserver(aObserver) |
|
50 { |
|
51 } |
|
52 |
|
53 void CAudioOutputProxyAO::ConstructL() |
|
54 { |
|
55 CActiveScheduler::Add(this); |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------- |
|
59 // CAudioOutputProxyAO::RunL |
|
60 // ?implementation_description |
|
61 // (other items were commented in a header). |
|
62 // --------------------------------------------------------- |
|
63 // |
|
64 void CAudioOutputProxyAO::RunL() |
|
65 { |
|
66 #ifdef _DEBUG |
|
67 RDebug::Print(_L("CAudioOutputProxyAO::RunL")); |
|
68 #endif |
|
69 if ( iRegistered != EFalse ) |
|
70 { |
|
71 iCustomCommandUtility->CustomCommandAsync( *iDestination,iFunction,KNullDesC8,KNullDesC8,iCallbackData,iStatus ); |
|
72 SetActive(); |
|
73 iObserver.DefaultAudioOutputChanged(*iAudioOutputProxy,iCallbackData()); |
|
74 } |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------- |
|
78 // CAudioOutputProxyAO::DoCancel |
|
79 // ?implementation_description |
|
80 // (other items were commented in a header). |
|
81 // --------------------------------------------------------- |
|
82 // |
|
83 void CAudioOutputProxyAO::DoCancel() |
|
84 { |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // CAudioOutputProxyAO::SendAsyncMessage |
|
89 // ?implementation_description |
|
90 // (other items were commented in a header). |
|
91 // --------------------------------------------------------- |
|
92 // |
|
93 void CAudioOutputProxyAO::SendAsyncMessage(const TMMFMessageDestinationPckg& aDestination, |
|
94 TInt aFunction) |
|
95 { |
|
96 iDestination = &aDestination; |
|
97 iFunction = aFunction; |
|
98 iCustomCommandUtility->CustomCommandAsync( aDestination,aFunction,KNullDesC8,KNullDesC8,iCallbackData,iStatus ); |
|
99 SetActive(); |
|
100 } |
|
101 |
|
102 |
|
103 // --------------------------------------------------------- |
|
104 // CAudioOutputProxyAO::SetRegisterFlag |
|
105 // ?implementation_description |
|
106 // (other items were commented in a header). |
|
107 // --------------------------------------------------------- |
|
108 // |
|
109 void CAudioOutputProxyAO::SetRegisterFlag(TBool aFlag) |
|
110 { |
|
111 iRegistered = aFlag; |
|
112 } |