homescreenplugins/videochplugin/src/videocontentharvesterservicelistener.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <e32base.h>
       
    21 
       
    22 #include "IptvDebug.h"
       
    23 #include "iptvactivespacepskeys.h"
       
    24 
       
    25 #include "videocontentharvesterplugin.h"
       
    26 #include "videocontentharvesterservicelistener.h"
       
    27 #include "videochpublishabledata.h"
       
    28 #include "videochpublisher.h"
       
    29 
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // 
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CVcxNsContentHarvesterServiceListener::CVcxNsContentHarvesterServiceListener(
       
    37         CVcxNsChPublisher* aPublisher,
       
    38         CVcxNsChPublishableData* aPublishableData ) :
       
    39                                                                   
       
    40     iPublisher( aPublisher ),
       
    41     iPublishableData( aPublishableData )
       
    42     {
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // 
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 void CVcxNsContentHarvesterServiceListener::ConstructL()
       
    50     {
       
    51     IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterServiceListener::ConstructL IN");
       
    52 
       
    53     iVodServiceCount = CVcxNsCHPSSubscriber::NewL( KPSUidIptvServer, KIptvAsVodCastFeedCount,  
       
    54                                                     RProperty::EInt, this );
       
    55     iVodServiceCount->Start();
       
    56     
       
    57     iLiveTvServiceCount = CVcxNsCHPSSubscriber::NewL( KPSUidIptvServer, KIptvLiveTVServiceCount,  
       
    58                                                         RProperty::EInt, this );
       
    59     iLiveTvServiceCount->Start();
       
    60     
       
    61     IPTVLOGSTRING_LOW_LEVEL("CVcxNsContentHarvesterServiceListener::ConstructL OUT");
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // 
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CVcxNsContentHarvesterServiceListener* CVcxNsContentHarvesterServiceListener::NewL(
       
    69         CVcxNsChPublisher* aPublisher,
       
    70         CVcxNsChPublishableData* aPublishableData )
       
    71     {
       
    72     CVcxNsContentHarvesterServiceListener* self = 
       
    73         new( ELeave ) CVcxNsContentHarvesterServiceListener( aPublisher, aPublishableData );
       
    74     
       
    75     CleanupStack::PushL( self );
       
    76     self->ConstructL();
       
    77     CleanupStack::Pop( self );
       
    78     
       
    79     return self;
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // 
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 CVcxNsContentHarvesterServiceListener::~CVcxNsContentHarvesterServiceListener()
       
    87      {
       
    88      delete iVodServiceCount;
       
    89      delete iLiveTvServiceCount;     
       
    90      }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CVcxNsContentHarvesterServiceListener::ValueChanged
       
    94 // From class MCHPSObserver.
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 void CVcxNsContentHarvesterServiceListener::ValueChanged( 
       
    98         const TUint32& aKey, 
       
    99         const TInt& aValue  )
       
   100     {
       
   101     if( aKey == KIptvAsVodCastFeedCount )
       
   102         {
       
   103         TRAP_IGNORE( iPublishableData->SetDataL( EVCxNsCPContentFeeds,
       
   104                                                  TPtrC8( KTvVideoCount ),
       
   105                                                  aValue ) );
       
   106         
       
   107         TRAP_IGNORE( iPublisher->PublishContentL( EVCxNsCPContentFeeds ) );
       
   108         }
       
   109         
       
   110     // NOTE: LiveTV and IPTV means same thing in this context
       
   111     else if( aKey == KIptvLiveTVServiceCount )
       
   112         {
       
   113         TRAP_IGNORE( iPublishableData->SetDataL( EVCxNsCPContentIPTV,
       
   114                                                  TPtrC8( KTvVideoCount ),
       
   115                                                  aValue ) );
       
   116         if( aValue )
       
   117             {
       
   118             TRAP_IGNORE( iPublisher->PublishContentL( EVCxNsCPContentIPTV ) );
       
   119             }
       
   120         else
       
   121             {
       
   122             TRAP_IGNORE( iPublisher->DeleteContentL( EVCxNsCPContentIPTV ) );
       
   123             iPublishableData->ClearData( EVCxNsCPContentIPTV );
       
   124             }
       
   125         }    
       
   126     }
       
   127