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