tsrc/musenginestub/src/musengsessionmanager.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 2009 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 #include "musengsessionmanager.h"
       
    19 #include <e32property.h>
       
    20 #include "musenglivesession.h"
       
    21 #include "musengreceivesession.h"
       
    22 #include "lcsession.h"
       
    23 #include "mussessionproperties.h"
       
    24 #include "lcsessionobserver.h"
       
    25 #include "lcuiprovider.h"
       
    26 
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CMusEngSessionManager* CMusEngSessionManager::NewL( TAny* aInitParams )
       
    33     {
       
    34     __ASSERT_ALWAYS( aInitParams != NULL, User::Leave( KErrArgument ) );
       
    35     
       
    36     CMusEngSessionManager* self = 
       
    37         new( ELeave )CMusEngSessionManager( 
       
    38                 *reinterpret_cast< TLcEngineParams* >( aInitParams ) );
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     CleanupStack::Pop( self );
       
    42     return self;
       
    43     }
       
    44         
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 // -----------------------------------------------------------------------------
       
    48 //  
       
    49 CMusEngSessionManager::~CMusEngSessionManager()
       
    50     {
       
    51     delete iSession;
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CMusEngSessionManager::CMusEngSessionManager( 
       
    59     TLcEngineParams& aInitParams )
       
    60     {
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void CMusEngSessionManager::ConstructL()
       
    68     {
       
    69     TInt useCase;
       
    70     User::LeaveIfError( RProperty::Get( NMusSessionApi::KCategoryUid, 
       
    71                                         NMusSessionApi::KUseCase, 
       
    72                                         useCase ) );    
       
    73     iSession = CreateMusSessionL( 
       
    74         static_cast< MultimediaSharing::TMusUseCase >( useCase ) );
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 MLcSession& CMusEngSessionManager::Session()
       
    82     {
       
    83     return *iSession;
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 CMusEngMceSession* CMusEngSessionManager::CreateMusSessionL( 
       
    91     MultimediaSharing::TMusUseCase aUseCase )
       
    92     {
       
    93     CMusEngMceSession* session = NULL;
       
    94     switch ( aUseCase ) 
       
    95         {
       
    96         case MultimediaSharing::EMusLiveVideo:
       
    97             {
       
    98             session = CMusEngLiveSession::NewL( TRect() );
       
    99             break;
       
   100             }
       
   101         case MultimediaSharing::EMusReceive:
       
   102             {
       
   103             session = CMusEngReceiveSession::NewL( TRect() );
       
   104             break;
       
   105             }
       
   106         default:
       
   107             User::Leave( KErrNotSupported );
       
   108             break;
       
   109         }
       
   110     return session;
       
   111     }
       
   112 
       
   113 // End of File