|
1 /* |
|
2 * Copyright (c) 2008 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: Interface class for tactile feedback players. |
|
15 * Part of: Tactile Feedback. |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "tactileplayer.h" |
|
20 |
|
21 const TUid KTactilePlayerIFUid = {0x2001CBA7}; |
|
22 |
|
23 _LIT8( KTactileHaptics, "Haptics" ); |
|
24 _LIT8( KTactileAudio, "Audio" ); |
|
25 |
|
26 // ======== LOCAL FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // Constructor. |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CTactilePlayer* CTactilePlayer::NewL( TUid aImplementationUid, |
|
33 CRepository& aRepository ) |
|
34 { |
|
35 return static_cast<CTactilePlayer*> ( REComSession::CreateImplementationL( |
|
36 aImplementationUid, |
|
37 _FOFF(CTactilePlayer, iDtor_ID_Key ), |
|
38 &aRepository ) ); |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // Lists the available plugin implementations for this interface. |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 void CTactilePlayer::ListImplementationsL( TTactilePlayerType aType, |
|
46 RImplInfoPtrArray& aImplInfoArray ) |
|
47 { |
|
48 if ( aType == ETactilePlayerAny ) |
|
49 { |
|
50 REComSession::ListImplementationsL( KTactilePlayerIFUid, |
|
51 aImplInfoArray ); |
|
52 } |
|
53 else |
|
54 { |
|
55 RImplInfoPtrArray implInfoArray; |
|
56 CleanupClosePushL( implInfoArray ); |
|
57 REComSession::ListImplementationsL( KTactilePlayerIFUid, |
|
58 implInfoArray ); |
|
59 for( TInt i(0) ; i < implInfoArray.Count() ; i++ ) |
|
60 { |
|
61 switch( aType ) |
|
62 { |
|
63 case ETactilePlayerHaptics: |
|
64 if ( !implInfoArray[i]->DataType().Compare( KTactileHaptics ) ) |
|
65 { |
|
66 aImplInfoArray.AppendL( implInfoArray[i] ); |
|
67 } |
|
68 break; |
|
69 case ETactilePlayerAudio: |
|
70 if ( !implInfoArray[i]->DataType().Compare( KTactileAudio ) ) |
|
71 { |
|
72 aImplInfoArray.AppendL( implInfoArray[i] ); |
|
73 } |
|
74 break; |
|
75 default: |
|
76 break; |
|
77 } |
|
78 } |
|
79 CleanupStack::PopAndDestroy( &implInfoArray ); |
|
80 } |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // Destructor. |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 EXPORT_C CTactilePlayer::~CTactilePlayer() |
|
88 { |
|
89 REComSession::DestroyedImplementation( iDtor_ID_Key ); |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // Start feedback. |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 EXPORT_C TInt CTactilePlayer::StartFeedback( TTouchContinuousFeedback /*aFeedback*/, |
|
97 TInt /*aIntensity*/ ) |
|
98 { |
|
99 // Empty implementation for plugins, which don't support |
|
100 // continuous feedback. |
|
101 return KErrNotSupported; |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // Modify feedback. |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 EXPORT_C TInt CTactilePlayer::ModifyFeedback( TInt /*aIntensity*/ ) |
|
109 { |
|
110 // Empty implementation for plugins, which don't support |
|
111 // continuous feedback. |
|
112 return KErrNotSupported; |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // Stop feedback. |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 EXPORT_C void CTactilePlayer::StopFeedback() |
|
120 { |
|
121 // Empty implementation for plugins, which don't support |
|
122 // continuous feedback. |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // Maximum level. |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 EXPORT_C TInt CTactilePlayer::MaxLevel() |
|
130 { |
|
131 // Default implementation returns 1 as maximum level, which means that |
|
132 // player has only one level. |
|
133 return 1; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // Play preview. |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C TInt CTactilePlayer::PlayPreviewFeedback( TInt /*aLevel*/, |
|
141 TTouchLogicalFeedback /*aFeedback*/ ) |
|
142 { |
|
143 return KErrNotSupported; |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // Start preview. |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C TInt CTactilePlayer::StartPreviewFeedback( TInt /*aLevel*/, |
|
151 TTouchContinuousFeedback /*aFeedback*/, |
|
152 TInt /*aIntensity*/ ) |
|
153 { |
|
154 return KErrNotSupported; |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // Stop preview. |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 EXPORT_C void CTactilePlayer::StopPreviewFeedback() |
|
162 { |
|
163 } |