|
1 /* |
|
2 * Copyright (c) 2004 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: Async to sync. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CASYNC2SYNC_H |
|
19 #define __CASYNC2SYNC_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 |
|
24 |
|
25 // CLASS DECLARATION |
|
26 |
|
27 /** |
|
28 * Synchronizes asynchronous operation. |
|
29 * |
|
30 * @since 3.0 |
|
31 */ |
|
32 NONSHARABLE_CLASS( CAsync2Sync ) : public CActive |
|
33 { |
|
34 public: // Symbian OS constructor and destructor |
|
35 |
|
36 /** |
|
37 * C++ default constructor. |
|
38 */ |
|
39 static CAsync2Sync* NewLC(); |
|
40 |
|
41 |
|
42 /** |
|
43 * Destructor. |
|
44 */ |
|
45 virtual ~CAsync2Sync(); |
|
46 |
|
47 |
|
48 private: // Constructor |
|
49 |
|
50 /** |
|
51 * C++ default constructor. |
|
52 */ |
|
53 CAsync2Sync(); |
|
54 |
|
55 |
|
56 public: //New |
|
57 |
|
58 /** |
|
59 * Prepares the wait object for the new wait round. |
|
60 * Sets the internal request status to KErrNone state. |
|
61 * |
|
62 * @since 3.0 |
|
63 */ |
|
64 void Prepare(); |
|
65 |
|
66 |
|
67 /** |
|
68 * Waits the issued request to complete. |
|
69 * |
|
70 * If owned request status isn't pending, |
|
71 * returns directly. Else returns after |
|
72 * request complete. |
|
73 * |
|
74 * @since 3.0 |
|
75 */ |
|
76 void WaitToComplete(); |
|
77 |
|
78 |
|
79 /** |
|
80 * Gets the active object request status. |
|
81 * |
|
82 * @since 3.0 |
|
83 * @return Active object request status. |
|
84 */ |
|
85 TRequestStatus& RequestStatus(); |
|
86 |
|
87 |
|
88 |
|
89 private: //From CActive |
|
90 |
|
91 void RunL(); |
|
92 TInt RunError( TInt aError ); |
|
93 void DoCancel(); |
|
94 |
|
95 |
|
96 private: //data |
|
97 |
|
98 //OWN: Active Scheduler wait |
|
99 CActiveSchedulerWait iWait; |
|
100 }; |
|
101 |
|
102 #endif // __CASYNC2SYNC_H |
|
103 |
|
104 |
|
105 // End of File |
|
106 |