mmsharing/livecommsui/lcui/tsrc/mustester/Stubs/mceclientstub/src/mcespeakersink.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 #include "mcespeakersink.h"
       
    20 #include "mcesession.h"
       
    21 #include "mcemediastream.h"
       
    22 
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 const TInt KMceMaxVolume = 10;
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CMceSpeakerSink::NewL
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 EXPORT_C CMceSpeakerSink* CMceSpeakerSink::NewL()
       
    33     {
       
    34     CMceSpeakerSink* self = NewLC();
       
    35     CleanupStack::Pop( self );
       
    36     return self;
       
    37     
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CMceSpeakerSink::NewLC
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 EXPORT_C CMceSpeakerSink* CMceSpeakerSink::NewLC()
       
    45     {
       
    46     CMceSpeakerSink* self = new (ELeave) CMceSpeakerSink();
       
    47     CleanupStack::PushL( self );
       
    48     self->ConstructL();
       
    49     return self;
       
    50     
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CMceSpeakerSink::~CMceSpeakerSink
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C CMceSpeakerSink::~CMceSpeakerSink()
       
    58     {
       
    59     }
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // CMceSpeakerSink::EnableL
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 EXPORT_C void CMceSpeakerSink::EnableL() 
       
    66     {
       
    67     CMceMediaSink::DoEnableL();
       
    68     }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CMceSpeakerSink::Disable
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 EXPORT_C void CMceSpeakerSink::DisableL() 
       
    75     {
       
    76     CMceMediaSink::DoDisableL();
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CMceSpeakerSink::SetVolumeL
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 EXPORT_C void CMceSpeakerSink::SetVolumeL(TInt aVolume)
       
    84 	{
       
    85 	__ASSERT_ALWAYS( iStream &&
       
    86                      iStream->Session() &&
       
    87                      iStream->Session()->State() != CMceSession::EIdle &&
       
    88                      iStream->Session()->State() != CMceSession::EIncoming,
       
    89                      User::Leave( KErrNotReady ) );
       
    90                      	
       
    91 	__ASSERT_ALWAYS( aVolume <= MaxVolumeL() &&
       
    92 	                 aVolume > 0, 
       
    93 	                 User::Leave( KErrArgument ) );
       
    94     iVolume = aVolume; 
       
    95 	}
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CMceSpeakerSink::VolumeL
       
    99 // -----------------------------------------------------------------------------
       
   100 //		        
       
   101 EXPORT_C TInt CMceSpeakerSink::VolumeL() const
       
   102 	{
       
   103 	__ASSERT_ALWAYS( iStream &&
       
   104                      iStream->Session() &&
       
   105                      iStream->Session()->State() != CMceSession::EIdle &&
       
   106                      iStream->Session()->State() != CMceSession::EIncoming,
       
   107                      User::Leave( KErrNotReady ) );
       
   108 	
       
   109 	return iVolume;
       
   110 	}
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CMceSpeakerSink::MaxVolumeL
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 EXPORT_C TInt CMceSpeakerSink::MaxVolumeL() const
       
   117 	{
       
   118 	__ASSERT_ALWAYS( iStream &&
       
   119                      iStream->Session() &&
       
   120                      iStream->Session()->State() != CMceSession::EIdle &&
       
   121                      iStream->Session()->State() != CMceSession::EIncoming,
       
   122                      User::Leave( KErrNotReady ) );
       
   123                      	
       
   124 	return iMaxVolume;
       
   125 	}
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // 
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 EXPORT_C void CMceSpeakerSink::SetRoutingL( TInt aRoute )
       
   132     {
       
   133     __ASSERT_ALWAYS( iStream &&
       
   134                      iStream->Session() &&
       
   135                      iStream->Session()->State() != CMceSession::EIdle &&
       
   136                      iStream->Session()->State() != CMceSession::EIncoming,
       
   137                      User::Leave( KErrNotReady ) );
       
   138                      
       
   139     iAudioRouting = aRoute;
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // 
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 EXPORT_C TInt CMceSpeakerSink::RoutingL() const
       
   147     {
       
   148     __ASSERT_ALWAYS( iStream &&
       
   149                      iStream->Session() &&
       
   150                      iStream->Session()->State() != CMceSession::EIdle &&
       
   151                      iStream->Session()->State() != CMceSession::EIncoming,
       
   152                      User::Leave( KErrNotReady ) );
       
   153 
       
   154     return iAudioRouting;
       
   155     }
       
   156 
       
   157 // -----------------------------------------------------------------------------
       
   158 // CMceSpeakerSink::CMceSpeakerSink
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 CMceSpeakerSink::CMceSpeakerSink()
       
   162     {
       
   163     iType = KMceSpeakerSink;
       
   164     iMaxVolume = KMceMaxVolume;
       
   165     }
       
   166 
       
   167 // -----------------------------------------------------------------------------
       
   168 // CMceSpeakerSink::ConstructL
       
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171 void CMceSpeakerSink::ConstructL()
       
   172     {
       
   173     }
       
   174     
       
   175