|
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: Handler to get watcher list. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "CPEngGetWatchersTransaction.h" |
|
20 |
|
21 #include "CPEngWatcherList.h" |
|
22 #include "CPEngContactListModItemContainer.h" |
|
23 #include "CPEngContactListModChangeMonitor.h" |
|
24 |
|
25 #include "PEngListLibTools.h" |
|
26 #include "MPEngXMLSerializer.h" |
|
27 #include "MPEngXMLParser.h" |
|
28 |
|
29 #include "CPEngTransactionStatus.h" |
|
30 #include "PEngWVPresenceErrors2.h" |
|
31 #include "PresenceDebugPrint.h" |
|
32 |
|
33 |
|
34 // ============================ MEMBER FUNCTIONS =============================== |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CPEngGetWatchersTransaction::CPEngGetWatchersTransaction() |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CPEngGetWatchersTransaction::CPEngGetWatchersTransaction( |
|
41 CPEngContactListModBase& aWatchers, |
|
42 TPEngWVCspVersion& aCSPVersion, |
|
43 TInt aOperationId ) |
|
44 : iIsTransactionCompleted( EFalse ), |
|
45 iWatchers( aWatchers ), |
|
46 iCSPVersion( aCSPVersion ), |
|
47 iOperationId( aOperationId ) |
|
48 { |
|
49 PENG_DP( D_PENG_LIT( "CPEngGetWatchersTransaction::CPEngGetWatchersTransaction()" ) ); |
|
50 |
|
51 iWatchers.Open(); // CSI: 65 # |
|
52 iWatchers.BufferServerSideNotifications(); |
|
53 iWatchers.Lock( EStorageLockLevelHigh ); |
|
54 } |
|
55 |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CPEngGetWatchersTransaction::ConstructL() |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 void CPEngGetWatchersTransaction::ConstructL() |
|
62 { |
|
63 iTransactionStatus = CPEngTransactionStatus::NewL(); |
|
64 iIsTransactionCompleted = EFalse; |
|
65 } |
|
66 |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CPEngGetWatchersTransaction::NewLC() |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CPEngGetWatchersTransaction* CPEngGetWatchersTransaction::NewLC( |
|
73 CPEngContactListModBase& aWatchers, |
|
74 TPEngWVCspVersion& aCSPVersion, |
|
75 TInt aOperationId ) |
|
76 { |
|
77 CPEngGetWatchersTransaction* self = |
|
78 new ( ELeave ) CPEngGetWatchersTransaction( |
|
79 aWatchers, |
|
80 aCSPVersion, |
|
81 aOperationId ); |
|
82 |
|
83 CleanupStack::PushL( self ); |
|
84 self->ConstructL( ); |
|
85 |
|
86 return self; |
|
87 } |
|
88 |
|
89 |
|
90 // Destructor |
|
91 CPEngGetWatchersTransaction::~CPEngGetWatchersTransaction() |
|
92 { |
|
93 iWatchers.ReleaseServerSideBuffering(); |
|
94 iWatchers.Unlock(); |
|
95 iWatchers.Close(); |
|
96 delete iTransactionStatus; |
|
97 } |
|
98 |
|
99 |
|
100 // =========================================================================== |
|
101 // ============Function from MPEngOutgoingTransactionHandler ================= |
|
102 // =========================================================================== |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CPEngGetWatchersTransaction::RequestL() |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 void CPEngGetWatchersTransaction::RequestL( |
|
109 TDes8& aSendBuffer ) |
|
110 { |
|
111 aSendBuffer.Zero(); |
|
112 MPEngXMLSerializer* xmlSerializer = CreateXmlSerializerL( aSendBuffer ); |
|
113 CleanupClosePushL( *xmlSerializer ); |
|
114 |
|
115 // <TransactionContent xmlns="http://www.wireless -village.org/TRC1.1"> |
|
116 NListLibTools::AppendTransactionContentTagXmlL( *xmlSerializer, iCSPVersion ); |
|
117 |
|
118 // <GetWatcherList-Request/> |
|
119 xmlSerializer->StartTagL( KGetWatchers |
|
120 ).EndTagL( KGetWatchers ); |
|
121 |
|
122 // </TransactionContent> |
|
123 xmlSerializer->EndTagL( KTransactionContent ); |
|
124 CleanupStack::PopAndDestroy( ); // xmlSerializer |
|
125 } |
|
126 |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CPEngGetWatchersTransaction::LastRunningTransactionHandler() |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 void CPEngGetWatchersTransaction::LastRunningTransactionHandler() |
|
133 { |
|
134 } |
|
135 |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CPEngGetWatchersTransaction::ProcessResponseL() |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 void CPEngGetWatchersTransaction::ProcessResponseL( |
|
142 const TDesC8& aResponse, |
|
143 TRequestStatus& /* aStatus */ ) |
|
144 { |
|
145 PENG_DP( D_PENG_LIT( "CPEngGetWatchersTransaction::ProcessResponseL()" ) ); |
|
146 |
|
147 // transaction to server was successful |
|
148 RReffArray<CPEngContactListModItemContainer> newContacts; |
|
149 CleanupClosePushL( newContacts ); |
|
150 MPEngXMLParser* XMLparser = CreateXMLParserLC(); |
|
151 |
|
152 // parse result if it exists |
|
153 TBool resultFound( EFalse ); |
|
154 TInt err( XMLparser->ParseResultL( aResponse, |
|
155 iOperationId, |
|
156 *iTransactionStatus, |
|
157 resultFound ) ); |
|
158 |
|
159 if ( ( err == KErrNone ) && NListLibTools::ParseContactListIDsL( aResponse, |
|
160 newContacts, |
|
161 iWatchers, |
|
162 *XMLparser, |
|
163 ETrue ) ) |
|
164 { |
|
165 iWatchers.AdoptNewContactsL( newContacts ); |
|
166 } |
|
167 |
|
168 CleanupStack::PopAndDestroy( 2 ); // newContacts, XMLparser |
|
169 iIsTransactionCompleted = ETrue; |
|
170 } |
|
171 |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // CPEngGetWatchersTransaction::CancelProcessing() |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 void CPEngGetWatchersTransaction::CancelProcessing( ) |
|
178 { |
|
179 } |
|
180 |
|
181 |
|
182 // ----------------------------------------------------------------------------- |
|
183 // CPEngGetWatchersTransaction::GetNewOutGoingTransactionHandlersL() |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 void CPEngGetWatchersTransaction::NewTransactionHandlersL( |
|
187 RPointerArray<MPEngOutgoingTransactionHandler>& /* aTransactionsArray*/ ) |
|
188 { |
|
189 } |
|
190 |
|
191 |
|
192 // ----------------------------------------------------------------------------- |
|
193 // CPEngGetWatchersTransaction::TransactionCompleted() |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 TBool CPEngGetWatchersTransaction::TransactionCompleted() |
|
197 { |
|
198 return iIsTransactionCompleted; |
|
199 } |
|
200 |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CPEngGetWatchersTransaction::TransactionResult() |
|
204 // ----------------------------------------------------------------------------- |
|
205 // |
|
206 CPEngTransactionStatus* CPEngGetWatchersTransaction::TransactionResult() |
|
207 { |
|
208 CPEngTransactionStatus* temp = iTransactionStatus; |
|
209 iTransactionStatus = NULL; |
|
210 return temp; |
|
211 } |
|
212 |
|
213 |
|
214 // ----------------------------------------------------------------------------- |
|
215 // CPEngGetWatchersTransaction::ReleaseHandler() |
|
216 // ----------------------------------------------------------------------------- |
|
217 // |
|
218 void CPEngGetWatchersTransaction::ReleaseHandler() |
|
219 { |
|
220 iIsTransactionCompleted = ETrue; |
|
221 } |
|
222 |
|
223 // End of File |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |