|
1 /* |
|
2 * Copyright (c) 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: Container implementation for accessory policy name/value pair objects. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <accpolhdmiobjectcon.h> |
|
19 #include <accpolobjecttypes.h> |
|
20 |
|
21 #include "acc_debug.h" |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // CAccPolHdmiObjectCon::CAccPolHdmiObjectCon |
|
25 // C++ default constructor can NOT contain any code, that |
|
26 // might leave. |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 CAccPolHdmiObjectCon::CAccPolHdmiObjectCon( CAccPolObjectCon* aObject ) : |
|
30 CAccPolObjectCon( EAccPolHdmiObjectCon, aObject ) |
|
31 { |
|
32 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::CAccPolHdmiObjectCon() - Enter " ); |
|
33 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::CAccPolHdmiObjectCon() - Return" ); |
|
34 } |
|
35 |
|
36 // Destructor |
|
37 CAccPolHdmiObjectCon::~CAccPolHdmiObjectCon() |
|
38 { |
|
39 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::~CAccPolHdmiObjectCon() - Enter " ); |
|
40 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::~CAccPolHdmiObjectCon() - Return" ); |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CAccPolHdmiObjectCon::ConstructL |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 void CAccPolHdmiObjectCon::ConstructL() |
|
48 { |
|
49 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::ConstructL() - Enter " ); |
|
50 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::ConstructL() - Return" ); |
|
51 } |
|
52 // --------------------------------------------------------------------------- |
|
53 // CAccPolHdmiObjectCon::NewL |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 EXPORT_C CAccPolHdmiObjectCon* CAccPolHdmiObjectCon::NewL( CAccPolObjectCon* aObject ) |
|
57 { |
|
58 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::NewL() - Enter " ); |
|
59 CAccPolHdmiObjectCon* self = CAccPolHdmiObjectCon::NewLC( aObject ); |
|
60 CleanupStack::Pop( self ); |
|
61 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::NewL() - Return" ); |
|
62 return self; |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // CAccPolHdmiObjectCon::NewLC |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 EXPORT_C CAccPolHdmiObjectCon* CAccPolHdmiObjectCon::NewLC( CAccPolObjectCon* aObject ) |
|
70 { |
|
71 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::NewLC() - Enter " ); |
|
72 CAccPolHdmiObjectCon* self = new ( ELeave ) CAccPolHdmiObjectCon( aObject ); |
|
73 CleanupStack::PushL( self ); |
|
74 self->ConstructL(); |
|
75 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::NewLC() - Return" ); |
|
76 return self; |
|
77 } |
|
78 |
|
79 //------------------------------------------------------------------------------ |
|
80 // CAccPolHdmiObjectCon::GetAudioFormatObjectsL |
|
81 //------------------------------------------------------------------------------ |
|
82 // |
|
83 EXPORT_C void CAccPolHdmiObjectCon::GetAudioFormatObjectsL( |
|
84 RAccPolHdmiAudioFormatArray& aArray ) const |
|
85 { |
|
86 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetFormatObjectsL() - Enter " ); |
|
87 CAccPolObjectBase* object = NULL; |
|
88 TInt count = Count(); |
|
89 for( TInt i = 0; i < count; i++ ) |
|
90 { |
|
91 object = AtL( i ); |
|
92 if( object->ObjectType() == EAccPolHdmiAudioFormatObject ) |
|
93 { |
|
94 aArray.AppendL( static_cast<CAccPolHdmiAudioFormat*>( object ) ); |
|
95 } |
|
96 } |
|
97 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetFormatObjectsL() - Return " ); |
|
98 } |
|
99 |
|
100 //------------------------------------------------------------------------------ |
|
101 // CAccPolHdmiObjectCon::GetLatencyObjectsL |
|
102 //------------------------------------------------------------------------------ |
|
103 // |
|
104 EXPORT_C void CAccPolHdmiObjectCon::GetLatencyObjectsL( |
|
105 RAccPolHdmiLatencyArray& aArray ) const |
|
106 { |
|
107 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetLatencyObjectsL() - Enter " ); |
|
108 CAccPolObjectBase* object = NULL; |
|
109 TInt count = Count(); |
|
110 for( TInt i = 0; i < count; i++ ) |
|
111 { |
|
112 object = AtL( i ); |
|
113 if( object->ObjectType() == EAccPolHdmiLatencyObject ) |
|
114 { |
|
115 aArray.AppendL( static_cast<CAccPolHdmiLatency*>( object ) ); |
|
116 } |
|
117 } |
|
118 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetLatencyObjectsL() - Return " ); |
|
119 } |
|
120 |
|
121 //------------------------------------------------------------------------------ |
|
122 // CAccPolHdmiObjectCon::GetHdmiSinkObjectsL |
|
123 //------------------------------------------------------------------------------ |
|
124 // |
|
125 EXPORT_C void CAccPolHdmiObjectCon::GetHdmiSinkObjectsL( |
|
126 RAccPolHdmiSinkArray& aArray ) const |
|
127 { |
|
128 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetHdmiSinkObjectsL() - Enter " ); |
|
129 CAccPolObjectBase* object = NULL; |
|
130 TInt count = Count(); |
|
131 for( TInt i = 0; i < count; i++ ) |
|
132 { |
|
133 object = AtL( i ); |
|
134 if( object->ObjectType() == EAccPolHdmiSinkObject ) |
|
135 { |
|
136 aArray.AppendL( static_cast<CAccPolHdmiSink*>( object ) ); |
|
137 } |
|
138 } |
|
139 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetHdmiSinkObjectsL() - Return " ); |
|
140 } |
|
141 |
|
142 //------------------------------------------------------------------------------ |
|
143 // CAccPolHdmiObjectCon::GetHdmiSpeakerAllocationObjectsL |
|
144 //------------------------------------------------------------------------------ |
|
145 // |
|
146 EXPORT_C void CAccPolHdmiObjectCon::GetHdmiSpeakerAllocationObjectsL( |
|
147 RAccPolHdmiSpeakerAllocationArray& aArray ) const |
|
148 { |
|
149 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetHdmiSpeakerAllocationObjectsL() - Enter " ); |
|
150 CAccPolObjectBase* object = NULL; |
|
151 TInt count = Count(); |
|
152 for( TInt i = 0; i < count; i++ ) |
|
153 { |
|
154 object = AtL( i ); |
|
155 if( object->ObjectType() == EAccPolHdmiSpeakerAllocationObject ) |
|
156 { |
|
157 aArray.AppendL( static_cast<CAccPolHdmiSpeakerAllocation*>( object ) ); |
|
158 } |
|
159 } |
|
160 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetHdmiSpeakerAllocationObjectsL() - Return " ); |
|
161 } |
|
162 |
|
163 //------------------------------------------------------------------------------ |
|
164 // CAccPolHdmiObjectCon::GetHdmiVideoFormatObjectsL |
|
165 //------------------------------------------------------------------------------ |
|
166 // |
|
167 EXPORT_C void CAccPolHdmiObjectCon::GetHdmiVideoFormatObjectsL( |
|
168 RAccPolHdmiVideoFormatArray& aArray ) const |
|
169 { |
|
170 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetHdmiSpeakerAllocationObjectsL() - Enter " ); |
|
171 CAccPolObjectBase* object = NULL; |
|
172 TInt count = Count(); |
|
173 for( TInt i = 0; i < count; i++ ) |
|
174 { |
|
175 object = AtL( i ); |
|
176 if( object->ObjectType() == EAccPolHdmiVideoFormatObject ) |
|
177 { |
|
178 aArray.AppendL( static_cast<CAccPolHdmiVideoFormat*>( object ) ); |
|
179 } |
|
180 } |
|
181 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::GetHdmiSpeakerAllocationObjectsL() - Return " ); |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------------------------- |
|
185 // CAccPolAudioTopologyObjectCon::InternalizeL |
|
186 // --------------------------------------------------------------------------- |
|
187 // |
|
188 void CAccPolHdmiObjectCon::InternalizeL( RReadStream& aStream ) |
|
189 { |
|
190 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::InternalizeL() - Enter" ); |
|
191 |
|
192 TUint8 objectType = 0; |
|
193 TUint32 count = 0; |
|
194 |
|
195 // This object |
|
196 SetObjectType( aStream.ReadUint8L() ); |
|
197 |
|
198 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::InternalizeBaseL - Object Type=%d", ObjectType() ); |
|
199 |
|
200 count = aStream.ReadUint8L();//Number of objects inside this container |
|
201 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::InternalizeL - object count = %d",count ); |
|
202 |
|
203 for( TInt i = 0; i < count; i++ ) |
|
204 { |
|
205 objectType = aStream.ReadUint8L(); |
|
206 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::InternalizeL - object type = %d",objectType ); |
|
207 |
|
208 CAccPolObjectBase* object = NULL; |
|
209 switch( objectType ) |
|
210 { |
|
211 case EAccPolHdmiSinkObject: |
|
212 { |
|
213 object = CAccPolHdmiSink::NewLC(); |
|
214 break; |
|
215 } |
|
216 case EAccPolHdmiAudioFormatObject: |
|
217 { |
|
218 object = CAccPolHdmiAudioFormat::NewLC(); |
|
219 break; |
|
220 } |
|
221 case EAccPolHdmiLatencyObject: |
|
222 { |
|
223 object = CAccPolHdmiLatency::NewLC(); |
|
224 break; |
|
225 } |
|
226 case EAccPolHdmiSpeakerAllocationObject: |
|
227 { |
|
228 object = CAccPolHdmiSpeakerAllocation::NewLC(); |
|
229 break; |
|
230 } |
|
231 case EAccPolHdmiVideoFormatObject: |
|
232 { |
|
233 object = CAccPolHdmiVideoFormat::NewLC(); |
|
234 break; |
|
235 } |
|
236 default: |
|
237 { |
|
238 User::Leave( KErrNotSupported ); |
|
239 break; |
|
240 } |
|
241 } |
|
242 object->InternalizeL( aStream ); |
|
243 AddL( *object ); |
|
244 CleanupStack::PopAndDestroy( object ); |
|
245 } |
|
246 |
|
247 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::InternalizeL - Return" ); |
|
248 } |
|
249 |
|
250 // --------------------------------------------------------------------------- |
|
251 // CAccPolAudioTopologyObjectCon::ExternalizeL |
|
252 // --------------------------------------------------------------------------- |
|
253 // |
|
254 void CAccPolHdmiObjectCon::ExternalizeL( RWriteStream& aStream ) const |
|
255 { |
|
256 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::ExternalizeL() - Enter" ); |
|
257 |
|
258 TInt count( Count() ); |
|
259 aStream.WriteUint8L( ObjectType() );// Type of object |
|
260 aStream.WriteUint8L( count );//Count |
|
261 |
|
262 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::ExternalizeL - object type = %d", ObjectType() ); |
|
263 API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::ExternalizeL - object count = %d", count ); |
|
264 |
|
265 for( TInt i = 0; i < count; i++ ) |
|
266 { |
|
267 AtL( i )->ExternalizeL( aStream ); |
|
268 } |
|
269 |
|
270 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::ExternalizeL - Return" ); |
|
271 } |
|
272 |
|
273 // --------------------------------------------------------------------------- |
|
274 // CAccPolAudioTopologyObjectCon::DuplicateL |
|
275 // --------------------------------------------------------------------------- |
|
276 // |
|
277 CAccPolObjectBase* CAccPolHdmiObjectCon::DuplicateLC( CAccPolObjectCon* aObject ) |
|
278 { |
|
279 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolAudioTopologyObjectCon::DuplicateL()" ); |
|
280 CAccPolHdmiObjectCon* aContainer = CAccPolHdmiObjectCon::NewLC( aObject ); |
|
281 TInt count( Count() ); |
|
282 for( TInt i = 0; i < count; i++ ) |
|
283 { |
|
284 aContainer->AddL( *AtL( i ) ); |
|
285 } |
|
286 API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiObjectCon::DuplicateL()" ); |
|
287 return aContainer; |
|
288 } |
|
289 |
|
290 // End of File |