mmsharing/livecommsui/lcui/tsrc/mustester/Stubs/mceclientstub/src/mcertpsource.cpp
branchRCL_3
changeset 23 bc78a40cd63c
parent 22 73a1feb507fb
child 24 6c57ef9392d2
equal deleted inserted replaced
22:73a1feb507fb 23: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 #include "mcertpsource.h"
       
    20 #include "mcesession.h"
       
    21 #include "mcemanager.h"
       
    22 #include "mcemediastream.h"
       
    23 #include "mcertpobserver.h"
       
    24 
       
    25 #define KMceTIMERDISABLED 0
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CMceRtpSource::NewL
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 EXPORT_C CMceRtpSource* CMceRtpSource::NewL(
       
    36 					   TUint aBufferLength,
       
    37 					   TUint aBufferTreshold,
       
    38 					   TUint32 aInactivityTimer,
       
    39 					   HBufC8* aIdentity )
       
    40     {
       
    41     CMceRtpSource* self = NewLC( aBufferLength, aBufferTreshold,
       
    42     	 aInactivityTimer, aIdentity );
       
    43     CleanupStack::Pop( self );
       
    44     return self;   
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CMceRtpSource::NewLC
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 EXPORT_C CMceRtpSource* CMceRtpSource::NewLC(
       
    52 					   TUint aBufferLength,
       
    53 					   TUint aBufferTreshold,
       
    54 					   TUint32 aInactivityTimer,
       
    55 					   HBufC8* /*aIdentity*/ )
       
    56     {
       
    57     CMceRtpSource* self = new (ELeave) CMceRtpSource();
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL( aBufferLength, aBufferTreshold, 
       
    60                       aInactivityTimer, NULL );
       
    61     return self;
       
    62     }
       
    63 
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CMceRtpSource::~CMceRtpSource
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 EXPORT_C CMceRtpSource::~CMceRtpSource()
       
    70     {
       
    71     delete iMediaBurstIndicator;
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CMceRtpSource::EnableL
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 EXPORT_C void CMceRtpSource::EnableL() 
       
    79     {
       
    80     CMceMediaSource::DoEnableL();
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CMceRtpSource::DisableL
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 EXPORT_C void CMceRtpSource::DisableL() 
       
    88     {
       
    89     CMceMediaSource::DoDisableL();
       
    90     }
       
    91 
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CMceRtpSource::EnableInactivityTimerL
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C void CMceRtpSource::EnableInactivityTimerL( TUint32 aInactivityTimer ) 
       
    98     {
       
    99     // Simulate MCE's check
       
   100     if ( iStreams[0] &&
       
   101          iStreams[0]->Session() &&
       
   102          iStreams[0]->Session()->State() != CMceSession::EIdle &&
       
   103          iStreams[0]->Session()->State() != CMceSession::EIncoming )
       
   104         {
       
   105         iInactivityTimer = aInactivityTimer;
       
   106         }
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CMceRtpSource::DisableInactivityTimer
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 EXPORT_C void CMceRtpSource::DisableInactivityTimerL() 
       
   114     {
       
   115     iInactivityTimer = KMceTIMERDISABLED;
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CMceRtpSource::UpdateL
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 EXPORT_C void CMceRtpSource::UpdateL ( 
       
   123                                 TUint aBufferLength,
       
   124 								TUint aBufferTreshold,
       
   125 								TUint32 aInactivityTimer,
       
   126 								HBufC8* /*aIdentity*/ )
       
   127 	{
       
   128     iInactivityTimer = aInactivityTimer;
       
   129     iBufferLength = aBufferLength;
       
   130     iBufferTreshold = aBufferTreshold;
       
   131 	}
       
   132 
       
   133 // -----------------------------------------------------------------------------
       
   134 // CMceRtpSource::SendRRL
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 EXPORT_C void CMceRtpSource::SendRRL() 
       
   138     {
       
   139     __ASSERT_ALWAYS( iStreams[0] &&
       
   140                      iStreams[0]->Session() &&
       
   141                      iStreams[0]->Session()->State() != CMceSession::EIdle &&
       
   142                      iStreams[0]->Session()->State() != CMceSession::EIncoming,
       
   143                      User::Leave( KErrNotReady ) );
       
   144     }
       
   145 
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 // 
       
   149 // -----------------------------------------------------------------------------
       
   150 //	
       
   151 EXPORT_C TUint32 CMceRtpSource::Ssrc() const
       
   152     {
       
   153     return 0;
       
   154     }
       
   155 
       
   156 
       
   157 // -----------------------------------------------------------------------------
       
   158 // 
       
   159 // -----------------------------------------------------------------------------
       
   160 //	
       
   161 EXPORT_C const RArray<TUint>& CMceRtpSource::Ssrcs() const
       
   162     {
       
   163     return iSsrcs;
       
   164     }
       
   165 
       
   166 
       
   167 // -----------------------------------------------------------------------------
       
   168 // 
       
   169 // -----------------------------------------------------------------------------
       
   170 //	
       
   171 EXPORT_C void CMceRtpSource::EnableSsrcL( TUint /*aSsrc*/ )
       
   172     {
       
   173     }
       
   174 
       
   175 	
       
   176 // -----------------------------------------------------------------------------
       
   177 // 
       
   178 // -----------------------------------------------------------------------------
       
   179 //		
       
   180 EXPORT_C void CMceRtpSource::DisableSsrcL( TUint /*aSsrc*/ )
       
   181     {
       
   182     }
       
   183 
       
   184 
       
   185 // -----------------------------------------------------------------------------
       
   186 // 
       
   187 // -----------------------------------------------------------------------------
       
   188 //	
       
   189 EXPORT_C TBool CMceRtpSource::IsSsrcEnabledL( TUint /*aSsrc*/ )
       
   190     {
       
   191     return ETrue;
       
   192     }
       
   193 		
       
   194 	
       
   195 // -----------------------------------------------------------------------------
       
   196 // CMceRtpSource::CMceRtpSource
       
   197 // -----------------------------------------------------------------------------
       
   198 //
       
   199 CMceRtpSource::CMceRtpSource()
       
   200    : CMceMediaSource()
       
   201     {
       
   202     iType = KMceRTPSource;
       
   203     }
       
   204 
       
   205 
       
   206 // -----------------------------------------------------------------------------
       
   207 // CMceRtpSource::ConstructL
       
   208 // -----------------------------------------------------------------------------
       
   209 //
       
   210 void CMceRtpSource::ConstructL( 
       
   211                          TUint aBufferLength,
       
   212                          TUint aBufferTreshold,
       
   213                          TUint32 aInactivityTimer,
       
   214                          HBufC8* aMediaBurstIndicator )
       
   215     {
       
   216   
       
   217     iInactivityTimer = aInactivityTimer;
       
   218     iBufferLength = aBufferLength;
       
   219     iBufferTreshold = aBufferTreshold;
       
   220     iMediaBurstIndicator = aMediaBurstIndicator;
       
   221     
       
   222     }
       
   223