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

#include <e32base.h>

#include "hspfeaturecommons.h"

class CHsHSPCommand;
class CHsHSPSettings;

/**
 * @brief Represents "Accept an incoming voice call" feature
 */
class CHsHSPIncomingCallAcceptance : public CBase,
        public MHsHSPProcedureCommons
{
public:
    /**
     * Two-phased constructor.
     * 
     * @param aObserver feature observer
     * 
     * @return instance of class
     */
    static CHsHSPIncomingCallAcceptance* NewL(
            MHsHSPFeatureProviderObserver* aObserver );

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

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

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

private:

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

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

private:
    /**
     * Checks if received command is proper +CKPD
     * 
     * @param aCommand AT command
     * @return ETrue if command is AT+CKPD=200<cr><lf>, otherwise EFalse
     */
    TBool IsCKPD200( const CHsHSPCommand* aCommand );

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

private:

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

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

    /** Denotes if the next expected command is  <cr><lf> OK <cr><lf> */
    TBool iWaitingForOK;

    /** Denotes if the next expected command is  AT+CKPD=200<cr><lf> */
    TBool iWaitingForCKPD200;

};

#endif // HSPINCOMINGCALLACCEPTANCE_H