smf/smfservermodule/smfclient/smfmusic_p.h
changeset 18 013a02bf2bb0
child 25 a180113055cb
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
       
     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 #ifndef SMFMUSICPRIVATE_H_
       
    21 #define SMFMUSICPRIVATE_H_
       
    22 
       
    23 #include <qcontactgeolocation.h>
       
    24 #include <smfglobal.h>
       
    25 #include <smfobserver.h>
       
    26 #include <smfevent.h>
       
    27 #include <smfsubtitle.h>
       
    28 #include <smfmusicprofile.h>
       
    29 #include <smflyrics.h>
       
    30 #include <smfplaylist.h>
       
    31 #include <smftrackinfo.h>
       
    32 #include <smflocation.h>
       
    33 #include <smfprovider.h>
       
    34 
       
    35 #ifdef Q_OS_SYMBIAN
       
    36 	class CSmfClientSymbian;	
       
    37 #else
       
    38 	class SmfClientQt;
       
    39 #endif
       
    40 class SmfMusicService;
       
    41 class SmfMusicSearch;
       
    42 class SmfPlaylistService;
       
    43 class SmfMusicEvents;
       
    44 class SmfLyricsService;
       
    45 class SmfMusicFingerPrint;
       
    46 class SmfMusicRating;
       
    47 class SmfComment;
       
    48 
       
    49 
       
    50 class SmfMusicServicePrivate : public smfObserver
       
    51 	{
       
    52 	Q_OBJECT
       
    53 public:
       
    54 	/**
       
    55 	 * Constructor
       
    56 	 */
       
    57 	SmfMusicServicePrivate(SmfMusicService* aMusicService);
       
    58 	
       
    59 	/**
       
    60 	 * Destructor
       
    61 	 */
       
    62 	~SmfMusicServicePrivate();
       
    63 	
       
    64 	/**
       
    65 	 * Gets self profile information asynchronously.
       
    66 	 * userInfoAvailable() signal is emitted with SmfMusicProfile when the info is arrived
       
    67 	 */
       
    68 	void userinfo ( );
       
    69 
       
    70 	/**
       
    71 	 * Asynchronously searches information about other service users for a particular venue
       
    72 	 * searchInfoAvailable() signal is emitted with SmfMusicProfileList when the info is arrived.
       
    73 	 * When the list is big user can specify the page number and per page item data.
       
    74 	 * If not supplied by the user default values are used.
       
    75 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    76 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    77 	 */
       
    78 	void searchUser ( SmfLocation venue, int pageNum = SMF_FIRST_PAGE,
       
    79 						int perPage = SMF_ITEMS_PER_PAGE);
       
    80 	
       
    81 	/**
       
    82 	 * Request for a custom operation. The signal customDataAvailable() is emitted 
       
    83 	 * when the result is available.
       
    84 	 * @param operationId OperationId
       
    85 	 * @param customData Custom data to be sent
       
    86 	 * Note:-Interpretation of operationId and customData is upto the concerned
       
    87 	 * plugin and client application. service provider should provide some
       
    88 	 * serializing-deserializing utilities for these custom data
       
    89 	 */
       
    90 	void customRequest ( const int& operationId, QByteArray* customData );
       
    91 	
       
    92 	/**
       
    93 	 * Posts currently playing track.
       
    94 	 * Success can be checked by checking the signal postFinished()
       
    95 	 * @param track Track to post
       
    96 	 */
       
    97 	void postCurrentPlaying ( SmfTrackInfo track);
       
    98 	
       
    99 	void postRating ( SmfTrackInfo track, SmfMusicRating rate);
       
   100 	
       
   101 	void postComments ( SmfTrackInfo track, SmfComment comment);
       
   102 	
       
   103 public: // from smfObserver
       
   104 	/**
       
   105 	 * To notify availibility of asynchronous requests.
       
   106 	 * @param result Requested result, before using must check error param.
       
   107 	 * @param opcode Requested opcode, for which the result has arrived.
       
   108 	 * @param error Error 
       
   109 	 */
       
   110 	void resultsAvailable(QByteArray result,SmfRequestTypeID opcode, SmfError error);
       
   111 	
       
   112 private:
       
   113 	SmfMusicService* m_musicService;
       
   114 	//serialized byte array of provider+other info to be sent to the server
       
   115 	//The order:- SmfProvider then params in order of their appearance in fn
       
   116 	QByteArray m_serializedDataToServer;
       
   117 #ifdef Q_OS_SYMBIAN
       
   118 	CSmfClientSymbian* m_SmfClientPrivate;
       
   119 	friend class CSmfClientSymbian;
       
   120 #else
       
   121 	SmfClientQt* m_SmfClientPrivate;
       
   122 	friend class SmfClientQt;
       
   123 #endif
       
   124 	int m_argFlag;
       
   125 	
       
   126 	};
       
   127 
       
   128 
       
   129 //SmfMusicSearch
       
   130 class SmfMusicSearchPrivate : public smfObserver
       
   131 	{
       
   132 	Q_OBJECT
       
   133 public:
       
   134 	/**
       
   135 	 * Constructor
       
   136 	 */
       
   137 	SmfMusicSearchPrivate(SmfMusicSearch* aMusicSearch);
       
   138 	
       
   139 	/**
       
   140 	 * Constructor
       
   141 	 */
       
   142 	~SmfMusicSearchPrivate();
       
   143 	
       
   144 public:
       
   145 	/**
       
   146 	 * Searches for music recommendations similar to a particulartrack asynchronously.
       
   147 	 * The signal trackSearchAvailable() is emitted with SmfTrackInfoList
       
   148 	 * once its arrived.
       
   149 	 * When the list is big user can specify the page number and per page item data.
       
   150 	 * If not supplied by the user default values are used.
       
   151 	 * @param track The track for which similar recommendations need to be fetched.
       
   152 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   153 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   154 	 */
       
   155 	void recommendations ( SmfTrackInfo track, int pageNum = SMF_FIRST_PAGE,
       
   156 			int perPage = SMF_ITEMS_PER_PAGE);
       
   157 	
       
   158 	/**
       
   159 	 * Searches for tracks similar to a given track asynchronously.
       
   160 	 * The signal trackSearchAvailable() is emitted with SmfTrackInfoList
       
   161 	 * once its arrived.
       
   162 	 * When the list is big user can specify the page number and per page item data.
       
   163 	 * If not supplied by the user default values are used.
       
   164 	 * @param track The search criteria, similar tracks are searched
       
   165 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   166 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   167 	 */
       
   168 	void tracks ( SmfTrackInfo track, int pageNum = SMF_FIRST_PAGE,
       
   169 			int perPage = SMF_ITEMS_PER_PAGE);
       
   170 	
       
   171 	/**
       
   172 	 * Searches for a track having similar finger print asynchronously.
       
   173 	 * The signal trackSearchAvailable() is emitted with SmfTrackInfoList
       
   174 	 * once its arrived.
       
   175 	 * @param signature The search criteria,signature to be searched for
       
   176 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   177 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   178 	 */
       
   179 	void trackInfo ( SmfMusicFingerPrint signature, int pageNum = SMF_FIRST_PAGE,
       
   180 			int perPage = SMF_ITEMS_PER_PAGE);
       
   181 	
       
   182 	/**
       
   183 	 * Search information about where to buy this song from asynchronously.
       
   184 	 * The signal storeSearchAvailable() is emitted with SmfProviderList once its arrived.
       
   185 	 * @param track The search criteria for stores
       
   186 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   187 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   188 	 */
       
   189 	void stores ( SmfTrackInfo track, int pageNum = SMF_FIRST_PAGE, 
       
   190 			int perPage = SMF_ITEMS_PER_PAGE);
       
   191 	
       
   192 	/**
       
   193 	 * Request for a custom operation. The signal customDataAvailable() is emitted 
       
   194 	 * when the result is available.
       
   195 	 * @param operationId OperationId
       
   196 	 * @param customData Custom data to be sent
       
   197 	 * Note:-Interpretation of operationId and customData is upto the concerned
       
   198 	 * plugin and client application. service provider should provide some
       
   199 	 * serializing-deserializing utilities for these custom data
       
   200 	 */
       
   201 	void customRequest ( const int& operationId, QByteArray* customData );
       
   202 	
       
   203 public: //From smfObserver
       
   204 	/**
       
   205 	 * To notify availibility of asynchronous requests.
       
   206 	 * @param result Requested result, before using must check error param.
       
   207 	 * @param opcode Requested opcode, for which the result has arrived.
       
   208 	 * @param error Error 
       
   209 	 */
       
   210 	void resultsAvailable(QByteArray result,SmfRequestTypeID opcode, SmfError error);
       
   211 	
       
   212 private:
       
   213 	SmfMusicSearch *m_musicSearch;
       
   214 	//serialized byte array of provider+other info to be sent to the server
       
   215 	//The order:- SmfProvider then params in order of their appearance in fn
       
   216 	QByteArray m_serializedDataToServer;
       
   217 #ifdef Q_OS_SYMBIAN
       
   218 	CSmfClientSymbian* m_SmfClientPrivate;
       
   219 	friend class CSmfClientSymbian;
       
   220 #else
       
   221 	SmfClientQt* m_SmfClientPrivate;
       
   222 	friend class SmfClientQt;
       
   223 #endif
       
   224 	int m_argFlag;
       
   225 
       
   226 	};
       
   227 
       
   228 
       
   229 class SmfPlaylistServicePrivate : public smfObserver
       
   230 	{
       
   231 	Q_OBJECT
       
   232 
       
   233 public:
       
   234 	/**
       
   235 	 * Constructs SmfPlaylistService with base provider info
       
   236 	 */
       
   237 	SmfPlaylistServicePrivate(SmfPlaylistService* aPlayLstSrvc);
       
   238 	
       
   239 	/**
       
   240 	 * Destructor
       
   241 	 */
       
   242 	~SmfPlaylistServicePrivate();
       
   243 
       
   244 public:
       
   245 	/**
       
   246 	 * Gets the list playlists for the logged-in user asynchronously.
       
   247 	 * The signal playlistsListAvailable() signal is emitted with
       
   248 	 * SmfPlaylistList once its arrived .
       
   249 	 * When the list is big user can specify the page number and per page item data.
       
   250 	 * If not supplied by the user default values are used.
       
   251 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   252 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   253 	 */
       
   254 	void playlists ( int pageNum = SMF_FIRST_PAGE,
       
   255 			int perPage = SMF_ITEMS_PER_PAGE);
       
   256 	
       
   257 	/**
       
   258 	 * Gets the list playlists for the given user asynchronously.
       
   259 	 * The signal playlistsListAvailable() signal is emitted with
       
   260 	 * SmfPlaylistList once its arrived.
       
   261 	 * When the list is big user can specify the page number and per page item data.
       
   262 	 * If not supplied by the user default values are used.
       
   263 	 * @param user User for which to get the playlists
       
   264 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   265 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   266 	 */
       
   267 	void playlistsOf ( SmfMusicProfile* user, int pageNum = SMF_FIRST_PAGE,
       
   268 			int perPage = SMF_ITEMS_PER_PAGE);
       
   269 	
       
   270 	/**
       
   271 	 * Upload currently playing track to a playlist. Signal
       
   272 	 * playlistUpdated() can be checked for success value
       
   273 	 * @param plst The playlist to be added in
       
   274 	 * @param tracks The list of tracks to uploaded
       
   275 	 */
       
   276 	int addToPlaylist ( SmfPlaylist plst, SmfTrackInfoList* tracks );
       
   277 	
       
   278 	/**
       
   279 	 * Upload currently playing playlist . Signal
       
   280 	 * playlistUpdated() can be checked for success value
       
   281 	 * @param plst The playlist to be uploaded
       
   282 	 */
       
   283 	int postCurrentPlayingPlaylist ( SmfPlaylist plst );
       
   284 	
       
   285 	/**
       
   286 	 * Request for a custom operation. The signal customDataAvailable() is emitted 
       
   287 	 * when the result is available.
       
   288 	 * @param operationId OperationId
       
   289 	 * @param customData Custom data to be sent
       
   290 	 * Note:-Interpretation of operationId and customData is upto the concerned
       
   291 	 * plugin and client application. service provider should provide some
       
   292 	 * serializing-deserializing utilities for these custom data
       
   293 	 */
       
   294 	void customRequest ( const int& operationId, QByteArray* customData );
       
   295 	
       
   296 public: //From smfObserver
       
   297 	/**
       
   298 	 * To notify availibility of asynchronous requests.
       
   299 	 * @param result Requested result, before using must check error param.
       
   300 	 * @param opcode Requested opcode, for which the result has arrived.
       
   301 	 * @param error Error 
       
   302 	 */
       
   303 	void resultsAvailable(QByteArray result,SmfRequestTypeID opcode, SmfError error);
       
   304 
       
   305 private:
       
   306 	SmfPlaylistService* m_playlstSrvc;
       
   307 	//serialized byte array of provider+other info to be sent to the server
       
   308 	//The order:- SmfProvider then params in order of their appearance in fn
       
   309 	QByteArray m_serializedDataToServer;
       
   310 
       
   311 #ifdef Q_OS_SYMBIAN
       
   312 	CSmfClientSymbian* m_SmfClientPrivate;
       
   313 	friend class CSmfClientSymbian;
       
   314 #else
       
   315 	SmfClientQt* m_SmfClientPrivate;
       
   316 	friend class SmfClientQt;
       
   317 #endif
       
   318 	int m_argFlag;
       
   319 	
       
   320 	};
       
   321 
       
   322 
       
   323 class SmfMusicEventsPrivate : public smfObserver
       
   324 	{
       
   325 	Q_OBJECT
       
   326 
       
   327 public:
       
   328 	/**
       
   329 	 * Constructs SmfMusicEvents with base provider info
       
   330 	 */
       
   331 	SmfMusicEventsPrivate(SmfMusicEvents* aMusicEvent);
       
   332 	
       
   333 	/**
       
   334 	 * Destructor
       
   335 	 */
       
   336 	~SmfMusicEventsPrivate();
       
   337 
       
   338 public:
       
   339 	/**
       
   340 	 * Gets list of events in a particular venue asynchronously.
       
   341 	 * eventsAvailable() signal is emitted with SmfEventsList once its arrived.
       
   342 	 * When the list is big user can specify the page number and per page item data.
       
   343 	 * If not supplied by the user default values are used.
       
   344 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   345 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   346 	 */
       
   347 	void events ( SmfLocation venue, int pageNum = SMF_FIRST_PAGE,
       
   348 			int perPage = SMF_ITEMS_PER_PAGE);
       
   349 	
       
   350 	/**
       
   351 	 * Gets list of venues of a particular location asynchronously.
       
   352 	 * venuesAvailable() signal is emitted with SmfLocationList once its arrived.
       
   353 	 * When the list is big user can specify the page number and per page item data.
       
   354 	 * If not supplied by the user default values are used.
       
   355 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   356 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   357 	 */
       
   358 	void venues ( SmfLocation location, int pageNum = SMF_FIRST_PAGE,
       
   359 			int perPage = SMF_ITEMS_PER_PAGE);
       
   360 	
       
   361 	/**
       
   362 	 * Updates events. Might not be supported by all service provider.
       
   363 	 * eventsUpdated() signal can be checked for success value.
       
   364 	 * @param SmfEventsList List of events to be posted
       
   365 	 */
       
   366 	void postEvents ( SmfEventList events );
       
   367 	
       
   368 	/**
       
   369 	 * Request for a custom operation. The signal customDataAvailable() is emitted 
       
   370 	 * when the result is available.
       
   371 	 * @param operationId OperationId
       
   372 	 * @param customData Custom data to be sent
       
   373 	 * Note:-Interpretation of operationId and customData is upto the concerned
       
   374 	 * plugin and client application. service provider should provide some
       
   375 	 * serializing-deserializing utilities for these custom data
       
   376 	 */
       
   377 	void customRequest ( const int& operationId, QByteArray* customData );
       
   378 	
       
   379 public: //From smfObserver
       
   380 	/**
       
   381 	 * To notify availibility of asynchronous requests.
       
   382 	 * @param result Requested result, before using must check error param.
       
   383 	 * @param opcode Requested opcode, for which the result has arrived.
       
   384 	 * @param error Error 
       
   385 	 */
       
   386 	void resultsAvailable(QByteArray result,SmfRequestTypeID opcode, SmfError error);
       
   387 
       
   388 private:
       
   389 	SmfMusicEvents* m_musicEvent;
       
   390 	//serialized byte array of provider+other info to be sent to the server
       
   391 	//The order:- SmfProvider then params in order of their appearance in fn
       
   392 	QByteArray m_serializedDataToServer;
       
   393 #ifdef Q_OS_SYMBIAN
       
   394 	CSmfClientSymbian* m_SmfClientPrivate;
       
   395 	friend class CSmfClientSymbian;
       
   396 #else
       
   397 	SmfClientQt* m_SmfClientPrivate;
       
   398 	friend class SmfClientQt;
       
   399 #endif
       
   400 	int m_argFlag;
       
   401 	
       
   402 	};
       
   403 
       
   404 
       
   405 /**
       
   406  * provides service ("org.symbian.smf.client.music.lyrics")
       
   407  */
       
   408 class SmfLyricsServicePrivate : public smfObserver
       
   409 	{
       
   410 	Q_OBJECT
       
   411 
       
   412 public:
       
   413 	/**
       
   414 	 * Constructs SmfLyricsService with base provider info.
       
   415 	 */
       
   416 	SmfLyricsServicePrivate(SmfLyricsService* aLyricsSrvc);
       
   417 	
       
   418 	/**
       
   419 	 * Destructor
       
   420 	 */
       
   421 	~SmfLyricsServicePrivate();
       
   422 
       
   423 public:
       
   424 	/**
       
   425 	 * Get the lyrics lists asynchrnously, it fetches texts without time info.
       
   426 	 * lyricsAvailable() notification comes SmfLyricsList with when the data is available
       
   427 	 * @param track Track for which lyrics needs to be fetched.
       
   428 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   429 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   430 	 */
       
   431 	void lyrics ( SmfTrackInfo track, int pageNum = SMF_FIRST_PAGE,
       
   432 			int perPage = SMF_ITEMS_PER_PAGE);
       
   433 	
       
   434 	/**
       
   435 	 * Get the lyrics lists asynchrnously, it fetches texts with time info.
       
   436 	 * Subtitle search filter can be applied
       
   437 	 * subtitleAvailable() notification comes SmfSubtitleList with when the data is available
       
   438 	 * @param track Track for which subtitle needs to be fetched.
       
   439 	 * @param filter Subtitle search filter
       
   440 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   441 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   442 	 */
       
   443 	void subtitles ( SmfTrackInfo track, SmfSubtitleSearchFilter filter,
       
   444 			int pageNum = SMF_FIRST_PAGE, int perPage = SMF_ITEMS_PER_PAGE);
       
   445 	
       
   446 	/**
       
   447 	 * Request for a custom operation. The signal customDataAvailable() is emitted 
       
   448 	 * when the result is available.
       
   449 	 * @param operationId OperationId
       
   450 	 * @param customData Custom data to be sent
       
   451 	 * Note:-Interpretation of operationId and customData is upto the concerned
       
   452 	 * plugin and client application. service provider should provide some
       
   453 	 * serializing-deserializing utilities for these custom data
       
   454 	 */
       
   455 	void customRequest ( const int& operationId, QByteArray* customData );
       
   456 	
       
   457 public: //From smfObserver
       
   458 	/**
       
   459 	 * To notify availibility of asynchronous requests.
       
   460 	 * @param result Requested result, before using must check error param.
       
   461 	 * @param opcode Requested opcode, for which the result has arrived.
       
   462 	 * @param error Error 
       
   463 	 */
       
   464 	void resultsAvailable(QByteArray result,SmfRequestTypeID opcode, SmfError error);
       
   465 	
       
   466 private:
       
   467 	SmfLyricsService *m_lyricsSrvc;
       
   468 	//serialized byte array of provider+other info to be sent to the server
       
   469 	//The order:- SmfProvider then params in order of their appearance in fn
       
   470 	QByteArray m_serializedDataToServer;
       
   471 #ifdef Q_OS_SYMBIAN
       
   472 	CSmfClientSymbian* m_SmfClientPrivate;
       
   473 	friend class CSmfClientSymbian;
       
   474 #else
       
   475 	SmfClientQt* m_SmfClientPrivate;
       
   476 	friend class SmfClientQt;
       
   477 #endif
       
   478 	int m_argFlag;
       
   479 
       
   480 	};
       
   481 
       
   482 #endif