|
1 /* |
|
2 * Copyright (c) 2007-2009 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: Implementation for audio input terminal object. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <accpolinputterminal.h> |
|
19 #include "acc_debug.h" |
|
20 |
|
21 // ----------------------------------------------------------------------------- |
|
22 // CAccPolInputTerminal::CAccPolInputTerminal() |
|
23 // C++ default constructor can NOT contain any code, that |
|
24 // might leave. |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 CAccPolInputTerminal::CAccPolInputTerminal( CAccPolObjectCon* aObject ) : |
|
28 CAccPolTerminalBase( EAccPolAudioInputTerminalObject, aObject ) |
|
29 { |
|
30 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::CAccPolInputTerminal() - Enter" ); |
|
31 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::CAccPolInputTerminal() - Return void" ); |
|
32 } |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CAccPolInputTerminal::CAccPolInputTerminal() |
|
36 // C++ default constructor can NOT contain any code, that |
|
37 // might leave. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CAccPolInputTerminal::CAccPolInputTerminal( const TUint8 aUnitId, |
|
41 const TInputTerminalType aType, |
|
42 TUint8 aChannelCount, |
|
43 TUint16 aChannelConfig ) : |
|
44 CAccPolTerminalBase( EAccPolAudioInputTerminalObject, aUnitId ) // JNI type removed |
|
45 { |
|
46 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::CAccPolInputTerminal() - Enter" ); |
|
47 iInputTerminalType = aType; |
|
48 iChannelCount = aChannelCount; |
|
49 iChannelConfig = aChannelConfig; |
|
50 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::CAccPolInputTerminal() - Return" ); |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CAccPolInputTerminal::NewL() |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CAccPolInputTerminal* CAccPolInputTerminal::NewL( |
|
58 CAccPolObjectCon* aObject ) |
|
59 { |
|
60 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::NewL() - Enter" ); |
|
61 CAccPolInputTerminal* self = CAccPolInputTerminal::NewLC( aObject ); |
|
62 CleanupStack::Pop( self ); |
|
63 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::NewL() - Return" ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CAccPolInputTerminal::NewLC() |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 EXPORT_C CAccPolInputTerminal* CAccPolInputTerminal::NewLC( |
|
72 CAccPolObjectCon* aObject ) |
|
73 { |
|
74 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::NewLC() - Enter" ); |
|
75 |
|
76 CAccPolInputTerminal* self = new ( ELeave ) CAccPolInputTerminal( aObject ); |
|
77 CleanupStack::PushL( self ); |
|
78 self->ConstructL(); |
|
79 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::NewLC() - Return" ); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CAccPolInputTerminal::NewL() |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 EXPORT_C CAccPolInputTerminal* CAccPolInputTerminal::NewL( |
|
88 const TUint8 aUnitId, |
|
89 const TInputTerminalType aType, |
|
90 TUint8 aChannelCount, |
|
91 TUint16 aChannelConfig ) |
|
92 { |
|
93 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::NewL() - Enter" ); |
|
94 CAccPolInputTerminal* self = CAccPolInputTerminal::NewLC( aUnitId, aType, |
|
95 aChannelCount, aChannelConfig ); |
|
96 CleanupStack::Pop( self ); |
|
97 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::NewL() - Return" ); |
|
98 return self; |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CAccPolInputTerminal::NewLC() |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 EXPORT_C CAccPolInputTerminal* CAccPolInputTerminal::NewLC( |
|
106 const TUint8 aUnitId, |
|
107 const TInputTerminalType aType, |
|
108 TUint8 aChannelCount, |
|
109 TUint16 aChannelConfig ) |
|
110 |
|
111 { |
|
112 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::NewLC() - Enter" ); |
|
113 CAccPolInputTerminal* self = new ( ELeave ) CAccPolInputTerminal( aUnitId, |
|
114 aType, aChannelCount, aChannelConfig ); |
|
115 CleanupStack::PushL( self ); |
|
116 self->ConstructL(); |
|
117 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::NewLC() - Return" ); |
|
118 return self; |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // CAccPolInputTerminal::ConstructL() |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 void CAccPolInputTerminal::ConstructL() |
|
126 { |
|
127 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::ConstructL() - Enter" ); |
|
128 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::ConstructL() - Return" ); |
|
129 } |
|
130 |
|
131 // Destructor |
|
132 EXPORT_C CAccPolInputTerminal::~CAccPolInputTerminal() |
|
133 { |
|
134 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::CAccPolInputTerminal() - Enter" ); |
|
135 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::~CAccPolInputTerminal() - Return" ); |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // CAccPolInputTerminal::operator() |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 EXPORT_C CAccPolInputTerminal& CAccPolInputTerminal::operator=( |
|
143 const CAccPolInputTerminal& aInputTerminalObject ) |
|
144 { |
|
145 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::operator() - Enter" ); |
|
146 CAccPolTerminalBase::operator=( |
|
147 ( CAccPolTerminalBase& )aInputTerminalObject ); |
|
148 iInputTerminalType = aInputTerminalObject.InputTerminalType(); |
|
149 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::~operator() - Return" ); |
|
150 return ( *this ); |
|
151 } |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // CAccPolInputTerminal::operator() |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 EXPORT_C void CAccPolInputTerminal::SetChannelCount( TUint8 aChannelCount ) |
|
158 { |
|
159 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::SetChannelCount() - Enter %d", aChannelCount ); |
|
160 iChannelCount = aChannelCount; |
|
161 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::SetChannelCount() - Return" ); |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // CAccPolInputTerminal::operator() |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C TUint8 CAccPolInputTerminal::ChannelCount() const |
|
169 { |
|
170 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::ChannelCount() - Enter" ); |
|
171 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::ChannelCount() - Return %d", iChannelCount ); |
|
172 return iChannelCount; |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // CAccPolInputTerminal::operator() |
|
177 // --------------------------------------------------------------------------- |
|
178 // |
|
179 EXPORT_C void CAccPolInputTerminal::SetChannelConfig( TUint32 aChannelConfig ) |
|
180 { |
|
181 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::SetChannelConfig() - Enter, 0x%x", aChannelConfig ); |
|
182 iChannelConfig = aChannelConfig; |
|
183 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::SetChannelConfig() - Return" ); |
|
184 } |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // CAccPolInputTerminal::operator() |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 EXPORT_C TUint32 CAccPolInputTerminal::ChannelConfig() const |
|
191 { |
|
192 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::ChannelConfig() - Enter" ); |
|
193 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::ChannelConfig() - Return, 0x%x", iChannelConfig ); |
|
194 return iChannelConfig; |
|
195 } |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // CAccPolFeatureUnit::SetSupportedControls() |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 EXPORT_C TBool CAccPolInputTerminal::ChannelConfig( |
|
202 TUint32 aChannelConfigBitMask ) const |
|
203 |
|
204 { |
|
205 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolFeatureUnit::SupportedControls() 0x%x", aChannelConfigBitMask ); |
|
206 |
|
207 TUint32 result( iChannelConfig ); |
|
208 result = result & aChannelConfigBitMask; |
|
209 |
|
210 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolFeatureUnit::SupportedControls() - return %d", |
|
211 ( result == aChannelConfigBitMask ) ); |
|
212 |
|
213 return ( result == aChannelConfigBitMask ); |
|
214 } |
|
215 |
|
216 // --------------------------------------------------------------------------- |
|
217 // CAccPolInputTerminal::InputTerminalType() |
|
218 // --------------------------------------------------------------------------- |
|
219 // |
|
220 EXPORT_C CAccPolInputTerminal::TInputTerminalType CAccPolInputTerminal::InputTerminalType() const |
|
221 { |
|
222 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::InputTerminalType() - Enter" ); |
|
223 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::InputTerminalType() - Return" ); |
|
224 return iInputTerminalType; |
|
225 } |
|
226 |
|
227 // --------------------------------------------------------------------------- |
|
228 // CAccPolInputTerminal::SetInputTerminalType() |
|
229 // --------------------------------------------------------------------------- |
|
230 // |
|
231 EXPORT_C void CAccPolInputTerminal::SetInputTerminalType( |
|
232 TInputTerminalType aInputTerminalType ) |
|
233 { |
|
234 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolOutputTerminal::SetInputTerminalType() - Enter" ); |
|
235 iInputTerminalType = aInputTerminalType; |
|
236 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolOutputTerminal::SetInputTerminalType() - Return" ); |
|
237 } |
|
238 |
|
239 // --------------------------------------------------------------------------- |
|
240 // CAccPolInputTerminal::ExternalizeL() |
|
241 // --------------------------------------------------------------------------- |
|
242 // |
|
243 void CAccPolInputTerminal::ExternalizeL( RWriteStream& aStream ) const |
|
244 { |
|
245 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::ExternalizeL() - Enter" ); |
|
246 aStream.WriteUint8L( ObjectType() ); |
|
247 //Externalize base class. |
|
248 ExternalizeTerminalBaseL( aStream ); |
|
249 |
|
250 //Object data |
|
251 aStream.WriteUint8L( iInputTerminalType ); |
|
252 aStream.WriteUint8L( iChannelCount ); |
|
253 aStream.WriteUint16L( iChannelConfig ); |
|
254 |
|
255 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::ExternalizeL - Return" ); |
|
256 } |
|
257 |
|
258 // --------------------------------------------------------------------------- |
|
259 // CAccPolAudioStreamFormat::InternalizeL() |
|
260 // --------------------------------------------------------------------------- |
|
261 // |
|
262 void CAccPolInputTerminal::InternalizeL( RReadStream& aStream ) |
|
263 { |
|
264 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::InternalizeL() - Enter" ); |
|
265 //Externalize base class. |
|
266 InternalizeTerminalBaseL( aStream ); |
|
267 |
|
268 // Object data |
|
269 iInputTerminalType |
|
270 = ( CAccPolInputTerminal::TInputTerminalType )aStream.ReadUint8L(); |
|
271 iChannelCount = aStream.ReadUint8L(); |
|
272 iChannelConfig = aStream.ReadUint16L(); |
|
273 |
|
274 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::InternalizeL - Return" ); |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // CAccPolInputTerminal::DuplicateL() |
|
279 // --------------------------------------------------------------------------- |
|
280 // |
|
281 CAccPolObjectBase* CAccPolInputTerminal::DuplicateLC( CAccPolObjectCon* aObject ) |
|
282 { |
|
283 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::DuplicateLC() - Enter" ); |
|
284 CAccPolInputTerminal* aInput = CAccPolInputTerminal::NewLC( aObject ); |
|
285 *aInput = ( CAccPolInputTerminal& )*this; |
|
286 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolInputTerminal::DuplicateLC() - Return" ); |
|
287 return aInput; |
|
288 } |