|
45
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2002 - 2007 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: Test sounds_api
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
// [INCLUDE FILES]
|
|
|
20 |
#include <e32svr.h>
|
|
|
21 |
#include <stifparser.h>
|
|
|
22 |
#include <stiftestinterface.h>
|
|
|
23 |
|
|
|
24 |
#include <aknsoundsystem.h>
|
|
|
25 |
#include <aknsoundinfo.h>
|
|
|
26 |
#include <avkon.hrh>
|
|
|
27 |
#include <testsdksounds.rsg>
|
|
|
28 |
|
|
|
29 |
#include "testsdksounds.h"
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
const TInt KKeySoundUid = 100;
|
|
|
33 |
const TInt KResourceId = 10;
|
|
|
34 |
const TInt KSid = 20;
|
|
|
35 |
|
|
|
36 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
|
37 |
// -----------------------------------------------------------------------------
|
|
|
38 |
// CTestSDKSounds::TestSSNewL
|
|
|
39 |
// -----------------------------------------------------------------------------
|
|
|
40 |
//
|
|
|
41 |
TInt CTestSDKSounds::TestSSNewL( CStifItemParser& /*aItem*/ )
|
|
|
42 |
{
|
|
|
43 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
44 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
45 |
STIF_ASSERT_NOT_NULL( aknsoundsystem );
|
|
|
46 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
47 |
return KErrNone;
|
|
|
48 |
}
|
|
|
49 |
// -----------------------------------------------------------------------------
|
|
|
50 |
// CTestSDKSounds::TestSSPushContextL
|
|
|
51 |
// -----------------------------------------------------------------------------
|
|
|
52 |
//
|
|
|
53 |
TInt CTestSDKSounds::TestSSPushContextL( CStifItemParser& /*aItem*/ )
|
|
|
54 |
{
|
|
|
55 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
56 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
57 |
aknsoundsystem->PushContextL( R_SKEY_LIST );
|
|
|
58 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
59 |
return KErrNone;
|
|
|
60 |
}
|
|
|
61 |
// -----------------------------------------------------------------------------
|
|
|
62 |
// CTestSDKSounds::TestSSPopContext
|
|
|
63 |
// -----------------------------------------------------------------------------
|
|
|
64 |
//
|
|
|
65 |
|
|
|
66 |
TInt CTestSDKSounds::TestSSPopContextL( CStifItemParser& /*aItem*/ )
|
|
|
67 |
{
|
|
|
68 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
69 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
70 |
aknsoundsystem->PushContextL(KResourceId);
|
|
|
71 |
aknsoundsystem->PopContext();
|
|
|
72 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
73 |
return KErrNone;
|
|
|
74 |
}
|
|
|
75 |
// -----------------------------------------------------------------------------
|
|
|
76 |
// CTestSDKSounds::TestSSPlaySoundWithTKeyEvent
|
|
|
77 |
// -----------------------------------------------------------------------------
|
|
|
78 |
//
|
|
|
79 |
|
|
|
80 |
TInt CTestSDKSounds::TestSSPlaySoundWithTKeyEventL( CStifItemParser& /*aItem*/ )
|
|
|
81 |
{
|
|
|
82 |
CAknKeySoundSystem* aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
83 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
84 |
TKeyEvent keyevent;
|
|
|
85 |
aknsoundsystem->PlaySound( keyevent );
|
|
|
86 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
87 |
return KErrNone;
|
|
|
88 |
}
|
|
|
89 |
// -----------------------------------------------------------------------------
|
|
|
90 |
// CTestSDKSounds::TestSSPlaySoundWithTInt
|
|
|
91 |
// -----------------------------------------------------------------------------
|
|
|
92 |
//
|
|
|
93 |
|
|
|
94 |
TInt CTestSDKSounds::TestSSPlaySoundWithTIntL( CStifItemParser& /*aItem*/ )
|
|
|
95 |
{
|
|
|
96 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
97 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
98 |
aknsoundsystem->PlaySound( KSid );
|
|
|
99 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
100 |
return KErrNone;
|
|
|
101 |
}
|
|
|
102 |
// -----------------------------------------------------------------------------
|
|
|
103 |
// CTestSDKSounds::TestSSAddAppSoundInfoListL
|
|
|
104 |
// -----------------------------------------------------------------------------
|
|
|
105 |
//
|
|
|
106 |
|
|
|
107 |
TInt CTestSDKSounds::TestSSAddAppSoundInfoListL( CStifItemParser& /*aItem*/ )
|
|
|
108 |
{
|
|
|
109 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
110 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
111 |
aknsoundsystem->AddAppSoundInfoListL( R_TESTSOUNDSINFO_LIST );
|
|
|
112 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
113 |
return KErrNone;
|
|
|
114 |
}
|
|
|
115 |
// -----------------------------------------------------------------------------
|
|
|
116 |
// CTestSDKSounds::TestSSBringToForeground
|
|
|
117 |
// -----------------------------------------------------------------------------
|
|
|
118 |
//
|
|
|
119 |
|
|
|
120 |
TInt CTestSDKSounds::TestSSBringToForegroundL( CStifItemParser& /*aItem*/ )
|
|
|
121 |
{
|
|
|
122 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
123 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
124 |
aknsoundsystem->BringToForeground();
|
|
|
125 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
126 |
return KErrNone;
|
|
|
127 |
}
|
|
|
128 |
// -----------------------------------------------------------------------------
|
|
|
129 |
// CTestSDKSounds::TestSSStopSound
|
|
|
130 |
// -----------------------------------------------------------------------------
|
|
|
131 |
//
|
|
|
132 |
|
|
|
133 |
TInt CTestSDKSounds::TestSSStopSoundL( CStifItemParser& /*aItem*/ )
|
|
|
134 |
{
|
|
|
135 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
136 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
137 |
aknsoundsystem->StopSound( KSid );
|
|
|
138 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
139 |
return KErrNone;
|
|
|
140 |
}
|
|
|
141 |
// -----------------------------------------------------------------------------
|
|
|
142 |
// CTestSDKSounds::TestSSLockContext
|
|
|
143 |
// -----------------------------------------------------------------------------
|
|
|
144 |
//
|
|
|
145 |
|
|
|
146 |
TInt CTestSDKSounds::TestSSLockContextL( CStifItemParser& /*aItem*/ )
|
|
|
147 |
{
|
|
|
148 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
149 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
150 |
aknsoundsystem->LockContext();
|
|
|
151 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
152 |
return KErrNone;
|
|
|
153 |
}
|
|
|
154 |
// -----------------------------------------------------------------------------
|
|
|
155 |
// CTestSDKSounds::TestSSReleaseContext
|
|
|
156 |
// -----------------------------------------------------------------------------
|
|
|
157 |
//
|
|
|
158 |
|
|
|
159 |
TInt CTestSDKSounds::TestSSReleaseContextL( CStifItemParser& /*aItem*/ )
|
|
|
160 |
{
|
|
|
161 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
162 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
163 |
aknsoundsystem->LockContext();
|
|
|
164 |
aknsoundsystem->ReleaseContext();
|
|
|
165 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
166 |
return KErrNone;
|
|
|
167 |
}
|
|
|
168 |
// -----------------------------------------------------------------------------
|
|
|
169 |
// CTestSDKSounds::TestSSRequestSoundInfoL
|
|
|
170 |
// -----------------------------------------------------------------------------
|
|
|
171 |
//
|
|
|
172 |
|
|
|
173 |
TInt CTestSDKSounds::TestSSRequestSoundInfoL( CStifItemParser& /*aItem*/ )
|
|
|
174 |
{
|
|
|
175 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
176 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
177 |
CAknSoundInfo *aknsoundinfo = CAknSoundInfo::NewL();
|
|
|
178 |
CleanupStack::PushL( aknsoundinfo );
|
|
|
179 |
TInt sInfo = aknsoundsystem->RequestSoundInfoL( EAvkonSIDDefaultSound,
|
|
|
180 |
*aknsoundinfo );
|
|
|
181 |
CleanupStack::PopAndDestroy( aknsoundinfo );
|
|
|
182 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
183 |
return KErrNone;
|
|
|
184 |
}
|
|
|
185 |
// -----------------------------------------------------------------------------
|
|
|
186 |
// CTestSDKSounds::TestSSTopContext
|
|
|
187 |
// -----------------------------------------------------------------------------
|
|
|
188 |
//
|
|
|
189 |
|
|
|
190 |
TInt CTestSDKSounds::TestSSTopContextL( CStifItemParser& /*aItem*/ )
|
|
|
191 |
{
|
|
|
192 |
CAknKeySoundSystem *aknsoundsystem = CAknKeySoundSystem::NewL( KKeySoundUid );
|
|
|
193 |
CleanupStack::PushL( aknsoundsystem );
|
|
|
194 |
aknsoundsystem->TopContext();
|
|
|
195 |
CleanupStack::PopAndDestroy( aknsoundsystem );
|
|
|
196 |
return KErrNone;
|
|
|
197 |
}
|
|
|
198 |
|
|
|
199 |
// End of file
|
|
|
200 |
|
|
|
201 |
|