mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcsessionstub.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     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 // USER
       
    20 #include "lcenginestub.h"
       
    21 #include "lcsessionstub.h"
       
    22 #include "lcvideoplayer.h"
       
    23 #include "lcsessionobserver.h"
       
    24 #include "lcuiprovider.h"
       
    25 #include "lcvideoplayerstub.h"
       
    26 
       
    27 // SYSTEM
       
    28 #include <QStringList>
       
    29 
       
    30 
       
    31 static QStringList lcutStub_LcSession_calledMethods;
       
    32 static MLcUiProvider* lcutStub_LcSession_uiProvider = 0;
       
    33  
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CLcSession* CLcSession::NewL( )
       
    39     {
       
    40     CLcSession* self = new( ELeave ) CLcSession(  );
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL();
       
    43     CleanupStack::Pop( self );
       
    44     return self;
       
    45     }
       
    46 
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CLcSession::~CLcSession()
       
    53     {
       
    54     //delete iRemoteDisplayName;
       
    55     delete iRemotePlayer;
       
    56     delete iLocalPlayer;
       
    57     delete iLocalDisplayName;
       
    58     delete iRemoteDisplayName;
       
    59     delete iRemoteDetails;
       
    60     }     
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // From MLcSession
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66  
       
    67  MLcSession::TLcSessionState  CLcSession::LcSessionState() const
       
    68     {
       
    69     return iState;
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // From MLcSession
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 void CLcSession::SetLcSessionObserver( MLcSessionObserver* aObserver )
       
    77     {
       
    78     iSessionObserver = aObserver;
       
    79     }
       
    80              
       
    81 // -----------------------------------------------------------------------------
       
    82 // From MLcSession
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CLcSession::SetLcUiProvider( MLcUiProvider* aUiProvider )
       
    86     {
       
    87     iLcUiProvider = aUiProvider;
       
    88     lcutStub_LcSession_uiProvider = aUiProvider;
       
    89     }       
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // From MLcSession
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CLcSession::EstablishLcSessionL( )
       
    96     {
       
    97     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
    98     lcutStub_LcSession_calledMethods.insert(0,lcutStub_LcSession_establishSession );
       
    99     }    
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // From MLcSession
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void CLcSession::TerminateLcSessionL( )
       
   106     {
       
   107     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   108     lcutStub_LcSession_calledMethods.insert(0,lcutStub_LcSession_terminateSession );
       
   109     }       
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // From MLcSession
       
   113 // -----------------------------------------------------------------------------
       
   114 //
       
   115 void CLcSession::UpdateLcSessionL( )
       
   116     {
       
   117     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   118     lcutStub_LcSession_calledMethods.insert(0,lcutStub_LcSession_updateSession );
       
   119     }       
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // From MLcSession
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 
       
   126 TBool CLcSession::SendDialTone( TChar /*aKey*/)
       
   127     {
       
   128     return ETrue;
       
   129     }
       
   130 
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // From MLcSession
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 MLcVideoPlayer* CLcSession::RemoteVideoPlayer( )
       
   137     {
       
   138     return iRemotePlayer;
       
   139     }     
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // From MLcSession
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 MLcVideoPlayer* CLcSession::LocalVideoPlayer( )
       
   146     {
       
   147     return iLocalPlayer;           
       
   148     }       
       
   149 
       
   150 // -----------------------------------------------------------------------------
       
   151 // From MLcSession
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 const TDesC& CLcSession::LocalDisplayName( )
       
   155     {
       
   156     return *iLocalDisplayName;
       
   157     }    
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // From MLcSession
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 const TDesC& CLcSession::RemoteDisplayName( )
       
   164     {
       
   165     return *iRemoteDisplayName;
       
   166     } 
       
   167 // -----------------------------------------------------------------------------
       
   168 // From MLcSession
       
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171  TInt CLcSession::SetParameter( TInt aId, TInt aValue )
       
   172     {
       
   173     mParams.insert( aId, aValue );
       
   174     return 0;
       
   175     } 
       
   176        
       
   177 // -----------------------------------------------------------------------------
       
   178 // From MLcSession
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 TInt CLcSession::ParameterValue( TInt /*aId*/ )
       
   182     {
       
   183     return 0;
       
   184     }        
       
   185 
       
   186 
       
   187 // -----------------------------------------------------------------------------
       
   188 // From MLcSession
       
   189 // -----------------------------------------------------------------------------
       
   190 //
       
   191  TBool CLcSession::IsBackgroundStartup()
       
   192     {
       
   193     return iIsForeground;
       
   194     }
       
   195 
       
   196  // -----------------------------------------------------------------------------
       
   197  // From MLcSession
       
   198  // -----------------------------------------------------------------------------
       
   199  // 
       
   200 TInt CLcSession::SetForegroundStatus( TBool aIsForeground )
       
   201     {
       
   202     iIsForeground = aIsForeground;
       
   203     return iForegroundChange;
       
   204     }
       
   205 
       
   206  // -----------------------------------------------------------------------------
       
   207  // From MLcSession
       
   208  // -----------------------------------------------------------------------------
       
   209  //     
       
   210 const TDesC& CLcSession::RemoteDetails()
       
   211     {
       
   212     return *iRemoteDetails;
       
   213     }
       
   214 
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 // -----------------------------------------------------------------------------
       
   218 //
       
   219 CLcSession::CLcSession( )
       
   220     {
       
   221     }
       
   222 
       
   223 
       
   224 // -----------------------------------------------------------------------------
       
   225 //
       
   226 // -----------------------------------------------------------------------------
       
   227 //
       
   228 void CLcSession::ConstructL()
       
   229     {
       
   230     iLocalDisplayName = KLcStubLocalDisplayName().AllocL();
       
   231     iRemoteDisplayName = KLcStubRemoteDisplayName().AllocL();
       
   232     iLocalPlayer = CLcVideoPlayer::NewL();
       
   233     iRemotePlayer = CLcVideoPlayer::NewL();
       
   234     iRemoteDetails = KLcStubRemoteDetails().AllocL();
       
   235     }
       
   236 
       
   237 
       
   238 //stub control
       
   239 
       
   240 bool lcutStub_LcSession_expectCall( const QString& call, int callNdx )
       
   241 {
       
   242     if ( callNdx >= lcutStub_LcSession_calledMethods.count() ) {
       
   243         return call == lcutStub_LcSession_NoCall;
       
   244     }
       
   245 
       
   246     return lcutStub_LcSession_calledMethods.count() > 0 ?
       
   247            lcutStub_LcSession_calledMethods[callNdx] == call :
       
   248            call == lcutStub_LcSession_NoCall;
       
   249 }
       
   250 
       
   251     
       
   252 void lcutStub_LcSession_reset()
       
   253 {
       
   254     lcutStub_LcSession_calledMethods.clear();
       
   255 }
       
   256 
       
   257 MLcUiProvider* lcutStub_LcSession_lcUiProvider()
       
   258 {
       
   259     return lcutStub_LcSession_uiProvider;
       
   260 }