|
1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * SMF wide global const and macros, to be shared among SMF components |
|
17 * and SMF clients |
|
18 * |
|
19 */ |
|
20 |
|
21 #ifndef SMFGLOBAL_H |
|
22 #define SMFGLOBAL_H |
|
23 #include <e32cmn.h> |
|
24 #include <qglobal.h> |
|
25 #include <QBuffer> |
|
26 #include <QNetworkRequest> |
|
27 #include <QNetworkAccessManager> |
|
28 /** |
|
29 * Server name |
|
30 */ |
|
31 |
|
32 /** |
|
33 * Exact definition to be decided later |
|
34 */ |
|
35 #define SMF_SERVICE_NAME(INTERFACE,INTERFACENAME) |
|
36 |
|
37 /** |
|
38 * Indicates first page for a web query |
|
39 */ |
|
40 const int SMF_FIRST_PAGE=0; |
|
41 |
|
42 /** |
|
43 * Default value for per page item for web queries |
|
44 */ |
|
45 const int SMF_ITEMS_PER_PAGE=10; |
|
46 |
|
47 class SmfServerSymbianSession; |
|
48 |
|
49 |
|
50 /** |
|
51 * The enumeration used to denote errors reported by plugin |
|
52 * Smf can't continue without handling these errors |
|
53 */ |
|
54 enum SmfPluginError |
|
55 { |
|
56 SmfPluginErrNone = 0, |
|
57 SmfPluginErrTooManyRequest, |
|
58 SmfPluginErrRequestQuotaExceeded, |
|
59 SmfPluginErrInvalidRequest, |
|
60 SmfPluginErrUserNotLoggedIn, |
|
61 SmfPluginErrAuthenticationExpired, |
|
62 SmfPluginErrPermissionDenied, |
|
63 SmfPluginErrInvalidApplication, |
|
64 SmfPluginErrServiceUnavailable, |
|
65 SmfPluginErrServiceTemporaryUnavailable, |
|
66 SmfPluginErrFormatNotSupported, |
|
67 SmfPluginErrDataSizeExceeded, |
|
68 SmfPluginErrParsingFailed |
|
69 }; |
|
70 |
|
71 /** |
|
72 * The enumeration used to track the plugin methods return type |
|
73 */ |
|
74 enum SmfPluginRetType |
|
75 { |
|
76 SmfSendRequestAgain = 0, |
|
77 SmfRequestComplete, |
|
78 SmfRequestError |
|
79 }; |
|
80 |
|
81 |
|
82 /** |
|
83 * The enumeration used to indicate the type of network operation done |
|
84 */ |
|
85 enum SmfRequestTypeID |
|
86 { |
|
87 SmfGetService, |
|
88 SmfGetServiceComplete, |
|
89 SmfTest, |
|
90 SmfTestComplete, |
|
91 SmfContactGetFriends, |
|
92 SmfContactGetFollowers, |
|
93 SmfContactSearch, |
|
94 SmfContactSearchNear, |
|
95 SmfContactGetGroups, |
|
96 SmfContactSearchInGroup, |
|
97 SmfContactRetrievePosts, |
|
98 SmfContactPost, |
|
99 SmfContactUpdatePost, |
|
100 SmfContactPostDirected, |
|
101 SmfContactCommentOnAPost, |
|
102 SmfContactPostAppearence, |
|
103 SmfContactSharePost, |
|
104 SmfMusicGetLyrics, |
|
105 SmfMusicGetSubtitle, |
|
106 SmfMusicGetEventsOnLoc, |
|
107 SmfMusicGetVenueOnLoc, |
|
108 SmfMusicGetEventsOnVenue, |
|
109 SmfMusicPostEvents, |
|
110 SmfMusicGetRecommendations, |
|
111 SmfMusicGetTracks, |
|
112 SmfMusicGetTrackInfo, |
|
113 SmfMusicGetStores, |
|
114 SmfMusicPostCurrentPlaying, |
|
115 SmfMusicGetUserInfo, |
|
116 SmfMusicSearchUser, |
|
117 SmfMusicGetPlaylists, |
|
118 SmfMusicGetPlaylistsOfUser, |
|
119 SmfMusicAddToPlaylist, |
|
120 SmfMusicPostCurrentPlayingPlaylist, |
|
121 SmfPictureGetPictures, |
|
122 SmfPictureDescription, |
|
123 SmfPictureUpload, |
|
124 SmfPictureMultiUpload, |
|
125 SmfPicturePostComment, |
|
126 SmfContactGetFriendsComplete, |
|
127 SmfContactGetFollowersComplete, |
|
128 SmfContactSearchComplete, |
|
129 SmfContactSearchNearComplete, |
|
130 SmfContactGetGroupsComplete, |
|
131 SmfContactSearchInGroupComplete, |
|
132 SmfContactRetrievePostsComplete, |
|
133 SmfContactPostComplete, |
|
134 SmfContactUpdatePostComplete, |
|
135 SmfContactPostDirectedComplete, |
|
136 SmfContactCommentOnAPostComplete, |
|
137 SmfContactPostAppearenceComplete, |
|
138 SmfContactSharePostComplete, |
|
139 SmfMusicGetLyricsComplete, |
|
140 SmfMusicGetSubtitleComplete, |
|
141 SmfMusicGetEventsOnLocComplete, |
|
142 SmfMusicGetVenueOnLocComplete, |
|
143 SmfMusicGetEventsOnVenueComplete, |
|
144 SmfMusicPostEventsComplete, |
|
145 SmfMusicGetRecommendationsComplete, |
|
146 SmfMusicGetTracksComplete, |
|
147 SmfMusicGetTrackInfoComplete, |
|
148 SmfMusicGetStoresComplete, |
|
149 SmfMusicPostCurrentPlayingComplete, |
|
150 SmfMusicGetUserInfoComplete, |
|
151 SmfMusicSearchUserComplete, |
|
152 SmfMusicGetPlaylistsComplete, |
|
153 SmfMusicGetPlaylistsOfUserComplete, |
|
154 SmfMusicAddToPlaylistComplete, |
|
155 SmfMusicPostCurrentPlayingPlaylistComplete, |
|
156 SmfPictureGetPicturesComplete, |
|
157 SmfPictureDescriptionComplete, |
|
158 SmfPictureUploadComplete, |
|
159 SmfPictureMultiUploadComplete, |
|
160 SmfPicturePostCommentComplete |
|
161 |
|
162 }; |
|
163 |
|
164 /** |
|
165 * The enumeration used to indicate result of transport to the plugins |
|
166 */ |
|
167 enum SmfTransportResult |
|
168 { |
|
169 SmfTransportOpNoError = 0, |
|
170 SmfTransportOpConnectionRefusedError, |
|
171 SmfTransportOpRemoteHostClosedError, |
|
172 SmfTransportOpHostNotFoundError, |
|
173 SmfTransportOpTimeoutError, |
|
174 SmfTransportOpOperationCanceledError, |
|
175 SmfTransportOpSslHandshakeFailedError, |
|
176 SmfTransportOpProxyConnectionRefusedError, |
|
177 SmfTransportOpProxyConnectionClosedError, |
|
178 SmfTransportOpProxyNotFoundError, |
|
179 SmfTransportOpProxyTimeoutError, |
|
180 SmfTransportOpProxyAuthenticationRequiredError, |
|
181 SmfTransportOpContentAccessDenied, |
|
182 SmfTransportOpContentOperationNotPermittedError, |
|
183 SmfTransportOpContentNotFoundError, |
|
184 SmfTransportOpAuthenticationRequiredError, |
|
185 SmfTransportOpContentReSendError, |
|
186 SmfTransportOpProtocolUnknownError, |
|
187 SmfTransportOpProtocolInvalidOperationError, |
|
188 SmfTransportOpUnknownNetworkError, |
|
189 SmfTransportOpUnknownProxyError, |
|
190 SmfTransportOpUnknownContentError, |
|
191 SmfTransportOpProtocolFailure, |
|
192 SmfTransportOpUnknownError, |
|
193 SmfTransportOpIAPChanged, |
|
194 SmfTransportOpCancelled |
|
195 }; |
|
196 |
|
197 /** |
|
198 * The structure used to hold the request created by the plugins |
|
199 */ |
|
200 struct SmfPluginRequestData |
|
201 { |
|
202 /** |
|
203 * Indicates the type of operation performed, like getting Friends |
|
204 * list, upload image etc |
|
205 */ |
|
206 SmfRequestTypeID iRequestType; |
|
207 |
|
208 /** |
|
209 * The QNetworkRequest that has to be filled up by the plugins |
|
210 */ |
|
211 QNetworkRequest iNetworkRequest; |
|
212 |
|
213 /** |
|
214 * The data to be posted in case of HTTP POST operation |
|
215 */ |
|
216 QBuffer *iPostData; |
|
217 |
|
218 /** |
|
219 * The type of HTTP transaction, like GET, POST etc |
|
220 */ |
|
221 QNetworkAccessManager::Operation iHttpOperationType; |
|
222 |
|
223 }; |
|
224 |
|
225 /** |
|
226 * The structure used to hold the request created by the plugins |
|
227 */ |
|
228 struct SmfResultPage |
|
229 { |
|
230 /** |
|
231 * The total number of items |
|
232 */ |
|
233 uint iTotalItems; |
|
234 |
|
235 /** |
|
236 * The number of items per page |
|
237 */ |
|
238 uint iItemsPerPage; |
|
239 |
|
240 /** |
|
241 * The total number of pages |
|
242 */ |
|
243 uint iTotalPages; |
|
244 |
|
245 /** |
|
246 * The current fetched page number |
|
247 */ |
|
248 uint iPageNum; |
|
249 }; |
|
250 |
|
251 |
|
252 struct SmfClientAuthID |
|
253 { |
|
254 #ifdef Q_OS_SYMBIAN |
|
255 TSecureId pid; |
|
256 SmfServerSymbianSession* session; |
|
257 #else |
|
258 QString pid; |
|
259 SmfServerQtSession* session; |
|
260 #endif |
|
261 |
|
262 }; |
|
263 |
|
264 /*enum SmfRequestTypeID |
|
265 { |
|
266 ESmfTest, |
|
267 ESmfTestComplete, |
|
268 ESmfGetService, |
|
269 ESmfGetServiceComplete, |
|
270 ESmfGetContact, |
|
271 ESmfGetContactComplete, |
|
272 ESmfGetFriend, |
|
273 ESmfGetFriendComplete, |
|
274 ESmfGetFollower, |
|
275 ESmfGetFollowerComplete, |
|
276 ESmfSearchFriend, |
|
277 ESmfSearchFriendComplete, |
|
278 ESmfGetGroup, |
|
279 ESmfGetGroupComplete, |
|
280 ESmfSearchGroup, |
|
281 ESmfSearchGroupComplete, |
|
282 ESmfGetPost, |
|
283 ESmfGetPostComplete, |
|
284 ESmfGetPicture, //required for SmfGallery interface implementation |
|
285 ESmfGetPictureComplete, |
|
286 ESmfUploadPicture, |
|
287 ESmfUploadPictureComplete, |
|
288 ESmfPostComments, |
|
289 ESmfPostCommentsComplete, |
|
290 ESmfGetLyrics, //required for music related implementations |
|
291 ESmfGetLyricsComplete, |
|
292 ESmfGetSubtitles, |
|
293 ESmfGetSubtitlesComplete, |
|
294 ESmfGetPlayList, |
|
295 ESmfGetPlayListComplete, |
|
296 ESmfaddToPlayList, |
|
297 ESmfaddToPlayListComplete, |
|
298 ESmfGetEvents, |
|
299 ESmfGetEventsComplete, |
|
300 ESmfGetVenues, |
|
301 ESmfGetVenuesComplete, |
|
302 ESmfPostEvent, |
|
303 ESmfPostEventComplete, |
|
304 ESmfGetMusicRecommendation, |
|
305 ESmfGetMusicRecommendationComplete, |
|
306 ESmfGetTrack, |
|
307 ESmfGetTrackComplete, |
|
308 ESmfSearchMusicUser, |
|
309 ESmfSearchMusicUserComplete, |
|
310 ESmfQueryAuthKeys, |
|
311 ESmfQueryAuthKeysComplete, |
|
312 ESmfAuthKeyExpired, |
|
313 ESmfAuthKeyExpiredComplete |
|
314 };*/ |
|
315 /** |
|
316 * Smf wide errors |
|
317 */ |
|
318 enum SmfError |
|
319 { |
|
320 SmfNoError, |
|
321 SmfInvalidInterface, |
|
322 SmfNoAuthorizedPlugin, |
|
323 SmfClientAuthFailed, |
|
324 SmfPluginErrorTooManyRequest, |
|
325 SmfPluginErrorRequestQuotaExceeded, |
|
326 SmfPluginErrorInvalidRequest, |
|
327 SmfPluginErrorUserNotLoggedIn, |
|
328 SmfPluginErrorAuthenticationExpired, |
|
329 SmfPluginErrorPermissionDenied, |
|
330 SmfPluginErrorInvalidApplication, |
|
331 SmfPluginErrorServiceUnavailable, |
|
332 SmfPluginErrorServiceTemporaryUnavailable, |
|
333 SmfPluginErrorFormatNotSupported, |
|
334 SmfPluginErrorDataSizeExceeded , |
|
335 SmfpluginNotFound, |
|
336 SmfpluginNotLoaded, |
|
337 SmfpluginLoaded, |
|
338 SmfpluginLoadError, |
|
339 SmfpluginAuthorised, |
|
340 SmfpluginNotAuthorised, |
|
341 SmfpluginRequestCreated, |
|
342 SmfpluginRequestCreationFailed, |
|
343 SmfpluginUnknownService, |
|
344 SmfpluginRequestSendingFailed, |
|
345 SmfpluginSOPCheckFailed, |
|
346 SmfpluginServiceError, |
|
347 SmfpluginResponseParsed, |
|
348 SmfpluginResponseParseFailure, |
|
349 SmfpluginSendRequestAgain, |
|
350 SmfpluginUnknownError, |
|
351 SmftransportOpConnectionRefusedError, |
|
352 SmftransportOpRemoteHostClosedError, |
|
353 SmftransportOpHostNotFoundError, |
|
354 SmftransportOpTimeoutError, |
|
355 SmftransportOpOperationCanceledError, |
|
356 SmftransportOpSslHandshakeFailedError, |
|
357 SmftransportOpProxyConnectionRefusedError, |
|
358 SmftransportOpProxyConnectionClosedError, |
|
359 SmftransportOpProxyNotFoundError, |
|
360 SmftransportOpProxyTimeoutError, |
|
361 SmftransportOpProxyAuthenticationRequiredError, |
|
362 SmftransportOpContentAccessDenied, |
|
363 SmftransportOpContentOperationNotPermittedError, |
|
364 SmftransportOpContentNotFoundError, |
|
365 SmftransportOpAuthenticationRequiredError, |
|
366 SmftransportOpContentReSendError, |
|
367 SmftransportOpProtocolUnknownError, |
|
368 SmftransportOpProtocolInvalidOperationError, |
|
369 SmftransportOpUnknownNetworkError, |
|
370 SmftransportOpUnknownProxyError, |
|
371 SmftransportOpUnknownContentError, |
|
372 SmftransportOpProtocolFailure, |
|
373 SmftransportOpUnknownError, |
|
374 SmftransportOpIAPChanged, |
|
375 SmftransportOpCancelled, |
|
376 SmftransportInitNetworkNotAvailable , |
|
377 SmftransportInitRoamingNetworkUsageNotEnabled |
|
378 }; |
|
379 |
|
380 /** |
|
381 * Smf wide panics |
|
382 */ |
|
383 enum SmfPanic |
|
384 { |
|
385 SmfRequestPending//to allow one outstanding request per session |
|
386 }; |
|
387 //interface names |
|
388 const QString contactFetcherInterface("org.symbian.smf.client.contact.fetcher"); |
|
389 //TODO:- changed to match PM for the time being, PM must change later |
|
390 const QString postProviderInterface("posts"); |
|
391 //const QString postProviderInterface("org.symbian.smf.client.contact.posts"); |
|
392 const QString galleryInterface("org.symbian.smf.client.gallery"); |
|
393 |
|
394 |
|
395 |
|
396 #endif /* SMFGLOBAL_H_ */ |