|
1 /* |
|
2 * Copyright (c) 2008-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: Class for Analog Dialer example application, which |
|
15 * implements long lasting tactile feed back event |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef ANALOGDIALER_FEEDBACK_H |
|
22 #define ANALOGDIALER_FEEDBACK_H |
|
23 |
|
24 #include <e32std.h> |
|
25 |
|
26 // Forward reference |
|
27 class MTouchFeedback; |
|
28 class CPeriodic; |
|
29 |
|
30 // default time values for playing tactile feedback |
|
31 const TInt KFeedbackDefault = 0; |
|
32 |
|
33 /** |
|
34 * Class for giving physical feedback about events in the analog dialer |
|
35 * |
|
36 * @since S60 5.0 |
|
37 */ |
|
38 class CAlfExAnalogDialerFeedback : public CBase |
|
39 { |
|
40 public: |
|
41 |
|
42 |
|
43 /* Constructors and destructor. */ |
|
44 |
|
45 /** |
|
46 * First phase construction of CAlfExAnalogDialerFeedback. |
|
47 * |
|
48 * @since S60 5.0 |
|
49 */ |
|
50 static CAlfExAnalogDialerFeedback* NewL(); |
|
51 |
|
52 /** |
|
53 * Destructor of CAlfExAnalogDialerFeedback |
|
54 * Destroy the object and release all memory objects |
|
55 * |
|
56 * @since S60 5.0 |
|
57 */ |
|
58 virtual ~CAlfExAnalogDialerFeedback(); |
|
59 |
|
60 |
|
61 /* Methods. */ |
|
62 |
|
63 /** |
|
64 * Starts tactile feedback which lasts for given time |
|
65 * |
|
66 * @param aDuration total duration of tactile feedback. |
|
67 * KFeedbackDefaultInterval: feedback is given once only |
|
68 * @param aInterval interval, when feed back is restarted |
|
69 * KFeedbackDefaultInterval: continuos feedback is given. |
|
70 * if aDuration == KFeedbackDefaultInterval, this parameter |
|
71 * is ignored. |
|
72 * |
|
73 * @since S60 5.0 |
|
74 */ |
|
75 void Start( TInt aDurationMilliSeconds = KFeedbackDefault, |
|
76 TInt aIntervalMilliSeconds = KFeedbackDefault); |
|
77 |
|
78 /** |
|
79 * Stops tactile feedback immediately |
|
80 * |
|
81 * @since S60 5.0 |
|
82 */ |
|
83 void Stop(); |
|
84 |
|
85 private: |
|
86 |
|
87 |
|
88 /* Constructors */ |
|
89 |
|
90 /** |
|
91 * Constructor of CAlfExAnalogDialerFeedback |
|
92 * @since S60 5.0 |
|
93 */ |
|
94 CAlfExAnalogDialerFeedback(); |
|
95 |
|
96 /** |
|
97 * Second phase construction of CAlfExAnalogDialerFeedback. |
|
98 * Private as this object must be constructed via NewL() or NewLC() |
|
99 * |
|
100 * @since S60 5.0 |
|
101 */ |
|
102 void ConstructL(); |
|
103 |
|
104 |
|
105 /* Methods. */ |
|
106 |
|
107 /** |
|
108 * Handles elapsed interval of feedback clock |
|
109 * |
|
110 * @since S60 5.0 |
|
111 */ |
|
112 void DoHandleInterval(); |
|
113 |
|
114 /** |
|
115 * TCallBack function. Handles elapsed interval of feedback clock. |
|
116 * Required by CPeriodic. |
|
117 * |
|
118 * @return Returns value forced by TCallBack |
|
119 * @since S60 5.0 |
|
120 */ |
|
121 static TInt HandleInterval(TAny* aThis); |
|
122 |
|
123 private: |
|
124 |
|
125 /* Member data. */ |
|
126 |
|
127 /** |
|
128 * Tactile feedback object |
|
129 * Not own. |
|
130 */ |
|
131 MTouchFeedback* iFeedback; |
|
132 |
|
133 /** |
|
134 * Class for implementing continuous feedback effect |
|
135 * Own. |
|
136 */ |
|
137 CPeriodic* iClock; |
|
138 |
|
139 /** |
|
140 * time for duration of current feedback |
|
141 */ |
|
142 TInt iDuration; |
|
143 |
|
144 /** |
|
145 * interval of current feedback |
|
146 */ |
|
147 TInt iInterval; |
|
148 |
|
149 /** |
|
150 * Clock time when feedback stops |
|
151 */ |
|
152 TTime iDurationStop; |
|
153 |
|
154 }; |
|
155 |
|
156 |
|
157 #endif // ANALOGDIALER_FEEDBACK_H |
|
158 |