bluetoothengine/headsetsimulator/core/inc/RemoteControl/hsremotecontroldatahandler.h
author michal.sulewski
Wed, 15 Sep 2010 15:59:44 +0200
branchheadsetsimulator
changeset 60 90dbfc0435e3
permissions -rw-r--r--
source code commit

/*
 * Component Name: Headset Simulator
 * Author: Comarch S.A.
 * Version: 1.0
 * Copyright (c) 2010 Comarch S.A.
 *  
 * This Software is submitted by Comarch S.A. to Symbian Foundation Limited on 
 * the basis of the Member Contribution Agreement entered between Comarch S.A. 
 * and Symbian Foundation Limited on 5th June 2009 (“Agreement”) and may be 
 * used only in accordance with the terms and conditions of the Agreement. 
 * Any other usage, duplication or redistribution of this Software is not 
 * allowed without written permission of Comarch S.A.
 * 
 */

#ifndef HSREMOTECONTROLDATAHANDLER_H
#define HSREMOTECONTROLDATAHANDLER_H

#include <e32base.h>

class THsRemoteControlCommand;
class CHsRemoteControlParser;

/**
 * @brief Manages remote requests
 */
class CHsRemoteControlDataHandler : public CBase
{

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

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

    /**
     * Destructor
     */
    ~CHsRemoteControlDataHandler();

public:

    /**
     * Transforms remote requests into THsRemoteControlCommand objects
     * 
     * @param aDataIn remote request read from socket
     * @param aCmd THsRemoteControlCommand object
     * 
     * @return error code.
     *      KErrNone if OK
     *      KErrArgument if command not valid or not supported
     *      KErrGeneral, KErrOverflow if error in parsing
     */
    TInt RecognizeCommand( const TDesC8& aDataIn, 
            THsRemoteControlCommand& aCmd );

private:

    /**
     * Constructor for performing 1st stage construction
     */
    CHsRemoteControlDataHandler();

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

private:

    /**
     * Checks if command is supported
     * 
     * @param aCmd command to be checked
     * @return ETrue if OK, otherwise EFalse
     */
    TBool IsCommandValid( THsRemoteControlCommand& aCmd );

private:

    /** Pointer to parser. Owned */
    CHsRemoteControlParser* iParser;

};
#endif // HSREMOTECONTROLDATAHANDLER_H