accessoryservices/accessoryserver/src/accpolaudiodevicetopology/accpolmutecontrol.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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:  Implementation for mute control object.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <accpolmutecontrol.h>
       
    19 #include "acc_debug.h"
       
    20 
       
    21 // -----------------------------------------------------------------------------
       
    22 // CAccPolMuteControl::CAccPolMuteControl()
       
    23 // C++ default constructor can NOT contain any code, that
       
    24 // might leave.
       
    25 // -----------------------------------------------------------------------------
       
    26 //
       
    27 CAccPolMuteControl::CAccPolMuteControl( CAccPolObjectCon* aObject ) :
       
    28     CAccPolAudioControlBase( EAccPolAudioMuteControlObject, aObject )
       
    29     {
       
    30     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::CAccPolMuteControl() - Enter" );
       
    31     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::CAccPolMuteControl() - Return" );
       
    32     }
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CAccPolMuteControl::CAccPolMuteControl()
       
    36 // C++ default constructor can NOT contain any code, that
       
    37 // might leave.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CAccPolMuteControl::CAccPolMuteControl( TUint32 aChannel, const TBool aMute ) :
       
    41     CAccPolAudioControlBase( EAccPolAudioMuteControlObject, aChannel )
       
    42     {
       
    43     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::CAccPolMuteControl() - Enter" );
       
    44     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::CAccPolMuteControl() - Return void" );
       
    45     iMute = aMute;
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CAccPolMuteControl::NewL()
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 EXPORT_C CAccPolMuteControl* CAccPolMuteControl::NewL(
       
    53     CAccPolObjectCon* aObject )
       
    54     {
       
    55     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::NewL() - Enter" );
       
    56     CAccPolMuteControl* self = CAccPolMuteControl::NewLC( aObject );
       
    57     CleanupStack::Pop( self );
       
    58     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::NewL() - Return" );
       
    59     return self;
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CAccPolMixerUnit::NewLC()
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 EXPORT_C CAccPolMuteControl* CAccPolMuteControl::NewLC(
       
    67     CAccPolObjectCon* aObject )
       
    68     {
       
    69     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::NewLC() - Enter" );
       
    70     CAccPolMuteControl* self = new ( ELeave ) CAccPolMuteControl( aObject );
       
    71     CleanupStack::PushL( self );
       
    72     self->ConstructL();
       
    73     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::NewLC() - Return" );
       
    74     return self;
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CAccPolMuteControl::NewL()
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 EXPORT_C CAccPolMuteControl* CAccPolMuteControl::NewL( TUint32 aChannel,
       
    82     const TBool aMute )
       
    83     {
       
    84     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::NewL() - Enter" );
       
    85     CAccPolMuteControl* self = CAccPolMuteControl::NewLC( aChannel, aMute );
       
    86 
       
    87     CleanupStack::Pop( self );
       
    88     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::NewL()- Return" );
       
    89     return self;
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CAccPolMuteControl::NewLC()
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 EXPORT_C CAccPolMuteControl* CAccPolMuteControl::NewLC( TUint32 aChannel,
       
    97     const TBool aMute )
       
    98 
       
    99     {
       
   100     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::NewLC() - Enter" );
       
   101     CAccPolMuteControl* self = new ( ELeave ) CAccPolMuteControl( aChannel,
       
   102         aMute );
       
   103 
       
   104     CleanupStack::PushL( self );
       
   105     self->ConstructL();
       
   106     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::NewLC() - Return" );
       
   107     return self;
       
   108     }
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // CAccPolMuteControl::ConstructL()
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 void CAccPolMuteControl::ConstructL()
       
   115     {
       
   116     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::ConstructL() - Enter" );
       
   117     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY CAccPolMuteControl::ConstructL()- Return void" );
       
   118     }
       
   119 
       
   120 // Destructor
       
   121 EXPORT_C CAccPolMuteControl::~CAccPolMuteControl()
       
   122     {
       
   123     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::~CAccPolMuteControl() - Enter" );
       
   124     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::~CAccPolMuteControl()- Return" );
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // CAccPolMuteControl::operator()
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 EXPORT_C CAccPolMuteControl& CAccPolMuteControl::operator=(
       
   132     const CAccPolMuteControl& aMuteControlObject )
       
   133     {
       
   134     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::operator() - Enter" );
       
   135 
       
   136     CAccPolAudioControlBase::operator=(
       
   137         ( CAccPolAudioControlBase& )aMuteControlObject );
       
   138     iMute = aMuteControlObject.Mute();
       
   139     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::operator()- Return" );
       
   140     return ( *this );
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // CAccPolMuteControl::SetMute()
       
   145 // ---------------------------------------------------------------------------
       
   146 //
       
   147 EXPORT_C void CAccPolMuteControl::SetMute( const TBool aMute )
       
   148     {
       
   149     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::SetMute() - mute=%d", aMute );
       
   150     iMute = aMute;
       
   151     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::SetMute() - Return" );
       
   152     }
       
   153 // ---------------------------------------------------------------------------
       
   154 // CAccPolMuteControl::Mute()
       
   155 // ---------------------------------------------------------------------------
       
   156 //
       
   157 EXPORT_C TBool CAccPolMuteControl::Mute() const
       
   158     {
       
   159     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::Mute() - Enter" );
       
   160     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::Mute() - mute=%d", iMute );
       
   161     return iMute;
       
   162     }
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // CAccPolMuteControl::ExternalizeL()
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 void CAccPolMuteControl::ExternalizeL( RWriteStream& aStream ) const
       
   169     {
       
   170     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::ExternalizeL() - Enter" );
       
   171     aStream.WriteUint8L( ObjectType() );
       
   172     ExternalizeAudioControlbaseL( aStream );
       
   173     aStream.WriteInt8L( iMute );
       
   174     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::ExternalizeL - Return" );
       
   175     }
       
   176 
       
   177 // ---------------------------------------------------------------------------
       
   178 // CAccPolMuteControl::InternalizeL()
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 void CAccPolMuteControl::InternalizeL( RReadStream& aStream )
       
   182     {
       
   183     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::InternalizeL() - Enter" );
       
   184     InternalizeAudioControlbaseL( aStream );
       
   185     iMute = aStream.ReadInt8L();
       
   186     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::InternalizeL - Return" );
       
   187     }
       
   188 
       
   189 // ---------------------------------------------------------------------------
       
   190 // CAccPolMuteControl::DuplicateL()
       
   191 // ---------------------------------------------------------------------------
       
   192 //
       
   193 CAccPolObjectBase* CAccPolMuteControl::DuplicateLC( CAccPolObjectCon* aObject )
       
   194     {
       
   195     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::DuplicateLC() - Enter" );
       
   196     CAccPolMuteControl* aMute = CAccPolMuteControl::NewLC( aObject );
       
   197     *aMute = ( CAccPolMuteControl& )*this;
       
   198     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolMuteControl::DuplicateLC() - Return" );
       
   199     return aMute;
       
   200     }
       
   201 
       
   202 //  End of File