sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description: Audio input proxy implementation
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
// INCLUDE FILES
|
sl@0
|
21 |
#include "AudioInputProxy.h"
|
sl@0
|
22 |
#include "AudioInputMessageTypes.h"
|
sl@0
|
23 |
#include <CustomCommandUtility.h>
|
sl@0
|
24 |
#include <CustomInterfaceUtility.h>
|
sl@0
|
25 |
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
|
sl@0
|
29 |
// ================= MEMBER FUNCTIONS =======================
|
sl@0
|
30 |
|
sl@0
|
31 |
// C++ default constructor can NOT contain any code, that
|
sl@0
|
32 |
// might leave.
|
sl@0
|
33 |
//
|
sl@0
|
34 |
CAudioInputProxy::CAudioInputProxy(TMMFMessageDestinationPckg aMessageHandler,
|
sl@0
|
35 |
MCustomCommand& aCustomCommand,
|
sl@0
|
36 |
CCustomInterfaceUtility* aCustomInterfaceUtility) :
|
sl@0
|
37 |
iCustomCommand(&aCustomCommand),
|
sl@0
|
38 |
iInputArray(4),
|
sl@0
|
39 |
iMessageHandler(aMessageHandler),
|
sl@0
|
40 |
iCustomInterfaceUtility(aCustomInterfaceUtility)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
// Two-phased constructor.
|
sl@0
|
45 |
EXPORT_C CAudioInputProxy* CAudioInputProxy::NewL(TMMFMessageDestinationPckg aMessageHandler,
|
sl@0
|
46 |
MCustomCommand& aCustomCommand,
|
sl@0
|
47 |
CCustomInterfaceUtility* aCustomInterfaceUtility)
|
sl@0
|
48 |
{
|
sl@0
|
49 |
CAudioInputProxy* self = new(ELeave) CAudioInputProxy(aMessageHandler,aCustomCommand,aCustomInterfaceUtility);
|
sl@0
|
50 |
|
sl@0
|
51 |
return self;
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|
sl@0
|
54 |
|
sl@0
|
55 |
// Destructor
|
sl@0
|
56 |
CAudioInputProxy::~CAudioInputProxy()
|
sl@0
|
57 |
{
|
sl@0
|
58 |
|
sl@0
|
59 |
iInputArray.Reset();
|
sl@0
|
60 |
if(iCustomCommand)
|
sl@0
|
61 |
iCustomCommand->CustomCommandSync(iMessageHandler, EAifDelete, KNullDesC8, KNullDesC8);
|
sl@0
|
62 |
if(iCustomInterfaceUtility)
|
sl@0
|
63 |
iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
|
sl@0
|
64 |
delete iCustomInterfaceUtility;
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
EXPORT_C const TUid CAudioInputProxy::Uid()
|
sl@0
|
68 |
{
|
sl@0
|
69 |
return KUidAudioInput;
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
// ---------------------------------------------------------
|
sl@0
|
73 |
// CAudioInput::AudioInput
|
sl@0
|
74 |
// ?implementation_description
|
sl@0
|
75 |
// (other items were commented in a header).
|
sl@0
|
76 |
// ---------------------------------------------------------
|
sl@0
|
77 |
//
|
sl@0
|
78 |
CAudioInput::TAudioInputArray CAudioInputProxy::AudioInput()
|
sl@0
|
79 |
{
|
sl@0
|
80 |
return iInputArray.Array();
|
sl@0
|
81 |
}
|
sl@0
|
82 |
|
sl@0
|
83 |
// ---------------------------------------------------------
|
sl@0
|
84 |
// CAudioInput::SetAudioInputL
|
sl@0
|
85 |
// ?implementation_description
|
sl@0
|
86 |
// (other items were commented in a header).
|
sl@0
|
87 |
// ---------------------------------------------------------
|
sl@0
|
88 |
//
|
sl@0
|
89 |
void CAudioInputProxy::SetAudioInputL(TAudioInputArray aAudioInputs)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
iInputArray.Reset();
|
sl@0
|
92 |
TInt count = aAudioInputs.Count();
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
for(int i=0; i<count; i++)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
TAudioInputPreference audioInput = aAudioInputs[i];
|
sl@0
|
98 |
iInputArray.AppendL(audioInput);
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
TInt length = iInputArray.Length() * count;
|
sl@0
|
102 |
TPtrC8 inputArrayPtr((const TUint8*)&iInputArray[0], length);
|
sl@0
|
103 |
TPckgC<TInt> countPckg(count);
|
sl@0
|
104 |
|
sl@0
|
105 |
User::LeaveIfError(iCustomCommand->CustomCommandSync(iMessageHandler, EAifSetInputs, countPckg, inputArrayPtr));
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
|
sl@0
|
109 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
sl@0
|
110 |
|
sl@0
|
111 |
|
sl@0
|
112 |
|
sl@0
|
113 |
|
sl@0
|
114 |
// End of File
|