1 /* |
|
2 * Copyright (c) 2006 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 the License "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: Semaphore controller. Checks once a while if given semaphore is* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CCSESEMAPHORECONTROLLER_H |
|
21 #define __CCSESEMAPHORECONTROLLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 // CONSTANTS |
|
27 // None. |
|
28 |
|
29 // MACROS |
|
30 // None. |
|
31 |
|
32 // DATA TYPES |
|
33 // None |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 // None. |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 // None |
|
40 |
|
41 // CLASS DECLARATION |
|
42 class RSemaphore; |
|
43 class MCseSemaphoreSignalObserver; |
|
44 |
|
45 /** |
|
46 * CCseSemaphoreController |
|
47 * |
|
48 * @lib |
|
49 */ |
|
50 class CCseSemaphoreController : public CTimer |
|
51 { |
|
52 public: // Constructors and destructors |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 virtual ~CCseSemaphoreController(); |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 * @param aSemaphore Semaphore to be followed. |
|
61 * @param aObserver A pointer back to server engine through observer. |
|
62 */ |
|
63 static CCseSemaphoreController* NewL( RSemaphore& aSemaphore, |
|
64 MCseSemaphoreSignalObserver& aObserver ); |
|
65 |
|
66 /** |
|
67 * Starts checking if semaphore is signalled. Default interval is 5000ms. |
|
68 */ |
|
69 void Start( ); |
|
70 |
|
71 /** |
|
72 * Stops checking semaphore. |
|
73 */ |
|
74 void Stop( ); |
|
75 |
|
76 private: // Constructors and destructors |
|
77 /** |
|
78 * By default Symbian 2nd phase constructor is private. |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 /** |
|
83 * C++ default constructor. |
|
84 * @param aSemaphore Semaphore to be followed. |
|
85 * @param aObserver A pointer back to server engine through observer. |
|
86 */ |
|
87 CCseSemaphoreController( RSemaphore& aSemaphore, |
|
88 MCseSemaphoreSignalObserver& aObserver ); |
|
89 |
|
90 private: // Functions from base classes |
|
91 /** |
|
92 * RunL |
|
93 * @return None |
|
94 */ |
|
95 void RunL(); |
|
96 |
|
97 /** |
|
98 * Sets new interval how often semaphore signal is checked. Doesn't restart |
|
99 * checking automatically. |
|
100 * @param aInterval Interval how often semaphore signal is checked in milliseconds. |
|
101 */ |
|
102 void SetInterval( TUint aInterval ); |
|
103 |
|
104 private: // data |
|
105 |
|
106 /** |
|
107 * Semaphore under observation. |
|
108 */ |
|
109 RSemaphore& iSemaphore; |
|
110 |
|
111 /** |
|
112 * Reference to observer. |
|
113 */ |
|
114 MCseSemaphoreSignalObserver& iObserver; |
|
115 |
|
116 /** |
|
117 * Interval how often semaphore signal is checked in milliseconds. |
|
118 * Default is 5000 ms. |
|
119 */ |
|
120 TUint iInterval; |
|
121 }; |
|
122 |
|
123 |
|
124 #endif // __CCSESEMAPHORECONTROLLER_H |
|