18
|
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 |
* Private implementation of music related services
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
#include <qdebug.h>
|
|
21 |
#include <smfmusicrating.h>
|
|
22 |
#include <smfcomment.h>
|
|
23 |
#include <smfmusicfingerprint.h>
|
|
24 |
#include <smfcontact.h>
|
|
25 |
|
|
26 |
#include "smfmusic.h"
|
|
27 |
#include "smfmusic_p.h"
|
|
28 |
#ifdef Q_OS_SYMBIAN
|
|
29 |
#include "smfclientsymbian.h"
|
|
30 |
#else
|
|
31 |
#include "smfclientqt.h"
|
|
32 |
#endif
|
|
33 |
|
|
34 |
|
|
35 |
//SmfMusicServicePrivate start
|
|
36 |
SmfMusicServicePrivate::SmfMusicServicePrivate(SmfMusicService* aMusicService)
|
|
37 |
:m_musicService(aMusicService)
|
|
38 |
{
|
|
39 |
#ifdef Q_OS_SYMBIAN
|
|
40 |
//private impl for symbian
|
|
41 |
m_SmfClientPrivate = CSmfClientSymbian::NewL(this);
|
|
42 |
#else
|
|
43 |
//TODO:- Use private impl for other platforms or else Qt impl
|
|
44 |
#endif
|
|
45 |
}
|
|
46 |
|
|
47 |
SmfMusicServicePrivate::~SmfMusicServicePrivate()
|
|
48 |
{
|
|
49 |
if(m_SmfClientPrivate)
|
|
50 |
{
|
|
51 |
delete m_SmfClientPrivate;
|
|
52 |
m_SmfClientPrivate = NULL;
|
|
53 |
}
|
|
54 |
}
|
|
55 |
|
25
|
56 |
SmfError SmfMusicServicePrivate::userMusicInfo()
|
18
|
57 |
{
|
25
|
58 |
SmfError err = SmfNoError;
|
18
|
59 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
60 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
61 |
m_serializedDataToServer.clear();
|
|
62 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
63 |
write<<*m_baseProvider;
|
|
64 |
|
|
65 |
QString intfName(musicServiceInterface);
|
|
66 |
int maxalloc = SmfMusicProfileMaxSize;
|
|
67 |
|
|
68 |
//call private impl's send method
|
|
69 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
70 |
SmfMusicGetUserInfo, maxalloc);
|
25
|
71 |
return err;
|
|
72 |
}
|
|
73 |
|
|
74 |
SmfError SmfMusicServicePrivate::searchArtist ( SmfArtists artist, int pageNum, int perPage )
|
|
75 |
{
|
|
76 |
SmfError err = SmfNoError;
|
|
77 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
78 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
79 |
m_serializedDataToServer.clear();
|
|
80 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
81 |
write<<*m_baseProvider;
|
|
82 |
|
|
83 |
QByteArray dataToPlugins;
|
|
84 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
85 |
m_argFlag = 1;
|
|
86 |
streamToPlugin<<m_argFlag;
|
|
87 |
streamToPlugin<<artist;
|
|
88 |
streamToPlugin<<m_argFlag;
|
|
89 |
streamToPlugin<<pageNum;
|
|
90 |
streamToPlugin<<m_argFlag;
|
|
91 |
streamToPlugin<<perPage;
|
|
92 |
|
|
93 |
write<<dataToPlugins;
|
|
94 |
|
|
95 |
QString intfName(musicServiceInterface);
|
|
96 |
int maxalloc = SmfMusicProfileMaxSize*perPage;
|
|
97 |
|
|
98 |
//call private impl's send method
|
|
99 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
100 |
SmfMusicSearchArtist, maxalloc);
|
|
101 |
return err;
|
18
|
102 |
}
|
|
103 |
|
25
|
104 |
SmfError SmfMusicServicePrivate::searchAlbum ( SmfAlbum album, int pageNum, int perPage )
|
18
|
105 |
{
|
25
|
106 |
SmfError err = SmfNoError;
|
|
107 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
108 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
109 |
m_serializedDataToServer.clear();
|
|
110 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
111 |
write<<*m_baseProvider;
|
|
112 |
|
|
113 |
QByteArray dataToPlugins;
|
|
114 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
115 |
m_argFlag = 1;
|
|
116 |
streamToPlugin<<m_argFlag;
|
|
117 |
streamToPlugin<<album;
|
|
118 |
streamToPlugin<<m_argFlag;
|
|
119 |
streamToPlugin<<pageNum;
|
|
120 |
streamToPlugin<<m_argFlag;
|
|
121 |
streamToPlugin<<perPage;
|
|
122 |
|
|
123 |
write<<dataToPlugins;
|
|
124 |
|
|
125 |
QString intfName(musicServiceInterface);
|
|
126 |
int maxalloc = SmfMusicProfileMaxSize*perPage;
|
|
127 |
|
|
128 |
//call private impl's send method
|
|
129 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
130 |
SmfMusicSearchAlbum, maxalloc);
|
|
131 |
return err;
|
|
132 |
}
|
|
133 |
|
|
134 |
|
|
135 |
SmfError SmfMusicServicePrivate::searchEvents ( SmfEvent event, int pageNum, int perPage )
|
|
136 |
{
|
|
137 |
SmfError err = SmfNoError;
|
18
|
138 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
139 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
140 |
m_serializedDataToServer.clear();
|
|
141 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
142 |
write<<*m_baseProvider;
|
25
|
143 |
|
|
144 |
QByteArray dataToPlugins;
|
|
145 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
18
|
146 |
m_argFlag = 1;
|
25
|
147 |
streamToPlugin<<m_argFlag;
|
|
148 |
streamToPlugin<<event;
|
|
149 |
streamToPlugin<<m_argFlag;
|
|
150 |
streamToPlugin<<pageNum;
|
|
151 |
streamToPlugin<<m_argFlag;
|
|
152 |
streamToPlugin<<perPage;
|
|
153 |
|
|
154 |
write<<dataToPlugins;
|
|
155 |
|
|
156 |
QString intfName(musicServiceInterface);
|
|
157 |
int maxalloc = SmfMusicProfileMaxSize*perPage;
|
|
158 |
|
|
159 |
//call private impl's send method
|
|
160 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
161 |
SmfMusicSearchEvent, maxalloc);
|
|
162 |
return err;
|
|
163 |
}
|
|
164 |
|
|
165 |
SmfError SmfMusicServicePrivate::searchVenue ( SmfLocation location, int pageNum, int perPage )
|
|
166 |
{
|
|
167 |
SmfError err = SmfNoError;
|
|
168 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
169 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
170 |
m_serializedDataToServer.clear();
|
|
171 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
172 |
write<<*m_baseProvider;
|
|
173 |
|
|
174 |
QByteArray dataToPlugins;
|
|
175 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
176 |
m_argFlag = 1;
|
|
177 |
streamToPlugin<<m_argFlag;
|
|
178 |
streamToPlugin<<location;
|
|
179 |
streamToPlugin<<m_argFlag;
|
|
180 |
streamToPlugin<<pageNum;
|
|
181 |
streamToPlugin<<m_argFlag;
|
|
182 |
streamToPlugin<<perPage;
|
|
183 |
|
|
184 |
write<<dataToPlugins;
|
|
185 |
|
|
186 |
QString intfName(musicServiceInterface);
|
|
187 |
int maxalloc = SmfMusicProfileMaxSize*perPage;
|
|
188 |
|
|
189 |
//call private impl's send method
|
|
190 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
191 |
SmfMusicSearchVenue, maxalloc);
|
|
192 |
return err;
|
|
193 |
}
|
|
194 |
|
|
195 |
SmfError SmfMusicServicePrivate::searchUser(SmfLocation venue, int pageNum, int perPage)
|
|
196 |
{
|
|
197 |
SmfError err = SmfNoError;
|
|
198 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
199 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
200 |
m_serializedDataToServer.clear();
|
|
201 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
202 |
write<<*m_baseProvider;
|
|
203 |
|
|
204 |
QByteArray dataToPlugins;
|
|
205 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
206 |
m_argFlag = 1;
|
|
207 |
streamToPlugin<<m_argFlag;
|
|
208 |
streamToPlugin<<venue;
|
|
209 |
streamToPlugin<<m_argFlag;
|
|
210 |
streamToPlugin<<pageNum;
|
|
211 |
streamToPlugin<<m_argFlag;
|
|
212 |
streamToPlugin<<perPage;
|
|
213 |
|
|
214 |
write<<dataToPlugins;
|
18
|
215 |
|
|
216 |
QString intfName(musicServiceInterface);
|
|
217 |
int maxalloc = SmfMusicProfileMaxSize*perPage;
|
|
218 |
|
|
219 |
//call private impl's send method
|
|
220 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
221 |
SmfMusicSearchUser, maxalloc);
|
25
|
222 |
return err;
|
18
|
223 |
}
|
|
224 |
|
25
|
225 |
SmfError SmfMusicServicePrivate::customRequest ( const int& operationId, QByteArray* customData )
|
18
|
226 |
{
|
25
|
227 |
SmfError err = SmfNoError;
|
18
|
228 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
229 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
230 |
m_serializedDataToServer.clear();
|
|
231 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
232 |
write<<*m_baseProvider;
|
25
|
233 |
|
|
234 |
QByteArray dataToPlugins;
|
|
235 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
236 |
|
18
|
237 |
m_argFlag = 1;
|
25
|
238 |
streamToPlugin<<m_argFlag;
|
|
239 |
streamToPlugin<<operationId;
|
18
|
240 |
if(customData)
|
|
241 |
{
|
25
|
242 |
streamToPlugin<<m_argFlag;
|
|
243 |
streamToPlugin<<*customData;
|
18
|
244 |
}
|
|
245 |
else
|
|
246 |
{
|
|
247 |
m_argFlag = 0;
|
25
|
248 |
streamToPlugin<<m_argFlag;
|
18
|
249 |
}
|
|
250 |
|
25
|
251 |
write<<dataToPlugins;
|
|
252 |
|
18
|
253 |
QString intfName(musicServiceInterface);
|
|
254 |
//ToDo:- How much size to allocate for custo data? keeping SmfMusicProfileMaxSize for now
|
|
255 |
int maxAlloc = SmfMusicProfileMaxSize;
|
|
256 |
|
|
257 |
//call private impl's send method
|
|
258 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
259 |
SmfMusicServiceCustomRequest, maxAlloc);
|
25
|
260 |
return err;
|
18
|
261 |
}
|
|
262 |
|
25
|
263 |
SmfError SmfMusicServicePrivate::postCurrentPlaying(SmfTrackInfo track)
|
18
|
264 |
{
|
25
|
265 |
SmfError err = SmfNoError;
|
18
|
266 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
267 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
268 |
m_serializedDataToServer.clear();
|
|
269 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
270 |
write<<*(m_baseProvider);
|
25
|
271 |
|
|
272 |
QByteArray dataToPlugins;
|
|
273 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
274 |
|
18
|
275 |
m_argFlag = 1;
|
25
|
276 |
streamToPlugin<<m_argFlag;
|
|
277 |
streamToPlugin<<track;
|
|
278 |
|
|
279 |
write<<dataToPlugins;
|
18
|
280 |
|
|
281 |
QString intfName(musicServiceInterface);
|
|
282 |
//TODO:-revisit all the maxalloc
|
|
283 |
int maxalloc = 1000;
|
|
284 |
|
|
285 |
//call private impl's send method
|
|
286 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
287 |
SmfMusicPostCurrentPlaying, maxalloc);
|
25
|
288 |
return err;
|
18
|
289 |
}
|
|
290 |
|
25
|
291 |
SmfError SmfMusicServicePrivate::postRating(SmfTrackInfo track, SmfMusicRating rate)
|
18
|
292 |
{
|
25
|
293 |
SmfError err = SmfNoError;
|
18
|
294 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
295 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
296 |
m_serializedDataToServer.clear();
|
|
297 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
298 |
write<<*(m_baseProvider);
|
25
|
299 |
|
|
300 |
QByteArray dataToPlugins;
|
|
301 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
302 |
|
18
|
303 |
m_argFlag = 1;
|
25
|
304 |
streamToPlugin<<m_argFlag;
|
|
305 |
streamToPlugin<<track;
|
|
306 |
streamToPlugin<<m_argFlag;
|
|
307 |
streamToPlugin<<rate;
|
|
308 |
|
|
309 |
write<<dataToPlugins;
|
18
|
310 |
|
|
311 |
QString intfName(musicServiceInterface);
|
|
312 |
//TODO:-revisit all the maxalloc
|
|
313 |
int maxalloc = 1000;
|
|
314 |
|
|
315 |
//call private impl's send method
|
|
316 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
317 |
SmfMusicPostRating, maxalloc);
|
25
|
318 |
return err;
|
18
|
319 |
}
|
|
320 |
|
25
|
321 |
SmfError SmfMusicServicePrivate::postComments(SmfTrackInfo track, SmfComment comment)
|
18
|
322 |
{
|
25
|
323 |
SmfError err = SmfNoError;
|
18
|
324 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
325 |
SmfProvider* m_baseProvider = m_musicService->getProvider();
|
|
326 |
m_serializedDataToServer.clear();
|
|
327 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
328 |
write<<*(m_baseProvider);
|
25
|
329 |
|
|
330 |
QByteArray dataToPlugins;
|
|
331 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
332 |
|
18
|
333 |
m_argFlag = 1;
|
25
|
334 |
streamToPlugin<<m_argFlag;
|
|
335 |
streamToPlugin<<track;
|
|
336 |
streamToPlugin<<m_argFlag;
|
|
337 |
streamToPlugin<<comment;
|
|
338 |
|
|
339 |
write<<dataToPlugins;
|
18
|
340 |
|
|
341 |
QString intfName(musicServiceInterface);
|
|
342 |
//TODO:-revisit all the maxalloc
|
|
343 |
int maxalloc = 1000;
|
|
344 |
|
|
345 |
//call private impl's send method
|
|
346 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
347 |
SmfMusicPostComment, maxalloc);
|
25
|
348 |
return err;
|
|
349 |
}
|
|
350 |
|
|
351 |
|
|
352 |
SmfError SmfMusicServicePrivate::cancelRequest()
|
|
353 |
{
|
|
354 |
qDebug()<<"Inside SmfMusicServicePrivate::cancelRequest()";
|
|
355 |
QByteArray notused;
|
|
356 |
QByteArray retData = m_SmfClientPrivate->sendSyncRequest(notused,SmfCancelRequest,1000, notused);
|
|
357 |
|
|
358 |
//De-serialize it into SmfError
|
|
359 |
QDataStream reader(&retData,QIODevice::ReadOnly);
|
|
360 |
int val;
|
|
361 |
reader>>val;
|
|
362 |
SmfError error = (SmfError) val;
|
|
363 |
return error;
|
18
|
364 |
}
|
|
365 |
|
|
366 |
void SmfMusicServicePrivate::resultsAvailable(QByteArray result, SmfRequestTypeID opcode, SmfError error)
|
|
367 |
{
|
|
368 |
//note:- "result" is serialized and we need to de-serialize it as per opcode
|
|
369 |
//Order of serialization Error value followed by data
|
|
370 |
|
|
371 |
QDataStream reader(&result,QIODevice::ReadOnly);
|
|
372 |
|
|
373 |
//Now de-serialize it based on opcode
|
|
374 |
switch(opcode)
|
|
375 |
{
|
|
376 |
case SmfMusicGetUserInfo:
|
|
377 |
{
|
|
378 |
SmfMusicProfile* m_profile = new SmfMusicProfile;
|
|
379 |
reader>>*m_profile;
|
|
380 |
|
25
|
381 |
emit m_musicService->userMusicInfoAvailable(m_profile,error);
|
|
382 |
break;
|
|
383 |
}
|
|
384 |
|
|
385 |
case SmfMusicSearchArtist:
|
|
386 |
{
|
|
387 |
SmfArtistsList *m_List = new SmfArtistsList;
|
|
388 |
reader>>*m_List;
|
|
389 |
|
|
390 |
//ToDo :- not incorporating paging now
|
|
391 |
SmfResultPage page;
|
|
392 |
|
|
393 |
emit m_musicService->searchArtistInfoAvailable(m_List, error, page);
|
|
394 |
break;
|
|
395 |
}
|
|
396 |
|
|
397 |
case SmfMusicSearchAlbum:
|
|
398 |
{
|
|
399 |
SmfAlbumList *m_List = new SmfAlbumList;
|
|
400 |
reader>>*m_List;
|
|
401 |
|
|
402 |
//ToDo :- not incorporating paging now
|
|
403 |
SmfResultPage page;
|
|
404 |
|
|
405 |
emit m_musicService->searchAlbumInfoAvailable(m_List, error, page);
|
|
406 |
break;
|
|
407 |
}
|
|
408 |
|
|
409 |
case SmfMusicSearchEvent:
|
|
410 |
{
|
|
411 |
SmfEventList *m_List = new SmfEventList;
|
|
412 |
reader>>*m_List;
|
|
413 |
|
|
414 |
//ToDo :- not incorporating paging now
|
|
415 |
SmfResultPage page;
|
|
416 |
|
|
417 |
emit m_musicService->searchEventsInfoAvailable(m_List, error, page);
|
|
418 |
break;
|
|
419 |
}
|
|
420 |
case SmfMusicSearchVenue:
|
|
421 |
{
|
|
422 |
SmfLocationList *m_List = new SmfLocationList;
|
|
423 |
reader>>*m_List;
|
|
424 |
|
|
425 |
//ToDo :- not incorporating paging now
|
|
426 |
SmfResultPage page;
|
|
427 |
|
|
428 |
emit m_musicService->searchVenueInfoAvailable(m_List, error, page);
|
18
|
429 |
break;
|
|
430 |
}
|
|
431 |
|
|
432 |
case SmfMusicSearchUser:
|
|
433 |
{
|
|
434 |
SmfMusicProfileList* m_profileList = new SmfMusicProfileList;
|
|
435 |
reader>>*m_profileList;
|
|
436 |
|
|
437 |
//ToDo :- not incorporating paging now
|
|
438 |
SmfResultPage page;
|
|
439 |
|
25
|
440 |
emit m_musicService->searchUserInfoAvailable(m_profileList, error, page);
|
18
|
441 |
break;
|
|
442 |
}
|
|
443 |
|
|
444 |
case SmfMusicPostCurrentPlaying:
|
|
445 |
case SmfMusicPostRating:
|
|
446 |
case SmfMusicPostComment:
|
|
447 |
{
|
|
448 |
emit m_musicService->postfinished(error);
|
|
449 |
break;
|
|
450 |
}
|
|
451 |
|
|
452 |
case SmfMusicServiceCustomRequest:
|
|
453 |
{
|
|
454 |
int operationId;
|
|
455 |
QByteArray *data = new QByteArray;
|
|
456 |
reader>>operationId;
|
|
457 |
reader>>*data;
|
|
458 |
qDebug()<<"operationId = "<<operationId;
|
|
459 |
qDebug()<<"data size = "<<data->size();
|
|
460 |
emit m_musicService->customDataAvailable(operationId, data);
|
|
461 |
break;
|
|
462 |
}
|
|
463 |
|
|
464 |
default:
|
|
465 |
User::Panic(_L("Music Service Private = "),opcode);
|
|
466 |
}
|
|
467 |
}
|
|
468 |
//SmfMusicServicePrivate start
|
|
469 |
|
|
470 |
|
|
471 |
//SmfMusicSearchPrivate start
|
|
472 |
SmfMusicSearchPrivate::SmfMusicSearchPrivate(SmfMusicSearch *aMusicSearch)
|
|
473 |
: m_musicSearch(aMusicSearch)
|
|
474 |
{
|
|
475 |
#ifdef Q_OS_SYMBIAN
|
|
476 |
//private impl for symbian
|
|
477 |
m_SmfClientPrivate = CSmfClientSymbian::NewL(this);
|
|
478 |
#else
|
|
479 |
//TODO:- Use private impl for other platforms or else Qt impl
|
|
480 |
#endif
|
|
481 |
}
|
|
482 |
|
|
483 |
SmfMusicSearchPrivate::~SmfMusicSearchPrivate()
|
|
484 |
{
|
|
485 |
if(m_SmfClientPrivate)
|
|
486 |
{
|
|
487 |
delete m_SmfClientPrivate;
|
|
488 |
m_SmfClientPrivate = NULL;
|
|
489 |
}
|
|
490 |
}
|
|
491 |
|
25
|
492 |
SmfError SmfMusicSearchPrivate::recommendations(SmfTrackInfo track, int pageNum, int perPage)
|
18
|
493 |
{
|
25
|
494 |
SmfError err = SmfNoError;
|
|
495 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
496 |
m_serializedDataToServer.clear();
|
|
497 |
SmfProvider* m_baseProvider = m_musicSearch->getProvider();
|
|
498 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
499 |
write<<*m_baseProvider;
|
|
500 |
|
|
501 |
QByteArray dataToPlugins;
|
|
502 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
503 |
|
|
504 |
m_argFlag = 1;
|
|
505 |
streamToPlugin<<m_argFlag;
|
|
506 |
streamToPlugin<<track;
|
|
507 |
streamToPlugin<<m_argFlag;
|
|
508 |
streamToPlugin<<pageNum;
|
|
509 |
streamToPlugin<<m_argFlag;
|
|
510 |
streamToPlugin<<perPage;
|
|
511 |
|
|
512 |
write<<dataToPlugins;
|
|
513 |
|
|
514 |
QString intfName(musicSearchInterface);
|
|
515 |
//TODO:-revisit all the maxalloc
|
|
516 |
int maxalloc = SmfMusicTracksMaxSize*perPage;
|
|
517 |
|
|
518 |
//call private impl's send method
|
|
519 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
520 |
SmfMusicGetRecommendations, maxalloc);
|
|
521 |
return err;
|
|
522 |
}
|
|
523 |
|
|
524 |
SmfError SmfMusicSearchPrivate::tracksSimilar ( SmfTrackInfo track, int pageNum, int perPage )
|
|
525 |
{
|
|
526 |
SmfError err = SmfNoError;
|
18
|
527 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
528 |
m_serializedDataToServer.clear();
|
|
529 |
SmfProvider* m_baseProvider = m_musicSearch->getProvider();
|
|
530 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
531 |
write<<*m_baseProvider;
|
25
|
532 |
|
|
533 |
|
|
534 |
QByteArray dataToPlugins;
|
|
535 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
536 |
|
18
|
537 |
m_argFlag = 1;
|
25
|
538 |
streamToPlugin<<m_argFlag;
|
|
539 |
streamToPlugin<<track;
|
|
540 |
streamToPlugin<<m_argFlag;
|
|
541 |
streamToPlugin<<pageNum;
|
|
542 |
streamToPlugin<<m_argFlag;
|
|
543 |
streamToPlugin<<perPage;
|
|
544 |
|
|
545 |
write<<dataToPlugins;
|
|
546 |
|
18
|
547 |
QString intfName(musicSearchInterface);
|
|
548 |
//TODO:-revisit all the maxalloc
|
25
|
549 |
int maxalloc = SmfMusicTracksMaxSize*perPage;
|
18
|
550 |
|
|
551 |
//call private impl's send method
|
|
552 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
25
|
553 |
SmfMusicGetTracksSimilar, maxalloc);
|
|
554 |
return err;
|
18
|
555 |
}
|
|
556 |
|
25
|
557 |
SmfError SmfMusicSearchPrivate::tracksOfAlbum ( SmfAlbum album, int pageNum, int perPage )
|
18
|
558 |
{
|
25
|
559 |
SmfError err = SmfNoError;
|
|
560 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
561 |
m_serializedDataToServer.clear();
|
18
|
562 |
SmfProvider* m_baseProvider = m_musicSearch->getProvider();
|
|
563 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
564 |
write<<*m_baseProvider;
|
25
|
565 |
|
|
566 |
QByteArray dataToPlugins;
|
|
567 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
568 |
|
18
|
569 |
m_argFlag = 1;
|
25
|
570 |
streamToPlugin<<m_argFlag;
|
|
571 |
streamToPlugin<<album;
|
|
572 |
streamToPlugin<<m_argFlag;
|
|
573 |
streamToPlugin<<pageNum;
|
|
574 |
streamToPlugin<<m_argFlag;
|
|
575 |
streamToPlugin<<perPage;
|
18
|
576 |
|
25
|
577 |
write<<dataToPlugins;
|
|
578 |
|
18
|
579 |
QString intfName(musicSearchInterface);
|
|
580 |
//TODO:-revisit all the maxalloc
|
25
|
581 |
int maxalloc = SmfMusicTracksMaxSize*perPage;
|
18
|
582 |
|
|
583 |
//call private impl's send method
|
|
584 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
25
|
585 |
SmfMusicGetTracksOfAlbum, maxalloc);
|
|
586 |
return err;
|
18
|
587 |
}
|
|
588 |
|
25
|
589 |
SmfError SmfMusicSearchPrivate::tracksOfArtist ( SmfArtists artists, int pageNum, int perPage )
|
18
|
590 |
{
|
25
|
591 |
SmfError err = SmfNoError;
|
|
592 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
593 |
m_serializedDataToServer.clear();
|
|
594 |
SmfProvider* m_baseProvider = m_musicSearch->getProvider();
|
|
595 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
596 |
write<<*m_baseProvider;
|
|
597 |
|
|
598 |
QByteArray dataToPlugins;
|
|
599 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
600 |
|
|
601 |
m_argFlag = 1;
|
|
602 |
streamToPlugin<<m_argFlag;
|
|
603 |
streamToPlugin<<artists;
|
|
604 |
streamToPlugin<<m_argFlag;
|
|
605 |
streamToPlugin<<pageNum;
|
|
606 |
streamToPlugin<<m_argFlag;
|
|
607 |
streamToPlugin<<perPage;
|
|
608 |
|
|
609 |
write<<dataToPlugins;
|
|
610 |
|
|
611 |
QString intfName(musicSearchInterface);
|
|
612 |
//TODO:-revisit all the maxalloc
|
|
613 |
int maxalloc = SmfMusicTracksMaxSize*perPage;
|
|
614 |
|
|
615 |
//call private impl's send method
|
|
616 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
617 |
SmfMusicGetTracksOfArtist, maxalloc);
|
|
618 |
return err;
|
|
619 |
}
|
|
620 |
|
|
621 |
SmfError SmfMusicSearchPrivate::trackInfo(SmfMusicFingerPrint signature, int pageNum, int perPage)
|
|
622 |
{
|
|
623 |
SmfError err = SmfNoError;
|
18
|
624 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
625 |
SmfProvider* m_baseProvider = m_musicSearch->getProvider();
|
|
626 |
m_serializedDataToServer.clear();
|
|
627 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
628 |
write<<*m_baseProvider;
|
25
|
629 |
|
|
630 |
QByteArray dataToPlugins;
|
|
631 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
632 |
|
18
|
633 |
m_argFlag = 1;
|
25
|
634 |
streamToPlugin<<m_argFlag;
|
|
635 |
streamToPlugin<<signature;
|
|
636 |
streamToPlugin<<m_argFlag;
|
|
637 |
streamToPlugin<<pageNum;
|
|
638 |
streamToPlugin<<m_argFlag;
|
|
639 |
streamToPlugin<<perPage;
|
|
640 |
|
|
641 |
write<<dataToPlugins;
|
18
|
642 |
|
|
643 |
QString intfName(musicSearchInterface);
|
|
644 |
//TODO:-revisit all the maxalloc
|
25
|
645 |
int maxalloc = SmfMusicTracksMaxSize*perPage;
|
18
|
646 |
|
|
647 |
//call private impl's send method
|
|
648 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
649 |
SmfMusicGetTrackInfo, maxalloc);
|
25
|
650 |
return err;
|
18
|
651 |
}
|
|
652 |
|
25
|
653 |
SmfError SmfMusicSearchPrivate::stores(SmfTrackInfo track, int pageNum, int perPage)
|
18
|
654 |
{
|
25
|
655 |
SmfError err = SmfNoError;
|
18
|
656 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
657 |
SmfProvider* m_baseProvider = m_musicSearch->getProvider();
|
|
658 |
m_serializedDataToServer.clear();
|
|
659 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
660 |
write<<*(m_baseProvider);
|
25
|
661 |
|
|
662 |
QByteArray dataToPlugins;
|
|
663 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
664 |
|
18
|
665 |
m_argFlag = 1;
|
25
|
666 |
streamToPlugin<<m_argFlag;
|
|
667 |
streamToPlugin<<track;
|
|
668 |
streamToPlugin<<m_argFlag;
|
|
669 |
streamToPlugin<<pageNum;
|
|
670 |
streamToPlugin<<m_argFlag;
|
|
671 |
streamToPlugin<<perPage;
|
|
672 |
|
|
673 |
write<<dataToPlugins;
|
18
|
674 |
|
|
675 |
QString intfName(musicSearchInterface);
|
|
676 |
/** @TODO:-revisit all the maxalloc */
|
25
|
677 |
int maxalloc = 1000*perPage;
|
18
|
678 |
|
|
679 |
//call private impl's send method
|
|
680 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
681 |
SmfMusicGetStores, maxalloc);
|
25
|
682 |
return err;
|
18
|
683 |
}
|
|
684 |
|
25
|
685 |
SmfError SmfMusicSearchPrivate::customRequest ( const int& operationId, QByteArray* customData )
|
18
|
686 |
{
|
25
|
687 |
SmfError err = SmfNoError;
|
18
|
688 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
689 |
SmfProvider* m_baseProvider = m_musicSearch->getProvider();
|
|
690 |
m_serializedDataToServer.clear();
|
|
691 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
692 |
write<<*m_baseProvider;
|
25
|
693 |
|
|
694 |
QByteArray dataToPlugins;
|
|
695 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
696 |
|
18
|
697 |
m_argFlag = 1;
|
25
|
698 |
streamToPlugin<<m_argFlag;
|
|
699 |
streamToPlugin<<operationId;
|
18
|
700 |
if(customData)
|
|
701 |
{
|
25
|
702 |
streamToPlugin<<m_argFlag;
|
|
703 |
streamToPlugin<<*customData;
|
18
|
704 |
}
|
|
705 |
else
|
|
706 |
{
|
|
707 |
m_argFlag = 0;
|
25
|
708 |
streamToPlugin<<m_argFlag;
|
18
|
709 |
}
|
|
710 |
|
25
|
711 |
write<<dataToPlugins;
|
|
712 |
|
18
|
713 |
QString intfName(musicSearchInterface);
|
|
714 |
/** @TODO:-revisit all the maxalloc */
|
25
|
715 |
int maxalloc = 10000;
|
18
|
716 |
|
|
717 |
//call private impl's send method
|
|
718 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
719 |
SmfMusicSearchCustomRequest, maxalloc);
|
25
|
720 |
return err;
|
18
|
721 |
}
|
|
722 |
|
25
|
723 |
SmfError SmfMusicSearchPrivate::cancelRequest()
|
|
724 |
{
|
|
725 |
qDebug()<<"Inside SmfMusicSearchPrivate::cancelRequest()";
|
|
726 |
QByteArray notused;
|
|
727 |
QByteArray retData = m_SmfClientPrivate->sendSyncRequest(notused,SmfCancelRequest,1000, notused);
|
|
728 |
|
|
729 |
//De-serialize it into SmfError
|
|
730 |
QDataStream reader(&retData,QIODevice::ReadOnly);
|
|
731 |
int val;
|
|
732 |
reader>>val;
|
|
733 |
SmfError error = (SmfError) val;
|
|
734 |
return error;
|
|
735 |
}
|
18
|
736 |
|
|
737 |
|
|
738 |
void SmfMusicSearchPrivate::resultsAvailable(QByteArray result, SmfRequestTypeID opcode, SmfError error)
|
|
739 |
{
|
|
740 |
//note:- "result" is serialized and we need to de-serialize it as per opcode
|
|
741 |
//Order of serialization Error value followed by data
|
|
742 |
|
|
743 |
QDataStream reader(&result,QIODevice::ReadOnly);
|
|
744 |
|
|
745 |
//Now de-serialize it based on opcode
|
|
746 |
switch(opcode)
|
|
747 |
{
|
|
748 |
case SmfMusicGetRecommendations:
|
25
|
749 |
case SmfMusicGetTracksSimilar:
|
|
750 |
case SmfMusicGetTracksOfAlbum:
|
|
751 |
case SmfMusicGetTracksOfArtist:
|
18
|
752 |
case SmfMusicGetTrackInfo:
|
|
753 |
{
|
|
754 |
SmfTrackInfoList* m_trackInfoList = new SmfTrackInfoList;
|
|
755 |
reader>>*(m_trackInfoList);
|
|
756 |
|
|
757 |
//ToDo :- not incorporating paging now
|
|
758 |
SmfResultPage page;
|
|
759 |
|
|
760 |
emit m_musicSearch->trackSearchAvailable(m_trackInfoList,error,page);
|
|
761 |
break;
|
|
762 |
}
|
|
763 |
|
|
764 |
case SmfMusicGetStores:
|
|
765 |
{
|
|
766 |
SmfProviderList* m_providers = new SmfProviderList;
|
|
767 |
reader>>*(m_providers);
|
|
768 |
|
|
769 |
//ToDo :- not incorporating paging now
|
|
770 |
SmfResultPage page;
|
|
771 |
|
|
772 |
emit m_musicSearch->storeSearchAvailable(m_providers,error,page);
|
|
773 |
break;
|
|
774 |
}
|
|
775 |
|
|
776 |
case SmfMusicSearchCustomRequest:
|
|
777 |
{
|
|
778 |
int operationId;
|
|
779 |
QByteArray *data = new QByteArray;
|
|
780 |
reader>>operationId;
|
|
781 |
reader>>*data;
|
|
782 |
qDebug()<<"operationId = "<<operationId;
|
|
783 |
qDebug()<<"data size = "<<data->size();
|
|
784 |
emit m_musicSearch->customDataAvailable(operationId, data);
|
|
785 |
break;
|
|
786 |
}
|
|
787 |
|
|
788 |
default:
|
|
789 |
User::Panic(_L("Music Search Private = "),opcode);
|
|
790 |
}
|
|
791 |
}
|
|
792 |
//SmfMusicSearchPrivate end
|
|
793 |
|
|
794 |
|
|
795 |
//SmfPlaylistServicePrivate start
|
|
796 |
SmfPlaylistServicePrivate::SmfPlaylistServicePrivate(SmfPlaylistService *aPlayLstSrvc)
|
|
797 |
: m_playlstSrvc(aPlayLstSrvc)
|
|
798 |
{
|
|
799 |
#ifdef Q_OS_SYMBIAN
|
|
800 |
//private impl for symbian
|
|
801 |
m_SmfClientPrivate = CSmfClientSymbian::NewL(this);
|
|
802 |
#else
|
|
803 |
//TODO:- Use private impl for other platforms or else Qt impl
|
|
804 |
#endif
|
|
805 |
}
|
|
806 |
|
|
807 |
SmfPlaylistServicePrivate::~SmfPlaylistServicePrivate()
|
|
808 |
{
|
|
809 |
if(m_SmfClientPrivate)
|
|
810 |
{
|
|
811 |
delete m_SmfClientPrivate;
|
|
812 |
m_SmfClientPrivate = NULL;
|
|
813 |
}
|
|
814 |
}
|
|
815 |
|
25
|
816 |
SmfError SmfPlaylistServicePrivate::playlists(int pageNum, int perPage)
|
18
|
817 |
{
|
25
|
818 |
SmfError err = SmfNoError;
|
|
819 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
820 |
SmfProvider* m_baseProvider = m_playlstSrvc->getProvider();
|
|
821 |
m_serializedDataToServer.clear();
|
|
822 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
823 |
write<<*(m_baseProvider);
|
|
824 |
|
|
825 |
QByteArray dataToPlugins;
|
|
826 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
827 |
|
|
828 |
m_argFlag = 1;
|
|
829 |
streamToPlugin<<m_argFlag;
|
|
830 |
streamToPlugin<<pageNum;
|
|
831 |
streamToPlugin<<m_argFlag;
|
|
832 |
streamToPlugin<<perPage;
|
|
833 |
|
|
834 |
write<<dataToPlugins;
|
|
835 |
|
|
836 |
QString intfName(playlistServiceInterface);
|
|
837 |
//TODO:-revisit all the maxalloc
|
|
838 |
int maxalloc = SmfMusicPlaylistMaxSize*perPage;
|
|
839 |
|
|
840 |
//call private impl's send method
|
|
841 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
842 |
SmfMusicGetPlaylists, maxalloc);
|
|
843 |
return err;
|
|
844 |
}
|
|
845 |
|
|
846 |
SmfError SmfPlaylistServicePrivate::playlistsOf(SmfContact *user, int pageNum, int perPage)
|
|
847 |
{
|
|
848 |
SmfError err = SmfNoError;
|
18
|
849 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
850 |
SmfProvider* m_baseProvider = m_playlstSrvc->getProvider();
|
|
851 |
m_serializedDataToServer.clear();
|
|
852 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
853 |
write<<*(m_baseProvider);
|
25
|
854 |
|
|
855 |
QByteArray dataToPlugins;
|
|
856 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
857 |
|
|
858 |
if(user)
|
|
859 |
{
|
|
860 |
m_argFlag = 1;
|
|
861 |
streamToPlugin<<m_argFlag;
|
|
862 |
streamToPlugin<<*user;
|
|
863 |
}
|
|
864 |
else
|
|
865 |
{
|
|
866 |
m_argFlag = 0;
|
|
867 |
streamToPlugin<<m_argFlag;
|
|
868 |
}
|
18
|
869 |
m_argFlag = 1;
|
25
|
870 |
streamToPlugin<<m_argFlag;
|
|
871 |
streamToPlugin<<pageNum;
|
|
872 |
streamToPlugin<<m_argFlag;
|
|
873 |
streamToPlugin<<perPage;
|
|
874 |
|
|
875 |
write<<dataToPlugins;
|
|
876 |
|
18
|
877 |
QString intfName(playlistServiceInterface);
|
|
878 |
//TODO:-revisit all the maxalloc
|
25
|
879 |
int maxalloc = SmfMusicPlaylistMaxSize*perPage;
|
18
|
880 |
|
|
881 |
//call private impl's send method
|
|
882 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
25
|
883 |
SmfMusicGetPlaylistsOfUser, maxalloc);
|
|
884 |
return err;
|
18
|
885 |
}
|
|
886 |
|
25
|
887 |
SmfError SmfPlaylistServicePrivate::addToPlaylist(SmfPlaylist plst, SmfTrackInfoList *tracks)
|
18
|
888 |
{
|
25
|
889 |
SmfError err = SmfNoError;
|
18
|
890 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
891 |
SmfProvider* m_baseProvider = m_playlstSrvc->getProvider();
|
|
892 |
m_serializedDataToServer.clear();
|
|
893 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
894 |
write<<*(m_baseProvider);
|
25
|
895 |
|
|
896 |
QByteArray dataToPlugins;
|
|
897 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
898 |
|
|
899 |
m_argFlag = 1;
|
|
900 |
streamToPlugin<<m_argFlag;
|
|
901 |
streamToPlugin<<plst;
|
|
902 |
if(tracks)
|
18
|
903 |
{
|
25
|
904 |
streamToPlugin<<m_argFlag;
|
|
905 |
streamToPlugin<<*tracks;
|
18
|
906 |
}
|
|
907 |
else
|
|
908 |
{
|
|
909 |
m_argFlag = 0;
|
25
|
910 |
streamToPlugin<<m_argFlag;
|
18
|
911 |
}
|
25
|
912 |
|
|
913 |
write<<dataToPlugins;
|
18
|
914 |
|
|
915 |
QString intfName(playlistServiceInterface);
|
|
916 |
//TODO:-revisit all the maxalloc
|
|
917 |
int maxalloc = 1000;
|
|
918 |
|
|
919 |
//call private impl's send method
|
|
920 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
25
|
921 |
SmfMusicAddToPlaylist, maxalloc);
|
|
922 |
return err;
|
18
|
923 |
}
|
|
924 |
|
25
|
925 |
SmfError SmfPlaylistServicePrivate::postCurrentPlayingPlaylist(SmfPlaylist plst)
|
18
|
926 |
{
|
25
|
927 |
SmfError err = SmfNoError;
|
18
|
928 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
929 |
SmfProvider* m_baseProvider = m_playlstSrvc->getProvider();
|
|
930 |
m_serializedDataToServer.clear();
|
|
931 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
932 |
write<<*(m_baseProvider);
|
|
933 |
|
25
|
934 |
QByteArray dataToPlugins;
|
|
935 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
936 |
|
18
|
937 |
m_argFlag = 1;
|
25
|
938 |
streamToPlugin<<m_argFlag;
|
|
939 |
streamToPlugin<<plst;
|
|
940 |
|
|
941 |
write<<dataToPlugins;
|
18
|
942 |
|
|
943 |
QString intfName(playlistServiceInterface);
|
|
944 |
//TODO:-revisit all the maxalloc
|
|
945 |
int maxalloc = 1000;
|
|
946 |
|
|
947 |
//call private impl's send method
|
|
948 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
25
|
949 |
SmfMusicPostCurrentPlayingPlaylist, maxalloc);
|
|
950 |
return err;
|
|
951 |
}
|
|
952 |
|
|
953 |
SmfError SmfPlaylistServicePrivate::customRequest ( const int& operationId, QByteArray* customData )
|
|
954 |
{
|
|
955 |
SmfError err = SmfNoError;
|
|
956 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
957 |
SmfProvider* m_baseProvider = m_playlstSrvc->getProvider();
|
|
958 |
m_serializedDataToServer.clear();
|
|
959 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
960 |
write<<*m_baseProvider;
|
|
961 |
|
|
962 |
QByteArray dataToPlugins;
|
|
963 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
964 |
|
|
965 |
m_argFlag = 1;
|
|
966 |
streamToPlugin<<m_argFlag;
|
|
967 |
streamToPlugin<<operationId;
|
|
968 |
if(customData)
|
|
969 |
{
|
|
970 |
streamToPlugin<<m_argFlag;
|
|
971 |
streamToPlugin<<*customData;
|
|
972 |
}
|
|
973 |
else
|
|
974 |
{
|
|
975 |
m_argFlag = 0;
|
|
976 |
streamToPlugin<<m_argFlag;
|
|
977 |
}
|
|
978 |
|
|
979 |
write<<dataToPlugins;
|
|
980 |
|
|
981 |
QString intfName(playlistServiceInterface);
|
|
982 |
//TODO:-revisit all the maxalloc
|
|
983 |
int maxalloc = 10000;
|
|
984 |
|
|
985 |
//call private impl's send method
|
|
986 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
18
|
987 |
SmfMusicPlaylistCustomRequest, maxalloc);
|
25
|
988 |
return err;
|
|
989 |
}
|
|
990 |
|
|
991 |
SmfError SmfPlaylistServicePrivate::cancelRequest()
|
|
992 |
{
|
|
993 |
qDebug()<<"Inside SmfPlaylistServicePrivate::cancelRequest()";
|
|
994 |
QByteArray notused;
|
|
995 |
QByteArray retData = m_SmfClientPrivate->sendSyncRequest(notused,SmfCancelRequest,1000, notused);
|
|
996 |
|
|
997 |
//De-serialize it into SmfError
|
|
998 |
QDataStream reader(&retData,QIODevice::ReadOnly);
|
|
999 |
int val;
|
|
1000 |
reader>>val;
|
|
1001 |
SmfError error = (SmfError) val;
|
|
1002 |
return error;
|
18
|
1003 |
}
|
|
1004 |
|
|
1005 |
void SmfPlaylistServicePrivate::resultsAvailable(QByteArray result, SmfRequestTypeID opcode, SmfError error)
|
|
1006 |
{
|
|
1007 |
//note:- "result" is serialized and we need to de-serialize it as per opcode
|
|
1008 |
//Order of serialization Error value followed by data
|
|
1009 |
|
|
1010 |
QDataStream reader(&result,QIODevice::ReadOnly);
|
|
1011 |
|
|
1012 |
//Now de-serialize it based on opcode
|
|
1013 |
switch(opcode)
|
|
1014 |
{
|
|
1015 |
case SmfMusicGetPlaylists:
|
|
1016 |
case SmfMusicGetPlaylistsOfUser:
|
|
1017 |
{
|
|
1018 |
SmfPlaylistList* m_playlistList = new SmfPlaylistList;
|
|
1019 |
reader>>*(m_playlistList);
|
|
1020 |
|
|
1021 |
//ToDo:-
|
|
1022 |
SmfResultPage page;
|
|
1023 |
|
|
1024 |
emit m_playlstSrvc->playlistsListAvailable(m_playlistList,error,page);
|
|
1025 |
break;
|
|
1026 |
}
|
|
1027 |
|
|
1028 |
case SmfMusicAddToPlaylist:
|
|
1029 |
case SmfMusicPostCurrentPlayingPlaylist:
|
|
1030 |
{
|
|
1031 |
emit m_playlstSrvc->playlistUpdated(error);
|
|
1032 |
break;
|
|
1033 |
}
|
|
1034 |
|
|
1035 |
case SmfMusicPlaylistCustomRequest:
|
|
1036 |
{
|
|
1037 |
int operationId;
|
|
1038 |
QByteArray *data = new QByteArray;
|
|
1039 |
reader>>operationId;
|
|
1040 |
reader>>*data;
|
|
1041 |
qDebug()<<"operationId = "<<operationId;
|
|
1042 |
qDebug()<<"data size = "<<data->size();
|
|
1043 |
emit m_playlstSrvc->customDataAvailable(operationId, data);
|
|
1044 |
break;
|
|
1045 |
}
|
|
1046 |
default:
|
|
1047 |
Q_ASSERT_X(1,"SmfPlaylistServicePrivate::resultsAvailable","unknown opcode");
|
|
1048 |
}
|
|
1049 |
}
|
|
1050 |
//SmfPlaylistServicePrivate end
|
|
1051 |
|
|
1052 |
|
|
1053 |
|
|
1054 |
//SmfLyricsServicePrivate start
|
|
1055 |
SmfLyricsServicePrivate::SmfLyricsServicePrivate(SmfLyricsService *aLyricsSrvc)
|
|
1056 |
: m_lyricsSrvc(aLyricsSrvc)
|
|
1057 |
{
|
|
1058 |
#ifdef Q_OS_SYMBIAN
|
|
1059 |
//private impl for symbian
|
|
1060 |
m_SmfClientPrivate = CSmfClientSymbian::NewL(this);
|
|
1061 |
#else
|
|
1062 |
//TODO:- Use private impl for other platforms or else Qt impl
|
|
1063 |
#endif
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
SmfLyricsServicePrivate::~SmfLyricsServicePrivate()
|
|
1067 |
{
|
|
1068 |
if(m_SmfClientPrivate)
|
|
1069 |
{
|
|
1070 |
delete m_SmfClientPrivate;
|
|
1071 |
m_SmfClientPrivate = NULL;
|
|
1072 |
}
|
|
1073 |
}
|
|
1074 |
|
25
|
1075 |
SmfError SmfLyricsServicePrivate::lyrics(SmfTrackInfo track, int pageNum, int perPage)
|
18
|
1076 |
{
|
25
|
1077 |
SmfError err = SmfNoError;
|
18
|
1078 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
1079 |
SmfProvider* m_baseProvider = m_lyricsSrvc->getProvider();
|
|
1080 |
m_serializedDataToServer.clear();
|
|
1081 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
1082 |
write<<*(m_baseProvider);
|
25
|
1083 |
|
|
1084 |
QByteArray dataToPlugins;
|
|
1085 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
1086 |
|
18
|
1087 |
m_argFlag = 1;
|
25
|
1088 |
streamToPlugin<<m_argFlag;
|
|
1089 |
streamToPlugin<<track;
|
|
1090 |
streamToPlugin<<m_argFlag;
|
|
1091 |
streamToPlugin<<pageNum;
|
|
1092 |
streamToPlugin<<m_argFlag;
|
|
1093 |
streamToPlugin<<perPage;
|
|
1094 |
|
|
1095 |
write<<dataToPlugins;
|
18
|
1096 |
|
|
1097 |
QString intfName(lyricsServiceInterface);
|
|
1098 |
//TODO:-revisit all the maxalloc
|
25
|
1099 |
int maxalloc = SmfMusicLyricsMaxSize*perPage;
|
18
|
1100 |
|
|
1101 |
//call private impl's send method
|
|
1102 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
1103 |
SmfMusicGetLyrics, maxalloc);
|
25
|
1104 |
return err;
|
18
|
1105 |
}
|
|
1106 |
|
25
|
1107 |
SmfError SmfLyricsServicePrivate::subtitles(SmfTrackInfo track, SmfSubtitleSearchFilter filter,
|
18
|
1108 |
int pageNum, int perPage)
|
|
1109 |
{
|
25
|
1110 |
SmfError err = SmfNoError;
|
18
|
1111 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
1112 |
SmfProvider* m_baseProvider = m_lyricsSrvc->getProvider();
|
|
1113 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
1114 |
write<<*(m_baseProvider);
|
25
|
1115 |
|
|
1116 |
QByteArray dataToPlugins;
|
|
1117 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
1118 |
|
18
|
1119 |
m_argFlag = 1;
|
25
|
1120 |
streamToPlugin<<m_argFlag;
|
|
1121 |
streamToPlugin<<track;
|
|
1122 |
streamToPlugin<<m_argFlag;
|
|
1123 |
streamToPlugin<<filter;
|
|
1124 |
streamToPlugin<<m_argFlag;
|
|
1125 |
streamToPlugin<<pageNum;
|
|
1126 |
streamToPlugin<<m_argFlag;
|
|
1127 |
streamToPlugin<<perPage;
|
|
1128 |
|
|
1129 |
write<<dataToPlugins;
|
18
|
1130 |
|
|
1131 |
QString intfName(lyricsServiceInterface);
|
|
1132 |
//TODO:-revisit all the maxalloc
|
25
|
1133 |
int maxalloc = SmfMusicLyricsMaxSize*perPage;
|
18
|
1134 |
|
|
1135 |
//call private impl's send method
|
|
1136 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
1137 |
SmfMusicGetSubtitle, maxalloc);
|
25
|
1138 |
return err;
|
18
|
1139 |
}
|
|
1140 |
|
25
|
1141 |
SmfError SmfLyricsServicePrivate::customRequest ( const int& operationId, QByteArray* customData )
|
18
|
1142 |
{
|
25
|
1143 |
SmfError err = SmfNoError;
|
18
|
1144 |
//We need to pass Opcode and SmfProvider serialized into bytearray
|
|
1145 |
SmfProvider* m_baseProvider = m_lyricsSrvc->getProvider();
|
|
1146 |
m_serializedDataToServer.clear();
|
|
1147 |
QDataStream write(&m_serializedDataToServer,QIODevice::WriteOnly);
|
|
1148 |
write<<*m_baseProvider;
|
25
|
1149 |
|
|
1150 |
QByteArray dataToPlugins;
|
|
1151 |
QDataStream streamToPlugin(&dataToPlugins, QIODevice::WriteOnly);
|
|
1152 |
|
18
|
1153 |
m_argFlag = 1;
|
25
|
1154 |
streamToPlugin<<m_argFlag;
|
|
1155 |
streamToPlugin<<operationId;
|
18
|
1156 |
if(customData)
|
|
1157 |
{
|
25
|
1158 |
streamToPlugin<<m_argFlag;
|
|
1159 |
streamToPlugin<<*customData;
|
18
|
1160 |
}
|
|
1161 |
else
|
|
1162 |
{
|
|
1163 |
m_argFlag = 0;
|
25
|
1164 |
streamToPlugin<<m_argFlag;
|
18
|
1165 |
}
|
|
1166 |
|
25
|
1167 |
write<<dataToPlugins;
|
|
1168 |
|
18
|
1169 |
QString intfName(lyricsServiceInterface);
|
|
1170 |
//TODO:-revisit all the maxalloc
|
25
|
1171 |
int maxalloc = 10000;
|
18
|
1172 |
|
|
1173 |
//call private impl's send method
|
|
1174 |
m_SmfClientPrivate->sendRequest(m_serializedDataToServer, intfName,
|
|
1175 |
SmfMusicLyricsCustomRequest, maxalloc);
|
25
|
1176 |
return err;
|
|
1177 |
}
|
|
1178 |
|
|
1179 |
SmfError SmfLyricsServicePrivate::cancelRequest()
|
|
1180 |
{
|
|
1181 |
qDebug()<<"Inside SmfLyricsServicePrivate::cancelRequest()";
|
|
1182 |
QByteArray notused;
|
|
1183 |
QByteArray retData = m_SmfClientPrivate->sendSyncRequest(notused,SmfCancelRequest,1000, notused);
|
|
1184 |
|
|
1185 |
//De-serialize it into SmfError
|
|
1186 |
QDataStream reader(&retData,QIODevice::ReadOnly);
|
|
1187 |
int val;
|
|
1188 |
reader>>val;
|
|
1189 |
SmfError error = (SmfError) val;
|
|
1190 |
return error;
|
18
|
1191 |
}
|
|
1192 |
|
|
1193 |
void SmfLyricsServicePrivate::resultsAvailable(QByteArray result, SmfRequestTypeID opcode, SmfError error)
|
|
1194 |
{
|
|
1195 |
//note:- "result" is serialized and we need to de-serialize it as per opcode
|
|
1196 |
|
|
1197 |
QDataStream reader(&result,QIODevice::ReadOnly);
|
|
1198 |
|
|
1199 |
//Now de-serialize it based on opcode
|
|
1200 |
switch(opcode)
|
|
1201 |
{
|
|
1202 |
case SmfMusicGetLyrics:
|
|
1203 |
{
|
|
1204 |
SmfLyricsList* m_lyricsList = new SmfLyricsList;
|
|
1205 |
reader>>*(m_lyricsList);
|
|
1206 |
|
|
1207 |
// ToDo :-
|
|
1208 |
SmfResultPage page;
|
|
1209 |
|
|
1210 |
emit m_lyricsSrvc->lyricsAvailable(m_lyricsList,error,page);
|
|
1211 |
break;
|
|
1212 |
}
|
|
1213 |
|
|
1214 |
case SmfMusicGetSubtitle:
|
|
1215 |
{
|
|
1216 |
SmfSubtitleList* m_subList = new SmfSubtitleList;
|
|
1217 |
reader>>*(m_subList);
|
|
1218 |
|
|
1219 |
// ToDo :-
|
|
1220 |
SmfResultPage page;
|
|
1221 |
|
|
1222 |
emit m_lyricsSrvc->subtitleAvailable(m_subList,error,page);
|
|
1223 |
break;
|
|
1224 |
}
|
|
1225 |
|
|
1226 |
case SmfMusicLyricsCustomRequest:
|
|
1227 |
{
|
|
1228 |
int operationId;
|
|
1229 |
QByteArray *data = new QByteArray;
|
|
1230 |
reader>>operationId;
|
|
1231 |
reader>>*data;
|
|
1232 |
qDebug()<<"operationId = "<<operationId;
|
|
1233 |
qDebug()<<"data size = "<<data->size();
|
|
1234 |
emit m_lyricsSrvc->customDataAvailable(operationId, data);
|
|
1235 |
break;
|
|
1236 |
}
|
|
1237 |
|
|
1238 |
default:
|
|
1239 |
Q_ASSERT_X(1,"SmfLyricsServicePrivate::resultsAvailable","unknown opcode");
|
|
1240 |
}
|
|
1241 |
}
|
|
1242 |
|
|
1243 |
//SmfLyricsServicePrivate end
|