voipplugins/sipconnectionprovider/src/scpstatecontainer.cpp
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "scpstatecontainer.h"
       
    20 #include "scplogger.h"
       
    21 #include "scpdisabled.h"
       
    22 #include "scpconnectingservice.h"
       
    23 #include "scpenabled.h"
       
    24 #include "scpdisconnecting.h"
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // TScpStateContainer::TScpStateContainer
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 TScpStateContainer::TScpStateContainer()
       
    31     {
       
    32     SCPLOGSTRING( "TScpStateContainer::TScpStateContainer" );
       
    33     }
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // TScpStateContainer::InitializeL
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 void TScpStateContainer::InitializeL()
       
    40     {
       
    41     SCPLOGSTRING( "TScpStateContainer::ConstructL" );
       
    42 
       
    43     User::LeaveIfError( Dll::SetTls( static_cast<TAny*>( this ) ) );
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // TScpStateContainer::Instance
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 TScpSubServiceState* TScpStateContainer::Instance( TCCHSubserviceState aState )
       
    51     {
       
    52     SCPLOGSTRING2( "TScpStateContainer::Instance state: %d", aState );
       
    53 
       
    54     TScpStateContainer* container = static_cast<TScpStateContainer*>( Dll::Tls() );
       
    55     __ASSERT_DEBUG( container, User::Panic( KNullDesC, KErrGeneral ) );
       
    56     
       
    57     switch( aState )
       
    58         {
       
    59         case ECCHDisabled:
       
    60             return &container->iDisabled;
       
    61 
       
    62         case ECCHConnecting:
       
    63             return &container->iConnectingService;
       
    64 
       
    65         case ECCHEnabled:
       
    66             return &container->iEnabled;
       
    67 
       
    68         case ECCHDisconnecting:
       
    69             return &container->iDisconnecting;
       
    70 
       
    71         default:
       
    72             break;           
       
    73         }
       
    74     
       
    75     __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
       
    76     return NULL;
       
    77     }
       
    78 
       
    79 //  End of File