bluetoothengine/headsetsimulator/profiles/hspprofile/inc/features/hspremoteaudiovolumecontrol.h
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:
 *
 */

#ifndef HSPREMOTEAUDIOVOLUMECONTROL_H
#define HSPREMOTEAUDIOVOLUMECONTROL_H

#include <e32base.h>

#include "hspfeaturecommons.h"

class CHsHSPCommand;
class CHsHSPSettings;

/**
 * @brief Represents "Remote audio volume control" feature
 */
class CHsHSPRemoteAudioVolumeControl : public CBase,
        public MHsHSPProcedureCommons
{
public:

    /**
     * Two-phased constructor.
     * 
     * @param aObserver feature observer
     * 
     * @return instance of class
     */
    static CHsHSPRemoteAudioVolumeControl* NewL(
            MHsHSPFeatureProviderObserver* aObserver );

    /**
     * Two-phased constructor.
     * 
     * @param aObserver feature observer
     * 
     * @return instance of class
     */
    static CHsHSPRemoteAudioVolumeControl* NewLC(
            MHsHSPFeatureProviderObserver* aObserver );

    /**
     * Destructor.
     */
    ~CHsHSPRemoteAudioVolumeControl();

public:

    /** 
     * Resets volume settings
     */
    void Reset();

public:
    //Methods inherited from MHsHFPProcedureCommons
    TInt ProcessCommand( const CHsHSPCommand* aInputCmd,
            CHsHSPCommand &aOutputCmd );

private:

    /**
     * Constructor for performing 1st stage construction
     * 
     * @param aObserver feature observer
     */
    CHsHSPRemoteAudioVolumeControl( MHsHSPFeatureProviderObserver* aObserver );

    /**
     * Constructor for performing 2nd stage construction
     */
    void ConstructL();

private:

    /**
     * Informs observer about procedure's completion
     * 
     * @param aErr error value
     */
    void InformObserver( TInt aErr );

    /**
     * Sets volume level. Value is retrieved from AT command.
     * 
     * @param aCmd AT command
     */
    void SetVolumeLevelL( const CHsHSPCommand* aCmd );

    /**
     * Sets mic gain level. Value is retrieved from AT command.
     * 
     * @param aCmd AT command
     */
    void SetMicGainLevelL( const CHsHSPCommand* aCmd );

    /**
     * Checks if passed AT command's params are valid. Leaves if invalid.
     * 
     * @param aCmd AT command
     */
    void CheckParamsL( const CHsHSPCommand* aCmd );
private:

    /** Procedure's type */
    const THSPProcedure iHSPProc = EHSPVolumeControl;

    /** Pointer to observer, not owned */
    MHsHSPFeatureProviderObserver* iObserver;

    /** Pointer to profile's settings */
    CHsHSPSettings* iSettings;

    /** 
     * Denotes if the next expected command is  <cr><lf> OK <cr><lf>
     * after +VGM handled 
     */
    TBool iWaitingForVgmOK;

    /** 
     * Denotes if the next expected command is <cr><lf> OK <cr><lf> 
     * after +VGS handled 
     */
    TBool iWaitingForVgsOK;

};

#endif // HSPREMOTEAUDIOVOLUMECONTROL_H