bluetoothengine/headsetsimulator/profiles/hfpprofile/inc/dataprocessing/hfpdatahandler.h
branchheadsetsimulator
changeset 60 90dbfc0435e3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/headsetsimulator/profiles/hfpprofile/inc/dataprocessing/hfpdatahandler.h	Wed Sep 15 15:59:44 2010 +0200
@@ -0,0 +1,134 @@
+/* 
+ *
+ * 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 DATAHANDLER_H_
+#define DATAHANDLER_H_
+
+#include <e32base.h>
+
+class CHsHFPParser;
+class CHsHFPCommand;
+class CHsHFPFeatureManager;
+class CDesC8ArrayFlat;
+
+/**
+ * @brief Manages AT commands handling
+ */
+class CHsHFPDataHandler : public CBase
+    {
+public:
+
+    /**
+     * Two-phase constructor
+     * @return instance of class
+     */
+    static CHsHFPDataHandler* NewL();
+
+    /**
+     * Two-phase constructor
+     * @return instance of class
+     */
+    static CHsHFPDataHandler* NewLC();
+
+    /**
+     * Destructor
+     */
+    ~CHsHFPDataHandler();
+
+public:
+    /**
+     * Profile's method for handling AT Commands
+     * 
+     * @param aDataIn AT command received by HS
+     * @param aFromAG denotes if AT command was sent from AG
+     * @param aDataOut AT response
+     * 
+     */
+    void ProcessDataL(const TDesC8& aDataIn, const TBool aFromAG,
+            TDes8& aDataOut);
+
+    /**
+     * Profile's method for handling AG client disconnection
+     * 
+     * @param aErr disconnection reason
+     */
+    void HandleClientDisconnected(TInt aErr);
+
+    /**
+     * Profile's method for handling AG client connection
+     * 
+     * @param aCommandOut AT response
+     */
+    void HandleClientConnected(TDes8& aCommandOut);
+
+    /**
+     * Profile's method for accepting incoming call
+     * 
+     * @param aCommandOut AT response
+     */
+    void HandleAcceptCallL(TDes8& aCommandOut);
+
+    /**
+     * Profile's method for releasing ongoing call
+     * 
+     * @param aCommandOut AT response
+     */
+    void HandleReleaseCallL(TDes8& aCommandOut);
+
+private:
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CHsHFPDataHandler();
+
+    /**
+     * Constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+
+private:
+    /**
+     * Splits multiple AT commands 
+     * 
+     * @param aCommands 8-bit descriptor containing
+     */
+    CDesC8ArrayFlat* SplitCommandsL(const TDesC8 &aCommands);
+
+    /**
+     * Common funcionality for HandleAcceptCallL() and HandleReleaseCall().
+     * 
+     * @param aCommand input AT command
+     * @param aResponse  AT response
+     */
+    void PerformRequestL(const TDesC8& aCommand, TDes8& aResponse);
+
+private:
+    /** Command array's granularity */
+    const TInt KCommandArrayGranularity = 2;
+    
+    /** Temporary buffer's max length */
+    const TInt KTmpBufferLength = 256;
+    
+    /** AT command parser */
+    CHsHFPParser* iParser;
+
+    /** Feature manager */
+    CHsHFPFeatureManager* iFeatureManager;
+    };
+
+#endif /* DATAHANDLER_H_ */