internetradio2.0/uiinc/irisdswrapper.h
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Wrapper class for Isds functions
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef IRISDSWRAPPER_H
       
    23 #define IRISDSWRAPPER_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <BADESCA.H>
       
    27 #include "misdsresponseobserver.h"
       
    28 #include "isdsclientdll.h"
       
    29 #include <AknProgressDialog.h>
       
    30 
       
    31 const TInt KPresetsArrayMaxLength = 50;
       
    32 
       
    33 
       
    34 class CIRIsdsClient;
       
    35 class CIRBrowseCatagoryItems;
       
    36 class CIRBrowseChannelItems;
       
    37 class CIRSettings;
       
    38 class CIRFavoritesDb;
       
    39 class CIRIsdsPreset;
       
    40 class CIRDialogLauncher;
       
    41 class CAknWaitDialog;
       
    42 
       
    43 class MViewsResponseAndErrorObserver;
       
    44 class MSyncPresetObserver;
       
    45 
       
    46 class CIRIsdsWrapper:public CBase,public MIsdsResponseObserver,public MProgressDialogCallback
       
    47 {
       
    48 
       
    49 public:
       
    50 	/* Function : NewL
       
    51 	 * function to return an instance of CIRIsdsWrapper
       
    52 	 * Two phase constructor
       
    53      */
       
    54  	static CIRIsdsWrapper* NewL(CIRSettings& aIRSettings,CIRFavoritesDb& aFavPresets);        
       
    55     /**
       
    56      * NewLC.
       
    57      * Two-phased constructor.
       
    58      * Create a CIRIsdsWrapper object, which will draw itself
       
    59      * to aRect.
       
    60      */
       
    61     static CIRIsdsWrapper* NewLC(CIRSettings& aIRSettings,CIRFavoritesDb& aFavPresets);        
       
    62     /**
       
    63      * ~CIRIsdsWrapper
       
    64      * Destructor.
       
    65      */
       
    66     ~CIRIsdsWrapper();
       
    67  
       
    68    /**
       
    69      * ConstructL
       
    70      * 2nd phase constructor.
       
    71      * Perform the second phase construction of a
       
    72      * CIRSearchView object.
       
    73      */
       
    74     void ConstructL();
       
    75 		
       
    76 	/**
       
    77      * CIRSearchView.
       
    78      * C++ default constructor.
       
    79      */
       
    80     CIRIsdsWrapper(CIRSettings& aIRSettings,CIRFavoritesDb& aFavPresets);  
       
    81 	/**
       
    82 	* IsdsSearchRequestL
       
    83 	* Issues a search request to the Isds Client
       
    84 	*/
       
    85 	void IsdsSearchRequestL(MViewsResponseAndErrorObserver* aViewObserver,
       
    86 							const TDesC& aIsdsSearchString);
       
    87 
       
    88 	/**
       
    89 	* IsdsCategoryRequestL
       
    90 	* Issues a category request to the Isds Client
       
    91 	*/
       
    92 	void IsdsCategoryRequestL(MViewsResponseAndErrorObserver* aViewObserver,
       
    93 							CIRIsdsClient::TIRIsdsclientInterfaceIDs aIDType);
       
    94 
       
    95 	/**
       
    96 	* IsdsChannelRequestL
       
    97 	* Issues a channel request to the Isds Client
       
    98 	*/
       
    99 	void IsdsChannelRequestL(MViewsResponseAndErrorObserver* aViewObserver,TInt aIndex);
       
   100 
       
   101 	/**
       
   102 	* IsdsListenRequestL
       
   103 	* Issues a Listen request to the Isds Client
       
   104 	*/
       
   105 	void IsdsListenRequestL(MViewsResponseAndErrorObserver* aViewObserver,
       
   106 					TInt aCurrentIndex,TBool aHistoryBool=EFalse);
       
   107 	
       
   108     /** 
       
   109      * MIsdsResponseObserver::IsdsErrorL()
       
   110 	 * Used to Indiacte error in retrieving data from Isds
       
   111 	 * @param aErrCode- contains error code
       
   112 	 */
       
   113     void IsdsErrorL(TInt aErrCode);
       
   114     
       
   115 	/**
       
   116 	 * MIsdsResponseObserver::IsdsCatogoryDataReceivedL()
       
   117 	 * Called when catogory information is recieved from ISDS
       
   118 	 * @param aParsedStructure - contains catogory info
       
   119 	 */
       
   120 	void IsdsCatogoryDataReceivedL(
       
   121 		CArrayPtrFlat<CIRBrowseCatagoryItems> & aParsedStructure) ;
       
   122     
       
   123 	/**
       
   124 	 * MIsdsResponseObserver::IsdsChannelDataReceivedL()
       
   125 	 * Called when channel information is recieved from ISDS
       
   126 	 * @param aParsedStructure - contains Channel info
       
   127 	 */
       
   128 	void IsdsChannelDataReceivedL(
       
   129 		CArrayPtrFlat<CIRBrowseChannelItems> & aParsedStructure);
       
   130     
       
   131 	/**
       
   132 	 * MIsdsResponseObserver::IsdsPresetDataReceivedL()
       
   133 	 * Called when preset information is recieved from ISDS
       
   134 	 * @param aParsedStructure - contains Preset info
       
   135 	 */
       
   136 	void IsdsPresetDataReceivedL(
       
   137 		CArrayPtrFlat<CIRIsdsPreset> & aParsedStructure);
       
   138     
       
   139 	/**
       
   140 	 * MIsdsResponseObserver::IsdsIRIDRecieved()
       
   141 	 * Called to provide IRID
       
   142 	 * @param aIRID  - contains IRID recived from Isds
       
   143 	 */
       
   144 	void IsdsIRIDRecieved(const TDesC& /*aIRID*/);
       
   145 
       
   146 	/**
       
   147 	 * MIsdsResponseObserver::IsdsOtaInfoRecieved()
       
   148 	 * called back when OTA info is recieved and Ui needs to be intimated
       
   149 	 * @param CIROTAUpdate&,the ota information 
       
   150 	 */
       
   151 	void IsdsOtaInfoRecieved( CIROTAUpdate &/*aOtaData*/);
       
   152 
       
   153 	/**
       
   154 	 * MIsdsResponseObserver::IsdsPresetRemovedL()
       
   155 	 * called back when the preset that is synced was removed from isds
       
   156 	 * @param TInt,the preset id
       
   157 	 */
       
   158 	void IsdsPresetRemovedL(TInt /*aId*/);
       
   159 
       
   160 	/**
       
   161 	 * MIsdsResponseObserver::IsdsPresetChangedL()
       
   162 	 * called back when the preset that is synced has been changed in the isds
       
   163 	 * @param CIRIsdsPreset&,the new preset data
       
   164 	 */
       
   165 	void IsdsPresetChangedL(CIRIsdsPreset& /*aPreset*/);
       
   166 	
       
   167 	/**
       
   168 	 * MIsdsResponseObserver::IsdsPresetNoChangeL()
       
   169 	 * called back when the preset that is synced has not been changed
       
   170 	 */
       
   171 	 void IsdsPresetNoChangeL();	
       
   172 	/**
       
   173 	 * IsdsPresetRequestL()
       
   174 	 * called by all the views to get preset data
       
   175 	 */
       
   176 	void IsdsPresetRequestL(MViewsResponseAndErrorObserver* aViewObserver,TInt aIndex,
       
   177 				TInt aCommand,TInt aReqForLogo = ETrue,TInt aHistoryBool=EFalse);
       
   178 	
       
   179 
       
   180 	/**
       
   181 	* CIRIsdsWrapper::GetISDSInstance()
       
   182 	* Returns the ISDS Instance
       
   183 	*/
       
   184 	CIRIsdsClient* GetISDSInstance();
       
   185 	
       
   186 	/**
       
   187 	* CIRIsdsWrapper::IsdsCancelRequest()
       
   188 	* Cancels the Isds request made by UI
       
   189 	*/
       
   190 	void IsdsCancelRequest();
       
   191 	
       
   192 	/**
       
   193 	* CIRIsdsWrapper::GetDialogLauncherInstance()
       
   194 	* Returns the Dialog Launcher Instance
       
   195 	*/
       
   196     CIRDialogLauncher* GetDialogLauncherInstance();
       
   197     
       
   198     /**
       
   199      * GetStationsData()
       
   200      * returns the instance of iStationsData
       
   201      */
       
   202     CDesCArrayFlat* GetStationsData();
       
   203     void CreateWaitDialogL();
       
   204     	/**
       
   205 	* Called when the refresh dialog is dismissed.
       
   206 	* @param aButtonId The button that was used to dismiss the dialog.
       
   207 	*/
       
   208 	void DialogDismissedL( TInt aButtonId );
       
   209 	
       
   210 	
       
   211 	/**
       
   212 	* CIRIsdsWrapper::GetBannerUrl()
       
   213 	* Returns the BannerUrl
       
   214 	*/
       
   215 	HBufC* GetBannerUrl();
       
   216 
       
   217 	/**
       
   218 	* DestroyWaitDialogL()
       
   219 	* Destroys the Wait Dialog
       
   220 	*/
       
   221 	void DestroyWaitDialogL();
       
   222 	
       
   223 	/**
       
   224 	* CIRIsdsWrapper::SetCurrentPlayingIndex()
       
   225 	* Sets the Current Playing Index
       
   226 	*/
       
   227 	void SetCurrentPlayingIndex(TBool aCurrentPlayingIndex);
       
   228 
       
   229 	/**
       
   230 	* CIRIsdsWrapper::GetCurrentPlayingIndex()
       
   231 	* Returns The current Playing Index
       
   232 	*/
       
   233 	TBool GetCurrentPlayingIndex();
       
   234 
       
   235 	/**
       
   236 	* CIRIsdsWrapper::SetListenRequest()
       
   237 	* Sets The ListenRequest if Listen is Done
       
   238 	*/
       
   239 	void  SetListenRequest(TBool aListenRequest);
       
   240 
       
   241 	/**
       
   242 	* CIRIsdsWrapper::GetListenRequest()
       
   243 	* Returns the Listen Request Value
       
   244 	*/
       
   245 	TBool GetListenRequest();
       
   246 	/**
       
   247 	* CIRIsdsWrapper::ActiveWaitDialog();
       
   248 	* Returns checks Whether tHe IsdS waitDialog is Active or Not
       
   249 	*/
       
   250 	
       
   251 	TBool  ActiveWaitDialog();
       
   252 	
       
   253 	/**
       
   254 	* CIRIsdsWrapper::SetSyncPresetObserver()
       
   255 	* Notifies the sync preset call back to the observer
       
   256 	* @param MSyncPresetObserver, observer for the synchronization
       
   257 	*/
       
   258 	void SetSyncPresetObserver(MSyncPresetObserver* aSyncPresetObserver);
       
   259 	
       
   260 	void SetSyncPresetObserver(MSyncPresetObserver* aSyncPresetObserver,
       
   261 					MViewsResponseAndErrorObserver* aViewObserver);
       
   262 	
       
   263 	
       
   264     TInt GetErrorCode();
       
   265     
       
   266     /**
       
   267     * CIRIsdsWrapper::SetSyncReqFromMainView()
       
   268     * called before the syncrequest is made form MAINVIEW
       
   269     * once the reponse receives saying "preset removed",
       
   270     * error note "item no longer available" should not be displayed
       
   271 	* @param aValue, to know whether the syncrequest is made form mainview or not
       
   272 	*/
       
   273 	void SetSyncReqFromMainView(TBool aValue);
       
   274 	
       
   275 public: 	//data
       
   276 
       
   277 	/**
       
   278 	* iStationsData
       
   279 	* Data for stationa data
       
   280 	*/
       
   281 	CDesCArrayFlat* iStationsData;
       
   282 	/**
       
   283 	* iCategoryData
       
   284 	* Data for category data
       
   285 	*/
       
   286 	CDesCArrayFlat* iCategoryData;
       
   287 	
       
   288 	/**
       
   289 	* iCategoryData
       
   290 	* Array which contains the data for imgUrl of each channel
       
   291 	*/
       
   292 	CDesCArrayFlat* iChannelImgUrl;
       
   293 	
       
   294 	
       
   295 	/**
       
   296 	* iChannelID
       
   297 	* stores the channel id of currently playing channel
       
   298 	*/
       
   299 	TInt iChannelID;
       
   300 	
       
   301 	/**
       
   302 	* iChannelIdArray
       
   303 	* for station id comparision
       
   304 	*/
       
   305 	RArray<TInt> iChannelIdArray;
       
   306 	
       
   307 	
       
   308 	/**
       
   309 	* iIRSettings
       
   310 	* Instance of CurrentOperationSettings
       
   311 	*/
       
   312 	CIRSettings& iIRSettings;
       
   313 	
       
   314 	/**
       
   315 	* iISDSClient
       
   316 	* ISDS INTERFACE
       
   317 	*/
       
   318 	CIRIsdsClient* iISDSClient;
       
   319 	
       
   320 	/**
       
   321 	* iViewObserver
       
   322 	* data of MViewsResponseAndErrorObserver class
       
   323 	*/
       
   324 	MViewsResponseAndErrorObserver *iViewObserver;	
       
   325 	
       
   326 	/**
       
   327 	* iFavPresets
       
   328 	* Instance of favoritesDb class
       
   329 	*/
       
   330 	CIRFavoritesDb& iFavPresets;
       
   331 	
       
   332 	/**
       
   333 	* iReqAddToFav
       
   334 	* Boolean value to determine whether add to favorites is requested
       
   335 	*/
       
   336 	TBool iReqAddToFav;
       
   337 	
       
   338 	/**
       
   339 	* iReqForLogo
       
   340 	* Boolean value to determine whether logo is requested
       
   341 	*/
       
   342 	TBool iReqForLogo;
       
   343 	
       
   344 	/**
       
   345 	* iSSearchRequest;
       
   346 	* Checks if the Isds request is for search
       
   347 	*/
       
   348 	TBool iSSearchRequest;
       
   349 	
       
   350 	/**
       
   351 	* iError
       
   352 	* Checks if there is any Isds error.
       
   353 	*/
       
   354 	TBool iError;
       
   355 	TBool iConnTimeOut;
       
   356 	TBool iDialogDismissed;
       
   357 	
       
   358 	/**
       
   359 	* iDiaologLauncher
       
   360 	* instance of CIRDiaologLauncher
       
   361 	*/
       
   362 	CIRDialogLauncher* iDiaologLauncher;
       
   363 	
       
   364 	 
       
   365 private:
       
   366 	 /**
       
   367 	  * iBannerUrl
       
   368 	  * Banner Url of the Advertisement for Channels
       
   369 	  */
       
   370 	  HBufC* iBannerUrl;
       
   371 	  
       
   372 	  /**
       
   373 	  * iWaitDialogWhileSearch
       
   374 	  * Set When request For Search
       
   375 	  */
       
   376 	  TBool iWaitDialogWhileSearch;
       
   377 	 
       
   378 	 /**
       
   379 	 *iCurrentPlayingIndex
       
   380 	 * index of currently playing item
       
   381 	 */
       
   382 	 TInt iCurrentPlayingIndex;
       
   383 
       
   384 	  /**
       
   385 	  * iListenRequest
       
   386 	  * Set When request For Listen
       
   387 	  */
       
   388 	  TBool iListenRequest;
       
   389 	  
       
   390 	  TBool iHistoryBool ;
       
   391 	  /**
       
   392 	  * iSyncPresetObserver
       
   393 	  * observer for the prest synchronization
       
   394 	  */
       
   395 	  MSyncPresetObserver* iSyncPresetObserver;
       
   396 	  TBool iKNotFound;
       
   397 	 
       
   398 public:
       
   399 	  
       
   400 	  /**
       
   401 	  * iCliokThroughUrl
       
   402 	  * ClickThroughUrl of the Advertisement for Channels
       
   403 	  */
       
   404 	  HBufC* iClickThroughUrl;
       
   405 	 /**
       
   406 	  * iBannerUrl
       
   407 	  * Banner Url of the Advertisement for Channels
       
   408 	  */
       
   409 	  HBufC* iCatBannerUrl;
       
   410 	  
       
   411 	  /**
       
   412 	  * iCliokThroughUrl
       
   413 	  * ClickThroughUrl of the Advertisement for Channels
       
   414 	  */
       
   415 	  HBufC* iCatClickThroughUrl;
       
   416     /**
       
   417 	* iWaitDialog
       
   418 	* calls the waitdialog owned by
       
   419 	* CAknWaitDialog
       
   420 	*/   
       
   421 	CAknWaitDialog* iIsdsWaitDialog;
       
   422 	TBool iCatBannerTag;
       
   423 	TBool iChannelBannerTag;
       
   424 	
       
   425 	/**
       
   426 	* iSyncReqFromMainView
       
   427 	* used to know whether the sync request is made from mainview or not
       
   428 	*/
       
   429 	TBool iSyncReqFromMainView;
       
   430 
       
   431 	 
       
   432 };
       
   433 
       
   434 #endif //IRISDSWRAPPER_H