videofeeds/clientapi/src/CIptvVodContentUpdateObserver.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     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 <s32mem.h>
       
    24 #include "IptvDebug.h"
       
    25 
       
    26 #include "MIptvVodContentClientObserver.h"
       
    27 #include "IptvClientServerCommon.h"
       
    28 #include "CIptvVodContentUpdateObserver.h"
       
    29 #include "RIptvClientSession.h"
       
    30 
       
    31 // CONSTANTS
       
    32 const TUint32 KIptvVodObserverData = 0;
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 // ---------------------------------------------------------
       
    37 // CIptvVodContentUpdateObserver::ConstructL
       
    38 // Symbian 2nd phase constructor can leave.
       
    39 // ---------------------------------------------------------
       
    40 //
       
    41 void CIptvVodContentUpdateObserver::ConstructL()
       
    42     {    
       
    43     SendObserverRequestL();
       
    44     SetActive();
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CIptvVodContentUpdateObserver::NewL
       
    49 // Two-phased constructor.
       
    50 // ---------------------------------------------------------
       
    51 //
       
    52 EXPORT_C CIptvVodContentUpdateObserver* CIptvVodContentUpdateObserver::NewL(MIptvVodContentClientObserver& aObserver, 
       
    53     RIptvClientSession& aSession,
       
    54     TIptvServiceId aServiceId)
       
    55     {
       
    56     CIptvVodContentUpdateObserver* self = new(ELeave) CIptvVodContentUpdateObserver(aObserver, aSession, aServiceId);
       
    57     CleanupStack::PushL(self);
       
    58     self->ConstructL();
       
    59     CleanupStack::Pop(self);
       
    60     return self;
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------
       
    64 // CIptvVodContentUpdateObserver::~CIptvVodContentUpdateObserver
       
    65 // Destructor
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 CIptvVodContentUpdateObserver::~CIptvVodContentUpdateObserver()
       
    69     {
       
    70     delete iObserverMsg;
       
    71     Cancel();        
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------
       
    75 // CIptvVodContentUpdateObserver::CIptvVodContentUpdateObserver
       
    76 // C++ default constructor
       
    77 // ---------------------------------------------------------
       
    78 //
       
    79 CIptvVodContentUpdateObserver::CIptvVodContentUpdateObserver(MIptvVodContentClientObserver& aObserver, 
       
    80     RIptvClientSession& aSession, 
       
    81     TIptvServiceId aServiceId) : 
       
    82     CActive( EPriorityStandard ),
       
    83     iObserver( aObserver ),
       
    84     iSession( aSession ),
       
    85     iObserverMsg( NULL ),
       
    86     iObserverMsgPtr( (unsigned char*)0, 0 ),
       
    87     iServiceId( aServiceId )
       
    88     {
       
    89     CActiveScheduler::Add(this);
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------
       
    93 // CIptvVodContentUpdateObserver::DoCancel
       
    94 // 
       
    95 // ---------------------------------------------------------
       
    96 //
       
    97 void CIptvVodContentUpdateObserver::DoCancel()
       
    98     {
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------
       
   102 // CIptvVodContentUpdateObserver::RunL
       
   103 // 
       
   104 // ---------------------------------------------------------
       
   105 //
       
   106 void CIptvVodContentUpdateObserver::RunL()
       
   107     {
       
   108     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentUpdateObserver::RunL");
       
   109 
       
   110     RDesReadStream stream;
       
   111     stream.Open(iObserverMsgPtr);
       
   112     CleanupClosePushL( stream );    
       
   113     TUint32 msg = stream.ReadUint32L();
       
   114     TInt info = stream.ReadInt32L();
       
   115     CleanupStack::PopAndDestroy( &stream );
       
   116 
       
   117     TRAP_IGNORE( iObserver.HandleEpgManagerMsgL( msg, info, iServiceId ) );
       
   118             
       
   119     SendObserverRequestL();
       
   120     SetActive();
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CIptvVodContentClient::SendObserverRequestL
       
   125 // -----------------------------------------------------------------------------
       
   126 void CIptvVodContentUpdateObserver::SendObserverRequestL()
       
   127     {
       
   128     IPTVLOGSTRING_LOW_LEVEL("CIptvVodContentUpdateObserver::SendObserverRequestL");
       
   129 
       
   130     delete iObserverMsg;
       
   131     iObserverMsg = NULL;
       
   132     
       
   133     iObserverMsg = HBufC8::NewL(KIptvVodObserverRequestSize);
       
   134     iObserverMsgPtr.Set(iObserverMsg->Des());
       
   135 
       
   136     RDesWriteStream stream;
       
   137     stream.Open(iObserverMsgPtr);
       
   138     CleanupClosePushL( stream );
       
   139     stream.WriteUint32L(KIptvVodObserverData);
       
   140     CleanupStack::PopAndDestroy( &stream );
       
   141     
       
   142     iSession.SendRequest(EIptvEngineVodContentObserver, iObserverMsgPtr, iStatus);
       
   143     }