bluetoothengine/headsetsimulator/profiles/hspprofile/inc/features/hspfeaturemanager.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 HSPFEATUREMANAGER_H_
#define HSPFEATUREMANAGER_H_

#include "hspfeaturecommons.h"
#include "hspsettings.h"

class CHsHSPCommand;
class CHsHSPCallTerminationProc;
class CHsHSPIncomingCallAcceptance;
class CHsHSPRemoteAudioVolumeControl;

/**
 * @brief Manages features supported by profile.
 * 
 * Delegates data handling to appropriate procedure and holds current state.
 */
class CHsHSPFeatureManager : public CBase, public MHsHSPFeatureProviderObserver
{
public:
    /**
     * Two-phased constructor.
     * 
     * @return instance of class
     */
    static CHsHSPFeatureManager* NewL();

    /**
     * Two-phased constructor.
     * 
     * @return instance of class
     */
    static CHsHSPFeatureManager* NewLC();

    /**
     * Destructor
     */
    ~CHsHSPFeatureManager();

public:
    /**
     * Decides which procedure should be started.
     * 
     * @param aATCommandIn input AT command
     * @param aATCommandOut response
     */
    void PerformDataProcessingL( const CHsHSPCommand* aATCommandIn,
            CHsHSPCommand& aATCommandOut );

    /**
     * Handles AG's client disconnection event
     * 
     * @param aErr disconnection reason
     */
    void HandleClientDisconnected( TInt aErr );

    /**
     * Handles AG's client connection event
     * 
     * @param aCommandOut AT response
     */
    void HandleClientConnected( TDes8& aCommandOut );

public:
    //Methods inherited from MHsHSPFeatureProviderObserver
    void HandleProcedureCompleted( TInt aErr, const THSPProcedure aProcedure );

private:
    /**
     * Constructor for performing 1st stage construction
     */
    CHsHSPFeatureManager();

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

private:

    /**
     * Handles <cr><lf> OK <cr><lf> command.
     * 
     * @param aATCommandIn input AT command
     * @param aATCommandOut response
     */
    void HandleOKCommandL( const CHsHSPCommand* aATCommandIn,
            CHsHSPCommand& aATCommandOut );

    /**
     * Handles +CKPD command 
     * 
     * @param aATCommandIn input AT command
     * @param aATCommandOut response
     */
    void HandleCKPDCommandL( const CHsHSPCommand* aATCommandIn,
            CHsHSPCommand& aATCommandOut );
private:

    /** Ongoing procedure */
    THSPProcedure iProcedureStarted;

    /** Pointer to 'Terminate a call' feature. Owned */
    CHsHSPCallTerminationProc* iCallTermProc;

    /** Pointer to 'Accept an incoming voice call' feature. Owned */
    CHsHSPIncomingCallAcceptance* iCallAcceptProc;

    /** Pointer to 'Remote audio volume control' feature. Owned */
    CHsHSPRemoteAudioVolumeControl* iVolumeControl;

    /** Profile's settings */
    CHsHSPSettings* iSettings;

};

#endif /* HSPFEATUREMANAGER_H_ */