vtuis/videotelui/src/commands/tvtuiaudiostate.cpp
branchRCL_3
changeset 35 779871d1e4f4
parent 0 ed9695c8bcbe
equal deleted inserted replaced
34:f15ac8e65a02 35:779871d1e4f4
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Audio state class.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <cvtlogger.h>
       
    19 #include <cvtengmodel.h>
       
    20 
       
    21 #include "tvtuiaudiostate.h"
       
    22 #include "VtUiUtility.h"
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // TVtUiAudioState::UpdateFlags
       
    26 // -----------------------------------------------------------------------------
       
    27 //
       
    28 void TVtUiAudioState::UpdateFlags()
       
    29     {
       
    30     __VTPRINTENTER( "AudioState.UpdateFlags" )
       
    31     TInt avail( 0 );
       
    32 
       
    33     VtUiUtility::GetAudioRoutingAvailability( iModel.Audio(), avail );
       
    34 
       
    35     const TBool videoCallConnected ( iModel.Media().VideoCallConnected());
       
    36     //Before update AudioRouting, video call state must to be checked.
       
    37     //AudioRouting can not be changed if call is not in EConnected state.
       
    38     if ( videoCallConnected )
       
    39         {
       
    40         __VTPRINT( DEBUG_GEN, " videoCallConnected " )
       
    41         if ( avail & VtUiUtility::EDeactivateBtHandsfree )
       
    42             {
       
    43             SetFlag( ECanDeactivateBtHf );
       
    44             }
       
    45         if ( avail & VtUiUtility::EActivateBtHandsfree )
       
    46             {
       
    47             SetFlag( ECanActivateBtHf );
       
    48             }
       
    49         if ( avail & VtUiUtility::EDeactivateLoudspeaker )
       
    50             {
       
    51             SetFlag( ECanDeactivateLoudspeaker );
       
    52             }
       
    53         if ( avail & VtUiUtility::EActivateLoudspeaker )
       
    54             {
       
    55             SetFlag( ECanActivateLoudspeaker );
       
    56             }
       
    57         }
       
    58 
       
    59     VtUiUtility::GetOutgoingMediaState( iModel.Media(), avail );
       
    60 
       
    61     if ( avail & MVtEngMedia::EMediaAudio )
       
    62         {
       
    63         SetFlag( EIsAudio );
       
    64         }
       
    65 
       
    66     TInt status ( 0 );
       
    67     iModel.Media().GetMediaState( MVtEngMedia::EMediaOutgoing, status );
       
    68     if ( !(status & MVtEngMedia::EMediaAudioChannelOpen ) )
       
    69         {
       
    70         SetFlag( EIsAudioPermanentlyStopped );
       
    71         }
       
    72 
       
    73     __VTPRINTEXITR( "AudioState.UpdateFlags bits = %b", Value() )
       
    74     }