vtengines/videoteleng/Src/State/CVtEngStateRinging.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2004-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:  Ringing state handle interfaces implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "CVtEngStateRinging.h"
       
    21 #include    "CVtEngInitializer.h"
       
    22 #include    "VtEngUtils.h"
       
    23 #include    <cvtlogger.h>
       
    24 
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CVtEngStateRinging::CVtEngStateRinging
       
    30 // C++ constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CVtEngStateRinging::CVtEngStateRinging( 
       
    35     CVtEngStateManager& aStateManager,
       
    36     CVtEngEventManager& aEventManager )
       
    37     : CVtEngStateBase( aStateManager, aEventManager )
       
    38     {
       
    39     }
       
    40 
       
    41 // Destructor
       
    42 CVtEngStateRinging::~CVtEngStateRinging()
       
    43     {
       
    44     __VTPRINT( DEBUG_DESTRUCT, "~StateRing")
       
    45     }
       
    46 
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CVtEngStateRinging::UpdateL
       
    50 // Updates state
       
    51 // (other items were commented in a header).
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 void CVtEngStateRinging::UpdateL()
       
    55     {
       
    56     __VTPRINTENTER( "StateRing.Update" )
       
    57     const MVtCtlCallControl::TVtCtlState bearerstate = 
       
    58         SessionHandler().RealState();
       
    59     CVtEngStateBase* newState = NULL;
       
    60     switch ( bearerstate )
       
    61         {
       
    62         case MVtCtlCallControl::EConnected:
       
    63             newState = NegotiatingOrConnectedStateL();
       
    64             break;
       
    65         case MVtCtlCallControl::EDisconnecting:
       
    66         case MVtCtlCallControl::EIdle:
       
    67             newState = NewStateL( MVtEngSessionInfo::EIdle );
       
    68             // Initializer may be waiting for dataport. In that case MediaHandler 
       
    69             // has already signaled reqStatus of CVtEngInitializer which must
       
    70             // complete KVtEngInitializeEngine command in order uninitialisation to
       
    71             // finish properly. This scenario may happen in 1st call since phone
       
    72             // boot, i.e. when dataport name is not already published.
       
    73             CVtEngUtility::EngineUtils()->Initializer().CancelInit();
       
    74             break;
       
    75         default:
       
    76             break;
       
    77         }
       
    78     if ( newState )
       
    79         {
       
    80         newState->OpenL( this );
       
    81         }
       
    82     __VTPRINTEXIT( "StateRing.Update")
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CVtEngStateRinging::OpenL
       
    87 // State transition to Ring.
       
    88 // (other items were commented in a header).
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 void CVtEngStateRinging::DoOpenL()
       
    92     {
       
    93     __VTPRINTENTER( "StateRing.Open")
       
    94     NotifyStateChange( MVtEngSessionInfo::EReceiving );
       
    95     __VTPRINTEXIT( "StateRing.Open")
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CVtEngStateRinging::ValidateCommand
       
   100 // Returns if a command is valid in ringing state.
       
   101 // 
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 TBool CVtEngStateRinging::ValidateCommand(
       
   105     const TVtEngCommandId aCommandId )
       
   106     {
       
   107     __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "Statering.Validate")
       
   108     TBool okToPerform( EFalse );
       
   109     switch ( aCommandId )
       
   110         {
       
   111         case KVtEngSetSource:
       
   112         case KVtEngPrepareViewFinder:                
       
   113         case KVtEngStartViewFinder:
       
   114         case KVtEngPauseViewFinder:
       
   115         case KVtEngPrepareRemoteRenderDSA:
       
   116         case KVtEngPrepareRemoteRenderDP:
       
   117         case KVtEngPrepareRemoteRender:
       
   118         case KVtEngPrepareRemoteRenderNGA:
       
   119         case KVtEngStartRenderRemote: 
       
   120             okToPerform = ETrue;
       
   121             break;
       
   122         default:
       
   123             okToPerform = CVtEngStateBase::ValidateCommand( aCommandId );
       
   124             break;
       
   125         }
       
   126     return okToPerform;
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CVtEngStateRinging::State
       
   131 // Returns session state.
       
   132 // 
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 MVtEngSessionInfo::TSessionState CVtEngStateRinging::State() const
       
   136     {
       
   137     return MVtEngSessionInfo::EReceiving;
       
   138     }
       
   139 
       
   140 // End of File