|
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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Interface to receive notifications of SyncML session and synchronization progress events. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __SYNCMLOBSERVERS_H__ |
|
19 #define __SYNCMLOBSERVERS_H__ |
|
20 #define SYNCML_V3 |
|
21 // |
|
22 #include <e32std.h> |
|
23 // |
|
24 |
|
25 /////////////////////////////////////////////////////////////////////////////// |
|
26 // MSyncMLEventObserver |
|
27 // Observer of session events. |
|
28 /////////////////////////////////////////////////////////////////////////////// |
|
29 class MSyncMLEventObserver |
|
30 /** |
|
31 Interface to receive notifications of SyncML session events. |
|
32 |
|
33 Notifications are requested through RSyncMLSession::RequestEventL(). |
|
34 @publishedAll |
|
35 @released |
|
36 */ |
|
37 { |
|
38 public: |
|
39 enum TEvent |
|
40 /** SyncML session event types. */ |
|
41 { |
|
42 /** Job has started. */ |
|
43 EJobStart, |
|
44 /** Job has failed to start. */ |
|
45 EJobStartFailed, |
|
46 /** Job has stopped. */ |
|
47 EJobStop, |
|
48 /** Job could not be parsed, and will not be processed. */ |
|
49 EJobRejected, |
|
50 /** A profile has been created. */ |
|
51 EProfileCreated, |
|
52 /** A profile has been changed. */ |
|
53 EProfileChanged, |
|
54 /** A profile has been deleted. */ |
|
55 EProfileDeleted, |
|
56 /** A transport has timed-out. */ |
|
57 ETransportTimeout, |
|
58 /** The SyncML Agent is suspended. This can occur when processing pauses in order to perform a back-up. */ |
|
59 EServerSuspended, |
|
60 /** The SyncML Agent has shutdown. */ |
|
61 EServerTerminated |
|
62 }; |
|
63 public: |
|
64 /** |
|
65 Receives a SyncML session event. |
|
66 |
|
67 The following table lists the meaning of the identifier and error parameters for the various event types. |
|
68 @code |
|
69 TEvent aIdentifier aError aAdditionalData |
|
70 EJobStart ID of the new job. KErrNone. KUnusedAdditionalData. |
|
71 EJobStartFailed Unused. Reason for fail. KUnusedAdditionalData. |
|
72 EJobStop ID of the job. Completion code. KUnusedAdditionalData. |
|
73 EJobRejected Unused. Reason for rejection. KUnusedAdditionalData. |
|
74 EProfileCreated ID of the profile. Unused. The usage type( either ESmlDataSync or ESmlDevMan) or an error code. |
|
75 EProfileChanged ID of the profile. Unused. The usage type( either ESmlDataSync or ESmlDevMan) or an error code. |
|
76 EProfileDeleted ID of the profile. Unused. KUnusedAdditionalData. |
|
77 ETransportTimeout ID of the transport. KErrTimedOut. KUnusedAdditionalData. |
|
78 EServerSuspended Non-zero if the server KErrNone when entering. When exiting, |
|
79 is entering suspended any error encountered when reloading data. KUnusedAdditionalData. |
|
80 state, zero on exiting. |
|
81 EServerTerminated Unused. KErrServerTerminated. KUnusedAdditionalData. |
|
82 @endcode |
|
83 |
|
84 @param aEvent Event type. |
|
85 @param aIdentifier When the event relates to an object with an ID (job or profile), the ID. |
|
86 @param aError When the event relates to an error, the error code. |
|
87 @param aAdditionalData The value of this parameter can be: |
|
88 KUnusedAdditionalData if additional data are unavailable, |
|
89 ESmlDataSync if the event is generated during a Data Sync session, |
|
90 ESmlDevMan if the event is generated during a Device Management session |
|
91 */ |
|
92 virtual void OnSyncMLSessionEvent(TEvent aEvent, TInt aIdentifier, TInt aError, TInt aAdditionalData) = 0; |
|
93 }; |
|
94 |
|
95 /////////////////////////////////////////////////////////////////////////////// |
|
96 /////////////////////////////////////////////////////////////////////////////// |
|
97 |
|
98 /////////////////////////////////////////////////////////////////////////////// |
|
99 // MSyncMLProgressObserver |
|
100 /////////////////////////////////////////////////////////////////////////////// |
|
101 /** |
|
102 Interface to receive notifications of SyncML synchronisation progress events. |
|
103 |
|
104 Notifications are requested through RSyncMLSession::RequestProgressL(). |
|
105 @publishedAll |
|
106 @released |
|
107 */ |
|
108 class MSyncMLProgressObserver |
|
109 { |
|
110 public: |
|
111 /** SyncML synchronisation progress events. */ |
|
112 enum TStatus |
|
113 { |
|
114 /** Connecting to a SyncML server. */ |
|
115 ESmlConnecting, |
|
116 /** Connected to a SyncML server. */ |
|
117 ESmlConnected, |
|
118 /** Logging on to a SyncML server. */ |
|
119 ESmlLoggingOn, |
|
120 /** Logged on to a SyncML server. */ |
|
121 ESmlLoggedOn, |
|
122 /** Disconnected from a SyncML server. */ |
|
123 ESmlDisconnected, |
|
124 /** Synchronisation has completed. */ |
|
125 ESmlCompleted, |
|
126 #ifdef SYNCML_V3 |
|
127 /** Sending modifications to a SyncML server. DS only */ |
|
128 ESmlSendingModificationsToServer, |
|
129 /** Receiving modifications from a SyncML server. DS only */ |
|
130 ESmlReceivingModificationsFromServer, |
|
131 /** Sending mappings to a SyncML server. DS only */ |
|
132 ESmlSendingMappingsToServer, |
|
133 /** Processing commands from a SyncML server. DM only*/ |
|
134 ESmlProcessingServerCommands, |
|
135 /** Receiving commands from a SyncML server. DM only*/ |
|
136 ESmlReceivingServerCommands, |
|
137 #else // SYNCML_V3 |
|
138 /** Sending data to a SyncML server. */ |
|
139 ESmlSendingData, |
|
140 /** Receiving data from a SyncML server. */ |
|
141 ESmlReceivingData |
|
142 #endif // SYNCML_V3 |
|
143 }; |
|
144 /** SyncML error levels. */ |
|
145 enum TErrorLevel |
|
146 { |
|
147 /** Warning. A non-fatal error has occurred. Synchronisation continues.*/ |
|
148 ESmlWarning, |
|
149 /** Fatal error. A fatal error has occurred. The synchronisation is stopped. */ |
|
150 ESmlFatalError |
|
151 }; |
|
152 |
|
153 #ifdef SYNCML_V3 |
|
154 /** Container class for number of items added, replaced, moved, deleted and failed. */ |
|
155 class TSyncMLDataSyncModifications |
|
156 { |
|
157 public: |
|
158 TInt iNumAdded; |
|
159 TInt iNumReplaced; |
|
160 TInt iNumMoved; |
|
161 TInt iNumDeleted; |
|
162 TInt iNumFailed; |
|
163 }; |
|
164 #endif // SYNCML_V3 |
|
165 |
|
166 public: |
|
167 |
|
168 /** |
|
169 Receives notification of a synchronisation error. |
|
170 |
|
171 @param aErrorLevel The error level. |
|
172 @param aError The type of error. This is one of the SyncMLError error values. |
|
173 @param aTaskId The ID of the task for which the error occurred. |
|
174 @param aInfo1 An integer that can contain additional information about the error. Normally 0. |
|
175 @param aInfo2 An integer that can contain additional information about the error. Normally 0. |
|
176 */ |
|
177 virtual void OnSyncMLSyncError(TErrorLevel aErrorLevel, TInt aError, TInt aTaskId, TInt aInfo1, TInt aInfo2)= 0 ; |
|
178 |
|
179 /** |
|
180 Receives notification of synchronisation progress. |
|
181 |
|
182 @param aStatus The current status, e.g. 'Connecting'. |
|
183 @param aInfo1 An integer that can contain additional information about the progress. |
|
184 @param aInfo2 An integer that can contain additional information about the progress. |
|
185 */ |
|
186 virtual void OnSyncMLSyncProgress(TStatus aStatus, TInt aInfo1, TInt aInfo2)= 0; |
|
187 #ifdef SYNCML_V3 |
|
188 /** |
|
189 Receives notification of modifications to synchronisation tasks. |
|
190 |
|
191 @param aTaskId The ID of the task. |
|
192 @param aClientModifications Modifications made on the clients Data Store. |
|
193 @param aServerModifications Modifications made on the server Data Store. |
|
194 */ |
|
195 virtual void OnSyncMLDataSyncModifications(TInt aTaskId, |
|
196 const TSyncMLDataSyncModifications& aClientModifications, |
|
197 const TSyncMLDataSyncModifications& aServerModifications)= 0; |
|
198 #else // SYNCML_V3 |
|
199 /** |
|
200 Receives notification of modifications to synchronisation tasks. |
|
201 |
|
202 @param aTaskId The ID of the task. |
|
203 @param aNumAdded Number of items added. |
|
204 @param aNumReplaced Number of items replaced. |
|
205 @param aNumDeleted Number of items deleted. |
|
206 */ |
|
207 virtual void OnSyncMLDataSyncModifications(TInt aTaskId, TInt aNumAdded, TInt aNumReplaced, TInt aNumDeleted)= 0; |
|
208 #endif // SYNCML_V3 |
|
209 |
|
210 }; |
|
211 |
|
212 |
|
213 /////////////////////////////////////////////////////////////////////////////// |
|
214 /////////////////////////////////////////////////////////////////////////////// |
|
215 |
|
216 /////////////////////////////////////////////////////////////////////////////// |
|
217 /////////////////////////////////////////////////////////////////////////////// |
|
218 /////////////////////////////////////////////////////////////////////////////// |
|
219 #endif |