|
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: Header of tactile feedback server. |
|
15 * Part of: Tactile Feedback. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_TACTILEFEEDBACKSRV_H |
|
21 #define C_TACTILEFEEDBACKSRV_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 |
|
26 #include "tactilefeedbackresolver.h" |
|
27 #include "tactilefeedbackdefs.h" |
|
28 |
|
29 // Total number of ranges |
|
30 const TUint KTactileFeedbackRangeCount = 1; |
|
31 |
|
32 // Definition of the ranges of IPC numbers |
|
33 const TInt KTactileFeedbackRanges[KTactileFeedbackRangeCount] = |
|
34 { |
|
35 0, |
|
36 }; |
|
37 |
|
38 // Policy to implement for each of the above ranges |
|
39 const TUint8 KTactileFeedbackElementsIndex[KTactileFeedbackRangeCount] = |
|
40 { |
|
41 0, |
|
42 }; |
|
43 |
|
44 const CPolicyServer::TPolicyElement KTactileFeedbackPolicyElements[] = |
|
45 { |
|
46 { _INIT_SECURITY_POLICY_C2(ECapability_None, |
|
47 ECapability_None), |
|
48 CPolicyServer::EFailClient } |
|
49 }; |
|
50 |
|
51 // Package all the above together into a policy |
|
52 const CPolicyServer::TPolicy KTactileFeedbackPolicy = |
|
53 { |
|
54 CPolicyServer::EAlwaysPass, // all attempts should pass |
|
55 KTactileFeedbackRangeCount, // number of ranges |
|
56 KTactileFeedbackRanges, // ranges array |
|
57 KTactileFeedbackElementsIndex, // elements<->ranges index |
|
58 KTactileFeedbackPolicyElements, // array of elements |
|
59 }; |
|
60 |
|
61 /** |
|
62 * Tactile feedback server. |
|
63 * |
|
64 * @since S60 5.2 |
|
65 */ |
|
66 class CTactileFeedbackSrv : public CPolicyServer |
|
67 { |
|
68 public: |
|
69 /** |
|
70 * 2-phased constructor. |
|
71 * |
|
72 * @since S60 5.2 |
|
73 * @return Instance of CTactileFeedbackSrv. |
|
74 */ |
|
75 static CTactileFeedbackSrv* NewL(); |
|
76 |
|
77 /** |
|
78 * C++ destructor. |
|
79 */ |
|
80 virtual ~CTactileFeedbackSrv(); |
|
81 |
|
82 public: |
|
83 // from base class CServer2. |
|
84 /** |
|
85 * From CServer2, creates a new session. |
|
86 */ |
|
87 CSession2* NewSessionL( const TVersion& aVersion, |
|
88 const RMessage2& aMessage ) const; |
|
89 |
|
90 /** |
|
91 * Increase session count. |
|
92 * |
|
93 * @since S60 5.2 |
|
94 */ |
|
95 void AddSession(); |
|
96 |
|
97 /** |
|
98 * Decrease session count, close server if count is zero. |
|
99 * |
|
100 * @since S60 5.2 |
|
101 */ |
|
102 void RemoveSession(); |
|
103 |
|
104 public: |
|
105 /** |
|
106 * Play feedback. |
|
107 * |
|
108 * @since S60 5.2 |
|
109 * @param aFeedback - Logical feedback type. |
|
110 * @param aPlayHaptics - Boolean value, which indicates if haptics |
|
111 * feedback is played. |
|
112 * @param aPlayAudio - Boolean value, which indicates if audio |
|
113 * feedback is played. |
|
114 */ |
|
115 void PlayFeedback( TTouchLogicalFeedback aFeedback, |
|
116 TBool aPlayHaptics, |
|
117 TBool aPlayAudio ); |
|
118 |
|
119 /** |
|
120 * Start continuous feedback. |
|
121 * |
|
122 * @since S60 5.2 |
|
123 * @param aType - Type of continuous feedback. |
|
124 * @param aIntensity - Intensity of continuous feedback. |
|
125 */ |
|
126 void StartFeedback( TTouchContinuousFeedback aType, |
|
127 TInt aIntensity ); |
|
128 |
|
129 /** |
|
130 * Modify continuous feedback. |
|
131 * |
|
132 * @since S60 5.2 |
|
133 * @param aIntensity - Intensity of continuous feedback. |
|
134 */ |
|
135 void ModifyFeedback( TInt aIntensity ); |
|
136 |
|
137 /** |
|
138 * Stop continuous feedback. |
|
139 */ |
|
140 void StopFeedback(); |
|
141 |
|
142 /** |
|
143 * Set feedback enabled/disabled for the device. |
|
144 * |
|
145 * @since S60 5.2 |
|
146 * @param aFeedbackType - Bitmask, which tells which feedback types |
|
147 * are enabled/disabled. |
|
148 */ |
|
149 void EnableFeedbackForDevice( TTouchFeedbackType aFeedbackType ); |
|
150 |
|
151 /** |
|
152 * Get a bitmask of feedback type, which indicates what feedback types |
|
153 * are enabled/disabled in the device. |
|
154 * |
|
155 * @since S60 5.2 |
|
156 * @return Bitmask, which contains currently enabled feedback types. |
|
157 */ |
|
158 TTouchFeedbackType FeedbackEnabledForDevice(); |
|
159 |
|
160 /** |
|
161 * Play preview feedback. |
|
162 * |
|
163 * @since S60 5.2 |
|
164 * @param aLevel - Level value defines the strength of playing |
|
165 * effect. Maximum level value is player dependent. |
|
166 * @param aFeedback - Logical feedback type. |
|
167 * @param aType - Type of feedback to be previewed. |
|
168 */ |
|
169 void PlayPreviewFeedback( TInt aLevel, |
|
170 TTouchLogicalFeedback aFeedback, |
|
171 TTouchFeedbackType aType ); |
|
172 |
|
173 /** |
|
174 * Start preview of continuous feedback. |
|
175 * |
|
176 * @since S60 5.2 |
|
177 * @param aLevel - Level value defines the strength of playing |
|
178 * effect. Maximum level value is player dependent. |
|
179 * @param aFeedback - Type of continuous feedback to be played. |
|
180 * @param aIntensity - Intensity of continuous feedback. Value |
|
181 * range for intensity is 0-100% from basic |
|
182 * strength (aLevel). |
|
183 * @param aType - Type of feedback to be previewed. |
|
184 */ |
|
185 void StartPreviewFeedback( TInt aLevel, |
|
186 TTouchContinuousFeedback aFeedback, |
|
187 TInt aIntensity, |
|
188 TTouchFeedbackType aType ); |
|
189 |
|
190 /** |
|
191 * Stop preview of continuous feedback. |
|
192 * |
|
193 * @since S60 5.2 |
|
194 */ |
|
195 void StopPreviewFeedback(); |
|
196 |
|
197 private: |
|
198 /** |
|
199 * C++ constructor. |
|
200 */ |
|
201 CTactileFeedbackSrv(); |
|
202 |
|
203 /** |
|
204 * 2nd phase constructor. |
|
205 */ |
|
206 void ConstructL(); |
|
207 |
|
208 private: // data |
|
209 /** |
|
210 * Instance of tactile feedback resolver. |
|
211 * Own. |
|
212 */ |
|
213 CTactileFeedbackResolver* iResolver; |
|
214 |
|
215 /** |
|
216 * Count of open sessions. |
|
217 */ |
|
218 TInt iSessionCount; |
|
219 |
|
220 /** |
|
221 * A bitmap, which contains information of currently enabled/disabled |
|
222 * feedback types. |
|
223 */ |
|
224 TInt iDeviceFeedbackEnabled; |
|
225 }; |
|
226 |
|
227 |
|
228 #endif // C_TACTILEFEEDBACKSRV_H |
|
229 |
|
230 // End of file. |