contextframework/cfwplugins/displaysourceplugin/src/displaysourceplugin.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     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 "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:  CDisplaySourcePlugIn class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <cfcontextobject.h>
       
    20 #include <cfcontextinterface.h>
       
    21 
       
    22 #include "displaysourceplugin.h"
       
    23 #include "displaysourcecontextdef.h"
       
    24 #include "displayservicebase.h"
       
    25 #include "displayservicelight.h"
       
    26 #include "displayserviceuilayout.h"
       
    27 #include "trace.h"
       
    28 
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 CDisplaySourcePlugIn* CDisplaySourcePlugIn::NewL(
       
    32     TContextSourceInitParams* aParams )
       
    33     {
       
    34     FUNC_LOG;
       
    35 
       
    36     CDisplaySourcePlugIn* self = CDisplaySourcePlugIn::NewLC( aParams );
       
    37     CleanupStack::Pop( self );
       
    38 
       
    39     return self;
       
    40     }
       
    41 
       
    42 CDisplaySourcePlugIn* CDisplaySourcePlugIn::NewLC(
       
    43     TContextSourceInitParams* aParams )
       
    44     {
       
    45     FUNC_LOG;
       
    46 
       
    47     CDisplaySourcePlugIn* self =
       
    48         new( ELeave ) CDisplaySourcePlugIn( aParams );
       
    49     CleanupStack::PushL( self );
       
    50 
       
    51     return self;
       
    52     }
       
    53 
       
    54 // Destructor
       
    55 CDisplaySourcePlugIn::~CDisplaySourcePlugIn()
       
    56     {
       
    57     FUNC_LOG;
       
    58     
       
    59     // Stop services
       
    60     TInt count( iServices.Count() );
       
    61     for( TInt i = 0; i < count; i++ )
       
    62         {
       
    63         iServices[i]->Stop();
       
    64         }
       
    65     
       
    66     // Delete services
       
    67     iServices.ResetAndDestroy();
       
    68     }
       
    69 
       
    70 CDisplaySourcePlugIn::CDisplaySourcePlugIn(
       
    71     TContextSourceInitParams* aParams ):
       
    72     CCFContextSourcePlugIn( aParams )
       
    73     {
       
    74     FUNC_LOG;
       
    75     }
       
    76 
       
    77 // METHODS
       
    78 
       
    79 //----------------------------------------------------------------------------
       
    80 // CDisplaySourcePlugIn::HandleSettingL
       
    81 //----------------------------------------------------------------------------
       
    82 //
       
    83 void CDisplaySourcePlugIn::HandleSettingL(
       
    84     CCFContextSourceSettingArray* /*aSettingList*/ )
       
    85 	{
       
    86     FUNC_LOG;
       
    87     
       
    88 	// Not called since we don't have settings
       
    89 	}
       
    90 
       
    91 //----------------------------------------------------------------------------
       
    92 // CDisplaySourcePlugIn::DefineContextsL
       
    93 //----------------------------------------------------------------------------
       
    94 //
       
    95 void CDisplaySourcePlugIn::DefineContextsL()
       
    96     {
       
    97     FUNC_LOG;
       
    98 
       
    99     // Nothing to do here.
       
   100     }
       
   101 
       
   102 //----------------------------------------------------------------------------
       
   103 // CDisplaySourcePlugIn::InitializeL
       
   104 //----------------------------------------------------------------------------
       
   105 //
       
   106 void CDisplaySourcePlugIn::InitializeL()
       
   107     {
       
   108     FUNC_LOG;
       
   109     
       
   110     CDisplayServiceBase* service = NULL;
       
   111     
       
   112     // Create light service
       
   113     service = CDisplayServiceLight::NewLC( iCF );
       
   114     service->StartL();
       
   115     iServices.AppendL( service );
       
   116     CleanupStack::Pop( service );
       
   117     
       
   118     // Create UI layout service
       
   119     service = CDisplayServiceUILayout::NewLC( iCF );
       
   120     service->StartL();
       
   121     iServices.AppendL( service );
       
   122     CleanupStack::Pop( service );
       
   123     }
       
   124 
       
   125 // End of file