qtinternetradio/irqisdsclient/inc/irqisdsclient.h
changeset 0 09774dfdd46b
child 3 ee64f059b8e1
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  a new wrapper class in QT 
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef IRQISDSCLIENT_H
       
    19 #define IRQISDSCLIENT_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <e32base.h>
       
    23 #include <badesca.h>
       
    24 #include <QList> 
       
    25 #include "irqenums.h" 
       
    26  
       
    27 class IRQIsdsClientImpl;
       
    28 class IRQFavoritesDB;
       
    29 class IRQPreset;
       
    30 class IRQBrowseCategoryItem;
       
    31 class IRQChannelItem;
       
    32 
       
    33 enum IRQSycPresetStatus
       
    34 {
       
    35     EIRQIsdsSycPresetNoChange,
       
    36     EIRQIsdsSycPresetRemoved,
       
    37     EIRQIsdsSycPresetChanged
       
    38 };
       
    39 
       
    40 /**
       
    41  *This class is being used by the UI to send request and get data from low layer
       
    42  *All interfaces are QT-supported
       
    43  */
       
    44 class IRQIsdsClient : public QObject
       
    45 {
       
    46 Q_OBJECT
       
    47 
       
    48 public:
       
    49 
       
    50     /**
       
    51      *IRQIsdsClient::IRQIsdsClientInterfaceIDs()
       
    52      *enum to indicate which the type of category   
       
    53      */
       
    54     enum IRQIsdsClientInterfaceIDs
       
    55     {
       
    56         EGenre, ELanguages, ECountries, Ehotpicks
       
    57     };
       
    58 
       
    59     /**
       
    60      *IRQIsdsClient::openInstance() 
       
    61      *to get an instance of the IRQIsdsClient. 
       
    62      *@return IRQIsdsClient *
       
    63      */
       
    64     IMPORT_C static IRQIsdsClient *openInstance(IRQFavoritesDB *aFavPresets);
       
    65 
       
    66     /**
       
    67      *IRQIsdsClient::CloseInstance() 
       
    68      *close the instance.
       
    69      *@return IRQIsdsClient *
       
    70      */
       
    71     IMPORT_C void closeInstance();
       
    72 
       
    73     /**
       
    74      *IRQIsdsClient::IsdsSearchRequestL()
       
    75      *Issue a search request to the isds server
       
    76      *@param QString, the requested search string
       
    77      **/
       
    78     IMPORT_C void isdsSearchRequest(const QString& aIsdsSearchString);
       
    79 
       
    80     /**
       
    81      *IRQIsdsClient::IsdsCategoryRequest()
       
    82      *Send the category request by the category type
       
    83      *@param IRQIsdsClientInterfaceIDs, the requested category type
       
    84      **/
       
    85     IMPORT_C void isdsCategoryRequest(
       
    86             IRQIsdsClient::IRQIsdsClientInterfaceIDs aIDType, bool& aCache);
       
    87     
       
    88     /**
       
    89      *IRQIsdsClient::isdsIsCategoryCached()
       
    90      *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 
       
    92      *not cached in DB. Normally, we call this function to check the cache.
       
    93      **/
       
    94     IMPORT_C bool isdsIsCategoryCached(IRQIsdsClient::IRQIsdsClientInterfaceIDs aIDType);
       
    95     
       
    96     /**
       
    97      *IRQIsdsClient::isdsIsChannelCached()
       
    98      *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 
       
   100      *not cached in DB. Normally, we call this function to check the cache.
       
   101      **/
       
   102     IMPORT_C bool isdsIsChannelCached(int aIndex);
       
   103 
       
   104     /**
       
   105      *IRQIsdsClient::IsdsChannelRequestL()
       
   106      *Send the channels request by the channel index in the specify category
       
   107      *@param int, the requested index from UI view   
       
   108      **/
       
   109     IMPORT_C void isdsChannelRequest(int aIndex, bool& aCache);
       
   110 
       
   111     /**
       
   112      *IRQIsdsClient::IsdsListenRequestL()
       
   113      *issue a listen request to the isds client. 
       
   114      *@param int,bool, the current index of channel, the history tag  
       
   115      **/
       
   116     IMPORT_C void isdsListenRequest(int aCurrentIndex, bool aHistoryBool =
       
   117             false);
       
   118 
       
   119     /**
       
   120      *IRQIsdsClient::IsdsListenRequestL()
       
   121      *to syncronize presets
       
   122      *@param int,QString, the preset id and the last modified tag for the preset   
       
   123      **/
       
   124     IMPORT_C int isdsSyncPreset(int aPresetId, const QString& aIfModifySince);
       
   125 
       
   126     /**
       
   127      *IRQIsdsClient::IsdsCancelRequest()
       
   128      *Cacel the request sent by the UI.
       
   129      *@param None
       
   130      **/
       
   131     IMPORT_C void isdsCancelRequest();
       
   132 
       
   133     /**
       
   134      *IRQIsdsClient::IsdsGetCurrentPlayingIndex()
       
   135      *get the playing song's index 
       
   136      *@param None
       
   137      **/
       
   138     IMPORT_C int isdsGetCurrentPlayingIndex();
       
   139 
       
   140     /**
       
   141      *IRQIsdsClient::IsdsIsCategoryBanner()
       
   142      *to see wether category view has a banner.
       
   143      *@param None
       
   144      **/
       
   145     IMPORT_C bool isdsIsCategoryBanner();
       
   146 
       
   147     /**
       
   148      *IRQIsdsClient::IsdsIsChannelBanner()
       
   149      *to see wether channel view has a banner.
       
   150      *@param None
       
   151      **/
       
   152     IMPORT_C bool isdsIsChannelBanner();
       
   153 
       
   154     /**
       
   155      *IRQIsdsClient::IsdsLogoDownSendRequestL()
       
   156      *the api is called from the UI(nowplaying view) to download logo.
       
   157      *@param None
       
   158      **/
       
   159     IMPORT_C void isdsLogoDownSendRequest(IRQPreset* aPreset, int aNPVReq = 1,
       
   160             int aXValue = 0, int aYValue = 0);
       
   161 
       
   162     /**
       
   163      *IRQIsdsClient::isdsIsLogoCached()
       
   164      *to check wether the preset's logo is cached or not.      
       
   165      **/
       
   166     IMPORT_C bool isdsIsLogoCached(IRQPreset* aPreset, int aXValue = 0, int aYValue = 0);
       
   167     /**
       
   168      *IRQIsdsClient::isdsLogoDownCancelTransaction()
       
   169      *the api is called to cancel the current transaction
       
   170      *@param None
       
   171      **/
       
   172     IMPORT_C void isdsLogoDownCancelTransaction();
       
   173 
       
   174     /**
       
   175      * IRQIsdsClient::isdsLogoDownIsRunning()
       
   176      *  To know the status of downloading logo
       
   177      */
       
   178     IMPORT_C bool isdsLogoDownIsRunning() const;
       
   179 
       
   180     /**
       
   181      * IRQIsdsClient::IsdsLogoDownCheckCacheLogoL()
       
   182      * takes the url as a parameter and the return value indicates wether the 
       
   183      * logo is in the cache. If the logo is in the cache, the logo data will 
       
   184      * be saved in an internal member of the logodown engine and we can use 
       
   185      * the next function to get it from the engine. 
       
   186      * this API is called form the search results view.
       
   187      * @param QString: the url of the img, int: the status for getting
       
   188      */
       
   189     IMPORT_C void isdsLogoDownCheckCacheLogo(const QString& aURL, int& aStatus);
       
   190 
       
   191     /**
       
   192      * IRQIsdsClient::IsdsLogoDownSendCacheLogo()
       
   193      * get the cache logo from the logodown engine. The return value should 
       
   194      * be changed to be QT value in future 
       
   195      * @param None
       
   196      */
       
   197     IMPORT_C TDesC8& isdsLogoDownSendCacheLogo();
       
   198     
       
   199     /**
       
   200      * IRQIsdsClient::isdsPostLog()
       
   201      * send the log file to the isds server
       
   202      * @param None
       
   203      */
       
   204     IMPORT_C void isdsPostLog(const QString& aFileName);
       
   205     
       
   206     /*
       
   207      * IRQIsdsClient::isdsGetIRID()
       
   208 	 * get the irid of the application
       
   209      */
       
   210     IMPORT_C void isdsGetIRID();
       
   211 
       
   212     /*
       
   213      * IRQIsdsClient::isdsGetBrowseBanner()
       
   214      * get the browse advertisement url and clickthrough url
       
   215      */
       
   216     IMPORT_C void isdsGetBrowseBanner(QString& aBannerUrl, QString& aClickThroughUrl);
       
   217 
       
   218     /*
       
   219      * IRQIsdsClient::isdsMultiSearch()
       
   220      * the new interface of multi search
       
   221      */
       
   222     IMPORT_C void isdsMultSearch(QString aGenreID, QString aCountryID, QString aLanguageID, QString aSearchText);
       
   223 
       
   224     IMPORT_C bool isdsIsConstructSucceed() const;
       
   225     
       
   226     signals:
       
   227     /**
       
   228      *IRQIsdsClient::categoryItemsChanged()
       
   229      *A signal to notify UI that the category items data is changed
       
   230      *@param QList<IRQBrowseCategoryItem *>, the data list sent to UI model
       
   231      **/
       
   232     void categoryItemsChanged(QList<IRQBrowseCategoryItem *> *aPushItemsList);
       
   233     /**
       
   234      *IRQIsdsClient::channelItemsChanged()
       
   235      *A signal to notify UI that the channel items data is changed
       
   236      *@param QList<QIRChannelItem *>, the data list sent to UI model
       
   237      **/
       
   238     void channelItemsChanged(QList<IRQChannelItem *> *aPushItemsList);
       
   239     /**
       
   240      *IRQIsdsClient::operationException()
       
   241      *A signal to notify UI that some inner error occurs     
       
   242      *@param IRQError, the error type notified
       
   243      **/
       
   244     void operationException(IRQError aError);
       
   245 
       
   246     /**
       
   247      *IRQIsdsClient::presetResponse()
       
   248      *A signal to notify UI that the preset data is changed     * 
       
   249      *@param QIRPreset*, the data sent to UI model
       
   250      **/
       
   251     void presetResponse(IRQPreset *aPreset);
       
   252 
       
   253     /**
       
   254      *IRQIsdsClient::presetResponse()
       
   255      *A signal to notify UI that the preset data is changed     * 
       
   256      *@param QIRPreset* IRQSycPresetStatus, the data sent to UI model
       
   257      **/
       
   258     void syncPresetResult(IRQSycPresetStatus aStatus, IRQPreset *aPreset);
       
   259 
       
   260     /**
       
   261      *IRQIsdsClient::presetLogoDownloaded()
       
   262      *A signal to notify UI that the preset logo requested is downloaded from server 
       
   263      *@param None
       
   264      **/
       
   265     void presetLogoDownloaded(IRQPreset* aPreset);
       
   266 
       
   267     /**
       
   268      *IRQIsdsClient::presetLogoDownloadError()
       
   269      *A signal to notify UI that the preset logo downloading is error      
       
   270      *@param None
       
   271      **/
       
   272     void presetLogoDownloadError();
       
   273     
       
   274     /*
       
   275      * IRQIsdsClient::iridReceived()
       
   276      * A signal to notify UI that the irid is received
       
   277      */
       
   278     void iridReceived(QString aIRID);
       
   279     
       
   280     
       
   281 
       
   282 private:
       
   283 
       
   284     /*
       
   285      * the IRQIsdsClientImpl of the IRQIsdsClient
       
   286      */
       
   287     IRQIsdsClientImpl *iImpl;
       
   288 
       
   289     /**
       
   290      *iSingletonInstances
       
   291      * the count of reference of the object
       
   292      */
       
   293     int iSingletonInstances;
       
   294 
       
   295     IRQIsdsClient(IRQFavoritesDB *aFavPresets);
       
   296     /**
       
   297      *IRQIsdsClient::~IRQIsdsClient()
       
   298      *default c++ function
       
   299      **/
       
   300     ~IRQIsdsClient();
       
   301 };
       
   302 
       
   303 #endif