|
1 /* |
|
2 * Copyright (c) 2005 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: Operation handler for performing respond publish. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CPEngReactAuthPublishOp.h" |
|
21 #include "CPEngNWSessionSlotStorageProxy.h" |
|
22 #include "MPEngAdvTransactionStatus2.h" |
|
23 |
|
24 #include <CPEngReactAuthTransaction.h> |
|
25 #include <MPEngReactAuthTransactionObserver.h> |
|
26 #include "PEngListLibraryFactory.h" |
|
27 #include "MPEngAuthorizationManager.h" |
|
28 #include "MPEngAuthorizationRespond.h" |
|
29 |
|
30 |
|
31 |
|
32 // ================= MEMBER FUNCTIONS ======================= |
|
33 |
|
34 // Two-phased constructor. |
|
35 CPEngReactAuthPublishOp* CPEngReactAuthPublishOp::NewL( TInt aPriority, |
|
36 CPEngReactAuthTransaction& aInterface, |
|
37 CPEngNWSessionSlotStorageProxy& aUsedSlot, |
|
38 MPEngReactAuthTransactionObserver& aObserver, |
|
39 RPEngManagerClient& aServer, |
|
40 MPEngAuthorizationRespond* aResponds ) |
|
41 { |
|
42 CPEngReactAuthPublishOp* self = new ( ELeave ) CPEngReactAuthPublishOp( aPriority, |
|
43 aInterface, |
|
44 aObserver, |
|
45 aServer ); |
|
46 |
|
47 CleanupStack::PushL( self ); |
|
48 self->ConstructL( aUsedSlot, aResponds ); |
|
49 CleanupStack::Pop(); |
|
50 |
|
51 return self; |
|
52 } |
|
53 |
|
54 |
|
55 // Destructor |
|
56 CPEngReactAuthPublishOp::~CPEngReactAuthPublishOp() |
|
57 { |
|
58 CActive::Cancel(); |
|
59 CleanResponds(); |
|
60 if ( iAuthManager ) |
|
61 { |
|
62 iAuthManager->Close(); |
|
63 } |
|
64 } |
|
65 |
|
66 |
|
67 // C++ default constructor can NOT contain any code, that |
|
68 // might leave. |
|
69 // |
|
70 CPEngReactAuthPublishOp::CPEngReactAuthPublishOp( TInt aPriority, |
|
71 CPEngReactAuthTransaction& aInterface, |
|
72 MPEngReactAuthTransactionObserver& aObserver, |
|
73 RPEngManagerClient& aServer ) |
|
74 : CPEngAsyncOperation( aPriority, aServer ), |
|
75 iInterface( aInterface ), |
|
76 iObserver( aObserver ) |
|
77 { |
|
78 } |
|
79 |
|
80 |
|
81 |
|
82 // EPOC default constructor can leave. |
|
83 void CPEngReactAuthPublishOp::ConstructL( CPEngNWSessionSlotStorageProxy& aUsedSlot, |
|
84 MPEngAuthorizationRespond* aResponds ) |
|
85 { |
|
86 __ASSERT_ALWAYS( aResponds, User::Leave( KErrArgument ) ); |
|
87 |
|
88 BaseConstructL( aUsedSlot ); // CSI: 9 # |
|
89 iAuthManager = PEngListLibraryFactory::AuthorizationManagerL( aUsedSlot.BaseId() ); |
|
90 iResponds = aResponds; |
|
91 |
|
92 //Pack the publish request |
|
93 HBufC16* data = iAuthManager->BufferedTransactionsLC(); |
|
94 InitTransaction( data, EPEngTransOpAuthorizationResponse ); |
|
95 CleanupStack::Pop( data ); |
|
96 } |
|
97 |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CPEngReactAuthPublishOp::PublishResponds() |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CPEngReactAuthPublishOp::PublishResponds() |
|
104 { |
|
105 iRespondsOwned = ETrue; |
|
106 IssueTransaction(); |
|
107 } |
|
108 |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CPEngReactAuthPublishOp::DoHandleOpSuccessL() |
|
112 // ----------------------------------------------------------------------------- |
|
113 void CPEngReactAuthPublishOp::DoHandleOpSuccessL( |
|
114 MPEngAdvTransactionStatus2& /*aStatus*/, |
|
115 TInt /*aTransactionOperation*/ ) |
|
116 |
|
117 { |
|
118 //Release the holded respond |
|
119 //Delete frees the lock also |
|
120 CleanResponds(); |
|
121 } |
|
122 |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CPEngReactAuthPublishOp::DoHandleOpFailure() |
|
126 // ----------------------------------------------------------------------------- |
|
127 void CPEngReactAuthPublishOp::DoHandleOpFailure( |
|
128 MPEngAdvTransactionStatus2& /*aStatus*/, |
|
129 TInt /*aTransactionOperation*/ ) |
|
130 { |
|
131 //Release the holded respond |
|
132 //Delete frees the lock also |
|
133 CleanResponds(); |
|
134 } |
|
135 |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CPEngReactAuthPublishOp::DoNotifyObserver() |
|
139 // ----------------------------------------------------------------------------- |
|
140 TPEngAsyncOpResult CPEngReactAuthPublishOp::DoNotifyObserver( |
|
141 MPEngAdvTransactionStatus2& aStatus, |
|
142 TInt aTransactionOperation ) |
|
143 { |
|
144 TRAPD( err, iObserver.HandleReactAuthTransactionCompleteL( |
|
145 aStatus, |
|
146 iInterface, |
|
147 aTransactionOperation ) ); |
|
148 if ( err != KErrNone ) |
|
149 { |
|
150 iObserver.HandleReactAuthTransactionError( err, |
|
151 iInterface, |
|
152 aTransactionOperation ); |
|
153 } |
|
154 |
|
155 |
|
156 return EPEngAsyncOpCompleted; |
|
157 } |
|
158 |
|
159 |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CPEngReactAuthPublishOp::CleanResponds() |
|
163 // ----------------------------------------------------------------------------- |
|
164 void CPEngReactAuthPublishOp::CleanResponds() |
|
165 { |
|
166 if ( iRespondsOwned ) |
|
167 { |
|
168 delete iResponds; |
|
169 iResponds = NULL; |
|
170 } |
|
171 } |
|
172 |
|
173 |
|
174 //End of file |
|
175 |
|
176 |