74 * web queries using the aOperation and aInputData parameters. |
76 * web queries using the aOperation and aInputData parameters. |
75 * @param aInstance Instance of the loaded plugin that perform this operation |
77 * @param aInstance Instance of the loaded plugin that perform this operation |
76 * @param aOperation The type of operation to be performed |
78 * @param aOperation The type of operation to be performed |
77 * @param aInputData The data required to create the web query |
79 * @param aInputData The data required to create the web query |
78 * @param aReqData [out] The request data created by the plugin |
80 * @param aReqData [out] The request data created by the plugin |
79 * @param aResult [out] SmfPluginManagerResult, The result of the operation |
81 * @param aResult [out] SmfError, The result of the operation |
80 * @see smfglobal.h |
82 * It can be :- |
|
83 * SmfPluginNoError (if plugin has created the request successfully) |
|
84 * SmfPluginUnknownPluginService (if plugin service is not known or unsupported) |
|
85 * SmfPluginRequestCreationFailed (if request creation has failed) |
81 */ |
86 */ |
82 void SmfPluginManagerUtil::createRequest ( QObject* aInstance, |
87 void SmfPluginManagerUtil::createRequest ( QObject* aInstance, |
83 const SmfRequestTypeID &aOperation, |
88 const SmfRequestTypeID &aOperation, |
84 QByteArray &aInputData, |
89 QByteArray &aInputData, |
85 SmfPluginRequestData &aReqData, |
90 SmfPluginRequestData &aReqData, |
86 SmfPluginManagerResult &aResult ) |
91 SmfError &aResult ) |
87 { |
92 { |
88 SmfPluginManager::getInstance()->server()->writeLog("SmfPluginManagerUtil::createRequest"); |
93 qDebug()<<"SmfPluginManagerUtil::createRequest()"; |
89 SmfPluginError pluginErrorVal = SmfPluginErrNone; |
94 SmfPluginError pluginErrorVal = SmfPluginErrServiceNotSupported; |
90 |
95 |
91 // Find the type of service required |
96 // Find the type of service required |
92 switch(aOperation) |
97 switch(aOperation) |
93 { |
98 { |
|
99 case SmfActivitySelfActivity: |
|
100 case SmfActivityFriendsActivities: |
|
101 case SmfActivityFiltered: |
|
102 case SmfActivityCustomRequest: |
|
103 // Authorise the plugin and call create request methods |
|
104 pluginErrorVal = createActivityFetcherRequest(aInstance, aOperation, |
|
105 aInputData, aReqData); |
|
106 break; |
|
107 |
94 case SmfContactGetFriends: |
108 case SmfContactGetFriends: |
95 case SmfContactGetFollowers: |
109 case SmfContactGetFollowers: |
96 case SmfContactSearch: |
110 case SmfContactSearch: |
97 case SmfContactSearchNear: |
111 case SmfContactSearchNear: |
98 case SmfContactGetGroups: |
112 case SmfContactGetGroups: |
99 case SmfContactSearchInGroup: |
113 case SmfContactSearchInGroup: |
|
114 case SmfContactCustomRequest: |
100 // Authorise the plugin and call create request methods |
115 // Authorise the plugin and call create request methods |
101 pluginErrorVal = createContactFetcherRequest(aInstance, aOperation, |
116 pluginErrorVal = createContactFetcherRequest(aInstance, aOperation, |
102 aInputData, aReqData, aResult); |
117 aInputData, aReqData); |
103 break; |
118 break; |
104 |
119 |
105 case SmfContactRetrievePosts: |
120 case SmfContactRetrievePosts: |
106 case SmfContactPost: |
121 case SmfContactPost: |
107 case SmfContactUpdatePost: |
122 case SmfContactUpdatePost: |
108 case SmfContactPostDirected: |
123 case SmfContactPostDirected: |
109 case SmfContactCommentOnAPost: |
124 case SmfContactCommentOnAPost: |
110 case SmfContactPostAppearence: |
125 case SmfContactPostAppearence: |
111 case SmfContactSharePost: |
126 case SmfContactSharePost: |
|
127 case SmfContactPostCustomRequest: |
112 // Authorise the plugin and call create request methods |
128 // Authorise the plugin and call create request methods |
113 pluginErrorVal = createContactPostRequest(aInstance, aOperation, |
129 pluginErrorVal = createContactPostRequest(aInstance, aOperation, |
114 aInputData, aReqData, aResult); |
130 aInputData, aReqData); |
115 break; |
131 break; |
116 |
132 |
117 case SmfMusicGetLyrics: |
133 case SmfMusicGetLyrics: |
118 case SmfMusicGetSubtitle: |
134 case SmfMusicGetSubtitle: |
|
135 case SmfMusicLyricsCustomRequest: |
119 // Authorise the plugin and call create request methods |
136 // Authorise the plugin and call create request methods |
120 pluginErrorVal = createMusicLyricsRequest(aInstance, aOperation, |
137 pluginErrorVal = createMusicLyricsRequest(aInstance, aOperation, |
121 aInputData, aReqData, aResult); |
138 aInputData, aReqData); |
122 break; |
139 break; |
123 |
140 |
124 case SmfMusicGetEventsOnLoc: |
141 case SmfMusicGetEventsOnLoc: |
125 case SmfMusicGetVenueOnLoc: |
142 case SmfMusicGetVenueOnLoc: |
126 case SmfMusicGetEventsOnVenue: |
143 case SmfMusicGetEventsOnVenue: |
127 case SmfMusicPostEvents: |
144 case SmfMusicPostEvents: |
|
145 case SmfMusicEventsCustomRequest: |
128 // Authorise the plugin and call create request methods |
146 // Authorise the plugin and call create request methods |
129 pluginErrorVal = createMusicEventsRequest(aInstance, aOperation, |
147 pluginErrorVal = createMusicEventsRequest(aInstance, aOperation, |
130 aInputData, aReqData, aResult); |
148 aInputData, aReqData); |
131 break; |
149 break; |
132 |
150 |
133 case SmfMusicGetRecommendations: |
151 case SmfMusicGetRecommendations: |
134 case SmfMusicGetTracks: |
152 case SmfMusicGetTracks: |
135 case SmfMusicGetTrackInfo: |
153 case SmfMusicGetTrackInfo: |
136 case SmfMusicGetStores: |
154 case SmfMusicGetStores: |
137 case SmfMusicPostCurrentPlaying: |
155 case SmfMusicPostCurrentPlaying: |
|
156 case SmfMusicSearchCustomRequest: |
138 // Authorise the plugin and call create request methods |
157 // Authorise the plugin and call create request methods |
139 pluginErrorVal = createMusicSearchRequest(aInstance, aOperation, |
158 pluginErrorVal = createMusicSearchRequest(aInstance, aOperation, |
140 aInputData, aReqData, aResult); |
159 aInputData, aReqData); |
141 break; |
160 break; |
142 |
161 |
143 case SmfMusicGetUserInfo: |
162 case SmfMusicGetUserInfo: |
144 case SmfMusicSearchUser: |
163 case SmfMusicSearchUser: |
|
164 case SmfMusicServiceCustomRequest: |
145 // Authorise the plugin and call create request methods |
165 // Authorise the plugin and call create request methods |
146 pluginErrorVal = createMusicServiceRequest(aInstance, aOperation, |
166 pluginErrorVal = createMusicServiceRequest(aInstance, aOperation, |
147 aInputData, aReqData, aResult); |
167 aInputData, aReqData); |
148 break; |
168 break; |
149 |
169 |
150 case SmfMusicGetPlaylists: |
170 case SmfMusicGetPlaylists: |
151 case SmfMusicGetPlaylistsOfUser: |
171 case SmfMusicGetPlaylistsOfUser: |
152 case SmfMusicAddToPlaylist: |
172 case SmfMusicAddToPlaylist: |
153 case SmfMusicPostCurrentPlayingPlaylist: |
173 case SmfMusicPostCurrentPlayingPlaylist: |
|
174 case SmfMusicPlaylistCustomRequest: |
154 // Authorise the plugin and call create request methods |
175 // Authorise the plugin and call create request methods |
155 pluginErrorVal = createMusicPlaylistRequest(aInstance, aOperation, |
176 pluginErrorVal = createMusicPlaylistRequest(aInstance, aOperation, |
156 aInputData, aReqData, aResult); |
177 aInputData, aReqData); |
157 break; |
178 break; |
158 |
179 |
159 case SmfPictureGetPictures: |
180 case SmfPictureGetPictures: |
160 case SmfPictureDescription: |
181 case SmfPictureDescription: |
161 case SmfPictureUpload: |
182 case SmfPictureUpload: |
162 case SmfPictureMultiUpload: |
183 case SmfPictureMultiUpload: |
163 case SmfPicturePostComment: |
184 case SmfPicturePostComment: |
|
185 case SmfPictureCustomRequest: |
164 // Authorise the plugin and call create request methods |
186 // Authorise the plugin and call create request methods |
165 pluginErrorVal = createGalleryRequest(aInstance, aOperation, |
187 pluginErrorVal = createGalleryRequest(aInstance, aOperation, |
166 aInputData, aReqData, aResult); |
188 aInputData, aReqData); |
167 break; |
189 break; |
168 |
190 |
169 default: |
191 default: |
170 SmfPluginManager::getInstance()->server()->writeLog("Unknown service type!!!"); |
192 qDebug()<<"Unknown service type!!!"; |
171 aResult = SmfPluginUnknownService; |
193 aResult = SmfPMPluginUnknownPluginService; |
172 } |
194 } |
173 if(SmfPluginErrNone == pluginErrorVal) |
195 qDebug()<<"return value = "<<pluginErrorVal; |
174 aResult = SmfPluginRequestCreated; |
196 |
|
197 // Convert the SmfPluginError error type to SmfError type |
|
198 convertPluginErrorType(pluginErrorVal, aResult); |
|
199 } |
|
200 |
|
201 |
|
202 /** |
|
203 * Method to create a web query to fetch activities |
|
204 * @param aPlugin The instance of the loaded plugin that performs the |
|
205 * contact fetch operation. |
|
206 * @param aOperation The type of operation to be performed |
|
207 * @param aInputData The data required to create the web query |
|
208 * @param aReqData [out] The request data created by the plugin |
|
209 * @return SmfPluginError |
|
210 */ |
|
211 SmfPluginError SmfPluginManagerUtil::createActivityFetcherRequest ( QObject *aPlugin, |
|
212 const SmfRequestTypeID &aOperation, |
|
213 QByteArray &aInputData, |
|
214 SmfPluginRequestData &aReqData ) |
|
215 { |
|
216 qDebug()<<"SmfPluginManagerUtil::createActivityFetcherRequest()"; |
|
217 |
|
218 // typecast instance to the activity - fetcher type, here SmfActivityFetcherPlugin |
|
219 SmfActivityFetcherPlugin *plugin = qobject_cast<SmfActivityFetcherPlugin *>(aPlugin); |
|
220 SmfPluginError pluginErrorVal = SmfPluginErrServiceNotSupported; |
|
221 |
|
222 if(plugin) |
|
223 { |
|
224 QDataStream stream(aInputData); |
|
225 int pageNum, itemPerPage; |
|
226 |
|
227 switch(aOperation) |
|
228 { |
|
229 case SmfActivitySelfActivity: |
|
230 qDebug()<<"Plugin Operation requested : selfactivities()"; |
|
231 stream>>pageNum; |
|
232 stream>>itemPerPage; |
|
233 pluginErrorVal = plugin->selfActivities(aReqData, pageNum, itemPerPage); |
|
234 break; |
|
235 |
|
236 case SmfActivityFriendsActivities: |
|
237 { |
|
238 qDebug()<<"Plugin Operation requested : friendsActivities()"; |
|
239 SmfContact contact; |
|
240 stream>>contact; |
|
241 stream>>pageNum; |
|
242 stream>>itemPerPage; |
|
243 pluginErrorVal = plugin->friendsActivities(aReqData, contact, pageNum, itemPerPage); |
|
244 break; |
|
245 } |
|
246 |
|
247 case SmfActivityFiltered: |
|
248 { |
|
249 qDebug()<<"Plugin Operation requested : filtered()"; |
|
250 QList<SmfActivityObjectType> list; |
|
251 QList<int> intList; |
|
252 stream>>intList; |
|
253 list.clear(); |
|
254 foreach(int val, intList) |
|
255 { |
|
256 SmfActivityObjectType type = (SmfActivityObjectType)val; |
|
257 list.append(type); |
|
258 } |
|
259 |
|
260 stream>>pageNum; |
|
261 stream>>itemPerPage; |
|
262 pluginErrorVal = plugin->filtered(aReqData, list, pageNum, itemPerPage); |
|
263 break; |
|
264 } |
|
265 |
|
266 case SmfActivityCustomRequest: |
|
267 { |
|
268 qDebug()<<"Plugin Operation requested : customRequest()"; |
|
269 int operationType; |
|
270 stream>>operationType; |
|
271 QByteArray data; |
|
272 stream>>data; |
|
273 pluginErrorVal = plugin->customRequest(aReqData, operationType, &data); |
|
274 break; |
|
275 } |
|
276 |
|
277 default: |
|
278 // do nothing, unknown service |
|
279 qDebug()<<"No API found for this operation type!!!"; |
|
280 } |
|
281 } |
175 else |
282 else |
176 aResult = SmfPluginRequestCreationFailed; |
283 { |
|
284 qDebug()<<"Plugin instance couldn't be typecasted!!!"; |
|
285 pluginErrorVal = SmfPluginErrRequestNotCreated; |
|
286 } |
|
287 |
|
288 return pluginErrorVal; |
177 } |
289 } |
178 |
290 |
179 |
291 |
180 /** |
292 /** |
181 * Method to create a web query to fetch contact details. |
293 * Method to create a web query to fetch contact details. |
182 * @param aPlugin The instance of the loaded plugin that performs the |
294 * @param aPlugin The instance of the loaded plugin that performs the |
183 * contact fetch operation. |
295 * contact fetch operation. |
184 * @param aOperation The type of operation to be performed |
296 * @param aOperation The type of operation to be performed |
185 * @param aInputData The data required to create the web query |
297 * @param aInputData The data required to create the web query |
186 * @param aReqData [out] The request data created by the plugin |
298 * @param aReqData [out] The request data created by the plugin |
187 * @param aResult [out] SmfPluginManagerResult, The result of the operation |
299 * @return SmfPluginError, it can be :- |
188 * @return SmfPluginError |
300 * SmfPluginErrNone (if request is created successfully) or |
189 * @see smfglobal.h |
301 * SmfPluginErrServiceNotSupported (if the service requested is not known or unsupported) or |
|
302 * SmfPluginErrInvalidArguments (if the arguments are invalid) or |
|
303 * SmfPluginErrRequestNotCreated (if request could not be created) |
190 */ |
304 */ |
191 SmfPluginError SmfPluginManagerUtil::createContactFetcherRequest ( QObject *aPlugin, |
305 SmfPluginError SmfPluginManagerUtil::createContactFetcherRequest ( QObject *aPlugin, |
192 const SmfRequestTypeID &aOperation, |
306 const SmfRequestTypeID &aOperation, |
193 QByteArray &aInputData, |
307 QByteArray &aInputData, |
194 SmfPluginRequestData &aReqData, |
308 SmfPluginRequestData &aReqData ) |
195 SmfPluginManagerResult &aResult ) |
|
196 { |
309 { |
197 SmfPluginManager::getInstance()->server()->writeLog("SmfPluginManagerUtil::createContactFetcherRequest"); |
310 qDebug()<<"SmfPluginManagerUtil::createContactFetcherRequest()"; |
198 |
311 |
199 // typecast instance to the contact - fetcher type, here SmfContactFetcherPlugin |
312 // typecast instance to the contact - fetcher type, here SmfContactFetcherPlugin |
200 SmfContactFetcherPlugin *plugin = qobject_cast<SmfContactFetcherPlugin *>(aPlugin); |
313 SmfContactFetcherPlugin *plugin = qobject_cast<SmfContactFetcherPlugin *>(aPlugin); |
201 SmfPluginError pluginErrorVal = SmfPluginErrNone; |
314 SmfPluginError pluginErrorVal = SmfPluginErrServiceNotSupported; |
202 |
315 |
203 if(plugin) |
316 if(plugin) |
204 { |
317 { |
205 QDataStream stream(aInputData); |
318 QDataStream stream(aInputData); |
206 int pageNum, itemPerPage; |
319 int pageNum, itemPerPage; |
207 |
320 |
208 switch(aOperation) |
321 switch(aOperation) |
209 { |
322 { |
210 case SmfContactGetFriends: |
323 case SmfContactGetFriends: |
|
324 qDebug()<<"Plugin Operation requested : friends()"; |
211 stream>>pageNum; |
325 stream>>pageNum; |
212 stream>>itemPerPage; |
326 stream>>itemPerPage; |
213 pluginErrorVal = plugin->friends(aReqData, pageNum, itemPerPage); |
327 pluginErrorVal = plugin->friends(aReqData, pageNum, itemPerPage); |
214 break; |
328 break; |
215 |
329 |
216 case SmfContactGetFollowers: |
330 case SmfContactGetFollowers: |
|
331 qDebug()<<"Plugin Operation requested : followers()"; |
217 stream>>pageNum; |
332 stream>>pageNum; |
218 stream>>itemPerPage; |
333 stream>>itemPerPage; |
219 pluginErrorVal = plugin->followers(aReqData, pageNum, itemPerPage); |
334 pluginErrorVal = plugin->followers(aReqData, pageNum, itemPerPage); |
220 break; |
335 break; |
221 |
336 |
222 case SmfContactSearch: |
337 case SmfContactSearch: |
223 { |
338 { |
|
339 qDebug()<<"Plugin Operation requested : search()"; |
224 SmfContact searchContact; |
340 SmfContact searchContact; |
225 stream>>searchContact; |
341 stream>>searchContact; |
226 stream>>pageNum; |
342 stream>>pageNum; |
227 stream>>itemPerPage; |
343 stream>>itemPerPage; |
228 pluginErrorVal = plugin->search(aReqData, searchContact, pageNum, itemPerPage); |
344 pluginErrorVal = plugin->search(aReqData, searchContact, pageNum, itemPerPage); |
229 break; |
345 break; |
230 } |
346 } |
231 |
347 |
232 case SmfContactSearchNear: |
348 case SmfContactSearchNear: |
233 { |
349 { |
|
350 qDebug()<<"Plugin Operation requested : searchNear()"; |
234 SmfLocation location; |
351 SmfLocation location; |
235 int i; |
352 int i; |
236 stream>>i; |
353 stream>>i; |
237 SmfLocationSearchBoundary proximity = (SmfLocationSearchBoundary)i; |
354 SmfLocationSearchBoundary proximity = (SmfLocationSearchBoundary)i; |
238 stream>>pageNum; |
355 stream>>pageNum; |
391 * @param aPlugin The instance of the loaded plugin that performs the |
536 * @param aPlugin The instance of the loaded plugin that performs the |
392 * contact fetch operation. |
537 * contact fetch operation. |
393 * @param aOperation The type of operation to be performed |
538 * @param aOperation The type of operation to be performed |
394 * @param aInputData The data required to create the web query |
539 * @param aInputData The data required to create the web query |
395 * @param aReqData [out] The request data created by the plugin |
540 * @param aReqData [out] The request data created by the plugin |
396 * @param aResult [out] SmfPluginManagerResult, The result of the operation |
541 * @return SmfPluginError, it can be :- |
397 * @return SmfPluginError |
542 * SmfPluginErrNone (if request is created successfully) or |
398 * @see smfglobal.h |
543 * SmfPluginErrServiceNotSupported (if the service requested is not known or unsupported) or |
|
544 * SmfPluginErrInvalidArguments (if the arguments are invalid) or |
|
545 * SmfPluginErrRequestNotCreated (if request could not be created) |
399 */ |
546 */ |
400 SmfPluginError SmfPluginManagerUtil::createMusicLyricsRequest ( QObject *aPlugin, |
547 SmfPluginError SmfPluginManagerUtil::createMusicLyricsRequest ( QObject *aPlugin, |
401 const SmfRequestTypeID &aOperation, |
548 const SmfRequestTypeID &aOperation, |
402 QByteArray &aInputData, |
549 QByteArray &aInputData, |
403 SmfPluginRequestData &aReqData, |
550 SmfPluginRequestData &aReqData ) |
404 SmfPluginManagerResult &aResult ) |
|
405 { |
551 { |
406 SmfPluginManager::getInstance()->server()->writeLog("SmfPluginManagerUtil::createMusicLyricsRequest"); |
552 qDebug()<<"SmfPluginManagerUtil::createMusicLyricsRequest"; |
407 |
553 |
408 // typecast instance to SmfLyricsServicePlugin |
554 // typecast instance to SmfLyricsServicePlugin |
409 SmfLyricsServicePlugin *plugin = qobject_cast<SmfLyricsServicePlugin *>(aPlugin); |
555 SmfLyricsServicePlugin *plugin = qobject_cast<SmfLyricsServicePlugin *>(aPlugin); |
410 SmfPluginError pluginErrorVal = SmfPluginErrNone; |
556 SmfPluginError pluginErrorVal = SmfPluginErrServiceNotSupported; |
411 |
557 |
412 if(plugin) |
558 if(plugin) |
413 { |
559 { |
414 QDataStream stream(aInputData); |
560 QDataStream stream(aInputData); |
415 SmfTrackInfo trackInfo; |
561 SmfTrackInfo trackInfo; |
416 int pageNum, itemPerPage; |
562 int pageNum, itemPerPage; |
417 |
563 |
418 switch(aOperation) |
564 switch(aOperation) |
419 { |
565 { |
420 case SmfMusicGetLyrics: |
566 case SmfMusicGetLyrics: |
|
567 qDebug()<<"Plugin Operation requested : lyrics()"; |
421 stream>>trackInfo; |
568 stream>>trackInfo; |
422 stream>>pageNum; |
569 stream>>pageNum; |
423 stream>>itemPerPage; |
570 stream>>itemPerPage; |
424 pluginErrorVal = plugin->lyrics(aReqData, trackInfo, pageNum, itemPerPage); |
571 pluginErrorVal = plugin->lyrics(aReqData, trackInfo, pageNum, itemPerPage); |
425 break; |
572 break; |
426 |
573 |
427 case SmfMusicGetSubtitle: |
574 case SmfMusicGetSubtitle: |
428 { |
575 { |
|
576 qDebug()<<"Plugin Operation requested : subtitles()"; |
429 stream>>trackInfo; |
577 stream>>trackInfo; |
430 int i; |
578 int i; |
431 stream>>i; |
579 stream>>i; |
432 SmfSubtitleSearchFilter filter = (SmfSubtitleSearchFilter)i; |
580 SmfSubtitleSearchFilter filter = (SmfSubtitleSearchFilter)i; |
433 stream>>pageNum; |
581 stream>>pageNum; |
434 stream>>itemPerPage; |
582 stream>>itemPerPage; |
435 pluginErrorVal = plugin->subtitles(aReqData, trackInfo, filter, pageNum, itemPerPage); |
583 pluginErrorVal = plugin->subtitles(aReqData, trackInfo, filter, pageNum, itemPerPage); |
436 break; |
584 break; |
437 } |
585 } |
438 |
586 |
|
587 case SmfMusicLyricsCustomRequest: |
|
588 { |
|
589 qDebug()<<"Plugin Operation requested : customRequest()"; |
|
590 int operationType; |
|
591 stream>>operationType; |
|
592 QByteArray data; |
|
593 stream>>data; |
|
594 pluginErrorVal = plugin->customRequest(aReqData, operationType, &data); |
|
595 break; |
|
596 } |
|
597 |
439 default: |
598 default: |
440 // do nothing, unknown service |
599 // do nothing, unknown service |
441 aResult = SmfPluginUnknownService; |
600 qDebug()<<"No API found for this operation type!!!"; |
442 SmfPluginManager::getInstance()->server()->writeLog("No API found for this operation type!!!"); |
601 } |
443 return SmfPluginErrInvalidRequest; |
602 } |
444 } |
603 else |
445 |
604 { |
446 if(SmfPluginErrNone == pluginErrorVal) |
605 qDebug()<<"Plugin instance couldn't be typecasted!!!"; |
447 aResult = SmfPluginRequestCreated; |
606 pluginErrorVal = SmfPluginErrRequestNotCreated; |
448 else |
607 } |
449 aResult = SmfPluginServiceError; |
|
450 } |
|
451 else |
|
452 aResult = SmfPluginLoadError; |
|
453 |
608 |
454 return pluginErrorVal; |
609 return pluginErrorVal; |
455 } |
610 } |
456 |
611 |
457 |
612 |
460 * @param aPlugin The instance of the loaded plugin that performs the |
615 * @param aPlugin The instance of the loaded plugin that performs the |
461 * contact fetch operation. |
616 * contact fetch operation. |
462 * @param aOperation The type of operation to be performed |
617 * @param aOperation The type of operation to be performed |
463 * @param aInputData The data required to create the web query |
618 * @param aInputData The data required to create the web query |
464 * @param aReqData [out] The request data created by the plugin |
619 * @param aReqData [out] The request data created by the plugin |
465 * @param aResult [out] SmfPluginManagerResult, The result of the operation |
620 * @return SmfPluginError, it can be :- |
466 * @return SmfPluginError |
621 * SmfPluginErrNone (if request is created successfully) or |
467 * @see smfglobal.h |
622 * SmfPluginErrServiceNotSupported (if the service requested is not known or unsupported) or |
|
623 * SmfPluginErrInvalidArguments (if the arguments are invalid) or |
|
624 * SmfPluginErrRequestNotCreated (if request could not be created) |
468 */ |
625 */ |
469 SmfPluginError SmfPluginManagerUtil::createMusicEventsRequest ( QObject *aPlugin, |
626 SmfPluginError SmfPluginManagerUtil::createMusicEventsRequest ( QObject *aPlugin, |
470 const SmfRequestTypeID &aOperation, |
627 const SmfRequestTypeID &aOperation, |
471 QByteArray &aInputData, |
628 QByteArray &aInputData, |
472 SmfPluginRequestData &aReqData, |
629 SmfPluginRequestData &aReqData ) |
473 SmfPluginManagerResult &aResult ) |
|
474 { |
630 { |
475 SmfPluginManager::getInstance()->server()->writeLog("SmfPluginManagerUtil::createMusicEventsRequest"); |
631 qDebug()<<"SmfPluginManagerUtil::createMusicEventsRequest"; |
476 |
632 |
477 // typecast instance to SmfMusicEventsPlugin |
633 // typecast instance to SmfMusicEventsPlugin |
478 SmfMusicEventsPlugin *plugin = qobject_cast<SmfMusicEventsPlugin *>(aPlugin); |
634 SmfMusicEventsPlugin *plugin = qobject_cast<SmfMusicEventsPlugin *>(aPlugin); |
479 SmfPluginError pluginErrorVal = SmfPluginErrNone; |
635 SmfPluginError pluginErrorVal = SmfPluginErrServiceNotSupported; |
480 |
636 |
481 if(plugin) |
637 if(plugin) |
482 { |
638 { |
483 QDataStream stream(aInputData); |
639 QDataStream stream(aInputData); |
484 int pageNum, itemPerPage; |
640 int pageNum, itemPerPage; |
485 QtMobility::QGeoPositionInfo location; |
641 QtMobility::QGeoPositionInfo location; |
486 |
642 |
487 switch(aOperation) |
643 switch(aOperation) |
488 { |
644 { |
489 case SmfMusicGetEventsOnLoc: |
645 case SmfMusicGetEventsOnLoc: |
|
646 qDebug()<<"Plugin Operation requested : events() OnLoc"; |
490 stream>>location; |
647 stream>>location; |
491 stream>>pageNum; |
648 stream>>pageNum; |
492 stream>>itemPerPage; |
649 stream>>itemPerPage; |
493 pluginErrorVal = plugin->events(aReqData, location, pageNum, itemPerPage); |
650 pluginErrorVal = plugin->events(aReqData, location, pageNum, itemPerPage); |
494 break; |
651 break; |
495 |
652 |
496 case SmfMusicGetVenueOnLoc: |
653 case SmfMusicGetVenueOnLoc: |
|
654 qDebug()<<"Plugin Operation requested : venues()"; |
497 stream>>location; |
655 stream>>location; |
498 stream>>pageNum; |
656 stream>>pageNum; |
499 stream>>itemPerPage; |
657 stream>>itemPerPage; |
500 pluginErrorVal = plugin->venues(aReqData, location, pageNum, itemPerPage); |
658 pluginErrorVal = plugin->venues(aReqData, location, pageNum, itemPerPage); |
501 break; |
659 break; |
502 |
660 |
503 case SmfMusicGetEventsOnVenue: |
661 case SmfMusicGetEventsOnVenue: |
504 { |
662 { |
|
663 qDebug()<<"Plugin Operation requested : events() OnVenue"; |
505 SmfLocation venue; |
664 SmfLocation venue; |
506 stream>>venue; |
665 stream>>venue; |
507 stream>>pageNum; |
666 stream>>pageNum; |
508 stream>>itemPerPage; |
667 stream>>itemPerPage; |
509 pluginErrorVal = plugin->events(aReqData, venue, pageNum, itemPerPage); |
668 pluginErrorVal = plugin->events(aReqData, venue, pageNum, itemPerPage); |
510 break; |
669 break; |
511 } |
670 } |
512 |
671 |
513 case SmfMusicPostEvents: |
672 case SmfMusicPostEvents: |
514 { |
673 { |
|
674 qDebug()<<"Plugin Operation requested : postEvents()"; |
515 QList<SmfEvent> list; |
675 QList<SmfEvent> list; |
516 stream>>list; |
676 stream>>list; |
517 pluginErrorVal = plugin->postEvents(aReqData, list); |
677 pluginErrorVal = plugin->postEvents(aReqData, list); |
518 break; |
678 break; |
519 } |
679 } |
520 |
680 |
|
681 case SmfMusicEventsCustomRequest: |
|
682 { |
|
683 qDebug()<<"Plugin Operation requested : customRequest()"; |
|
684 int operationType; |
|
685 stream>>operationType; |
|
686 QByteArray data; |
|
687 stream>>data; |
|
688 pluginErrorVal = plugin->customRequest(aReqData, operationType, &data); |
|
689 break; |
|
690 } |
|
691 |
521 default: |
692 default: |
522 // do nothing, unknown service |
693 // do nothing, unknown service |
523 aResult = SmfPluginUnknownService; |
694 qDebug()<<"No API found for this operation type!!!"; |
524 SmfPluginManager::getInstance()->server()->writeLog("No API found for this operation type!!!"); |
695 } |
525 return SmfPluginErrInvalidRequest; |
696 } |
526 } |
697 else |
527 |
698 { |
528 if(SmfPluginErrNone == pluginErrorVal) |
699 qDebug()<<"Plugin instance couldn't be typecasted!!!"; |
529 aResult = SmfPluginRequestCreated; |
700 pluginErrorVal = SmfPluginErrRequestNotCreated; |
530 else |
701 } |
531 aResult = SmfPluginServiceError; |
|
532 } |
|
533 else |
|
534 aResult = SmfPluginLoadError; |
|
535 |
702 |
536 return pluginErrorVal; |
703 return pluginErrorVal; |
537 } |
704 } |
538 |
705 |
539 |
706 |
543 * @param aPlugin The instance of the loaded plugin that performs the |
710 * @param aPlugin The instance of the loaded plugin that performs the |
544 * contact fetch operation. |
711 * contact fetch operation. |
545 * @param aOperation The type of operation to be performed |
712 * @param aOperation The type of operation to be performed |
546 * @param aInputData The data required to create the web query |
713 * @param aInputData The data required to create the web query |
547 * @param aReqData [out] The request data created by the plugin |
714 * @param aReqData [out] The request data created by the plugin |
548 * @param aResult [out] SmfPluginManagerResult, The result of the operation |
715 * @return SmfPluginError, it can be :- |
549 * @return SmfPluginError |
716 * SmfPluginErrNone (if request is created successfully) or |
550 * @see smfglobal.h |
717 * SmfPluginErrServiceNotSupported (if the service requested is not known or unsupported) or |
|
718 * SmfPluginErrInvalidArguments (if the arguments are invalid) or |
|
719 * SmfPluginErrRequestNotCreated (if request could not be created) |
551 */ |
720 */ |
552 SmfPluginError SmfPluginManagerUtil::createMusicSearchRequest ( QObject *aPlugin, |
721 SmfPluginError SmfPluginManagerUtil::createMusicSearchRequest ( QObject *aPlugin, |
553 const SmfRequestTypeID &aOperation, |
722 const SmfRequestTypeID &aOperation, |
554 QByteArray &aInputData, |
723 QByteArray &aInputData, |
555 SmfPluginRequestData &aReqData, |
724 SmfPluginRequestData &aReqData ) |
556 SmfPluginManagerResult &aResult ) |
|
557 { |
725 { |
558 SmfPluginManager::getInstance()->server()->writeLog("SmfPluginManagerUtil::createMusicSearchRequest"); |
726 qDebug()<<"SmfPluginManagerUtil::createMusicSearchRequest"; |
559 |
727 |
560 // typecast instance to SmfMusicSearchPlugin |
728 // typecast instance to SmfMusicSearchPlugin |
561 SmfMusicSearchPlugin *plugin = qobject_cast<SmfMusicSearchPlugin *>(aPlugin); |
729 SmfMusicSearchPlugin *plugin = qobject_cast<SmfMusicSearchPlugin *>(aPlugin); |
562 SmfPluginError pluginErrorVal = SmfPluginErrNone; |
730 SmfPluginError pluginErrorVal = SmfPluginErrServiceNotSupported; |
563 |
731 |
564 if(plugin) |
732 if(plugin) |
565 { |
733 { |
566 QDataStream stream(aInputData); |
734 QDataStream stream(aInputData); |
567 int pageNum, itemPerPage; |
735 int pageNum, itemPerPage; |
568 SmfTrackInfo trackInfo; |
736 SmfTrackInfo trackInfo; |
569 |
737 |
570 switch(aOperation) |
738 switch(aOperation) |
571 { |
739 { |
572 case SmfMusicGetRecommendations: |
740 case SmfMusicGetRecommendations: |
|
741 qDebug()<<"Plugin Operation requested : recommendations()"; |
573 stream>>trackInfo; |
742 stream>>trackInfo; |
574 stream>>pageNum; |
743 stream>>pageNum; |
575 stream>>itemPerPage; |
744 stream>>itemPerPage; |
576 pluginErrorVal = plugin->recommendations(aReqData, trackInfo, pageNum, itemPerPage); |
745 pluginErrorVal = plugin->recommendations(aReqData, trackInfo, pageNum, itemPerPage); |
577 break; |
746 break; |
578 |
747 |
579 case SmfMusicGetTracks: |
748 case SmfMusicGetTracks: |
|
749 qDebug()<<"Plugin Operation requested : tracks()"; |
580 stream>>trackInfo; |
750 stream>>trackInfo; |
581 stream>>pageNum; |
751 stream>>pageNum; |
582 stream>>itemPerPage; |
752 stream>>itemPerPage; |
583 pluginErrorVal = plugin->tracks(aReqData, trackInfo, pageNum, itemPerPage); |
753 pluginErrorVal = plugin->tracks(aReqData, trackInfo, pageNum, itemPerPage); |
584 break; |
754 break; |
585 |
755 |
586 case SmfMusicGetTrackInfo: |
756 case SmfMusicGetTrackInfo: |
587 { |
757 { |
|
758 qDebug()<<"Plugin Operation requested : trackInfo()"; |
588 SmfMusicFingerPrint fp; |
759 SmfMusicFingerPrint fp; |
589 stream>>fp; |
760 stream>>fp; |
590 stream>>pageNum; |
761 stream>>pageNum; |
591 stream>>itemPerPage; |
762 stream>>itemPerPage; |
592 pluginErrorVal = plugin->trackInfo(aReqData, fp, pageNum, itemPerPage); |
763 pluginErrorVal = plugin->trackInfo(aReqData, fp, pageNum, itemPerPage); |
593 break; |
764 break; |
594 } |
765 } |
595 |
766 |
596 case SmfMusicGetStores: |
767 case SmfMusicGetStores: |
|
768 qDebug()<<"Plugin Operation requested : stores()"; |
597 stream>>trackInfo; |
769 stream>>trackInfo; |
598 stream>>pageNum; |
770 stream>>pageNum; |
599 stream>>itemPerPage; |
771 stream>>itemPerPage; |
600 pluginErrorVal = plugin->stores(aReqData, trackInfo, pageNum, itemPerPage); |
772 pluginErrorVal = plugin->stores(aReqData, trackInfo, pageNum, itemPerPage); |
601 break; |
773 break; |
602 |
774 |
603 case SmfMusicPostCurrentPlaying: |
775 case SmfMusicPostCurrentPlaying: |
|
776 qDebug()<<"Plugin Operation requested : postCurrentPlaying()"; |
604 stream>>trackInfo; |
777 stream>>trackInfo; |
605 pluginErrorVal = plugin->postCurrentPlaying(aReqData, trackInfo); |
778 pluginErrorVal = plugin->postCurrentPlaying(aReqData, trackInfo); |
606 break; |
779 break; |
607 |
780 |
|
781 case SmfMusicPostRating: |
|
782 { |
|
783 qDebug()<<"Plugin Operation requested : postRating()"; |
|
784 stream>>trackInfo; |
|
785 SmfMusicRating rating; |
|
786 stream>>rating; |
|
787 pluginErrorVal = plugin->postRating(aReqData, trackInfo, rating); |
|
788 break; |
|
789 } |
|
790 |
|
791 case SmfMusicPostComment: |
|
792 { |
|
793 qDebug()<<"Plugin Operation requested : postComment()"; |
|
794 stream>>trackInfo; |
|
795 SmfComment comment; |
|
796 stream>>comment; |
|
797 pluginErrorVal = plugin->postComments(aReqData, trackInfo, comment); |
|
798 break; |
|
799 } |
|
800 |
|
801 case SmfMusicSearchCustomRequest: |
|
802 { |
|
803 qDebug()<<"Plugin Operation requested : customRequest()"; |
|
804 int operationType; |
|
805 stream>>operationType; |
|
806 QByteArray data; |
|
807 stream>>data; |
|
808 pluginErrorVal = plugin->customRequest(aReqData, operationType, &data); |
|
809 break; |
|
810 } |
|
811 |
608 default: |
812 default: |
609 // do nothing, unknown service |
813 // do nothing, unknown service |
610 aResult = SmfPluginUnknownService; |
814 qDebug()<<"No API found for this operation type!!!"; |
611 SmfPluginManager::getInstance()->server()->writeLog("No API found for this operation type!!!"); |
815 } |
612 return SmfPluginErrInvalidRequest; |
816 } |
613 } |
817 else |
614 |
818 { |
615 if(SmfPluginErrNone == pluginErrorVal) |
819 qDebug()<<"Plugin instance couldn't be typecasted!!!"; |
616 aResult = SmfPluginRequestCreated; |
820 pluginErrorVal = SmfPluginErrRequestNotCreated; |
617 else |
821 } |
618 aResult = SmfPluginServiceError; |
|
619 } |
|
620 else |
|
621 aResult = SmfPluginLoadError; |
|
622 |
822 |
623 return pluginErrorVal; |
823 return pluginErrorVal; |
624 } |
824 } |
625 |
825 |
626 |
826 |
630 * @param aPlugin The instance of the loaded plugin that performs the |
830 * @param aPlugin The instance of the loaded plugin that performs the |
631 * contact fetch operation. |
831 * contact fetch operation. |
632 * @param aOperation The type of operation to be performed |
832 * @param aOperation The type of operation to be performed |
633 * @param aInputData The data required to create the web query |
833 * @param aInputData The data required to create the web query |
634 * @param aReqData [out] The request data created by the plugin |
834 * @param aReqData [out] The request data created by the plugin |
635 * @param aResult [out] SmfPluginManagerResult, The result of the operation |
835 * @return SmfPluginError, it can be :- |
636 * @return SmfPluginError |
836 * SmfPluginErrNone (if request is created successfully) or |
637 * @see smfglobal.h |
837 * SmfPluginErrServiceNotSupported (if the service requested is not known or unsupported) or |
|
838 * SmfPluginErrInvalidArguments (if the arguments are invalid) or |
|
839 * SmfPluginErrRequestNotCreated (if request could not be created) |
638 */ |
840 */ |
639 SmfPluginError SmfPluginManagerUtil::createMusicServiceRequest ( QObject *aPlugin, |
841 SmfPluginError SmfPluginManagerUtil::createMusicServiceRequest ( QObject *aPlugin, |
640 const SmfRequestTypeID &aOperation, |
842 const SmfRequestTypeID &aOperation, |
641 QByteArray &aInputData, |
843 QByteArray &aInputData, |
642 SmfPluginRequestData &aReqData, |
844 SmfPluginRequestData &aReqData ) |
643 SmfPluginManagerResult &aResult ) |
|
644 { |
845 { |
645 SmfPluginManager::getInstance()->server()->writeLog("SmfPluginManagerUtil::createMusicServiceRequest"); |
846 qDebug()<<"SmfPluginManagerUtil::createMusicServiceRequest"; |
646 |
847 |
647 // typecast instance to SmfMusicServicePlugin |
848 // typecast instance to SmfMusicServicePlugin |
648 SmfMusicServicePlugin *plugin = qobject_cast<SmfMusicServicePlugin *>(aPlugin); |
849 SmfMusicServicePlugin *plugin = qobject_cast<SmfMusicServicePlugin *>(aPlugin); |
649 SmfPluginError pluginErrorVal = SmfPluginErrNone; |
850 SmfPluginError pluginErrorVal = SmfPluginErrServiceNotSupported; |
650 |
851 |
651 if(plugin) |
852 if(plugin) |
652 { |
853 { |
653 QDataStream stream(aInputData); |
854 QDataStream stream(aInputData); |
654 int pageNum, itemPerPage; |
855 int pageNum, itemPerPage; |
655 |
856 |
656 switch(aOperation) |
857 switch(aOperation) |
657 { |
858 { |
658 case SmfMusicGetUserInfo: |
859 case SmfMusicGetUserInfo: |
|
860 qDebug()<<"Plugin Operation requested : userInfo()"; |
659 pluginErrorVal = plugin->userInfo(aReqData); |
861 pluginErrorVal = plugin->userInfo(aReqData); |
660 break; |
862 break; |
661 |
863 |
662 case SmfMusicSearchUser: |
864 case SmfMusicSearchUser: |
663 { |
865 { |
|
866 qDebug()<<"Plugin Operation requested : serachNear() for Music"; |
664 SmfLocation place; |
867 SmfLocation place; |
665 stream>>place; |
868 stream>>place; |
666 stream>>pageNum; |
869 stream>>pageNum; |
667 stream>>itemPerPage; |
870 stream>>itemPerPage; |
668 pluginErrorVal = plugin->searchUser(aReqData, place, pageNum, itemPerPage); |
871 pluginErrorVal = plugin->searchUser(aReqData, place, pageNum, itemPerPage); |
669 break; |
872 break; |
670 } |
873 } |
671 |
874 |
|
875 case SmfMusicServiceCustomRequest: |
|
876 { |
|
877 qDebug()<<"Plugin Operation requested : customRequest()"; |
|
878 int operationType; |
|
879 stream>>operationType; |
|
880 QByteArray data; |
|
881 stream>>data; |
|
882 pluginErrorVal = plugin->customRequest(aReqData, operationType, &data); |
|
883 break; |
|
884 } |
|
885 |
672 default: |
886 default: |
673 // do nothing, unknown service |
887 // do nothing, unknown service |
674 aResult = SmfPluginUnknownService; |
888 qDebug()<<"No API found for this operation type!!!"; |
675 SmfPluginManager::getInstance()->server()->writeLog("No API found for this operation type!!!"); |
889 } |
676 return SmfPluginErrInvalidRequest; |
890 } |
677 } |
891 else |
678 |
892 { |
679 if(SmfPluginErrNone == pluginErrorVal) |
893 qDebug()<<"Plugin instance couldn't be typecasted!!!"; |
680 aResult = SmfPluginRequestCreated; |
894 pluginErrorVal = SmfPluginErrRequestNotCreated; |
681 else |
895 } |
682 aResult = SmfPluginServiceError; |
|
683 } |
|
684 else |
|
685 aResult = SmfPluginLoadError; |
|
686 |
896 |
687 return pluginErrorVal; |
897 return pluginErrorVal; |
688 } |
898 } |
689 |
899 |
690 |
900 |
694 * @param aPlugin The instance of the loaded plugin that performs the |
904 * @param aPlugin The instance of the loaded plugin that performs the |
695 * contact fetch operation. |
905 * contact fetch operation. |
696 * @param aOperation The type of operation to be performed |
906 * @param aOperation The type of operation to be performed |
697 * @param aInputData The data required to create the web query |
907 * @param aInputData The data required to create the web query |
698 * @param aReqData [out] The request data created by the plugin |
908 * @param aReqData [out] The request data created by the plugin |
699 * @param aResult [out] SmfPluginManagerResult, The result of the operation |
909 * @return SmfPluginError, it can be :- |
700 * @return SmfPluginError |
910 * SmfPluginErrNone (if request is created successfully) or |
701 * @see smfglobal.h |
911 * SmfPluginErrServiceNotSupported (if the service requested is not known or unsupported) or |
|
912 * SmfPluginErrInvalidArguments (if the arguments are invalid) or |
|
913 * SmfPluginErrRequestNotCreated (if request could not be created) |
702 */ |
914 */ |
703 SmfPluginError SmfPluginManagerUtil::createMusicPlaylistRequest ( QObject *aPlugin, |
915 SmfPluginError SmfPluginManagerUtil::createMusicPlaylistRequest ( QObject *aPlugin, |
704 const SmfRequestTypeID &aOperation, |
916 const SmfRequestTypeID &aOperation, |
705 QByteArray &aInputData, |
917 QByteArray &aInputData, |
706 SmfPluginRequestData &aReqData, |
918 SmfPluginRequestData &aReqData ) |
707 SmfPluginManagerResult &aResult ) |
|
708 { |
919 { |
709 SmfPluginManager::getInstance()->server()->writeLog("SmfPluginManagerUtil::createMusicPlaylistRequest"); |
920 qDebug()<<"SmfPluginManagerUtil::createMusicPlaylistRequest"; |
710 |
921 |
711 // typecast instance to SmfPlaylistServicePlugin |
922 // typecast instance to SmfPlaylistServicePlugin |
712 SmfPlaylistServicePlugin *plugin = qobject_cast<SmfPlaylistServicePlugin *>(aPlugin); |
923 SmfPlaylistServicePlugin *plugin = qobject_cast<SmfPlaylistServicePlugin *>(aPlugin); |
713 SmfPluginError pluginErrorVal = SmfPluginErrNone; |
924 SmfPluginError pluginErrorVal = SmfPluginErrServiceNotSupported; |
714 |
925 |
715 if(plugin) |
926 if(plugin) |
716 { |
927 { |
717 QDataStream stream(aInputData); |
928 QDataStream stream(aInputData); |
718 int pageNum, itemPerPage; |
929 int pageNum, itemPerPage; |
719 SmfPlaylist playlist; |
930 SmfPlaylist playlist; |
720 |
931 |
721 switch(aOperation) |
932 switch(aOperation) |
722 { |
933 { |
723 case SmfMusicGetPlaylists: |
934 case SmfMusicGetPlaylists: |
|
935 qDebug()<<"Plugin Operation requested : playlists()"; |
724 stream>>pageNum; |
936 stream>>pageNum; |
725 stream>>itemPerPage; |
937 stream>>itemPerPage; |
726 pluginErrorVal = plugin->playlists(aReqData, pageNum, itemPerPage); |
938 pluginErrorVal = plugin->playlists(aReqData, pageNum, itemPerPage); |
727 break; |
939 break; |
728 |
940 |
729 case SmfMusicGetPlaylistsOfUser: |
941 case SmfMusicGetPlaylistsOfUser: |
730 { |
942 { |
|
943 qDebug()<<"Plugin Operation requested : playlistsOf()"; |
731 SmfMusicProfile user; |
944 SmfMusicProfile user; |
732 stream>>user; |
945 stream>>user; |
733 stream>>pageNum; |
946 stream>>pageNum; |
734 stream>>itemPerPage; |
947 stream>>itemPerPage; |
735 pluginErrorVal = plugin->playlistsOf(aReqData, user, pageNum, itemPerPage); |
948 pluginErrorVal = plugin->playlistsOf(aReqData, user, pageNum, itemPerPage); |
736 break; |
949 break; |
737 } |
950 } |
738 |
951 |
739 case SmfMusicAddToPlaylist: |
952 case SmfMusicAddToPlaylist: |
740 { |
953 { |
|
954 qDebug()<<"Plugin Operation requested : addToPlaylist()"; |
741 QList<SmfTrackInfo> list; |
955 QList<SmfTrackInfo> list; |
742 stream>>playlist; |
956 stream>>playlist; |
743 stream>>list; |
957 stream>>list; |
744 pluginErrorVal = plugin->addToPlaylist(aReqData, playlist, list); |
958 pluginErrorVal = plugin->addToPlaylist(aReqData, playlist, list); |
745 break; |
959 break; |
746 } |
960 } |
747 |
961 |
748 case SmfMusicPostCurrentPlayingPlaylist: |
962 case SmfMusicPostCurrentPlayingPlaylist: |
|
963 qDebug()<<"Plugin Operation requested : postCurrentPlayingPlaylist()"; |
749 stream>>playlist; |
964 stream>>playlist; |
750 pluginErrorVal = plugin->postCurrentPlayingPlaylist(aReqData, playlist); |
965 pluginErrorVal = plugin->postCurrentPlayingPlaylist(aReqData, playlist); |
751 break; |
966 break; |
752 |
967 |
|
968 case SmfMusicPlaylistCustomRequest: |
|
969 { |
|
970 qDebug()<<"Plugin Operation requested : customRequest()"; |
|
971 int operationType; |
|
972 stream>>operationType; |
|
973 QByteArray data; |
|
974 stream>>data; |
|
975 pluginErrorVal = plugin->customRequest(aReqData, operationType, &data); |
|
976 break; |
|
977 } |
|
978 |
753 default: |
979 default: |
754 // do nothing, unknown service |
980 // do nothing, unknown service |
755 aResult = SmfPluginUnknownService; |
981 qDebug()<<"No API found for this operation type!!!"; |
756 SmfPluginManager::getInstance()->server()->writeLog("No API found for this operation type!!!"); |
982 } |
757 return SmfPluginErrInvalidRequest; |
983 } |
758 } |
984 else |
759 |
985 { |
760 if(SmfPluginErrNone == pluginErrorVal) |
986 qDebug()<<"Plugin instance couldn't be typecasted!!!"; |
761 aResult = SmfPluginRequestCreated; |
987 pluginErrorVal = SmfPluginErrRequestNotCreated; |
762 else |
988 } |
763 aResult = SmfPluginServiceError; |
|
764 } |
|
765 else |
|
766 aResult = SmfPluginLoadError; |
|
767 |
989 |
768 return pluginErrorVal; |
990 return pluginErrorVal; |
769 } |
991 } |
770 |
992 |
771 |
993 |
774 * @param aPlugin The instance of the loaded plugin that performs the |
996 * @param aPlugin The instance of the loaded plugin that performs the |
775 * contact fetch operation. |
997 * contact fetch operation. |
776 * @param aOperation The type of operation to be performed |
998 * @param aOperation The type of operation to be performed |
777 * @param aInputData The data required to create the web query |
999 * @param aInputData The data required to create the web query |
778 * @param aReqData [out] The request data created by the plugin |
1000 * @param aReqData [out] The request data created by the plugin |
779 * @param aResult [out] SmfPluginManagerResult, The result of the operation |
1001 * @return SmfPluginError, it can be :- |
780 * @return SmfPluginError |
1002 * SmfPluginErrNone (if request is created successfully) or |
781 * @see smfglobal.h |
1003 * SmfPluginErrServiceNotSupported (if the service requested is not known or unsupported) or |
|
1004 * SmfPluginErrInvalidArguments (if the arguments are invalid) or |
|
1005 * SmfPluginErrRequestNotCreated (if request could not be created) |
782 */ |
1006 */ |
783 SmfPluginError SmfPluginManagerUtil::createGalleryRequest ( QObject *aPlugin, |
1007 SmfPluginError SmfPluginManagerUtil::createGalleryRequest ( QObject *aPlugin, |
784 const SmfRequestTypeID &aOperation, |
1008 const SmfRequestTypeID &aOperation, |
785 QByteArray &aInputData, |
1009 QByteArray &aInputData, |
786 SmfPluginRequestData &aReqData, |
1010 SmfPluginRequestData &aReqData ) |
787 SmfPluginManagerResult &aResult ) |
|
788 { |
1011 { |
789 SmfPluginManager::getInstance()->server()->writeLog("SmfPluginManagerUtil::createGalleryRequest"); |
1012 qDebug()<<"SmfPluginManagerUtil::createGalleryRequest"; |
790 |
1013 |
791 // typecast instance to SmfGalleryPlugin |
1014 // typecast instance to SmfGalleryPlugin |
792 SmfGalleryPlugin *plugin = qobject_cast<SmfGalleryPlugin *>(aPlugin); |
1015 SmfGalleryPlugin *plugin = qobject_cast<SmfGalleryPlugin *>(aPlugin); |
793 SmfPluginError pluginErrorVal = SmfPluginErrNone; |
1016 SmfPluginError pluginErrorVal = SmfPluginErrServiceNotSupported; |
794 |
1017 |
795 if(plugin) |
1018 if(plugin) |
796 { |
1019 { |
797 QDataStream stream(aInputData); |
1020 QDataStream stream(aInputData); |
798 SmfPicture picture; |
1021 SmfPicture picture; |
799 |
1022 |
800 switch(aOperation) |
1023 switch(aOperation) |
801 { |
1024 { |
|
1025 |
|
1026 case SmfPictureGetAlbums: |
|
1027 { |
|
1028 qDebug()<<"Plugin Operation requested : albums()"; |
|
1029 QStringList names; |
|
1030 SmfContact contact; |
|
1031 int pageNum, itemPerPage; |
|
1032 stream>>names; |
|
1033 stream>>contact; |
|
1034 stream>>pageNum; |
|
1035 stream>>itemPerPage; |
|
1036 pluginErrorVal = plugin->albums(aReqData, names, &contact, pageNum, itemPerPage); |
|
1037 break; |
|
1038 } |
|
1039 |
802 case SmfPictureGetPictures: |
1040 case SmfPictureGetPictures: |
803 { |
1041 { |
|
1042 qDebug()<<"Plugin Operation requested : pictures()"; |
804 int pageNum, itemPerPage; |
1043 int pageNum, itemPerPage; |
805 stream>>pageNum; |
1044 SmfPictureAlbumList albumList; |
806 stream>>itemPerPage; |
1045 stream>>albumList; |
807 pluginErrorVal = plugin->pictures(aReqData, pageNum, itemPerPage); |
1046 stream>>pageNum; |
|
1047 stream>>itemPerPage; |
|
1048 pluginErrorVal = plugin->pictures(aReqData, albumList, pageNum, itemPerPage); |
808 break; |
1049 break; |
809 } |
1050 } |
810 |
1051 |
811 case SmfPictureDescription: |
1052 case SmfPictureDescription: |
|
1053 qDebug()<<"Plugin Operation requested : description()"; |
812 stream>>picture; |
1054 stream>>picture; |
813 pluginErrorVal = plugin->description(aReqData, picture); |
1055 pluginErrorVal = plugin->description(aReqData, picture); |
814 break; |
1056 break; |
815 |
1057 |
816 case SmfPictureUpload: |
1058 case SmfPictureUpload: |
|
1059 { |
|
1060 qDebug()<<"Plugin Operation requested : upload() single"; |
|
1061 SmfPictureAlbum album; |
817 stream>>picture; |
1062 stream>>picture; |
818 pluginErrorVal = plugin->upload(aReqData, picture); |
1063 stream>>album; |
819 break; |
1064 pluginErrorVal = plugin->upload(aReqData, picture, &album); |
|
1065 break; |
|
1066 } |
820 |
1067 |
821 case SmfPictureMultiUpload: |
1068 case SmfPictureMultiUpload: |
822 { |
1069 { |
|
1070 qDebug()<<"Plugin Operation requested : upload() Multiple"; |
823 QList<SmfPicture> list; |
1071 QList<SmfPicture> list; |
|
1072 SmfPictureAlbum album; |
824 stream>>list; |
1073 stream>>list; |
825 pluginErrorVal = plugin->upload(aReqData, list); |
1074 stream>>album; |
|
1075 pluginErrorVal = plugin->upload(aReqData, list, &album); |
826 break; |
1076 break; |
827 } |
1077 } |
828 |
1078 |
829 case SmfPicturePostComment: |
1079 case SmfPicturePostComment: |
830 { |
1080 { |
|
1081 qDebug()<<"Plugin Operation requested : postComment()"; |
831 SmfComment comment; |
1082 SmfComment comment; |
832 stream>>picture; |
1083 stream>>picture; |
833 stream>>comment; |
1084 stream>>comment; |
834 pluginErrorVal = plugin->postComment(aReqData, picture, comment); |
1085 pluginErrorVal = plugin->postComment(aReqData, picture, comment); |
835 break; |
1086 break; |
836 } |
1087 } |
837 |
1088 |
|
1089 case SmfPictureCustomRequest: |
|
1090 { |
|
1091 qDebug()<<"Plugin Operation requested : customRequest()"; |
|
1092 int operationType; |
|
1093 stream>>operationType; |
|
1094 QByteArray data; |
|
1095 stream>>data; |
|
1096 pluginErrorVal = plugin->customRequest(aReqData, operationType, &data); |
|
1097 break; |
|
1098 } |
|
1099 |
838 default: |
1100 default: |
839 // do nothing, unknown service |
1101 // do nothing, unknown service |
840 aResult = SmfPluginUnknownService; |
1102 qDebug()<<"No API found for this operation type!!!"; |
841 SmfPluginManager::getInstance()->server()->writeLog("No API found for this operation type!!!"); |
1103 } |
842 return SmfPluginErrInvalidRequest; |
1104 } |
843 } |
1105 else |
844 |
1106 { |
845 if(SmfPluginErrNone == pluginErrorVal) |
1107 qDebug()<<"Plugin instance couldn't be typecasted!!!"; |
846 aResult = SmfPluginRequestCreated; |
1108 pluginErrorVal = SmfPluginErrRequestNotCreated; |
847 else |
1109 } |
848 aResult = SmfPluginServiceError; |
|
849 } |
|
850 else |
|
851 aResult = SmfPluginLoadError; |
|
852 |
1110 |
853 return pluginErrorVal; |
1111 return pluginErrorVal; |
854 } |
1112 } |
855 |
1113 |
856 |
1114 |
1161 |
1448 |
1162 case SmfPictureUpload: |
1449 case SmfPictureUpload: |
1163 case SmfPictureMultiUpload: |
1450 case SmfPictureMultiUpload: |
1164 case SmfPicturePostComment: |
1451 case SmfPicturePostComment: |
1165 { |
1452 { |
|
1453 qDebug()<<"Serializing to : bool"; |
1166 bool value; |
1454 bool value; |
1167 if( QVariant::Bool == aResult->type() ) |
1455 if( QVariant::Bool == aResult->type() ) |
1168 value = aResult->toBool(); |
1456 value = aResult->toBool(); |
1169 aDataStream<<value; |
1457 aDataStream<<value; |
1170 break; |
1458 break; |
1171 } |
1459 } |
1172 |
1460 |
1173 default: |
1461 default: |
1174 // Unknown service, saved data in Plugin manager is corrupted |
1462 // Unknown service, saved data in Plugin manager is corrupted |
1175 SmfPluginManager::getInstance()->server()->writeLog("No operation type found!!!"); |
1463 qDebug()<<"No operation type found!!!"; |
1176 } |
1464 } |
1177 } |
1465 } |
1178 |
1466 |
|
1467 |
|
1468 /** |
|
1469 * Method to convert SmfPluginError Error to the type SmfError |
|
1470 * @param aPluginError The Error code returned by the plugin |
|
1471 * @param aSMFError [out] The Smf specific common error code |
|
1472 */ |
|
1473 void SmfPluginManagerUtil::convertPluginErrorType( |
|
1474 const SmfPluginError &aPluginError, |
|
1475 SmfError &aSMFError ) |
|
1476 { |
|
1477 qDebug()<<"Converting Plugin error code to SmfError"; |
|
1478 switch(aPluginError) |
|
1479 { |
|
1480 case SmfPluginErrNone: |
|
1481 aSMFError = SmfNoError; |
|
1482 break; |
|
1483 |
|
1484 case SmfPluginErrTooManyRequest: |
|
1485 aSMFError = SmfPluginErrorTooManyRequest; |
|
1486 break; |
|
1487 |
|
1488 case SmfPluginErrRequestQuotaExceeded: |
|
1489 aSMFError = SmfPluginErrorRequestQuotaExceeded; |
|
1490 break; |
|
1491 |
|
1492 case SmfPluginErrInvalidRequest: |
|
1493 aSMFError = SmfPluginErrorInvalidRequest; |
|
1494 break; |
|
1495 |
|
1496 case SmfPluginErrUserNotLoggedIn: |
|
1497 aSMFError = SmfPluginErrorUserNotLoggedIn; |
|
1498 break; |
|
1499 |
|
1500 case SmfPluginErrAuthenticationExpired: |
|
1501 aSMFError = SmfPluginErrorAuthenticationExpired; |
|
1502 break; |
|
1503 |
|
1504 case SmfPluginErrPermissionDenied: |
|
1505 aSMFError = SmfPluginErrorPermissionDenied; |
|
1506 break; |
|
1507 |
|
1508 case SmfPluginErrInvalidApplication: |
|
1509 aSMFError = SmfPluginErrorInvalidApplication; |
|
1510 break; |
|
1511 |
|
1512 case SmfPluginErrServiceUnavailable: |
|
1513 aSMFError = SmfPluginErrorServiceUnavailable; |
|
1514 break; |
|
1515 |
|
1516 case SmfPluginErrServiceTemporaryUnavailable: |
|
1517 aSMFError = SmfPluginErrorServiceTemporaryUnavailable; |
|
1518 break; |
|
1519 |
|
1520 case SmfPluginErrFormatNotSupported: |
|
1521 aSMFError = SmfPluginErrorFormatNotSupported; |
|
1522 break; |
|
1523 |
|
1524 case SmfPluginErrDataSizeExceeded: |
|
1525 aSMFError = SmfPluginErrorDataSizeExceeded; |
|
1526 break; |
|
1527 |
|
1528 case SmfPluginErrServiceNotSupported: |
|
1529 aSMFError = SmfPMPluginUnknownPluginService; |
|
1530 break; |
|
1531 |
|
1532 case SmfPluginErrInvalidArguments: |
|
1533 aSMFError = SmfPluginErrorInvalidArguments; |
|
1534 break; |
|
1535 |
|
1536 case SmfPluginErrRequestNotCreated: |
|
1537 aSMFError = SmfPMPluginRequestCreationFailed; |
|
1538 break; |
|
1539 |
|
1540 case SmfPluginErrParsingFailed: |
|
1541 aSMFError = SmfPluginErrorParsingFailed; |
|
1542 break; |
|
1543 |
|
1544 case SmfPluginErrNetworkError: |
|
1545 aSMFError = SmfPluginErrorNetworkError; |
|
1546 break; |
|
1547 |
|
1548 case SmfPluginErrCancelComplete: |
|
1549 aSMFError = SmfPluginErrorCancelComplete; |
|
1550 break; |
|
1551 |
|
1552 default: |
|
1553 aSMFError = SmfUnknownError; |
|
1554 } |
|
1555 } |
|
1556 |
|
1557 /** |
|
1558 * Method to convert SmfTransportResult Error to the type SmfError |
|
1559 * @param aTMError The Error code returned by the TM |
|
1560 * @param aSMFError [out] The Smf specific common error code |
|
1561 */ |
|
1562 void SmfPluginManagerUtil::convertNetworkErrorType( |
|
1563 const SmfTransportResult &aTMError, |
|
1564 SmfError &aSMFError ) |
|
1565 { |
|
1566 qDebug()<<"Converting Transport error code to SmfError"; |
|
1567 switch(aTMError) |
|
1568 { |
|
1569 case SmfTransportOpNoError: |
|
1570 aSMFError = SmfNoError; |
|
1571 break; |
|
1572 |
|
1573 case SmfTransportOpConnectionRefusedError: |
|
1574 aSMFError = SmfTMConnectionRefusedError; |
|
1575 break; |
|
1576 |
|
1577 case SmfTransportOpRemoteHostClosedError: |
|
1578 aSMFError = SmfTMRemoteHostClosedError; |
|
1579 break; |
|
1580 |
|
1581 case SmfTransportOpHostNotFoundError: |
|
1582 aSMFError = SmfTMHostNotFoundError; |
|
1583 break; |
|
1584 |
|
1585 case SmfTransportOpTimeoutError: |
|
1586 aSMFError = SmfTMTimeoutError; |
|
1587 break; |
|
1588 |
|
1589 case SmfTransportOpOperationCanceledError: |
|
1590 aSMFError = SmfTMOperationCanceledError; |
|
1591 break; |
|
1592 |
|
1593 case SmfTransportOpSslHandshakeFailedError: |
|
1594 aSMFError = SmfTMSslHandshakeFailedError; |
|
1595 break; |
|
1596 |
|
1597 case SmfTransportOpProxyConnectionRefusedError: |
|
1598 aSMFError = SmfTMProxyConnectionRefusedError; |
|
1599 break; |
|
1600 |
|
1601 case SmfTransportOpProxyConnectionClosedError: |
|
1602 aSMFError = SmfTMProxyConnectionClosedError; |
|
1603 break; |
|
1604 |
|
1605 case SmfTransportOpProxyNotFoundError: |
|
1606 aSMFError = SmfTMProxyNotFoundError; |
|
1607 break; |
|
1608 |
|
1609 case SmfTransportOpProxyTimeoutError: |
|
1610 aSMFError = SmfTMProxyTimeoutError; |
|
1611 break; |
|
1612 |
|
1613 case SmfTransportOpProxyAuthenticationRequiredError: |
|
1614 aSMFError = SmfTMProxyAuthenticationRequiredError; |
|
1615 break; |
|
1616 |
|
1617 case SmfTransportOpContentAccessDenied: |
|
1618 aSMFError = SmfTMContentAccessDenied; |
|
1619 break; |
|
1620 |
|
1621 case SmfTransportOpContentOperationNotPermittedError: |
|
1622 aSMFError = SmfTMContentOperationNotPermittedError; |
|
1623 break; |
|
1624 |
|
1625 case SmfTransportOpContentNotFoundError: |
|
1626 aSMFError = SmfTMContentNotFoundError; |
|
1627 break; |
|
1628 |
|
1629 case SmfTransportOpAuthenticationRequiredError: |
|
1630 aSMFError = SmfTMAuthenticationRequiredError; |
|
1631 break; |
|
1632 |
|
1633 case SmfTransportOpContentReSendError: |
|
1634 aSMFError = SmfTMContentReSendError; |
|
1635 break; |
|
1636 |
|
1637 case SmfTransportOpProtocolUnknownError: |
|
1638 aSMFError = SmfTMProtocolUnknownError; |
|
1639 break; |
|
1640 |
|
1641 case SmfTransportOpProtocolInvalidOperationError: |
|
1642 aSMFError = SmfTMProtocolInvalidOperationError; |
|
1643 break; |
|
1644 |
|
1645 case SmfTransportOpUnknownNetworkError: |
|
1646 aSMFError = SmfTMUnknownNetworkError; |
|
1647 break; |
|
1648 |
|
1649 case SmfTransportOpUnknownProxyError: |
|
1650 aSMFError = SmfTMUnknownProxyError; |
|
1651 break; |
|
1652 |
|
1653 case SmfTransportOpUnknownContentError: |
|
1654 aSMFError = SmfTMUnknownContentError; |
|
1655 break; |
|
1656 |
|
1657 case SmfTransportOpProtocolFailure: |
|
1658 aSMFError = SmfTMProtocolFailure; |
|
1659 break; |
|
1660 |
|
1661 case SmfTransportOpUnknownError: |
|
1662 aSMFError = SmfTMUnknownError; |
|
1663 break; |
|
1664 |
|
1665 case SmfTransportOpIAPChanged: |
|
1666 aSMFError = SmfTMIAPChanged; |
|
1667 break; |
|
1668 |
|
1669 case SmfTransportOpCancelled: |
|
1670 aSMFError = SmfTMCancelled; |
|
1671 break; |
|
1672 |
|
1673 case SmfTransportOpUnsupportedContentEncodingFormat: |
|
1674 aSMFError = SmfTMUnsupportedContentEncodingFormat; |
|
1675 break; |
|
1676 |
|
1677 default: |
|
1678 aSMFError = SmfUnknownError; |
|
1679 } |
|
1680 } |
|
1681 |