multimediacommsengine/mmcesrv/mmcemediamanager/src/mcemediastate.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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 
       
    20 
       
    21 #include <mmccevents.h>
       
    22 
       
    23 #include "mcemediastate.h"
       
    24 #include "mcemediaobserver.h"
       
    25 #include "mcecomsession.h"
       
    26 #include "mcesdpsession.h"
       
    27 #include "mceevents.h"
       
    28 #include "mcesrvstream.h"
       
    29 #include "mcemmlogs.h"
       
    30 
       
    31 
       
    32 #define DEFAULT_IMPLEMENTATION() User::Leave( KErrTotalLossOfPrecision )
       
    33 #define DEFAULT_RETURN_IMPLEMENTATION( returnVal ) DEFAULT_IMPLEMENTATION();return returnVal
       
    34 
       
    35 
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // TMceMediaState::TMceMediaState
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 TMceMediaState::TMceMediaState ( CMceComSession& aSession )
       
    42     : iSession( aSession ),
       
    43       iRole( EMceRoleOfferer ),
       
    44       iStackIndex( 0 )
       
    45     {
       
    46     }
       
    47     
       
    48 // -----------------------------------------------------------------------------
       
    49 // TMceMediaState::~TMceMediaState
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 TMceMediaState::~TMceMediaState ()
       
    53 	{
       
    54 	}
       
    55 
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // TMceMediaState::CloneL
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 TMceMediaState* TMceMediaState::CloneL( CMceComSession& /*aSession*/ ) const
       
    62     {
       
    63     DEFAULT_RETURN_IMPLEMENTATION( NULL );
       
    64     }
       
    65 
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // TMceMediaState::EntryL
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 void TMceMediaState::EntryL()
       
    72     {
       
    73     //NOP
       
    74     }
       
    75 
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // TMceMediaState::Pushed
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void TMceMediaState::Pushed()
       
    82     {
       
    83     iStackIndex--;
       
    84     }
       
    85     
       
    86 // -----------------------------------------------------------------------------
       
    87 // TMceMediaState::StackIndex
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 TInt TMceMediaState::StackIndex()
       
    91     {
       
    92     return iStackIndex;
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // TMceMediaState::CallbackAllowed
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 TBool TMceMediaState::CallbackAllowed()
       
   100     {
       
   101      return iSession.NegotiationState().Id() != KMceMediaIdle &&
       
   102             iSession.NegotiationState().Id() != KMceAnsweringMedia &&
       
   103             iSession.NegotiationState().Id() != KMceAnsweringMediaUpdate &&
       
   104             iSession.NegotiationState().Id() != KMceOfferingMedia &&
       
   105             iSession.NegotiationState().Id() != KMceMediaNegotiated;
       
   106     
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // TMceMediaState::Callback
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 void TMceMediaState::Callback()
       
   114     {
       
   115     //NOP
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // TMceMediaState::SetRole
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 void TMceMediaState::SetRole( TMceNegotiationRole aRole )
       
   123     {
       
   124     iRole = aRole;
       
   125     }
       
   126     
       
   127 // -----------------------------------------------------------------------------
       
   128 // TMceMediaState::SetRole
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 TMceNegotiationRole TMceMediaState::Role() const
       
   132     {
       
   133     return iRole;
       
   134     }
       
   135     
       
   136 
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 // TMceMediaState::MccError
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 void TMceMediaState::MccError( TInt aError, TMceMccComEvent& aEvent )
       
   143     {
       
   144     //force to be error, if not yet
       
   145     aEvent.iEvent = KMccStreamError;
       
   146     aEvent.iError = aError;
       
   147     
       
   148 
       
   149     CMceSrvStream::EventReceived( iSession.MccStreams(),
       
   150                                   aEvent );
       
   151 
       
   152     }
       
   153 
       
   154 
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // TMceMediaState::MccLinkCreatedL
       
   158 // -----------------------------------------------------------------------------
       
   159 //
       
   160 void TMceMediaState::MccLinkCreatedL( TMceMccComEvent& /*aEvent*/ )
       
   161     {
       
   162     DEFAULT_IMPLEMENTATION();
       
   163     }
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // TMceMediaState::MccMediaPreparedL
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 void TMceMediaState::MccMediaPreparedL( TMceMccComEvent& /*aEvent*/ )
       
   170     {
       
   171     DEFAULT_IMPLEMENTATION();
       
   172     }
       
   173 
       
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // TMceMediaState::MccMediaStartedL
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 void TMceMediaState::MccMediaStartedL( TMceMccComEvent& aEvent )
       
   180     {
       
   181     CMceSrvStream::EventReceived( iSession.MccStreams(), aEvent );
       
   182     }
       
   183 
       
   184 // -----------------------------------------------------------------------------
       
   185 // TMceMediaState::MccMediaPausedL
       
   186 // -----------------------------------------------------------------------------
       
   187 //
       
   188 void TMceMediaState::MccMediaPausedL( TMceMccComEvent& aEvent )
       
   189     {
       
   190     CMceSrvStream::EventReceived( iSession.MccStreams(), aEvent );
       
   191     }
       
   192     
       
   193 // -----------------------------------------------------------------------------
       
   194 // TMceMediaState::MccMediaResumedL
       
   195 // -----------------------------------------------------------------------------
       
   196 //
       
   197 void TMceMediaState::MccMediaResumedL( TMceMccComEvent& aEvent )
       
   198     {
       
   199     CMceSrvStream::EventReceived( iSession.MccStreams(), aEvent );
       
   200     }
       
   201     
       
   202 // -----------------------------------------------------------------------------
       
   203 // TMceMediaState::UpdateL
       
   204 // -----------------------------------------------------------------------------
       
   205 //
       
   206 void TMceMediaState::UpdateL()
       
   207     {
       
   208     DEFAULT_IMPLEMENTATION();
       
   209     }
       
   210 
       
   211 
       
   212 // -----------------------------------------------------------------------------
       
   213 // TMceMediaState::DecodeL
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 TMceSipWarningCode TMceMediaState::DecodeL( CSdpDocument& /*aSdpDocument*/ )
       
   217     {
       
   218     DEFAULT_RETURN_IMPLEMENTATION( KMceSipWarnMediaTypeNotAvailable );
       
   219     }
       
   220 
       
   221 // -----------------------------------------------------------------------------
       
   222 // TMceMediaState::EncodeL
       
   223 // -----------------------------------------------------------------------------
       
   224 //
       
   225 CSdpDocument* TMceMediaState::EncodeL()
       
   226     {
       
   227     DEFAULT_RETURN_IMPLEMENTATION( NULL );
       
   228     }
       
   229 
       
   230 // -----------------------------------------------------------------------------
       
   231 // TMceMediaState::NeedToNegotiate
       
   232 // -----------------------------------------------------------------------------
       
   233 //
       
   234 TBool TMceMediaState::NeedToNegotiate( CSdpDocument* /*aSdpDocument*/ )
       
   235     {
       
   236     MCEMM_DEBUG("TMceMediaState::NeedToNegotiate() ");
       
   237     
       
   238     return EFalse;
       
   239     }
       
   240 
       
   241 // -----------------------------------------------------------------------------
       
   242 // TMceMediaState::ConfirmationNeeded
       
   243 // -----------------------------------------------------------------------------
       
   244 //
       
   245 TBool TMceMediaState::ConfirmationNeeded()
       
   246     {
       
   247     return iSession.SdpSession().NeedToNegotiate( iSession );
       
   248     }
       
   249 
       
   250 // -----------------------------------------------------------------------------
       
   251 // TMceMediaState::ReservationNeeded
       
   252 // -----------------------------------------------------------------------------
       
   253 //
       
   254 TBool TMceMediaState::ReservationNeeded()
       
   255     {
       
   256     return iSession.SdpSession().ReservationNeeded( iSession );
       
   257     }
       
   258 
       
   259 // -----------------------------------------------------------------------------
       
   260 // TMceMediaState::ReserveL
       
   261 // -----------------------------------------------------------------------------
       
   262 //
       
   263 TMceReturnStatus TMceMediaState::ReserveL()
       
   264     {
       
   265     return iSession.SdpSession().ReserveL( iSession );
       
   266     }
       
   267 
       
   268 
       
   269 
       
   270 // End of File
       
   271 
       
   272