vtuis/videotelui/src/TVtUiCallParameters.cpp
branchRCL_3
changeset 24 f15ac8e65a02
parent 23 890b5dd735f8
child 25 779871d1e4f4
equal deleted inserted replaced
23:890b5dd735f8 24:f15ac8e65a02
     1 /*
       
     2 * Copyright (c) 2004 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:  Implementation of the TVtUiCallParameters class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "TVtUiCallParameters.h"
       
    22 
       
    23 // CONSTANTS
       
    24 
       
    25 // Enumerates call parameter flags.
       
    26 enum TVtUiCallParameterFlags
       
    27     {
       
    28     // Audio status has been updated.
       
    29     EVtUiCallParameterFlagHasAudio = 1,
       
    30     // Audio status equals to ETrue.
       
    31     EVtUiCallParameterFlagAudioEnabled = 2,
       
    32     // Video status has been updated.
       
    33     EVtUiCallParameterFlagHasVideo = 4,
       
    34     // Video status equals to ETrue.
       
    35     EVtUiCallParameterFlagVideoEnabled = 8,
       
    36     // Selected camera has been updated.
       
    37     EVtUiCallParameterFlagHasSelectedCamera = 16,
       
    38     // Primary camera has been selected. Otherwise secondary has been selected.
       
    39     EVtUiCallParameterFlagHasSelectedPrimary = 32,
       
    40     };
       
    41 
       
    42 // ============================ MEMBER FUNCTIONS ===============================
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // TVtUiCallParameters::TVtUiCallParameters
       
    46 // C++ constructor can NOT contain any code, that
       
    47 // might leave.
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 TVtUiCallParameters::TVtUiCallParameters()
       
    51     : iFlags( 0 )
       
    52     {
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // TVtUiCallParameters::Reset
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 void TVtUiCallParameters::Reset()
       
    60     {
       
    61     iFlags = 0;
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // TVtUiCallParameters::SetAudioStatus
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void TVtUiCallParameters::SetAudioStatus( const TBool aEnabled )
       
    69     {
       
    70     iFlags |= ( EVtUiCallParameterFlagAudioEnabled + 
       
    71                 EVtUiCallParameterFlagHasAudio );
       
    72     if ( !aEnabled )
       
    73         {
       
    74         iFlags &= ~EVtUiCallParameterFlagAudioEnabled;
       
    75         }
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // TVtUiCallParameters::GetAudioStatus
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 TInt TVtUiCallParameters::GetAudioStatus( TBool& aEnabled ) const
       
    83     {
       
    84     TInt err = KErrNotFound;
       
    85     if ( iFlags & EVtUiCallParameterFlagHasAudio )
       
    86         {
       
    87         err = KErrNone;
       
    88         aEnabled = ( iFlags & EVtUiCallParameterFlagAudioEnabled );
       
    89         }
       
    90 
       
    91     return err;
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // TVtUiCallParameters::SetVideoStatus
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void TVtUiCallParameters::SetVideoStatus( const TBool aEnabled )
       
    99     {
       
   100     iFlags |= ( EVtUiCallParameterFlagVideoEnabled + 
       
   101                 EVtUiCallParameterFlagHasVideo );
       
   102     if ( !aEnabled )
       
   103         {
       
   104         iFlags &= ~EVtUiCallParameterFlagVideoEnabled;
       
   105         }
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // TVtUiCallParameters::GetVideoStatus
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 TInt TVtUiCallParameters::GetVideoStatus( TBool& aEnabled )
       
   113     {
       
   114     TInt err = KErrNotFound;
       
   115     if ( iFlags & EVtUiCallParameterFlagHasVideo )
       
   116         {
       
   117         err = KErrNone;
       
   118         aEnabled = ( iFlags & EVtUiCallParameterFlagVideoEnabled );
       
   119         }
       
   120 
       
   121     return err;
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // TVtUiCallParameters::SetSelectedCamera
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 void TVtUiCallParameters::SetSelectedCamera( const TBool aPrimary )
       
   129     {
       
   130     iFlags |= EVtUiCallParameterFlagHasSelectedCamera;
       
   131     
       
   132     if ( aPrimary )
       
   133         {
       
   134         iFlags |= EVtUiCallParameterFlagHasSelectedPrimary;
       
   135         }
       
   136     else
       
   137         {
       
   138         iFlags &= ~EVtUiCallParameterFlagHasSelectedPrimary;
       
   139         }
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // TVtUiCallParameters::GetSelectedCamera
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 TInt TVtUiCallParameters::GetSelectedCamera( TBool& aPrimary )
       
   147     {
       
   148     TInt err = KErrNotFound;
       
   149     if ( iFlags & EVtUiCallParameterFlagHasSelectedCamera )
       
   150         {
       
   151         err = KErrNone;
       
   152         aPrimary = ( iFlags & EVtUiCallParameterFlagHasSelectedPrimary );
       
   153         }
       
   154 
       
   155     return err;
       
   156     }
       
   157 
       
   158 //  End of File