|
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 "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: Declaration of the COsmDelay class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef Hb0ac1e7a851b4571bffbc4428f4401f4 |
|
20 #define Hb0ac1e7a851b4571bffbc4428f4401f4 |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 /** |
|
25 * Utility for creating delays and timer callbacks. |
|
26 * When a delay or timer callback is active, the thread is not stopped |
|
27 * and active scheduler events occur normally. |
|
28 */ |
|
29 class COsmDelay : public CTimer |
|
30 { |
|
31 public: |
|
32 |
|
33 /** |
|
34 * Constructor. |
|
35 * |
|
36 * @param aCallBack Function that gets called after the timer goes off. |
|
37 * @return COsmDelay* Pointer to the created COsmDelay object. |
|
38 */ |
|
39 static COsmDelay* COsmDelay::NewL( TCallBack aCallBack ); |
|
40 |
|
41 /** |
|
42 * Creates a delay of a specified time using CActiveScheduler |
|
43 * Start()-Stop() sequence. |
|
44 * @param aTime Time in microseconds to wait. |
|
45 */ |
|
46 static void SynchronousWaitL( TInt aTime ); |
|
47 |
|
48 /** |
|
49 * Small wait of 1/100 sec. |
|
50 */ |
|
51 static void SmallWaitL(); |
|
52 |
|
53 /** |
|
54 * Small wait of 1/100 sec. Non-leavable version. |
|
55 * @return Error code |
|
56 */ |
|
57 static TInt SmallWait(); |
|
58 |
|
59 private: |
|
60 |
|
61 /** |
|
62 * Constructor. |
|
63 * |
|
64 * @param aCallBack Function that gets called after timer goes off. |
|
65 */ |
|
66 COsmDelay( TCallBack aCallBack ); |
|
67 |
|
68 /** |
|
69 * @see CActive::RunL() |
|
70 */ |
|
71 void RunL(); |
|
72 |
|
73 private: |
|
74 /** |
|
75 * Callback function |
|
76 */ |
|
77 TCallBack iCallBack; |
|
78 }; |
|
79 |
|
80 #endif // Hb0ac1e7a851b4571bffbc4428f4401f4 |