example/clientapi/smf/inc/smfclient/smfmusic.h
changeset 3 0446eb7b28aa
parent 2 86af6c333601
child 4 969092730d34
equal deleted inserted replaced
2:86af6c333601 3:0446eb7b28aa
     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  * The SmfEvent class represents an event
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFMUSIC_H
       
    21 #define SMMUSIC_H
       
    22 
       
    23 #include <QObject>
       
    24 
       
    25 #include <qmobilityglobal.h>
       
    26 #include <qgeopositioninfo.h>
       
    27 
       
    28 #include "smfglobal.h"
       
    29 #include "smfprovider.h"
       
    30 #include "smfcontact.h"
       
    31 #include "smfevent.h"
       
    32 
       
    33 class SmfProvider; //basic Smf service Provider info
       
    34 class SmfContact; // Smf contact
       
    35 class SmfMusicRating;//rating value from 0..31 - services would map accordingly
       
    36 class SmfMusicProfile; //user profile containing music usage and interest info, extends SmfContact
       
    37 class SmfTrackInfo; //id, title, album, artist, genre, tag, director,release year, rating, comment info
       
    38 class SmfMusicFingerPrint; //generation is not in scope of smf
       
    39 class SmfVenue;
       
    40 class SmfEvent;
       
    41 class SmfPlaylist;
       
    42 class SmfLyricsService;
       
    43 class SmfLyrics;
       
    44 class SmfSubtitle;
       
    45 class SmfSubtitleSearchFilter;
       
    46 
       
    47 typedef QList<SmfMusicProfile> SmfMusicProfileList;
       
    48 typedef QList<SmfTrackInfo> SmfTrackInfoList;
       
    49 typedef QList<SmfEvent> SmfEventsList;
       
    50 typedef QList<SmfProvider> SmfProviderList;
       
    51 typedef QList<SmfPlaylist> SmfPlaylistList;
       
    52 typedef QList<SmfVenue> SmfVenueList;
       
    53 typedef QList<SmfLyrics> SmfLyricsList;
       
    54 typedef QList<SmfSubtitle> SmfSubtitleList;
       
    55 /**
       
    56  * @ingroup smf_client_group
       
    57   * Basic music service ("org.symbian.smf.client.music.service")
       
    58   */
       
    59 class SMFCLIENT_EXPORT SmfMusicService : public QObject
       
    60 {
       
    61   Q_OBJECT
       
    62 
       
    63 public:
       
    64   /**
       
    65    * Constructs SmfMusicService.
       
    66    * @param baseProvider The base provider info
       
    67    * Seeing as this is a plug-in implementation, these will realistically
       
    68    *  be generated by SMF factory of some kind
       
    69    */
       
    70    SmfMusicService(SmfProvider* baseProvider = 0);
       
    71   ~SmfMusicService();
       
    72 
       
    73 public:
       
    74 
       
    75   /**
       
    76    * Gets self profile information asynchronously.
       
    77    * userInfoAvailable() signal is emitted with SmfMusicProfile when the info is arrived
       
    78    */
       
    79   void userinfo() ;
       
    80 
       
    81   /**
       
    82    * Asynchronously searches information about other service users for a particular venue
       
    83    * searchInfoAvailable() signal is emitted with SmfMusicProfileList when the info is arrived.
       
    84    * When the list is big user can specify the page number and per page item data.
       
    85    * If not supplied by the user default values are used.
       
    86    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    87    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    88    */
       
    89   void searchUser(SmfVenue venue,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ;
       
    90 
       
    91   /**
       
    92    * Gets the base provider info
       
    93    */
       
    94   SmfProvider* getProvider() ;
       
    95 
       
    96 
       
    97 signals:
       
    98 	/**
       
    99 	 * Notification on arrival of the self profile as result of userinfo().
       
   100 	 * @param profile The self profile
       
   101 	 */
       
   102 	void userInfoAvailable(SmfMusicProfile* profile, QString error);
       
   103 
       
   104 	void searchInfoAvailable(SmfMusicProfileList& profileList, QString error,SmfResultPage resultPage);
       
   105 private:
       
   106   SmfProvider* m_baseProvider;
       
   107 };
       
   108 SMF_SERVICE_NAME(SmfMusicService, "org.symbian.smf.client.music.service\0.2")
       
   109 
       
   110 
       
   111 /**
       
   112 * Provides service ("org.symbian.smf.client.music.search") for music search
       
   113 */
       
   114 class SMFCLIENT_EXPORT SmfMusicSearch : public QObject
       
   115 {
       
   116   Q_OBJECT
       
   117 
       
   118 public:
       
   119   /**
       
   120    * Constructs SmfMusicSearch with base provider as arguement.
       
   121    * Seeing as this is a plug-in implementation, these will realistically
       
   122    * be generated by SMF factory of some kind
       
   123    */
       
   124 
       
   125   SmfMusicSearch(SmfProvider* baseProvider = 0);
       
   126   ~SmfMusicSearch();
       
   127 
       
   128 public:
       
   129   // Get the track listing - might be made asynchrnous later
       
   130 
       
   131   /**
       
   132    * Searches for music recommendations similar to a particulartrack asynchronously.
       
   133    * The signal trackSearchAvailable() is emitted with SmfTrackInfoList
       
   134    * once its arrived.
       
   135    * When the list is big user can specify the page number and per page item data.
       
   136    * If not supplied by the user default values are used.
       
   137    * @param track The track for which similar recommendations need to be fetched.
       
   138    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   139    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   140    */
       
   141   void recommendations(SmfTrackInfo track,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ; // basic list of track objects
       
   142 
       
   143   /**
       
   144    * Searches for tracks similar to a given track asynchronously.
       
   145    * The signal trackSearchAvailable() is emitted with SmfTrackInfoList
       
   146    * once its arrived.
       
   147    * When the list is big user can specify the page number and per page item data.
       
   148    * If not supplied by the user default values are used.
       
   149    * @param track The search criteria, similar tracks are searched
       
   150    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   151    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   152    */
       
   153   void tracks(SmfTrackInfo track,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ; // basic list of track objects
       
   154 
       
   155   /**
       
   156    * Searches for a track having similar finger print asynchronously.
       
   157    * The signal trackSearchAvailable() is emitted with SmfTrackInfoList
       
   158    * once its arrived.
       
   159    * @param signature The search criteria,signature to be searched for
       
   160    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   161    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   162    */
       
   163   void trackInfo(SmfMusicFingerPrint signature,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ; // search by fingerprint object
       
   164 
       
   165   /**
       
   166    * Search information about where to buy this song from asynchronously.
       
   167    * The signal storeSearchAvailable() is emitted with SmfProviderList once its arrived.
       
   168    * @param track The search criteria for stores
       
   169    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   170    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   171    */
       
   172   void stores(SmfTrackInfo track,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ;
       
   173 
       
   174   //APIs to get/set base provider info (SmfProvider)
       
   175 
       
   176   /**
       
   177    * Gets the base provider info
       
   178    */
       
   179   SmfProvider* getProvider()  ;
       
   180 
       
   181 
       
   182 public slots:
       
   183 
       
   184 	/**
       
   185 	 * Posts currently playing track.
       
   186 	 * Success can be checked by checking the signal postFinished()
       
   187 	 * @param track Track to post
       
   188 	 */
       
   189   void postCurrentPlaying(SmfTrackInfo track)  ;
       
   190   //int postRating(SmfTrackInfo track, SmfMusicRating rate)  ;
       
   191   //int postComments(SmfTrackInfo track, SmfComment comment)  ;
       
   192 
       
   193 signals:
       
   194 	/**
       
   195 	 * Emitted when the search result for a track is available.
       
   196 	 * Note if number of tacks in the search is large, then it can download the list page by page.
       
   197 	 * In that case this signal is emitted multiple times.
       
   198 	 * @param resultPage Page number info
       
   199 	 */
       
   200 	void trackSearchAvailable(SmfTrackInfoList* result, QString error,SmfResultPage resultPage);
       
   201 
       
   202 	/**
       
   203 	 *  Emitted when the search result for a store is available.
       
   204 	 *  Note if number of tacks in the search is large, then it can download the list page by page.
       
   205 	 *  In that case this signal is emitted multiple times.
       
   206 	 *  @param resultPage Page number info
       
   207 	 */
       
   208 	void storeSearchAvailable(SmfProviderList* result, QString error, SmfResultPage resultPage);
       
   209 private:
       
   210   SmfProvider* m_baseProvider;
       
   211 };
       
   212 SMF_SERVICE_NAME(SmfMusicSearch, "org.symbian.smf.client.music.search\0.2")
       
   213 
       
   214 
       
   215 /**
       
   216  * Remote playlist
       
   217  */
       
   218 class SMFCLIENT_EXPORT SmfPlaylist : public QObject
       
   219 	{
       
   220 	Q_OBJECT
       
   221 
       
   222 public:
       
   223 	SmfPlaylist();
       
   224 	~SmfPlaylist();
       
   225 
       
   226 	/**
       
   227 	 * Gets tracks in the playlist
       
   228 	 */
       
   229 	SmfTrackInfoList* getTrackList();
       
   230 
       
   231 	/**
       
   232 	 * Gets playlist title
       
   233 	 */
       
   234 	QString getPlayListTitle();
       
   235 
       
   236 	/**
       
   237 	 * Gets the creation date
       
   238 	 */
       
   239 	QDateTime getCreationDate();
       
   240 
       
   241 	/**
       
   242 	 * Sets tracks in the playlist
       
   243 	 */
       
   244 	void setTrackList(SmfTrackInfoList* trackList);
       
   245 
       
   246 	/**
       
   247 	 * Sets playlist title
       
   248 	 */
       
   249 	void setPlayListTitle(QString title);
       
   250 
       
   251 	/**
       
   252 	 * Sets creation date
       
   253 	 */
       
   254 	void setCreationDate(QDateTime time);
       
   255 
       
   256 private:
       
   257 	SmfTrackInfoList* m_trackList;
       
   258 	QString m_title;
       
   259 	QDateTime m_creationDate;
       
   260 	};
       
   261 
       
   262 
       
   263 /**
       
   264  * provides service ("org.symbian.smf.client.music.playlist")
       
   265  *
       
   266  * Interface to a remote playlist service. This class
       
   267  * provides some basic functionality to allow applications
       
   268  * to interact with playlists in some music related service provider (e.g. last.fm).
       
   269  *
       
   270  * Note that branding information for the particular service implementation
       
   271  * is available from getProvider() API. See also:
       
   272  * SmfProvider::serviceName(), SmfProvider::serviceIcon()
       
   273  *
       
   274  * All of the functionality described here should be implemented by a service
       
   275  * specific plug-in object.
       
   276  *
       
   277  */
       
   278 class SMFCLIENT_EXPORT SmfPlaylistService : public QObject
       
   279 {
       
   280   Q_OBJECT
       
   281 
       
   282 public:
       
   283   /**
       
   284    * Constructs SmfPlaylistService with base provider info
       
   285    * Seeing as this is a plug-in implementation, these will realistically
       
   286    * be generated by SMF factory of some kind
       
   287    */
       
   288   SmfPlaylistService(SmfProvider* baseProvider = 0);
       
   289   ~SmfPlaylistService();
       
   290 
       
   291 public:
       
   292 
       
   293   /**
       
   294    * Gets the list playlists for the logged-in user asynchronously.
       
   295    * The signal playlistsListAvailable() signal is emitted with
       
   296    * SmfPlaylistList once its arrived .
       
   297    * When the list is big user can specify the page number and per page item data.
       
   298    * If not supplied by the user default values are used.
       
   299    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   300    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   301    */
       
   302   void playlists(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ; // basic list of playlist objects
       
   303 
       
   304   /**
       
   305    * Gets the list playlists for the given user asynchronously.
       
   306    * The signal playlistsListAvailable() signal is emitted with
       
   307    * SmfPlaylistList once its arrived.
       
   308    * When the list is big user can specify the page number and per page item data.
       
   309    * If not supplied by the user default values are used.
       
   310    * @param user User for which to get the playlists
       
   311    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   312    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   313    */
       
   314   void playlistsOf(SmfMusicProfile* user,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ;
       
   315 
       
   316   //APIs to get/set base provider info (SmfProvider)
       
   317 
       
   318   /**
       
   319    * Gets the base provider info
       
   320    */
       
   321   SmfProvider* getProvider()  ;
       
   322 
       
   323 
       
   324 public slots:
       
   325 
       
   326 	/**
       
   327 	 * Upload currently playing track to a playlist. Signal
       
   328 	 * playlistUpdated() can be checked for success value
       
   329 	 * @param plst The playlist to be added in
       
   330 	 * @param tracks The list of tracks to uploaded
       
   331 	 */
       
   332   int addToPlaylist(SmfPlaylist plst, SmfTrackInfoList* tracks)  ;
       
   333 
       
   334 	/**
       
   335 	 * Upload currently playing playlist . Signal
       
   336 	 * playlistUpdated() can be checked for success value
       
   337 	 * @param plst The playlist to be uploaded
       
   338 	 */
       
   339   int postCurrentPlayingPlaylist(SmfPlaylist plst)  ;
       
   340 
       
   341 
       
   342 signals:
       
   343 	/**
       
   344 	 * Notification of availability of list of playlists requested.
       
   345 	 * Note if number of list is large, then it can download the list page by page.
       
   346 	 * In that case this signal is emitted multiple times.
       
   347 	 * @param resultPage Page number info
       
   348 	 */
       
   349 	void playlistsListAvailable(SmfPlaylistList*, QString error, SmfResultPage resultPage);
       
   350 	/**
       
   351 	 * Signals remote updation of playlist with success value
       
   352 	 */
       
   353     int playlistUpdated(bool success) ;
       
   354 private:
       
   355   SmfProvider* m_baseProvider;
       
   356 };
       
   357 SMF_SERVICE_NAME(SmfPlaylistService, "org.symbian.smf.client.music.playlist\0.2")
       
   358 
       
   359 
       
   360 /**
       
   361 * provides service ("org.symbian.smf.client.music.events")
       
   362 */
       
   363 class SMFCLIENT_EXPORT SmfMusicEvents : public QObject
       
   364 {
       
   365   Q_OBJECT
       
   366 
       
   367 public:
       
   368   /**
       
   369    * Constructs SmfMusicEvents with base provider info
       
   370    * Seeing as this is a plug-in implementation, these will realistically
       
   371    *  be generated by SMF factory of some kind
       
   372    */
       
   373   SmfMusicEvents(SmfProvider* baseProvider = 0);
       
   374   ~SmfMusicEvents();
       
   375 
       
   376 public:
       
   377 
       
   378   /**
       
   379    * Gets list of events in a particular location asynchronously.
       
   380    * eventsAvailable() signal is emitted with SmfEventsList once its arrived.
       
   381    * When the list is big user can specify the page number and per page item data.
       
   382    * If not supplied by the user default values are used.
       
   383    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   384    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   385    */
       
   386   void events(QtMobility::QContactGeolocation location,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ;
       
   387 
       
   388   /**
       
   389    * Gets list of venues of a particular location asynchronously.
       
   390    * venuesAvailable() signal is emitted with SmfVenueList once its arrived.
       
   391    * When the list is big user can specify the page number and per page item data.
       
   392    * If not supplied by the user default values are used.
       
   393    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   394    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   395    */
       
   396   void venues(QtMobility::QContactGeolocation location,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ; // basic list of venue objects
       
   397 
       
   398   /**
       
   399    * Gets list of events in a particular venue asynchronously.
       
   400    * eventsAvailable() signal is emitted with SmfEventsList once its arrived.
       
   401    * When the list is big user can specify the page number and per page item data.
       
   402    * If not supplied by the user default values are used.
       
   403    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   404    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   405    */
       
   406   void events(SmfVenue venue,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ; // basic list of events objects
       
   407 
       
   408 
       
   409   //APIs to get/set base provider info (SmfProvider)
       
   410 
       
   411   /**
       
   412    * Gets the base provider info
       
   413    */
       
   414   SmfProvider* getProvider()  ;
       
   415 
       
   416 
       
   417 public slots:
       
   418 
       
   419 	/**
       
   420 	 * Updates events. Might not be supported by all service provider.
       
   421 	 * eventsUpdated() signal can be checked for success value.
       
   422 	 * @param SmfEventsList List of events to be posted
       
   423 	 */
       
   424 	 void postEvents(SmfEventsList events);
       
   425 
       
   426 signals:
       
   427 
       
   428 	/**
       
   429 	 * Notification of the success of request to post an event
       
   430 	 */
       
   431 	void eventsUpdated(bool success);
       
   432 
       
   433 	/**
       
   434 	 * Notification on arrival of event lists
       
   435 	 * Note if number of list is large, then it can download the list page by page.
       
   436 	 * In that case this signal is emitted multiple times.
       
   437 	 * @param resultPage Page number info
       
   438 	 */
       
   439 	void eventsAvailable(SmfEventsList* list, QString error, SmfResultPage resultPage);
       
   440 
       
   441 	/**
       
   442 	 *  Notification on arrival of venues lists
       
   443 	 * Note if number of list is large, then it can download the list page by page.
       
   444 	 * In that case this signal is emitted multiple times.
       
   445 	 * @param resultPage Page number info
       
   446 	 */
       
   447 	void venuesAvailable(SmfVenueList* list, QString error, SmfResultPage resultPage);
       
   448 private:
       
   449   SmfProvider* m_baseProvider;
       
   450 };
       
   451 SMF_SERVICE_NAME(SmfMusicEvents, "org.symbian.smf.client.music.events\0.2")
       
   452 
       
   453 
       
   454 /**
       
   455 * provides service ("org.symbian.smf.client.music.lyrics")
       
   456 */
       
   457 class SMFCLIENT_EXPORT SmfLyricsService : public QObject
       
   458 {
       
   459   Q_OBJECT
       
   460 
       
   461 public:
       
   462   /**
       
   463    * Constructs SmfLyricsService with base provider info.
       
   464    * Seeing as this is a plug-in implementation, these will realistically
       
   465    * be generated by SMF factory of some kind
       
   466    */
       
   467 
       
   468   SmfLyricsService(SmfProvider* baseProvider = 0);
       
   469   ~SmfLyricsService();
       
   470 
       
   471 public:
       
   472 
       
   473   /**
       
   474    * Get the lyrics lists asynchrnously, it fetches texts without time info.
       
   475    * lyricsAvailable() notification comes SmfLyricsList with when the data is available
       
   476    * @param track Track for which lyrics needs to be fetched.
       
   477    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   478    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   479    */
       
   480   void lyrics(SmfTrackInfo track,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ;
       
   481 
       
   482   /**
       
   483    * Get the lyrics lists asynchrnously, it fetches texts with time info.
       
   484    * Subtitle search filter can be applied
       
   485    * subtitleAvailable() notification comes SmfSubtitleList with when the data is available
       
   486    * @param track Track for which subtitle needs to be fetched.
       
   487    * @param filter Subtitle search filter
       
   488    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   489    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   490    */
       
   491   void subtitles(SmfTrackInfo track, SmfSubtitleSearchFilter filter,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE)  ; // texts with time information
       
   492   //APIs to get/set base provider info (SmfProvider)
       
   493 
       
   494   /**
       
   495    * Gets the base provider info
       
   496    */
       
   497   SmfProvider* getProvider()  ;
       
   498 
       
   499 
       
   500 public slots:
       
   501 
       
   502 
       
   503 signals:
       
   504 
       
   505 	/**
       
   506 	 * Notification on arrival of lyrics
       
   507 	 * Note if the list is large, then it can download the list page by page.
       
   508 	 * In that case this signal is emitted multiple times.
       
   509 	 * @param resultPage Page number info
       
   510 	 */
       
   511 	void lyricsAvailable(SmfLyricsList* list, QString error, SmfResultPage resultPage);
       
   512 
       
   513 	/**
       
   514 	 * Notification on arrival of subtitle based on filter.
       
   515 	 * Note if the list is large, then it can download the list page by page.
       
   516 	 * In that case this signal is emitted multiple times.
       
   517 	 * @param resultPage Page number info
       
   518 	 */
       
   519 	void subtitleAvailable(SmfSubtitleList* list, QString error, SmfResultPage resultPage);
       
   520 private:
       
   521   SmfProvider* m_baseProvider;
       
   522 };
       
   523 SMF_SERVICE_NAME(SmfLyricsService, "org.symbian.smf.client.music.lyrics\0.2")
       
   524 
       
   525 #endif // SMFMUSIC_H
       
   526