77
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: The test application to issue audio property with specified sid.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// Include Files
|
|
19 |
|
|
20 |
#include "ut_atspaudioproperty.h"
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <e32std.h>
|
|
23 |
#include <e32cons.h> // Console
|
|
24 |
|
|
25 |
#include <e32property.h>
|
|
26 |
#include <AudioClientsListPSKeys.h>
|
|
27 |
|
|
28 |
// Constants
|
|
29 |
|
|
30 |
_LIT(KTextConsoleTitle, "Console");
|
|
31 |
_LIT(KTextFailed, " failed, leave code = %d");
|
|
32 |
|
|
33 |
// Global Variables
|
|
34 |
|
|
35 |
LOCAL_D CConsoleBase* console; // write all messages to this
|
|
36 |
|
|
37 |
|
|
38 |
// Local Functions
|
|
39 |
|
|
40 |
LOCAL_C void MainL()
|
|
41 |
{
|
|
42 |
RProperty myProperty;
|
|
43 |
CleanupClosePushL(myProperty);
|
|
44 |
// The value of the property
|
|
45 |
TUint16 array[4] = {10,20,30,40};
|
|
46 |
TBuf16<10> buf;
|
|
47 |
buf.Copy(&array[0],sizeof(array));
|
|
48 |
|
|
49 |
// Attach and set the property
|
|
50 |
User::LeaveIfError(myProperty.Attach(KPSUidMMFAudioServer, KAudioPolicyApplicationAudioStatePlaying, EOwnerThread));
|
|
51 |
User::LeaveIfError(myProperty.Set(buf));
|
|
52 |
|
|
53 |
// CLose the property
|
|
54 |
CleanupStack::PopAndDestroy();
|
|
55 |
}
|
|
56 |
|
|
57 |
LOCAL_C void DoStartL()
|
|
58 |
{
|
|
59 |
// Create active scheduler (to run active objects)
|
|
60 |
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
|
|
61 |
CleanupStack::PushL(scheduler);
|
|
62 |
CActiveScheduler::Install(scheduler);
|
|
63 |
|
|
64 |
MainL();
|
|
65 |
|
|
66 |
// Delete active scheduler
|
|
67 |
CleanupStack::PopAndDestroy(scheduler);
|
|
68 |
}
|
|
69 |
|
|
70 |
// Global Functions
|
|
71 |
|
|
72 |
GLDEF_C TInt E32Main()
|
|
73 |
{
|
|
74 |
// Create cleanup stack
|
|
75 |
__UHEAP_MARK;
|
|
76 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
|
77 |
|
|
78 |
// Create output console
|
|
79 |
TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(
|
|
80 |
KConsFullScreen, KConsFullScreen)));
|
|
81 |
if (createError)
|
|
82 |
{
|
|
83 |
delete cleanup;
|
|
84 |
return createError;
|
|
85 |
}
|
|
86 |
|
|
87 |
// Run application code inside TRAP harness, wait keypress when terminated
|
|
88 |
TRAPD(mainError, DoStartL());
|
|
89 |
if (mainError)
|
|
90 |
console->Printf(KTextFailed, mainError);
|
|
91 |
|
|
92 |
delete console;
|
|
93 |
delete cleanup;
|
|
94 |
__UHEAP_MARKEND;
|
|
95 |
return KErrNone;
|
|
96 |
}
|
|
97 |
|