videofeeds/clientapi/src/CIptvVodContentClient.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:    Implements VoD ECG content API.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #include <e32svr.h>
       
    21 #include <s32mem.h> 
       
    22 #include "IptvDebug.h"
       
    23 #include "CIptvMediaContent.h"
       
    24 
       
    25 #include "MIptvVodContentClientObserver.h"
       
    26 #include "CIptvVodContentClient.h"
       
    27 #include "IptvClientServerCommon.h"
       
    28 #include "IptvServer.pan"
       
    29 #include "CIptvVodContentCategoryBriefDetails.h"
       
    30 #include "CIptvVodContentContentBriefDetails.h"
       
    31 #include "CIptvVodContentContentFullDetails.h"
       
    32 #include "CIptvVodContentUpdateObserver.h"
       
    33 #include "CIptvMyVideosGlobalFileId.h"
       
    34 #include "TIptvRssSearchQuery.h"
       
    35 
       
    36 const TInt KTUint32SizeInBytes( 4 );
       
    37 
       
    38 // ============================ MEMBER FUNCTIONS ===============================
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CIptvVodContentClient::CIptvVodContentClient
       
    42 // C++ default constructor can NOT contain any code, that
       
    43 // might leave.
       
    44 // -----------------------------------------------------------------------------
       
    45 CIptvVodContentClient::CIptvVodContentClient(TIptvServiceId aServiceId, MIptvVodContentClientObserver& aClientObserver) : 
       
    46     CActive( EPriorityStandard ), 
       
    47     iClientObserver( aClientObserver ), 
       
    48     iMsg(NULL), 
       
    49     iMsgPtr((unsigned char*)0, 0), 
       
    50     iServiceId(aServiceId), 
       
    51     iObserver(NULL)
       
    52     {
       
    53     CActiveScheduler::Add(this);
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CIptvVodContentClient::ConstructL
       
    58 // Symbian 2nd phase constructor can leave.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 void CIptvVodContentClient::ConstructL()
       
    62     {
       
    63     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::ConstructL");         
       
    64              
       
    65     User::LeaveIfError(iSession.Connect());
       
    66     iObserver = CIptvVodContentUpdateObserver::NewL(iClientObserver, iSession, iServiceId);
       
    67     TRequestStatus status;
       
    68     SendRequestL(EIptvEngineVodContentServiceId, iServiceId, status);
       
    69 
       
    70     if (status.Int() != KErrNone)    
       
    71         {
       
    72         User::Leave(status.Int());
       
    73         }
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CIptvVodContentClient::NewL
       
    78 // Two-phased constructor.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 EXPORT_C CIptvVodContentClient* CIptvVodContentClient::NewL(TIptvServiceId aServiceId, MIptvVodContentClientObserver& aClientObserver)
       
    82     {
       
    83     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::NewL");         
       
    84 
       
    85 	CIptvVodContentClient* self = new ( ELeave ) CIptvVodContentClient(aServiceId, aClientObserver);
       
    86 	CleanupStack::PushL( self );
       
    87 	self->ConstructL();
       
    88 	CleanupStack::Pop( self );
       
    89 	return self;
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CIptvVodContentClient::NewLC
       
    94 // Two-phased constructor.
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C CIptvVodContentClient *CIptvVodContentClient::NewLC(TIptvServiceId aServiceId, MIptvVodContentClientObserver& aClientObserver)
       
    98     {
       
    99     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::NewLC");         
       
   100 
       
   101 	CIptvVodContentClient* self = new ( ELeave ) CIptvVodContentClient(aServiceId, aClientObserver);
       
   102 	CleanupStack::PushL( self );
       
   103 	self->ConstructL();
       
   104 	return self;
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CIptvVodContentClient::~CIptvVodContentClient
       
   109 // Destructor.
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 CIptvVodContentClient::~CIptvVodContentClient()
       
   113     {
       
   114     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::~CIptvVodContentClient");         
       
   115 
       
   116     Cancel();         
       
   117     SendCancelRequest();
       
   118 
       
   119     delete iMsg;
       
   120     delete iObserver;   
       
   121     iSession.Close();                    
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CIptvVodContentClient::CleanupL
       
   126 // 
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 void CIptvVodContentClient::CleanupL()
       
   130     {
       
   131     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::CleanupL");
       
   132 
       
   133     delete iMsg;
       
   134     iMsg = NULL;
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CIptvVodContentClient::GetEcgCategoryList
       
   139 // -----------------------------------------------------------------------------
       
   140 EXPORT_C TInt CIptvVodContentClient::GetEcgCategoryListL(TIptvCategoryId aParentCategoryId, RPointerArray<CIptvVodContentCategoryBriefDetails>& aCategoryList)
       
   141     {
       
   142     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetEcgCategoryListL");
       
   143 
       
   144     TRequestStatus status(KErrNone);
       
   145     if (!IsActive())
       
   146         {        
       
   147         SendSizeRequestL(EIptvEngineVodContentGetEcgCategoryListSizeReq, aParentCategoryId, status);        
       
   148         if (status.Int() != KErrNone)
       
   149             {
       
   150             CleanupL();
       
   151             }
       
   152         else
       
   153             {
       
   154             HandleVodContentGetEcgCategoryListSizeReqL();
       
   155             HandleVodContentGetEcgCategoryListDataReqL(aCategoryList);
       
   156             }
       
   157         }
       
   158 
       
   159 #ifdef _DEBUG
       
   160 
       
   161     TInt count = aCategoryList.Count();
       
   162     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetEcgCategoryListL ----------------------------------------------------");
       
   163     IPTVLOGSTRING2_LOW_LEVEL("CIptvVodContentClient::GetEcgCategoryListL Parent id = %d", aParentCategoryId);
       
   164     IPTVLOGSTRING2_LOW_LEVEL("CIptvVodContentClient::GetEcgCategoryListL Category count = %d", count);
       
   165 
       
   166     for (TInt i = 0; i < count; i++)
       
   167         {
       
   168         TDesC& name = aCategoryList[i]->iName;
       
   169         IPTVLOGSTRING2_LOW_LEVEL("CIptvVodContentClient::GetEcgCategoryListL Category name = %S", &name);        
       
   170         IPTVLOGSTRING2_LOW_LEVEL("CIptvVodContentClient::GetEcgCategoryListL Category ID = %d", aCategoryList[i]->iCategoryId);        
       
   171         }
       
   172 
       
   173     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetEcgCategoryListL ----------------------------------------------------");
       
   174 
       
   175 #endif
       
   176 
       
   177     return status.Int();
       
   178     }
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // CIptvVodContentClient::GetCategoryDetails
       
   182 // -----------------------------------------------------------------------------
       
   183 EXPORT_C TInt CIptvVodContentClient::GetCategoryDetailsL(TIptvCategoryId aCategoryId, CIptvVodContentCategoryBriefDetails& aCategory)
       
   184     {
       
   185     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetCategoryDetailsL");         
       
   186 
       
   187     TRequestStatus status(KErrNone);
       
   188     if (!IsActive())
       
   189         {       
       
   190         SendSizeRequestL(EIptvEngineVodContentGetCategoryDetailsSizeReq, aCategoryId, status);
       
   191         if (status.Int() != KErrNone)
       
   192             {
       
   193             CleanupL();            
       
   194             }
       
   195         else
       
   196             {
       
   197             HandleVodContentGetCategoryDetailsSizeReqL();
       
   198             HandleVodContentGetCategoryDetailsDataReqL(aCategory);
       
   199             }
       
   200         }    
       
   201     return status.Int();
       
   202     }
       
   203 
       
   204 // -----------------------------------------------------------------------------
       
   205 // CIptvVodContentClient::GetParentCategory
       
   206 // -----------------------------------------------------------------------------
       
   207 EXPORT_C TInt CIptvVodContentClient::GetParentCategoryL(TIptvCategoryId aCategoryId, TIptvCategoryId& aParentId)
       
   208     {
       
   209     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetParentCategoryL");         
       
   210 
       
   211     TRequestStatus status(KErrNone);
       
   212     if (!IsActive())
       
   213         {        
       
   214         SendRequestL(EIptvEngineVodContentGetParentCategoryReq, aCategoryId, status);
       
   215         if (status.Int() != KErrNone)
       
   216             {
       
   217             CleanupL();
       
   218             }
       
   219         else
       
   220             {
       
   221             HandleVodContentGetParentCategoryReqL(aParentId);
       
   222             }
       
   223         }    
       
   224     return status.Int();
       
   225     }
       
   226 
       
   227 // -----------------------------------------------------------------------------
       
   228 // CIptvVodContentClient::GetEcgList
       
   229 // -----------------------------------------------------------------------------
       
   230 EXPORT_C TInt CIptvVodContentClient::GetEcgListL(TIptvCategoryId aCategoryId, TDesC& aSearchString, TUint32 aFrom, TUint32 aAmount, TUint32& aTotalAmount, RPointerArray<CIptvVodContentContentBriefDetails>& aEcgList)
       
   231     {
       
   232     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetEcgListL");         
       
   233 
       
   234     TRequestStatus status(KErrNone);
       
   235     if (!IsActive())
       
   236         {        
       
   237         SendSizeRequestL(EIptvEngineVodContentGetEcgListSizeReq, aCategoryId, aFrom, aAmount, aSearchString, status);
       
   238         if (status.Int() != KErrNone)
       
   239             {
       
   240             CleanupL();
       
   241             }
       
   242         else
       
   243             {
       
   244             HandleVodContentGetEcgListSizeReqL();
       
   245             HandleVodContentGetEcgListDataReqL(aTotalAmount, aEcgList);
       
   246             }  
       
   247         }
       
   248 
       
   249 #ifdef _DEBUG
       
   250 
       
   251     TInt count = aEcgList.Count();
       
   252     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetEcgListL ----------------------------------------------------");
       
   253     IPTVLOGSTRING2_LOW_LEVEL("CIptvVodContentClient::GetEcgListL Content info for category = %d", aCategoryId);
       
   254     IPTVLOGSTRING2_LOW_LEVEL("CIptvVodContentClient::GetEcgListL Item count = %d", count);
       
   255 
       
   256     for (TInt i = 0; i < count; i++)
       
   257         {
       
   258         TDesC& name = aEcgList[i]->iName;
       
   259         IPTVLOGSTRING2_LOW_LEVEL("CIptvVodContentClient::GetEcgListL Name = %S", &name);
       
   260         IPTVLOGSTRING2_LOW_LEVEL("CIptvVodContentClient::GetEcgListL GFID = %d", aEcgList[i]->iFileId->iFileId);                    
       
   261         IPTVLOGSTRING2_LOW_LEVEL("CIptvVodContentClient::GetEcgListL GDID = %d", aEcgList[i]->iFileId->iDrive);                    
       
   262         }
       
   263 
       
   264     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetEcgListL ----------------------------------------------------");
       
   265 
       
   266 #endif
       
   267 
       
   268     return status.Int();  
       
   269     }
       
   270 
       
   271 // -----------------------------------------------------------------------------
       
   272 // CIptvVodContentClient::GetEcgAllList
       
   273 // -----------------------------------------------------------------------------
       
   274 EXPORT_C TInt CIptvVodContentClient::GetEcgAllListL(TDesC& aSearchString, TUint32 aFrom, TUint32 aAmount, TUint32& aTotalAmount, RPointerArray<CIptvVodContentContentBriefDetails>& aEcgList)
       
   275     {    
       
   276     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetEcgAllListL");         
       
   277 
       
   278     TRequestStatus status(KErrNone);
       
   279     if (!IsActive())
       
   280         {
       
   281         SendSizeRequestL(EIptvEngineVodContentGetEcgAllListSizeReq, aFrom, aAmount, aSearchString, status);    
       
   282         if (status.Int() != KErrNone)
       
   283             {
       
   284             CleanupL();
       
   285             }
       
   286         else
       
   287             {            
       
   288             HandleVodContentGetEcgAllListSizeReqL();
       
   289             HandleVodContentGetEcgAllListDataReqL(aTotalAmount, aEcgList);
       
   290             }
       
   291         }
       
   292     return status.Int();
       
   293     }
       
   294 
       
   295 // -----------------------------------------------------------------------------
       
   296 // CIptvVodContentClient::GetContentDetails
       
   297 // -----------------------------------------------------------------------------
       
   298 EXPORT_C TInt CIptvVodContentClient::GetContentDetailsL(TIptvContentId aContentId, CIptvVodContentContentFullDetails& aContentFullDetails)
       
   299     {    
       
   300     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetContentDetailsL");         
       
   301 
       
   302     TRequestStatus status(KErrNone);
       
   303     if (!IsActive())
       
   304         {                
       
   305         SendSizeRequestL(EIptvEngineVodContentGetContentDetailsSizeReq, aContentId, status);
       
   306         if (status.Int() != KErrNone)
       
   307             {
       
   308             CleanupL();
       
   309             }
       
   310         else
       
   311             {            
       
   312             HandleVodContentGetContentDetailsSizeReqL();
       
   313             HandleVodContentGetContentDetailsDataReqL(aContentFullDetails);
       
   314             }
       
   315         }
       
   316     return status.Int();
       
   317     }
       
   318 
       
   319 // -----------------------------------------------------------------------------
       
   320 // CIptvVodContentClient::SetIapL
       
   321 // -----------------------------------------------------------------------------
       
   322 EXPORT_C TInt CIptvVodContentClient::SetIapL(const TUint32 aIap)
       
   323     {           
       
   324     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SetIapL");         
       
   325 
       
   326     TRequestStatus status(KErrNone);
       
   327     if (!IsActive())
       
   328         { 
       
   329         SendSizeRequestL(EIptvEngineVodContentSetIap, aIap, status);
       
   330         if (status.Int() != KErrNone)
       
   331             {
       
   332             CleanupL();
       
   333             }
       
   334         }
       
   335     return status.Int();
       
   336     }
       
   337 
       
   338 // -----------------------------------------------------------------------------
       
   339 // CIptvVodContentClient::UpdateEcg
       
   340 // -----------------------------------------------------------------------------
       
   341 EXPORT_C TInt CIptvVodContentClient::UpdateEcgL()
       
   342     {
       
   343     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::UpdateEcgL");
       
   344 
       
   345     TRequestStatus status(KErrNone);
       
   346     if (!IsActive())
       
   347         {        
       
   348         SendRequestL(EIptvEngineVodContentUpdateEcg, 0, status);
       
   349         if (status.Int() != KErrNone)
       
   350             {
       
   351             CleanupL();
       
   352             }
       
   353         }
       
   354     return status.Int();
       
   355     }
       
   356 
       
   357 // -----------------------------------------------------------------------------
       
   358 // CIptvVodContentClient::CheckGroupL
       
   359 // -----------------------------------------------------------------------------
       
   360 EXPORT_C TInt CIptvVodContentClient::CheckGroupL()
       
   361     {
       
   362     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::CheckGroupL");
       
   363 
       
   364     TRequestStatus status( KErrNone );
       
   365     if ( !IsActive() )
       
   366         {        
       
   367         SendRequestL( EIptvEngineVodContentCheckGroup, 0, status );
       
   368         if ( status.Int() != KErrNone )
       
   369             {
       
   370             CleanupL();
       
   371             }
       
   372         }
       
   373     
       
   374     return status.Int();
       
   375     }
       
   376 
       
   377 // -----------------------------------------------------------------------------
       
   378 // CIptvVodContentClient::GetUpdateTimeL
       
   379 // -----------------------------------------------------------------------------
       
   380 EXPORT_C TInt CIptvVodContentClient::GetUpdateTimeL(TTime& aTime)
       
   381     {
       
   382     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetUpdateTimeL");
       
   383 
       
   384     TRequestStatus status(KErrNone);
       
   385     if (!IsActive())
       
   386         {
       
   387         SendUpdateTimeRequestL(status);
       
   388         if (status.Int() != KErrNone)
       
   389             {
       
   390             CleanupL();
       
   391             }
       
   392         else
       
   393             {
       
   394             HandleVodContentGetUpdateTimeL(aTime);
       
   395             }
       
   396         }
       
   397     return status.Int();
       
   398     }
       
   399 
       
   400 // -----------------------------------------------------------------------------
       
   401 // CIptvVodContentClient::GetContentAccessListL
       
   402 // -----------------------------------------------------------------------------
       
   403 EXPORT_C TInt CIptvVodContentClient::GetContentAccessListL(TUint32 aContentId, RPointerArray<CIptvMediaContent>& aCAList)
       
   404     {
       
   405     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetContentAccessListL");
       
   406 
       
   407     TRequestStatus status(KErrNone);
       
   408     if (!IsActive())
       
   409         {        
       
   410         SendSizeRequestL(EIptvEngineVodContentGetCAListSizeReq, aContentId, status);
       
   411         if (status.Int() != KErrNone)
       
   412             {
       
   413             CleanupL();
       
   414             }
       
   415         else
       
   416             {
       
   417             HandleVodContentGetCAListSizeReqL();
       
   418             HandleVodContentGetCAListDataReqL(aCAList);
       
   419             }
       
   420         }   
       
   421     return status.Int();
       
   422     }
       
   423 
       
   424 // -----------------------------------------------------------------------------
       
   425 // CIptvVodContentClient::SetLastPositionL
       
   426 // -----------------------------------------------------------------------------
       
   427 EXPORT_C TInt CIptvVodContentClient::SetLastPositionL(TUint32 aContentId, TUint32 aIndex, TUint32 aPosition)
       
   428     {
       
   429     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::GetContentAccessListL");
       
   430 
       
   431     TRequestStatus status(KErrNone);
       
   432     if (!IsActive())
       
   433         {        
       
   434         SendLastPositionL(EIptvEngineVodContentSetLastPosition, aContentId, aIndex, aPosition, status);
       
   435         if (status.Int() != KErrNone)
       
   436             {
       
   437             CleanupL();
       
   438             }
       
   439         }
       
   440     return status.Int();    
       
   441     }
       
   442 
       
   443 
       
   444 // -----------------------------------------------------------------------------
       
   445 // CIptvVodContentClient::SetMpxIdL
       
   446 // -----------------------------------------------------------------------------
       
   447 EXPORT_C TInt CIptvVodContentClient::SetMpxIdL( TUint32 aContentId,
       
   448                                                 TUint32 aCaIndex,
       
   449                                                 TUint32 aMpxId )
       
   450     {
       
   451     TRequestStatus status( KErrServerBusy );
       
   452     if ( !IsActive() )
       
   453         {        
       
   454         SendMpxIdL( EIptvEngineVodContentSetMpxId, aContentId, aCaIndex, aMpxId, status );
       
   455         if ( status.Int() != KErrNone )
       
   456             {
       
   457             CleanupL();
       
   458             }
       
   459         }
       
   460     return status.Int();    
       
   461     
       
   462     }
       
   463 
       
   464 // -----------------------------------------------------------------------------
       
   465 // CIptvVodContentClient::SendLastPositionL
       
   466 // -----------------------------------------------------------------------------
       
   467 void CIptvVodContentClient::SendLastPositionL(TInt aMessage, TUint32 aContentId, TUint32 aIndex, TUint32 aPosition, TRequestStatus& aStatus)
       
   468     {
       
   469     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendLastPositionL");
       
   470     
       
   471     delete iMsg;
       
   472     iMsg = NULL;
       
   473     
       
   474     iMsg = HBufC8::NewL(KIptvVodSendLastPositionSize);
       
   475     iMsgPtr.Set(iMsg->Des());
       
   476 
       
   477     RDesWriteStream stream;
       
   478     stream.Open(iMsgPtr);
       
   479     CleanupClosePushL( stream );
       
   480     stream.WriteUint32L(aContentId);
       
   481     stream.WriteUint32L(aIndex);
       
   482     stream.WriteUint32L(aPosition);
       
   483     CleanupStack::PopAndDestroy( &stream );
       
   484 
       
   485     iSession.SendRequest(aMessage, iMsgPtr, aStatus);
       
   486     User::WaitForRequest(aStatus);
       
   487     }
       
   488 
       
   489 // -----------------------------------------------------------------------------
       
   490 // CIptvVodContentClient::SendMpxIdL
       
   491 // -----------------------------------------------------------------------------
       
   492 void CIptvVodContentClient::SendMpxIdL( TInt aMessage,
       
   493                                         TUint32 aContentId,
       
   494                                         TUint32 aCaIndex,
       
   495                                         TUint32 aMpxId,
       
   496                                         TRequestStatus& aStatus )
       
   497     {
       
   498     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendMpxIdL");
       
   499     
       
   500     delete iMsg;
       
   501     iMsg = NULL;
       
   502     
       
   503     iMsg = HBufC8::NewL( KIptvVodSendMpxIdSize );
       
   504     iMsgPtr.Set( iMsg->Des() );
       
   505 
       
   506     RDesWriteStream stream;
       
   507     stream.Open( iMsgPtr );
       
   508     CleanupClosePushL( stream );
       
   509     stream.WriteUint32L( aContentId );
       
   510     stream.WriteUint32L( aCaIndex);
       
   511     stream.WriteUint32L( aMpxId );
       
   512     CleanupStack::PopAndDestroy( &stream );
       
   513 
       
   514     iSession.SendRequest( aMessage, iMsgPtr, aStatus );
       
   515     User::WaitForRequest( aStatus );
       
   516     }
       
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CIptvVodContentClient::RunL
       
   520 // -----------------------------------------------------------------------------
       
   521 void CIptvVodContentClient::RunL()
       
   522     {
       
   523     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::RunL");            
       
   524     }
       
   525 
       
   526 // -----------------------------------------------------------------------------
       
   527 // CIptvVodContentClient::DoCancel
       
   528 // -----------------------------------------------------------------------------
       
   529 void CIptvVodContentClient::DoCancel()
       
   530     {
       
   531     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::DoCancel");            
       
   532     }
       
   533 
       
   534 // -----------------------------------------------------------------------------
       
   535 // CIptvVodContentClient::HandleVodContentGetEcgCategoryListSizeReq
       
   536 // -----------------------------------------------------------------------------
       
   537 void CIptvVodContentClient::HandleVodContentGetEcgCategoryListSizeReqL()
       
   538     {
       
   539     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetEcgCategoryListSizeReqL");            
       
   540 
       
   541     if (iMsg)
       
   542         {
       
   543         RDesReadStream stream;
       
   544         stream.Open(iMsgPtr);
       
   545         CleanupClosePushL( stream );
       
   546         TUint32 dataSize = stream.ReadUint32L();                       	    
       
   547         CleanupStack::PopAndDestroy( &stream );
       
   548     
       
   549         IPTVLOGSTRING2_LOW_LEVEL("HandleVodContentGetEcgCategoryListSizeReq:: Data size = %d", dataSize);
       
   550         
       
   551         delete iMsg;
       
   552         iMsg = NULL;
       
   553        
       
   554         iMsg = HBufC8::NewL(dataSize);
       
   555         iMsgPtr.Set(iMsg->Des());
       
   556      
       
   557         TRequestStatus status;
       
   558         iSession.SendRequest(EIptvEngineVodContentGetEcgCategoryListDataReq, iMsgPtr, status);
       
   559         User::WaitForRequest(status);  
       
   560 
       
   561         if (status.Int() != KErrNone)
       
   562             {
       
   563             CleanupL();
       
   564             }     
       
   565         }
       
   566     }
       
   567 
       
   568 // -----------------------------------------------------------------------------
       
   569 // CIptvVodContentClient::HandleVodContentGetEcgCategoryListDataReq
       
   570 // -----------------------------------------------------------------------------
       
   571 void CIptvVodContentClient::HandleVodContentGetEcgCategoryListDataReqL(RPointerArray<CIptvVodContentCategoryBriefDetails>& aCategoryList)
       
   572     {    
       
   573     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetEcgCategoryListDataReqL");            
       
   574 
       
   575     if (iMsg)
       
   576         {
       
   577         RDesReadStream stream;
       
   578         stream.Open(iMsgPtr);
       
   579         CleanupClosePushL( stream );
       
   580         TUint32 count = stream.ReadUint32L();
       
   581         for (TUint32 i = 0; i < count; i++)
       
   582             {
       
   583             CIptvVodContentCategoryBriefDetails* brief = CIptvVodContentCategoryBriefDetails::NewL();
       
   584             CleanupStack::PushL(brief);
       
   585             brief->InternalizeL(stream);
       
   586             aCategoryList.AppendL(brief);
       
   587             CleanupStack::Pop(brief);            
       
   588             }
       
   589         CleanupStack::PopAndDestroy( &stream );
       
   590         delete iMsg;
       
   591         iMsg = NULL;
       
   592         }                
       
   593     }
       
   594 
       
   595 // -----------------------------------------------------------------------------
       
   596 // CIptvMyVideosClient::SendRequestL
       
   597 // -----------------------------------------------------------------------------
       
   598 //
       
   599 TInt CIptvVodContentClient::SendRequestL(
       
   600     TInt aMessage,
       
   601     CIptvMyVideosGlobalFileId& aFileIdParam,
       
   602     TUint32 aUintParam )
       
   603     {
       
   604     IPTVLOGSTRING_LOW_LEVEL(
       
   605         "My Videos Mgr ## CIptvMyVideosClient::SendRequestL" );
       
   606 
       
   607     TUint32 dataSize(
       
   608         aFileIdParam.CountExternalizeSize() + KTUint32SizeInBytes );
       
   609 
       
   610     HBufC8* ipcMsg = HBufC8::NewL( dataSize );
       
   611     CleanupStack::PushL( ipcMsg ); // 1->
       
   612             
       
   613     TPtr8 ipcMsgPtr( ipcMsg->Des() );
       
   614     ipcMsgPtr.Zero();
       
   615 
       
   616     RDesWriteStream stream;
       
   617     stream.Open( ipcMsgPtr );
       
   618     CleanupClosePushL( stream );
       
   619     aFileIdParam.ExternalizeL( stream );
       
   620     stream.WriteUint32L( aUintParam );
       
   621     CleanupStack::PopAndDestroy( &stream );
       
   622 
       
   623     TRequestStatus status;
       
   624     iSession.SendRequest( aMessage, ipcMsgPtr, status );
       
   625     User::WaitForRequest( status);
       
   626 
       
   627     CleanupStack::PopAndDestroy( ipcMsg ); // <-1
       
   628 
       
   629     return status.Int();
       
   630     }
       
   631 
       
   632 // -----------------------------------------------------------------------------
       
   633 // CIptvVodContentClient::SendRequestL
       
   634 // -----------------------------------------------------------------------------
       
   635 void CIptvVodContentClient::SendRequestL(TInt aMessage, TUint32 aParam, TRequestStatus& aStatus)
       
   636     {    
       
   637     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendRequestL");
       
   638 
       
   639     SendSizeRequestL(aMessage, aParam, aStatus);
       
   640     }
       
   641 
       
   642 // -----------------------------------------------------------------------------
       
   643 // CIptvVodContentClient::SendSizeRequest
       
   644 // -----------------------------------------------------------------------------
       
   645 void CIptvVodContentClient::SendSizeRequestL(TInt aMessage, TUint32 aParam, TRequestStatus& aStatus)
       
   646     {
       
   647     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendSizeRequestL");
       
   648     
       
   649     delete iMsg;
       
   650     iMsg = NULL;
       
   651     
       
   652     iMsg = HBufC8::NewL(KIptvSizeRequestSize);
       
   653     iMsgPtr.Set(iMsg->Des());
       
   654 
       
   655     RDesWriteStream stream;
       
   656     stream.Open(iMsgPtr);
       
   657     CleanupClosePushL( stream );
       
   658     stream.WriteUint32L(aParam);
       
   659     CleanupStack::PopAndDestroy( &stream );
       
   660 
       
   661     iSession.SendRequest(aMessage, iMsgPtr, aStatus);
       
   662     User::WaitForRequest(aStatus);
       
   663     }
       
   664 
       
   665 // -----------------------------------------------------------------------------
       
   666 // CIptvVodContentClient::SendSizeRequest
       
   667 // -----------------------------------------------------------------------------
       
   668 void CIptvVodContentClient::SendSizeRequestL( TInt aMessage,
       
   669                                               TUint32 aUintParam1,
       
   670                                               TUint32 aUintParam2,
       
   671                                               TUint32 aUintParam3,
       
   672                                               const TDesC& aDesCParam,
       
   673                                               TRequestStatus& aStatus )
       
   674     {
       
   675     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendSizeRequestL");
       
   676     
       
   677     delete iMsg;
       
   678     iMsg = NULL;
       
   679         
       
   680     // length (2), TUint32 aUintParam1, TUint32 aUintParam2, TUint32 aUintParam3, TDesC& aDesCParam)
       
   681     TUint32 length = aDesCParam.Length();
       
   682     TUint32 dataSize = 2 + 4 + 4 + 4 + (length * 2);
       
   683     IPTVLOGSTRING2_LOW_LEVEL("SendSizeRequestL:: data size = %d", dataSize);
       
   684     
       
   685     iMsg = HBufC8::NewL(dataSize);
       
   686     iMsgPtr.Set(iMsg->Des());
       
   687 
       
   688     RDesWriteStream stream;
       
   689     stream.Open(iMsgPtr);
       
   690     CleanupClosePushL( stream );      
       
   691     stream.WriteUint32L(aUintParam1);
       
   692     stream.WriteUint32L(aUintParam2);
       
   693     stream.WriteUint32L(aUintParam3);
       
   694     CIptvUtil::WriteDesToStreamL(aDesCParam, stream);    
       
   695     CleanupStack::PopAndDestroy( &stream );
       
   696     
       
   697     iSession.SendRequest(aMessage, iMsgPtr, aStatus);
       
   698     User::WaitForRequest(aStatus);            
       
   699     }
       
   700 
       
   701 // -----------------------------------------------------------------------------
       
   702 // CIptvVodContentClient::SendSizeRequest
       
   703 // -----------------------------------------------------------------------------
       
   704 void CIptvVodContentClient::SendSizeRequestL( TInt aMessage,
       
   705                                               TUint32 aUintParam1,
       
   706                                               TUint32 aUintParam2,
       
   707                                               const TDesC& aDesCParam,
       
   708                                               TRequestStatus& aStatus )
       
   709     {
       
   710     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendSizeRequestL");
       
   711     
       
   712     delete iMsg;
       
   713     iMsg = NULL;
       
   714             
       
   715     // length (2), TUint32 aUintParam1, TUint32 aUintParam2, TDesC& aDesCParam)
       
   716     TUint32 length = aDesCParam.Length();
       
   717     TUint32 dataSize = 2 + 4 + 4 + (length * 2);
       
   718     IPTVLOGSTRING2_LOW_LEVEL("SendSizeRequestL:: data size = %d", dataSize);
       
   719     
       
   720     iMsg = HBufC8::NewL(dataSize);
       
   721     iMsgPtr.Set(iMsg->Des());
       
   722 
       
   723     RDesWriteStream stream;
       
   724     stream.Open(iMsgPtr);  
       
   725     CleanupClosePushL( stream );     
       
   726     stream.WriteUint32L(aUintParam1);
       
   727     stream.WriteUint32L(aUintParam2);
       
   728     CIptvUtil::WriteDesToStreamL(aDesCParam, stream);
       
   729     CleanupStack::PopAndDestroy( &stream );
       
   730 
       
   731     iSession.SendRequest(aMessage, iMsgPtr, aStatus);
       
   732     User::WaitForRequest(aStatus);           
       
   733     }
       
   734 
       
   735 // -----------------------------------------------------------------------------
       
   736 // CIptvVodContentClient::HandleVodContentGetCategoryDetailsSizeReq
       
   737 // -----------------------------------------------------------------------------
       
   738 void CIptvVodContentClient::HandleVodContentGetCategoryDetailsSizeReqL()
       
   739     {
       
   740     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetCategoryDetailsSizeReqL");
       
   741 
       
   742     if (iMsg)
       
   743         {
       
   744         RDesReadStream stream;
       
   745         stream.Open(iMsgPtr);
       
   746         CleanupClosePushL( stream );   
       
   747         TUint32 dataSize = stream.ReadUint32L();                       	    
       
   748         CleanupStack::PopAndDestroy( &stream );
       
   749 
       
   750         IPTVLOGSTRING2_LOW_LEVEL("HandleVodContentGetCategoryDetailsSizeReq:: Data size = %d", dataSize);    
       
   751         
       
   752         delete iMsg;
       
   753         iMsg = NULL;
       
   754         
       
   755         iMsg = HBufC8::NewL(dataSize);
       
   756         iMsgPtr.Set(iMsg->Des());                                                  
       
   757      
       
   758         TRequestStatus status;
       
   759         iSession.SendRequest(EIptvEngineVodContentGetCategoryDetailsDataReq, iMsgPtr, status);
       
   760         User::WaitForRequest(status);
       
   761 
       
   762         if (status.Int() != KErrNone)
       
   763             {
       
   764             CleanupL();
       
   765             }
       
   766         }
       
   767     }
       
   768 
       
   769 // -----------------------------------------------------------------------------
       
   770 // CIptvVodContentClient::HandleVodContentGetCategoryDetailsDataReq
       
   771 // -----------------------------------------------------------------------------
       
   772 void CIptvVodContentClient::HandleVodContentGetCategoryDetailsDataReqL(CIptvVodContentCategoryBriefDetails& aCategory)
       
   773     {
       
   774     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetCategoryDetailsDataReqL");
       
   775 
       
   776     if (iMsg)
       
   777         {
       
   778         RDesReadStream stream;
       
   779         stream.Open(iMsgPtr);
       
   780         CleanupClosePushL( stream );
       
   781         aCategory.InternalizeL(stream);
       
   782         CleanupStack::PopAndDestroy( &stream );    
       
   783         }   
       
   784        
       
   785     delete iMsg;
       
   786     iMsg = NULL;        
       
   787     }
       
   788 
       
   789 // -----------------------------------------------------------------------------
       
   790 // CIptvVodContentClient::HandleVodContentGetParentCategoryReqL
       
   791 // -----------------------------------------------------------------------------
       
   792 void CIptvVodContentClient::HandleVodContentGetParentCategoryReqL(TIptvCategoryId& aParentId)
       
   793     {
       
   794     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetParentCategoryReqL");
       
   795 
       
   796     if (iMsg)
       
   797         {
       
   798         RDesReadStream stream;
       
   799         stream.Open(iMsgPtr);
       
   800         CleanupClosePushL( stream );
       
   801         aParentId = stream.ReadUint32L();                       	    
       
   802         CleanupStack::PopAndDestroy( &stream );      
       
   803         }   
       
   804        
       
   805     delete iMsg;
       
   806     iMsg = NULL;      
       
   807     }
       
   808 
       
   809 // -----------------------------------------------------------------------------
       
   810 // CIptvVodContentClient::HandleVodContentGetEcgListSizeReq
       
   811 // -----------------------------------------------------------------------------
       
   812 void CIptvVodContentClient::HandleVodContentGetEcgListSizeReqL()
       
   813     {
       
   814     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetEcgListSizeReqL");
       
   815 
       
   816     if (iMsg)
       
   817         {
       
   818         RDesReadStream stream;
       
   819         stream.Open(iMsgPtr);
       
   820         CleanupClosePushL( stream );
       
   821         TUint32 dataSize = stream.ReadUint32L();                       	    
       
   822         CleanupStack::PopAndDestroy( &stream );   
       
   823     
       
   824         IPTVLOGSTRING2_LOW_LEVEL("HandleVodContentGetEcgListSizeReq:: Data size = %d", dataSize);    
       
   825         
       
   826         delete iMsg;
       
   827         iMsg = NULL;
       
   828         
       
   829         iMsg = HBufC8::NewL(dataSize);
       
   830         iMsgPtr.Set(iMsg->Des());                                                  
       
   831      
       
   832         TRequestStatus status;
       
   833         iSession.SendRequest(EIptvEngineVodContentGetEcgListDataReq, iMsgPtr, status);
       
   834         User::WaitForRequest(status);
       
   835 
       
   836         if (status.Int() != KErrNone)
       
   837             {
       
   838             CleanupL();
       
   839             }
       
   840         }
       
   841     }
       
   842 
       
   843 // -----------------------------------------------------------------------------
       
   844 // CIptvVodContentClient::HandleVodContentGetCAListSizeReqL
       
   845 // -----------------------------------------------------------------------------
       
   846 void CIptvVodContentClient::HandleVodContentGetCAListSizeReqL()
       
   847     {
       
   848     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetCAListSizeReqL");
       
   849 
       
   850     if (iMsg)
       
   851         {
       
   852         RDesReadStream stream;
       
   853         stream.Open(iMsgPtr);
       
   854         CleanupClosePushL( stream );
       
   855         TUint32 dataSize = stream.ReadUint32L();                       	    
       
   856         CleanupStack::PopAndDestroy( &stream );   
       
   857     
       
   858         IPTVLOGSTRING2_LOW_LEVEL("HandleVodContentGetCAListSizeReqL:: Data size = %d", dataSize);    
       
   859         
       
   860         delete iMsg;
       
   861         iMsg = NULL;
       
   862         
       
   863         iMsg = HBufC8::NewL(dataSize);
       
   864         iMsgPtr.Set(iMsg->Des());                                                  
       
   865      
       
   866         TRequestStatus status;        
       
   867         iSession.SendRequest(EIptvEngineVodContentGetCAListDataReq, iMsgPtr, status);
       
   868         User::WaitForRequest(status);
       
   869 
       
   870         if (status.Int() != KErrNone)
       
   871             {
       
   872             CleanupL();
       
   873             }
       
   874         }
       
   875     }
       
   876 
       
   877 // -----------------------------------------------------------------------------
       
   878 // CIptvVodContentClient::HandleVodContentGetCAListDataReqL
       
   879 // -----------------------------------------------------------------------------
       
   880 void CIptvVodContentClient::HandleVodContentGetCAListDataReqL(RPointerArray<CIptvMediaContent>& aCAList)
       
   881     {
       
   882     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetCAListDataReqL");
       
   883 
       
   884     if (iMsg)
       
   885         {
       
   886         RDesReadStream stream;
       
   887         stream.Open(iMsgPtr);
       
   888         CleanupClosePushL( stream );
       
   889         TUint32 count = stream.ReadUint32L();        
       
   890         for (TUint32 i = 0; i < count; i++)
       
   891             {
       
   892             CIptvMediaContent* content = CIptvMediaContent::NewL();
       
   893             CleanupStack::PushL(content);
       
   894             content->InternalizeL(stream);
       
   895             aCAList.AppendL(content);
       
   896             CleanupStack::Pop(content);            
       
   897             }
       
   898         CleanupStack::PopAndDestroy( &stream );
       
   899         }    
       
   900 
       
   901     delete iMsg;
       
   902     iMsg = NULL;
       
   903     }
       
   904 
       
   905 // -----------------------------------------------------------------------------
       
   906 // CIptvVodContentClient::HandleVodContentGetEcgListSizeReq
       
   907 // -----------------------------------------------------------------------------
       
   908 void CIptvVodContentClient::HandleVodContentGetEcgListDataReqL(TUint32& aTotalAmount, RPointerArray<CIptvVodContentContentBriefDetails>& aEcgList)
       
   909     {
       
   910     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetEcgListDataReqL");
       
   911 
       
   912     if (iMsg)
       
   913         {
       
   914         RDesReadStream stream;
       
   915         stream.Open(iMsgPtr);
       
   916         CleanupClosePushL( stream );
       
   917         TUint32 count = stream.ReadUint32L();
       
   918         aTotalAmount = stream.ReadUint32L();
       
   919         for (TUint32 i = 0; i < count; i++)
       
   920             {
       
   921             CIptvVodContentContentBriefDetails* brief = CIptvVodContentContentBriefDetails::NewL();
       
   922             CleanupStack::PushL(brief);
       
   923             brief->InternalizeL(stream);
       
   924             aEcgList.AppendL(brief);
       
   925             CleanupStack::Pop(brief);            
       
   926             }
       
   927         CleanupStack::PopAndDestroy( &stream );
       
   928         }    
       
   929 
       
   930     delete iMsg;
       
   931     iMsg = NULL;
       
   932     }
       
   933 
       
   934 // -----------------------------------------------------------------------------
       
   935 // CIptvVodContentClient::HandleVodContentGetEcgAllListSizeReqL
       
   936 // -----------------------------------------------------------------------------
       
   937 void CIptvVodContentClient::HandleVodContentGetEcgAllListSizeReqL()
       
   938     {
       
   939     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetEcgAllListSizeReqL");
       
   940 
       
   941     if (iMsg)
       
   942         {
       
   943         RDesReadStream stream;
       
   944         stream.Open(iMsgPtr);
       
   945         CleanupClosePushL( stream );
       
   946         TUint32 dataSize = stream.ReadUint32L();                       	    
       
   947         CleanupStack::PopAndDestroy( &stream );   
       
   948     
       
   949         IPTVLOGSTRING2_LOW_LEVEL("HandleVodContentGetEcgAllListSizeReqL:: Data size = %d", dataSize);    
       
   950         
       
   951         delete iMsg;
       
   952         iMsg = NULL;
       
   953         
       
   954         iMsg = HBufC8::NewL(dataSize);
       
   955         iMsgPtr.Set(iMsg->Des());                                                  
       
   956      
       
   957         TRequestStatus status;
       
   958         iSession.SendRequest(EIptvEngineVodContentGetEcgAllListDataReq, iMsgPtr, status);
       
   959         User::WaitForRequest(status);
       
   960 
       
   961         if (status.Int() != KErrNone)
       
   962             {
       
   963             CleanupL();
       
   964             }
       
   965         }
       
   966     }
       
   967 
       
   968 // -----------------------------------------------------------------------------
       
   969 // CIptvVodContentClient::HandleVodContentGetEcgAllListDataReqL
       
   970 // -----------------------------------------------------------------------------
       
   971 void CIptvVodContentClient::HandleVodContentGetEcgAllListDataReqL(TUint32& aTotalAmount, RPointerArray<CIptvVodContentContentBriefDetails>& aEcgList)
       
   972     {
       
   973     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetEcgAllListDataReqL");
       
   974 
       
   975     if (iMsg)
       
   976         {
       
   977         RDesReadStream stream;
       
   978         stream.Open(iMsgPtr);
       
   979         CleanupClosePushL( stream );
       
   980         TUint32 count = stream.ReadUint32L();
       
   981         aTotalAmount = stream.ReadUint32L();
       
   982         for (TUint32 i = 0; i < count; i++)
       
   983             {
       
   984             CIptvVodContentContentBriefDetails* brief = CIptvVodContentContentBriefDetails::NewL();
       
   985             CleanupStack::PushL(brief);
       
   986             brief->InternalizeL(stream);
       
   987             aEcgList.AppendL(brief);
       
   988             CleanupStack::Pop(brief);            
       
   989             }
       
   990         CleanupStack::PopAndDestroy( &stream );
       
   991         }    
       
   992 
       
   993     delete iMsg;
       
   994     iMsg = NULL;
       
   995     }
       
   996 
       
   997 // -----------------------------------------------------------------------------
       
   998 // CIptvVodContentClient::HandleVodContentGetContentDetailsSizeReqL
       
   999 // -----------------------------------------------------------------------------
       
  1000 void CIptvVodContentClient::HandleVodContentGetContentDetailsSizeReqL()
       
  1001     {
       
  1002     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetContentDetailsSizeReqL");
       
  1003 
       
  1004     if (iMsg)
       
  1005         {
       
  1006         RDesReadStream stream;
       
  1007         stream.Open(iMsgPtr);
       
  1008         CleanupClosePushL( stream );
       
  1009         TUint32 dataSize = stream.ReadUint32L();                       	    
       
  1010         CleanupStack::PopAndDestroy( &stream );
       
  1011 
       
  1012         IPTVLOGSTRING2_LOW_LEVEL("HandleVodContentGetContentDetailsSizeReqL:: Data size = %d", dataSize);    
       
  1013         
       
  1014         delete iMsg;
       
  1015         iMsg = NULL;
       
  1016         
       
  1017         iMsg = HBufC8::NewL(dataSize);
       
  1018         iMsgPtr.Set(iMsg->Des());                                                  
       
  1019      
       
  1020         TRequestStatus status;
       
  1021         iSession.SendRequest(EIptvEngineVodContentGetContentDetailsDataReq, iMsgPtr, status);
       
  1022         User::WaitForRequest(status);
       
  1023 
       
  1024         if (status.Int() != KErrNone)
       
  1025             {
       
  1026             CleanupL();
       
  1027             }
       
  1028         }
       
  1029     }
       
  1030 
       
  1031 // -----------------------------------------------------------------------------
       
  1032 // CIptvVodContentClient::HandleVodContentGetContentDetailsDataReqL
       
  1033 // -----------------------------------------------------------------------------
       
  1034 void CIptvVodContentClient::HandleVodContentGetContentDetailsDataReqL(CIptvVodContentContentFullDetails& aContentFullDetails)
       
  1035     {
       
  1036     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetContentDetailsDataReqL");
       
  1037 
       
  1038     if (iMsg)
       
  1039         {
       
  1040         RDesReadStream stream;
       
  1041         stream.Open(iMsgPtr);
       
  1042         CleanupClosePushL( stream );
       
  1043         aContentFullDetails.InternalizeL(stream);
       
  1044         CleanupStack::PopAndDestroy( &stream );  
       
  1045         }   
       
  1046        
       
  1047     delete iMsg;
       
  1048     iMsg = NULL;        
       
  1049     }
       
  1050 
       
  1051 // -----------------------------------------------------------------------------
       
  1052 // CIptvVodContentClient::SendCancelRequest
       
  1053 // -----------------------------------------------------------------------------
       
  1054 void CIptvVodContentClient::SendCancelRequest()
       
  1055     {
       
  1056     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendCancelRequest");
       
  1057 
       
  1058     TRequestStatus status;
       
  1059     iSession.SendRequest(EIptvEngineVodContentCancel, status);
       
  1060     User::WaitForRequest(status);
       
  1061     }
       
  1062 
       
  1063 // -----------------------------------------------------------------------------
       
  1064 // CIptvVodContentClient::SendCancelUpdateRequest
       
  1065 // -----------------------------------------------------------------------------
       
  1066 void CIptvVodContentClient::SendCancelUpdateRequest()
       
  1067     {
       
  1068     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendCancelUpdateRequest");
       
  1069 
       
  1070     TRequestStatus status;
       
  1071     iSession.SendRequest( EIptvEngineVodContentCancelUpdate, status );
       
  1072     User::WaitForRequest(status);
       
  1073     }
       
  1074 
       
  1075 // -----------------------------------------------------------------------------
       
  1076 // CIptvVodContentClient::SendUpdateTimeRequestL
       
  1077 // -----------------------------------------------------------------------------
       
  1078 void CIptvVodContentClient::SendUpdateTimeRequestL(TRequestStatus& aStatus)
       
  1079     {
       
  1080     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendUpdateTimeRequestL");
       
  1081 
       
  1082     delete iMsg;
       
  1083     iMsg = NULL;
       
  1084     
       
  1085     iMsg = HBufC8::NewL(KIptvVodGetUpdateTimeRequestSize);
       
  1086     iMsgPtr.Set(iMsg->Des());
       
  1087         
       
  1088     iSession.SendRequest(EIptvEngineVodGetUpdateTime, iMsgPtr, aStatus);
       
  1089     User::WaitForRequest(aStatus);
       
  1090     }
       
  1091 
       
  1092 // -----------------------------------------------------------------------------
       
  1093 // CIptvVodContentClient::HandleVodContentGetUpdateTimeL
       
  1094 // -----------------------------------------------------------------------------
       
  1095 void CIptvVodContentClient::HandleVodContentGetUpdateTimeL(TTime& aTime)
       
  1096     {
       
  1097     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentGetUpdateTimeL");
       
  1098 
       
  1099     if (iMsg)
       
  1100         {
       
  1101         RDesReadStream stream;
       
  1102         stream.Open(iMsgPtr);
       
  1103         CleanupClosePushL( stream );
       
  1104         TUint32 lower = stream.ReadUint32L();
       
  1105         TUint32 upper = stream.ReadUint32L();
       
  1106         TInt64 time = 0;
       
  1107         time = (TInt64) lower;    
       
  1108         TInt64 longUpper = (TInt64) upper;
       
  1109         longUpper = longUpper << 32;        
       
  1110         longUpper &= (0xFFFFFFFF00000000ULL);    
       
  1111         time |= longUpper;
       
  1112         aTime = time;  
       
  1113         CleanupStack::PopAndDestroy( &stream );       
       
  1114         }    
       
  1115 
       
  1116     delete iMsg;
       
  1117     iMsg = NULL;
       
  1118     }
       
  1119 
       
  1120 // -----------------------------------------------------------------------------
       
  1121 // CIptvVodContentClient::Search
       
  1122 // -----------------------------------------------------------------------------
       
  1123 EXPORT_C TInt CIptvVodContentClient::Search(
       
  1124 							TIptvRssSearchQuery& aQuery
       
  1125 							)
       
  1126 	{
       
  1127 	TInt retVal = KErrNotSupported;
       
  1128 
       
  1129 	if( !IsActive() )
       
  1130 		{
       
  1131 	    TPckgBuf<TIptvRssSearchQuery> pckg( aQuery );
       
  1132 
       
  1133 	    TIpcArgs args( &pckg );
       
  1134 
       
  1135 	    retVal = iSession.SendRequest( EIptvEngineVodContentRssSearch, args );
       
  1136 		}
       
  1137 	else
       
  1138 		{
       
  1139 		retVal = KErrNotReady;
       
  1140 		}
       
  1141 
       
  1142 	return retVal;
       
  1143 	}
       
  1144 
       
  1145 // -----------------------------------------------------------------------------
       
  1146 // CIptvVodContentClient::CancelSearch
       
  1147 // -----------------------------------------------------------------------------
       
  1148 EXPORT_C TInt CIptvVodContentClient::CancelSearch()
       
  1149 	{
       
  1150 	TInt retVal = KErrNotSupported;
       
  1151 
       
  1152 	if( !IsActive() )
       
  1153 		{
       
  1154 		TRequestStatus status;
       
  1155 		iSession.SendRequest( EIptvEngineVodContentRssSearchCancel, status );
       
  1156 		User::WaitForRequest( status );
       
  1157 		retVal = KErrNone;
       
  1158 		}
       
  1159 
       
  1160 	return retVal;
       
  1161 	}
       
  1162 
       
  1163 // -----------------------------------------------------------------------------
       
  1164 // Reset global Id.
       
  1165 // -----------------------------------------------------------------------------
       
  1166 //
       
  1167 EXPORT_C void CIptvVodContentClient::ResetGlobalId(
       
  1168     CIptvMyVideosGlobalFileId& aFileId,
       
  1169     TUint32 aServiceId )
       
  1170     {
       
  1171     if ( !IsActive() )
       
  1172         {
       
  1173         TRAP_IGNORE( SendRequestL(
       
  1174             EIptvEngineVodContentResetGlobalId,
       
  1175             aFileId,
       
  1176             aServiceId ) );
       
  1177         }
       
  1178     }
       
  1179 
       
  1180 // -----------------------------------------------------------------------------
       
  1181 // Check if update needed 
       
  1182 // -----------------------------------------------------------------------------
       
  1183 //
       
  1184 EXPORT_C TInt CIptvVodContentClient::UpdateAvailableL( TBool& aAvailable )
       
  1185     {
       
  1186     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::UpdateAvailableL");
       
  1187 
       
  1188     TRequestStatus status( KErrNone );
       
  1189     if (!IsActive())
       
  1190         {
       
  1191         SendUpdateCheckRequestL( status );
       
  1192         if ( status.Int() != KErrNone )
       
  1193             {
       
  1194             CleanupL();
       
  1195             }
       
  1196         else
       
  1197             {
       
  1198             HandleVodContentUpdateCheckL( aAvailable );
       
  1199             }
       
  1200         }
       
  1201     return status.Int();    
       
  1202     }
       
  1203 
       
  1204 // -----------------------------------------------------------------------------
       
  1205 // Cancel ongoing content update
       
  1206 // -----------------------------------------------------------------------------
       
  1207 //
       
  1208 EXPORT_C void CIptvVodContentClient::CancelUpdate()
       
  1209     {
       
  1210     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::CancelUpdate()");
       
  1211     Cancel();
       
  1212     SendCancelUpdateRequest();
       
  1213     }
       
  1214 
       
  1215 // -----------------------------------------------------------------------------
       
  1216 // Send update check request
       
  1217 // -----------------------------------------------------------------------------
       
  1218 void CIptvVodContentClient::SendUpdateCheckRequestL( TRequestStatus& aStatus )
       
  1219     {
       
  1220     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::SendUpdateCheckRequestL");
       
  1221 
       
  1222     delete iMsg;
       
  1223     iMsg = NULL;
       
  1224 
       
  1225     iMsg = HBufC8::NewL( KIptvVodUpdateCheckRequestSize );
       
  1226     iMsgPtr.Set(iMsg->Des());
       
  1227         
       
  1228     iSession.SendRequest( EIptvEngineVodContentCheckUpdate, iMsgPtr, aStatus );
       
  1229     User::WaitForRequest(aStatus);
       
  1230     }
       
  1231 
       
  1232 // -----------------------------------------------------------------------------
       
  1233 // Handle content update check
       
  1234 // -----------------------------------------------------------------------------
       
  1235 //
       
  1236 void CIptvVodContentClient::HandleVodContentUpdateCheckL( TBool& aAvailable )
       
  1237     {
       
  1238     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentClient::HandleVodContentUpdateCheckL");
       
  1239 
       
  1240     if ( iMsg )
       
  1241         {
       
  1242         RDesReadStream stream;
       
  1243         stream.Open( iMsgPtr );
       
  1244         CleanupClosePushL( stream );
       
  1245         TInt32 updateValue = stream.ReadInt32L();
       
  1246         TInt32 updateAvailable = (TBool) updateValue;
       
  1247         aAvailable = updateAvailable;  
       
  1248         CleanupStack::PopAndDestroy( &stream );
       
  1249         }    
       
  1250 
       
  1251     delete iMsg;
       
  1252     iMsg = NULL;
       
  1253     }