bluetoothengine/headsetsimulator/profiles/hspprofile/src/hspsettings.cpp
author michal.sulewski
Wed, 15 Sep 2010 15:59:44 +0200
branchheadsetsimulator
changeset 60 90dbfc0435e3
permissions -rw-r--r--
source code commit

/* 
 *
 * Copyright (c) <2010> Comarch S.A. and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Original Contributors:
 * Comarch S.A. - original contribution.
 *
 * Contributors:
 *
 * Description:
 *
 */

#include "hspsettings.h"
#include "hspcommand.h"
#include "debug.h"

CHsHSPSettings* CHsHSPSettings::InstanceL()
    {
    CHsHSPSettings* self = NULL;

    TAny* tlsPtr = Dll::Tls();
    if ( !tlsPtr )
        {
        self = new ( ELeave ) CHsHSPSettings;
        CleanupStack::PushL( self );
        self->ConstructL();
        User::LeaveIfError( Dll::SetTls( self ) );
        CleanupStack::Pop( self );
        }
    else
        {
        self = static_cast <CHsHSPSettings*> ( tlsPtr );
        ++self->iReferenceCounter;
        }

    return self;
    }

void CHsHSPSettings::Release()
    {
    TAny* tlsPtr = Dll::Tls();
    __ASSERT_DEBUG( tlsPtr, User::Panic( _L( "HSP Settings error" ),
                    KErrNotFound ) );

    CHsHSPSettings* self = static_cast <CHsHSPSettings*> ( tlsPtr );
    if ( --self->iReferenceCounter == 0 )
        {
        Dll::FreeTls();
        delete self;
        }
    }

CHsHSPSettings::CHsHSPSettings() :
    iReferenceCounter( 1 )
    {

    }

CHsHSPSettings::~CHsHSPSettings()
    {
    }

void CHsHSPSettings::ConstructL()
    {

    }

void CHsHSPSettings::SetSpeakerVolumeLevel( const TInt aLevel )
    {
    iSpeakerVolumeLevel = aLevel;
    }

void CHsHSPSettings::SetMicGainLevel( const TInt aLevel )
    {
    iMicGainLevel = aLevel;
    }

void CHsHSPSettings::UpdateCallStatus( const TBool aIsCallOngoing )
    {
    iCallOngoing = aIsCallOngoing;
    }

TBool CHsHSPSettings::CallOngoing() const
    {
    return iCallOngoing;
    }