|
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: NWSessionOperation base class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPENGNWSESSIONOPERATION_H |
|
19 #define CPENGNWSESSIONOPERATION_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <E32Base.h> |
|
23 |
|
24 |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MPEngNWSessionOperationOwner; |
|
28 class CPEngNWSessionSlot2; |
|
29 class MPEngNWSessionOperationObserver2; |
|
30 class CPEngNWSessionSlotID2; |
|
31 class CPEngTransactionStatus; |
|
32 class CPEngNWSessionProxy; |
|
33 |
|
34 |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * NWSessionOperation base class. |
|
40 * |
|
41 * Provides: |
|
42 * - adding to scheduler |
|
43 * - protection against nested canceling |
|
44 * - operation owning services |
|
45 * |
|
46 * @lib |
|
47 * @since 3.0 |
|
48 */ |
|
49 NONSHARABLE_CLASS( CPEngNWSessionOperation ) : public CActive |
|
50 { |
|
51 public: // destructor |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 virtual ~CPEngNWSessionOperation(); |
|
57 |
|
58 protected: //Constructor |
|
59 |
|
60 /** |
|
61 * Constructor. |
|
62 */ |
|
63 CPEngNWSessionOperation( TInt aPriority, |
|
64 CPEngNWSessionProxy& aNWSessionProxy, |
|
65 CPEngNWSessionSlot2& aInterface, |
|
66 MPEngNWSessionOperationObserver2& aObserver ); |
|
67 |
|
68 /** |
|
69 * Symbian OS base class constructor. |
|
70 */ |
|
71 void BaseConstructL(); |
|
72 |
|
73 |
|
74 public: // New external services |
|
75 |
|
76 /** |
|
77 * Sets the operation owner. |
|
78 * Owner can be set just once. |
|
79 */ |
|
80 void SetOwner( MPEngNWSessionOperationOwner& aOperationOwner ); |
|
81 |
|
82 /** |
|
83 * Cancels the operation if operation active |
|
84 * and not yet cancelled. |
|
85 * |
|
86 * Deletes also the operation object. |
|
87 */ |
|
88 void CancelOpD(); |
|
89 |
|
90 |
|
91 protected: // Services for derived implementations |
|
92 |
|
93 |
|
94 /** |
|
95 * |
|
96 */ |
|
97 void HandleOperationIssued( TInt aError, TInt aNWSessionSlotOp ); |
|
98 |
|
99 /** |
|
100 * |
|
101 */ |
|
102 void NotifyObserverFromCancel(); |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 protected: // Template methods for derived implementations |
|
108 |
|
109 /** |
|
110 * Notifies derived implementation from |
|
111 * operation complete or failure with error. |
|
112 */ |
|
113 virtual void DoHandleOpCompleted( TInt aError ) = 0; |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 private: // Implementation |
|
119 |
|
120 void RunL(); |
|
121 TInt RunError( TInt aError ); |
|
122 //DoCancel() is implemented by the derived classes |
|
123 |
|
124 |
|
125 protected: // Data |
|
126 |
|
127 //REF: |
|
128 CPEngNWSessionProxy& iNWSessionProxy; |
|
129 |
|
130 |
|
131 |
|
132 private: // Data |
|
133 |
|
134 //REF: The implemented interface |
|
135 CPEngNWSessionSlot2& iInterface; |
|
136 |
|
137 //REF: The observer |
|
138 MPEngNWSessionOperationObserver2& iObserver; |
|
139 |
|
140 //OWN: Is cancel call running? |
|
141 TBool iCancelling; |
|
142 |
|
143 //REF: Operation owner |
|
144 MPEngNWSessionOperationOwner* iOperationOwner; |
|
145 |
|
146 //OWN: Transaction status container for result |
|
147 CPEngTransactionStatus* iTransactionStatus; |
|
148 |
|
149 //OWN: Session Slot operation identifier |
|
150 TInt iNWSessionSlotOp; |
|
151 }; |
|
152 |
|
153 |
|
154 #endif //CPENGNWSESSIONOPERATION_H |