contextframework/cfw/src/cfserver/cfphasecfwready.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2007-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:  CCFPhaseCfwReady class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "cfphasecfwready.h"
       
    20 #include "CFContextObjectImpl.h"
       
    21 #include "cfcontextinterface.h"
       
    22 #include "cfwcontextdef.h"
       
    23 #include "cftrace.h"
       
    24 
       
    25 CCFPhaseCfwReady* CCFPhaseCfwReady::NewL( MCFContextInterface& aCF )
       
    26     {
       
    27     FUNC_LOG;
       
    28     
       
    29     CCFPhaseCfwReady* self = CCFPhaseCfwReady::NewLC( aCF );
       
    30     CleanupStack::Pop( self );
       
    31     
       
    32     return self;
       
    33     }
       
    34 
       
    35 CCFPhaseCfwReady* CCFPhaseCfwReady::NewLC( MCFContextInterface& aCF )
       
    36     {
       
    37     FUNC_LOG;
       
    38     
       
    39     CCFPhaseCfwReady* self = new( ELeave ) CCFPhaseCfwReady( aCF );
       
    40     CleanupStack::PushL( self );
       
    41     self->ConstructL();
       
    42     
       
    43     return self;
       
    44     }
       
    45 
       
    46 CCFPhaseCfwReady::~CCFPhaseCfwReady()
       
    47     {
       
    48     FUNC_LOG;
       
    49     }
       
    50 
       
    51 void CCFPhaseCfwReady::ConstructL()
       
    52     {
       
    53     FUNC_LOG;
       
    54 
       
    55     // Nothing to do    
       
    56     }
       
    57 
       
    58 CCFPhaseCfwReady::CCFPhaseCfwReady( MCFContextInterface& aCF ):
       
    59     CCFPhaseBase( CCFPhaseBase::ECFCfwReady, aCF )
       
    60     {
       
    61     FUNC_LOG;
       
    62     }
       
    63 
       
    64 // METHODS
       
    65 
       
    66 //-----------------------------------------------------------------------------
       
    67 // CCFPhaseCfwReady::ExecuteL
       
    68 //-----------------------------------------------------------------------------
       
    69 //
       
    70 void CCFPhaseCfwReady::ExecuteL( TRequestStatus* aStatus )
       
    71     {
       
    72     FUNC_LOG;
       
    73     
       
    74     // Publish context that Context Framework is ready
       
    75     CCFContextObject* context = CCFContextObject::NewLC( KCfwSource,
       
    76         KCfwSourceStatus,
       
    77         TPtrC( KCfwSourceStatusValues[EStatusReady] ) );
       
    78     RThread thread;
       
    79     TInt err = iCF.PublishContext( *context, thread );
       
    80     ERROR_3( err, "Failed to publish context: [%S: %S: %S]",
       
    81          &context->Source(),
       
    82          &context->Type(),
       
    83          &context->Value() );
       
    84     
       
    85     // Clean up
       
    86     thread.Close();
       
    87     CleanupStack::PopAndDestroy( context );
       
    88 
       
    89     // Complete phase immediately
       
    90     iStarterRequest = aStatus;
       
    91     Complete( KErrNone );
       
    92     }
       
    93 
       
    94 //-----------------------------------------------------------------------------
       
    95 // CCFPhaseCfwReady::NextPhase
       
    96 //-----------------------------------------------------------------------------
       
    97 //
       
    98 CCFPhaseBase::TCFPhaseId CCFPhaseCfwReady::NextPhase() const
       
    99     {
       
   100     FUNC_LOG;
       
   101     
       
   102     // This ends CF starting sequence
       
   103     return CCFPhaseBase::ECFStartEnd;
       
   104     }