|
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 HSPDATAHANDLER_H_ |
|
20 #define HSPDATAHANDLER_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 class CHsHSPParser; |
|
25 class CHsHSPCommand; |
|
26 class CHsHSPFeatureManager; |
|
27 class CDesC8ArrayFlat; |
|
28 |
|
29 /** Useful constants */ |
|
30 _LIT8(KHSPCallAcceptCmd, "AT+CKPD=200\r\n"); |
|
31 _LIT8(KHSPCallReleaseCmd, "AT+CKPD=200\r\n"); |
|
32 |
|
33 |
|
34 /** |
|
35 * @brief Manages AT commands handling |
|
36 */ |
|
37 class CHsHSPDataHandler : public CBase |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Two-phase constructor |
|
43 * @return instance of class |
|
44 */ |
|
45 static CHsHSPDataHandler* NewL(); |
|
46 |
|
47 /** |
|
48 * Two-phase constructor |
|
49 * @return instance of class |
|
50 */ |
|
51 static CHsHSPDataHandler* NewLC(); |
|
52 |
|
53 /** |
|
54 * Destructor |
|
55 */ |
|
56 ~CHsHSPDataHandler(); |
|
57 |
|
58 public: |
|
59 /** |
|
60 * Profile's method for handling AT Commands |
|
61 * |
|
62 * @param aDataIn descriptor containing AT command |
|
63 * @param aFromAG denotes if datac was sent by AG |
|
64 * @param aDataOut response for passed command |
|
65 * |
|
66 */ |
|
67 void ProcessDataL( const TDesC8& aDataIn, const TBool aFromAG, |
|
68 TDes8& aDataOut ); |
|
69 |
|
70 /** |
|
71 * Profile's method for handling AG client's disconnection |
|
72 * |
|
73 * @param aErr disconnection reason |
|
74 */ |
|
75 void HandleClientDisconnected( TInt aErr ); |
|
76 |
|
77 /** |
|
78 * Profile's method for handling AG client connection |
|
79 * |
|
80 * @param aCommandOut AT response |
|
81 */ |
|
82 void HandleClientConnected( TDes8& aCommandOut ); |
|
83 |
|
84 /** |
|
85 * Profile's method for accepting incoming call |
|
86 * |
|
87 * @param aCommandOut AT response |
|
88 */ |
|
89 void HandleAcceptCallL( TDes8& aCommandOut ); |
|
90 |
|
91 /** |
|
92 * Profile's method for releasing ongoing call |
|
93 * |
|
94 * @param aCommandOut AT response |
|
95 */ |
|
96 void HandleReleaseCallL( TDes8& aCommandOut ); |
|
97 |
|
98 private: |
|
99 /** |
|
100 * Constructor for performing 1st stage construction |
|
101 */ |
|
102 CHsHSPDataHandler(); |
|
103 |
|
104 /** |
|
105 * Constructor for performing 2nd stage construction |
|
106 */ |
|
107 void ConstructL(); |
|
108 |
|
109 private: |
|
110 /** |
|
111 * Splits multiple AT commands |
|
112 * |
|
113 * @param aCommands 8-bit descriptor containing AT command(s) |
|
114 * @return pointer to array of desciptors (each element is a separate AT command) |
|
115 */ |
|
116 CDesC8ArrayFlat* SplitCommandsL( const TDesC8 &aCommands ); |
|
117 |
|
118 /** |
|
119 * Common funcionality for HandleAcceptCallL() and HandleReleaseCallL(). |
|
120 * |
|
121 * @param aCommand descriptor containing AT command |
|
122 * @param aResponse response for passed command |
|
123 * |
|
124 */ |
|
125 void PerformRequestL( const TDesC8& aCommand, TDes8& aResponse ); |
|
126 |
|
127 private: |
|
128 |
|
129 /** Command array's granularity */ |
|
130 const TInt KCommandArrayGranularity = 2; |
|
131 |
|
132 /** Temporary buffer's max length */ |
|
133 const TInt KTmpBufferLength = 256; |
|
134 |
|
135 /** AT command parser, owned */ |
|
136 CHsHSPParser* iParser; |
|
137 |
|
138 /** Feature manager, owned */ |
|
139 CHsHSPFeatureManager* iFeatureManager; |
|
140 |
|
141 }; |
|
142 |
|
143 #endif /* HSPDATAHANDLER_H_ */ |