|
1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: SendDtmf command handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSENDDTMFHANDLER_H |
|
20 #define CSENDDTMFHANDLER_H |
|
21 |
|
22 #include <etelsat.h> |
|
23 |
|
24 #include "CSatCommandHandler.h" |
|
25 #include "SatSTypes.h" |
|
26 |
|
27 class CSatDtmfSender; |
|
28 |
|
29 /** |
|
30 * Command handler for SendDtmf command. |
|
31 * |
|
32 * @lib SendDtmfCmd.lib |
|
33 * @since S60 v3.0 |
|
34 */ |
|
35 class CSendDtmfHandler : public CSatCommandHandler |
|
36 { |
|
37 |
|
38 public: |
|
39 |
|
40 static CSendDtmfHandler* NewL( MSatUtils* aUtils ); |
|
41 |
|
42 virtual ~CSendDtmfHandler(); |
|
43 |
|
44 /** |
|
45 * Gets the result of DTMF sending. |
|
46 * |
|
47 * @since S60 3.2 |
|
48 * @param aErrCode result of completed DTMF sending. |
|
49 */ |
|
50 void SendDtmfComplete( const TInt aErrCode ); |
|
51 |
|
52 // from base class MSatCommand |
|
53 |
|
54 /** |
|
55 * From MSatCommand. |
|
56 * Response from the client |
|
57 * |
|
58 */ |
|
59 void ClientResponse(); |
|
60 |
|
61 // from base class CSatCommandHandler |
|
62 |
|
63 /** |
|
64 * From CSatCommandHandler |
|
65 * Overrides the default implementation. |
|
66 * |
|
67 * @param aEvent Identifies the event. |
|
68 */ |
|
69 void Event( TInt aEvent ); |
|
70 |
|
71 protected: |
|
72 |
|
73 // from base class CActive |
|
74 |
|
75 /** |
|
76 * From CActive |
|
77 * Cancels the usat request. |
|
78 * |
|
79 */ |
|
80 void DoCancel(); |
|
81 |
|
82 // from base class CSatCommandHandler |
|
83 |
|
84 /** |
|
85 * From CSatCommandHandler |
|
86 * Requests the command notification. |
|
87 * |
|
88 * @param aStatus Request status |
|
89 */ |
|
90 void IssueUSATRequest( TRequestStatus& aStatus ); |
|
91 |
|
92 /** |
|
93 * From CSatCommandHandler |
|
94 * Precheck before executing the command. |
|
95 * |
|
96 * @return TBool indicating command is currently allowed. |
|
97 */ |
|
98 TBool CommandAllowed(); |
|
99 |
|
100 /** |
|
101 * From CSatCommandHandler |
|
102 * Need for ui session. |
|
103 * |
|
104 * @return TBool indicating need of ui session. |
|
105 */ |
|
106 TBool NeedUiSession(); |
|
107 |
|
108 /** |
|
109 * From CSatCommandHandler |
|
110 * Called when USAT API notifies that command. |
|
111 * |
|
112 */ |
|
113 void HandleCommand(); |
|
114 |
|
115 /** |
|
116 * From CSatCommandHandler |
|
117 * Called when UI launch fails |
|
118 * |
|
119 */ |
|
120 void UiLaunchFailed(); |
|
121 |
|
122 private: |
|
123 |
|
124 CSendDtmfHandler(); |
|
125 |
|
126 void ConstructL(); |
|
127 |
|
128 /** |
|
129 * Converts extended BCD string into UCS2 string |
|
130 * |
|
131 * @param aDtmfString destination string, to contain DTMF as UCS2 |
|
132 * @return ETrue if DTMF string in iSendDtmfData contains valid DTMF characters only |
|
133 * (0-9,*,#,pause) |
|
134 */ |
|
135 TBool ConvertDtmfStringToUcs2( TDes& aDtmfString ); |
|
136 |
|
137 /** |
|
138 * converts an extended BCD character according to GSM 11.11 into a UCS2 character |
|
139 * |
|
140 * @param aExtBcd extended BCD character |
|
141 * @param aEndOfString ETrue iff aExtBcd signals end of string |
|
142 * @param aDtmfCharacter ETrue iff aExtBcd represents DTMF character (0-9,*,#,pause) |
|
143 * @param aUcs2Char DTMF character in UCS2 representation - only valid if aDtmfCharacter is true |
|
144 */ |
|
145 void ConvertDtmfCharacterToUcs2( |
|
146 const TChar& aExtBcd, |
|
147 TBool& aEndOfString, |
|
148 TBool& aDtmfCharacter, |
|
149 TChar& aUcs2Char ) const; |
|
150 |
|
151 /** |
|
152 * Handles the result of DTMF sending and sends terminal response |
|
153 * |
|
154 */ |
|
155 void HandleResult(); |
|
156 |
|
157 /** |
|
158 * Sends terminal response. Makes sure that terminal response |
|
159 * is not send more that once / command. |
|
160 * |
|
161 */ |
|
162 void SendTerminalResponse(); |
|
163 |
|
164 private: // data |
|
165 |
|
166 /** |
|
167 * SendDtmf command data from SIM. |
|
168 */ |
|
169 RSat::TSendDtmfV1 iSendDtmfData; |
|
170 |
|
171 /** |
|
172 * SendDtmf command package. |
|
173 */ |
|
174 RSat::TSendDtmfV1Pckg iSendDtmfPckg; |
|
175 |
|
176 /** |
|
177 * SendDtmf response data from client. |
|
178 */ |
|
179 RSat::TSendDtmfRspV1 iSendDtmfRsp; |
|
180 |
|
181 /** |
|
182 * SendDtmf response package |
|
183 */ |
|
184 RSat::TSendDtmfRspV1Pckg iSendDtmfRspPckg; |
|
185 |
|
186 // UI notification data |
|
187 |
|
188 /** |
|
189 * SendDtmf notification send data |
|
190 */ |
|
191 TSatNotificationV1 iNotificationData; |
|
192 |
|
193 /** |
|
194 * SendDtmf notification package |
|
195 */ |
|
196 TSatNotificationV1Pckg iNotificationDataPckg; |
|
197 |
|
198 /** |
|
199 * SendDtmf notification Response data |
|
200 */ |
|
201 TSatNotificationRspV1 iNotificationRsp; |
|
202 |
|
203 /** |
|
204 * SendDtmf notification Response package |
|
205 */ |
|
206 TSatNotificationRspV1Pckg iNotificationRspPckg; |
|
207 |
|
208 /** |
|
209 * DTMF handling |
|
210 */ |
|
211 CSatDtmfSender* iDtmfSender; |
|
212 |
|
213 /** |
|
214 * Result of completed DTMF sending. |
|
215 */ |
|
216 TInt iDtmfResult; |
|
217 |
|
218 /** |
|
219 * Indicates is terminal response sent |
|
220 */ |
|
221 TBool iTerminalRespSent; |
|
222 |
|
223 /** |
|
224 * Indicates do we need UI |
|
225 */ |
|
226 TBool iNeedUiSession; |
|
227 |
|
228 /** |
|
229 * Converted DTMF string container. |
|
230 * Own. |
|
231 */ |
|
232 HBufC16* iDtmfStringUcs2; |
|
233 |
|
234 /** |
|
235 * Flag to signal that command has icon data |
|
236 * To be removed when icons are allowed in this command |
|
237 */ |
|
238 TBool iIconCommand; |
|
239 |
|
240 /** |
|
241 * Wait scheduler for fast UI event cases. |
|
242 */ |
|
243 CActiveSchedulerWait iWait; |
|
244 |
|
245 /** |
|
246 * Indicates if client response is received. |
|
247 */ |
|
248 TBool iClientResponseReceived; |
|
249 |
|
250 }; |
|
251 |
|
252 #endif // CSENDDTMFHANDLER_H |
|
253 |