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 |
|
24 #ifdef Q_OS_SYMBIAN |
|
25 #include <e32cmn.h> |
|
26 #endif |
|
27 |
|
28 #include <qglobal.h> |
|
29 #include <QBuffer> |
|
30 #include <QNetworkRequest> |
|
31 #include <QNetworkAccessManager> |
|
32 /** |
|
33 * Server name |
|
34 */ |
|
35 |
|
36 /** |
|
37 * Exact definition to be decided later |
|
38 */ |
|
39 #define SMF_SERVICE_NAME(INTERFACE,INTERFACENAME) |
|
40 |
|
41 /** |
|
42 * Indicates first page for a web query |
|
43 */ |
|
44 const int SMF_FIRST_PAGE=0; |
|
45 |
|
46 /** |
|
47 * Default value for per page item for web queries |
|
48 */ |
|
49 const int SMF_ITEMS_PER_PAGE=10; |
|
50 #ifdef Q_OS_SYMBIAN |
|
51 class SmfServerSymbianSession; |
|
52 #else |
|
53 class SmfServerQtSession; |
|
54 #endif |
|
55 |
|
56 /** |
|
57 * The enumeration used to denote errors reported by plugin |
|
58 * Smf can't continue without handling these errors |
|
59 */ |
|
60 enum SmfPluginError |
|
61 { |
|
62 SmfPluginErrNone = 0, |
|
63 SmfPluginErrTooManyRequest, |
|
64 SmfPluginErrRequestQuotaExceeded, |
|
65 SmfPluginErrInvalidRequest, |
|
66 SmfPluginErrUserNotLoggedIn, |
|
67 SmfPluginErrAuthenticationExpired, |
|
68 SmfPluginErrPermissionDenied, |
|
69 SmfPluginErrInvalidApplication, |
|
70 SmfPluginErrServiceUnavailable, |
|
71 SmfPluginErrServiceTemporaryUnavailable, |
|
72 SmfPluginErrFormatNotSupported, |
|
73 SmfPluginErrDataSizeExceeded, |
|
74 SmfPluginErrServiceNotSupported, |
|
75 SmfPluginErrInvalidArguments, |
|
76 SmfPluginErrRequestNotCreated, |
|
77 SmfPluginErrParsingFailed, |
|
78 SmfPluginErrNetworkError, |
|
79 SmfPluginErrCancelComplete |
|
80 }; |
|
81 |
|
82 /** |
|
83 * The enumeration used to track the plugin methods return type |
|
84 */ |
|
85 enum SmfPluginRetType |
|
86 { |
|
87 SmfSendRequestAgain = 0, |
|
88 SmfRequestComplete, |
|
89 SmfRequestError |
|
90 }; |
|
91 |
|
92 |
|
93 /** |
|
94 * The enumeration used to indicate the type of network operation done |
|
95 */ |
|
96 enum SmfRequestTypeID |
|
97 { |
|
98 SmfGetService, |
|
99 SmfGetServiceComplete, |
|
100 SmfTest, |
|
101 SmfTestComplete, |
|
102 SmfContactGetFriends, |
|
103 SmfContactGetFollowers, |
|
104 SmfContactSearch, |
|
105 SmfContactSearchNear, |
|
106 SmfContactGetGroups, |
|
107 SmfContactSearchInGroup, |
|
108 SmfContactCustomRequest, |
|
109 SmfContactRetrievePosts, |
|
110 SmfContactPost, |
|
111 SmfContactUpdatePost, |
|
112 SmfContactPostDirected, |
|
113 SmfContactCommentOnAPost, |
|
114 SmfContactPostAppearence, |
|
115 SmfContactSharePost, |
|
116 SmfContactPostCustomRequest, |
|
117 SmfMusicGetLyrics, |
|
118 SmfMusicGetSubtitle, |
|
119 SmfMusicLyricsCustomRequest, |
|
120 SmfMusicGetEventsOnLoc, |
|
121 SmfMusicGetVenueOnLoc, |
|
122 SmfMusicGetEventsOnVenue, |
|
123 SmfMusicPostEvents, |
|
124 SmfMusicEventsCustomRequest, |
|
125 SmfMusicGetRecommendations, |
|
126 SmfMusicGetTracks, |
|
127 SmfMusicGetTrackInfo, |
|
128 SmfMusicGetStores, |
|
129 SmfMusicPostCurrentPlaying, |
|
130 SmfMusicPostRating, |
|
131 SmfMusicPostComment, |
|
132 SmfMusicSearchCustomRequest, |
|
133 SmfMusicGetUserInfo, |
|
134 SmfMusicSearchUser, |
|
135 SmfMusicServiceCustomRequest, |
|
136 SmfMusicGetPlaylists, |
|
137 SmfMusicGetPlaylistsOfUser, |
|
138 SmfMusicAddToPlaylist, |
|
139 SmfMusicPostCurrentPlayingPlaylist, |
|
140 SmfMusicPlaylistCustomRequest, |
|
141 SmfPictureGetAlbums, |
|
142 SmfPictureGetPictures, |
|
143 SmfPictureDescription, |
|
144 SmfPictureUpload, |
|
145 SmfPictureMultiUpload, |
|
146 SmfPicturePostComment, |
|
147 SmfPictureCustomRequest, |
|
148 SmfActivityFriendsActivities, //SmfActivityFetcher start |
|
149 SmfActivityFiltered, |
|
150 SmfActivitySelfActivity, |
|
151 SmfActivityCustomRequest,//SmfActivityFetcher end |
|
152 SmfContactGetFriendsComplete, |
|
153 SmfContactGetFollowersComplete, |
|
154 SmfContactSearchComplete, |
|
155 SmfContactSearchNearComplete, |
|
156 SmfContactGetGroupsComplete, |
|
157 SmfContactSearchInGroupComplete, |
|
158 SmfContactRetrievePostsComplete, |
|
159 SmfContactPostComplete, |
|
160 SmfContactUpdatePostComplete, |
|
161 SmfContactPostDirectedComplete, |
|
162 SmfContactCommentOnAPostComplete, |
|
163 SmfContactPostAppearenceComplete, |
|
164 SmfContactSharePostComplete, |
|
165 SmfMusicGetLyricsComplete, |
|
166 SmfMusicGetSubtitleComplete, |
|
167 SmfMusicGetEventsOnLocComplete, |
|
168 SmfMusicGetVenueOnLocComplete, |
|
169 SmfMusicGetEventsOnVenueComplete, |
|
170 SmfMusicPostEventsComplete, |
|
171 SmfMusicGetRecommendationsComplete, |
|
172 SmfMusicGetTracksComplete, |
|
173 SmfMusicGetTrackInfoComplete, |
|
174 SmfMusicGetStoresComplete, |
|
175 SmfMusicPostCurrentPlayingComplete, |
|
176 SmfMusicGetUserInfoComplete, |
|
177 SmfMusicSearchUserComplete, |
|
178 SmfMusicGetPlaylistsComplete, |
|
179 SmfMusicGetPlaylistsOfUserComplete, |
|
180 SmfMusicAddToPlaylistComplete, |
|
181 SmfMusicPostCurrentPlayingPlaylistComplete, |
|
182 SmfPictureGetPicturesComplete, |
|
183 SmfPictureDescriptionComplete, |
|
184 SmfPictureUploadComplete, |
|
185 SmfPictureMultiUploadComplete, |
|
186 SmfPicturePostCommentComplete, |
|
187 SmfRelationCreate,//SmfRelationMngr start |
|
188 SmfRelationAssociate, |
|
189 SmfRelationRemove, |
|
190 SmfRelationSearchById, |
|
191 SmfRelationSearchByContact, |
|
192 SmfRelationCount, |
|
193 SmfRelationGet, |
|
194 SmfRelationGetAll, |
|
195 SmfRelationGetAllRelations//SmfRelationMngr end |
|
196 |
|
197 }; |
|
198 |
|
199 /** |
|
200 * The enumeration used to indicate result of transport to the plugins |
|
201 */ |
|
202 enum SmfTransportResult |
|
203 { |
|
204 SmfTransportOpNoError = 0, |
|
205 SmfTransportOpConnectionRefusedError, |
|
206 SmfTransportOpRemoteHostClosedError, |
|
207 SmfTransportOpHostNotFoundError, |
|
208 SmfTransportOpTimeoutError, |
|
209 SmfTransportOpOperationCanceledError, |
|
210 SmfTransportOpSslHandshakeFailedError, |
|
211 SmfTransportOpProxyConnectionRefusedError, |
|
212 SmfTransportOpProxyConnectionClosedError, |
|
213 SmfTransportOpProxyNotFoundError, |
|
214 SmfTransportOpProxyTimeoutError, |
|
215 SmfTransportOpProxyAuthenticationRequiredError, |
|
216 SmfTransportOpContentAccessDenied, |
|
217 SmfTransportOpContentOperationNotPermittedError, |
|
218 SmfTransportOpContentNotFoundError, |
|
219 SmfTransportOpAuthenticationRequiredError, |
|
220 SmfTransportOpContentReSendError, |
|
221 SmfTransportOpProtocolUnknownError, |
|
222 SmfTransportOpProtocolInvalidOperationError, |
|
223 SmfTransportOpUnknownNetworkError, |
|
224 SmfTransportOpUnknownProxyError, |
|
225 SmfTransportOpUnknownContentError, |
|
226 SmfTransportOpProtocolFailure, |
|
227 SmfTransportOpUnknownError, |
|
228 SmfTransportOpIAPChanged, |
|
229 SmfTransportOpCancelled, |
|
230 SmfTransportOpUnsupportedContentEncodingFormat, |
|
231 SmfTransportOpGzipError |
|
232 }; |
|
233 |
|
234 /** |
|
235 * The structure used to hold the request created by the plugins |
|
236 */ |
|
237 struct SmfPluginRequestData |
|
238 { |
|
239 /** |
|
240 * Indicates the type of operation performed, like getting Friends |
|
241 * list, upload image etc |
|
242 */ |
|
243 SmfRequestTypeID iRequestType; |
|
244 |
|
245 /** |
|
246 * The QNetworkRequest that has to be filled up by the plugins |
|
247 */ |
|
248 QNetworkRequest iNetworkRequest; |
|
249 |
|
250 /** |
|
251 * The data to be posted in case of HTTP POST operation |
|
252 */ |
|
253 QBuffer *iPostData; |
|
254 |
|
255 /** |
|
256 * The type of HTTP transaction, like GET, POST etc |
|
257 */ |
|
258 QNetworkAccessManager::Operation iHttpOperationType; |
|
259 |
|
260 }; |
|
261 |
|
262 /** |
|
263 * The structure used to hold the request created by the plugins |
|
264 */ |
|
265 struct SmfResultPage |
|
266 { |
|
267 /** |
|
268 * The total number of items |
|
269 */ |
|
270 uint iTotalItems; |
|
271 |
|
272 /** |
|
273 * The number of items per page |
|
274 */ |
|
275 uint iItemsPerPage; |
|
276 |
|
277 /** |
|
278 * The total number of pages |
|
279 */ |
|
280 uint iTotalPages; |
|
281 |
|
282 /** |
|
283 * The current fetched page number |
|
284 */ |
|
285 uint iPageNum; |
|
286 }; |
|
287 |
|
288 |
|
289 struct SmfClientAuthID |
|
290 { |
|
291 #ifdef Q_OS_SYMBIAN |
|
292 TSecureId pid; |
|
293 SmfServerSymbianSession* session; |
|
294 #else |
|
295 QString pid; |
|
296 SmfServerQtSession* session; |
|
297 #endif |
|
298 |
|
299 }; |
|
300 |
|
301 /** |
|
302 * Smf wide errors |
|
303 */ |
|
304 enum SmfError |
|
305 { |
|
306 SmfNoError = 0, |
|
307 SmfInvalidInterface, //1 |
|
308 SmfNoAuthorizedPlugin, //2 |
|
309 SmfClientAuthFailed, //3 |
|
310 SmfPMPluginNotFound, //4 |
|
311 SmfPMPluginNotLoaded, //5 |
|
312 SmfPMPluginLoadError, //6 |
|
313 SmfPMPluginNotAuthorised, //7 |
|
314 SmfPMPluginRequestCreationFailed, //8 |
|
315 SmfPMPluginUnknownPluginService, //9 |
|
316 SmfPMPluginUnknownHttpService, //10 |
|
317 SmfPMPluginRequestSendingFailed, //11 |
|
318 SmfPMPluginSOPCheckFailed, //12 |
|
319 SmfPMPluginSendRequestAgain, //13 |
|
320 SmfPluginErrorTooManyRequest, //14 |
|
321 SmfPluginErrorRequestQuotaExceeded, //15 |
|
322 SmfPluginErrorInvalidRequest, //16 |
|
323 SmfPluginErrorUserNotLoggedIn, //17 |
|
324 SmfPluginErrorAuthenticationExpired, //18 |
|
325 SmfPluginErrorPermissionDenied, //19 |
|
326 SmfPluginErrorInvalidApplication, //20 |
|
327 SmfPluginErrorServiceUnavailable, //21 |
|
328 SmfPluginErrorServiceTemporaryUnavailable, //22 |
|
329 SmfPluginErrorFormatNotSupported, //23 |
|
330 SmfPluginErrorDataSizeExceeded , //24 |
|
331 SmfPluginErrorInvalidArguments, //25 |
|
332 SmfPluginErrorParsingFailed, //26 |
|
333 SmfPluginErrorNetworkError, //27 |
|
334 SmfPluginErrorCancelComplete, //28 |
|
335 SmfTMConnectionRefusedError, //29 |
|
336 SmfTMRemoteHostClosedError, //30 |
|
337 SmfTMHostNotFoundError, //31 |
|
338 SmfTMTimeoutError, //32 |
|
339 SmfTMOperationCanceledError, //33 |
|
340 SmfTMSslHandshakeFailedError, //34 |
|
341 SmfTMProxyConnectionRefusedError, //35 |
|
342 SmfTMProxyConnectionClosedError, //36 |
|
343 SmfTMProxyNotFoundError, //37 |
|
344 SmfTMProxyTimeoutError, //38 |
|
345 SmfTMProxyAuthenticationRequiredError, //39 |
|
346 SmfTMContentAccessDenied, //40 |
|
347 SmfTMContentOperationNotPermittedError, //41 |
|
348 SmfTMContentNotFoundError, //42 |
|
349 SmfTMAuthenticationRequiredError, //43 |
|
350 SmfTMContentReSendError, //44 |
|
351 SmfTMProtocolUnknownError, //45 |
|
352 SmfTMProtocolInvalidOperationError, //46 |
|
353 SmfTMUnknownNetworkError, //47 |
|
354 SmfTMUnknownProxyError, //48 |
|
355 SmfTMUnknownContentError, //49 |
|
356 SmfTMProtocolFailure, //50 |
|
357 SmfTMUnknownError, //51 |
|
358 SmfTMIAPChanged, //52 |
|
359 SmfTMCancelled, //53 |
|
360 SmfTMUnsupportedContentEncodingFormat, //54 |
|
361 SmfTMInitNetworkNotAvailable , //55 |
|
362 SmfTMInitRoamingNetworkUsageNotEnabled, //56 |
|
363 SmfTMGzipMemoryError, //57 |
|
364 SmfTMGzipStreamError, //58 |
|
365 SmfTMGzipDataError, //59 |
|
366 SmfMemoryAllocationFailure, //60 |
|
367 SmfDbOpeningError, //61 |
|
368 SmfDbQueryExecutonError, //61 |
|
369 SmfDbContactNotExist, //63 |
|
370 SmfErrItemNotInRelation, //64 |
|
371 SmfErrInvalidRelation, //65 |
|
372 SmfUnknownError //66 |
|
373 |
|
374 }; |
|
375 |
|
376 /** |
|
377 * Smf wide panics |
|
378 */ |
|
379 enum SmfPanic |
|
380 { |
|
381 SmfRequestPending//to allow one outstanding request per session |
|
382 }; |
|
383 |
|
384 //interface names |
|
385 const QString contactFetcherInterface("org.symbian.smf.plugin.contact.fetcher\0.2"); |
|
386 const QString postProviderInterface("org.symbian.smf.plugin.contact.posts\0.2"); |
|
387 const QString galleryInterface("org.symbian.smf.plugin.gallery\0.2"); |
|
388 const QString musicServiceInterface("org.symbian.smf.plugin.music.service\0.2"); |
|
389 const QString musicSearchInterface("org.symbian.smf.client.music.search\0.2"); |
|
390 const QString playlistServiceInterface("org.symbian.smf.plugin.music.playlist\0.2"); |
|
391 const QString musicEventServiceInterface("org.symbian.smf.plugin.music.events\0.2"); |
|
392 const QString lyricsServiceInterface("org.symbian.smf.plugin.music.lyrics\0.2"); |
|
393 const QString activityFetcherInterface("org.symbian.smf.plugin.activity.fetcher\0.2"); |
|
394 |
|
395 #endif /* SMFGLOBAL_H_ */ |
|