voipplugins/sipconnectionprovider/src/scpstatecontainer.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:29:57 +0100
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  
*
*/


#include "scpstatecontainer.h"
#include "scplogger.h"
#include "scpdisabled.h"
#include "scpconnectingservice.h"
#include "scpenabled.h"
#include "scpdisconnecting.h"

// -----------------------------------------------------------------------------
// TScpStateContainer::TScpStateContainer
// -----------------------------------------------------------------------------
//
TScpStateContainer::TScpStateContainer()
    {
    SCPLOGSTRING( "TScpStateContainer::TScpStateContainer" );
    }

// -----------------------------------------------------------------------------
// TScpStateContainer::InitializeL
// -----------------------------------------------------------------------------
//
void TScpStateContainer::InitializeL()
    {
    SCPLOGSTRING( "TScpStateContainer::ConstructL" );

    User::LeaveIfError( Dll::SetTls( static_cast<TAny*>( this ) ) );
    }

// -----------------------------------------------------------------------------
// TScpStateContainer::Instance
// -----------------------------------------------------------------------------
//
TScpSubServiceState* TScpStateContainer::Instance( TCCHSubserviceState aState )
    {
    SCPLOGSTRING2( "TScpStateContainer::Instance state: %d", aState );

    TScpStateContainer* container = static_cast<TScpStateContainer*>( Dll::Tls() );
    __ASSERT_DEBUG( container, User::Panic( KNullDesC, KErrGeneral ) );
    
    switch( aState )
        {
        case ECCHDisabled:
            return &container->iDisabled;

        case ECCHConnecting:
            return &container->iConnectingService;

        case ECCHEnabled:
            return &container->iEnabled;

        case ECCHDisconnecting:
            return &container->iDisconnecting;

        default:
            break;           
        }
    
    __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
    return NULL;
    }

//  End of File