|
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: Converts asynchronous operation to synchronous |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPHCNTASYNCTOSYNC_H |
|
20 #define CPHCNTASYNCTOSYNC_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 /** |
|
25 * Converts asynchronous operation to synchronous |
|
26 * |
|
27 * @lib PhoneCntFinder |
|
28 * @since S60 v3.1 |
|
29 */ |
|
30 NONSHARABLE_CLASS( CPhCntAsyncToSync ) : public CBase |
|
31 { |
|
32 protected: |
|
33 |
|
34 /** |
|
35 * Converts asynchronous call from DoMakeAsyncRequestL to synchronous. |
|
36 * Derived class has to implement the DoMakeAsyncRequestL method and make |
|
37 * asynchronous call from there. |
|
38 * |
|
39 * @since S60 v3.1 |
|
40 */ |
|
41 TInt MakeAsyncRequest(); |
|
42 |
|
43 /** |
|
44 * Indication that asynchronous call from DoMakeAsyncRequestL has |
|
45 * completed. Derived class has to call this method, |
|
46 * when the asynchronous request completes. |
|
47 * |
|
48 * @since S60 v3.1 |
|
49 * @param Error code of the response. |
|
50 */ |
|
51 virtual void ResponseReceived( TInt aErrorCode ); |
|
52 |
|
53 /** |
|
54 * Checks if there are pending asynchronous requests available. |
|
55 * |
|
56 * @since S60 v5.0 |
|
57 */ |
|
58 TBool IsActive(); |
|
59 |
|
60 CPhCntAsyncToSync(); |
|
61 |
|
62 void BaseConstructL(); |
|
63 |
|
64 virtual ~CPhCntAsyncToSync(); |
|
65 |
|
66 /** |
|
67 * Template method, which derived class has to implement. This is the |
|
68 * place to make the asynchronous call, which is converted to synchronous. |
|
69 * |
|
70 * @since S60 v3.1 |
|
71 */ |
|
72 virtual void DoMakeAsyncRequestL() = 0; |
|
73 |
|
74 private: // data |
|
75 |
|
76 /** |
|
77 * To make asynchronous operation synchronous |
|
78 * Own. |
|
79 */ |
|
80 CActiveSchedulerWait* iWait; |
|
81 |
|
82 /** |
|
83 * Indication of response received from the async request. |
|
84 */ |
|
85 TBool iResponseReceived; |
|
86 |
|
87 /** |
|
88 * Error code from response. |
|
89 */ |
|
90 TInt iResponseError; |
|
91 }; |
|
92 |
|
93 |
|
94 #endif // CPHCNTASYNCTOSYNC_H |