|
1 /* |
|
2 * Copyright (c) 2007-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 header for CWsfActiveWaiter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_WSFACTIVEWAITER_H |
|
20 #define C_WSFACTIVEWAITER_H |
|
21 |
|
22 // EXTERNAL INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 |
|
26 // CLASS DEFINITION |
|
27 /** |
|
28 * CWsfActiveWaiter class, |
|
29 * an active object to replace User::WaitForRequest() |
|
30 * |
|
31 * Usage: |
|
32 * @code |
|
33 * CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL(); |
|
34 * CleanupStack::PushL( waiter ); |
|
35 * server.AsyncFunction( waiter->iStatus ); |
|
36 * if ( waiter->WaitForRequest() == KErrNone ) |
|
37 * { |
|
38 * // handle success |
|
39 * } |
|
40 * else |
|
41 * { |
|
42 * // handle failure |
|
43 * } |
|
44 * CleanupStack::PopAndDestroy( waiter ); |
|
45 * @endcode |
|
46 * |
|
47 * @lib wsfserver.exe |
|
48 * @since S60 5.0 |
|
49 */ |
|
50 NONSHARABLE_CLASS( CWsfActiveWaiter ): public CActive |
|
51 { |
|
52 public: |
|
53 /** |
|
54 * Factory function |
|
55 * @since S60 5.0 |
|
56 * @return CWsfActiveWaiter instance. |
|
57 */ |
|
58 static CWsfActiveWaiter* NewL(); |
|
59 |
|
60 /** |
|
61 * Factory function |
|
62 * @since S60 5.0 |
|
63 * @return CWsfActiveWaiter instance. |
|
64 */ |
|
65 static CWsfActiveWaiter* NewLC(); |
|
66 |
|
67 /** |
|
68 * Destructor |
|
69 * @since S60 5.0 |
|
70 */ |
|
71 virtual ~CWsfActiveWaiter(); |
|
72 |
|
73 protected: |
|
74 /** |
|
75 * Constructor |
|
76 * @since S60 5.0 |
|
77 */ |
|
78 CWsfActiveWaiter(); |
|
79 |
|
80 protected: // from CActive |
|
81 |
|
82 /** |
|
83 * Implements cancellation of an outstanding request. |
|
84 * @since S60 5.0 |
|
85 */ |
|
86 void DoCancel(); |
|
87 |
|
88 /** |
|
89 * Handles an active object's request completion event. |
|
90 * @since S60 5.0 |
|
91 */ |
|
92 void RunL(); |
|
93 |
|
94 public: // new methods |
|
95 /** |
|
96 * Waits for its TRequestStatus to be completed |
|
97 * @since S60 5.0 |
|
98 * @return Error code returned from server after request is completed |
|
99 */ |
|
100 TInt WaitForRequest(); |
|
101 |
|
102 protected: // data |
|
103 /** |
|
104 * Nested waitloop |
|
105 */ |
|
106 CActiveSchedulerWait iWait; |
|
107 }; |
|
108 |
|
109 #endif // C_WSFACTIVEWAITER_H |
|
110 |
|
111 // End of file |