bluetoothengine/headsetsimulator/profiles/hspprofile/inc/dataprocessing/hspcommandparser.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 HSPCOMMANDPARSER_H_
#define HSPCOMMANDPARSER_H_

#include <e32base.h>

#include "hspcommand.h"

/**
 *  @brief Parser for AT commands 
 */
class CHsHSPParser : public CBase
{
public:

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

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

    /** 
     * Destructor
     */
    ~CHsHSPParser();

public:

    /**
     * Parses 8-bit descriptor into AT command
     * 
     * @param aBufCommand descriptor to be parsed
     * @param aFromAG is data passed from AG
     * @param aCommand result (AT command)
     */
    void ParseL( const TDesC8 &aBufCommand, const TBool aFromAG,
            CHsHSPCommand& aCommand );

private:

    /**
     * Contructor for performing 1st stage construction
     */
    CHsHSPParser();

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

private:

    /**
     * Retrieves command's mode from descriptor data
     * 
     * @param aCommand descriptor to be parsed
     * @param aFromAG denotes if data sent from AG
     * @return command's mode 
     */
    THsHSPCommandMode RetrieveModeL( const TDesC8 &aCommand,
            const TBool aFromAG );

    /**
     * Retrieves command's type from descriptor data
     * 
     * @param aCommand descriptor to be parsed
     * @return command's type 
     */
    THsHSPCommandType RetrieveTypeL( const TDesC8 &aCommand );

    /**
     * Retrieves command's params from descriptor data
     * 
     * @param aCommand descriptor to be parsed
     * @param aCmdMode command's mode
     * @param aParams reference for array of params
     */
    void RetrieveParamsL( const TDesC8 &aCommand,
            const THsHSPCommandMode aCmdMode, RATParamArray& aParams );

};

#endif /* HSPCOMMANDPARSER_H_ */