|
1 /* |
|
2 * Copyright (c) 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: Definition of the class CPbkxRclEventScheduler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBKXRCLEVENTSCHEDULER_H |
|
20 #define CPBKXRCLEVENTSCHEDULER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 /** |
|
25 * Class that is notified when event is triggered. |
|
26 * |
|
27 * @lib pbkxrclengine.lib |
|
28 * @since 3.1 |
|
29 */ |
|
30 class MPbkxRclEventHandler |
|
31 { |
|
32 public: |
|
33 |
|
34 /** |
|
35 * This method is called when event is triggered. |
|
36 */ |
|
37 virtual void EventTriggered() = 0; |
|
38 |
|
39 }; |
|
40 |
|
41 /** |
|
42 * Class that generates events with a little delay. |
|
43 * |
|
44 * @lib pbkxrclengine.lib |
|
45 * @since 3.1 |
|
46 */ |
|
47 class CPbkxRclEventScheduler : public CActive |
|
48 { |
|
49 |
|
50 public: // constructor and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 * |
|
55 * @param aHandler Interface which is notified when event is triggered. |
|
56 * @return Created object. |
|
57 */ |
|
58 static CPbkxRclEventScheduler* NewL( MPbkxRclEventHandler& aHandler ); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 virtual ~CPbkxRclEventScheduler(); |
|
64 |
|
65 public: // new methods |
|
66 |
|
67 /** |
|
68 * Triggers event with a little delay. |
|
69 */ |
|
70 void TriggerEvent(); |
|
71 |
|
72 protected: // from CActive |
|
73 |
|
74 /** |
|
75 * Handles asynchronous request. |
|
76 */ |
|
77 virtual void RunL(); |
|
78 |
|
79 /** |
|
80 * Cancels asynchronous request. |
|
81 */ |
|
82 virtual void DoCancel(); |
|
83 |
|
84 private: // constructors |
|
85 |
|
86 /** |
|
87 * Constructor. |
|
88 * |
|
89 * @param aHandler Interface which is notified when event is triggered. |
|
90 */ |
|
91 CPbkxRclEventScheduler( MPbkxRclEventHandler& aHandler ); |
|
92 |
|
93 /** |
|
94 * Second-phase constructor. |
|
95 */ |
|
96 void ConstructL(); |
|
97 |
|
98 private: // data |
|
99 |
|
100 // Handles triggered event. |
|
101 MPbkxRclEventHandler& iEventHandler; |
|
102 |
|
103 // Timer for creating a little delays in triggering events. |
|
104 RTimer iTimer; |
|
105 |
|
106 }; |
|
107 |
|
108 #endif |