76
|
1 |
/*
|
|
2 |
* Copyright (c) 2005 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
|
|
20 |
#include <ctffactory.h>
|
|
21 |
#include <tftypes.h>
|
|
22 |
#include <AccPolSubblockNameArray.h>
|
|
23 |
#include "siftrace.h"
|
|
24 |
#include "CtfAccessoryTestcontrol.h"
|
|
25 |
#include "CtfAccessoryTestCaseControl.h"
|
|
26 |
#include <AccPolProprietaryNameValuePairs.h>
|
|
27 |
#include <AccConGenericID.h>
|
|
28 |
#include <AccPolPropGenericid.h>
|
|
29 |
#include <AccessoryConnectionBase.h>
|
|
30 |
#include <s32mem.h>
|
|
31 |
|
|
32 |
#include <accpolobjectcon.h>
|
|
33 |
#include <accpolaudiostreamformat.h>
|
|
34 |
#include <accpolterminalbase.h>
|
|
35 |
#include <accpoloutputterminal.h>
|
|
36 |
#include <accpolinputterminal.h>
|
|
37 |
#include <accpolmixerunit.h>
|
|
38 |
#include <accpolfeatureunit.h>
|
|
39 |
#include <accpolvolumecontrol.h>
|
|
40 |
#include <accpolmutecontrol.h>
|
|
41 |
#include <accpolselectorunit.h>
|
|
42 |
|
|
43 |
#include <StartupDomainPSKeys.h>
|
|
44 |
|
|
45 |
#include <E32Math.h>
|
|
46 |
#include "AccClientServerMessages.h"
|
|
47 |
#include <e32property.h>
|
|
48 |
|
|
49 |
#include <accpolhdmiobjectcon.h>
|
|
50 |
#include <tvoutconfigdef.h>
|
|
51 |
|
|
52 |
//
|
|
53 |
// ----------------------------------------------------------------------------------
|
|
54 |
// MTFAccessoryTestControl* GetAccessoryTestControl
|
|
55 |
// ----------------------------------------------------------------------------------
|
|
56 |
MTFAccessoryTestControl* GetAccessoryTestControl( void )
|
|
57 |
{
|
|
58 |
CTFStub* stub = CTFFactory::Stub( KTFStubTypeAccessoryControl );
|
|
59 |
return STATIC_CAST( CTFAccessoryTestControl*, stub );
|
|
60 |
}
|
|
61 |
//
|
|
62 |
// ----------------------------------------------------------------------------------
|
|
63 |
// MTFAccessoryTestControl::MTFAccessoryTestControl
|
|
64 |
// ----------------------------------------------------------------------------------
|
|
65 |
MTFAccessoryTestControl::MTFAccessoryTestControl( void )
|
|
66 |
{
|
|
67 |
}
|
|
68 |
//
|
|
69 |
// ----------------------------------------------------------------------------------
|
|
70 |
// MTFAccessoryTestControl::~MTFAccessoryTestControl
|
|
71 |
// ----------------------------------------------------------------------------------
|
|
72 |
MTFAccessoryTestControl::~MTFAccessoryTestControl( void )
|
|
73 |
{
|
|
74 |
}
|
|
75 |
|
|
76 |
//
|
|
77 |
// ----------------------------------------------------------------------------------
|
|
78 |
// CTFAccessoryTestControl::CTFAccessoryTestControl
|
|
79 |
// ----------------------------------------------------------------------------------
|
|
80 |
CTFAccessoryTestControl::CTFAccessoryTestControl( void ) :
|
|
81 |
CTFRemoteStub( KTFStubTypeAccessoryControl ),
|
|
82 |
iStack( CTFTestControlObserver::iOffset ), iStackIter( iStack )
|
|
83 |
{
|
|
84 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::CTFAccessoryTestControl()" ) ) );
|
|
85 |
|
|
86 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::CTFAccessoryTestControl() - return" ) ) );
|
|
87 |
}
|
|
88 |
|
|
89 |
//lint -e1740 Pointer not directly deleted by destructor
|
|
90 |
//
|
|
91 |
// ----------------------------------------------------------------------------------
|
|
92 |
// CTFAccessoryTestControl::~CTFAccessoryTestControl
|
|
93 |
// ----------------------------------------------------------------------------------
|
|
94 |
CTFAccessoryTestControl::~CTFAccessoryTestControl( void )
|
|
95 |
{
|
|
96 |
|
|
97 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::~CTFAccessoryTestControl()" ) ) );
|
|
98 |
RProperty::Delete( KTFAccessoryTestProperty, KTFAccessoryMethod );
|
|
99 |
|
|
100 |
ResetAccessoryServices();
|
|
101 |
|
|
102 |
iAccessoryServer.Disconnect();
|
|
103 |
|
|
104 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::~CTFAccessoryTestControl() - Accessory Server connection closed" ) ) );
|
|
105 |
|
|
106 |
}
|
|
107 |
//lint +e1740
|
|
108 |
//
|
|
109 |
// ----------------------------------------------------------------------------------
|
|
110 |
// CTFAccessoryTestControl::InitializeL
|
|
111 |
// ----------------------------------------------------------------------------------
|
|
112 |
void CTFAccessoryTestControl::InitializeL( void )
|
|
113 |
{
|
|
114 |
|
|
115 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::InitializeL( void ) - enter" ) ) );
|
|
116 |
TInt retval( KErrNone );
|
|
117 |
|
|
118 |
iAccessoryConnection = NULL;
|
|
119 |
iAccessorySingleConnection = NULL;
|
|
120 |
iAccessoryControl = NULL;
|
|
121 |
iAccessorySettings = NULL;
|
|
122 |
iAccessoryMode = NULL;
|
|
123 |
iAccessoryAudioControl = NULL;
|
|
124 |
iAccessoryBTControl = NULL;
|
|
125 |
|
|
126 |
iStreamContainer = NULL;
|
|
127 |
iTopologyContainer = NULL;
|
|
128 |
iSpeakerRightVolume = NULL;
|
|
129 |
iSpeakerLeftVolume = NULL;
|
|
130 |
iSpeakerMute = NULL;
|
|
131 |
iMicRightVolume = NULL;
|
|
132 |
iMicLeftVolume = NULL;
|
|
133 |
|
|
134 |
TAccPolGenericID emptyInstance;
|
|
135 |
for( TInt i( 0 ); i < 10; i++ )
|
|
136 |
{
|
|
137 |
iGenericId[i] = emptyInstance;
|
|
138 |
}
|
|
139 |
|
|
140 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::InitializeL()" ) ) );
|
|
141 |
|
|
142 |
User::LeaveIfError( iAccessoryServer.Connect() );
|
|
143 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::InitializeL() - Connected to accessory server" ) ) );
|
|
144 |
|
|
145 |
retval = RProperty::Define( KTFAccessoryTestProperty,
|
|
146 |
KTFAccessoryMethod,
|
|
147 |
RProperty::EByteArray );
|
|
148 |
if( retval != KErrAlreadyExists )
|
|
149 |
User::LeaveIfError( retval );
|
|
150 |
//attach to property
|
|
151 |
|
|
152 |
|
|
153 |
RProperty systemState;
|
|
154 |
User::LeaveIfError( systemState.Attach( KPSUidStartup, KPSGlobalSystemState ) );
|
|
155 |
TInt value( KErrNone );
|
|
156 |
//check value
|
|
157 |
TInt err = systemState.Get( value );
|
|
158 |
|
|
159 |
if( err != KErrNone )
|
|
160 |
{
|
|
161 |
err = systemState.Define( KPSUidStartup,
|
|
162 |
KPSGlobalSystemState,
|
|
163 |
RProperty::EInt );
|
|
164 |
TInt err = systemState.Get( value );
|
|
165 |
}
|
|
166 |
|
|
167 |
if( value != ESwStateNormalRfOn || value != ESwStateNormalRfOff || value
|
|
168 |
!= ESwStateNormalBTSap )
|
|
169 |
{
|
|
170 |
TInt err = systemState.Set( KPSUidStartup,
|
|
171 |
KPSGlobalSystemState,
|
|
172 |
ESwStateNormalRfOn );
|
|
173 |
}
|
|
174 |
|
|
175 |
iInitialized = ETrue;
|
|
176 |
|
|
177 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::InitializeL - return" ) ) );
|
|
178 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::InitializeL( void ) - return" ) ) );
|
|
179 |
}
|
|
180 |
//
|
|
181 |
// ----------------------------------------------------------------------------------
|
|
182 |
// CTFAccessoryTestControl::ResetAccessoryServices
|
|
183 |
// ----------------------------------------------------------------------------------
|
|
184 |
void CTFAccessoryTestControl::ResetAccessoryServices( void )
|
|
185 |
{
|
|
186 |
ResetAccessoryServer();
|
|
187 |
|
|
188 |
iInitialized = EFalse;
|
|
189 |
|
|
190 |
iAccessoryServer.Close();
|
|
191 |
}
|
|
192 |
|
|
193 |
//
|
|
194 |
// ----------------------------------------------------------------------------------
|
|
195 |
// CTFAccessoryTestControl::ResetAccessoryServer
|
|
196 |
// ----------------------------------------------------------------------------------
|
|
197 |
void CTFAccessoryTestControl::ResetAccessoryServer( void )
|
|
198 |
{
|
|
199 |
|
|
200 |
COMPONENT_TRACE( ( _L( "CTFAccessoryTestControl::ResetAccessoryServer()" ) ) );
|
|
201 |
|
|
202 |
CTFTestControlObserver* observerItem;
|
|
203 |
if( !iStack.IsEmpty() )
|
|
204 |
{
|
|
205 |
iStackIter.SetToFirst();
|
|
206 |
|
|
207 |
while( ( observerItem = iStackIter++ ) != NULL )
|
|
208 |
{
|
|
209 |
observerItem->Cancel();
|
|
210 |
User::After( 2000000 );
|
|
211 |
iStack.Remove( *observerItem );
|
|
212 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::ResetAccessoryServer -- Remove Observer" ) ) );
|
|
213 |
delete observerItem;
|
|
214 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::ResetAccessoryServer -- Delete Observer" ) ) );
|
|
215 |
};
|
|
216 |
}
|
|
217 |
|
|
218 |
iStack.Reset();
|
|
219 |
|
|
220 |
TAccPolGenericID emptyInstance;
|
|
221 |
|
|
222 |
for( TInt i( 0 ); i < 10; i++ )
|
|
223 |
{
|
|
224 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::ResetAccessoryServer -- Clear instances" ) ) );
|
|
225 |
if( KErrNotFound != iGenericId[i].UniqueID() )
|
|
226 |
{
|
|
227 |
if( iGenericId[i].PhysicalConnectionCaps( KPCBluetooth ) )
|
|
228 |
{
|
|
229 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::ResetAccessoryServer -- BT Found" ) ) );
|
|
230 |
TBTDevAddr BTDevAddr( iGenericId[i].DeviceAddress() );
|
|
231 |
if( iAccessoryBTControl != NULL )
|
|
232 |
{
|
|
233 |
TRequestStatus status;
|
|
234 |
status = KRequestPending;
|
|
235 |
iAccessoryBTControl->DisconnectAccessory( status, BTDevAddr );
|
|
236 |
User::WaitForRequest( status );
|
|
237 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::ResetAccessoryServer -- BT Disconnected" ) ) );
|
|
238 |
}
|
|
239 |
}
|
|
240 |
else
|
|
241 |
{
|
|
242 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::ResetAccessoryServer -- Wired Found" ) ) );
|
|
243 |
TPckgBuf<TTFAccessoryPublishAndSubscribe> buf;
|
|
244 |
buf().iMethod = ETFAsyDisc;
|
|
245 |
User::LeaveIfError( iSubscribe.Set( KTFAccessoryTestProperty,
|
|
246 |
KTFAccessoryMethod,
|
|
247 |
buf ) );
|
|
248 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::ResetAccessoryServer -- Wired Disconnected" ) ) );
|
|
249 |
}
|
|
250 |
}
|
|
251 |
iGenericId[i] = emptyInstance;
|
|
252 |
}
|
|
253 |
|
|
254 |
if( iAccessoryConnection != NULL )
|
|
255 |
{
|
|
256 |
iAccessoryConnection->CloseSubSession();
|
|
257 |
delete iAccessoryConnection;
|
|
258 |
iAccessoryConnection = NULL;
|
|
259 |
}
|
|
260 |
|
|
261 |
if( iAccessorySingleConnection != NULL )
|
|
262 |
{
|
|
263 |
iAccessorySingleConnection->CloseSubSession();
|
|
264 |
delete iAccessorySingleConnection;
|
|
265 |
iAccessorySingleConnection = NULL;
|
|
266 |
}
|
|
267 |
if( iAccessoryControl != NULL )
|
|
268 |
{
|
|
269 |
iAccessoryControl->CloseSubSession();
|
|
270 |
delete iAccessoryControl;
|
|
271 |
iAccessoryControl = NULL;
|
|
272 |
}
|
|
273 |
if( iAccessorySettings != NULL )
|
|
274 |
{
|
|
275 |
iAccessorySettings->CloseSubSession();
|
|
276 |
delete iAccessorySettings;
|
|
277 |
iAccessorySettings = NULL;
|
|
278 |
}
|
|
279 |
if( iAccessoryMode != NULL )
|
|
280 |
{
|
|
281 |
iAccessoryMode->CloseSubSession();
|
|
282 |
delete iAccessoryMode;
|
|
283 |
iAccessoryMode = NULL;
|
|
284 |
}
|
|
285 |
|
|
286 |
if( iAccessoryAudioControl != NULL )
|
|
287 |
{
|
|
288 |
iAccessoryAudioControl->CloseSubSession();
|
|
289 |
delete iAccessoryAudioControl;
|
|
290 |
iAccessoryAudioControl = NULL;
|
|
291 |
}
|
|
292 |
|
|
293 |
if( iAccessoryBTControl != NULL )
|
|
294 |
{
|
|
295 |
iAccessoryBTControl->CloseSubSession();
|
|
296 |
delete iAccessoryBTControl;
|
|
297 |
iAccessoryBTControl = NULL;
|
|
298 |
}
|
|
299 |
|
|
300 |
if( iSpeakerRightVolume != NULL )
|
|
301 |
{
|
|
302 |
delete iSpeakerRightVolume;
|
|
303 |
iSpeakerRightVolume = NULL;
|
|
304 |
}
|
|
305 |
|
|
306 |
if( iSpeakerLeftVolume != NULL )
|
|
307 |
{
|
|
308 |
delete iSpeakerLeftVolume;
|
|
309 |
iSpeakerLeftVolume = NULL;
|
|
310 |
}
|
|
311 |
|
|
312 |
if( iSpeakerMute != NULL )
|
|
313 |
{
|
|
314 |
delete iSpeakerMute;
|
|
315 |
iSpeakerMute = NULL;
|
|
316 |
}
|
|
317 |
|
|
318 |
if( iMicRightVolume != NULL )
|
|
319 |
{
|
|
320 |
delete iMicRightVolume;
|
|
321 |
iMicRightVolume = NULL;
|
|
322 |
}
|
|
323 |
|
|
324 |
if( iMicLeftVolume != NULL )
|
|
325 |
{
|
|
326 |
delete iMicLeftVolume;
|
|
327 |
iMicLeftVolume = NULL;
|
|
328 |
}
|
|
329 |
|
|
330 |
if( iStreamContainer != NULL )
|
|
331 |
{
|
|
332 |
delete iStreamContainer;
|
|
333 |
iStreamContainer = NULL;
|
|
334 |
}
|
|
335 |
|
|
336 |
if( iTopologyContainer != NULL )
|
|
337 |
{
|
|
338 |
delete iTopologyContainer;
|
|
339 |
iTopologyContainer = NULL;
|
|
340 |
}
|
|
341 |
|
|
342 |
COMPONENT_TRACE( ( _L( "CTFAccessoryTestControl::ResetAccessoryServer() - Success" ) ) );
|
|
343 |
}
|
|
344 |
//
|
|
345 |
// ----------------------------------------------------------------------------------
|
|
346 |
// CTFAccessoryTestControl::CancelOutStandingRequest
|
|
347 |
// ----------------------------------------------------------------------------------
|
|
348 |
void CTFAccessoryTestControl::CancelOutStandingRequest()
|
|
349 |
{
|
|
350 |
iObserverItem->Cancel();
|
|
351 |
}
|
|
352 |
|
|
353 |
//
|
|
354 |
// ----------------------------------------------------------------------------------
|
|
355 |
// CTFAccessoryTestControl::FillObjectL
|
|
356 |
// ----------------------------------------------------------------------------------
|
|
357 |
void CTFAccessoryTestControl::FillObjectL( CAccPolAudioStreamFormatCon* aContainer,
|
|
358 |
TStreamConObjectType aobjectType,
|
|
359 |
TInt64 aNumberOfObjects )
|
|
360 |
{
|
|
361 |
|
|
362 |
for( TInt i = 0; i < aNumberOfObjects; i++ )
|
|
363 |
{
|
|
364 |
switch( aobjectType )
|
|
365 |
{
|
|
366 |
case EAccPolAudioInputStreamObject:
|
|
367 |
{
|
|
368 |
CAccPolAudioStreamFormat* stream =
|
|
369 |
CAccPolAudioStreamFormat::NewLC( aobjectType,
|
|
370 |
i,
|
|
371 |
KUidFormatPCM16,
|
|
372 |
CAccPolAudioStreamFormat::EStereo,
|
|
373 |
CAccPolAudioStreamFormat::EBitsPerSample16,
|
|
374 |
i + 200 );
|
|
375 |
aContainer->AddL( *stream );
|
|
376 |
CleanupStack::PopAndDestroy( stream );
|
|
377 |
}
|
|
378 |
break;
|
|
379 |
|
|
380 |
case EAccPolAudioOutputStreamObject:
|
|
381 |
{
|
|
382 |
|
|
383 |
CAccPolAudioStreamFormat
|
|
384 |
* stream =
|
|
385 |
CAccPolAudioStreamFormat::NewLC( EAccPolAudioOutputStreamObject );
|
|
386 |
|
|
387 |
stream->SetUnitId( i );
|
|
388 |
stream->SetAudioFormat( KUidFormatPCM16 );
|
|
389 |
stream->SetStreamType( CAccPolAudioStreamFormat::EMono );
|
|
390 |
stream->SetBitResolution( CAccPolAudioStreamFormat::EBitsPerSample32 );
|
|
391 |
stream->SetSamFreq( i + 200 );
|
|
392 |
|
|
393 |
aContainer->AddL( *stream );
|
|
394 |
CleanupStack::PopAndDestroy( stream );
|
|
395 |
}
|
|
396 |
break;
|
|
397 |
|
|
398 |
default:
|
|
399 |
{
|
|
400 |
TRACE_ASSERT_ALWAYS;
|
|
401 |
}
|
|
402 |
break;
|
|
403 |
}
|
|
404 |
}
|
|
405 |
|
|
406 |
}
|
|
407 |
|
|
408 |
//
|
|
409 |
// ----------------------------------------------------------------------------------
|
|
410 |
// CTFAccessoryTestControl::CreateObjectPubSub
|
|
411 |
// ----------------------------------------------------------------------------------
|
|
412 |
void CTFAccessoryTestControl::CreateObjectPubSubL( TStreamConObjectType aobjectType,
|
|
413 |
TInt64 aNumberOfObjects,
|
|
414 |
TStreamConObjectType aobjectType2,
|
|
415 |
TInt64 aNumberOfObjects2 )
|
|
416 |
{
|
|
417 |
RProperty prop;
|
|
418 |
prop.Define( KTFAccessoryTestProperty,
|
|
419 |
KTFAccessoryObjectMethod,
|
|
420 |
RProperty::EByteArray );
|
|
421 |
|
|
422 |
CAccPolAudioStreamFormatCon* container =
|
|
423 |
CAccPolAudioStreamFormatCon::NewLC();
|
|
424 |
|
|
425 |
FillObjectL( container, aobjectType, aNumberOfObjects );
|
|
426 |
FillObjectL( container, aobjectType2, aNumberOfObjects2 );
|
|
427 |
|
|
428 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
429 |
CleanupStack::PushL( buf );
|
|
430 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
431 |
|
|
432 |
//Externalize container to buf
|
|
433 |
RBufWriteStream wStrm;
|
|
434 |
( void )wStrm.Open( *buf );
|
|
435 |
wStrm.PushL();
|
|
436 |
container->ExternalizeL( wStrm );
|
|
437 |
wStrm.CommitL();
|
|
438 |
wStrm.Close();
|
|
439 |
wStrm.Pop();
|
|
440 |
|
|
441 |
TPtr8 ptr( buf->Ptr( 0 ) );
|
|
442 |
|
|
443 |
TInt retval = prop.Set( KTFAccessoryTestProperty,
|
|
444 |
KTFAccessoryObjectMethod,
|
|
445 |
ptr );
|
|
446 |
|
|
447 |
CleanupStack::PopAndDestroy( buf );
|
|
448 |
CleanupStack::PopAndDestroy( container );
|
|
449 |
}
|
|
450 |
|
|
451 |
//
|
|
452 |
// ----------------------------------------------------------------------------------
|
|
453 |
// CTFAccessoryTestControl::CreateObjectPubSub
|
|
454 |
// ----------------------------------------------------------------------------------
|
|
455 |
void CTFAccessoryTestControl::CreateTopologyObjectsToPubSubL(
|
|
456 |
TTFAccessoryTestCaseStateControl& aParameter )
|
|
457 |
{
|
|
458 |
RProperty prop;
|
|
459 |
prop.Define( KTFAccessoryTestProperty,
|
|
460 |
KTFAccessoryObjectMethod,
|
|
461 |
RProperty::EByteArray );
|
|
462 |
|
|
463 |
CAccPolAudioTopologyObjectCon* aObject =
|
|
464 |
CAccPolAudioTopologyObjectCon::NewLC();
|
|
465 |
|
|
466 |
//Speaker
|
|
467 |
//OT-3
|
|
468 |
CAccPolOutputTerminal* OT3 = CAccPolOutputTerminal::NewLC( 3,
|
|
469 |
CAccPolOutputTerminal::EAPTHeadphone,
|
|
470 |
2 );
|
|
471 |
//Connected to FU-2
|
|
472 |
aObject->AddL( *OT3 );
|
|
473 |
|
|
474 |
//FU2
|
|
475 |
CAccPolFeatureUnit* FU2 = CAccPolFeatureUnit::NewLC( 2, 8 );
|
|
476 |
// Volume control object.
|
|
477 |
CAccPolVolumeControl* speakerRightVolume =
|
|
478 |
CAccPolVolumeControl::NewLC( KAccRightFrontChannel, 7, 5, 20, 5 );
|
|
479 |
CAccPolVolumeControl* speakerLeftVolume =
|
|
480 |
CAccPolVolumeControl::NewLC( KAccLeftFrontChannel, 7, 5, 20, 5 );
|
|
481 |
|
|
482 |
CAccPolMuteControl* speakermute =
|
|
483 |
CAccPolMuteControl::NewLC( KAccMasterChannel, ETrue );
|
|
484 |
|
|
485 |
FU2->AddControlL( *speakerRightVolume );
|
|
486 |
FU2->AddControlL( *speakerLeftVolume );
|
|
487 |
FU2->AddControlL( *speakermute );
|
|
488 |
|
|
489 |
//Connected to MU-8
|
|
490 |
aObject->AddL( *FU2 );
|
|
491 |
|
|
492 |
CAccPolMixerUnit* MU8 = CAccPolMixerUnit::NewLC( 8 );
|
|
493 |
MU8->AddSourceIdL( 1 );
|
|
494 |
MU8->AddSourceIdL( 7 );
|
|
495 |
|
|
496 |
//Connected to IT1 and FU7
|
|
497 |
aObject->AddL( *MU8 );
|
|
498 |
|
|
499 |
//Choice one
|
|
500 |
//IT-1
|
|
501 |
TUint8 aChannelCount = 2;
|
|
502 |
TUint16 aChannelConfig = 0;
|
|
503 |
aChannelConfig = aChannelConfig | KAccRightFrontChannel;
|
|
504 |
aChannelConfig = aChannelConfig | KAccLeftFrontChannel;
|
|
505 |
|
|
506 |
CAccPolInputTerminal* IT1 = CAccPolInputTerminal::NewLC( 1,
|
|
507 |
CAccPolInputTerminal::EAPTStream,
|
|
508 |
aChannelCount,
|
|
509 |
aChannelConfig );
|
|
510 |
aObject->AddL( *IT1 );
|
|
511 |
|
|
512 |
//choice two
|
|
513 |
//FU7
|
|
514 |
CAccPolFeatureUnit* FU7 = CAccPolFeatureUnit::NewLC( 7, 5 ); //Connected to FU5
|
|
515 |
// Volume control object.
|
|
516 |
CAccPolVolumeControl* sidetoneRightVolume =
|
|
517 |
CAccPolVolumeControl::NewLC( KAccMasterChannel, 7, 5, 20, 5 );
|
|
518 |
CAccPolVolumeControl* sidetoneLeftVolume =
|
|
519 |
CAccPolVolumeControl::NewLC( KAccMasterChannel, 7, 5, 20, 5 );
|
|
520 |
|
|
521 |
FU7->AddControlL( *sidetoneRightVolume );
|
|
522 |
FU7->AddControlL( *sidetoneLeftVolume );
|
|
523 |
|
|
524 |
aObject->AddL( *FU7 );
|
|
525 |
|
|
526 |
//Microphone
|
|
527 |
//IT-4
|
|
528 |
|
|
529 |
//OT-6
|
|
530 |
CAccPolOutputTerminal* OT6 = CAccPolOutputTerminal::NewLC( 6,
|
|
531 |
CAccPolOutputTerminal::EAPTStream,
|
|
532 |
10 );
|
|
533 |
//Connected to SU-10
|
|
534 |
aObject->AddL( *OT6 );
|
|
535 |
|
|
536 |
//SU-10
|
|
537 |
CAccPolSelectorUnit* SU10 = CAccPolSelectorUnit::NewLC( 10, 1 );
|
|
538 |
|
|
539 |
// Connected to FU 5
|
|
540 |
SU10->AddSourceIdL( 5 );
|
|
541 |
aObject->AddL( *SU10 );
|
|
542 |
|
|
543 |
//FU5
|
|
544 |
CAccPolFeatureUnit* FU5 = CAccPolFeatureUnit::NewLC( 5, 9 );
|
|
545 |
|
|
546 |
// Volume control object.
|
|
547 |
CAccPolVolumeControl* micRightVolume =
|
|
548 |
CAccPolVolumeControl::NewLC( KAccRightFrontChannel, 7, 5, 20, 5 );
|
|
549 |
CAccPolVolumeControl* micLeftVolume =
|
|
550 |
CAccPolVolumeControl::NewLC( KAccLeftFrontChannel, 7, 5, 20, 5 );
|
|
551 |
CAccPolMuteControl* micmute = CAccPolMuteControl::NewLC( KAccMasterChannel,
|
|
552 |
ETrue );
|
|
553 |
|
|
554 |
FU5->AddControlL( *micRightVolume );
|
|
555 |
FU5->AddControlL( *micLeftVolume );
|
|
556 |
FU5->AddControlL( *micmute );
|
|
557 |
|
|
558 |
//Connected to FU-9
|
|
559 |
aObject->AddL( *FU5 );
|
|
560 |
|
|
561 |
///FU9
|
|
562 |
CAccPolFeatureUnit* FU9 = CAccPolFeatureUnit::NewLC( 9, 4 );
|
|
563 |
//Connected IT-4
|
|
564 |
aObject->AddL( *FU9 );
|
|
565 |
|
|
566 |
CAccPolInputTerminal* IT4 = CAccPolInputTerminal::NewLC( 4,
|
|
567 |
CAccPolInputTerminal::EAPTMicrophone,
|
|
568 |
aChannelCount,
|
|
569 |
aChannelConfig );
|
|
570 |
aObject->AddL( *IT4 );
|
|
571 |
|
|
572 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
573 |
CleanupStack::PushL( buf );
|
|
574 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
575 |
|
|
576 |
//Externalize container to buf
|
|
577 |
RBufWriteStream wStrm;
|
|
578 |
( void )wStrm.Open( *buf );
|
|
579 |
wStrm.PushL();
|
|
580 |
aObject->ExternalizeL( wStrm );
|
|
581 |
wStrm.CommitL();
|
|
582 |
wStrm.Close();
|
|
583 |
wStrm.Pop();
|
|
584 |
TPtr8 ptr( buf->Ptr( 0 ) );
|
|
585 |
TInt retval = prop.Set( KTFAccessoryTestProperty,
|
|
586 |
KTFAccessoryObjectMethod,
|
|
587 |
ptr );
|
|
588 |
|
|
589 |
// Notify ASY stub
|
|
590 |
if( aParameter.iArg2 )
|
|
591 |
{
|
|
592 |
PublishAndSubscribeL( aParameter );
|
|
593 |
}
|
|
594 |
|
|
595 |
CleanupStack::PopAndDestroy( buf );
|
|
596 |
CleanupStack::PopAndDestroy( IT4 );
|
|
597 |
CleanupStack::PopAndDestroy( FU9 );
|
|
598 |
CleanupStack::PopAndDestroy( micmute );
|
|
599 |
CleanupStack::PopAndDestroy( micLeftVolume );
|
|
600 |
CleanupStack::PopAndDestroy( micRightVolume );
|
|
601 |
CleanupStack::PopAndDestroy( FU5 );
|
|
602 |
CleanupStack::PopAndDestroy( SU10 );
|
|
603 |
CleanupStack::PopAndDestroy( OT6 );
|
|
604 |
CleanupStack::PopAndDestroy( sidetoneLeftVolume );
|
|
605 |
CleanupStack::PopAndDestroy( sidetoneRightVolume );
|
|
606 |
CleanupStack::PopAndDestroy( FU7 );
|
|
607 |
CleanupStack::PopAndDestroy( IT1 );
|
|
608 |
CleanupStack::PopAndDestroy( MU8 );
|
|
609 |
CleanupStack::PopAndDestroy( speakermute );
|
|
610 |
CleanupStack::PopAndDestroy( speakerLeftVolume );
|
|
611 |
CleanupStack::PopAndDestroy( speakerRightVolume );
|
|
612 |
CleanupStack::PopAndDestroy( FU2 );
|
|
613 |
CleanupStack::PopAndDestroy( OT3 );
|
|
614 |
CleanupStack::PopAndDestroy( aObject );
|
|
615 |
}
|
|
616 |
|
|
617 |
//
|
|
618 |
// ----------------------------------------------------------------------------------
|
|
619 |
// CTFAccessoryTestControl::CallAccessoryFunctionL
|
|
620 |
// ----------------------------------------------------------------------------------
|
|
621 |
void CTFAccessoryTestControl::CallAccessoryFunctionL( TTFAccessoryTestCaseStateControl& aParameter )
|
|
622 |
{
|
|
623 |
|
|
624 |
// COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::CallAccessoryFunctionL(%d, %d, %d)" ), aParameter.iAccessoryFunction, aParameter.iArg1, aParameter.iArg2 ) );
|
|
625 |
if( !iInitialized )
|
|
626 |
{
|
|
627 |
InitializeL();
|
|
628 |
}
|
|
629 |
|
|
630 |
TInt retval = KTFErrAccessoryServiceMissing;
|
|
631 |
|
|
632 |
switch( aParameter.iAccessoryFunction )
|
|
633 |
{
|
|
634 |
case ETFAccessorySet_ObjectPubSub:
|
|
635 |
{
|
|
636 |
CreateObjectPubSubL( ( TStreamConObjectType )aParameter.iArg1,
|
|
637 |
aParameter.iArg2,
|
|
638 |
( TStreamConObjectType )aParameter.iArg3,
|
|
639 |
aParameter.iArg4 );
|
|
640 |
retval = KErrNone;
|
|
641 |
}
|
|
642 |
break;
|
|
643 |
|
|
644 |
case ETFAccessorySet_TopologyObjectsPubSub:
|
|
645 |
{
|
|
646 |
CreateTopologyObjectsToPubSubL( aParameter );
|
|
647 |
retval = KErrNone;
|
|
648 |
}
|
|
649 |
break;
|
|
650 |
|
|
651 |
case ETFAccessorySet_PubSub:
|
|
652 |
{
|
|
653 |
RProperty prop;
|
|
654 |
prop.Define( KTFAccessoryTestProperty,
|
|
655 |
KTFAccessoryNotifierMethod,
|
|
656 |
RProperty::EInt );
|
|
657 |
retval = prop.Set( KTFAccessoryTestProperty,
|
|
658 |
KTFAccessoryNotifierMethod,
|
|
659 |
aParameter.iArg1 );
|
|
660 |
}
|
|
661 |
break;
|
|
662 |
|
|
663 |
case ETFConnectWiredAccessory:
|
|
664 |
{
|
|
665 |
PublishAndSubscribeL( aParameter );
|
|
666 |
retval = KErrNone;
|
|
667 |
}
|
|
668 |
break;
|
|
669 |
|
|
670 |
case ETFClearStack:
|
|
671 |
{
|
|
672 |
CTFTestControlObserver* observerItem;
|
|
673 |
TInt count = 0;
|
|
674 |
if( !iStack.IsEmpty() )
|
|
675 |
{
|
|
676 |
iStackIter.SetToFirst();
|
|
677 |
|
|
678 |
while( ( observerItem = iStackIter++ ) != NULL )
|
|
679 |
{
|
|
680 |
observerItem->Cancel();
|
|
681 |
iStack.Remove( *observerItem );
|
|
682 |
delete observerItem;
|
|
683 |
count++;
|
|
684 |
};
|
|
685 |
}
|
|
686 |
|
|
687 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestCaseControl::ETF_Pappa - count=%d " ), count ) );
|
|
688 |
retval = KErrNone;
|
|
689 |
}
|
|
690 |
break;
|
|
691 |
|
|
692 |
case ETFDisconnectWiredAccessory:
|
|
693 |
{
|
|
694 |
retval = KErrNone;
|
|
695 |
PublishAndSubscribeL( aParameter );
|
|
696 |
TAccPolGenericID emptyInstance;
|
|
697 |
iGenericId[aParameter.iGid] = emptyInstance;
|
|
698 |
}
|
|
699 |
break;
|
|
700 |
|
|
701 |
case ETFCheckCapabilityGroup:
|
|
702 |
{
|
|
703 |
if( aParameter.iArg2
|
|
704 |
== iGenericId[aParameter.iGid].SubblockCaps( aParameter.iArg3 ) )
|
|
705 |
{
|
|
706 |
retval = KErrNone;
|
|
707 |
}
|
|
708 |
else
|
|
709 |
{
|
|
710 |
retval = KErrNotFound;
|
|
711 |
}
|
|
712 |
}
|
|
713 |
break;
|
|
714 |
|
|
715 |
case ETFCheckCapability:
|
|
716 |
{
|
|
717 |
RAccessoryConnection accessoryConnectionn;
|
|
718 |
accessoryConnectionn.CreateSubSession( iAccessoryServer );
|
|
719 |
|
|
720 |
CAccPolSubblockNameArray* nameArrayy =
|
|
721 |
CAccPolSubblockNameArray::NewL();
|
|
722 |
CleanupStack::PushL( nameArrayy );
|
|
723 |
accessoryConnectionn.GetSubblockNameArrayL( iGenericId[aParameter.iGid],
|
|
724 |
*nameArrayy );
|
|
725 |
|
|
726 |
if( aParameter.iArg2 == nameArrayy->HasName( aParameter.iArg3 ) )
|
|
727 |
{
|
|
728 |
retval = KErrNone;
|
|
729 |
}
|
|
730 |
else
|
|
731 |
{
|
|
732 |
retval = KErrNotFound;
|
|
733 |
}
|
|
734 |
|
|
735 |
CleanupStack::PopAndDestroy( nameArrayy );
|
|
736 |
accessoryConnectionn.CloseSubSession();
|
|
737 |
}
|
|
738 |
break;
|
|
739 |
|
|
740 |
case ETFFindAndCheckRequest:
|
|
741 |
|
|
742 |
{
|
|
743 |
FindAndCheckRequestL(&retval, aParameter);
|
|
744 |
}
|
|
745 |
break;
|
|
746 |
|
|
747 |
case ETFFindAndCheckObjectRequest:
|
|
748 |
{
|
|
749 |
CTFAccessoryTestCaseControl* testCase = STATIC_CAST( CTFAccessoryTestCaseControl*, CurrentTestCase());
|
|
750 |
TRACE_ASSERT( testCase != NULL );
|
|
751 |
if( testCase != NULL )
|
|
752 |
{
|
|
753 |
if( !iStack.IsEmpty() )
|
|
754 |
{
|
|
755 |
iStackIter.SetToFirst();
|
|
756 |
|
|
757 |
while( ( iObserverItem = iStackIter++ ) != NULL )
|
|
758 |
{
|
|
759 |
if( iObserverItem->FindRequest( aParameter.iRequestType ) )
|
|
760 |
{
|
|
761 |
testCase->CheckObjectRequest( iObserverItem->iStatus,
|
|
762 |
iObserverItem->iObjectValue,
|
|
763 |
iObserverItem->iCapabilityName );
|
|
764 |
|
|
765 |
if( !iStack.IsEmpty() ) // Check if observes are already deleted by CheckRequest()
|
|
766 |
{
|
|
767 |
if( KTFDontDeleteObserver != aParameter.iArg1 )
|
|
768 |
{
|
|
769 |
iStack.Remove( *iObserverItem );
|
|
770 |
delete iObserverItem;
|
|
771 |
return;
|
|
772 |
}
|
|
773 |
else
|
|
774 |
{
|
|
775 |
User::Leave( KTFDontDeleteObserver );
|
|
776 |
}
|
|
777 |
}
|
|
778 |
else
|
|
779 |
{
|
|
780 |
retval = KErrGeneral;
|
|
781 |
}
|
|
782 |
}
|
|
783 |
}
|
|
784 |
}
|
|
785 |
else
|
|
786 |
{
|
|
787 |
retval = KErrGeneral;
|
|
788 |
}
|
|
789 |
}
|
|
790 |
|
|
791 |
retval = KErrNone;
|
|
792 |
}
|
|
793 |
break;
|
|
794 |
|
|
795 |
//
|
|
796 |
// Accessory Connection
|
|
797 |
//
|
|
798 |
case ETFAccessoryConnection_Open:
|
|
799 |
{
|
|
800 |
AccessoryConnectionOpenClose(ETFAccessoryConnection_Open, &retval);
|
|
801 |
}
|
|
802 |
break;
|
|
803 |
|
|
804 |
case ETFAccessoryConnection_Close:
|
|
805 |
|
|
806 |
{
|
|
807 |
AccessoryConnectionOpenClose(ETFAccessoryConnection_Close, &retval);
|
|
808 |
}
|
|
809 |
break;
|
|
810 |
|
|
811 |
//
|
|
812 |
// Accessory Settings
|
|
813 |
//
|
|
814 |
case ETFAccessorySettings_Open:
|
|
815 |
{
|
|
816 |
AccessorySettingsOpenClose(ETFAccessorySettings_Open, &retval);
|
|
817 |
}
|
|
818 |
break;
|
|
819 |
|
|
820 |
case ETFAccessorySettings_Close:
|
|
821 |
{
|
|
822 |
AccessorySettingsOpenClose(ETFAccessorySettings_Close, &retval);
|
|
823 |
}
|
|
824 |
break;
|
|
825 |
|
|
826 |
case ETFSetHWDeviceSettings:
|
|
827 |
{
|
|
828 |
retval
|
|
829 |
= iAccessorySettings->SetHWDeviceSettingsL( aParameter.iArg1,
|
|
830 |
( TBool )aParameter.iArg2 );
|
|
831 |
}
|
|
832 |
break;
|
|
833 |
|
|
834 |
case ETFGetHWDeviceSettings:
|
|
835 |
{
|
|
836 |
TUint32 aSettingsValue( 0 );
|
|
837 |
retval = iAccessorySettings->GetHWDeviceSettings( aSettingsValue );
|
|
838 |
|
|
839 |
if( aSettingsValue != aParameter.iArg1 )
|
|
840 |
{
|
|
841 |
retval = KErrArgument;
|
|
842 |
}
|
|
843 |
}
|
|
844 |
break;
|
|
845 |
|
|
846 |
case ETFGetSupportedHWDeviceSettings:
|
|
847 |
{
|
|
848 |
TUint32 aSettingsSupportedValue( 0 );
|
|
849 |
|
|
850 |
retval
|
|
851 |
= iAccessorySettings->GetSupportedHWDeviceSettings( aSettingsSupportedValue );
|
|
852 |
|
|
853 |
if( aSettingsSupportedValue != ( aParameter.iArg1
|
|
854 |
| aParameter.iArg2 ) )
|
|
855 |
{
|
|
856 |
retval = KErrArgument;
|
|
857 |
}
|
|
858 |
}
|
|
859 |
break;
|
|
860 |
|
|
861 |
case ETFSetIntAccessoryModeSetting:
|
|
862 |
{
|
|
863 |
TAccMode aAccMode = ( TAccMode )aParameter.iArg1;
|
|
864 |
TAccModeSetting aSetting;
|
|
865 |
|
|
866 |
//Set Lights
|
|
867 |
aSetting.SetId( aParameter.iArg2 );
|
|
868 |
aSetting.SetTInt( aParameter.iArg4 );
|
|
869 |
|
|
870 |
retval = iAccessorySettings->SetAccessoryModeSettingL( aAccMode,
|
|
871 |
aSetting );
|
|
872 |
}
|
|
873 |
break;
|
|
874 |
|
|
875 |
case ETFSetBoolAccessoryModeSetting:
|
|
876 |
{
|
|
877 |
TAccMode aAccMode = ( TAccMode )aParameter.iArg1;
|
|
878 |
TAccModeSetting aSetting;
|
|
879 |
|
|
880 |
//Set Lights
|
|
881 |
aSetting.SetId( aParameter.iArg2 );
|
|
882 |
aSetting.SetTBool( aParameter.iArg4 );
|
|
883 |
|
|
884 |
retval = iAccessorySettings->SetAccessoryModeSettingL( aAccMode,
|
|
885 |
aSetting );
|
|
886 |
}
|
|
887 |
break;
|
|
888 |
|
|
889 |
case ETFSetDesAccessoryModeSetting:
|
|
890 |
{
|
|
891 |
TAccMode aAccMode = ( TAccMode )aParameter.iArg1;
|
|
892 |
TAccModeSetting aSetting;
|
|
893 |
|
|
894 |
TBuf<KMaxAccModeSetting> buf;
|
|
895 |
buf.Num( aParameter.iArg3 );
|
|
896 |
// buf.Copy( *aParameter.iArg3 );
|
|
897 |
|
|
898 |
aSetting.SetId( aParameter.iArg2 );
|
|
899 |
aSetting.SetTDes( buf );
|
|
900 |
retval = iAccessorySettings->SetAccessoryModeSettingL( aAccMode,
|
|
901 |
aSetting );
|
|
902 |
}
|
|
903 |
break;
|
|
904 |
|
|
905 |
case ETFGetIntAccessoryModeSetting:
|
|
906 |
{
|
|
907 |
TInt aSettingsValueInt;
|
|
908 |
|
|
909 |
TAccMode aAccMode = ( TAccMode )aParameter.iArg1;
|
|
910 |
TAccModeSetting aSetting;
|
|
911 |
aSetting.SetId( aParameter.iArg2 );
|
|
912 |
|
|
913 |
retval = iAccessorySettings->GetAccessoryModeSetting( aAccMode,
|
|
914 |
aSetting );
|
|
915 |
|
|
916 |
if( aSetting.Type() == EAccModeSettingInt )
|
|
917 |
{
|
|
918 |
retval = aSetting.GetTInt( aSettingsValueInt );
|
|
919 |
|
|
920 |
if( retval != KErrNotFound )
|
|
921 |
{
|
|
922 |
if( aSettingsValueInt == aParameter.iArg4 )
|
|
923 |
{
|
|
924 |
retval = KErrNone;
|
|
925 |
}
|
|
926 |
else
|
|
927 |
{
|
|
928 |
retval = KErrArgument;
|
|
929 |
}
|
|
930 |
}
|
|
931 |
}
|
|
932 |
else
|
|
933 |
{
|
|
934 |
retval = KErrNotFound;
|
|
935 |
}
|
|
936 |
}
|
|
937 |
break;
|
|
938 |
|
|
939 |
case ETFGetBoolAccessoryModeSetting:
|
|
940 |
{
|
|
941 |
TBool aSettingsValueBool;
|
|
942 |
|
|
943 |
TAccMode aAccMode = ( TAccMode )aParameter.iArg1;
|
|
944 |
TAccModeSetting aSetting;
|
|
945 |
aSetting.SetId( aParameter.iArg2 );
|
|
946 |
|
|
947 |
retval = iAccessorySettings->GetAccessoryModeSetting( aAccMode,
|
|
948 |
aSetting );
|
|
949 |
|
|
950 |
if( aSetting.Type() == EAccModeSettingBool )
|
|
951 |
{
|
|
952 |
retval = aSetting.GetTBool( aSettingsValueBool );
|
|
953 |
|
|
954 |
if( retval != KErrNotFound )
|
|
955 |
{
|
|
956 |
if( aSettingsValueBool == ( TBool )aParameter.iArg4 )
|
|
957 |
{
|
|
958 |
retval = KErrNone;
|
|
959 |
}
|
|
960 |
else
|
|
961 |
{
|
|
962 |
retval = KErrArgument;
|
|
963 |
}
|
|
964 |
}
|
|
965 |
}
|
|
966 |
else
|
|
967 |
{
|
|
968 |
retval = KErrNotFound;
|
|
969 |
}
|
|
970 |
}
|
|
971 |
break;
|
|
972 |
|
|
973 |
case ETFGetDesAccessoryModeSetting:
|
|
974 |
{
|
|
975 |
TBuf<KMaxAccModeSetting> aSettingsValueDes;
|
|
976 |
|
|
977 |
TAccMode aAccMode = ( TAccMode )aParameter.iArg1;
|
|
978 |
TAccModeSetting aSetting;
|
|
979 |
aSetting.SetId( aParameter.iArg2 );
|
|
980 |
|
|
981 |
retval = iAccessorySettings->GetAccessoryModeSetting( aAccMode,
|
|
982 |
aSetting );
|
|
983 |
|
|
984 |
if( aSetting.Type() == EAccModeSettingDes )
|
|
985 |
{
|
|
986 |
retval = aSetting.GetTDes( aSettingsValueDes );
|
|
987 |
|
|
988 |
if( retval != KErrNotFound )
|
|
989 |
{
|
|
990 |
TBuf<KMaxAccModeSetting> buffer;
|
|
991 |
buffer.Num( aParameter.iArg3 );
|
|
992 |
if( KErrNone == aSettingsValueDes.Compare( buffer ) )
|
|
993 |
{
|
|
994 |
retval = KErrNone;
|
|
995 |
}
|
|
996 |
else
|
|
997 |
{
|
|
998 |
retval = KErrArgument;
|
|
999 |
}
|
|
1000 |
}
|
|
1001 |
}
|
|
1002 |
else
|
|
1003 |
{
|
|
1004 |
retval = KErrNotFound;
|
|
1005 |
}
|
|
1006 |
}
|
|
1007 |
break;
|
|
1008 |
|
|
1009 |
case ETFSetSeveralAccessoryModeSetting:
|
|
1010 |
{
|
|
1011 |
|
|
1012 |
TAccModeSetting accModeSettingIn;
|
|
1013 |
TAccMode tAccMode = EAccModeWirelessHeadset;
|
|
1014 |
TBuf<KMaxAccModeSetting> aDesIn;
|
|
1015 |
// Set
|
|
1016 |
// setting 1
|
|
1017 |
accModeSettingIn.SetId( 11 ); // unknown TInt
|
|
1018 |
accModeSettingIn.SetTInt( 1 );
|
|
1019 |
TAccModeSettingArray arrayIn;
|
|
1020 |
arrayIn.AddSetting( accModeSettingIn );
|
|
1021 |
|
|
1022 |
// setting 2
|
|
1023 |
accModeSettingIn.SetId( 12 ); // unknown Des
|
|
1024 |
_LIT( KAccSetting2, "012345678901234567890" );
|
|
1025 |
aDesIn.Copy( KAccSetting2 );
|
|
1026 |
accModeSettingIn.SetTDes( aDesIn );
|
|
1027 |
arrayIn.AddSetting( accModeSettingIn );
|
|
1028 |
|
|
1029 |
// setting 3
|
|
1030 |
accModeSettingIn.SetId( 13 ); // unknown TBool
|
|
1031 |
accModeSettingIn.SetTBool( ETrue );
|
|
1032 |
arrayIn.AddSetting( accModeSettingIn );
|
|
1033 |
|
|
1034 |
retval = iAccessorySettings->SetAccessoryModeSettingsL( tAccMode,
|
|
1035 |
arrayIn );
|
|
1036 |
|
|
1037 |
}
|
|
1038 |
break;
|
|
1039 |
|
|
1040 |
case ETFGetSeveralAccessoryModeSetting:
|
|
1041 |
{
|
|
1042 |
|
|
1043 |
TAccModeSetting accModeSettingOut;
|
|
1044 |
TAccMode tAccMode = EAccModeWirelessHeadset;
|
|
1045 |
TBuf<KMaxAccModeSetting> aDesOut;
|
|
1046 |
TAccModeSettingArray arrayOut;
|
|
1047 |
TInt intOut( 0 );
|
|
1048 |
// set input parameters for GetAccessoryModeSettings()
|
|
1049 |
// setting 11
|
|
1050 |
accModeSettingOut.SetId( 11 );
|
|
1051 |
arrayOut.AddSetting( accModeSettingOut );
|
|
1052 |
|
|
1053 |
// setting 12
|
|
1054 |
accModeSettingOut.SetId( 12 );
|
|
1055 |
arrayOut.AddSetting( accModeSettingOut );
|
|
1056 |
|
|
1057 |
// setting 13
|
|
1058 |
accModeSettingOut.SetId( 13 );
|
|
1059 |
arrayOut.AddSetting( accModeSettingOut );
|
|
1060 |
|
|
1061 |
retval = iAccessorySettings->GetAccessoryModeSettings( tAccMode,
|
|
1062 |
arrayOut );
|
|
1063 |
|
|
1064 |
// Check that got settings are right
|
|
1065 |
|
|
1066 |
TInt count = arrayOut.GetArraySize();
|
|
1067 |
TInt foundCount( 0 );
|
|
1068 |
|
|
1069 |
for( TInt index = 0; index < count; index++ )
|
|
1070 |
{
|
|
1071 |
arrayOut.GetSetting( index, accModeSettingOut );
|
|
1072 |
|
|
1073 |
if( 11 == accModeSettingOut.Id() )
|
|
1074 |
{
|
|
1075 |
|
|
1076 |
accModeSettingOut.GetTInt( intOut );
|
|
1077 |
|
|
1078 |
if( 1 == intOut )
|
|
1079 |
{
|
|
1080 |
foundCount++;
|
|
1081 |
}
|
|
1082 |
}
|
|
1083 |
|
|
1084 |
if( 12 == accModeSettingOut.Id() )
|
|
1085 |
{
|
|
1086 |
accModeSettingOut.GetTDes( aDesOut );
|
|
1087 |
|
|
1088 |
if( KErrNone == aDesOut.Compare( _L("012345678901234567890") ) )
|
|
1089 |
{
|
|
1090 |
foundCount++;
|
|
1091 |
}
|
|
1092 |
|
|
1093 |
}
|
|
1094 |
|
|
1095 |
if( 13 == accModeSettingOut.Id() )
|
|
1096 |
{
|
|
1097 |
|
|
1098 |
accModeSettingOut.GetTBool( intOut );
|
|
1099 |
|
|
1100 |
if( intOut )
|
|
1101 |
{
|
|
1102 |
foundCount++;
|
|
1103 |
}
|
|
1104 |
}
|
|
1105 |
}
|
|
1106 |
|
|
1107 |
if( foundCount != 3 )
|
|
1108 |
{
|
|
1109 |
retval = KErrNotFound;
|
|
1110 |
}
|
|
1111 |
|
|
1112 |
//
|
|
1113 |
// Reset Settings
|
|
1114 |
//
|
|
1115 |
TAccModeSetting accModeSettingIn;
|
|
1116 |
TBuf<KMaxAccModeSetting> aDesIn;
|
|
1117 |
// Set
|
|
1118 |
// setting 1
|
|
1119 |
accModeSettingIn.SetId( 11 ); // unknown TInt
|
|
1120 |
accModeSettingIn.SetTInt( 0 );
|
|
1121 |
TAccModeSettingArray arrayIn;
|
|
1122 |
arrayIn.AddSetting( accModeSettingIn );
|
|
1123 |
|
|
1124 |
// setting 2
|
|
1125 |
accModeSettingIn.SetId( 12 ); // unknown Des
|
|
1126 |
_LIT( KAccSetting2, "" );
|
|
1127 |
aDesIn.Copy( KAccSetting2 );
|
|
1128 |
accModeSettingIn.SetTDes( aDesIn );
|
|
1129 |
arrayIn.AddSetting( accModeSettingIn );
|
|
1130 |
|
|
1131 |
// setting 3
|
|
1132 |
accModeSettingIn.SetId( 13 ); // unknown TBool
|
|
1133 |
accModeSettingIn.SetTBool( EFalse );
|
|
1134 |
arrayIn.AddSetting( accModeSettingIn );
|
|
1135 |
|
|
1136 |
iAccessorySettings->SetAccessoryModeSettingsL( tAccMode, arrayIn );
|
|
1137 |
}
|
|
1138 |
break;
|
|
1139 |
|
|
1140 |
//
|
|
1141 |
// Accessory Single Connection
|
|
1142 |
//
|
|
1143 |
case ETFAccessorySingleConnection_Open:
|
|
1144 |
{
|
|
1145 |
if( iAccessorySingleConnection == NULL )
|
|
1146 |
{
|
|
1147 |
iAccessorySingleConnection
|
|
1148 |
= new ( ELeave ) RAccessorySingleConnection;
|
|
1149 |
retval
|
|
1150 |
= iAccessorySingleConnection->CreateSubSession( iAccessoryServer );
|
|
1151 |
}
|
|
1152 |
else
|
|
1153 |
{
|
|
1154 |
retval = KErrNone;
|
|
1155 |
}
|
|
1156 |
}
|
|
1157 |
break;
|
|
1158 |
|
|
1159 |
case ETFAccessorySingleConnection_Close:
|
|
1160 |
{
|
|
1161 |
TRACE_ASSERT( iAccessorySingleConnection != NULL );
|
|
1162 |
|
|
1163 |
if( iAccessorySingleConnection != NULL )
|
|
1164 |
{
|
|
1165 |
iAccessorySingleConnection->CloseSubSession();
|
|
1166 |
delete iAccessorySingleConnection;
|
|
1167 |
iAccessorySingleConnection = NULL;
|
|
1168 |
}
|
|
1169 |
retval = KErrNone;
|
|
1170 |
}
|
|
1171 |
break;
|
|
1172 |
|
|
1173 |
case ETFAccessoryNotifyNewAccessoryConnected:
|
|
1174 |
{
|
|
1175 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1176 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1177 |
aConnectionObserver->NotifyNewAccessoryConnected( iGenericId[aParameter.iGid] );
|
|
1178 |
retval = KErrNone;
|
|
1179 |
}
|
|
1180 |
break;
|
|
1181 |
|
|
1182 |
case ETFAccessoryNotifyAccessoryDisconnected:
|
|
1183 |
{
|
|
1184 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1185 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1186 |
aConnectionObserver->NotifyAccessoryDisconnected( iGenericId[aParameter.iGid] );
|
|
1187 |
retval = KErrNone;
|
|
1188 |
}
|
|
1189 |
break;
|
|
1190 |
|
|
1191 |
case ETFNotifyIntAccessoryValueChanged:
|
|
1192 |
{
|
|
1193 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1194 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1195 |
aConnectionObserver->NotifyIntegerAccessoryValueChanged( iGenericId[aParameter.iGid],
|
|
1196 |
aParameter.iArg3 );
|
|
1197 |
retval = KErrNone;
|
|
1198 |
}
|
|
1199 |
break;
|
|
1200 |
|
|
1201 |
case ETFNotifyBoolAccessoryValueChanged:
|
|
1202 |
{
|
|
1203 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1204 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1205 |
aConnectionObserver->NotifyBooleanAccessoryValueChanged( iGenericId[aParameter.iGid],
|
|
1206 |
aParameter.iArg3 );
|
|
1207 |
retval = KErrNone;
|
|
1208 |
}
|
|
1209 |
break;
|
|
1210 |
|
|
1211 |
case ETFNotifyObjectAccessoryValueChanged:
|
|
1212 |
{
|
|
1213 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1214 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1215 |
aConnectionObserver->NotifyObjectAccessoryValueChanged( iGenericId[aParameter.iGid],
|
|
1216 |
aParameter.iArg3 );
|
|
1217 |
retval = KErrNone;
|
|
1218 |
}
|
|
1219 |
break;
|
|
1220 |
|
|
1221 |
case ETFAccessoryIntGetValue:
|
|
1222 |
{
|
|
1223 |
TAccPolNameRecord aNameRecord;
|
|
1224 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1225 |
TAccValueTypeTInt aIntValue;
|
|
1226 |
|
|
1227 |
iAccessorySingleConnection->GetValueL( iGenericId[aParameter.iGid],
|
|
1228 |
aNameRecord,
|
|
1229 |
aIntValue );
|
|
1230 |
|
|
1231 |
if( aIntValue.iValue == aParameter.iArg2 )
|
|
1232 |
{
|
|
1233 |
retval = KErrNone;
|
|
1234 |
}
|
|
1235 |
else
|
|
1236 |
{
|
|
1237 |
retval = KErrArgument;
|
|
1238 |
}
|
|
1239 |
}
|
|
1240 |
break;
|
|
1241 |
|
|
1242 |
case ETFAccessoryBoolGetValue:
|
|
1243 |
{
|
|
1244 |
RAccessoryConnection accessoryConnection;
|
|
1245 |
accessoryConnection.CreateSubSession( iAccessoryServer );
|
|
1246 |
|
|
1247 |
TAccPolNameRecord nameRecord;
|
|
1248 |
nameRecord.SetNameL( aParameter.iArg3 );
|
|
1249 |
TAccValueTypeTBool boolValue;
|
|
1250 |
retval
|
|
1251 |
= accessoryConnection.GetValueL( iGenericId[aParameter.iGid],
|
|
1252 |
nameRecord,
|
|
1253 |
boolValue );
|
|
1254 |
|
|
1255 |
if( boolValue.iValue != aParameter.iArg1 )
|
|
1256 |
{
|
|
1257 |
retval = KErrArgument;
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
accessoryConnection.CloseSubSession();
|
|
1261 |
}
|
|
1262 |
break;
|
|
1263 |
|
|
1264 |
case ETFAccessoryDes8GetValue:
|
|
1265 |
{
|
|
1266 |
TBuf8<80>
|
|
1267 |
worm( _L8("Malicious Worm Attach with extra long data with extra long content" ));
|
|
1268 |
TBuf8<85> valueBuf;
|
|
1269 |
TAccPolNameRecord aNameRecord;
|
|
1270 |
aNameRecord.SetNameL( aParameter.iArg1 );
|
|
1271 |
TRAPD( err, iAccessorySingleConnection->GetValueL( iGenericId[aParameter.iGid], aNameRecord, valueBuf ) );
|
|
1272 |
|
|
1273 |
if( err == aParameter.iExpectedResult )
|
|
1274 |
{
|
|
1275 |
|
|
1276 |
if( aParameter.iExpectedResult == KErrArgument )
|
|
1277 |
{
|
|
1278 |
retval = KErrNone;
|
|
1279 |
}
|
|
1280 |
else
|
|
1281 |
{
|
|
1282 |
if( KErrNone == valueBuf.Compare( worm ) )
|
|
1283 |
{
|
|
1284 |
RDebug::RawPrint( valueBuf );
|
|
1285 |
retval = KErrNone;
|
|
1286 |
}
|
|
1287 |
else
|
|
1288 |
{
|
|
1289 |
retval = KErrArgument;
|
|
1290 |
}
|
|
1291 |
}
|
|
1292 |
}
|
|
1293 |
else
|
|
1294 |
{
|
|
1295 |
retval = KErrArgument;
|
|
1296 |
}
|
|
1297 |
}
|
|
1298 |
break;
|
|
1299 |
|
|
1300 |
case ETFAccessoryObjectParseTopology:
|
|
1301 |
{
|
|
1302 |
|
|
1303 |
TInt rspeaker( KErrGeneral );
|
|
1304 |
TInt lspeaker( KErrGeneral );
|
|
1305 |
TInt rmic( KErrGeneral );
|
|
1306 |
TInt lmic( KErrGeneral );
|
|
1307 |
TInt mute( KErrGeneral );
|
|
1308 |
TInt sidetone( KErrGeneral );
|
|
1309 |
//
|
|
1310 |
// Find speaker volume object in USB headset case.
|
|
1311 |
//
|
|
1312 |
CAccPolAudioUnitBase* audioUnit = NULL;
|
|
1313 |
CAccPolAudioControlBase* audioControl = NULL;
|
|
1314 |
//CAccPolOutputTerminal* ouputTerminal = NULL;
|
|
1315 |
|
|
1316 |
if( iTopologyContainer->OutputTerminalL( CAccPolOutputTerminal::EAPTHeadphone,
|
|
1317 |
audioUnit ) )
|
|
1318 |
{
|
|
1319 |
if( audioUnit->GetNextAudioUnitL( audioUnit ) )
|
|
1320 |
{
|
|
1321 |
if( audioUnit->ObjectType()
|
|
1322 |
== EAccPolAudioFeatureUnitObject )
|
|
1323 |
{
|
|
1324 |
if( audioUnit->GetAudioControlL( EAccPolAudioVolumeControlObject,
|
|
1325 |
KAccRightFrontChannel,
|
|
1326 |
audioControl ) )
|
|
1327 |
{
|
|
1328 |
iSpeakerRightVolume = CAccPolVolumeControl::NewL();
|
|
1329 |
*iSpeakerRightVolume
|
|
1330 |
= *reinterpret_cast<CAccPolVolumeControl*> ( audioControl );
|
|
1331 |
rspeaker = KErrNone;
|
|
1332 |
}
|
|
1333 |
if( audioUnit->GetAudioControlL( EAccPolAudioVolumeControlObject,
|
|
1334 |
KAccLeftFrontChannel,
|
|
1335 |
audioControl ) )
|
|
1336 |
{
|
|
1337 |
iSpeakerLeftVolume = CAccPolVolumeControl::NewL();
|
|
1338 |
*iSpeakerLeftVolume
|
|
1339 |
= *reinterpret_cast<CAccPolVolumeControl*> ( audioControl );
|
|
1340 |
lspeaker = KErrNone;
|
|
1341 |
}
|
|
1342 |
if( audioUnit->GetAudioControlL( EAccPolAudioMuteControlObject,
|
|
1343 |
KAccMasterChannel,
|
|
1344 |
audioControl ) )
|
|
1345 |
{
|
|
1346 |
iSpeakerMute = CAccPolMuteControl::NewL();
|
|
1347 |
*iSpeakerMute
|
|
1348 |
= *reinterpret_cast<CAccPolMuteControl*> ( audioControl );
|
|
1349 |
mute = KErrNone;
|
|
1350 |
}
|
|
1351 |
|
|
1352 |
}
|
|
1353 |
}
|
|
1354 |
}
|
|
1355 |
|
|
1356 |
//
|
|
1357 |
// Find mic volume object in USB headset case.
|
|
1358 |
//
|
|
1359 |
if( iTopologyContainer->OutputTerminalL( CAccPolOutputTerminal::EAPTStream,
|
|
1360 |
audioUnit ) )
|
|
1361 |
{
|
|
1362 |
do
|
|
1363 |
{
|
|
1364 |
}
|
|
1365 |
while( audioUnit->GetNextAudioUnitL( audioUnit )
|
|
1366 |
&& audioUnit->ObjectType() != EAccPolAudioFeatureUnitObject );
|
|
1367 |
|
|
1368 |
RPointerArray<CAccPolAudioControlBase> aAudioControls;
|
|
1369 |
audioUnit->GetAudioControlsL( KAccRightFrontChannel,
|
|
1370 |
aAudioControls );
|
|
1371 |
|
|
1372 |
if( aAudioControls.Count() > 0 )
|
|
1373 |
{
|
|
1374 |
iMicRightVolume = CAccPolVolumeControl::NewL();
|
|
1375 |
*iMicRightVolume
|
|
1376 |
= *reinterpret_cast<CAccPolVolumeControl*> ( aAudioControls.operator[]( 0 ) );
|
|
1377 |
rmic = KErrNone;
|
|
1378 |
}
|
|
1379 |
aAudioControls.Reset();
|
|
1380 |
|
|
1381 |
audioUnit->GetAudioControlsL( KAccLeftFrontChannel,
|
|
1382 |
aAudioControls );
|
|
1383 |
|
|
1384 |
if( aAudioControls.Count() > 0 )
|
|
1385 |
{
|
|
1386 |
iMicLeftVolume = CAccPolVolumeControl::NewL();
|
|
1387 |
*iMicLeftVolume
|
|
1388 |
= *reinterpret_cast<CAccPolVolumeControl*> ( aAudioControls.operator[]( 0 ) );
|
|
1389 |
lmic = KErrNone;
|
|
1390 |
}
|
|
1391 |
|
|
1392 |
//
|
|
1393 |
// Find sidetone volume object in USB headset case.
|
|
1394 |
//
|
|
1395 |
iTopologyContainer->OutputTerminalL( CAccPolOutputTerminal::EAPTHeadphone,
|
|
1396 |
audioUnit );
|
|
1397 |
|
|
1398 |
do
|
|
1399 |
{
|
|
1400 |
audioUnit->GetNextAudioUnitL( audioUnit );
|
|
1401 |
}
|
|
1402 |
while( audioUnit->ObjectType() != EAccPolAudioMixerUnitObject );
|
|
1403 |
|
|
1404 |
if( audioUnit->SourceIdCount() > 1 )
|
|
1405 |
{
|
|
1406 |
RPointerArray<CAccPolAudioUnitBase> aAudioUnits;
|
|
1407 |
audioUnit->GetAudioUnitListL( aAudioUnits );
|
|
1408 |
|
|
1409 |
for( TInt i = 0; i < aAudioUnits.Count(); i++ )
|
|
1410 |
{
|
|
1411 |
if( aAudioUnits.operator[]( i )->ObjectType()
|
|
1412 |
== EAccPolAudioFeatureUnitObject )
|
|
1413 |
{
|
|
1414 |
audioUnit = aAudioUnits.operator[]( i );
|
|
1415 |
break;
|
|
1416 |
}
|
|
1417 |
}
|
|
1418 |
}
|
|
1419 |
|
|
1420 |
aAudioControls.Reset();
|
|
1421 |
audioUnit->GetAudioControlsL( aAudioControls );
|
|
1422 |
if( aAudioControls.Count() == 2 )
|
|
1423 |
{
|
|
1424 |
sidetone = KErrNone;
|
|
1425 |
}
|
|
1426 |
}
|
|
1427 |
|
|
1428 |
retval = ( rspeaker | lspeaker | rmic | lmic | mute | sidetone );
|
|
1429 |
|
|
1430 |
}
|
|
1431 |
break;
|
|
1432 |
|
|
1433 |
case ETFAccessoryGetStreamObjects:
|
|
1434 |
{
|
|
1435 |
if( iStreamContainer != NULL )
|
|
1436 |
{
|
|
1437 |
delete iStreamContainer;
|
|
1438 |
iStreamContainer = NULL;
|
|
1439 |
}
|
|
1440 |
iStreamContainer = CAccPolAudioStreamFormatCon::NewL();
|
|
1441 |
|
|
1442 |
TAccPolNameRecord aNameRecord;
|
|
1443 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1444 |
TRAPD( err, iAccessorySingleConnection->GetValueL( iGenericId[aParameter.iGid], aNameRecord, *iStreamContainer ) );
|
|
1445 |
|
|
1446 |
if( err == aParameter.iExpectedResult )
|
|
1447 |
{
|
|
1448 |
//externalize container to bufFromASY
|
|
1449 |
CBufFlat* bufFromASY =
|
|
1450 |
CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
1451 |
CleanupStack::PushL( bufFromASY );
|
|
1452 |
bufFromASY->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
1453 |
RBufWriteStream wStrm;
|
|
1454 |
( void )wStrm.Open( *bufFromASY );
|
|
1455 |
wStrm.PushL();
|
|
1456 |
iStreamContainer->ExternalizeL( wStrm );
|
|
1457 |
wStrm.CommitL();
|
|
1458 |
wStrm.Close();
|
|
1459 |
wStrm.Pop();
|
|
1460 |
TPtr8 ptrbufFromASY( bufFromASY->Ptr( 0 ) );
|
|
1461 |
|
|
1462 |
//Read container from PubSub
|
|
1463 |
RProperty prop;
|
|
1464 |
RBufReadStream rStrm;
|
|
1465 |
CBufFlat* bufFromPubSub =
|
|
1466 |
CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
1467 |
CleanupStack::PushL( bufFromPubSub );
|
|
1468 |
bufFromPubSub->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
1469 |
TPtr8 ptrBufFromPubSub( bufFromPubSub->Ptr( 0 ) );
|
|
1470 |
TInt ret = prop.Get( KTFAccessoryTestProperty,
|
|
1471 |
KTFAccessoryObjectMethod,
|
|
1472 |
ptrBufFromPubSub );
|
|
1473 |
|
|
1474 |
TInt k = sizeof( bufFromASY );
|
|
1475 |
TInt kk = sizeof( bufFromPubSub );
|
|
1476 |
|
|
1477 |
bufFromASY->Compress();
|
|
1478 |
bufFromPubSub->Compress();
|
|
1479 |
|
|
1480 |
k = sizeof( bufFromASY );
|
|
1481 |
kk = sizeof( bufFromPubSub );
|
|
1482 |
|
|
1483 |
retval
|
|
1484 |
= ( 0
|
|
1485 |
== memcompare( reinterpret_cast<TUint8*> ( &ptrbufFromASY ),
|
|
1486 |
sizeof( bufFromASY ),
|
|
1487 |
reinterpret_cast<TUint8*> ( &ptrBufFromPubSub ),
|
|
1488 |
sizeof( bufFromASY ) ) ) ? KErrNone : KErrGeneral;
|
|
1489 |
|
|
1490 |
CleanupStack::PopAndDestroy( bufFromPubSub );
|
|
1491 |
CleanupStack::PopAndDestroy( bufFromASY );
|
|
1492 |
}
|
|
1493 |
}
|
|
1494 |
break;
|
|
1495 |
|
|
1496 |
case ETFAccessoryGetStreamObjectsFromPolicy:
|
|
1497 |
{
|
|
1498 |
if( iStreamContainer != NULL )
|
|
1499 |
{
|
|
1500 |
delete iStreamContainer;
|
|
1501 |
iStreamContainer = NULL;
|
|
1502 |
}
|
|
1503 |
iStreamContainer = CAccPolAudioStreamFormatCon::NewL();
|
|
1504 |
|
|
1505 |
TAccPolNameRecord aNameRecord;
|
|
1506 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1507 |
TRAPD( err, iAccessorySingleConnection->GetValueL( iGenericId[aParameter.iGid], aNameRecord, *iStreamContainer ) );
|
|
1508 |
|
|
1509 |
RPointerArray<CAccPolAudioStreamFormat> inputStreamObjects;
|
|
1510 |
RPointerArray<CAccPolAudioStreamFormat> outputStreamObjects;
|
|
1511 |
|
|
1512 |
iStreamContainer->GetInputStreamFormatsL( inputStreamObjects );
|
|
1513 |
iStreamContainer->GetOutputStreamFormatsL( outputStreamObjects );
|
|
1514 |
|
|
1515 |
CAccPolAudioStreamFormat* inputStream =
|
|
1516 |
inputStreamObjects.operator[]( 0 );
|
|
1517 |
CAccPolAudioStreamFormat* ouputStream =
|
|
1518 |
outputStreamObjects.operator[]( 0 );
|
|
1519 |
|
|
1520 |
retval = err;
|
|
1521 |
}
|
|
1522 |
break;
|
|
1523 |
|
|
1524 |
case ETFAccessorySetStreamObjects:
|
|
1525 |
{
|
|
1526 |
CAccPolAudioStreamFormatCon* setContainer = CAccPolAudioStreamFormatCon::NewLC();
|
|
1527 |
|
|
1528 |
RPointerArray<CAccPolAudioStreamFormat> inputStreamObjects;
|
|
1529 |
RPointerArray<CAccPolAudioStreamFormat> outputStreamObjects;
|
|
1530 |
|
|
1531 |
iStreamContainer->GetInputStreamFormatsL( inputStreamObjects );
|
|
1532 |
CAccPolAudioStreamFormat* inputStream = NULL;
|
|
1533 |
for(TInt i=0; i<inputStreamObjects.Count(); i++)
|
|
1534 |
{
|
|
1535 |
inputStream = inputStreamObjects.operator[]( i );
|
|
1536 |
if( inputStream->AudioFormat() == KUidFormatPCM16 &&
|
|
1537 |
inputStream->UnitId() == 0 &&
|
|
1538 |
inputStream->StreamType() == CAccPolAudioStreamFormat::EStereo &&
|
|
1539 |
inputStream->BitResolution() == CAccPolAudioStreamFormat::EBitsPerSample16 &&
|
|
1540 |
inputStream->SamFreq() == 200 )
|
|
1541 |
{
|
|
1542 |
setContainer->AddL( *inputStream );
|
|
1543 |
break;
|
|
1544 |
}
|
|
1545 |
}
|
|
1546 |
|
|
1547 |
iStreamContainer->GetOutputStreamFormatsL( outputStreamObjects );
|
|
1548 |
CAccPolAudioStreamFormat* outputStream = NULL;
|
|
1549 |
for(TInt i=0; i<outputStreamObjects.Count(); i++)
|
|
1550 |
{
|
|
1551 |
outputStream = outputStreamObjects.operator[]( i );
|
|
1552 |
if( outputStream->AudioFormat() == KUidFormatPCM16 &&
|
|
1553 |
outputStream->UnitId() == 0 &&
|
|
1554 |
outputStream->StreamType() == CAccPolAudioStreamFormat::EMono &&
|
|
1555 |
outputStream->BitResolution() == CAccPolAudioStreamFormat::EBitsPerSample32 &&
|
|
1556 |
outputStream->SamFreq() == 200 )
|
|
1557 |
{
|
|
1558 |
setContainer->AddL( *outputStream );
|
|
1559 |
break;
|
|
1560 |
}
|
|
1561 |
}
|
|
1562 |
|
|
1563 |
RBufWriteStream wStrm;
|
|
1564 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
1565 |
CleanupStack::PushL( buf );
|
|
1566 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
1567 |
(void)wStrm.Open( *buf );
|
|
1568 |
wStrm.PushL();
|
|
1569 |
setContainer->ExternalizeL( wStrm );
|
|
1570 |
wStrm.Close();
|
|
1571 |
wStrm.Pop();
|
|
1572 |
TPtr8 ptr( buf->Ptr( 0 ) );
|
|
1573 |
|
|
1574 |
retval = RProperty::Set( KTFAccessoryTestProperty, KTFAccessoryObjectMethod, ptr );
|
|
1575 |
|
|
1576 |
TAccPolNameRecord aNameRecord;
|
|
1577 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1578 |
|
|
1579 |
TRAPD( setErr, iAccessoryControl->SetValueL( iGenericId[aParameter.iGid], aNameRecord, *setContainer ) );
|
|
1580 |
|
|
1581 |
retval = setErr;
|
|
1582 |
|
|
1583 |
CleanupStack::PopAndDestroy( buf );
|
|
1584 |
CleanupStack::PopAndDestroy( setContainer );
|
|
1585 |
inputStreamObjects.Close();
|
|
1586 |
outputStreamObjects.Close();
|
|
1587 |
}
|
|
1588 |
break;
|
|
1589 |
|
|
1590 |
case ETFAccessoryGetTopologyObjects:
|
|
1591 |
{
|
|
1592 |
if( iTopologyContainer != NULL )
|
|
1593 |
{
|
|
1594 |
delete iTopologyContainer;
|
|
1595 |
iTopologyContainer = NULL;
|
|
1596 |
}
|
|
1597 |
|
|
1598 |
iTopologyContainer = CAccPolAudioTopologyObjectCon::NewL();
|
|
1599 |
|
|
1600 |
TAccPolNameRecord aNameRecord;
|
|
1601 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1602 |
TRAPD( err, iAccessorySingleConnection->GetValueL( iGenericId[aParameter.iGid], aNameRecord, *iTopologyContainer ) );
|
|
1603 |
|
|
1604 |
if( err == aParameter.iExpectedResult )
|
|
1605 |
{
|
|
1606 |
//externalize container to bufFromASY
|
|
1607 |
CBufFlat* bufFromASY =
|
|
1608 |
CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
1609 |
CleanupStack::PushL( bufFromASY );
|
|
1610 |
bufFromASY->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
1611 |
RBufWriteStream wStrm;
|
|
1612 |
( void )wStrm.Open( *bufFromASY );
|
|
1613 |
wStrm.PushL();
|
|
1614 |
iTopologyContainer->ExternalizeL( wStrm );
|
|
1615 |
wStrm.CommitL();
|
|
1616 |
wStrm.Close();
|
|
1617 |
wStrm.Pop();
|
|
1618 |
TPtr8 ptrbufFromASY( bufFromASY->Ptr( 0 ) );
|
|
1619 |
|
|
1620 |
//Read container from PubSub
|
|
1621 |
RProperty prop;
|
|
1622 |
RBufReadStream rStrm;
|
|
1623 |
CBufFlat* bufFromPubSub =
|
|
1624 |
CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
1625 |
CleanupStack::PushL( bufFromPubSub );
|
|
1626 |
bufFromPubSub->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
1627 |
TPtr8 ptrBufFromPubSub( bufFromPubSub->Ptr( 0 ) );
|
|
1628 |
TInt ret = prop.Get( KTFAccessoryTestProperty,
|
|
1629 |
KTFAccessoryObjectMethod,
|
|
1630 |
ptrBufFromPubSub );
|
|
1631 |
|
|
1632 |
TInt k = sizeof( bufFromASY );
|
|
1633 |
TInt kk = sizeof( bufFromPubSub );
|
|
1634 |
|
|
1635 |
bufFromASY->Compress();
|
|
1636 |
bufFromPubSub->Compress();
|
|
1637 |
|
|
1638 |
k = sizeof( bufFromASY );
|
|
1639 |
kk = sizeof( bufFromPubSub );
|
|
1640 |
|
|
1641 |
retval
|
|
1642 |
= ( 0
|
|
1643 |
== memcompare( reinterpret_cast<TUint8*> ( &ptrbufFromASY ),
|
|
1644 |
sizeof( bufFromASY ),
|
|
1645 |
reinterpret_cast<TUint8*> ( &ptrBufFromPubSub ),
|
|
1646 |
sizeof( bufFromASY ) ) ) ? KErrNone : KErrGeneral;
|
|
1647 |
|
|
1648 |
CleanupStack::PopAndDestroy( bufFromPubSub );
|
|
1649 |
CleanupStack::PopAndDestroy( bufFromASY );
|
|
1650 |
}
|
|
1651 |
}
|
|
1652 |
break;
|
|
1653 |
|
|
1654 |
case ETFAccessoryGetVolumeControlObjects:
|
|
1655 |
{
|
|
1656 |
|
|
1657 |
if( iTopologyContainer != NULL )
|
|
1658 |
{
|
|
1659 |
delete iTopologyContainer;
|
|
1660 |
iTopologyContainer = NULL;
|
|
1661 |
}
|
|
1662 |
|
|
1663 |
iTopologyContainer = CAccPolAudioTopologyObjectCon::NewL();
|
|
1664 |
|
|
1665 |
iTopologyContainer->AddL( *iSpeakerRightVolume );
|
|
1666 |
iTopologyContainer->AddL( *iSpeakerLeftVolume );
|
|
1667 |
|
|
1668 |
TAccPolNameRecord aNameRecord;
|
|
1669 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1670 |
TRAPD( err, iAccessorySingleConnection->GetValueL( iGenericId[aParameter.iGid], aNameRecord, *iTopologyContainer ) );
|
|
1671 |
|
|
1672 |
CAccPolVolumeControl* rightVolume;
|
|
1673 |
rightVolume = ( CAccPolVolumeControl* )iTopologyContainer->AtL( 0 );
|
|
1674 |
|
|
1675 |
CAccPolVolumeControl* leftVolume;
|
|
1676 |
leftVolume = ( CAccPolVolumeControl* )iTopologyContainer->AtL( 1 );
|
|
1677 |
|
|
1678 |
if( err == aParameter.iExpectedResult )
|
|
1679 |
{
|
|
1680 |
retval = KErrNone;
|
|
1681 |
}
|
|
1682 |
}
|
|
1683 |
break;
|
|
1684 |
|
|
1685 |
case ETFAccessorySetVolumeControlObjects:
|
|
1686 |
{
|
|
1687 |
RBufWriteStream wStrm;
|
|
1688 |
CAccPolAudioTopologyObjectCon* setContainer =
|
|
1689 |
CAccPolAudioTopologyObjectCon::NewLC();
|
|
1690 |
|
|
1691 |
iSpeakerRightVolume->SetVolumeDb( aParameter.iArg1 );
|
|
1692 |
iSpeakerRightVolume->SetMinVolumeDb( aParameter.iArg2 );
|
|
1693 |
iSpeakerRightVolume->SetMaxVolumeDb( aParameter.iArg4 );
|
|
1694 |
iSpeakerRightVolume->SetVolumeResDb( 0x05 );
|
|
1695 |
setContainer->AddL( *iSpeakerRightVolume );
|
|
1696 |
iSpeakerLeftVolume->SetVolumeDb( aParameter.iArg1 );
|
|
1697 |
iSpeakerLeftVolume->SetMinVolumeDb( aParameter.iArg2 );
|
|
1698 |
iSpeakerLeftVolume->SetMaxVolumeDb( aParameter.iArg4 );
|
|
1699 |
iSpeakerLeftVolume->SetVolumeResDb( 0x05 );
|
|
1700 |
setContainer->AddL( *iSpeakerLeftVolume );
|
|
1701 |
|
|
1702 |
CBufFlat* buf =
|
|
1703 |
CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
1704 |
CleanupStack::PushL( buf );
|
|
1705 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
1706 |
( void )wStrm.Open( *buf );
|
|
1707 |
wStrm.PushL();
|
|
1708 |
setContainer->ExternalizeL( wStrm );
|
|
1709 |
wStrm.Close();
|
|
1710 |
wStrm.Pop();
|
|
1711 |
TPtr8 ptr( buf->Ptr( 0 ) );
|
|
1712 |
|
|
1713 |
retval = RProperty::Set( KTFAccessoryTestProperty,
|
|
1714 |
KTFAccessoryObjectMethod,
|
|
1715 |
ptr );
|
|
1716 |
|
|
1717 |
TAccPolNameRecord aNameRecord;
|
|
1718 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1719 |
TRAPD( setErr, iAccessoryControl->SetValueL( iGenericId[aParameter.iGid], aNameRecord, *setContainer ) );
|
|
1720 |
|
|
1721 |
retval = setErr;
|
|
1722 |
|
|
1723 |
CleanupStack::PopAndDestroy( buf );
|
|
1724 |
CleanupStack::PopAndDestroy( setContainer );
|
|
1725 |
}
|
|
1726 |
break;
|
|
1727 |
|
|
1728 |
case ETFAccessoryGetMuteControlObjects:
|
|
1729 |
{
|
|
1730 |
|
|
1731 |
if( iTopologyContainer != NULL )
|
|
1732 |
{
|
|
1733 |
delete iTopologyContainer;
|
|
1734 |
iTopologyContainer = NULL;
|
|
1735 |
}
|
|
1736 |
|
|
1737 |
iTopologyContainer = CAccPolAudioTopologyObjectCon::NewL();
|
|
1738 |
|
|
1739 |
iTopologyContainer->AddL( *iSpeakerMute );
|
|
1740 |
|
|
1741 |
TAccPolNameRecord aNameRecord;
|
|
1742 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1743 |
TRAPD( err, iAccessorySingleConnection->GetValueL( iGenericId[aParameter.iGid], aNameRecord, *iTopologyContainer ) );
|
|
1744 |
|
|
1745 |
CAccPolMuteControl* mute;
|
|
1746 |
mute = ( CAccPolMuteControl* )iTopologyContainer->AtL( 0 );
|
|
1747 |
|
|
1748 |
if( err == aParameter.iExpectedResult )
|
|
1749 |
{
|
|
1750 |
retval = KErrNone;
|
|
1751 |
}
|
|
1752 |
}
|
|
1753 |
break;
|
|
1754 |
|
|
1755 |
case ETFAccessorySetMuteControlObjects:
|
|
1756 |
{
|
|
1757 |
RBufWriteStream wStrm;
|
|
1758 |
CAccPolAudioTopologyObjectCon* setContainer =
|
|
1759 |
CAccPolAudioTopologyObjectCon::NewLC();
|
|
1760 |
|
|
1761 |
iSpeakerMute->SetMute( aParameter.iArg1 );
|
|
1762 |
setContainer->AddL( *iSpeakerMute );
|
|
1763 |
|
|
1764 |
CBufFlat* buf =
|
|
1765 |
CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
1766 |
CleanupStack::PushL( buf );
|
|
1767 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
1768 |
( void )wStrm.Open( *buf );
|
|
1769 |
wStrm.PushL();
|
|
1770 |
setContainer->ExternalizeL( wStrm );
|
|
1771 |
wStrm.Close();
|
|
1772 |
wStrm.Pop();
|
|
1773 |
TPtr8 ptr( buf->Ptr( 0 ) );
|
|
1774 |
|
|
1775 |
retval = RProperty::Set( KTFAccessoryTestProperty,
|
|
1776 |
KTFAccessoryObjectMethod,
|
|
1777 |
ptr );
|
|
1778 |
|
|
1779 |
TAccPolNameRecord aNameRecord;
|
|
1780 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1781 |
TRAPD( setErr, iAccessoryControl->SetValueL( iGenericId[aParameter.iGid], aNameRecord, *setContainer ) );
|
|
1782 |
|
|
1783 |
retval = setErr;
|
|
1784 |
|
|
1785 |
CleanupStack::PopAndDestroy( buf );
|
|
1786 |
CleanupStack::PopAndDestroy( setContainer );
|
|
1787 |
}
|
|
1788 |
break;
|
|
1789 |
|
|
1790 |
//
|
|
1791 |
// Accessory Control
|
|
1792 |
//
|
|
1793 |
|
|
1794 |
case ETFAccessoryControl_Open:
|
|
1795 |
{
|
|
1796 |
if( iAccessoryControl == NULL )
|
|
1797 |
{
|
|
1798 |
iAccessoryControl = new ( ELeave ) RAccessoryControl;
|
|
1799 |
retval = iAccessoryControl->CreateSubSession( iAccessoryServer );
|
|
1800 |
}
|
|
1801 |
else
|
|
1802 |
{
|
|
1803 |
retval = KErrNone;
|
|
1804 |
}
|
|
1805 |
}
|
|
1806 |
break;
|
|
1807 |
|
|
1808 |
case ETFAccessoryControl_Close:
|
|
1809 |
{
|
|
1810 |
TRACE_ASSERT( iAccessoryControl != NULL );
|
|
1811 |
|
|
1812 |
if( iAccessoryControl != NULL )
|
|
1813 |
{
|
|
1814 |
iAccessoryControl->CloseSubSession();
|
|
1815 |
delete iAccessoryControl;
|
|
1816 |
iAccessoryControl = NULL;
|
|
1817 |
}
|
|
1818 |
retval = KErrNone;
|
|
1819 |
}
|
|
1820 |
break;
|
|
1821 |
|
|
1822 |
case ETFAccessoryNotifyAccessoryConnectionStatusChanged:
|
|
1823 |
{
|
|
1824 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1825 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1826 |
aConnectionObserver->NotifyAccessoryConnectionStatusChanged( iGenericIdArray );
|
|
1827 |
retval = KErrNone;
|
|
1828 |
}
|
|
1829 |
break;
|
|
1830 |
|
|
1831 |
case ETFSyncGetAccessoryConnectionStatus:
|
|
1832 |
{
|
|
1833 |
iAccessoryConnection->GetAccessoryConnectionStatus( iGenericIdArray );
|
|
1834 |
|
|
1835 |
if( iGenericIdArray.Count() != aParameter.iArg1 )
|
|
1836 |
{
|
|
1837 |
retval = KErrArgument;
|
|
1838 |
}
|
|
1839 |
else
|
|
1840 |
{
|
|
1841 |
retval = KErrNone;
|
|
1842 |
}
|
|
1843 |
}
|
|
1844 |
break;
|
|
1845 |
|
|
1846 |
case ETFASyncGetAccessoryConnectionStatus:
|
|
1847 |
{
|
|
1848 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1849 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1850 |
aConnectionObserver->GetAccessoryConnectionStatus( iGenericIdArray );
|
|
1851 |
retval = KErrNone;
|
|
1852 |
}
|
|
1853 |
break;
|
|
1854 |
|
|
1855 |
case ETFSetIntValue:
|
|
1856 |
{
|
|
1857 |
SetIntValue(aParameter, &retval);
|
|
1858 |
}
|
|
1859 |
break;
|
|
1860 |
|
|
1861 |
case ETFSetBoolValue:
|
|
1862 |
{
|
|
1863 |
TAccPolNameRecord aNameRecord;
|
|
1864 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1865 |
TAccValueTypeTBool aBoolValue;
|
|
1866 |
aBoolValue.iValue = aParameter.iArg1;
|
|
1867 |
retval = iAccessoryControl->SetValueL( iGenericId[aParameter.iGid],
|
|
1868 |
aNameRecord,
|
|
1869 |
aBoolValue );
|
|
1870 |
}
|
|
1871 |
break;
|
|
1872 |
|
|
1873 |
//
|
|
1874 |
//Tuupaa
|
|
1875 |
//
|
|
1876 |
case ETFAccessoryValueChangedNotifyInt:
|
|
1877 |
{
|
|
1878 |
TAccPolNameRecord aNameRecord;
|
|
1879 |
aNameRecord.SetNameL( KAccAudioOutputType );
|
|
1880 |
TAccValueTypeTInt aIntValue;
|
|
1881 |
aIntValue.iValue = EAccAudioOutPutTypePublic;
|
|
1882 |
iAccessoryControl->AccessoryValueChangedNotifyL( iGenericId[aParameter.iGid],
|
|
1883 |
aNameRecord,
|
|
1884 |
aIntValue );
|
|
1885 |
retval = KErrNone;
|
|
1886 |
}
|
|
1887 |
break;
|
|
1888 |
|
|
1889 |
case ETFAccessoryValueChangedNotifyBool:
|
|
1890 |
{
|
|
1891 |
TAccPolNameRecord aNameRecord;
|
|
1892 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
1893 |
TAccValueTypeTBool aBoolValue;
|
|
1894 |
aBoolValue.iValue = ETrue;
|
|
1895 |
iAccessoryControl->AccessoryValueChangedNotifyL( iGenericId[aParameter.iGid],
|
|
1896 |
aNameRecord,
|
|
1897 |
aBoolValue );
|
|
1898 |
retval = KErrNone;
|
|
1899 |
}
|
|
1900 |
break;
|
|
1901 |
|
|
1902 |
//
|
|
1903 |
// BT Control
|
|
1904 |
//
|
|
1905 |
case ETFBTAccessoryValueChangedNotifyBool:
|
|
1906 |
{
|
|
1907 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
1908 |
TAccPolNameRecord nameRecord;
|
|
1909 |
nameRecord.SetNameL( aParameter.iArg3 );
|
|
1910 |
TAccValueTypeTBool boolValue;
|
|
1911 |
boolValue.iValue = aParameter.iArg4;
|
|
1912 |
iAccessoryBTControl->AccessoryValueChangedNotifyL( btaddr,
|
|
1913 |
nameRecord,
|
|
1914 |
boolValue );
|
|
1915 |
retval = KErrNone;
|
|
1916 |
}
|
|
1917 |
break;
|
|
1918 |
|
|
1919 |
case ETFBTAccessoryValueChangedNotifyInt:
|
|
1920 |
{
|
|
1921 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
1922 |
TAccPolNameRecord nameRecord;
|
|
1923 |
nameRecord.SetNameL( aParameter.iArg3 );
|
|
1924 |
TAccValueTypeTInt intValue;
|
|
1925 |
intValue.iValue = aParameter.iArg4;
|
|
1926 |
iAccessoryBTControl->AccessoryValueChangedNotifyL( btaddr,
|
|
1927 |
nameRecord,
|
|
1928 |
intValue );
|
|
1929 |
retval = KErrNone;
|
|
1930 |
}
|
|
1931 |
break;
|
|
1932 |
|
|
1933 |
case ETFAccessoryBtControl_Open:
|
|
1934 |
{
|
|
1935 |
if( iAccessoryBTControl == NULL )
|
|
1936 |
{
|
|
1937 |
iAccessoryBTControl = new ( ELeave ) RAccessoryBTControl;
|
|
1938 |
retval
|
|
1939 |
= iAccessoryBTControl->CreateSubSession( iAccessoryServer );
|
|
1940 |
}
|
|
1941 |
else
|
|
1942 |
{
|
|
1943 |
retval = KErrNone;
|
|
1944 |
}
|
|
1945 |
}
|
|
1946 |
break;
|
|
1947 |
|
|
1948 |
case ETFAccessoryBtControl_Close:
|
|
1949 |
{
|
|
1950 |
TRACE_ASSERT( iAccessoryBTControl != NULL );
|
|
1951 |
|
|
1952 |
if( iAccessoryBTControl != NULL )
|
|
1953 |
{
|
|
1954 |
iAccessoryBTControl->CloseSubSession();
|
|
1955 |
delete iAccessoryBTControl;
|
|
1956 |
iAccessoryBTControl = NULL;
|
|
1957 |
}
|
|
1958 |
retval = KErrNone;
|
|
1959 |
}
|
|
1960 |
break;
|
|
1961 |
|
|
1962 |
case ETFAccessoryBtConnectAccessory:
|
|
1963 |
{
|
|
1964 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
1965 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1966 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1967 |
aConnectionObserver->ConnectBTAccessory( btaddr );
|
|
1968 |
retval = KErrNone;
|
|
1969 |
}
|
|
1970 |
break;
|
|
1971 |
case ETFAccessoryBtDisconnectAccessory:
|
|
1972 |
{
|
|
1973 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
1974 |
TRequestStatus status;
|
|
1975 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1976 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1977 |
aConnectionObserver->DisconnectBTAccessory( btaddr );
|
|
1978 |
retval = KErrNone;
|
|
1979 |
TAccPolGenericID emptyInstance;
|
|
1980 |
iGenericId[aParameter.iGid] = emptyInstance;
|
|
1981 |
}
|
|
1982 |
break;
|
|
1983 |
|
|
1984 |
case ETFAccessoryNotifyBluetoothAudioLinkOpenReq:
|
|
1985 |
{
|
|
1986 |
//TRequestStatus status;
|
|
1987 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
1988 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
1989 |
aConnectionObserver->NotifyBluetoothAudioLinkOpenReq();
|
|
1990 |
retval = KErrNone;
|
|
1991 |
}
|
|
1992 |
break;
|
|
1993 |
|
|
1994 |
case ETFAccessoryBluetoothAudioLinkOpenedNotify:
|
|
1995 |
{
|
|
1996 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
1997 |
TRAPD( err, iAccessoryBTControl->BluetoothAudioLinkOpenedNotifyL( btaddr, (TAccAudioType)aParameter.iArg3 ) );
|
|
1998 |
|
|
1999 |
if( err == aParameter.iExpectedResult )
|
|
2000 |
{
|
|
2001 |
retval = KErrNone;
|
|
2002 |
}
|
|
2003 |
else
|
|
2004 |
{
|
|
2005 |
retval = KErrGeneral;
|
|
2006 |
}
|
|
2007 |
}
|
|
2008 |
break;
|
|
2009 |
|
|
2010 |
case ETFAccessoryBluetoothAudioLinkOpenResp:
|
|
2011 |
{
|
|
2012 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
2013 |
TInt response( aParameter.iArg2 );
|
|
2014 |
TRAPD( err, iAccessoryBTControl->BluetoothAudioLinkOpenRespL( btaddr, response ) );
|
|
2015 |
|
|
2016 |
if( err == aParameter.iExpectedResult )
|
|
2017 |
{
|
|
2018 |
retval = KErrNone;
|
|
2019 |
}
|
|
2020 |
else
|
|
2021 |
{
|
|
2022 |
retval = KErrGeneral;
|
|
2023 |
}
|
|
2024 |
}
|
|
2025 |
break;
|
|
2026 |
|
|
2027 |
case ETFAccessoryNotifyBluetoothAudioLinkCloseReq:
|
|
2028 |
{
|
|
2029 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
2030 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
2031 |
aConnectionObserver->NotifyBluetoothAudioLinkCloseReq();
|
|
2032 |
retval = KErrNone;
|
|
2033 |
}
|
|
2034 |
break;
|
|
2035 |
|
|
2036 |
case ETFAccessoryBluetoothAudioLinkClosedNotify:
|
|
2037 |
{
|
|
2038 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
2039 |
TRAPD( err, iAccessoryBTControl->BluetoothAudioLinkClosedNotifyL( btaddr, ( TAccAudioType )aParameter.iArg3 ) );
|
|
2040 |
|
|
2041 |
if( err == aParameter.iExpectedResult )
|
|
2042 |
{
|
|
2043 |
retval = KErrNone;
|
|
2044 |
}
|
|
2045 |
else
|
|
2046 |
{
|
|
2047 |
retval = KErrGeneral;
|
|
2048 |
}
|
|
2049 |
}
|
|
2050 |
break;
|
|
2051 |
|
|
2052 |
case ETFAccessoryBluetoothAudioLinkCloseResp:
|
|
2053 |
{
|
|
2054 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
2055 |
TInt response( aParameter.iArg2 );
|
|
2056 |
TRAPD( err, iAccessoryBTControl->BluetoothAudioLinkCloseRespL( btaddr, response ) );
|
|
2057 |
|
|
2058 |
if( err == aParameter.iExpectedResult )
|
|
2059 |
{
|
|
2060 |
retval = KErrNone;
|
|
2061 |
}
|
|
2062 |
else
|
|
2063 |
{
|
|
2064 |
retval = KErrGeneral;
|
|
2065 |
}
|
|
2066 |
}
|
|
2067 |
break;
|
|
2068 |
|
|
2069 |
case ETFAccessoryBtCancelConnectAccessory:
|
|
2070 |
{
|
|
2071 |
TRequestStatus status;
|
|
2072 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
2073 |
iAccessoryBTControl->ConnectAccessory( status, btaddr );
|
|
2074 |
iAccessoryBTControl->CancelConnectAccessory();
|
|
2075 |
User::WaitForRequest( status );
|
|
2076 |
if( KErrCancel != status.Int() )
|
|
2077 |
{
|
|
2078 |
retval = status.Int();
|
|
2079 |
}
|
|
2080 |
else
|
|
2081 |
{
|
|
2082 |
retval = KErrNone;
|
|
2083 |
}
|
|
2084 |
}
|
|
2085 |
break;
|
|
2086 |
|
|
2087 |
case ETFAccessoryBtCancelDisconnectAccessory:
|
|
2088 |
{
|
|
2089 |
TRequestStatus status;
|
|
2090 |
TBTDevAddr btaddr( aParameter.iArg1 );
|
|
2091 |
iAccessoryBTControl->DisconnectAccessory( status, btaddr );
|
|
2092 |
iAccessoryBTControl->CancelDisconnectAccessory();
|
|
2093 |
User::WaitForRequest( status );
|
|
2094 |
retval = status.Int();
|
|
2095 |
}
|
|
2096 |
break;
|
|
2097 |
|
|
2098 |
//
|
|
2099 |
// Accessory Mode
|
|
2100 |
//
|
|
2101 |
case ETFAccessoryMode_Open:
|
|
2102 |
{
|
|
2103 |
if( iAccessoryMode == NULL )
|
|
2104 |
{
|
|
2105 |
iAccessoryMode = new ( ELeave ) RAccessoryMode;
|
|
2106 |
retval = iAccessoryMode->CreateSubSession( iAccessoryServer );
|
|
2107 |
}
|
|
2108 |
else
|
|
2109 |
{
|
|
2110 |
retval = KErrNone;
|
|
2111 |
}
|
|
2112 |
}
|
|
2113 |
break;
|
|
2114 |
|
|
2115 |
case ETFAccessoryMode_Close:
|
|
2116 |
{
|
|
2117 |
TRACE_ASSERT( iAccessoryMode != NULL );
|
|
2118 |
|
|
2119 |
if( iAccessoryMode != NULL )
|
|
2120 |
{
|
|
2121 |
iAccessoryMode->CloseSubSession();
|
|
2122 |
delete iAccessoryMode;
|
|
2123 |
iAccessoryMode = NULL;
|
|
2124 |
}
|
|
2125 |
retval = KErrNone;
|
|
2126 |
}
|
|
2127 |
break;
|
|
2128 |
|
|
2129 |
case ETFAccessoryNotifyAccessoryModeChanged:
|
|
2130 |
{
|
|
2131 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
2132 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
2133 |
aConnectionObserver->NotifyAccessoryModeChanged();
|
|
2134 |
retval = KErrNone;
|
|
2135 |
}
|
|
2136 |
break;
|
|
2137 |
|
|
2138 |
case ETFAccessoryAccessoryModeSync:
|
|
2139 |
{
|
|
2140 |
TAccPolAccessoryMode mode;
|
|
2141 |
retval = iAccessoryMode->GetAccessoryMode( mode );
|
|
2142 |
|
|
2143 |
if( retval == KErrNone )
|
|
2144 |
{
|
|
2145 |
if( aParameter.iArg1 != mode.iAccessoryMode )
|
|
2146 |
{
|
|
2147 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::CallAccessoryFunctionL: Unexpected Accessory Mode Parameter1 %d %d" ), aParameter.iArg1, mode.iAccessoryMode ) );
|
|
2148 |
retval = KTFErrAccessoryUnexpectedArg1;
|
|
2149 |
}
|
|
2150 |
#ifdef __WINS__ // Just check this in winscw
|
|
2151 |
if( aParameter.iArg2 != mode.iAudioOutputStatus )
|
|
2152 |
{
|
|
2153 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::CallAccessoryFunctionL: Unexpected Accessory Mode Parameter2 %d %d" ), aParameter.iArg2, mode.iAudioOutputStatus ) );
|
|
2154 |
retval = KTFErrAccessoryUnexpectedArg2;
|
|
2155 |
}
|
|
2156 |
#endif
|
|
2157 |
}
|
|
2158 |
else
|
|
2159 |
{
|
|
2160 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::CallAccessoryFunctionL: Getting Accessory Mode Failed %d" ), retval ) );
|
|
2161 |
}
|
|
2162 |
|
|
2163 |
}
|
|
2164 |
break;
|
|
2165 |
|
|
2166 |
case ETFAccessoryAccessoryModeASync:
|
|
2167 |
{
|
|
2168 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
2169 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
2170 |
aConnectionObserver->GetAccessoryMode();
|
|
2171 |
retval = KErrNone;
|
|
2172 |
}
|
|
2173 |
break;
|
|
2174 |
|
|
2175 |
//
|
|
2176 |
// Audio Control
|
|
2177 |
//
|
|
2178 |
case ETFAccessoryAudioControl_Open:
|
|
2179 |
{
|
|
2180 |
if( iAccessoryAudioControl == NULL )
|
|
2181 |
{
|
|
2182 |
iAccessoryAudioControl = new ( ELeave ) RAccessoryAudioControl;
|
|
2183 |
retval
|
|
2184 |
= iAccessoryAudioControl->CreateSubSession( iAccessoryServer );
|
|
2185 |
}
|
|
2186 |
else
|
|
2187 |
{
|
|
2188 |
retval = KErrNone;
|
|
2189 |
}
|
|
2190 |
}
|
|
2191 |
break;
|
|
2192 |
|
|
2193 |
case ETFAccessoryAudioControl_Close:
|
|
2194 |
{
|
|
2195 |
TRACE_ASSERT( iAccessoryAudioControl != NULL );
|
|
2196 |
|
|
2197 |
if( iAccessoryAudioControl != NULL )
|
|
2198 |
{
|
|
2199 |
iAccessoryAudioControl->CloseSubSession();
|
|
2200 |
delete iAccessoryAudioControl;
|
|
2201 |
iAccessoryAudioControl = NULL;
|
|
2202 |
}
|
|
2203 |
retval = KErrNone;
|
|
2204 |
}
|
|
2205 |
break;
|
|
2206 |
|
|
2207 |
case ETFAudioRoutingStatusNotify:
|
|
2208 |
{
|
|
2209 |
RAccessoryAudioControl audioControl;
|
|
2210 |
audioControl.CreateSubSession( iAccessoryServer );
|
|
2211 |
|
|
2212 |
audioControl.AudioRoutingStatusNotify( aParameter.iArg1,
|
|
2213 |
iGenericId[aParameter.iGid] );
|
|
2214 |
retval = KErrNone;
|
|
2215 |
|
|
2216 |
audioControl.CloseSubSession();
|
|
2217 |
}
|
|
2218 |
break;
|
|
2219 |
|
|
2220 |
case ETFAccessoryAudioLinkOpen:
|
|
2221 |
{
|
|
2222 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
2223 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
2224 |
aConnectionObserver->AccessoryAudioLinkOpen( iGenericId[aParameter.iGid],
|
|
2225 |
aParameter.iArg3 );
|
|
2226 |
retval = KErrNone;
|
|
2227 |
}
|
|
2228 |
break;
|
|
2229 |
|
|
2230 |
case ETFAccessoryNotifyAccessoryAudioLinkOpened:
|
|
2231 |
{
|
|
2232 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
2233 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
2234 |
aConnectionObserver->NotifyAccessoryAudioLinkOpened( iGenericId[aParameter.iGid] );
|
|
2235 |
retval = KErrNone;
|
|
2236 |
}
|
|
2237 |
break;
|
|
2238 |
|
|
2239 |
case ETFAccessoryNotifyAccessoryAudioLinkClosed:
|
|
2240 |
{
|
|
2241 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
2242 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
2243 |
aConnectionObserver->NotifyAccessoryAudioLinkClosed( iGenericId[aParameter.iGid] );
|
|
2244 |
retval = KErrNone;
|
|
2245 |
}
|
|
2246 |
break;
|
|
2247 |
|
|
2248 |
case ETFAccessoryAccessoryAudioLinkClose:
|
|
2249 |
{
|
|
2250 |
CTFTestControlObserver* aConnectionObserver = CreateObserver();
|
|
2251 |
TRACE_ASSERT( aConnectionObserver != NULL );
|
|
2252 |
aConnectionObserver->AccessoryAudioLinkClose( iGenericId[aParameter.iGid],
|
|
2253 |
aParameter.iArg3 );
|
|
2254 |
retval = KErrNone;
|
|
2255 |
}
|
|
2256 |
break;
|
|
2257 |
|
|
2258 |
case ETFAccessoryPublishAndSubscribe:
|
|
2259 |
{
|
|
2260 |
PublishAndSubscribeL( aParameter );
|
|
2261 |
retval = KErrNone;
|
|
2262 |
}
|
|
2263 |
break;
|
|
2264 |
|
|
2265 |
case ETFAccessory_Cancel:
|
|
2266 |
{
|
|
2267 |
CTFTestControlObserver* item;
|
|
2268 |
if( !iStack.IsEmpty() )
|
|
2269 |
{
|
|
2270 |
item = iStack.First();
|
|
2271 |
item->Cancel();
|
|
2272 |
}
|
|
2273 |
retval = KErrNone;
|
|
2274 |
}
|
|
2275 |
break;
|
|
2276 |
|
|
2277 |
//
|
|
2278 |
// Cancels
|
|
2279 |
//
|
|
2280 |
case ETFCancelAccessoryAudioLinkOpen:
|
|
2281 |
{
|
|
2282 |
iAccessoryAudioControl->CancelAccessoryAudioLinkOpen();
|
|
2283 |
retval = KErrNone;
|
|
2284 |
}
|
|
2285 |
break;
|
|
2286 |
|
|
2287 |
case ETFCancelAccessoryAudioLinkClose:
|
|
2288 |
{
|
|
2289 |
iAccessoryAudioControl->CancelAccessoryAudioLinkClose();
|
|
2290 |
retval = KErrNone;
|
|
2291 |
}
|
|
2292 |
break;
|
|
2293 |
|
|
2294 |
case ETFCancelNotifyAccessoryAudioLinkOpened:
|
|
2295 |
{
|
|
2296 |
iAccessoryAudioControl->CancelNotifyAccessoryAudioLinkOpened();
|
|
2297 |
retval = KErrNone;
|
|
2298 |
}
|
|
2299 |
break;
|
|
2300 |
|
|
2301 |
case ETFCancelNotifyAccessoryAudioLinkClosed:
|
|
2302 |
{
|
|
2303 |
iAccessoryAudioControl->CancelNotifyAccessoryAudioLinkClosed();
|
|
2304 |
retval = KErrNone;
|
|
2305 |
}
|
|
2306 |
break;
|
|
2307 |
|
|
2308 |
case ETFCancelNotifyProcessCommand:
|
|
2309 |
{
|
|
2310 |
TRACE_ASSERT_ALWAYS;
|
|
2311 |
}
|
|
2312 |
break;
|
|
2313 |
|
|
2314 |
case ETFCancelConnectAccessory:
|
|
2315 |
{
|
|
2316 |
iAccessoryControl->CancelConnectAccessory();
|
|
2317 |
retval = KErrNone;
|
|
2318 |
}
|
|
2319 |
break;
|
|
2320 |
|
|
2321 |
case ETFCancelDisconnectAccessory:
|
|
2322 |
{
|
|
2323 |
iAccessoryControl->CancelDisconnectAccessory();
|
|
2324 |
retval = KErrNone;
|
|
2325 |
}
|
|
2326 |
break;
|
|
2327 |
|
|
2328 |
case ETFCancelNotifyBluetoothAudioLinkOpenReq:
|
|
2329 |
{
|
|
2330 |
iAccessoryBTControl->CancelNotifyBluetoothAudioLinkOpenReq();
|
|
2331 |
retval = KErrNone;
|
|
2332 |
}
|
|
2333 |
break;
|
|
2334 |
|
|
2335 |
case ETFCancelNotifyBluetoothAudioLinkCloseReq:
|
|
2336 |
{
|
|
2337 |
iAccessoryBTControl->CancelNotifyBluetoothAudioLinkCloseReq();
|
|
2338 |
retval = KErrNone;
|
|
2339 |
}
|
|
2340 |
break;
|
|
2341 |
|
|
2342 |
case ETFCancelNotifyAccessoryConnectionStatusChanged:
|
|
2343 |
{
|
|
2344 |
iAccessoryConnection->CancelNotifyAccessoryConnectionStatusChanged();
|
|
2345 |
retval = KErrNone;
|
|
2346 |
}
|
|
2347 |
break;
|
|
2348 |
|
|
2349 |
case ETFCancelGetAccessoryConnectionStatus:
|
|
2350 |
{
|
|
2351 |
iAccessoryConnection->CancelGetAccessoryConnectionStatus();
|
|
2352 |
retval = KErrNone;
|
|
2353 |
}
|
|
2354 |
break;
|
|
2355 |
|
|
2356 |
case ETFCancelConnectAccessoryBT:
|
|
2357 |
{
|
|
2358 |
iAccessoryBTControl->CancelConnectAccessory();
|
|
2359 |
retval = KErrNone;
|
|
2360 |
}
|
|
2361 |
break;
|
|
2362 |
|
|
2363 |
case ETFCancelDisconnectAccessoryBT:
|
|
2364 |
{
|
|
2365 |
iAccessoryBTControl->CancelDisconnectAccessory();
|
|
2366 |
retval = KErrNone;
|
|
2367 |
}
|
|
2368 |
break;
|
|
2369 |
|
|
2370 |
case ETFCancelNotifyAccessoryModeChanged:
|
|
2371 |
{
|
|
2372 |
iAccessoryMode->CancelNotifyAccessoryModeChanged();
|
|
2373 |
retval = KErrNone;
|
|
2374 |
}
|
|
2375 |
break;
|
|
2376 |
|
|
2377 |
case ETFCancelGetAccessoryMode:
|
|
2378 |
{
|
|
2379 |
iAccessoryMode->CancelGetAccessoryMode();
|
|
2380 |
retval = KErrNone;
|
|
2381 |
}
|
|
2382 |
break;
|
|
2383 |
|
|
2384 |
case ETFCancelNotifyNewAccessoryConnected:
|
|
2385 |
{
|
|
2386 |
iAccessorySingleConnection->CancelNotifyNewAccessoryConnected();
|
|
2387 |
retval = KErrNone;
|
|
2388 |
}
|
|
2389 |
break;
|
|
2390 |
|
|
2391 |
case ETFCancelNotifyAccessoryDisconnected:
|
|
2392 |
{
|
|
2393 |
iAccessorySingleConnection->CancelNotifyAccessoryDisconnected();
|
|
2394 |
retval = KErrNone;
|
|
2395 |
}
|
|
2396 |
break;
|
|
2397 |
|
|
2398 |
case ETFCancelNotifyAccessoryValueChanged:
|
|
2399 |
{
|
|
2400 |
TAccPolNameRecord nameRecord;
|
|
2401 |
nameRecord.SetNameL( aParameter.iArg3 );
|
|
2402 |
iAccessorySingleConnection->CancelNotifyAccessoryValueChanged( nameRecord );
|
|
2403 |
retval = KErrNone;
|
|
2404 |
}
|
|
2405 |
break;
|
|
2406 |
|
|
2407 |
case ETFSelectionDialogText:
|
|
2408 |
{
|
|
2409 |
SelectionDialog(ETFSelectionDialogText, &retval);
|
|
2410 |
}
|
|
2411 |
break;
|
|
2412 |
|
|
2413 |
case ETFSelectionDialogCancel:
|
|
2414 |
{
|
|
2415 |
SelectionDialog(ETFSelectionDialogCancel, &retval);
|
|
2416 |
}
|
|
2417 |
break;
|
|
2418 |
|
|
2419 |
case ETFNotSupportedNote:
|
|
2420 |
{
|
|
2421 |
TUid KAccFwUiNoteNotifierUid =
|
|
2422 |
{
|
|
2423 |
0x10205061
|
|
2424 |
};
|
|
2425 |
RNotifier notifier;
|
|
2426 |
notifier.Connect();
|
|
2427 |
|
|
2428 |
TInt err = notifier.StartNotifier( KAccFwUiNoteNotifierUid,
|
|
2429 |
KNullDesC8 );
|
|
2430 |
|
|
2431 |
TInt value( 0 );
|
|
2432 |
TPckg<TInt> intPckg( value );
|
|
2433 |
notifier.Close();
|
|
2434 |
|
|
2435 |
notifier.Connect();
|
|
2436 |
err = notifier.StartNotifier( KAccFwUiNoteNotifierUid, intPckg );
|
|
2437 |
notifier.Close();
|
|
2438 |
|
|
2439 |
value = 1;
|
|
2440 |
notifier.Connect();
|
|
2441 |
err = notifier.StartNotifier( KAccFwUiNoteNotifierUid, intPckg );
|
|
2442 |
notifier.Close();
|
|
2443 |
|
|
2444 |
value = value << 1;
|
|
2445 |
notifier.Connect();
|
|
2446 |
err = notifier.StartNotifier( KAccFwUiNoteNotifierUid, intPckg );
|
|
2447 |
notifier.Close();
|
|
2448 |
|
|
2449 |
value = value << 1;
|
|
2450 |
notifier.Connect();
|
|
2451 |
err = notifier.StartNotifier( KAccFwUiNoteNotifierUid, intPckg );
|
|
2452 |
notifier.Close();
|
|
2453 |
|
|
2454 |
value = value << 1;
|
|
2455 |
notifier.Connect();
|
|
2456 |
err = notifier.StartNotifier( KAccFwUiNoteNotifierUid, intPckg );
|
|
2457 |
notifier.Close();
|
|
2458 |
|
|
2459 |
value = value << 1;
|
|
2460 |
notifier.Connect();
|
|
2461 |
err = notifier.StartNotifier( KAccFwUiNoteNotifierUid, intPckg );
|
|
2462 |
notifier.Close();
|
|
2463 |
|
|
2464 |
value = value << 1;
|
|
2465 |
notifier.Connect();
|
|
2466 |
err = notifier.StartNotifier( KAccFwUiNoteNotifierUid, intPckg );
|
|
2467 |
notifier.Close();
|
|
2468 |
|
|
2469 |
value = value << 1;
|
|
2470 |
notifier.Connect();
|
|
2471 |
err = notifier.StartNotifier( KAccFwUiNoteNotifierUid, intPckg );
|
|
2472 |
notifier.Close();
|
|
2473 |
|
|
2474 |
retval = KErrNone;
|
|
2475 |
}
|
|
2476 |
break;
|
|
2477 |
|
|
2478 |
case ETFValueRecordTests:
|
|
2479 |
{
|
|
2480 |
retval = TestValueRecordL();
|
|
2481 |
}
|
|
2482 |
break;
|
|
2483 |
|
|
2484 |
case ETFObjectBaseSerializationTests:
|
|
2485 |
{
|
|
2486 |
retval = TestBaseSerializationL();
|
|
2487 |
}
|
|
2488 |
break;
|
|
2489 |
|
|
2490 |
case ETFCheckConnectedAccessory:
|
|
2491 |
{
|
|
2492 |
CheckConnectedAccessory(&retval);
|
|
2493 |
}
|
|
2494 |
break;
|
|
2495 |
|
|
2496 |
case ETFCallTClassMethods:
|
|
2497 |
{
|
|
2498 |
CallTClassMethods(&retval); \
|
|
2499 |
}
|
|
2500 |
|
|
2501 |
case ETFSetHdmiObject_PubSub:
|
|
2502 |
{
|
|
2503 |
CreateHdmiObjectsToPubSubL( aParameter );
|
|
2504 |
retval = KErrNone;
|
|
2505 |
break;
|
|
2506 |
}
|
|
2507 |
|
|
2508 |
case ETFGetHdmiObject:
|
|
2509 |
{
|
|
2510 |
TInt err = KErrNone;
|
|
2511 |
TAccPolNameRecord nameRecord;
|
|
2512 |
nameRecord.SetNameL( aParameter.iArg3 );
|
|
2513 |
|
|
2514 |
// Create HDMI container
|
|
2515 |
CAccPolHdmiObjectCon* conFromASY = CAccPolHdmiObjectCon::NewLC();
|
|
2516 |
CAccPolHdmiObjectCon* conFromPS = CAccPolHdmiObjectCon::NewLC();
|
|
2517 |
|
|
2518 |
// Get HDMI container
|
|
2519 |
TRAP( err, iAccessorySingleConnection->GetValueL(
|
|
2520 |
iGenericId[aParameter.iGid], nameRecord, *conFromASY ) );
|
|
2521 |
|
|
2522 |
// Get HDMI container from P&S
|
|
2523 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
2524 |
CleanupStack::PushL( buf );
|
|
2525 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
2526 |
|
|
2527 |
TPtr8 bufPtr( buf->Ptr( 0 ) );
|
|
2528 |
err = RProperty::Get( KTFAccessoryTestProperty,
|
|
2529 |
KTFAccessoryObjectMethod,
|
|
2530 |
bufPtr );
|
|
2531 |
if( err == KErrNone )
|
|
2532 |
{
|
|
2533 |
RBufReadStream readStream( *buf );
|
|
2534 |
readStream.PushL();
|
|
2535 |
conFromPS->InternalizeL( readStream );
|
|
2536 |
CleanupStack::PopAndDestroy( &readStream );
|
|
2537 |
}
|
|
2538 |
switch( aParameter.iArg3 )
|
|
2539 |
{
|
|
2540 |
case KAccVideoHdmiAttributes:
|
|
2541 |
{
|
|
2542 |
// Validate object count
|
|
2543 |
if( conFromASY->Count() != conFromPS->Count() )
|
|
2544 |
{
|
|
2545 |
err = KErrArgument;
|
|
2546 |
}
|
|
2547 |
|
|
2548 |
// Validate speaker allocation
|
|
2549 |
RAccPolHdmiSpeakerAllocationArray array;
|
|
2550 |
CleanupClosePushL( array );
|
|
2551 |
conFromASY->GetHdmiSpeakerAllocationObjectsL( array );
|
|
2552 |
if( array.Count() )
|
|
2553 |
{
|
|
2554 |
CAccPolHdmiSpeakerAllocation* speakerAllocation = array[0];
|
|
2555 |
TUint32 bits = speakerAllocation->SpeakerAllocation();
|
|
2556 |
|
|
2557 |
// Speaker allocation should be EHdmiSpeakerUnknown
|
|
2558 |
if( bits != CAccPolHdmiSpeakerAllocation::EHdmiSpeakerUnknown )
|
|
2559 |
{
|
|
2560 |
err = KErrArgument;
|
|
2561 |
}
|
|
2562 |
|
|
2563 |
// Speaker count should be zero
|
|
2564 |
if( speakerAllocation->SpeakerCount() )
|
|
2565 |
{
|
|
2566 |
err = KErrArgument;
|
|
2567 |
}
|
|
2568 |
}
|
|
2569 |
CleanupStack::PopAndDestroy( &array );
|
|
2570 |
break;
|
|
2571 |
}
|
|
2572 |
case KAccVideoFormat:
|
|
2573 |
{
|
|
2574 |
// Validate object count
|
|
2575 |
if( conFromASY->Count() != conFromPS->Count() )
|
|
2576 |
{
|
|
2577 |
err = KErrArgument;
|
|
2578 |
}
|
|
2579 |
|
|
2580 |
// Validate video format
|
|
2581 |
RAccPolHdmiVideoFormatArray array;
|
|
2582 |
CleanupClosePushL( array );
|
|
2583 |
conFromASY->GetHdmiVideoFormatObjectsL( array );
|
|
2584 |
if( array.Count() )
|
|
2585 |
{
|
|
2586 |
CAccPolHdmiVideoFormat* videoFormat = array[0];
|
|
2587 |
|
|
2588 |
// Interlaced video should be enabled
|
|
2589 |
if( !videoFormat->Interlaced() )
|
|
2590 |
{
|
|
2591 |
err = KErrArgument;
|
|
2592 |
}
|
|
2593 |
}
|
|
2594 |
else
|
|
2595 |
{
|
|
2596 |
err = KErrArgument;
|
|
2597 |
}
|
|
2598 |
CleanupStack::PopAndDestroy( &array );
|
|
2599 |
break;
|
|
2600 |
}
|
|
2601 |
default:
|
|
2602 |
{
|
|
2603 |
break;
|
|
2604 |
}
|
|
2605 |
}
|
|
2606 |
CleanupStack::PopAndDestroy( buf );
|
|
2607 |
CleanupStack::PopAndDestroy( conFromPS );
|
|
2608 |
CleanupStack::PopAndDestroy( conFromASY );
|
|
2609 |
retval = err;
|
|
2610 |
break;
|
|
2611 |
}
|
|
2612 |
|
|
2613 |
case ETFCheckHdmiObject:
|
|
2614 |
{
|
|
2615 |
TInt err = KErrNone;
|
|
2616 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::CallAccessoryFunctionL: Check HDMI object %d" ),
|
|
2617 |
aParameter.iArg1 ) );
|
|
2618 |
switch( aParameter.iArg1 )
|
|
2619 |
{
|
|
2620 |
case EAccPolHdmiObjectCon:
|
|
2621 |
{
|
|
2622 |
err = CheckHdmiContainerObjectL();
|
|
2623 |
break;
|
|
2624 |
}
|
|
2625 |
case EAccPolHdmiSinkObject:
|
|
2626 |
{
|
|
2627 |
err = CheckHdmiSinkObjectL();
|
|
2628 |
break;
|
|
2629 |
}
|
|
2630 |
case EAccPolHdmiAudioFormatObject:
|
|
2631 |
{
|
|
2632 |
err = CheckHdmiAudioFormatObjectL();
|
|
2633 |
break;
|
|
2634 |
}
|
|
2635 |
case EAccPolHdmiLatencyObject:
|
|
2636 |
{
|
|
2637 |
err = CheckHdmiLatencyObjectL();
|
|
2638 |
break;
|
|
2639 |
}
|
|
2640 |
case EAccPolHdmiSpeakerAllocationObject:
|
|
2641 |
{
|
|
2642 |
err = CheckHdmiSpeakerAllocationObjectL();
|
|
2643 |
break;
|
|
2644 |
}
|
|
2645 |
case EAccPolHdmiVideoFormatObject:
|
|
2646 |
{
|
|
2647 |
err = CheckHdmiVideoFormatObjectL();
|
|
2648 |
break;
|
|
2649 |
}
|
|
2650 |
default:
|
|
2651 |
{
|
|
2652 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::CallAccessoryFunctionL: Invalid HDMI object=%d" ),
|
|
2653 |
aParameter.iArg1 ) );
|
|
2654 |
err = KErrArgument;
|
|
2655 |
break;
|
|
2656 |
}
|
|
2657 |
}
|
|
2658 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::CallAccessoryFunctionL: Check HDMI object %d returned with code %d" ),
|
|
2659 |
aParameter.iArg1, err ) );
|
|
2660 |
retval = err;
|
|
2661 |
break;
|
|
2662 |
}
|
|
2663 |
|
|
2664 |
default:
|
|
2665 |
TRACE_ASSERT_ALWAYS;
|
|
2666 |
break;
|
|
2667 |
|
|
2668 |
}
|
|
2669 |
User::LeaveIfError( retval );
|
|
2670 |
}
|
|
2671 |
|
|
2672 |
//
|
|
2673 |
// ----------------------------------------------------------------------------------
|
|
2674 |
// CTFAccessoryTestControl::TestValueRecordL()
|
|
2675 |
// ----------------------------------------------------------------------------------
|
|
2676 |
//
|
|
2677 |
TInt CTFAccessoryTestControl::TestValueRecordL()
|
|
2678 |
{
|
|
2679 |
TInt ret( KErrNone );
|
|
2680 |
|
|
2681 |
TAccPolValueRecord valueRecord;
|
|
2682 |
TBuf8<KAccMaxECIBlockLength> eci;
|
|
2683 |
TBuf8<KAccMaxECIBlockLength> check;
|
|
2684 |
_LIT( Kissa, "Kissa" );
|
|
2685 |
eci.Copy( Kissa );
|
|
2686 |
|
|
2687 |
valueRecord.SetValue( eci );
|
|
2688 |
check.Copy( valueRecord.ValueRef() );
|
|
2689 |
|
|
2690 |
if( KErrNone != eci.Compare( check ) )
|
|
2691 |
{
|
|
2692 |
User::Leave( KErrGeneral );
|
|
2693 |
}
|
|
2694 |
|
|
2695 |
TDesC8& test( valueRecord.ValueRef() );
|
|
2696 |
if( KErrNone != eci.Compare( test ) )
|
|
2697 |
{
|
|
2698 |
User::Leave( KErrGeneral );
|
|
2699 |
}
|
|
2700 |
|
|
2701 |
return ret;
|
|
2702 |
}
|
|
2703 |
|
|
2704 |
//
|
|
2705 |
// ----------------------------------------------------------------------------------
|
|
2706 |
// CTFAccessoryTestControl::TestBaseSerializationL()
|
|
2707 |
// ----------------------------------------------------------------------------------
|
|
2708 |
//
|
|
2709 |
TInt CTFAccessoryTestControl::TestBaseSerializationL()
|
|
2710 |
{
|
|
2711 |
TInt ret( KErrNone );
|
|
2712 |
TInt err( KErrNone );
|
|
2713 |
|
|
2714 |
/*** One container *************************************************************/
|
|
2715 |
CAccPolAudioStreamFormatCon* container1 =
|
|
2716 |
CAccPolAudioStreamFormatCon::NewLC();
|
|
2717 |
CAccPolAudioStreamFormatCon* container2 =
|
|
2718 |
CAccPolAudioStreamFormatCon::NewLC();
|
|
2719 |
|
|
2720 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
2721 |
CleanupStack::PushL( buf );
|
|
2722 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
2723 |
|
|
2724 |
//Externalize to buf
|
|
2725 |
RBufWriteStream wStrm;
|
|
2726 |
( void )wStrm.Open( *buf );
|
|
2727 |
wStrm.PushL();
|
|
2728 |
container1->ExternalizeL( wStrm );
|
|
2729 |
wStrm.CommitL();
|
|
2730 |
wStrm.Close();
|
|
2731 |
wStrm.Pop();
|
|
2732 |
|
|
2733 |
//Internalize from buf
|
|
2734 |
RBufReadStream rStrm;
|
|
2735 |
( void )rStrm.Open( *buf );
|
|
2736 |
rStrm.PushL();
|
|
2737 |
container2->InternalizeL( rStrm );
|
|
2738 |
rStrm.Close();
|
|
2739 |
rStrm.Pop();
|
|
2740 |
|
|
2741 |
//container1 content must equal to container2 content
|
|
2742 |
err = ( 0 == memcompare( reinterpret_cast<TUint8*> ( container1 ),
|
|
2743 |
sizeof(CAccPolObjectCon),
|
|
2744 |
reinterpret_cast<TUint8*> ( container2 ),
|
|
2745 |
sizeof(CAccPolObjectCon) ) ) ? KErrNone : KErrGeneral;
|
|
2746 |
User::LeaveIfError( err );
|
|
2747 |
|
|
2748 |
CleanupStack::PopAndDestroy( buf );
|
|
2749 |
CleanupStack::PopAndDestroy( container2 );
|
|
2750 |
CleanupStack::PopAndDestroy( container1 );
|
|
2751 |
container2 = NULL;
|
|
2752 |
container1 = NULL;
|
|
2753 |
/* end *************************************************************************/
|
|
2754 |
|
|
2755 |
//Make test again!
|
|
2756 |
|
|
2757 |
CAccPolAudioStreamFormat* audioStream1 =
|
|
2758 |
CAccPolAudioStreamFormat::NewLC( EAccPolAudioInputStreamObject,
|
|
2759 |
15,
|
|
2760 |
KUidFormatMP3,
|
|
2761 |
CAccPolAudioStreamFormat::EStereo,
|
|
2762 |
CAccPolAudioStreamFormat::EBitsPerSample24,
|
|
2763 |
11 );
|
|
2764 |
|
|
2765 |
buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
2766 |
CleanupStack::PushL( buf );
|
|
2767 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
2768 |
|
|
2769 |
//Externalize to buf
|
|
2770 |
( void )wStrm.Open( *buf );
|
|
2771 |
wStrm.PushL();
|
|
2772 |
audioStream1->ExternalizeL( wStrm );
|
|
2773 |
wStrm.CommitL();
|
|
2774 |
wStrm.Close();
|
|
2775 |
wStrm.Pop();
|
|
2776 |
|
|
2777 |
//Internalize from buf
|
|
2778 |
( void )rStrm.Open( *buf );
|
|
2779 |
rStrm.PushL();
|
|
2780 |
|
|
2781 |
TInt objectid = rStrm.ReadUint8L();
|
|
2782 |
|
|
2783 |
if( ( TStreamConObjectType )objectid == EAccPolAudioInputStreamObject )
|
|
2784 |
{
|
|
2785 |
CAccPolAudioStreamFormat* audioStream2 =
|
|
2786 |
CAccPolAudioStreamFormat::NewLC( EAccPolAudioInputStreamObject );
|
|
2787 |
|
|
2788 |
audioStream2->InternalizeL( rStrm );
|
|
2789 |
|
|
2790 |
//audioStream1 content must equal to audioStream2 content
|
|
2791 |
err = ( 0 == memcompare( reinterpret_cast<TUint8*> ( audioStream1 ),
|
|
2792 |
sizeof(CAccPolAudioStreamFormat),
|
|
2793 |
reinterpret_cast<TUint8*> ( audioStream2 ),
|
|
2794 |
sizeof(CAccPolAudioStreamFormat) ) ) ? KErrNone : KErrGeneral;
|
|
2795 |
|
|
2796 |
User::LeaveIfError( err );
|
|
2797 |
|
|
2798 |
CleanupStack::PopAndDestroy( audioStream2 );
|
|
2799 |
|
|
2800 |
rStrm.Close();
|
|
2801 |
rStrm.Pop();
|
|
2802 |
|
|
2803 |
}
|
|
2804 |
else
|
|
2805 |
{
|
|
2806 |
User::LeaveIfError( KErrGeneral );
|
|
2807 |
}
|
|
2808 |
|
|
2809 |
CleanupStack::PopAndDestroy( buf );
|
|
2810 |
CleanupStack::PopAndDestroy( audioStream1 );
|
|
2811 |
audioStream1 = NULL;
|
|
2812 |
/* end *************************************************************************/
|
|
2813 |
|
|
2814 |
return ret;
|
|
2815 |
}
|
|
2816 |
|
|
2817 |
//
|
|
2818 |
// ----------------------------------------------------------------------------------
|
|
2819 |
// CTFAccessoryTestControl::PublishAndSubscribeL()
|
|
2820 |
// ----------------------------------------------------------------------------------
|
|
2821 |
//
|
|
2822 |
void CTFAccessoryTestControl::PublishAndSubscribeL( TTFAccessoryTestCaseStateControl& aParameter )
|
|
2823 |
{
|
|
2824 |
TPckgBuf<TTFAccessoryPublishAndSubscribe> buf;
|
|
2825 |
|
|
2826 |
buf().iTestCaseID = aParameter.iTestCaseID;
|
|
2827 |
buf().iMethod = aParameter.iMethod;
|
|
2828 |
buf().iParam1 = aParameter.iArg1;
|
|
2829 |
buf().iTimeMs = aParameter.iArg4;
|
|
2830 |
buf().iGenericID = iGenericId[aParameter.iGid];
|
|
2831 |
|
|
2832 |
// Send capability to stub(s).
|
|
2833 |
|
|
2834 |
// if( aParameter.iArg3 )
|
|
2835 |
// {
|
|
2836 |
buf().iParam2 = aParameter.iArg3;
|
|
2837 |
// }
|
|
2838 |
|
|
2839 |
/*
|
|
2840 |
if( aParameter.iArg3->Compare( KNullDesC ) )
|
|
2841 |
{
|
|
2842 |
buf().iParam2.Copy( *aParameter.iArg3 );
|
|
2843 |
}
|
|
2844 |
|
|
2845 |
*/
|
|
2846 |
User::LeaveIfError( iSubscribe.Set( KTFAccessoryTestProperty,
|
|
2847 |
KTFAccessoryMethod,
|
|
2848 |
buf ) );
|
|
2849 |
}
|
|
2850 |
|
|
2851 |
//
|
|
2852 |
// ----------------------------------------------------------------------------------
|
|
2853 |
// CTFAccessoryTestControl::CreateHdmiObjectsToPubSubL()
|
|
2854 |
// ----------------------------------------------------------------------------------
|
|
2855 |
//
|
|
2856 |
void CTFAccessoryTestControl::CreateHdmiObjectsToPubSubL(
|
|
2857 |
TTFAccessoryTestCaseStateControl& aParameter )
|
|
2858 |
{
|
|
2859 |
// Define property just in case
|
|
2860 |
RProperty::Define( KTFAccessoryTestProperty,
|
|
2861 |
KTFAccessoryObjectMethod,
|
|
2862 |
RProperty::EByteArray );
|
|
2863 |
|
|
2864 |
// Create HDMI container
|
|
2865 |
CAccPolHdmiObjectCon* con = CAccPolHdmiObjectCon::NewLC();
|
|
2866 |
switch( aParameter.iArg3 )
|
|
2867 |
{
|
|
2868 |
case KAccVideoHdmiAttributes:
|
|
2869 |
{
|
|
2870 |
// Create audio format object
|
|
2871 |
CreateHdmiObjectL( *con, EAccPolHdmiAudioFormatObject );
|
|
2872 |
|
|
2873 |
// Create latency object
|
|
2874 |
CreateHdmiObjectL( *con, EAccPolHdmiLatencyObject );
|
|
2875 |
|
|
2876 |
// Create sink object
|
|
2877 |
CreateHdmiObjectL( *con, EAccPolHdmiSinkObject );
|
|
2878 |
|
|
2879 |
// Create speaker allocation object
|
|
2880 |
CreateHdmiObjectL( *con, EAccPolHdmiSpeakerAllocationObject );
|
|
2881 |
|
|
2882 |
// Create video format object
|
|
2883 |
CreateHdmiObjectL( *con, EAccPolHdmiVideoFormatObject );
|
|
2884 |
break;
|
|
2885 |
}
|
|
2886 |
case KAccVideoFormat:
|
|
2887 |
{
|
|
2888 |
// Create video format object
|
|
2889 |
CreateHdmiObjectL( *con, EAccPolHdmiVideoFormatObject );
|
|
2890 |
break;
|
|
2891 |
}
|
|
2892 |
default:
|
|
2893 |
{
|
|
2894 |
break;
|
|
2895 |
}
|
|
2896 |
}
|
|
2897 |
// Stream HDMI container to P&S
|
|
2898 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
2899 |
CleanupStack::PushL( buf );
|
|
2900 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
2901 |
|
|
2902 |
RBufWriteStream writeStream( *buf );
|
|
2903 |
writeStream.PushL();
|
|
2904 |
con->ExternalizeL( writeStream );
|
|
2905 |
writeStream.CommitL();
|
|
2906 |
CleanupStack::PopAndDestroy( &writeStream );
|
|
2907 |
|
|
2908 |
TPtr8 bufPtr( buf->Ptr( 0 ) );
|
|
2909 |
TInt err = RProperty::Set( KTFAccessoryTestProperty,
|
|
2910 |
KTFAccessoryObjectMethod,
|
|
2911 |
bufPtr );
|
|
2912 |
User::LeaveIfError( err );
|
|
2913 |
|
|
2914 |
// Check if ASY stub needs to be informed
|
|
2915 |
if( aParameter.iArg2 )
|
|
2916 |
{
|
|
2917 |
PublishAndSubscribeL( aParameter );
|
|
2918 |
}
|
|
2919 |
|
|
2920 |
// Cleanup
|
|
2921 |
CleanupStack::PopAndDestroy( buf );
|
|
2922 |
CleanupStack::PopAndDestroy( con );
|
|
2923 |
}
|
|
2924 |
|
|
2925 |
//
|
|
2926 |
// ----------------------------------------------------------------------------------
|
|
2927 |
// CTFAccessoryTestControl::CheckHdmiContainerObjectL
|
|
2928 |
// ----------------------------------------------------------------------------------
|
|
2929 |
TInt CTFAccessoryTestControl::CheckHdmiContainerObjectL()
|
|
2930 |
{
|
|
2931 |
TInt err = KErrNone;
|
|
2932 |
CAccPolHdmiObjectCon* con1 = NULL;
|
|
2933 |
CAccPolHdmiObjectCon* con2 = NULL;
|
|
2934 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
2935 |
CleanupStack::PushL( buf );
|
|
2936 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
2937 |
|
|
2938 |
// NewL
|
|
2939 |
con1 = CAccPolHdmiObjectCon::NewL();
|
|
2940 |
CleanupStack::PushL( con1 );
|
|
2941 |
CleanupStack::PopAndDestroy( con1 );
|
|
2942 |
|
|
2943 |
// NewLC
|
|
2944 |
con1 = CAccPolHdmiObjectCon::NewLC();
|
|
2945 |
CleanupStack::PopAndDestroy( con1 );
|
|
2946 |
|
|
2947 |
// Internalize & Externalize
|
|
2948 |
con1 = CAccPolHdmiObjectCon::NewLC();
|
|
2949 |
CreateHdmiObjectL( *con1, EAccPolHdmiAudioFormatObject );
|
|
2950 |
CreateHdmiObjectL( *con1, EAccPolHdmiLatencyObject );
|
|
2951 |
CreateHdmiObjectL( *con1, EAccPolHdmiSinkObject );
|
|
2952 |
CreateHdmiObjectL( *con1, EAccPolHdmiSpeakerAllocationObject );
|
|
2953 |
CreateHdmiObjectL( *con1, EAccPolHdmiVideoFormatObject );
|
|
2954 |
RBufWriteStream writeStream;
|
|
2955 |
writeStream.Open( *buf );
|
|
2956 |
writeStream.PushL();
|
|
2957 |
con1->ExternalizeL( writeStream );
|
|
2958 |
writeStream.CommitL();
|
|
2959 |
CleanupStack::PopAndDestroy( &writeStream );
|
|
2960 |
|
|
2961 |
con2 = CAccPolHdmiObjectCon::NewLC();
|
|
2962 |
RBufReadStream readStream;
|
|
2963 |
readStream.Open( *buf );
|
|
2964 |
readStream.PushL();
|
|
2965 |
con2->InternalizeL( readStream );
|
|
2966 |
if( con1->Count() == con2->Count() )
|
|
2967 |
{
|
|
2968 |
TInt count = con1->Count();
|
|
2969 |
CAccPolObjectBase* objBase1 = NULL;
|
|
2970 |
CAccPolObjectBase* objBase2 = NULL;
|
|
2971 |
for( TInt i = 0; i < count; i++ )
|
|
2972 |
{
|
|
2973 |
objBase1 = con1->AtL( i );
|
|
2974 |
objBase2 = con2->AtL( i );
|
|
2975 |
if( objBase1->ObjectType() != objBase2->ObjectType() )
|
|
2976 |
{
|
|
2977 |
err = KErrArgument;
|
|
2978 |
}
|
|
2979 |
}
|
|
2980 |
}
|
|
2981 |
else
|
|
2982 |
{
|
|
2983 |
err = KErrArgument;
|
|
2984 |
}
|
|
2985 |
CleanupStack::PopAndDestroy( &readStream );
|
|
2986 |
CleanupStack::PopAndDestroy( con2 );
|
|
2987 |
CleanupStack::PopAndDestroy( con1 );
|
|
2988 |
|
|
2989 |
// DuplicateLC
|
|
2990 |
con1 = CAccPolHdmiObjectCon::NewLC();
|
|
2991 |
CreateHdmiObjectL( *con1, EAccPolHdmiAudioFormatObject );
|
|
2992 |
CreateHdmiObjectL( *con1, EAccPolHdmiLatencyObject );
|
|
2993 |
CreateHdmiObjectL( *con1, EAccPolHdmiSinkObject );
|
|
2994 |
CreateHdmiObjectL( *con1, EAccPolHdmiSpeakerAllocationObject );
|
|
2995 |
CreateHdmiObjectL( *con1, EAccPolHdmiVideoFormatObject );
|
|
2996 |
con2 = static_cast<CAccPolHdmiObjectCon*>( con1->DuplicateLC() );
|
|
2997 |
if( con1->Count() == con2->Count() )
|
|
2998 |
{
|
|
2999 |
TInt count = con1->Count();
|
|
3000 |
CAccPolObjectBase* objBase1 = NULL;
|
|
3001 |
CAccPolObjectBase* objBase2 = NULL;
|
|
3002 |
for( TInt i = 0; i < count; i++ )
|
|
3003 |
{
|
|
3004 |
objBase1 = con1->AtL( i );
|
|
3005 |
objBase2 = con2->AtL( i );
|
|
3006 |
if( objBase1->ObjectType() != objBase2->ObjectType() )
|
|
3007 |
{
|
|
3008 |
err = KErrArgument;
|
|
3009 |
}
|
|
3010 |
}
|
|
3011 |
}
|
|
3012 |
else
|
|
3013 |
{
|
|
3014 |
err = KErrArgument;
|
|
3015 |
}
|
|
3016 |
CleanupStack::PopAndDestroy( con2 );
|
|
3017 |
CleanupStack::PopAndDestroy( con1 );
|
|
3018 |
|
|
3019 |
// Rest of the API
|
|
3020 |
con1 = CAccPolHdmiObjectCon::NewLC();
|
|
3021 |
THdmiConObjectType objectType = EAccPolHdmiObjectCon;
|
|
3022 |
TBool exit = EFalse;
|
|
3023 |
TInt index = 0;
|
|
3024 |
TInt count = 0;
|
|
3025 |
do
|
|
3026 |
{
|
|
3027 |
index++;
|
|
3028 |
err = KErrArgument;
|
|
3029 |
objectType = ( THdmiConObjectType )( index );
|
|
3030 |
CreateHdmiObjectL( *con1, objectType );
|
|
3031 |
count = con1->Count();
|
|
3032 |
CAccPolObjectBase* obj = NULL;
|
|
3033 |
if( con1->Count() != index )
|
|
3034 |
{
|
|
3035 |
err = KErrArgument;
|
|
3036 |
break;
|
|
3037 |
}
|
|
3038 |
for( TInt ii = 0; ii < count; ii++ )
|
|
3039 |
{
|
|
3040 |
obj = con1->AtL( ii );
|
|
3041 |
if( obj->ObjectType() == objectType )
|
|
3042 |
{
|
|
3043 |
err = KErrNone;
|
|
3044 |
break;
|
|
3045 |
}
|
|
3046 |
}
|
|
3047 |
if( objectType == EAccPolHdmiVideoFormatObject )
|
|
3048 |
{
|
|
3049 |
// Last object
|
|
3050 |
exit = ETrue;
|
|
3051 |
}
|
|
3052 |
}
|
|
3053 |
while( !exit && ( err == KErrNone ) );
|
|
3054 |
CleanupStack::PopAndDestroy( con1 );
|
|
3055 |
CleanupStack::PopAndDestroy( buf );
|
|
3056 |
|
|
3057 |
return err;
|
|
3058 |
}
|
|
3059 |
|
|
3060 |
//
|
|
3061 |
// ----------------------------------------------------------------------------------
|
|
3062 |
// CTFAccessoryTestControl::CheckHdmiSinkObjectL
|
|
3063 |
// ----------------------------------------------------------------------------------
|
|
3064 |
TInt CTFAccessoryTestControl::CheckHdmiSinkObjectL()
|
|
3065 |
{
|
|
3066 |
TInt err = KErrNone;
|
|
3067 |
CAccPolHdmiSink* obj = NULL;
|
|
3068 |
CAccPolHdmiSink* objDuplicate = NULL;
|
|
3069 |
TUint8 objectType = 0;
|
|
3070 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
3071 |
CleanupStack::PushL( buf );
|
|
3072 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
3073 |
|
|
3074 |
// NewL
|
|
3075 |
obj = CAccPolHdmiSink::NewL();
|
|
3076 |
CleanupStack::PushL( obj );
|
|
3077 |
CleanupStack::PopAndDestroy( obj );
|
|
3078 |
|
|
3079 |
// NewL - with params
|
|
3080 |
obj = CAccPolHdmiSink::NewL( ETrue, ETrue );
|
|
3081 |
CleanupStack::PushL( obj );
|
|
3082 |
if( !obj->BasicAudioSupport() )
|
|
3083 |
{
|
|
3084 |
err = KErrArgument;
|
|
3085 |
}
|
|
3086 |
if( !obj->HdcpSupport() )
|
|
3087 |
{
|
|
3088 |
err = KErrArgument;
|
|
3089 |
}
|
|
3090 |
CleanupStack::PopAndDestroy( obj );
|
|
3091 |
|
|
3092 |
// NewLC
|
|
3093 |
obj = CAccPolHdmiSink::NewLC();
|
|
3094 |
CleanupStack::PopAndDestroy( obj );
|
|
3095 |
|
|
3096 |
// NewLC - with params
|
|
3097 |
obj = CAccPolHdmiSink::NewLC( ETrue, ETrue );
|
|
3098 |
if( !obj->BasicAudioSupport() )
|
|
3099 |
{
|
|
3100 |
err = KErrArgument;
|
|
3101 |
}
|
|
3102 |
if( !obj->HdcpSupport() )
|
|
3103 |
{
|
|
3104 |
err = KErrArgument;
|
|
3105 |
}
|
|
3106 |
CleanupStack::PopAndDestroy( obj );
|
|
3107 |
|
|
3108 |
// Internalize & Externalize
|
|
3109 |
obj = CAccPolHdmiSink::NewLC( ETrue, ETrue );
|
|
3110 |
|
|
3111 |
RBufWriteStream writeStream;
|
|
3112 |
writeStream.Open( *buf );
|
|
3113 |
writeStream.PushL();
|
|
3114 |
obj->ExternalizeL( writeStream );
|
|
3115 |
writeStream.CommitL();
|
|
3116 |
CleanupStack::PopAndDestroy( &writeStream );
|
|
3117 |
CleanupStack::PopAndDestroy( obj );
|
|
3118 |
|
|
3119 |
obj = CAccPolHdmiSink::NewLC();
|
|
3120 |
RBufReadStream readStream;
|
|
3121 |
readStream.Open( *buf );
|
|
3122 |
readStream.PushL();
|
|
3123 |
objectType = readStream.ReadUint8L();
|
|
3124 |
obj->InternalizeL( readStream );
|
|
3125 |
if( objectType != EAccPolHdmiSinkObject )
|
|
3126 |
{
|
|
3127 |
err = KErrArgument;
|
|
3128 |
}
|
|
3129 |
if( !obj->BasicAudioSupport() )
|
|
3130 |
{
|
|
3131 |
err = KErrArgument;
|
|
3132 |
}
|
|
3133 |
if( !obj->HdcpSupport() )
|
|
3134 |
{
|
|
3135 |
err = KErrArgument;
|
|
3136 |
}
|
|
3137 |
CleanupStack::PopAndDestroy( &readStream );
|
|
3138 |
CleanupStack::PopAndDestroy( obj );
|
|
3139 |
|
|
3140 |
// DuplicateLC - mem compare can be used since the object does not contain
|
|
3141 |
// any ponters as memebers
|
|
3142 |
obj = CAccPolHdmiSink::NewLC( ETrue, ETrue );
|
|
3143 |
objDuplicate = static_cast<CAccPolHdmiSink*>( obj->DuplicateLC() );
|
|
3144 |
TUint8* left = reinterpret_cast<TUint8*>( obj );
|
|
3145 |
TUint8* right = reinterpret_cast<TUint8*>( objDuplicate );
|
|
3146 |
TInt size = sizeof( CAccPolHdmiSink );
|
|
3147 |
if( Mem::Compare( left, size, right, size ) != KErrNone )
|
|
3148 |
{
|
|
3149 |
err = KErrArgument;
|
|
3150 |
}
|
|
3151 |
CleanupStack::PopAndDestroy( objDuplicate );
|
|
3152 |
CleanupStack::PopAndDestroy( obj );
|
|
3153 |
|
|
3154 |
// Rest of the API
|
|
3155 |
obj = CAccPolHdmiSink::NewLC();
|
|
3156 |
obj->SetBasicAudioSupport( ETrue );
|
|
3157 |
if( !obj->BasicAudioSupport() )
|
|
3158 |
{
|
|
3159 |
err = KErrArgument;
|
|
3160 |
}
|
|
3161 |
obj->SetHdcpSupport( ETrue );
|
|
3162 |
if( !obj->HdcpSupport() )
|
|
3163 |
{
|
|
3164 |
err = KErrArgument;
|
|
3165 |
}
|
|
3166 |
CleanupStack::PopAndDestroy( obj );
|
|
3167 |
CleanupStack::PopAndDestroy( buf );
|
|
3168 |
return err;
|
|
3169 |
}
|
|
3170 |
|
|
3171 |
// ----------------------------------------------------------------------------------
|
|
3172 |
// CTFAccessoryTestControl::CheckHdmiAudioFormatObjectL
|
|
3173 |
// ----------------------------------------------------------------------------------
|
|
3174 |
TInt CTFAccessoryTestControl::CheckHdmiAudioFormatObjectL()
|
|
3175 |
{
|
|
3176 |
TInt err = KErrNone;
|
|
3177 |
CAccPolHdmiAudioFormat* obj = NULL;
|
|
3178 |
CAccPolHdmiAudioFormat* objDuplicate = NULL;
|
|
3179 |
TUint8 objectType = 0;
|
|
3180 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
3181 |
CleanupStack::PushL( buf );
|
|
3182 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
3183 |
|
|
3184 |
// NewL
|
|
3185 |
obj = CAccPolHdmiAudioFormat::NewL();
|
|
3186 |
CleanupStack::PushL( obj );
|
|
3187 |
CleanupStack::PopAndDestroy( obj );
|
|
3188 |
|
|
3189 |
// NewL - with params
|
|
3190 |
obj = CAccPolHdmiAudioFormat::NewL( HdmiAudioFormat::KUidFormatPCM16,
|
|
3191 |
1,
|
|
3192 |
1,
|
|
3193 |
1,
|
|
3194 |
1,
|
|
3195 |
1 );
|
|
3196 |
if( obj->AudioFormat() != HdmiAudioFormat::KUidFormatPCM16 )
|
|
3197 |
{
|
|
3198 |
err = KErrArgument;
|
|
3199 |
}
|
|
3200 |
if( obj->ChannelCount() != 1 )
|
|
3201 |
{
|
|
3202 |
err = KErrArgument;
|
|
3203 |
}
|
|
3204 |
if( obj->BitResolution() != 1 )
|
|
3205 |
{
|
|
3206 |
err = KErrArgument;
|
|
3207 |
}
|
|
3208 |
if( obj->MaxBitResolution() != 1 )
|
|
3209 |
{
|
|
3210 |
err = KErrArgument;
|
|
3211 |
}
|
|
3212 |
if( obj->SamFreq() != 1 )
|
|
3213 |
{
|
|
3214 |
err = KErrArgument;
|
|
3215 |
}
|
|
3216 |
if( obj->FormatDependentValue() != 1 )
|
|
3217 |
{
|
|
3218 |
err = KErrArgument;
|
|
3219 |
}
|
|
3220 |
CleanupStack::PushL( obj );
|
|
3221 |
CleanupStack::PopAndDestroy( obj );
|
|
3222 |
|
|
3223 |
// NewLC
|
|
3224 |
obj = CAccPolHdmiAudioFormat::NewLC();
|
|
3225 |
CleanupStack::PopAndDestroy( obj );
|
|
3226 |
|
|
3227 |
// NewLC - with params
|
|
3228 |
obj = CAccPolHdmiAudioFormat::NewLC( HdmiAudioFormat::KUidFormatPCM16,
|
|
3229 |
1,
|
|
3230 |
1,
|
|
3231 |
1,
|
|
3232 |
1,
|
|
3233 |
1 );
|
|
3234 |
if( obj->AudioFormat() != HdmiAudioFormat::KUidFormatPCM16 )
|
|
3235 |
{
|
|
3236 |
err = KErrArgument;
|
|
3237 |
}
|
|
3238 |
if( obj->ChannelCount() != 1 )
|
|
3239 |
{
|
|
3240 |
err = KErrArgument;
|
|
3241 |
}
|
|
3242 |
if( obj->BitResolution() != 1 )
|
|
3243 |
{
|
|
3244 |
err = KErrArgument;
|
|
3245 |
}
|
|
3246 |
if( obj->MaxBitResolution() != 1 )
|
|
3247 |
{
|
|
3248 |
err = KErrArgument;
|
|
3249 |
}
|
|
3250 |
if( obj->SamFreq() != 1 )
|
|
3251 |
{
|
|
3252 |
err = KErrArgument;
|
|
3253 |
}
|
|
3254 |
if( obj->FormatDependentValue() != 1 )
|
|
3255 |
{
|
|
3256 |
err = KErrArgument;
|
|
3257 |
}
|
|
3258 |
CleanupStack::PopAndDestroy( obj );
|
|
3259 |
|
|
3260 |
// Internalize & Externalize
|
|
3261 |
obj = CAccPolHdmiAudioFormat::NewLC( HdmiAudioFormat::KUidFormatPCM16,
|
|
3262 |
1,
|
|
3263 |
1,
|
|
3264 |
1,
|
|
3265 |
1,
|
|
3266 |
1 );
|
|
3267 |
RBufWriteStream writeStream;
|
|
3268 |
writeStream.Open( *buf );
|
|
3269 |
writeStream.PushL();
|
|
3270 |
obj->ExternalizeL( writeStream );
|
|
3271 |
writeStream.CommitL();
|
|
3272 |
CleanupStack::PopAndDestroy( &writeStream );
|
|
3273 |
CleanupStack::PopAndDestroy( obj );
|
|
3274 |
|
|
3275 |
obj = CAccPolHdmiAudioFormat::NewLC();
|
|
3276 |
RBufReadStream readStream;
|
|
3277 |
readStream.Open( *buf );
|
|
3278 |
readStream.PushL();
|
|
3279 |
objectType = readStream.ReadUint8L();
|
|
3280 |
obj->InternalizeL( readStream );
|
|
3281 |
if( objectType != EAccPolHdmiAudioFormatObject )
|
|
3282 |
{
|
|
3283 |
err = KErrArgument;
|
|
3284 |
}
|
|
3285 |
if( obj->AudioFormat() != HdmiAudioFormat::KUidFormatPCM16 )
|
|
3286 |
{
|
|
3287 |
err = KErrArgument;
|
|
3288 |
}
|
|
3289 |
if( obj->ChannelCount() != 1 )
|
|
3290 |
{
|
|
3291 |
err = KErrArgument;
|
|
3292 |
}
|
|
3293 |
if( obj->BitResolution() != 1 )
|
|
3294 |
{
|
|
3295 |
err = KErrArgument;
|
|
3296 |
}
|
|
3297 |
if( obj->MaxBitResolution() != 1 )
|
|
3298 |
{
|
|
3299 |
err = KErrArgument;
|
|
3300 |
}
|
|
3301 |
if( obj->SamFreq() != 1 )
|
|
3302 |
{
|
|
3303 |
err = KErrArgument;
|
|
3304 |
}
|
|
3305 |
if( obj->FormatDependentValue() != 1 )
|
|
3306 |
{
|
|
3307 |
err = KErrArgument;
|
|
3308 |
}
|
|
3309 |
CleanupStack::PopAndDestroy( &readStream );
|
|
3310 |
CleanupStack::PopAndDestroy( obj );
|
|
3311 |
|
|
3312 |
// DuplicateLC - mem compare can be used since the object does not contain
|
|
3313 |
// any ponters as memebers
|
|
3314 |
obj = CAccPolHdmiAudioFormat::NewLC( HdmiAudioFormat::KUidFormatPCM16,
|
|
3315 |
1,
|
|
3316 |
1,
|
|
3317 |
1,
|
|
3318 |
1,
|
|
3319 |
1 );
|
|
3320 |
objDuplicate = static_cast<CAccPolHdmiAudioFormat*>( obj->DuplicateLC() );
|
|
3321 |
TUint8* left = reinterpret_cast<TUint8*>( obj );
|
|
3322 |
TUint8* right = reinterpret_cast<TUint8*>( objDuplicate );
|
|
3323 |
TInt size = sizeof( CAccPolHdmiSink );
|
|
3324 |
if( Mem::Compare( left, size, right, size ) != KErrNone )
|
|
3325 |
{
|
|
3326 |
err = KErrArgument;
|
|
3327 |
}
|
|
3328 |
CleanupStack::PopAndDestroy( objDuplicate );
|
|
3329 |
CleanupStack::PopAndDestroy( obj );
|
|
3330 |
|
|
3331 |
// Rest of the API
|
|
3332 |
obj = CAccPolHdmiAudioFormat::NewLC();
|
|
3333 |
obj->SetAudioFormat( HdmiAudioFormat::KUidFormatEAC3 );
|
|
3334 |
if( obj->AudioFormat() != HdmiAudioFormat::KUidFormatEAC3 )
|
|
3335 |
{
|
|
3336 |
err = KErrArgument;
|
|
3337 |
}
|
|
3338 |
obj->SetChannelCount( 2 );
|
|
3339 |
if( obj->ChannelCount() != 2 )
|
|
3340 |
{
|
|
3341 |
err = KErrArgument;
|
|
3342 |
}
|
|
3343 |
obj->SetBitResolution( CAccPolHdmiAudioFormat::EBitsPerSample20 );
|
|
3344 |
if( !( obj->BitResolution() & CAccPolHdmiAudioFormat::EBitsPerSample20 ) )
|
|
3345 |
{
|
|
3346 |
err = KErrArgument;
|
|
3347 |
}
|
|
3348 |
obj->SetMaxBitResolution( CAccPolHdmiAudioFormat::EBitsPerSample24 );
|
|
3349 |
if( obj->MaxBitResolution() != CAccPolHdmiAudioFormat::EBitsPerSample24 )
|
|
3350 |
{
|
|
3351 |
err = KErrArgument;
|
|
3352 |
}
|
|
3353 |
obj->SetSamFreq( CAccPolHdmiAudioFormat::ESamplingFreq192KHz );
|
|
3354 |
if( !( obj->SamFreq() & CAccPolHdmiAudioFormat::ESamplingFreq192KHz ) )
|
|
3355 |
{
|
|
3356 |
err = KErrArgument;
|
|
3357 |
}
|
|
3358 |
obj->SetFormatDependentValue( CAccPolHdmiAudioFormat::EBitsPerSample16 );
|
|
3359 |
if( !( obj->FormatDependentValue() & CAccPolHdmiAudioFormat::EBitsPerSample16 ) )
|
|
3360 |
{
|
|
3361 |
err = KErrArgument;
|
|
3362 |
}
|
|
3363 |
CleanupStack::PopAndDestroy( obj );
|
|
3364 |
CleanupStack::PopAndDestroy( buf );
|
|
3365 |
|
|
3366 |
return err;
|
|
3367 |
}
|
|
3368 |
|
|
3369 |
// ----------------------------------------------------------------------------------
|
|
3370 |
// CTFAccessoryTestControl::CheckHdmiLatencyObjectL
|
|
3371 |
// ----------------------------------------------------------------------------------
|
|
3372 |
TInt CTFAccessoryTestControl::CheckHdmiLatencyObjectL()
|
|
3373 |
{
|
|
3374 |
TInt err = KErrNone;
|
|
3375 |
CAccPolHdmiLatency* obj = NULL;
|
|
3376 |
CAccPolHdmiLatency* objDuplicate = NULL;
|
|
3377 |
TUint8 objectType = 0;
|
|
3378 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
3379 |
CleanupStack::PushL( buf );
|
|
3380 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
3381 |
|
|
3382 |
// NewL
|
|
3383 |
obj = CAccPolHdmiLatency::NewL();
|
|
3384 |
CleanupStack::PushL( obj );
|
|
3385 |
CleanupStack::PopAndDestroy( obj );
|
|
3386 |
|
|
3387 |
// NewL - with params
|
|
3388 |
obj = CAccPolHdmiLatency::NewL( HdmiLatency::KUidLatency, 100, 200 );
|
|
3389 |
CleanupStack::PushL( obj );
|
|
3390 |
if( obj->LatencyType() != HdmiLatency::KUidLatency )
|
|
3391 |
{
|
|
3392 |
err = KErrArgument;
|
|
3393 |
}
|
|
3394 |
if( obj->AudioLatency() != 100 )
|
|
3395 |
{
|
|
3396 |
err = KErrArgument;
|
|
3397 |
}
|
|
3398 |
if( obj->VideoLatency() != 200 )
|
|
3399 |
{
|
|
3400 |
err = KErrArgument;
|
|
3401 |
}
|
|
3402 |
CleanupStack::PopAndDestroy( obj );
|
|
3403 |
|
|
3404 |
// NewLC
|
|
3405 |
obj = CAccPolHdmiLatency::NewLC();
|
|
3406 |
CleanupStack::PopAndDestroy( obj );
|
|
3407 |
|
|
3408 |
// NewLC - with params
|
|
3409 |
obj = CAccPolHdmiLatency::NewLC( HdmiLatency::KUidLatency, 100, 200 );
|
|
3410 |
if( obj->LatencyType() != HdmiLatency::KUidLatency )
|
|
3411 |
{
|
|
3412 |
err = KErrArgument;
|
|
3413 |
}
|
|
3414 |
if( obj->AudioLatency() != 100 )
|
|
3415 |
{
|
|
3416 |
err = KErrArgument;
|
|
3417 |
}
|
|
3418 |
if( obj->VideoLatency() != 200 )
|
|
3419 |
{
|
|
3420 |
err = KErrArgument;
|
|
3421 |
}
|
|
3422 |
CleanupStack::PopAndDestroy( obj );
|
|
3423 |
|
|
3424 |
// Internalize & Externalize
|
|
3425 |
obj = CAccPolHdmiLatency::NewLC( HdmiLatency::KUidLatency, 100, 200 );
|
|
3426 |
RBufWriteStream writeStream;
|
|
3427 |
writeStream.Open( *buf );
|
|
3428 |
writeStream.PushL();
|
|
3429 |
obj->ExternalizeL( writeStream );
|
|
3430 |
writeStream.CommitL();
|
|
3431 |
CleanupStack::PopAndDestroy( &writeStream );
|
|
3432 |
CleanupStack::PopAndDestroy( obj );
|
|
3433 |
|
|
3434 |
obj = CAccPolHdmiLatency::NewLC();
|
|
3435 |
RBufReadStream readStream;
|
|
3436 |
readStream.Open( *buf );
|
|
3437 |
readStream.PushL();
|
|
3438 |
objectType = readStream.ReadUint8L();
|
|
3439 |
obj->InternalizeL( readStream );
|
|
3440 |
if( objectType != EAccPolHdmiLatencyObject )
|
|
3441 |
{
|
|
3442 |
err = KErrArgument;
|
|
3443 |
}
|
|
3444 |
if( obj->LatencyType() != HdmiLatency::KUidLatency )
|
|
3445 |
{
|
|
3446 |
err = KErrArgument;
|
|
3447 |
}
|
|
3448 |
if( obj->AudioLatency() != 100 )
|
|
3449 |
{
|
|
3450 |
err = KErrArgument;
|
|
3451 |
}
|
|
3452 |
if( obj->VideoLatency() != 200 )
|
|
3453 |
{
|
|
3454 |
err = KErrArgument;
|
|
3455 |
}
|
|
3456 |
CleanupStack::PopAndDestroy( &readStream );
|
|
3457 |
CleanupStack::PopAndDestroy( obj );
|
|
3458 |
|
|
3459 |
// DuplicateLC - mem compare can be used since the object does not contain
|
|
3460 |
// any ponters as memebers
|
|
3461 |
obj = CAccPolHdmiLatency::NewLC( HdmiLatency::KUidLatency, 100, 200 );
|
|
3462 |
objDuplicate = static_cast<CAccPolHdmiLatency*>( obj->DuplicateLC() );
|
|
3463 |
TUint8* left = reinterpret_cast<TUint8*>( obj );
|
|
3464 |
TUint8* right = reinterpret_cast<TUint8*>( objDuplicate );
|
|
3465 |
TInt size = sizeof( CAccPolHdmiLatency );
|
|
3466 |
if( Mem::Compare( left, size, right, size ) != KErrNone )
|
|
3467 |
{
|
|
3468 |
err = KErrArgument;
|
|
3469 |
}
|
|
3470 |
CleanupStack::PopAndDestroy( objDuplicate );
|
|
3471 |
CleanupStack::PopAndDestroy( obj );
|
|
3472 |
|
|
3473 |
// Rest of the API
|
|
3474 |
obj = CAccPolHdmiLatency::NewLC();
|
|
3475 |
obj->SetLatencyType( HdmiLatency::KUidLatency );
|
|
3476 |
if( obj->LatencyType() != HdmiLatency::KUidLatency )
|
|
3477 |
{
|
|
3478 |
err = KErrArgument;
|
|
3479 |
}
|
|
3480 |
obj->SetAudioLatency( 100 );
|
|
3481 |
if( obj->AudioLatency() != 100 )
|
|
3482 |
{
|
|
3483 |
err = KErrArgument;
|
|
3484 |
}
|
|
3485 |
obj->SetVideoLatency( 200 );
|
|
3486 |
if( obj->VideoLatency() != 200 )
|
|
3487 |
{
|
|
3488 |
err = KErrArgument;
|
|
3489 |
}
|
|
3490 |
CleanupStack::PopAndDestroy( obj );
|
|
3491 |
CleanupStack::PopAndDestroy( buf );
|
|
3492 |
|
|
3493 |
return err;
|
|
3494 |
}
|
|
3495 |
|
|
3496 |
// ----------------------------------------------------------------------------------
|
|
3497 |
// CTFAccessoryTestControl::CheckHdmiSpeakerAllocationObjectL
|
|
3498 |
// ----------------------------------------------------------------------------------
|
|
3499 |
TInt CTFAccessoryTestControl::CheckHdmiSpeakerAllocationObjectL()
|
|
3500 |
{
|
|
3501 |
TInt err = KErrNone;
|
|
3502 |
CAccPolHdmiSpeakerAllocation* obj = NULL;
|
|
3503 |
CAccPolHdmiSpeakerAllocation* objDuplicate = NULL;
|
|
3504 |
TUint8 objectType = 0;
|
|
3505 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
3506 |
CleanupStack::PushL( buf );
|
|
3507 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
3508 |
TUint32 bits = 0x0;
|
|
3509 |
|
|
3510 |
// NewL
|
|
3511 |
obj = CAccPolHdmiSpeakerAllocation::NewL();
|
|
3512 |
CleanupStack::PushL( obj );
|
|
3513 |
CleanupStack::PopAndDestroy( obj );
|
|
3514 |
|
|
3515 |
// NewLC
|
|
3516 |
obj = CAccPolHdmiSpeakerAllocation::NewLC();
|
|
3517 |
CleanupStack::PopAndDestroy( obj );
|
|
3518 |
|
|
3519 |
// NewL - with params
|
|
3520 |
bits = CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter |
|
|
3521 |
CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter;
|
|
3522 |
obj = CAccPolHdmiSpeakerAllocation::NewL( bits );
|
|
3523 |
CleanupStack::PushL( obj );
|
|
3524 |
if( !obj->FrontCenter() )
|
|
3525 |
{
|
|
3526 |
err = KErrArgument;
|
|
3527 |
}
|
|
3528 |
if( !obj->RearCenter() )
|
|
3529 |
{
|
|
3530 |
err = KErrArgument;
|
|
3531 |
}
|
|
3532 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter ) )
|
|
3533 |
{
|
|
3534 |
err = KErrArgument;
|
|
3535 |
}
|
|
3536 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter ) )
|
|
3537 |
{
|
|
3538 |
err = KErrArgument;
|
|
3539 |
}
|
|
3540 |
CleanupStack::PopAndDestroy( obj );
|
|
3541 |
|
|
3542 |
obj = CAccPolHdmiSpeakerAllocation::NewL( EFalse,
|
|
3543 |
EFalse,
|
|
3544 |
EFalse,
|
|
3545 |
ETrue,
|
|
3546 |
EFalse,
|
|
3547 |
EFalse,
|
|
3548 |
ETrue,
|
|
3549 |
EFalse,
|
|
3550 |
EFalse,
|
|
3551 |
EFalse,
|
|
3552 |
EFalse );
|
|
3553 |
CleanupStack::PushL( obj );
|
|
3554 |
if( !obj->FrontCenter() )
|
|
3555 |
{
|
|
3556 |
err = KErrArgument;
|
|
3557 |
}
|
|
3558 |
if( !obj->RearCenter() )
|
|
3559 |
{
|
|
3560 |
err = KErrArgument;
|
|
3561 |
}
|
|
3562 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter ) )
|
|
3563 |
{
|
|
3564 |
err = KErrArgument;
|
|
3565 |
}
|
|
3566 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter ) )
|
|
3567 |
{
|
|
3568 |
err = KErrArgument;
|
|
3569 |
}
|
|
3570 |
CleanupStack::PopAndDestroy( obj );
|
|
3571 |
|
|
3572 |
// NewLC - with params
|
|
3573 |
bits = CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter |
|
|
3574 |
CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter;
|
|
3575 |
obj = CAccPolHdmiSpeakerAllocation::NewLC( bits );
|
|
3576 |
if( !obj->FrontCenter() )
|
|
3577 |
{
|
|
3578 |
err = KErrArgument;
|
|
3579 |
}
|
|
3580 |
if( !obj->RearCenter() )
|
|
3581 |
{
|
|
3582 |
err = KErrArgument;
|
|
3583 |
}
|
|
3584 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter ) )
|
|
3585 |
{
|
|
3586 |
err = KErrArgument;
|
|
3587 |
}
|
|
3588 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter ) )
|
|
3589 |
{
|
|
3590 |
err = KErrArgument;
|
|
3591 |
}
|
|
3592 |
CleanupStack::PopAndDestroy( obj );
|
|
3593 |
|
|
3594 |
obj = CAccPolHdmiSpeakerAllocation::NewLC( EFalse,
|
|
3595 |
EFalse,
|
|
3596 |
EFalse,
|
|
3597 |
ETrue,
|
|
3598 |
EFalse,
|
|
3599 |
EFalse,
|
|
3600 |
ETrue,
|
|
3601 |
EFalse,
|
|
3602 |
EFalse,
|
|
3603 |
EFalse,
|
|
3604 |
EFalse );
|
|
3605 |
if( !obj->FrontCenter() )
|
|
3606 |
{
|
|
3607 |
err = KErrArgument;
|
|
3608 |
}
|
|
3609 |
if( !obj->RearCenter() )
|
|
3610 |
{
|
|
3611 |
err = KErrArgument;
|
|
3612 |
}
|
|
3613 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter ) )
|
|
3614 |
{
|
|
3615 |
err = KErrArgument;
|
|
3616 |
}
|
|
3617 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter ) )
|
|
3618 |
{
|
|
3619 |
err = KErrArgument;
|
|
3620 |
}
|
|
3621 |
CleanupStack::PopAndDestroy( obj );
|
|
3622 |
|
|
3623 |
// Internalize & Externalize
|
|
3624 |
bits = CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter |
|
|
3625 |
CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter;
|
|
3626 |
obj = CAccPolHdmiSpeakerAllocation::NewLC( bits );
|
|
3627 |
RBufWriteStream writeStream;
|
|
3628 |
writeStream.Open( *buf );
|
|
3629 |
writeStream.PushL();
|
|
3630 |
obj->ExternalizeL( writeStream );
|
|
3631 |
writeStream.CommitL();
|
|
3632 |
CleanupStack::PopAndDestroy( &writeStream );
|
|
3633 |
CleanupStack::PopAndDestroy( obj );
|
|
3634 |
|
|
3635 |
obj = CAccPolHdmiSpeakerAllocation::NewLC();
|
|
3636 |
RBufReadStream readStream;
|
|
3637 |
readStream.Open( *buf );
|
|
3638 |
readStream.PushL();
|
|
3639 |
objectType = readStream.ReadUint8L();
|
|
3640 |
obj->InternalizeL( readStream );
|
|
3641 |
if( objectType != EAccPolHdmiSpeakerAllocationObject )
|
|
3642 |
{
|
|
3643 |
err = KErrArgument;
|
|
3644 |
}
|
|
3645 |
if( !obj->FrontCenter() )
|
|
3646 |
{
|
|
3647 |
err = KErrArgument;
|
|
3648 |
}
|
|
3649 |
if( !obj->RearCenter() )
|
|
3650 |
{
|
|
3651 |
err = KErrArgument;
|
|
3652 |
}
|
|
3653 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter ) )
|
|
3654 |
{
|
|
3655 |
err = KErrArgument;
|
|
3656 |
}
|
|
3657 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter ) )
|
|
3658 |
{
|
|
3659 |
err = KErrArgument;
|
|
3660 |
}
|
|
3661 |
CleanupStack::PopAndDestroy( &readStream );
|
|
3662 |
CleanupStack::PopAndDestroy( obj );
|
|
3663 |
|
|
3664 |
// DuplicateLC - mem compare can be used since the object does not contain
|
|
3665 |
// any ponters as memebers
|
|
3666 |
bits = CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter |
|
|
3667 |
CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter;
|
|
3668 |
obj = CAccPolHdmiSpeakerAllocation::NewLC( bits );
|
|
3669 |
objDuplicate = static_cast<CAccPolHdmiSpeakerAllocation*>( obj->DuplicateLC() );
|
|
3670 |
TUint8* left = reinterpret_cast<TUint8*>( obj );
|
|
3671 |
TUint8* right = reinterpret_cast<TUint8*>( objDuplicate );
|
|
3672 |
TInt size = sizeof( CAccPolHdmiSpeakerAllocation );
|
|
3673 |
if( Mem::Compare( left, size, right, size ) != KErrNone )
|
|
3674 |
{
|
|
3675 |
err = KErrArgument;
|
|
3676 |
}
|
|
3677 |
CleanupStack::PopAndDestroy( objDuplicate );
|
|
3678 |
CleanupStack::PopAndDestroy( obj );
|
|
3679 |
|
|
3680 |
// Rest of the API
|
|
3681 |
bits = CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter |
|
|
3682 |
CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter |
|
|
3683 |
CAccPolHdmiSpeakerAllocation::EHdmiSpeakerTopCenter;
|
|
3684 |
obj = CAccPolHdmiSpeakerAllocation::NewLC();
|
|
3685 |
obj->SetSpeakerAllocation( bits );
|
|
3686 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerFrontCenter ) )
|
|
3687 |
{
|
|
3688 |
err = KErrArgument;
|
|
3689 |
}
|
|
3690 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerRearCenter ) )
|
|
3691 |
{
|
|
3692 |
err = KErrArgument;
|
|
3693 |
}
|
|
3694 |
if( !( obj->SpeakerAllocation() & CAccPolHdmiSpeakerAllocation::EHdmiSpeakerTopCenter ) )
|
|
3695 |
{
|
|
3696 |
err = KErrArgument;
|
|
3697 |
}
|
|
3698 |
CleanupStack::PopAndDestroy( obj );
|
|
3699 |
|
|
3700 |
obj = CAccPolHdmiSpeakerAllocation::NewLC();
|
|
3701 |
obj->SetFrontSpeakers( ETrue );
|
|
3702 |
if( !obj->FrontSpeakers() || obj->SpeakerCount() != 2 )
|
|
3703 |
{
|
|
3704 |
err = KErrArgument;
|
|
3705 |
}
|
|
3706 |
obj->SetFrontSpeakers( EFalse );
|
|
3707 |
if( obj->FrontSpeakers() || obj->SpeakerCount() != 0 )
|
|
3708 |
{
|
|
3709 |
err = KErrArgument;
|
|
3710 |
}
|
|
3711 |
obj->SetRearSpeakers( ETrue );
|
|
3712 |
if( !obj->RearSpeakers() || obj->SpeakerCount() != 2 )
|
|
3713 |
{
|
|
3714 |
err = KErrArgument;
|
|
3715 |
}
|
|
3716 |
obj->SetRearSpeakers( EFalse );
|
|
3717 |
if( obj->RearSpeakers() || obj->SpeakerCount() != 0 )
|
|
3718 |
{
|
|
3719 |
err = KErrArgument;
|
|
3720 |
}
|
|
3721 |
obj->SetLowFrequencyEffect( ETrue );
|
|
3722 |
if( !obj->LowFrequencyEffect() || obj->SpeakerCount() != 1 )
|
|
3723 |
{
|
|
3724 |
err = KErrArgument;
|
|
3725 |
}
|
|
3726 |
obj->SetLowFrequencyEffect( EFalse );
|
|
3727 |
if( obj->LowFrequencyEffect() || obj->SpeakerCount() != 0 )
|
|
3728 |
{
|
|
3729 |
err = KErrArgument;
|
|
3730 |
}
|
|
3731 |
obj->SetFrontCenter( ETrue );
|
|
3732 |
if( !obj->FrontCenter() || obj->SpeakerCount() != 1 )
|
|
3733 |
{
|
|
3734 |
err = KErrArgument;
|
|
3735 |
}
|
|
3736 |
obj->SetFrontCenter( EFalse );
|
|
3737 |
if( obj->FrontCenter() || obj->SpeakerCount() != 0 )
|
|
3738 |
{
|
|
3739 |
err = KErrArgument;
|
|
3740 |
}
|
|
3741 |
obj->SetFrontCenterHigh( ETrue );
|
|
3742 |
if( !obj->FrontCenterHigh() || obj->SpeakerCount() != 1 )
|
|
3743 |
{
|
|
3744 |
err = KErrArgument;
|
|
3745 |
}
|
|
3746 |
obj->SetFrontCenterHigh( EFalse );
|
|
3747 |
if( obj->FrontCenterHigh() || obj->SpeakerCount() != 0 )
|
|
3748 |
{
|
|
3749 |
err = KErrArgument;
|
|
3750 |
}
|
|
3751 |
obj->SetTopCenter( ETrue );
|
|
3752 |
if( !obj->TopCenter() || obj->SpeakerCount() != 1 )
|
|
3753 |
{
|
|
3754 |
err = KErrArgument;
|
|
3755 |
}
|
|
3756 |
obj->SetTopCenter( EFalse );
|
|
3757 |
if( obj->TopCenter() || obj->SpeakerCount() != 0 )
|
|
3758 |
{
|
|
3759 |
err = KErrArgument;
|
|
3760 |
}
|
|
3761 |
obj->SetRearCenter( ETrue );
|
|
3762 |
if( !obj->RearCenter() || obj->SpeakerCount() != 1 )
|
|
3763 |
{
|
|
3764 |
err = KErrArgument;
|
|
3765 |
}
|
|
3766 |
obj->SetRearCenter( EFalse );
|
|
3767 |
if( obj->RearCenter() || obj->SpeakerCount() != 0 )
|
|
3768 |
{
|
|
3769 |
err = KErrArgument;
|
|
3770 |
}
|
|
3771 |
obj->SetFrontLeftRightCenter( ETrue );
|
|
3772 |
if( !obj->FrontLeftRightCenter() || obj->SpeakerCount() != 2 )
|
|
3773 |
{
|
|
3774 |
err = KErrArgument;
|
|
3775 |
}
|
|
3776 |
obj->SetFrontLeftRightCenter( EFalse );
|
|
3777 |
if( obj->FrontLeftRightCenter() || obj->SpeakerCount() != 0 )
|
|
3778 |
{
|
|
3779 |
err = KErrArgument;
|
|
3780 |
}
|
|
3781 |
obj->SetRearLeftRightCenter( ETrue );
|
|
3782 |
if( !obj->RearLeftRightCenter() || obj->SpeakerCount() != 2 )
|
|
3783 |
{
|
|
3784 |
err = KErrArgument;
|
|
3785 |
}
|
|
3786 |
obj->SetRearLeftRightCenter( EFalse );
|
|
3787 |
if( obj->RearLeftRightCenter() || obj->SpeakerCount() != 0 )
|
|
3788 |
{
|
|
3789 |
err = KErrArgument;
|
|
3790 |
}
|
|
3791 |
obj->SetFrontWideSpeakers( ETrue );
|
|
3792 |
if( !obj->FrontWideSpeakers() || obj->SpeakerCount() != 2 )
|
|
3793 |
{
|
|
3794 |
err = KErrArgument;
|
|
3795 |
}
|
|
3796 |
obj->SetFrontWideSpeakers( EFalse );
|
|
3797 |
if( obj->FrontWideSpeakers() || obj->SpeakerCount() != 0 )
|
|
3798 |
{
|
|
3799 |
err = KErrArgument;
|
|
3800 |
}
|
|
3801 |
obj->SetFrontHighSpeakers( ETrue );
|
|
3802 |
if( !obj->FrontHighSpeakers() || obj->SpeakerCount() != 2 )
|
|
3803 |
{
|
|
3804 |
err = KErrArgument;
|
|
3805 |
}
|
|
3806 |
obj->SetFrontHighSpeakers( EFalse );
|
|
3807 |
if( obj->FrontHighSpeakers() || obj->SpeakerCount() != 0 )
|
|
3808 |
{
|
|
3809 |
err = KErrArgument;
|
|
3810 |
}
|
|
3811 |
CleanupStack::PopAndDestroy( obj );
|
|
3812 |
CleanupStack::PopAndDestroy( buf );
|
|
3813 |
|
|
3814 |
return err;
|
|
3815 |
}
|
|
3816 |
|
|
3817 |
// ----------------------------------------------------------------------------------
|
|
3818 |
// CTFAccessoryTestControl::CheckHdmiVideoFormatObjectL
|
|
3819 |
// ----------------------------------------------------------------------------------
|
|
3820 |
TInt CTFAccessoryTestControl::CheckHdmiVideoFormatObjectL()
|
|
3821 |
{
|
|
3822 |
TInt err = KErrNone;
|
|
3823 |
CAccPolHdmiVideoFormat* obj = NULL;
|
|
3824 |
CAccPolHdmiVideoFormat* objDuplicate = NULL;
|
|
3825 |
TUint8 objectType = 0;
|
|
3826 |
CBufFlat* buf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
|
|
3827 |
CleanupStack::PushL( buf );
|
|
3828 |
buf->ResizeL( KAccSrvObjectBaseStreamBufMaxSize );
|
|
3829 |
|
|
3830 |
// NewL
|
|
3831 |
obj = CAccPolHdmiVideoFormat::NewL();
|
|
3832 |
CleanupStack::PushL( obj );
|
|
3833 |
CleanupStack::PopAndDestroy( obj );
|
|
3834 |
|
|
3835 |
// NewLC
|
|
3836 |
obj = CAccPolHdmiVideoFormat::NewLC();
|
|
3837 |
CleanupStack::PopAndDestroy( obj );
|
|
3838 |
|
|
3839 |
// NewL - with params
|
|
3840 |
obj = CAccPolHdmiVideoFormat::NewL( E640x480p59_94d60Hz4d3,
|
|
3841 |
E640x350p85HzRB,
|
|
3842 |
1,
|
|
3843 |
ETrue );
|
|
3844 |
CleanupStack::PushL( obj );
|
|
3845 |
if( obj->CeaFixedMode() != E640x480p59_94d60Hz4d3 )
|
|
3846 |
{
|
|
3847 |
err = KErrArgument;
|
|
3848 |
}
|
|
3849 |
if( obj->DmtFixedMode() != E640x350p85HzRB )
|
|
3850 |
{
|
|
3851 |
err = KErrArgument;
|
|
3852 |
}
|
|
3853 |
if( obj->PixelRepeat() != 1 )
|
|
3854 |
{
|
|
3855 |
err = KErrArgument;
|
|
3856 |
}
|
|
3857 |
if( !obj->Interlaced() )
|
|
3858 |
{
|
|
3859 |
err = KErrArgument;
|
|
3860 |
}
|
|
3861 |
CleanupStack::PopAndDestroy( obj );
|
|
3862 |
|
|
3863 |
// NewLC - with params
|
|
3864 |
obj = CAccPolHdmiVideoFormat::NewLC( E640x480p59_94d60Hz4d3,
|
|
3865 |
E640x350p85HzRB,
|
|
3866 |
1,
|
|
3867 |
ETrue );
|
|
3868 |
if( obj->CeaFixedMode() != E640x480p59_94d60Hz4d3 )
|
|
3869 |
{
|
|
3870 |
err = KErrArgument;
|
|
3871 |
}
|
|
3872 |
if( obj->DmtFixedMode() != E640x350p85HzRB )
|
|
3873 |
{
|
|
3874 |
err = KErrArgument;
|
|
3875 |
}
|
|
3876 |
if( obj->PixelRepeat() != 1 )
|
|
3877 |
{
|
|
3878 |
err = KErrArgument;
|
|
3879 |
}
|
|
3880 |
if( !obj->Interlaced() )
|
|
3881 |
{
|
|
3882 |
err = KErrArgument;
|
|
3883 |
}
|
|
3884 |
CleanupStack::PopAndDestroy( obj );
|
|
3885 |
|
|
3886 |
// Internalize & Externalize
|
|
3887 |
obj = CAccPolHdmiVideoFormat::NewLC( E640x480p59_94d60Hz4d3,
|
|
3888 |
E640x350p85HzRB,
|
|
3889 |
1,
|
|
3890 |
ETrue );
|
|
3891 |
RBufWriteStream writeStream;
|
|
3892 |
writeStream.Open( *buf );
|
|
3893 |
writeStream.PushL();
|
|
3894 |
obj->ExternalizeL( writeStream );
|
|
3895 |
writeStream.CommitL();
|
|
3896 |
CleanupStack::PopAndDestroy( &writeStream );
|
|
3897 |
CleanupStack::PopAndDestroy( obj );
|
|
3898 |
|
|
3899 |
obj = CAccPolHdmiVideoFormat::NewLC();
|
|
3900 |
RBufReadStream readStream;
|
|
3901 |
readStream.Open( *buf );
|
|
3902 |
readStream.PushL();
|
|
3903 |
objectType = readStream.ReadUint8L();
|
|
3904 |
obj->InternalizeL( readStream );
|
|
3905 |
if( objectType != EAccPolHdmiVideoFormatObject )
|
|
3906 |
{
|
|
3907 |
err = KErrArgument;
|
|
3908 |
}
|
|
3909 |
if( obj->CeaFixedMode() != E640x480p59_94d60Hz4d3 )
|
|
3910 |
{
|
|
3911 |
err = KErrArgument;
|
|
3912 |
}
|
|
3913 |
if( obj->DmtFixedMode() != E640x350p85HzRB )
|
|
3914 |
{
|
|
3915 |
err = KErrArgument;
|
|
3916 |
}
|
|
3917 |
if( obj->PixelRepeat() != 1 )
|
|
3918 |
{
|
|
3919 |
err = KErrArgument;
|
|
3920 |
}
|
|
3921 |
if( !obj->Interlaced() )
|
|
3922 |
{
|
|
3923 |
err = KErrArgument;
|
|
3924 |
}
|
|
3925 |
CleanupStack::PopAndDestroy( &readStream );
|
|
3926 |
CleanupStack::PopAndDestroy( obj );
|
|
3927 |
|
|
3928 |
// DuplicateLC - mem compare can be used since the object does not contain
|
|
3929 |
// any ponters as memebers
|
|
3930 |
obj = CAccPolHdmiVideoFormat::NewLC( E640x480p59_94d60Hz4d3,
|
|
3931 |
E640x350p85HzRB,
|
|
3932 |
1,
|
|
3933 |
ETrue );
|
|
3934 |
objDuplicate = static_cast<CAccPolHdmiVideoFormat*>( obj->DuplicateLC() );
|
|
3935 |
TUint8* left = reinterpret_cast<TUint8*>( obj );
|
|
3936 |
TUint8* right = reinterpret_cast<TUint8*>( objDuplicate );
|
|
3937 |
TInt size = sizeof( CAccPolHdmiVideoFormat );
|
|
3938 |
if( Mem::Compare( left, size, right, size ) != KErrNone )
|
|
3939 |
{
|
|
3940 |
err = KErrArgument;
|
|
3941 |
}
|
|
3942 |
CleanupStack::PopAndDestroy( objDuplicate );
|
|
3943 |
CleanupStack::PopAndDestroy( obj );
|
|
3944 |
|
|
3945 |
// Rest of the API
|
|
3946 |
obj = CAccPolHdmiVideoFormat::NewLC();
|
|
3947 |
obj->SetCeaFixedMode( E640x480p59_94d60Hz4d3 );
|
|
3948 |
if( obj->CeaFixedMode() != E640x480p59_94d60Hz4d3 )
|
|
3949 |
{
|
|
3950 |
err = KErrArgument;
|
|
3951 |
}
|
|
3952 |
obj->SetDmtFixedMode( E640x350p85HzRB );
|
|
3953 |
if( obj->DmtFixedMode() != E640x350p85HzRB )
|
|
3954 |
{
|
|
3955 |
err = KErrArgument;
|
|
3956 |
}
|
|
3957 |
obj->SetPixelRepeat( 4 );
|
|
3958 |
if( obj->PixelRepeat() != 4 )
|
|
3959 |
{
|
|
3960 |
err = KErrArgument;
|
|
3961 |
}
|
|
3962 |
obj->SetInterlaced( ETrue );
|
|
3963 |
if( !obj->Interlaced() )
|
|
3964 |
{
|
|
3965 |
err = KErrArgument;
|
|
3966 |
}
|
|
3967 |
CleanupStack::PopAndDestroy( obj );
|
|
3968 |
CleanupStack::PopAndDestroy( buf );
|
|
3969 |
|
|
3970 |
return err;
|
|
3971 |
}
|
|
3972 |
|
|
3973 |
//
|
|
3974 |
// ----------------------------------------------------------------------------------
|
|
3975 |
// CTFTestControlObserver* CTFAccessoryTestControl::CreateObserver()
|
|
3976 |
// ----------------------------------------------------------------------------------
|
|
3977 |
CTFTestControlObserver* CTFAccessoryTestControl::CreateObserver()
|
|
3978 |
{
|
|
3979 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::CreateObserver()" ) ) );
|
|
3980 |
iStack.AddFirst/*AddLast*/( *CTFTestControlObserver::NewL( *this ) );
|
|
3981 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::CreateObserver() return" ) ) );
|
|
3982 |
return iStack.First/*Last*/();
|
|
3983 |
}
|
|
3984 |
|
|
3985 |
// Not used at this point.
|
|
3986 |
// ----------------------------------------------------------------------------------
|
|
3987 |
// CTFAccessoryTestControl::ProcessMessageAndCompleteL
|
|
3988 |
// ----------------------------------------------------------------------------------
|
|
3989 |
void CTFAccessoryTestControl::ProcessMessageAndCompleteL( const RMessage2& aMessage )
|
|
3990 |
{
|
|
3991 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::ProcessMessageAndCompleteL enter" ) ) );
|
|
3992 |
aMessage.Complete( KErrNone );
|
|
3993 |
COMPONENT_TRACE( ( _L( "ACCESSORYTESTCONTROL - CTFAccessoryTestControl::ProcessMessageAndCompleteL return" ) ) );
|
|
3994 |
}
|
|
3995 |
//
|
|
3996 |
// ----------------------------------------------------------------------------------
|
|
3997 |
// CTFAccessoryTestControl::MessageCompleteL
|
|
3998 |
// ----------------------------------------------------------------------------------
|
|
3999 |
void CTFAccessoryTestControl::MessageCompleteL( TInt /*aResult*/)
|
|
4000 |
{
|
|
4001 |
|
|
4002 |
}
|
|
4003 |
|
|
4004 |
//
|
|
4005 |
// ----------------------------------------------------------------------------------
|
|
4006 |
// CTFAccessoryTestControl::CreateHdmiObjectL
|
|
4007 |
// ----------------------------------------------------------------------------------
|
|
4008 |
void CTFAccessoryTestControl::CreateHdmiObjectL( CAccPolObjectCon& aCon,
|
|
4009 |
THdmiConObjectType aType )
|
|
4010 |
{
|
|
4011 |
switch( aType )
|
|
4012 |
{
|
|
4013 |
case EAccPolHdmiSinkObject:
|
|
4014 |
{
|
|
4015 |
CAccPolHdmiSink* sink = CAccPolHdmiSink::NewLC();
|
|
4016 |
sink->SetBasicAudioSupport( ETrue );
|
|
4017 |
sink->SetHdcpSupport( ETrue );
|
|
4018 |
aCon.AddL( *sink );
|
|
4019 |
CleanupStack::PopAndDestroy( sink );
|
|
4020 |
break;
|
|
4021 |
}
|
|
4022 |
case EAccPolHdmiAudioFormatObject:
|
|
4023 |
{
|
|
4024 |
CAccPolHdmiAudioFormat* audioFormat = CAccPolHdmiAudioFormat::NewLC();
|
|
4025 |
audioFormat->SetAudioFormat( HdmiAudioFormat::KUidFormatPCM16 );
|
|
4026 |
audioFormat->SetChannelCount( 2 );
|
|
4027 |
audioFormat->SetBitResolution( CAccPolHdmiAudioFormat::EBitsPerSample16 );
|
|
4028 |
audioFormat->SetMaxBitResolution( CAccPolHdmiAudioFormat::EBitsPerSample16 );
|
|
4029 |
audioFormat->SetFormatDependentValue( CAccPolHdmiAudioFormat::EBitsPerSample16 );
|
|
4030 |
audioFormat->SamFreq( CAccPolHdmiAudioFormat::ESamplingFreq32KHz );
|
|
4031 |
aCon.AddL( *audioFormat );
|
|
4032 |
CleanupStack::PopAndDestroy( audioFormat );
|
|
4033 |
break;
|
|
4034 |
}
|
|
4035 |
case EAccPolHdmiLatencyObject:
|
|
4036 |
{
|
|
4037 |
CAccPolHdmiLatency* latency = CAccPolHdmiLatency::NewLC();
|
|
4038 |
latency->SetLatencyType( HdmiLatency::KUidLatency );
|
|
4039 |
latency->SetAudioLatency( 100 );
|
|
4040 |
latency->SetVideoLatency( 200 );
|
|
4041 |
aCon.AddL( *latency );
|
|
4042 |
CleanupStack::PopAndDestroy( latency );
|
|
4043 |
break;
|
|
4044 |
}
|
|
4045 |
case EAccPolHdmiSpeakerAllocationObject:
|
|
4046 |
{
|
|
4047 |
CAccPolHdmiSpeakerAllocation* speakerAllocation =
|
|
4048 |
CAccPolHdmiSpeakerAllocation::NewLC();
|
|
4049 |
speakerAllocation->SetFrontSpeakers( ETrue );
|
|
4050 |
speakerAllocation->SetRearSpeakers( ETrue );
|
|
4051 |
speakerAllocation->SetLowFrequencyEffect( ETrue );
|
|
4052 |
speakerAllocation->SetFrontCenter( ETrue );
|
|
4053 |
speakerAllocation->SetFrontCenterHigh( ETrue );
|
|
4054 |
speakerAllocation->SetTopCenter( ETrue );
|
|
4055 |
speakerAllocation->SetRearCenter( ETrue );
|
|
4056 |
speakerAllocation->SetFrontLeftRightCenter( ETrue );
|
|
4057 |
speakerAllocation->SetRearLeftRightCenter( ETrue );
|
|
4058 |
speakerAllocation->SetFrontWideSpeakers( ETrue );
|
|
4059 |
speakerAllocation->SetFrontHighSpeakers( ETrue );
|
|
4060 |
aCon.AddL( *speakerAllocation );
|
|
4061 |
CleanupStack::PopAndDestroy( speakerAllocation );
|
|
4062 |
break;
|
|
4063 |
}
|
|
4064 |
case EAccPolHdmiVideoFormatObject:
|
|
4065 |
{
|
|
4066 |
CAccPolHdmiVideoFormat* videoFormat = CAccPolHdmiVideoFormat::NewLC();
|
|
4067 |
videoFormat->SetCeaFixedMode( E640x480p59_94d60Hz4d3 );
|
|
4068 |
videoFormat->SetDmtFixedMode( E640x480p85HzRB );
|
|
4069 |
videoFormat->SetInterlaced( EFalse );
|
|
4070 |
aCon.AddL( *videoFormat );
|
|
4071 |
CleanupStack::PopAndDestroy( videoFormat );
|
|
4072 |
break;
|
|
4073 |
}
|
|
4074 |
default:
|
|
4075 |
{
|
|
4076 |
break;
|
|
4077 |
}
|
|
4078 |
}
|
|
4079 |
}
|
|
4080 |
|
|
4081 |
|
|
4082 |
void CTFAccessoryTestControl::AccessoryConnectionOpenClose(TTFAccessoryFunction aCase, TInt* aRetval)
|
|
4083 |
{
|
|
4084 |
switch(aCase)
|
|
4085 |
{
|
|
4086 |
case ETFAccessoryConnection_Open:
|
|
4087 |
{
|
|
4088 |
if ( iAccessoryConnection == NULL )
|
|
4089 |
{
|
|
4090 |
iAccessoryConnection = new ( ELeave ) RAccessoryConnection;
|
|
4091 |
*aRetval = iAccessoryConnection->CreateSubSession( iAccessoryServer );
|
|
4092 |
COMPONENT_TRACE( ( _L( "CTFAccessoryTestControl::CallAccessoryFunctionL(TTFAccessoryTestCaseStateControl& aParameter) - ETFAccessoryConnection_Open - Sub session created - (%d)" ), *aRetval ) );
|
|
4093 |
}
|
|
4094 |
else
|
|
4095 |
{
|
|
4096 |
*aRetval = KErrNone;
|
|
4097 |
COMPONENT_TRACE( ( _L( "CTFAccessoryTestControl::CallAccessoryFunctionL(TTFAccessoryTestCaseStateControl& aParameter) - ETFAccessoryConnection_Open - Sub session not created - (%d)" ), *aRetval ) );
|
|
4098 |
}
|
|
4099 |
}
|
|
4100 |
break;
|
|
4101 |
|
|
4102 |
case ETFAccessoryConnection_Close:
|
|
4103 |
{
|
|
4104 |
TRACE_ASSERT( iAccessoryConnection != NULL );
|
|
4105 |
|
|
4106 |
if ( iAccessoryConnection != NULL )
|
|
4107 |
{
|
|
4108 |
iAccessoryConnection->CloseSubSession();
|
|
4109 |
delete iAccessoryConnection;
|
|
4110 |
iAccessoryConnection = NULL;
|
|
4111 |
COMPONENT_TRACE( ( _L( "CTFAccessoryTestControl::CallAccessoryFunctionL(TTFAccessoryTestCaseStateControl& aParameter) - ETFAccessoryConnection_Close - Sub session closed" ) ) );
|
|
4112 |
}
|
|
4113 |
*aRetval = KErrNone;
|
|
4114 |
}
|
|
4115 |
break;
|
|
4116 |
|
|
4117 |
default:
|
|
4118 |
break;
|
|
4119 |
}
|
|
4120 |
|
|
4121 |
}
|
|
4122 |
|
|
4123 |
void CTFAccessoryTestControl::FindAndCheckRequestL( TInt* aRetval, TTFAccessoryTestCaseStateControl& aParameter )
|
|
4124 |
{
|
|
4125 |
CTFAccessoryTestCaseControl* testCase = STATIC_CAST( CTFAccessoryTestCaseControl*, CurrentTestCase());
|
|
4126 |
TInt errVal = 0;
|
|
4127 |
|
|
4128 |
TRACE_ASSERT( testCase != NULL );
|
|
4129 |
if ( testCase != NULL )
|
|
4130 |
{
|
|
4131 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::FindAndCheckRequest() - inside if ( testCase != NULL )" ) ) );
|
|
4132 |
if(!iStack.IsEmpty())
|
|
4133 |
{
|
|
4134 |
iStackIter.SetToFirst();
|
|
4135 |
|
|
4136 |
while ( ( iObserverItem = iStackIter++ ) != NULL )
|
|
4137 |
{
|
|
4138 |
if(iObserverItem->FindRequest(aParameter.iRequestType))
|
|
4139 |
{
|
|
4140 |
testCase->CheckRequest( iObserverItem->iStatus,
|
|
4141 |
iObserverItem->iValue,
|
|
4142 |
iObserverItem->iCapabilityName,
|
|
4143 |
&errVal );
|
|
4144 |
|
|
4145 |
if(errVal == KTFDontDeleteObserver)
|
|
4146 |
{
|
|
4147 |
aParameter.iArg1 = KTFDontDeleteObserver;
|
|
4148 |
}
|
|
4149 |
|
|
4150 |
|
|
4151 |
if ( !iStack.IsEmpty() ) // Check if observes are already deleted by CheckRequest()
|
|
4152 |
{
|
|
4153 |
if( KTFDontDeleteObserver != aParameter.iArg1 )
|
|
4154 |
{
|
|
4155 |
if (iObserverItem->iStatus == KRequestPending )
|
|
4156 |
{
|
|
4157 |
User::WaitForRequest(iObserverItem->iStatus);
|
|
4158 |
}
|
|
4159 |
iStack.Remove( *iObserverItem );
|
|
4160 |
delete iObserverItem;
|
|
4161 |
}
|
|
4162 |
else
|
|
4163 |
{
|
|
4164 |
User::Leave( KTFDontDeleteObserver );
|
|
4165 |
}
|
|
4166 |
}
|
|
4167 |
else
|
|
4168 |
{
|
|
4169 |
*aRetval = KErrGeneral;
|
|
4170 |
}
|
|
4171 |
}
|
|
4172 |
}
|
|
4173 |
}
|
|
4174 |
else
|
|
4175 |
{
|
|
4176 |
*aRetval = KErrGeneral;
|
|
4177 |
}
|
|
4178 |
}
|
|
4179 |
|
|
4180 |
TEST_CASE_TRACE( ( _L( "CTFAccessoryTestControl::FindAndCheckRequest() returning and setting *aRetval = KErrNone )" ) ) );
|
|
4181 |
*aRetval = KErrNone;
|
|
4182 |
}
|
|
4183 |
|
|
4184 |
|
|
4185 |
void CTFAccessoryTestControl::AccessorySettingsOpenClose( TTFAccessoryFunction aCase, TInt* aRetval )
|
|
4186 |
{
|
|
4187 |
switch(aCase)
|
|
4188 |
{
|
|
4189 |
case ETFAccessorySettings_Open:
|
|
4190 |
{
|
|
4191 |
if ( iAccessorySettings == NULL )
|
|
4192 |
{
|
|
4193 |
iAccessorySettings = new ( ELeave ) RAccessorySettings;
|
|
4194 |
*aRetval = iAccessorySettings->CreateSubSession( iAccessoryServer );
|
|
4195 |
}
|
|
4196 |
else
|
|
4197 |
*aRetval = KErrNone;
|
|
4198 |
}
|
|
4199 |
break;
|
|
4200 |
|
|
4201 |
case ETFAccessorySettings_Close:
|
|
4202 |
{
|
|
4203 |
TRACE_ASSERT( iAccessorySettings != NULL );
|
|
4204 |
|
|
4205 |
if ( iAccessorySettings != NULL )
|
|
4206 |
{
|
|
4207 |
iAccessorySettings->CloseSubSession();
|
|
4208 |
delete iAccessorySettings;
|
|
4209 |
iAccessorySettings = NULL;
|
|
4210 |
}
|
|
4211 |
*aRetval = KErrNone;
|
|
4212 |
}
|
|
4213 |
break;
|
|
4214 |
|
|
4215 |
default:
|
|
4216 |
break;
|
|
4217 |
|
|
4218 |
}
|
|
4219 |
}
|
|
4220 |
|
|
4221 |
void CTFAccessoryTestControl::SetSeveralAccessoryModeSetting( TInt* aRetval )
|
|
4222 |
{
|
|
4223 |
TAccModeSetting accModeSettingIn;
|
|
4224 |
TAccMode tAccMode = EAccModeWirelessHeadset;
|
|
4225 |
TBuf< KMaxAccModeSetting > aDesIn;
|
|
4226 |
// Set
|
|
4227 |
// setting 1
|
|
4228 |
accModeSettingIn.SetId( 11 ); // unknown TInt
|
|
4229 |
accModeSettingIn.SetTInt( 1 );
|
|
4230 |
TAccModeSettingArray arrayIn;
|
|
4231 |
arrayIn.AddSetting( accModeSettingIn );
|
|
4232 |
|
|
4233 |
// setting 2
|
|
4234 |
accModeSettingIn.SetId( 12 ); // unknown Des
|
|
4235 |
_LIT( KAccSetting2, "012345678901234567890" );
|
|
4236 |
aDesIn.Copy( KAccSetting2 );
|
|
4237 |
accModeSettingIn.SetTDes( aDesIn );
|
|
4238 |
arrayIn.AddSetting( accModeSettingIn );
|
|
4239 |
|
|
4240 |
// setting 3
|
|
4241 |
accModeSettingIn.SetId( 13 ); // unknown TBool
|
|
4242 |
accModeSettingIn.SetTBool( ETrue );
|
|
4243 |
arrayIn.AddSetting( accModeSettingIn );
|
|
4244 |
|
|
4245 |
*aRetval = iAccessorySettings->SetAccessoryModeSettingsL( tAccMode, arrayIn );
|
|
4246 |
}
|
|
4247 |
|
|
4248 |
void CTFAccessoryTestControl::GetSeveralAccessoryModeSetting( TInt* aRetval )
|
|
4249 |
{
|
|
4250 |
TAccModeSetting accModeSettingOut;
|
|
4251 |
TAccMode tAccMode = EAccModeWirelessHeadset;
|
|
4252 |
TBuf< KMaxAccModeSetting > aDesOut;
|
|
4253 |
TAccModeSettingArray arrayOut;
|
|
4254 |
TInt intOut( 0 );
|
|
4255 |
// set input parameters for GetAccessoryModeSettings()
|
|
4256 |
// setting 11
|
|
4257 |
accModeSettingOut.SetId( 11 );
|
|
4258 |
arrayOut.AddSetting( accModeSettingOut );
|
|
4259 |
|
|
4260 |
// setting 12
|
|
4261 |
accModeSettingOut.SetId( 12 );
|
|
4262 |
arrayOut.AddSetting( accModeSettingOut );
|
|
4263 |
|
|
4264 |
// setting 13
|
|
4265 |
accModeSettingOut.SetId( 13 );
|
|
4266 |
arrayOut.AddSetting( accModeSettingOut );
|
|
4267 |
|
|
4268 |
*aRetval = iAccessorySettings->GetAccessoryModeSettings( tAccMode, arrayOut );
|
|
4269 |
|
|
4270 |
// Check that got settings are right
|
|
4271 |
|
|
4272 |
TInt count = arrayOut.GetArraySize();
|
|
4273 |
TInt foundCount(0);
|
|
4274 |
|
|
4275 |
for( TInt index = 0; index < count; index++ )
|
|
4276 |
{
|
|
4277 |
arrayOut.GetSetting( index, accModeSettingOut );
|
|
4278 |
|
|
4279 |
if( 11 == accModeSettingOut.Id() )
|
|
4280 |
{
|
|
4281 |
|
|
4282 |
accModeSettingOut.GetTInt( intOut);
|
|
4283 |
|
|
4284 |
if( 1 == intOut )
|
|
4285 |
{
|
|
4286 |
foundCount++;
|
|
4287 |
}
|
|
4288 |
}
|
|
4289 |
|
|
4290 |
|
|
4291 |
if( 12 == accModeSettingOut.Id() )
|
|
4292 |
{
|
|
4293 |
accModeSettingOut.GetTDes( aDesOut );
|
|
4294 |
|
|
4295 |
if( KErrNone == aDesOut.Compare( _L("012345678901234567890") ) )
|
|
4296 |
{
|
|
4297 |
foundCount++;
|
|
4298 |
}
|
|
4299 |
|
|
4300 |
}
|
|
4301 |
|
|
4302 |
if( 13 == accModeSettingOut.Id() )
|
|
4303 |
{
|
|
4304 |
|
|
4305 |
accModeSettingOut.GetTBool( intOut );
|
|
4306 |
|
|
4307 |
if( intOut )
|
|
4308 |
{
|
|
4309 |
foundCount++;
|
|
4310 |
}
|
|
4311 |
}
|
|
4312 |
}
|
|
4313 |
|
|
4314 |
if(foundCount != 3)
|
|
4315 |
{
|
|
4316 |
*aRetval = KErrNotFound;
|
|
4317 |
}
|
|
4318 |
|
|
4319 |
//
|
|
4320 |
// Reset Settings
|
|
4321 |
//
|
|
4322 |
TAccModeSetting accModeSettingIn;
|
|
4323 |
TBuf< KMaxAccModeSetting > aDesIn;
|
|
4324 |
// Set
|
|
4325 |
// setting 1
|
|
4326 |
accModeSettingIn.SetId( 11 ); // unknown TInt
|
|
4327 |
accModeSettingIn.SetTInt( 0 );
|
|
4328 |
TAccModeSettingArray arrayIn;
|
|
4329 |
arrayIn.AddSetting( accModeSettingIn );
|
|
4330 |
|
|
4331 |
// setting 2
|
|
4332 |
accModeSettingIn.SetId( 12 ); // unknown Des
|
|
4333 |
_LIT( KAccSetting2, "" );
|
|
4334 |
aDesIn.Copy( KAccSetting2 );
|
|
4335 |
accModeSettingIn.SetTDes( aDesIn );
|
|
4336 |
arrayIn.AddSetting( accModeSettingIn );
|
|
4337 |
|
|
4338 |
// setting 3
|
|
4339 |
accModeSettingIn.SetId( 13 ); // unknown TBool
|
|
4340 |
accModeSettingIn.SetTBool( EFalse );
|
|
4341 |
arrayIn.AddSetting( accModeSettingIn );
|
|
4342 |
|
|
4343 |
iAccessorySettings->SetAccessoryModeSettingsL( tAccMode, arrayIn );
|
|
4344 |
|
|
4345 |
}
|
|
4346 |
|
|
4347 |
void CTFAccessoryTestControl::SetIntValue( TTFAccessoryTestCaseStateControl& aParameter, TInt *aRetval )
|
|
4348 |
{
|
|
4349 |
switch( aParameter.iArg3 )
|
|
4350 |
{
|
|
4351 |
case KAccSetVolumeLevel:
|
|
4352 |
{
|
|
4353 |
//AccPolCommonNameValuePairs.h contains following example code
|
|
4354 |
RAccessoryControl accessoryControl;
|
|
4355 |
accessoryControl.CreateSubSession( iAccessoryServer );
|
|
4356 |
|
|
4357 |
CAccPolSubblockNameArray* nameArray = CAccPolSubblockNameArray::NewL();
|
|
4358 |
CleanupStack::PushL( nameArray );
|
|
4359 |
accessoryControl.GetSubblockNameArrayL( iGenericId[aParameter.iGid], *nameArray );
|
|
4360 |
|
|
4361 |
TAccPolNameRecord nameRecord;
|
|
4362 |
nameRecord.SetNameL( KAccSetVolumeLevel );
|
|
4363 |
TAccValueTypeTInt value;
|
|
4364 |
|
|
4365 |
if( nameArray->HasName( KAccSetVolumeLevel ) )
|
|
4366 |
{
|
|
4367 |
accessoryControl.GetValueL( iGenericId[aParameter.iGid], nameRecord, value );
|
|
4368 |
value.iValue = value.iValue | aParameter.iArg1;
|
|
4369 |
accessoryControl.AccessoryValueChangedNotifyL( iGenericId[aParameter.iGid], nameRecord, value );
|
|
4370 |
}
|
|
4371 |
|
|
4372 |
CleanupStack::PopAndDestroy( nameArray );
|
|
4373 |
accessoryControl.CloseSubSession();
|
|
4374 |
*aRetval = KErrNone;
|
|
4375 |
}
|
|
4376 |
break;
|
|
4377 |
|
|
4378 |
default:
|
|
4379 |
{
|
|
4380 |
TAccPolNameRecord aNameRecord;
|
|
4381 |
aNameRecord.SetNameL( aParameter.iArg3 );
|
|
4382 |
TAccValueTypeTInt aIntValue;
|
|
4383 |
aIntValue.iValue = aParameter.iArg1;
|
|
4384 |
*aRetval = iAccessoryControl->SetValueL( iGenericId[aParameter.iGid], aNameRecord, aIntValue );
|
|
4385 |
}
|
|
4386 |
break;
|
|
4387 |
}
|
|
4388 |
|
|
4389 |
}
|
|
4390 |
|
|
4391 |
void CTFAccessoryTestControl::SelectionDialog( TTFAccessoryFunction aCase, TInt* aRetval )
|
|
4392 |
{
|
|
4393 |
switch(aCase)
|
|
4394 |
{
|
|
4395 |
case ETFSelectionDialogText:
|
|
4396 |
{
|
|
4397 |
const TUid KAccFwUiDialogNotifierUid = { 0x10205062 };
|
|
4398 |
|
|
4399 |
RNotifier notifier;
|
|
4400 |
notifier.Connect();
|
|
4401 |
|
|
4402 |
TInt selectionListBitmask = 255;
|
|
4403 |
TInt reply = 0;
|
|
4404 |
|
|
4405 |
TPckg<TInt> replyPck( reply);
|
|
4406 |
TPckg<TUint32> selectionBitmaskPackage( selectionListBitmask);
|
|
4407 |
|
|
4408 |
//activate active object
|
|
4409 |
TRequestStatus status;
|
|
4410 |
status = KRequestPending;
|
|
4411 |
|
|
4412 |
//open ui
|
|
4413 |
notifier.StartNotifierAndGetResponse( status, KAccFwUiDialogNotifierUid, selectionBitmaskPackage, replyPck);
|
|
4414 |
|
|
4415 |
User::WaitForRequest( status);
|
|
4416 |
|
|
4417 |
|
|
4418 |
notifier.Close();
|
|
4419 |
|
|
4420 |
*aRetval = KErrNone;
|
|
4421 |
}
|
|
4422 |
|
|
4423 |
case ETFSelectionDialogCancel:
|
|
4424 |
{
|
|
4425 |
const TUid KAccFwUiDialogNotifierUid = { 0x10205062 };
|
|
4426 |
|
|
4427 |
RNotifier notifier;
|
|
4428 |
notifier.Connect();
|
|
4429 |
|
|
4430 |
TInt selectionListBitmask = 7;
|
|
4431 |
TInt reply = 0;
|
|
4432 |
|
|
4433 |
TPckg<TInt> replyPck( reply);
|
|
4434 |
TPckg<TUint32> selectionBitmaskPackage( selectionListBitmask);
|
|
4435 |
|
|
4436 |
//activate active object
|
|
4437 |
TRequestStatus status;
|
|
4438 |
|
|
4439 |
//open ui
|
|
4440 |
notifier.StartNotifierAndGetResponse( status, KAccFwUiDialogNotifierUid, selectionBitmaskPackage, replyPck);
|
|
4441 |
User::After( 2500000);
|
|
4442 |
notifier.CancelNotifier( KAccFwUiDialogNotifierUid);
|
|
4443 |
|
|
4444 |
// Implementation of the dialog is changed. Request is completed every time
|
|
4445 |
User::WaitForRequest( status );
|
|
4446 |
|
|
4447 |
notifier.Close();
|
|
4448 |
|
|
4449 |
*aRetval = KErrNone;
|
|
4450 |
}
|
|
4451 |
|
|
4452 |
default:
|
|
4453 |
break;
|
|
4454 |
|
|
4455 |
}
|
|
4456 |
|
|
4457 |
}
|
|
4458 |
|
|
4459 |
void CTFAccessoryTestControl::CheckConnectedAccessory( TInt* aRetval )
|
|
4460 |
{
|
|
4461 |
*aRetval = KErrNone;
|
|
4462 |
|
|
4463 |
TAccPolGenericID genID; // TGeneric ID that should be connected
|
|
4464 |
TAccPolGenericID genIDConnected; // TGeneric ID that is connected
|
|
4465 |
TAccPolGIDHeader iGenericIDHeader; // Header of the GID that should be connected
|
|
4466 |
TAccPolGIDHeader iGenericIDHeaderConnected; // Header of the connected GID
|
|
4467 |
TAccPolGenericIDArray genericIdArray; // Array of connected generic ID's
|
|
4468 |
CAccConGenericID* aGenericID = CAccConGenericID::NewL(); // This might be needed for capabilities
|
|
4469 |
|
|
4470 |
CleanupStack::PushL( aGenericID );
|
|
4471 |
CAccPolSubblockNameArray* nameArrayConnected = CAccPolSubblockNameArray::NewL();
|
|
4472 |
|
|
4473 |
CleanupStack::PushL( nameArrayConnected );
|
|
4474 |
|
|
4475 |
TAccPolGenericID genericID = aGenericID->GenericID();
|
|
4476 |
|
|
4477 |
TBuf<KHWModelIDMaxLength> hwModelID(_L("headset"));
|
|
4478 |
// Set GenericID header
|
|
4479 |
iGenericIDHeader.iAccessoryDeviceType = KDTHeadset;
|
|
4480 |
iGenericIDHeader.iPhysicalConnection = KPCWired;
|
|
4481 |
iGenericIDHeader.iApplicationProtocol = 0x0;
|
|
4482 |
|
|
4483 |
iGenericIDHeader.iCapabilitiesSubblocks = KSBAudioSubblock;
|
|
4484 |
|
|
4485 |
iGenericIDHeader.iHWModelID = hwModelID;
|
|
4486 |
iGenericIDHeader.iHWDeviceID = 0x0;
|
|
4487 |
iGenericIDHeader.iDBID = 0x0;
|
|
4488 |
|
|
4489 |
RAccessoryConnection* accessoryConnection = new ( ELeave ) RAccessoryConnection();
|
|
4490 |
CleanupStack::PushL( accessoryConnection );
|
|
4491 |
accessoryConnection->CreateSubSession( iAccessoryServer );
|
|
4492 |
accessoryConnection->GetAccessoryConnectionStatus( genericIdArray );
|
|
4493 |
CleanupStack::PopAndDestroy( accessoryConnection );
|
|
4494 |
|
|
4495 |
genIDConnected = genericIdArray.GetGenericIDL( 0 );
|
|
4496 |
|
|
4497 |
RAccessorySingleConnection singleConnect;// = new ( ELeave ) RAccessoryConnectionBase();
|
|
4498 |
singleConnect.CreateSubSession( iAccessoryServer );
|
|
4499 |
singleConnect.GetSubblockNameArrayL( genIDConnected, *nameArrayConnected );
|
|
4500 |
|
|
4501 |
singleConnect.CloseSubSession();
|
|
4502 |
|
|
4503 |
iGenericIDHeaderConnected.iAccessoryDeviceType = genIDConnected.DeviceTypeCaps();
|
|
4504 |
iGenericIDHeaderConnected.iPhysicalConnection = genIDConnected.PhysicalConnectionCaps();
|
|
4505 |
iGenericIDHeaderConnected.iApplicationProtocol = genIDConnected.ApplicationProtocolCaps();
|
|
4506 |
iGenericIDHeaderConnected.iCapabilitiesSubblocks = genIDConnected.SubblockCaps();
|
|
4507 |
iGenericIDHeaderConnected.iHWModelID = genIDConnected.HWModelID();
|
|
4508 |
iGenericIDHeaderConnected.iHWDeviceID = genIDConnected.HWDeviceID();
|
|
4509 |
iGenericIDHeaderConnected.iDBID = 0x0;
|
|
4510 |
|
|
4511 |
//Check GenericID header
|
|
4512 |
if( iGenericIDHeader.iAccessoryDeviceType != iGenericIDHeaderConnected.iAccessoryDeviceType )
|
|
4513 |
{
|
|
4514 |
*aRetval = EFalse;
|
|
4515 |
}
|
|
4516 |
if( iGenericIDHeader.iPhysicalConnection != iGenericIDHeaderConnected.iPhysicalConnection )
|
|
4517 |
{
|
|
4518 |
*aRetval = EFalse;
|
|
4519 |
}
|
|
4520 |
if( iGenericIDHeader.iApplicationProtocol != iGenericIDHeaderConnected.iApplicationProtocol )
|
|
4521 |
{
|
|
4522 |
*aRetval = EFalse;
|
|
4523 |
}
|
|
4524 |
if( iGenericIDHeader.iCapabilitiesSubblocks != iGenericIDHeaderConnected.iCapabilitiesSubblocks )
|
|
4525 |
{
|
|
4526 |
*aRetval = EFalse;
|
|
4527 |
}
|
|
4528 |
if( iGenericIDHeader.iHWModelID != iGenericIDHeaderConnected.iHWModelID )
|
|
4529 |
{
|
|
4530 |
*aRetval = EFalse;
|
|
4531 |
}
|
|
4532 |
if( iGenericIDHeader.iHWDeviceID != iGenericIDHeaderConnected.iHWDeviceID )
|
|
4533 |
{
|
|
4534 |
*aRetval = EFalse;
|
|
4535 |
}
|
|
4536 |
if( !( nameArrayConnected->HasName( KAccStereoAudio ) ) )
|
|
4537 |
{
|
|
4538 |
*aRetval = EFalse;
|
|
4539 |
}
|
|
4540 |
|
|
4541 |
if( !( nameArrayConnected->HasName( KAccAudioOutConnector ) ) )
|
|
4542 |
{
|
|
4543 |
*aRetval = EFalse;
|
|
4544 |
}
|
|
4545 |
|
|
4546 |
if( !( nameArrayConnected->HasName( KAccAudioOutputType ) ) )
|
|
4547 |
{
|
|
4548 |
*aRetval = EFalse;
|
|
4549 |
}
|
|
4550 |
//CleanupStack::PopAndDestroy( nameValueArray );
|
|
4551 |
CleanupStack::PopAndDestroy( nameArrayConnected );
|
|
4552 |
CleanupStack::PopAndDestroy( aGenericID );
|
|
4553 |
|
|
4554 |
}
|
|
4555 |
|
|
4556 |
|
|
4557 |
void CTFAccessoryTestControl::CallTClassMethods( TInt* aRetval )
|
|
4558 |
{
|
|
4559 |
// Settings();
|
|
4560 |
Policy();
|
|
4561 |
*aRetval = KErrNone;
|
|
4562 |
}
|
|
4563 |
|
|
4564 |
void CTFAccessoryTestControl::Settings()
|
|
4565 |
{
|
|
4566 |
TAccModeSettingArray array;
|
|
4567 |
array.Reset();
|
|
4568 |
TInt ret = array.GetMaxArraySize();
|
|
4569 |
TAccModeSetting setting;
|
|
4570 |
TUint32 settingId( 1 );
|
|
4571 |
setting.SetId( settingId );
|
|
4572 |
array.AddSetting( setting );
|
|
4573 |
TAccModeSetting setting2;
|
|
4574 |
ret = array.GetSetting( 0, setting2 );
|
|
4575 |
ret = array.GetArraySize();
|
|
4576 |
}
|
|
4577 |
|
|
4578 |
void CTFAccessoryTestControl::Policy()
|
|
4579 |
{
|
|
4580 |
TInt valueInt( 1 );
|
|
4581 |
TUint32 valueUInt( 1 );
|
|
4582 |
TDesC8 des( _L8( "timo" ) );
|
|
4583 |
//TDes8 valueDesc = des;
|
|
4584 |
TAccPolNameRecord nameRecord;
|
|
4585 |
TAccPolValueRecord valRec( des, EAPVPolicy );
|
|
4586 |
TAccPolNameValueRecord nameValRec;
|
|
4587 |
TAccPolNameValueRecord nameValRec1( nameRecord, valRec );
|
|
4588 |
TAccPolNameValueRecord nameValRec2( valueUInt, valueInt, EAPVInt, EAPVPolicy );
|
|
4589 |
TAccPolNameValueRecord nameValRec3( valueUInt, des, EAPVPolicy );
|
|
4590 |
TAccPolNameValueRecord nameValRec4( valueUInt );
|
|
4591 |
//TDesC8 valueToGet;
|
|
4592 |
valRec.GetValueL( des );
|
|
4593 |
valRec.SetValue( des );
|
|
4594 |
//valRec.SetValue( valueToGet );
|
|
4595 |
TAccPolValueRecord valRec1( valueInt, EAPVInt, EAPVPolicy );
|
|
4596 |
valRec1.SetValue( valueInt );
|
|
4597 |
valRec1.SetLocation( EAPVPolicy );
|
|
4598 |
valRec1.SetL( valueInt, EAPVInt, EAPVPolicy );
|
|
4599 |
}
|
|
4600 |
|
|
4601 |
void CTFAccessoryTestControl::GetBoolAccessoryModeSetting( TTFAccessoryTestCaseStateControl& aParameter, TInt* aRetval )
|
|
4602 |
{
|
|
4603 |
TBool aSettingsValueBool;
|
|
4604 |
|
|
4605 |
TAccMode aAccMode = (TAccMode)aParameter.iArg1;
|
|
4606 |
TAccModeSetting aSetting;
|
|
4607 |
aSetting.SetId(aParameter.iArg2);
|
|
4608 |
|
|
4609 |
*aRetval = iAccessorySettings->GetAccessoryModeSetting(aAccMode, aSetting);
|
|
4610 |
|
|
4611 |
if( aSetting.Type() == EAccModeSettingBool)
|
|
4612 |
{
|
|
4613 |
*aRetval = aSetting.GetTBool(aSettingsValueBool);
|
|
4614 |
|
|
4615 |
if(*aRetval != KErrNotFound)
|
|
4616 |
{
|
|
4617 |
if(aSettingsValueBool == (TBool)aParameter.iArg4)
|
|
4618 |
{
|
|
4619 |
*aRetval = KErrNone;
|
|
4620 |
}
|
|
4621 |
else
|
|
4622 |
{
|
|
4623 |
*aRetval = KErrArgument;
|
|
4624 |
}
|
|
4625 |
}
|
|
4626 |
}
|
|
4627 |
else
|
|
4628 |
{
|
|
4629 |
*aRetval = KErrNotFound;
|
|
4630 |
}
|
|
4631 |
}
|
|
4632 |
|
|
4633 |
void CTFAccessoryTestControl::GetIntAccessoryModeSetting( TTFAccessoryTestCaseStateControl& aParameter, TInt* aRetval )
|
|
4634 |
{
|
|
4635 |
TInt aSettingsValueInt;
|
|
4636 |
|
|
4637 |
TAccMode aAccMode = (TAccMode)aParameter.iArg1;
|
|
4638 |
TAccModeSetting aSetting;
|
|
4639 |
aSetting.SetId(aParameter.iArg2);
|
|
4640 |
|
|
4641 |
*aRetval = iAccessorySettings->GetAccessoryModeSetting(aAccMode, aSetting);
|
|
4642 |
|
|
4643 |
if(aSetting.Type() == EAccModeSettingInt)
|
|
4644 |
{
|
|
4645 |
*aRetval = aSetting.GetTInt(aSettingsValueInt);
|
|
4646 |
|
|
4647 |
if(*aRetval != KErrNotFound)
|
|
4648 |
{
|
|
4649 |
if( aSettingsValueInt == aParameter.iArg4 )
|
|
4650 |
{
|
|
4651 |
*aRetval = KErrNone;
|
|
4652 |
}
|
|
4653 |
else
|
|
4654 |
{
|
|
4655 |
*aRetval = KErrArgument;
|
|
4656 |
}
|
|
4657 |
}
|
|
4658 |
}
|
|
4659 |
else
|
|
4660 |
{
|
|
4661 |
*aRetval = KErrNotFound;
|
|
4662 |
}
|
|
4663 |
}
|
|
4664 |
|
|
4665 |
void CTFAccessoryTestControl::GetDesAccessoryModeSetting( TTFAccessoryTestCaseStateControl& aParameter, TInt* aRetval )
|
|
4666 |
{
|
|
4667 |
TBuf<KMaxAccModeSetting> aSettingsValueDes;
|
|
4668 |
|
|
4669 |
TAccMode aAccMode = (TAccMode)aParameter.iArg1;
|
|
4670 |
TAccModeSetting aSetting;
|
|
4671 |
aSetting.SetId( aParameter.iArg2 );
|
|
4672 |
|
|
4673 |
*aRetval = iAccessorySettings->GetAccessoryModeSetting( aAccMode, aSetting );
|
|
4674 |
|
|
4675 |
if( aSetting.Type() == EAccModeSettingDes )
|
|
4676 |
{
|
|
4677 |
*aRetval = aSetting.GetTDes( aSettingsValueDes );
|
|
4678 |
|
|
4679 |
if(*aRetval != KErrNotFound)
|
|
4680 |
{
|
|
4681 |
TBuf<KMaxAccModeSetting> buffer;
|
|
4682 |
buffer.Num( aParameter.iArg3 );
|
|
4683 |
if( KErrNone == aSettingsValueDes.Compare( buffer ) )
|
|
4684 |
{
|
|
4685 |
*aRetval = KErrNone;
|
|
4686 |
}
|
|
4687 |
else
|
|
4688 |
{
|
|
4689 |
*aRetval = KErrArgument;
|
|
4690 |
}
|
|
4691 |
}
|
|
4692 |
}
|
|
4693 |
else
|
|
4694 |
{
|
|
4695 |
*aRetval = KErrNotFound;
|
|
4696 |
}
|
|
4697 |
}
|
|
4698 |
|
|
4699 |
// End of file
|