videofeeds/server/IptvEpgManager/inc/CIptvEpgSession.h
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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 the License "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:    Controls epg services update*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CIPTVEPGSESSION_H
       
    21 #define CIPTVEPGSESSION_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include "CIptvUtil.h"
       
    26 #include "MIptvEpgManagerUpdateObserver.h"
       
    27 #include "MIptvServiceManagerObserver.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CIptvMyVideosGlobalFileId;
       
    31 class CIptvEpgVodClientImpl;
       
    32 class CIptvEpgVodMsqQueue;
       
    33 class CIptvEpgLiveTvCallbackImpl;
       
    34 class CIptvEpgPluginInterface;
       
    35 class CIptvEpgVodCallbackImpl;
       
    36 class CIptvEpgDb;
       
    37 class CIptvSearchManager;
       
    38 class TIptvRssSearchQuery;
       
    39 class CIptvEpgDatabase;
       
    40 class CIptvEpgService;
       
    41 class CIptvServer;
       
    42 class CIptvEpgManagerUpdater;
       
    43 class CVcxGroupUpdater;
       
    44 
       
    45 // CLASS DECLARATION
       
    46 class CIptvEpgSession : public CBase,
       
    47                         public MIptvEpgManagerUpdateObserver,
       
    48                         public MIptvServiceManagerObserver
       
    49     {
       
    50     public:
       
    51 
       
    52         /**
       
    53          * Two-phased constructor.
       
    54          * @param 
       
    55          */
       
    56         static CIptvEpgSession* NewL(
       
    57             CIptvEpgDb* aEpgDb,
       
    58             TUint32 aServiceId,
       
    59             CIptvEpgVodMsqQueue* aMsgQueue,
       
    60             CIptvServer& aServer,
       
    61             TBool aPluginCanRun,
       
    62             TInt& aError );
       
    63 
       
    64         /**
       
    65          * Two-phased constructor.
       
    66          * @param 
       
    67          */
       
    68         static CIptvEpgSession* NewL(
       
    69             CIptvEpgDatabase* aLiveTvDb,
       
    70             TUint32 aServiceId,
       
    71             CIptvEpgVodMsqQueue* aMsgQueue,
       
    72             CIptvServer& aServer,
       
    73             TBool aPluginCanRun,
       
    74             TInt& aError );
       
    75 
       
    76         /**
       
    77          * Destructor.
       
    78          */
       
    79         ~CIptvEpgSession();
       
    80 
       
    81     public: // From MIptvEpgManagerUpdateObserver interface
       
    82         
       
    83         /**
       
    84          * Check is plugin running.
       
    85          */
       
    86         void CheckIsPluginRunning();
       
    87 
       
    88     public:
       
    89 
       
    90         /**
       
    91          * Get reference count.
       
    92          */        
       
    93         TInt GetReferenceCount() { return iReferenceCount; };
       
    94 
       
    95         /**
       
    96          * Set reference count.
       
    97          */
       
    98         void SetReferenceCount(TInt aReferenceCount) { iReferenceCount = aReferenceCount; };
       
    99 
       
   100         /**
       
   101          * Get service id.
       
   102          */
       
   103         TUint32 GetServiceId() { return iServiceId; };
       
   104         
       
   105         /**
       
   106          * Reset global Id.
       
   107          */
       
   108         TInt ResetGlobalId(CIptvMyVideosGlobalFileId& aId);
       
   109 
       
   110         /**
       
   111          * Set global Id.
       
   112          */
       
   113         TInt SetGlobalId(TUint32 aContentKey, CIptvMyVideosGlobalFileId& aId, TUint32 aIndex);
       
   114         
       
   115         /**
       
   116          * Is Epg manager ready?
       
   117          */
       
   118         TBool IsReadyL();
       
   119 
       
   120         /**
       
   121          * Set Epg manager ready.
       
   122          */
       
   123         void SetReady();
       
   124       
       
   125         /**
       
   126          * Delete EPG-database. Mark database to be deleted. Database file is deleted 
       
   127          * when EPG-manager is deleted.
       
   128          */
       
   129         void DeleteDatabaseFile();
       
   130         
       
   131         /**
       
   132          * Get pointer to Vod client implementation.
       
   133          */
       
   134         CIptvEpgVodClientImpl* GetVodClientImplL();
       
   135 
       
   136         /**
       
   137          * Update Ecg.
       
   138          * @since
       
   139          * @param aForceUpdate Update required without last modified check.
       
   140          * @return Error code, KErrNone if no errors, otherwise one of the system wide error codes.
       
   141          */
       
   142         TInt UpdateEcg( TBool aForceUpdate );
       
   143 
       
   144         /**
       
   145          * Handle search request and forward the message to search manager 
       
   146          * to be handled.
       
   147          *
       
   148          * @param	aSearchQuery	Class containing search details
       
   149          * @return	KErrNone if successful, otherwise Symbian error code
       
   150          */
       
   151         TInt Search( TIptvRssSearchQuery& aSearchQuery );
       
   152 
       
   153         /**
       
   154          * Gathers a list of used Content ID numbers and updates them to 
       
   155          * Search Manager. This is done to prevent overlapping of ID numbers
       
   156          * between downloads from old and new search results.
       
   157          */
       
   158         void UpdateSearchUsedContentIdsListL();
       
   159 
       
   160         /**
       
   161          * Updates the Content IDs that have changed during DB update to
       
   162          * other interested parties (in practise Download Manager).
       
   163          *
       
   164          * @param aOldContentIds Array of old Content IDs.
       
   165          * @param aNewContentIds Array of new Content IDs.
       
   166          */
       
   167         void UpdateChangedContentIdsL( RArray<TUint32>& aOldContentIds,
       
   168                                        RArray<TUint32>& aNewContentIds );
       
   169 
       
   170         /**
       
   171          * Returns true if plugin is running.
       
   172          *
       
   173          * @return ETrue if plugin is running.
       
   174          */
       
   175         TBool IsPluginRunning() { return iPluginStarted; }
       
   176         
       
   177 		/**
       
   178 		*	Cancel the current active search
       
   179 		*	@param	None
       
   180 		*	@return	KErrNone if successful, otherwise Symbian error code
       
   181 		*/
       
   182         TInt CancelSearch();
       
   183 
       
   184         /**
       
   185          * Initialize
       
   186          */
       
   187         void InitializeL();
       
   188 
       
   189         /**
       
   190          * Set IAP for this service session.
       
   191          */
       
   192         void SetIapL(TUint32 aIap);
       
   193 
       
   194         /**
       
   195          * Update service thumbnail.
       
   196          */
       
   197         void UpdateServiceThumbnailL( const TDesC& aIconFilePath, const TBool aGrouped );
       
   198         
       
   199         /**
       
   200          * Check if vod update is needed
       
   201          * @return ETrue if update is needed for content.
       
   202          * otherwise EFalse.
       
   203          */
       
   204         TBool IsVodUpdateNeededL();
       
   205         
       
   206         /**
       
   207          * Vod plugin cancelled.
       
   208          */
       
   209         void VodPluginCancelled();
       
   210         
       
   211         /**
       
   212          * Sets last update time for the service. 
       
   213 		 * @param aLastUpdate The last update time.
       
   214 		 * @return Error code from database handling functions.
       
   215          */
       
   216         TInt SetLastUpdateTimeL( const TTime& aLastUpdate );
       
   217     
       
   218     public: // From MIptvServiceManagerObserver
       
   219 
       
   220         /**
       
   221          * CIptvServiceManager calls this every time a service is
       
   222          * modified in the database.
       
   223          * @param aEvent Event to inform
       
   224          */
       
   225         void HandleSmEvent( CIptvSmEvent& aEvent );
       
   226 
       
   227     private:    // New functions
       
   228 
       
   229         /**
       
   230          * Check is VOD database update needed.
       
   231          */
       
   232         void CheckIsVodUpdateNeededL();
       
   233 
       
   234         /**
       
   235         * C++ default constructor.
       
   236         */
       
   237         CIptvEpgSession(
       
   238             CIptvEpgDb* aEpgDb,
       
   239             TUint32 aServiceId,
       
   240             CIptvEpgVodMsqQueue* aMsgQueue,
       
   241             CIptvServer& aServer,
       
   242             TBool aPluginCanRun );
       
   243 
       
   244         /**
       
   245         * C++ default constructor.
       
   246         */
       
   247         CIptvEpgSession(
       
   248             CIptvEpgDatabase* aLiveTvDb,
       
   249             TUint32 aServiceId,
       
   250             CIptvEpgVodMsqQueue* aMsgQueue,
       
   251             CIptvServer& aServer,
       
   252             TBool aPluginCanRun );
       
   253 
       
   254         /**
       
   255         * By default Symbian 2nd phase constructor is private.
       
   256         * @param 
       
   257         */
       
   258         TInt ConstructL();
       
   259 
       
   260         /**
       
   261         * Get service information.
       
   262         * @param none
       
   263         */
       
   264         TInt GetServiceInformationL();
       
   265 
       
   266         /**
       
   267          * Run VOD plugin.
       
   268          * @param aForceUpdate Update required without last modified check.
       
   269          */
       
   270         void RunVodPluginL( TBool aForceUpdate = EFalse );
       
   271 
       
   272         /**
       
   273          * Run VOD plugin.
       
   274          * @param aForceUpdate Update required without last modified check.
       
   275          */
       
   276         void RunVodPluginForFeedL( TBool aForceUpdate = EFalse );
       
   277 
       
   278         /**
       
   279          * Run VOD plugin.
       
   280          * @param aForceUpdate Update required without last modified check.
       
   281          */
       
   282         void RunVodPluginForGroupL( TBool aForceUpdate = EFalse );
       
   283 
       
   284         /**
       
   285          * Run SmartVision plugin.
       
   286          */
       
   287         void RunSmartVisionPluginL();
       
   288 
       
   289         /**
       
   290          * VOD Plugin stopped.
       
   291          */
       
   292         void VodPluginStopped();
       
   293 
       
   294         /**
       
   295          * Check is VOD update allowed.
       
   296          * @param aErrorCode KErrServerBusy enables retry.
       
   297          */
       
   298         TBool IsVodUpdateAllowedL( TInt& aErrorCode );
       
   299 
       
   300         /**
       
   301          * Check do we have valid VOD database available.
       
   302          */
       
   303         TBool IsValidVodDbAvailableL(TTime& aLastUpdated, TTime& aInterval);
       
   304 
       
   305         /**
       
   306          * Update VOD ecg.
       
   307          * @param aForceUpdate Update required without last modified check.
       
   308          */
       
   309         void UpdateVodEcgL( TBool aForceUpdate );
       
   310         
       
   311         /**
       
   312          * Update Thomson epg.
       
   313          */
       
   314         TInt UpdateLiveEpg();
       
   315 
       
   316         /**
       
   317          * Send message to client.
       
   318          */
       
   319         void SendMessageToClientL(TInt aMsg, TInt aInfo);
       
   320         
       
   321         /**
       
   322          * Leaving part of search.
       
   323          * @param error Completion code.
       
   324          */
       
   325         void DoSearchL( TInt& error );
       
   326                                                   
       
   327     private:    // Data members                         
       
   328 
       
   329         CIptvServer& iServer;
       
   330 
       
   331         CIptvEpgManagerUpdater* iUpdater;
       
   332 
       
   333         CIptvEpgVodClientImpl* iVodClient;
       
   334 
       
   335         CIptvEpgPluginInterface* iPlugin;        
       
   336 
       
   337         CIptvEpgVodCallbackImpl* iVodCallback;
       
   338 
       
   339         CIptvSearchManager* iSearchManager;
       
   340         
       
   341         /**
       
   342          * Session for updating costomized service group. 
       
   343          * own
       
   344          */
       
   345         CVcxGroupUpdater* iGroupUpdater;
       
   346 
       
   347         CIptvEpgLiveTvCallbackImpl* iLiveTvCallback;
       
   348         
       
   349         CIptvEpgDb* iEpgDb;
       
   350         
       
   351         CIptvEpgDatabase* iLiveTvDatabase;
       
   352         
       
   353         CIptvEpgService* iService;
       
   354 
       
   355         CIptvEpgVodMsqQueue* iMsgQueue;        
       
   356 
       
   357         TBool iPluginStarted;
       
   358 
       
   359         TBool iDeleteDatabase;
       
   360 
       
   361         TUint32 iServiceId;
       
   362 
       
   363         TBool iPluginCanRun;
       
   364 
       
   365         TInt iReferenceCount;
       
   366 
       
   367         TBool iInitialized;
       
   368 
       
   369         TBool iIsIap;
       
   370 
       
   371         TInt iIap;
       
   372 
       
   373         TBool iUpdatePending;
       
   374 
       
   375         TBool iReady;
       
   376 
       
   377         RFs iFs;    	
       
   378 
       
   379         TBool iForceUpdatePending;
       
   380 
       
   381     };
       
   382 
       
   383 #endif  // CIPTVEPGSESSION_H