qtinternetradio/irqisdsclient/inc/irqisdsclient.h
changeset 14 896e9dbc5f19
parent 8 3b03c28289e6
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
    20 
    20 
    21 #include <QObject>
    21 #include <QObject>
    22 #include <e32base.h>
    22 #include <e32base.h>
    23 #include <badesca.h>
    23 #include <badesca.h>
    24 #include <QList> 
    24 #include <QList> 
       
    25 #include <QMutex>
    25 #include "irqenums.h" 
    26 #include "irqenums.h" 
    26  
    27 #include "irqisdsclientexporter.h"
       
    28 
       
    29 class IRQAbstractIsdsClientImpl;
       
    30 
    27 class IRQIsdsClientImpl;
    31 class IRQIsdsClientImpl;
    28 class IRQFavoritesDB;
    32 class IRQFavoritesDB;
    29 class IRQPreset;
    33 class IRQPreset;
    30 class IRQBrowseCategoryItem;
    34 class IRQBrowseCategoryItem;
    31 class IRQChannelItem;
    35 class IRQChannelItem;
    39 
    43 
    40 /**
    44 /**
    41  *This class is being used by the UI to send request and get data from low layer
    45  *This class is being used by the UI to send request and get data from low layer
    42  *All interfaces are QT-supported
    46  *All interfaces are QT-supported
    43  */
    47  */
    44 class IRQIsdsClient : public QObject
    48 class IRQISDSCLIENT_DLL_EXPORT IRQIsdsClient : public QObject
    45 {
    49 {
    46 Q_OBJECT
    50 Q_OBJECT
    47 
    51 
    48 public:
    52 public:
    49 
    53 
    59     /**
    63     /**
    60      *IRQIsdsClient::openInstance() 
    64      *IRQIsdsClient::openInstance() 
    61      *to get an instance of the IRQIsdsClient. 
    65      *to get an instance of the IRQIsdsClient. 
    62      *@return IRQIsdsClient *
    66      *@return IRQIsdsClient *
    63      */
    67      */
    64     IMPORT_C static IRQIsdsClient *openInstance();
    68     static IRQIsdsClient *openInstance();
    65 
    69 
    66     /**
    70     /**
    67      *IRQIsdsClient::CloseInstance() 
    71      *IRQIsdsClient::CloseInstance() 
    68      *close the instance.
    72      *close the instance.
    69      *@return IRQIsdsClient *
    73      *@return IRQIsdsClient *
    70      */
    74      */
    71     IMPORT_C void closeInstance();
    75     void closeInstance();
    72 
    76 
    73     /**
    77     /**
    74      *IRQIsdsClient::IsdsSearchRequestL()
    78      *IRQIsdsClient::IsdsSearchRequestL()
    75      *Issue a search request to the isds server
    79      *Issue a search request to the isds server
    76      *@param QString, the requested search string
    80      *@param QString, the requested search string
    77      **/
    81      **/
    78     IMPORT_C void isdsSearchRequest(const QString& aIsdsSearchString);
    82     void isdsSearchRequest(const QString& aIsdsSearchString);
    79 
    83 
    80     /**
    84     /**
    81      *IRQIsdsClient::IsdsCategoryRequest()
    85      *IRQIsdsClient::IsdsCategoryRequest()
    82      *Send the category request by the category type
    86      *Send the category request by the category type
    83      *@param IRQIsdsClientInterfaceIDs, the requested category type
    87      *@param IRQIsdsClientInterfaceIDs, the requested category type
    84      **/
    88      **/
    85     IMPORT_C void isdsCategoryRequest(
    89     void isdsCategoryRequest(
    86             IRQIsdsClient::IRQIsdsClientInterfaceIDs aIDType, bool& aCache);
    90             IRQIsdsClient::IRQIsdsClientInterfaceIDs aIDType, bool& aCache);
    87     
    91     
    88     /**
    92     /**
    89      *IRQIsdsClient::isdsIsCategoryCached()
    93      *IRQIsdsClient::isdsIsCategoryCached()
    90      *to check wether the request data is cached. Different from the above
    94      *to check wether the request data is cached. Different from the above
    91      *function, this function will not send the http request if the data is 
    95      *function, this function will not send the http request if the data is 
    92      *not cached in DB. Normally, we call this function to check the cache.
    96      *not cached in DB. Normally, we call this function to check the cache.
    93      **/
    97      **/
    94     IMPORT_C bool isdsIsCategoryCached(IRQIsdsClient::IRQIsdsClientInterfaceIDs aIDType);
    98     bool isdsIsCategoryCached(IRQIsdsClient::IRQIsdsClientInterfaceIDs aIDType);
    95     
    99     
    96     /**
   100     /**
    97      *IRQIsdsClient::isdsIsChannelCached()
   101      *IRQIsdsClient::isdsIsChannelCached()
    98      *to check wether the request data is cached. Different from the followed
   102      *to check wether the request data is cached. Different from the followed
    99      *function, this function will not send the http request if the data is 
   103      *function, this function will not send the http request if the data is 
   100      *not cached in DB. Normally, we call this function to check the cache.
   104      *not cached in DB. Normally, we call this function to check the cache.
   101      **/
   105      **/
   102     IMPORT_C bool isdsIsChannelCached(int aIndex);
   106     bool isdsIsChannelCached(int aIndex);
   103 
   107 
   104     /**
   108     /**
   105      *IRQIsdsClient::IsdsChannelRequestL()
   109      *IRQIsdsClient::IsdsChannelRequestL()
   106      *Send the channels request by the channel index in the specify category
   110      *Send the channels request by the channel index in the specify category
   107      *@param int, the requested index from UI view   
   111      *@param int, the requested index from UI view   
   108      **/
   112      **/
   109     IMPORT_C void isdsChannelRequest(int aIndex, bool& aCache);
   113     void isdsChannelRequest(int aIndex, bool& aCache);
   110 
   114 
   111     /**
   115     /**
   112      *IRQIsdsClient::IsdsListenRequestL()
   116      *IRQIsdsClient::IsdsListenRequestL()
   113      *issue a listen request to the isds client. 
   117      *issue a listen request to the isds client. 
   114      *@param int,bool, 
   118      *@param int,bool, 
   115      *if we set the aHistoryBool to false, the aCurrentIndex means the current song's index
   119      *if we set the aHistoryBool to false, the aCurrentIndex means the current song's index
   116      *in the current list.
   120      *in the current list.
   117      *if we set the aHistoryBool to true,  the aCurrentIndex means the channel ID you expect 
   121      *if we set the aHistoryBool to true,  the aCurrentIndex means the channel ID you expect 
   118      *to listen, for sometimes, the channel ID is saved in the DB so we could get it directly
   122      *to listen, for sometimes, the channel ID is saved in the DB so we could get it directly
   119      **/
   123      **/
   120     IMPORT_C void isdsListenRequest(int aCurrentIndex, bool aHistoryBool =
   124     void isdsListenRequest(int aCurrentIndex, bool aHistoryBool =
   121             false);
   125             false);
   122 
   126 
   123     /**
   127     /**
   124      *IRQIsdsClient::IsdsListenRequestL()
   128      *IRQIsdsClient::IsdsListenRequestL()
   125      *to syncronize presets
   129      *to syncronize presets
   126      *@param int,QString, the preset id and the last modified tag for the preset   
   130      *@param int,QString, the preset id and the last modified tag for the preset   
   127      **/
   131      **/
   128     IMPORT_C int isdsSyncPreset(int aPresetId, const QString& aIfModifySince, IRQFavoritesDB *aFavPresets);
   132     int isdsSyncPreset(int aPresetId, const QString& aIfModifySince, IRQFavoritesDB *aFavPresets);
   129 
   133 
   130     /**
   134     /**
   131      *IRQIsdsClient::IsdsCancelRequest()
   135      *IRQIsdsClient::IsdsCancelRequest()
   132      *Cacel the request sent by the UI.
   136      *Cacel the request sent by the UI.
   133      *@param None
   137      *@param None
   134      **/
   138      **/
   135     IMPORT_C void isdsCancelRequest();
   139     void isdsCancelRequest();
   136 
   140 
   137     /**
   141     /**
   138      *IRQIsdsClient::IsdsGetCurrentPlayingIndex()
   142      *IRQIsdsClient::IsdsGetCurrentPlayingIndex()
   139      *get the playing song's index 
   143      *get the playing song's index 
   140      *@param None
   144      *@param None
   141      **/
   145      **/
   142     IMPORT_C int isdsGetCurrentPlayingIndex();
   146     int isdsGetCurrentPlayingIndex();
   143 
   147 
   144     /**
   148     /**
   145      *IRQIsdsClient::IsdsIsCategoryBanner()
   149      *IRQIsdsClient::IsdsIsCategoryBanner()
   146      *to see wether category view has a banner.
   150      *to see wether category view has a banner.
   147      *@param None
   151      *@param None
   148      **/
   152      **/
   149     IMPORT_C bool isdsIsCategoryBanner();
   153     bool isdsIsCategoryBanner();
   150 
   154 
   151     /**
   155     /**
   152      *IRQIsdsClient::IsdsIsChannelBanner()
   156      *IRQIsdsClient::IsdsIsChannelBanner()
   153      *to see wether channel view has a banner.
   157      *to see wether channel view has a banner.
   154      *@param None
   158      *@param None
   155      **/
   159      **/
   156     IMPORT_C bool isdsIsChannelBanner();
   160     bool isdsIsChannelBanner();
   157 
   161 
   158     /**
   162     /**
   159      *IRQIsdsClient::IsdsLogoDownSendRequestL()
   163      *IRQIsdsClient::IsdsLogoDownSendRequestL()
   160      *the api is called from the UI(nowplaying view) to download logo.
   164      *the api is called from the UI(nowplaying view) to download logo.
   161      *@param None
   165      *@param None
   162      **/
   166      **/
   163     IMPORT_C void isdsLogoDownSendRequest(IRQPreset* aPreset, int aNPVReq = 1,
   167     void isdsLogoDownSendRequest(IRQPreset* aPreset, int aNPVReq = 1,
   164             int aXValue = 0, int aYValue = 0);
   168             int aXValue = 0, int aYValue = 0);
   165 
   169 
   166     /**
   170     /**
   167      *IRQIsdsClient::isdsIsLogoCached()
   171      *IRQIsdsClient::isdsIsLogoCached()
   168      *to check wether the preset's logo is cached or not.      
   172      *to check wether the preset's logo is cached or not.      
   169      **/
   173      **/
   170     IMPORT_C bool isdsIsLogoCached(IRQPreset* aPreset, int aXValue = 0, int aYValue = 0);
   174     bool isdsIsLogoCached(IRQPreset* aPreset, int aXValue = 0, int aYValue = 0);
       
   175 
   171     /**
   176     /**
   172      *IRQIsdsClient::isdsLogoDownCancelTransaction()
   177      *IRQIsdsClient::isdsLogoDownCancelTransaction()
   173      *the api is called to cancel the current transaction
   178      *the api is called to cancel the current transaction
   174      *@param None
   179      *@param None
   175      **/
   180      **/
   176     IMPORT_C void isdsLogoDownCancelTransaction();
   181     void isdsLogoDownCancelTransaction();
   177 
   182 
   178     /**
   183     /**
   179      * IRQIsdsClient::isdsLogoDownIsRunning()
   184      * IRQIsdsClient::isdsLogoDownIsRunning()
   180      *  To know the status of downloading logo
   185      *  To know the status of downloading logo
   181      */
   186      */
   182     IMPORT_C bool isdsLogoDownIsRunning() const;
   187     bool isdsLogoDownIsRunning() const;
   183 
   188 
   184     /**
   189     /**
   185      * IRQIsdsClient::IsdsLogoDownCheckCacheLogoL()
   190      * IRQIsdsClient::IsdsLogoDownCheckCacheLogoL()
   186      * takes the url as a parameter and the return value indicates wether the 
   191      * takes the url as a parameter and the return value indicates wether the 
   187      * logo is in the cache. If the logo is in the cache, the logo data will 
   192      * logo is in the cache. If the logo is in the cache, the logo data will 
   188      * be saved in an internal member of the logodown engine and we can use 
   193      * be saved in an internal member of the logodown engine and we can use 
   189      * the next function to get it from the engine. 
   194      * the next function to get it from the engine. 
   190      * this API is called form the search results view.
   195      * this API is called form the search results view.
   191      * @param QString: the url of the img, int: the status for getting
   196      * @param QString: the url of the img, int: the status for getting
   192      */
   197      */
   193     IMPORT_C void isdsLogoDownCheckCacheLogo(const QString& aURL, int& aStatus);
   198     void isdsLogoDownCheckCacheLogo(const QString& aURL, int& aStatus);
   194 
   199 
   195     /**
   200     /**
   196      * IRQIsdsClient::IsdsLogoDownSendCacheLogo()
   201      * IRQIsdsClient::IsdsLogoDownSendCacheLogo()
   197      * get the cache logo from the logodown engine. The return value should 
   202      * get the cache logo from the logodown engine. The return value should 
   198      * be changed to be QT value in future 
   203      * be changed to be QT value in future 
   199      * @param None
   204      * @param None
   200      */
   205      */
   201     IMPORT_C TDesC8& isdsLogoDownSendCacheLogo();
   206     TDesC8& isdsLogoDownSendCacheLogo();
   202     
   207     
   203     /**
   208     /**
   204      * IRQIsdsClient::isdsPostLog()
   209      * IRQIsdsClient::isdsPostLog()
   205      * send the log file to the isds server
   210      * send the log file to the isds server
   206      * @param None
   211      * @param None
   207      */
   212      */
   208     IMPORT_C void isdsPostLog(const QString& aFileName);
   213     void isdsPostLog(const QString& aFileName);
   209     
   214     
   210     /*
   215     /*
   211      * IRQIsdsClient::isdsGetIRID()
   216      * IRQIsdsClient::isdsGetIRID()
   212 	 * get the irid of the application
   217 	 * get the irid of the application
   213      */
   218      */
   214     IMPORT_C void isdsGetIRID();
   219     void isdsGetIRID();
   215 
   220 
   216     /*
   221     /*
   217      * IRQIsdsClient::isdsGetBrowseBanner()
   222      * IRQIsdsClient::isdsGetBrowseBanner()
   218      * get the browse advertisement url and clickthrough url
   223      * get the browse advertisement url and clickthrough url
   219      */
   224      */
   220     IMPORT_C void isdsGetBrowseBanner(QString& aBannerUrl, QString& aClickThroughUrl);
   225     void isdsGetBrowseBanner(QString& aBannerUrl, QString& aClickThroughUrl);
   221 
   226 
   222     /*
   227     /*
   223      * IRQIsdsClient::isdsMultiSearch()
   228      * IRQIsdsClient::isdsMultiSearch()
   224      * the new interface of multi search
   229      * the new interface of multi search
   225      */
   230      */
   226     IMPORT_C void isdsMultSearch(QString aGenreID, QString aCountryID, QString aLanguageID, QString aSearchText);
   231     void isdsMultSearch(QString aGenreID, QString aCountryID, QString aLanguageID, QString aSearchText);
   227 
   232 
   228     IMPORT_C bool isdsIsConstructSucceed() const;
   233     bool isdsIsConstructSucceed() const;
   229     
   234     
   230     signals:
   235     signals:
   231     /**
   236     /**
   232      *IRQIsdsClient::categoryItemsChanged()
   237      *IRQIsdsClient::categoryItemsChanged()
   233      *A signal to notify UI that the category items data is changed
   238      *A signal to notify UI that the category items data is changed
   280      * A signal to notify UI that the irid is received
   285      * A signal to notify UI that the irid is received
   281      */
   286      */
   282     void iridReceived(QString aIRID);
   287     void iridReceived(QString aIRID);
   283     
   288     
   284     
   289     
   285 
   290     
   286 private:
   291 private:
   287 
   292 
   288     /*
   293     /*
   289      * the IRQIsdsClientImpl of the IRQIsdsClient
   294      * Pointer to IRQIsdsClient instance
   290      */
   295      */
   291     IRQIsdsClientImpl *iImpl;
   296 	static IRQIsdsClient *mInstance;
       
   297 	
       
   298     /*
       
   299      * Mutex lock for instance singleton
       
   300      */
       
   301     static QMutex mMutex;
       
   302 	
       
   303     /*
       
   304      * the pointer of IRQAbstractIsdsClientImpl type point to IRQIsdsClientImpl of the IRQIsdsClient
       
   305      */
       
   306 	IRQAbstractIsdsClientImpl *d_ptr;
   292 
   307 
   293     /**
   308     /**
   294      *iSingletonInstances
   309      *iSingletonInstances
   295      * the count of reference of the object
   310      * the count of reference of the object
   296      */
   311      */
   297     int iSingletonInstances;
   312     static int mRef;
   298 
   313 
   299     IRQIsdsClient();
   314     IRQIsdsClient();
   300     /**
   315     /**
   301      *IRQIsdsClient::~IRQIsdsClient()
   316      *IRQIsdsClient::~IRQIsdsClient()
   302      *default c++ function
   317      *default c++ function
   303      **/
   318      **/
   304     ~IRQIsdsClient();
   319     ~IRQIsdsClient();
       
   320 
       
   321 	friend class IRQIsdsClientImpl;
   305 };
   322 };
   306 
   323 
   307 #endif
   324 #endif