videofeeds/server/IptvEpgManager/src/CIptvEpgVodClientImpl.cpp
branchRCL_3
changeset 23 befca0ec475f
parent 0 96612d01cf9f
equal deleted inserted replaced
22:839377eedc2b 23:befca0ec475f
       
     1 /*
       
     2 * Copyright (c) 2004-2005 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32base.h>
       
    23 #include "IptvDebug.h"
       
    24 #include "CIptvMediaContent.h"
       
    25 #include "CIptvEpgVodClientImpl.h"
       
    26 #include "CIptvVodContentCategoryBriefDetails.h"
       
    27 #include "CIptvVodContentContentBriefDetails.h"
       
    28 #include "CIptvVodContentContentFullDetails.h"
       
    29 #include "CIptvEpgDb.h"
       
    30 #include "CIptvEpgSession.h"
       
    31 #include "CIptvSearchManager.h"
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 // ============================ MEMBER FUNCTIONS ===============================
       
    36 
       
    37 // ---------------------------------------------------------
       
    38 // CIptvEpgVodClientImpl::ConstructL
       
    39 // Symbian 2nd phase constructor can leave.
       
    40 // ---------------------------------------------------------
       
    41 //
       
    42 void CIptvEpgVodClientImpl::ConstructL()
       
    43     {       
       
    44     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::ConstructL");        
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CIptvEpgVodClientImpl::NewL
       
    49 // Two-phased constructor.
       
    50 // Create instance of concrete implementation
       
    51 // ---------------------------------------------------------
       
    52 //
       
    53 CIptvEpgVodClientImpl* CIptvEpgVodClientImpl::NewL( CIptvEpgDb& aEpgDb,
       
    54 													CIptvEpgSession& aSession,
       
    55 													CIptvSearchManager* aSearchManager )
       
    56     {
       
    57     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::NewL");  
       
    58 
       
    59     CIptvEpgVodClientImpl* self = new(ELeave) CIptvEpgVodClientImpl( aEpgDb,
       
    60     																 aSession,
       
    61     																 aSearchManager );
       
    62 
       
    63     CleanupStack::PushL(self);
       
    64 
       
    65     self->ConstructL();
       
    66 
       
    67     CleanupStack::Pop(self);
       
    68     return self;
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------
       
    72 // CIptvEpgVodClientImpl::~CIptvEpgVodClientImpl
       
    73 // Destructor
       
    74 // ---------------------------------------------------------
       
    75 //
       
    76 CIptvEpgVodClientImpl::~CIptvEpgVodClientImpl()
       
    77     {	
       
    78     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::~CIptvEpgVodClientImpl");  
       
    79 
       
    80     iCategories.Close();
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------
       
    84 // CIptvEpgVodClientImpl::CIptvEpgVodClientImpl
       
    85 // C++ default constructor
       
    86 // ---------------------------------------------------------
       
    87 //
       
    88 CIptvEpgVodClientImpl::CIptvEpgVodClientImpl( CIptvEpgDb& aEpgDb,
       
    89 											  CIptvEpgSession& aSession,
       
    90 											  CIptvSearchManager* aSearchManager ) : 
       
    91     iEpgDb( aEpgDb ),
       
    92     iSearchManager( aSearchManager ),
       
    93     iSession( aSession )
       
    94     {
       
    95     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::CIptvEpgVodClientImpl");  
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------
       
    99 // CIptvEpgVodClientImpl::GetEcgCategoryList
       
   100 // Database query method
       
   101 // ---------------------------------------------------------
       
   102 //  
       
   103 TInt CIptvEpgVodClientImpl::GetEcgCategoryListL(TIptvCategoryId aParentCategoryId, RPointerArray<CIptvVodContentCategoryBriefDetails>& aCategoryList)
       
   104     {
       
   105     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::GetEcgCategoryListL");  
       
   106     
       
   107     iSession.InitializeL();
       
   108     TInt error = iEpgDb.GetEcgCategoryListL(aParentCategoryId, aCategoryList);
       
   109 
       
   110     if ( iSearchManager )
       
   111         {
       
   112         CIptvVodContentCategoryBriefDetails* searchCategory = iSearchManager->SearchCategoryContentBriefDetailsL();
       
   113         if( searchCategory )
       
   114         	{
       
   115         	CleanupStack::PushL( searchCategory );
       
   116         	aCategoryList.AppendL( searchCategory );
       
   117         	CleanupStack::Pop( searchCategory );
       
   118         	}
       
   119         }
       
   120 
       
   121     return error;
       
   122     }
       
   123 
       
   124 // ---------------------------------------------------------
       
   125 // CIptvEpgVodClientImpl::GetCategoryDetails
       
   126 // Database query method
       
   127 // ---------------------------------------------------------
       
   128 //  
       
   129 TInt CIptvEpgVodClientImpl::GetCategoryDetailsL(TIptvCategoryId aCategoryId, CIptvVodContentCategoryBriefDetails& aCategory)
       
   130     {
       
   131     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::GetCategoryDetailsL");  
       
   132 
       
   133     iSession.InitializeL();
       
   134     TInt error = iEpgDb.GetCategoryDetailsL(aCategoryId, aCategory);
       
   135     return error;
       
   136     }
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 // CIptvEpgVodClientImpl::GetParentCategory
       
   140 // -----------------------------------------------------------------------------
       
   141 TInt CIptvEpgVodClientImpl::GetParentCategoryL(TIptvCategoryId aCategoryId, TIptvCategoryId& aParentId)
       
   142     {
       
   143     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::GetParentCategoryL");  
       
   144 
       
   145     iSession.InitializeL();
       
   146     TInt error = iEpgDb.GetParentCategoryL(aCategoryId, aParentId);
       
   147 
       
   148     if( error == KErrNotSupported && iSearchManager ) // Not found from the database
       
   149     	{
       
   150     	// Let's ask from search manager if we have a match for category
       
   151     	error = iSearchManager->GetParentCategory( aCategoryId, aParentId );
       
   152     	}
       
   153 
       
   154     return error;
       
   155     }
       
   156 
       
   157 // -----------------------------------------------------------------------------
       
   158 // CIptvEpgVodClientImpl::GetEcgList
       
   159 // -----------------------------------------------------------------------------
       
   160 TInt CIptvEpgVodClientImpl::GetEcgListL(TIptvCategoryId aCategoryId, TDesC& aSearchString, TUint32 aFrom, TUint32 aAmount, TUint32& aTotalAmount, RPointerArray<CIptvVodContentContentBriefDetails>& aEcgList)
       
   161     {
       
   162     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::GetEcgListL");  
       
   163 
       
   164     iSession.InitializeL();
       
   165     TInt error = KErrNone;
       
   166 
       
   167     if( aCategoryId == KIptvRssSearchCategoryId && iSearchManager )
       
   168     	{
       
   169         iSearchManager->GetSearchContentBriefDetailsL( aCategoryId,
       
   170                                                        aSearchString,
       
   171                                                        aFrom,
       
   172                                                        aAmount,
       
   173                                                        aTotalAmount,
       
   174                                                        aEcgList );
       
   175     	}
       
   176     else
       
   177     	{
       
   178 	    error = iEpgDb.GetEcgListL(aCategoryId, aSearchString, aFrom, aAmount, aTotalAmount, aEcgList);
       
   179     	}
       
   180 
       
   181     return error;
       
   182     }
       
   183 
       
   184 // -----------------------------------------------------------------------------
       
   185 // CIptvEpgVodClientImpl::GetEcgAllList
       
   186 // -----------------------------------------------------------------------------
       
   187 TInt CIptvEpgVodClientImpl::GetEcgAllListL(TDesC& aSearchString, TUint32 aFrom, TUint32 aAmount, TUint32& aTotalAmount, RPointerArray<CIptvVodContentContentBriefDetails>& aEcgList)
       
   188     {
       
   189     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::GetEcgAllListL");  
       
   190 
       
   191     iSession.InitializeL();
       
   192     TInt error = iEpgDb.GetEcgAllListL(aSearchString, aFrom, aAmount, aTotalAmount, aEcgList);
       
   193     return error;
       
   194     }
       
   195 
       
   196 // -----------------------------------------------------------------------------
       
   197 // CIptvEpgVodClientImpl::GetContentDetails
       
   198 // -----------------------------------------------------------------------------
       
   199 TInt CIptvEpgVodClientImpl::GetContentDetailsL(TIptvContentId aContentId, CIptvVodContentContentFullDetails& aContentFullDetails)
       
   200     {
       
   201     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::GetContentDetailsL");  
       
   202 
       
   203     iSession.InitializeL();
       
   204     TInt error = iEpgDb.GetContentDetailsL(aContentId, aContentFullDetails);
       
   205 
       
   206     if( iSearchManager )
       
   207     	{
       
   208     	error = iSearchManager->GetContentDetailsL( aContentId, aContentFullDetails );
       
   209     	}
       
   210 
       
   211     return error;
       
   212     }
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // CIptvEpgVodClientImpl::GetUpdateTimeL
       
   216 // -----------------------------------------------------------------------------
       
   217 TInt CIptvEpgVodClientImpl::GetUpdateTimeL(TTime& aTime)
       
   218     {
       
   219     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::GetUpdateTimeL");
       
   220     
       
   221     TTime interval;
       
   222     TInt error = iEpgDb.GetServiceInformationL(aTime, interval);
       
   223     return error;
       
   224     }
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 // CIptvEpgVodClientImpl::GetContentAccessListL
       
   228 // -----------------------------------------------------------------------------
       
   229 TInt CIptvEpgVodClientImpl::GetContentAccessListL(TUint32 aContentId, RPointerArray<CIptvMediaContent>& aContents)
       
   230     {
       
   231     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::GetContentAccessListL");
       
   232 
       
   233     TInt error = iEpgDb.GetContentAccessListL(aContentId, aContents);
       
   234     
       
   235     if ( iSearchManager )
       
   236         {
       
   237         iSearchManager->GetContentAccessListL( aContentId, aContents );
       
   238         }
       
   239 
       
   240     return error;
       
   241     }
       
   242 
       
   243 // -----------------------------------------------------------------------------
       
   244 // CIptvEpgVodClientImpl::GetContentAccessL
       
   245 // -----------------------------------------------------------------------------
       
   246 CIptvMediaContent* CIptvEpgVodClientImpl::GetContentAccessL(TUint32 aContentId, TUint32 aIndex)
       
   247     {
       
   248     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::GetContentAccessL");
       
   249     CIptvMediaContent* content = iEpgDb.GetContentAccessL( aContentId, aIndex );
       
   250 
       
   251     if( !content && iSearchManager )
       
   252     	{
       
   253     	content = iSearchManager->GetContentAccessL( aContentId, aIndex );
       
   254     	}
       
   255 
       
   256     return content;
       
   257     }
       
   258 
       
   259 // -----------------------------------------------------------------------------
       
   260 // CIptvEpgVodClientImpl::SetLastPositionL
       
   261 // -----------------------------------------------------------------------------
       
   262 TInt CIptvEpgVodClientImpl::SetLastPositionL(TUint32 aId, TUint32 aIndex, TUint32 aPosition)
       
   263     {
       
   264     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::SetLastPositionL");
       
   265     
       
   266     
       
   267     
       
   268     return iEpgDb.SetLastPositionL(aId, aIndex, aPosition);
       
   269     }
       
   270 
       
   271 // -----------------------------------------------------------------------------
       
   272 // CIptvEpgVodClientImpl::SetLastPositionL
       
   273 // -----------------------------------------------------------------------------
       
   274 TInt CIptvEpgVodClientImpl::SetMpxIdL( TUint32 aContentId, TUint32 aCaIndex, TUint32  aMpxId )
       
   275     {
       
   276     IPTVLOGSTRING_LOW_LEVEL("CIptvEpgVodClientImpl::SetMpxIdL");
       
   277 
       
   278     return iEpgDb.SetMpxIdL( aContentId, aCaIndex, aMpxId );
       
   279     }
       
   280 
       
   281 TBool CIptvEpgVodClientImpl::IsVodUpdateNeededL()
       
   282     {
       
   283      return iSession.IsVodUpdateNeededL();
       
   284     }
       
   285 
       
   286 // End of File