|
1 /* |
|
2 * |
|
3 * Copyright (c) <2010> Comarch S.A. and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of the License "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Original Contributors: |
|
11 * Comarch S.A. - original contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef DATAHANDLER_H_ |
|
20 #define DATAHANDLER_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class CHsHFPParser; |
|
25 class CHsHFPCommand; |
|
26 class CHsHFPFeatureManager; |
|
27 class CDesC8ArrayFlat; |
|
28 |
|
29 /** |
|
30 * @brief Manages AT commands handling |
|
31 */ |
|
32 class CHsHFPDataHandler : public CBase |
|
33 { |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Two-phase constructor |
|
38 * @return instance of class |
|
39 */ |
|
40 static CHsHFPDataHandler* NewL(); |
|
41 |
|
42 /** |
|
43 * Two-phase constructor |
|
44 * @return instance of class |
|
45 */ |
|
46 static CHsHFPDataHandler* NewLC(); |
|
47 |
|
48 /** |
|
49 * Destructor |
|
50 */ |
|
51 ~CHsHFPDataHandler(); |
|
52 |
|
53 public: |
|
54 /** |
|
55 * Profile's method for handling AT Commands |
|
56 * |
|
57 * @param aDataIn AT command received by HS |
|
58 * @param aFromAG denotes if AT command was sent from AG |
|
59 * @param aDataOut AT response |
|
60 * |
|
61 */ |
|
62 void ProcessDataL(const TDesC8& aDataIn, const TBool aFromAG, |
|
63 TDes8& aDataOut); |
|
64 |
|
65 /** |
|
66 * Profile's method for handling AG client disconnection |
|
67 * |
|
68 * @param aErr disconnection reason |
|
69 */ |
|
70 void HandleClientDisconnected(TInt aErr); |
|
71 |
|
72 /** |
|
73 * Profile's method for handling AG client connection |
|
74 * |
|
75 * @param aCommandOut AT response |
|
76 */ |
|
77 void HandleClientConnected(TDes8& aCommandOut); |
|
78 |
|
79 /** |
|
80 * Profile's method for accepting incoming call |
|
81 * |
|
82 * @param aCommandOut AT response |
|
83 */ |
|
84 void HandleAcceptCallL(TDes8& aCommandOut); |
|
85 |
|
86 /** |
|
87 * Profile's method for releasing ongoing call |
|
88 * |
|
89 * @param aCommandOut AT response |
|
90 */ |
|
91 void HandleReleaseCallL(TDes8& aCommandOut); |
|
92 |
|
93 private: |
|
94 /** |
|
95 * Constructor for performing 1st stage construction |
|
96 */ |
|
97 CHsHFPDataHandler(); |
|
98 |
|
99 /** |
|
100 * Constructor for performing 2nd stage construction |
|
101 */ |
|
102 void ConstructL(); |
|
103 |
|
104 private: |
|
105 /** |
|
106 * Splits multiple AT commands |
|
107 * |
|
108 * @param aCommands 8-bit descriptor containing |
|
109 */ |
|
110 CDesC8ArrayFlat* SplitCommandsL(const TDesC8 &aCommands); |
|
111 |
|
112 /** |
|
113 * Common funcionality for HandleAcceptCallL() and HandleReleaseCall(). |
|
114 * |
|
115 * @param aCommand input AT command |
|
116 * @param aResponse AT response |
|
117 */ |
|
118 void PerformRequestL(const TDesC8& aCommand, TDes8& aResponse); |
|
119 |
|
120 private: |
|
121 /** Command array's granularity */ |
|
122 const TInt KCommandArrayGranularity = 2; |
|
123 |
|
124 /** Temporary buffer's max length */ |
|
125 const TInt KTmpBufferLength = 256; |
|
126 |
|
127 /** AT command parser */ |
|
128 CHsHFPParser* iParser; |
|
129 |
|
130 /** Feature manager */ |
|
131 CHsHFPFeatureManager* iFeatureManager; |
|
132 }; |
|
133 |
|
134 #endif /* DATAHANDLER_H_ */ |