bluetoothengine/headsetsimulator/profiles/hfpprofile/inc/features/hfpfeaturemanager.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 HFFEATUREMANAGER_H_
#define HFFEATUREMANAGER_H_

#include "hfpfeaturecommons.h"
#include "hfpsettings.h"

class CHsHFPCommand;
class CHsHFPConnectionManagement;
class CHsHFPCallTerminationProc;
class CHsHFPIncomingCallAcceptance;
class CHsHFPIncomingCallRejection;
class CHsHFPPhoneStatusInformation;
class CHsHFPRemoteAudioVolumeControl;
class CHsHFPLastNumberRedialing;
class CHsHFPPhoneNumberDialing;
class CHsHFPCallingLineIdentification;

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

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

    /** 
     * Destructor
     */
    ~CHsHFPFeatureManager();

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

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

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

public:
    //Method inherited from MHsHFPFeatureProviderObserver
    void HandleProcedureCompleted(TInt aErr);

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

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

    /**
     * Handles OK command.
     * 
     * @param aATCommandIn input AT command
     * @param aATCommandOut response
     */
    void HandleOKCommandL(const CHsHFPCommand* aATCommandIn,
            CHsHFPCommand& aATCommandOut);

    /**
     * Handles CIEV command and saves current value of appropriate indicator.
     * 
     * @param aATCommandIn input AT command
     * @param aATCommandOut response
     */
    void HandleCIEVCommandL(const CHsHFPCommand* aATCommandIn,
            CHsHFPCommand& aATCommandOut);

private:
    /** HFP procedures */
    enum THFPProcedures
        {
        EHFPServiceLevelConnectionEstablishment,
        EHFPServiceLevelConnectionRelease,
        EHFPCallTerminate,
        EHFPCallAccept,
        EHFPCallReject,
        EHFPOperatorSelection,
        EHFPVolumeControl,
        EHFPLastNumberRedialing,
        EHFPPhoneNumberDialing,
        EHFPCallingLineIdentification,
        EHFPIdle
        };

    /** Ongoing procedure */
    THFPProcedures iProcedureStarted;

    /** Denotes if service level connection is established */
    TBool iSrvLvlConnEstablished;

    /** Connection managment feature */
    CHsHFPConnectionManagement* iConnectionManagement;

    /** Terminate a call feature */
    CHsHFPCallTerminationProc* iCallTermProc;

    /** Accept an incoming voice call feature */
    CHsHFPIncomingCallAcceptance* iCallAcceptProc;

    /** Reject an incoming voice call feature */
    CHsHFPIncomingCallRejection* iCallRejectProc;

    /** Phone status information feature */
    CHsHFPPhoneStatusInformation* iPhoneStatus;

    /** Remote audio volume control feature */
    CHsHFPRemoteAudioVolumeControl* iVolumeControl;

    /** Place a call to the last number dialed feature */
    CHsHFPLastNumberRedialing* iLastNumberRedialing;

    /** Place a call with a phone number supplied by the HF feature */
    CHsHFPPhoneNumberDialing* iPhoneNumberDialing;

    /** Calling Line Identification feature */
    CHsHFPCallingLineIdentification* iCallingLineIdentification;
    };

#endif /* HFFEATUREMANAGER_H_ */