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: SendData command handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSENDDATAHANDLER_H |
|
20 #define CSENDDATAHANDLER_H |
|
21 |
|
22 #include <etelsat.h> |
|
23 |
|
24 #include "MSatSendDataObserver.h" |
|
25 #include "CSatCommandHandler.h" |
|
26 #include "SatSTypes.h" |
|
27 #include "MSatConnectionObserver.h" |
|
28 #include "MSatBIPUtils.h" |
|
29 #include "MSatEventObserver.h" |
|
30 |
|
31 class MSatUtils; |
|
32 class MSatBIPDataChannel; |
|
33 |
|
34 /** |
|
35 * Command handler for SendData command. |
|
36 * |
|
37 * @lib SendDataCmd.lib |
|
38 * @since S60 v3.0 |
|
39 */ |
|
40 class CSendDataHandler : public CSatCommandHandler, |
|
41 public MSatSendDataObserver, |
|
42 public MSatConnectionObserver |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 static CSendDataHandler* NewL( MSatUtils* aUtils ); |
|
48 |
|
49 virtual ~CSendDataHandler(); |
|
50 |
|
51 // from base class MSatCommand |
|
52 |
|
53 /** |
|
54 * From MSatCommand. |
|
55 * Response from the client |
|
56 * |
|
57 */ |
|
58 void ClientResponse(); |
|
59 |
|
60 // from base class MSatSendDataObserver |
|
61 |
|
62 /** |
|
63 * From MSatSendDataObserver |
|
64 * Notification of data has been sent |
|
65 * |
|
66 * @param aError Indicates the status of data sent. |
|
67 * @param aLength Number of bytes sent |
|
68 */ |
|
69 void DataSentNotification( const TInt aError, |
|
70 const TInt aLength ); |
|
71 |
|
72 /** |
|
73 * From MSatConnectionObserver |
|
74 * Notfication from the connection |
|
75 * |
|
76 * @param aError Indicates the status of connection |
|
77 */ |
|
78 void ConnectionNotification( TInt aError ); |
|
79 |
|
80 // from base class CSatCommandHandler |
|
81 |
|
82 /** |
|
83 * From CSatCommandHandler |
|
84 * Overrides the default implementation. |
|
85 * |
|
86 * @param aEvent Identifies the event. |
|
87 */ |
|
88 void Event( TInt aEvent ); |
|
89 |
|
90 protected: |
|
91 |
|
92 // from base class CActive |
|
93 |
|
94 /** |
|
95 * From CActive |
|
96 * Cancels the usat request. |
|
97 * |
|
98 */ |
|
99 void DoCancel(); |
|
100 |
|
101 // from base class CSatCommandHandler |
|
102 |
|
103 /** |
|
104 * From CSatCommandHandler |
|
105 * Requests the command notification. |
|
106 * |
|
107 * @param aStatus Request status to active object notification |
|
108 */ |
|
109 void IssueUSATRequest( TRequestStatus& aStatus ); |
|
110 |
|
111 /** |
|
112 * From CSatCommandHandler |
|
113 * Precheck before executing the command. |
|
114 * |
|
115 * @return Boolean indicating is this command allowed to execute. |
|
116 */ |
|
117 TBool CommandAllowed(); |
|
118 |
|
119 /** |
|
120 * From CSatCommandHandler |
|
121 * Need for ui session. |
|
122 * |
|
123 * @return Boolean indicating does this command need UI session. |
|
124 */ |
|
125 TBool NeedUiSession(); |
|
126 |
|
127 /** |
|
128 * From CSatCommandHandler |
|
129 * Called when USAT API notifies that command. |
|
130 * |
|
131 */ |
|
132 void HandleCommand(); |
|
133 |
|
134 /** |
|
135 * From CSatCommandHandler. |
|
136 * Indicates the failure of launching ui client. |
|
137 * |
|
138 */ |
|
139 void UiLaunchFailed(); |
|
140 |
|
141 private: |
|
142 |
|
143 CSendDataHandler(); |
|
144 |
|
145 void ConstructL(); |
|
146 |
|
147 /** |
|
148 * Sends data |
|
149 * |
|
150 */ |
|
151 void SendData(); |
|
152 |
|
153 /** |
|
154 * Completes Terminal response and sends it |
|
155 * |
|
156 * @param aError is error code of reason |
|
157 */ |
|
158 void SendTerminalResponse( |
|
159 const TInt aError = MSatBIPUtils::ESatBIPSuccess ); |
|
160 |
|
161 /** |
|
162 * Sends notification to UI |
|
163 * |
|
164 * @return KErrNone if notification is sent successfully |
|
165 */ |
|
166 TInt SendUiNotification(); |
|
167 |
|
168 private: // data |
|
169 |
|
170 /** |
|
171 * SendData command data |
|
172 */ |
|
173 RSat::TSendDataV2 iSendDataData; |
|
174 |
|
175 /** |
|
176 * SendData command package |
|
177 */ |
|
178 RSat::TSendDataV2Pckg iSendDataPckg; |
|
179 |
|
180 /** |
|
181 * SendData response data |
|
182 */ |
|
183 RSat::TSendDataRspV2 iSendDataRspData; |
|
184 |
|
185 /** |
|
186 * SendData response package |
|
187 */ |
|
188 RSat::TSendDataRspV2Pckg iSendDataRspPckg; |
|
189 |
|
190 /** |
|
191 * Data to UI |
|
192 */ |
|
193 TSatNotificationV1 iSendDataUiData; |
|
194 |
|
195 /** |
|
196 * IPC Package to ui data |
|
197 */ |
|
198 TSatNotificationV1Pckg iSendDataUiPckg; |
|
199 |
|
200 /** |
|
201 * UI Response |
|
202 */ |
|
203 TSatNotificationRspV1 iSendDataUiRsp; |
|
204 |
|
205 /** |
|
206 * IPC Package to response |
|
207 */ |
|
208 TSatNotificationRspV1Pckg iSendDataUiRspPckg; |
|
209 |
|
210 /** |
|
211 * Remaining space in TX buffer |
|
212 */ |
|
213 TInt iFreeBuffSize; |
|
214 |
|
215 /** |
|
216 * Pointer to DataChannel |
|
217 */ |
|
218 MSatBIPDataChannel* iDataChannel; |
|
219 |
|
220 /** |
|
221 * Indicates has user cancelled the action |
|
222 */ |
|
223 TBool iUserCancelled; |
|
224 |
|
225 /** |
|
226 * Indicates does current command need UI or not |
|
227 */ |
|
228 TBool iNeedUiSession; |
|
229 |
|
230 /** |
|
231 * Flag to signal that command has icon data |
|
232 * To be removed when icons are allowed in this command |
|
233 */ |
|
234 TBool iIconCommand; |
|
235 |
|
236 }; |
|
237 |
|
238 #endif // CSENDDATAHANDLER_H |
|
239 |
|