|
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: Transction handler to do basic synchronization |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CPENGSTARTSYNCTRANSACTION_H__ |
|
19 #define __CPENGSTARTSYNCTRANSACTION_H__ |
|
20 |
|
21 |
|
22 // INCLUDES |
|
23 #include "MPEngOutgoingTransactionHandler.h" |
|
24 #include "PEngWVCspVersion.h" |
|
25 #include <e32base.h> |
|
26 #include <badesca.h> |
|
27 |
|
28 |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MPEngStorageManager; |
|
32 class CPEngTransactionStatus; |
|
33 class MPEngXMLParser; |
|
34 class MPEngContactListTransactionManager; |
|
35 class MPEngXMLSerializer; |
|
36 |
|
37 |
|
38 // CLASS DECLARATION |
|
39 /** |
|
40 * Transction handler to do basic synchronization |
|
41 * |
|
42 * @lib PEngListLib2 |
|
43 * @since 3.0 |
|
44 */ |
|
45 NONSHARABLE_CLASS( CPEngStartSyncTransaction ): |
|
46 public CBase, |
|
47 public MPEngOutgoingTransactionHandler |
|
48 { |
|
49 private: |
|
50 |
|
51 /** |
|
52 * Private enumerations. |
|
53 */ |
|
54 enum TPEngSyncStartState |
|
55 { |
|
56 EPEngGetListOfLists = 0, |
|
57 EPEngUnSubscribe, |
|
58 EPEngTransactionCompleted |
|
59 }; |
|
60 |
|
61 public: |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 */ |
|
66 static CPEngStartSyncTransaction* NewLC( |
|
67 MPEngContactListTransactionManager& aCntLstSettingsManager, |
|
68 TPEngWVCspVersion& aCSPVersion, |
|
69 TInt aOperationId, |
|
70 TBool aNeedToUnsubscribe ); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 virtual ~CPEngStartSyncTransaction(); |
|
76 |
|
77 |
|
78 public: // Functions from MPEngOutgoingTransactionHandler |
|
79 |
|
80 /** |
|
81 * Synchronous method, get Outgoing transaction request |
|
82 * @see <MPEngOutgoingTransactionHandler.h> |
|
83 */ |
|
84 void RequestL( TDes8& aSendBuffer ); |
|
85 |
|
86 |
|
87 /** |
|
88 * Signals to the transaction handler that this it is last one |
|
89 * @see <MPEngOutgoingTransactionHandler.h> |
|
90 */ |
|
91 void LastRunningTransactionHandler(); |
|
92 |
|
93 |
|
94 /** |
|
95 * Process the response to the request. |
|
96 * @see <MPEngOutgoingTransactionHandler.h> |
|
97 */ |
|
98 void ProcessResponseL( const TDesC8& aResponse, |
|
99 TRequestStatus& aStatus ); |
|
100 |
|
101 /** |
|
102 * Cancels asynchronous processing of the request |
|
103 * @see <MPEngOutgoingTransactionHandler.h> |
|
104 */ |
|
105 void CancelProcessing(); |
|
106 |
|
107 |
|
108 /** |
|
109 * Support for simultaneous transaction handling |
|
110 * @see <MPEngOutgoingTransactionHandler.h> |
|
111 */ |
|
112 void NewTransactionHandlersL( |
|
113 RPointerArray<MPEngOutgoingTransactionHandler>& aHandlers ); |
|
114 |
|
115 |
|
116 /** |
|
117 * Function to signal completing of the transaction |
|
118 * @see <MPEngOutgoingTransactionHandler.h> |
|
119 */ |
|
120 TBool TransactionCompleted(); |
|
121 |
|
122 |
|
123 /** |
|
124 * Gets transaction status result class |
|
125 * @see <MPEngOutgoingTransactionHandler.h> |
|
126 */ |
|
127 CPEngTransactionStatus* TransactionResult(); |
|
128 |
|
129 |
|
130 /** |
|
131 * Releases the handler |
|
132 * @see <MPEngOutgoingTransactionHandler.h> |
|
133 */ |
|
134 void ReleaseHandler(); |
|
135 |
|
136 |
|
137 |
|
138 private: ///New functions |
|
139 |
|
140 /** |
|
141 * Create XML message to retrieve all contact lists of the wv server |
|
142 * |
|
143 * @since 3.0 |
|
144 * @param aXmlSerializer XML serializer |
|
145 */ |
|
146 void GetXMLGetListOfContactListsL( MPEngXMLSerializer& aXmlSerializer ); |
|
147 |
|
148 /** |
|
149 * Create XML message to unsubscribe all contact lists of the wv server |
|
150 * @since 3.0 |
|
151 * @param aXmlSerializer XML serializer |
|
152 */ |
|
153 void GetXMLUnsubscribeAllL( MPEngXMLSerializer& aXmlSerializer ); |
|
154 |
|
155 |
|
156 /** |
|
157 * Parse XML Get list of server contact lists response |
|
158 * |
|
159 * @since 3.0 |
|
160 * @param aResponse response buffer |
|
161 * @return aXMLparser XML parser |
|
162 */ |
|
163 void ParseGetListOfListsResponseL( const TDesC8& aResponse, |
|
164 MPEngXMLParser* aXMLparser ); |
|
165 |
|
166 /** |
|
167 * Parse XML Unsunbscribe all response |
|
168 * |
|
169 * @since 3.0 |
|
170 * @param aResponse response buffer |
|
171 * @return aXMLparser XML parser |
|
172 */ |
|
173 void ParseUnsubscreAllResponseL( const TDesC8& aResponse, |
|
174 MPEngXMLParser* aXMLparser ); |
|
175 |
|
176 private: // Constructors |
|
177 |
|
178 /** |
|
179 * C++ constructor. |
|
180 */ |
|
181 CPEngStartSyncTransaction( |
|
182 MPEngContactListTransactionManager& aCntLstSettingsManager, |
|
183 TPEngWVCspVersion& aCSPVersion, |
|
184 TInt aOperationId, |
|
185 TBool aNeedToUnsubscribe ); |
|
186 |
|
187 |
|
188 /** |
|
189 * Symbian constructor |
|
190 */ |
|
191 void ConstructL(); |
|
192 |
|
193 |
|
194 private: // Data |
|
195 |
|
196 // REF: Contact list manager |
|
197 MPEngContactListTransactionManager& iContactListManager; |
|
198 |
|
199 // OWN: Transaction status class |
|
200 CPEngTransactionStatus* iTransactionStatus; |
|
201 |
|
202 // OWN: State of the start of the synchronization |
|
203 TInt iSynchronizationState; |
|
204 |
|
205 // OWN: List of server contact lists |
|
206 CDesC16ArrayFlat iServerCntLists; |
|
207 |
|
208 /// OWN: Server default contact list |
|
209 HBufC* iDefaultCntList; |
|
210 |
|
211 /// OWN: CPS Version |
|
212 TPEngWVCspVersion& iCSPVersion; |
|
213 |
|
214 /// Operation Id |
|
215 TInt iOperationId; |
|
216 |
|
217 // |
|
218 TBool iUnsubscribe; |
|
219 }; |
|
220 |
|
221 #endif // __CPENGSTARTSYNCTRANSACTION_H__ |
|
222 |
|
223 // End of File |
|
224 |