bluetoothengine/headsetsimulator/profiles/hfpprofile/inc/dataprocessing/hfpcommandparser.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 HFPCOMMANDPARSER_H_
#define HFPCOMMANDPARSER_H_

#include <e32base.h>

#include "hfpcommand.h"

/**
 *  @brief AT command parser 
 */
class CHsHFPParser : public CBase
    {
public:

    /**
     * Two-phased constructor.
     * 
     * @return class instance
     */
    static CHsHFPParser* NewL();

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

    /** 
     * Destructor
     */
    ~CHsHFPParser();

public:

    /**
     * Parses AT command. Sets type, mode and params.
     * 
     * @param aBufCommand AT command as descriptor
     * @param aFromAG denotes if AT command was sent from AG
     * @param aCommand on exit command object
     */
    void ParseL(const TDesC8 &aBufCommand, const TBool aFromAG,
            CHsHFPCommand& aCommand);

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

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

    /**
     * Retrieves command mode
     * 
     * @param aCommand AT command as descriptor
     * @param aFromAG denotes if AT command was sent from AG
     * 
     * @return command mode
     */
    THsHFPCommandMode RetrieveModeL(const TDesC8 &aCommand,
            const TBool aFromAG);

    /**
     * Retrieves command type
     * 
     * @param aCommand AT command as descriptor
     * 
     * @return command type
     */
    THsHFPCommandType RetrieveTypeL(const TDesC8 &aCommand);

    /**
     * Retrieves command params
     * 
     * @param aCommand AT command as descriptor
     * @param aCmdMode command mode
     * @param aParams on exit array contains AT params 
     * 
     */
    void RetrieveParamsL(const TDesC8 &aCommand,
            const THsHFPCommandMode aCmdMode, RATParamArray& aParams);

    };

#endif /* HFPCOMMANDPARSER_H_ */