|
1 /* |
|
2 * Copyright (c) 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: Audio input proxy implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "AudioInputProxy.h" |
|
22 #include "AudioInputMessageTypes.h" |
|
23 #include <CustomCommandUtility.h> |
|
24 #include <CustomInterfaceUtility.h> |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 // ================= MEMBER FUNCTIONS ======================= |
|
30 |
|
31 // C++ default constructor can NOT contain any code, that |
|
32 // might leave. |
|
33 // |
|
34 CAudioInputProxy::CAudioInputProxy(TMMFMessageDestinationPckg aMessageHandler, |
|
35 MCustomCommand& aCustomCommand, |
|
36 CCustomInterfaceUtility* aCustomInterfaceUtility) : |
|
37 iCustomCommand(&aCustomCommand), |
|
38 iInputArray(4), |
|
39 iMessageHandler(aMessageHandler), |
|
40 iCustomInterfaceUtility(aCustomInterfaceUtility) |
|
41 { |
|
42 } |
|
43 |
|
44 // Two-phased constructor. |
|
45 EXPORT_C CAudioInputProxy* CAudioInputProxy::NewL(TMMFMessageDestinationPckg aMessageHandler, |
|
46 MCustomCommand& aCustomCommand, |
|
47 CCustomInterfaceUtility* aCustomInterfaceUtility) |
|
48 { |
|
49 CAudioInputProxy* self = new(ELeave) CAudioInputProxy(aMessageHandler,aCustomCommand,aCustomInterfaceUtility); |
|
50 |
|
51 return self; |
|
52 } |
|
53 |
|
54 |
|
55 // Destructor |
|
56 CAudioInputProxy::~CAudioInputProxy() |
|
57 { |
|
58 |
|
59 iInputArray.Reset(); |
|
60 if(iCustomCommand) |
|
61 iCustomCommand->CustomCommandSync(iMessageHandler, EAifDelete, KNullDesC8, KNullDesC8); |
|
62 if(iCustomInterfaceUtility) |
|
63 iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler); |
|
64 delete iCustomInterfaceUtility; |
|
65 } |
|
66 |
|
67 EXPORT_C const TUid CAudioInputProxy::Uid() |
|
68 { |
|
69 return KUidAudioInput; |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------- |
|
73 // CAudioInput::AudioInput |
|
74 // ?implementation_description |
|
75 // (other items were commented in a header). |
|
76 // --------------------------------------------------------- |
|
77 // |
|
78 CAudioInput::TAudioInputArray CAudioInputProxy::AudioInput() |
|
79 { |
|
80 return iInputArray.Array(); |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // CAudioInput::SetAudioInputL |
|
85 // ?implementation_description |
|
86 // (other items were commented in a header). |
|
87 // --------------------------------------------------------- |
|
88 // |
|
89 void CAudioInputProxy::SetAudioInputL(TAudioInputArray aAudioInputs) |
|
90 { |
|
91 iInputArray.Reset(); |
|
92 TInt count = aAudioInputs.Count(); |
|
93 |
|
94 |
|
95 for(int i=0; i<count; i++) |
|
96 { |
|
97 TAudioInputPreference audioInput = aAudioInputs[i]; |
|
98 iInputArray.AppendL(audioInput); |
|
99 } |
|
100 |
|
101 TInt length = iInputArray.Length() * count; |
|
102 TPtrC8 inputArrayPtr((const TUint8*)&iInputArray[0], length); |
|
103 TPckgC<TInt> countPckg(count); |
|
104 |
|
105 User::LeaveIfError(iCustomCommand->CustomCommandSync(iMessageHandler, EAifSetInputs, countPckg, inputArrayPtr)); |
|
106 } |
|
107 |
|
108 |
|
109 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 // End of File |