author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 15:32:36 +0300 | |
branch | RCL_3 |
changeset 44 | 7a45d2ea2f56 |
parent 40 | 52a167391590 |
permissions | -rw-r--r-- |
40 | 1 |
/* |
2 |
* Copyright (c) 2009-2010 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: Definitions needed for one "stream" of CDunTransporter |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
/* |
|
20 |
* TODO: When local media is of type RComm, listening on it is started with |
|
21 |
* RComm::NotifyDataAvailable() call. Check that USB ACM port and Irda RCOMM |
|
22 |
* (and any other new media in the future) behaves correctly so that when |
|
23 |
* RComm::ReadOneOrMore() is issued, the read is issued immediately without |
|
24 |
* checking for new data. If waiting for new data happens in this |
|
25 |
* NotifyDataAvailable/ReadOneOrMore combination, raise a defect to Symbian. |
|
26 |
*/ |
|
27 |
||
28 |
#include "DunTransporter.h" |
|
29 |
#include "DunDownstream.h" |
|
30 |
#include "DunUpstream.h" |
|
31 |
#include "DunDebug.h" |
|
32 |
||
33 |
// --------------------------------------------------------------------------- |
|
34 |
// Two-phased constructor. |
|
35 |
// --------------------------------------------------------------------------- |
|
36 |
// |
|
37 |
CDunDownstream* CDunDownstream::NewL( MDunTransporterUtilityAux* aUtility ) |
|
38 |
{ |
|
39 |
CDunDownstream* self = new (ELeave) CDunDownstream( aUtility ); |
|
40 |
CleanupStack::PushL( self ); |
|
41 |
self->ConstructL(); |
|
42 |
CleanupStack::Pop( self ); |
|
43 |
return self; |
|
44 |
} |
|
45 |
||
46 |
// --------------------------------------------------------------------------- |
|
47 |
// Destructor. |
|
48 |
// --------------------------------------------------------------------------- |
|
49 |
// |
|
50 |
CDunDownstream::~CDunDownstream() |
|
51 |
{ |
|
52 |
FTRACE(FPrint( _L("CDunDownstream::~CDunDownstream()" ))); |
|
53 |
ResetData(); |
|
54 |
FTRACE(FPrint( _L("CDunDownstream::~CDunDownstream() complete" ))); |
|
55 |
} |
|
56 |
||
57 |
// --------------------------------------------------------------------------- |
|
58 |
// Resets data to initial values |
|
59 |
// --------------------------------------------------------------------------- |
|
60 |
// |
|
61 |
void CDunDownstream::ResetData() |
|
62 |
{ |
|
63 |
// APIs affecting this: |
|
64 |
// IssueRequest() |
|
65 |
Stop(); |
|
66 |
// InitializeForDataPushing() |
|
67 |
delete iPushData.iDataPusher; |
|
68 |
iPushData.iDataPusher = NULL; |
|
69 |
// AddConnMonCallbackL() |
|
70 |
iCallbacksR.Close(); |
|
71 |
iCallbacksW.Close(); |
|
72 |
// AddSkippedErrorL() |
|
73 |
iOkErrorsR.Close(); |
|
74 |
iOkErrorsW.Close(); |
|
75 |
// Internal |
|
76 |
Initialize(); |
|
77 |
} |
|
78 |
||
79 |
// --------------------------------------------------------------------------- |
|
80 |
// Initializes this stream for AT command notifications |
|
81 |
// --------------------------------------------------------------------------- |
|
82 |
// |
|
83 |
TInt CDunDownstream::InitializeForDataPushing( |
|
84 |
MDunAtCmdHandler* aAtCmdHandler ) |
|
85 |
{ |
|
86 |
FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing()" ) )); |
|
87 |
if ( iPushData.iDataPusher || iPushData.iAtCmdHandler ) // optional |
|
88 |
{ |
|
89 |
FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() (already exists) complete" ) )); |
|
90 |
return KErrAlreadyExists; |
|
91 |
} |
|
92 |
if ( !aAtCmdHandler ) |
|
93 |
{ |
|
94 |
FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() (aAtCmdHandler) not initialized!" ) )); |
|
95 |
return KErrGeneral; |
|
96 |
} |
|
97 |
CDunDataPusher* dataPusher = NULL; |
|
98 |
TRAPD( retTrap, dataPusher = CDunDataPusher::NewL(*this,this) ); |
|
99 |
if ( retTrap != KErrNone ) |
|
100 |
{ |
|
101 |
FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() (trapped!) complete" ) )); |
|
102 |
return retTrap; |
|
103 |
} |
|
104 |
if ( iComm ) |
|
105 |
{ |
|
106 |
dataPusher->SetMedia( iComm ); |
|
107 |
} |
|
108 |
else if ( iSocket ) |
|
109 |
{ |
|
110 |
dataPusher->SetMedia( iSocket ); |
|
111 |
} |
|
112 |
iPushData.iDataPusher = dataPusher; |
|
113 |
iPushData.iAtCmdHandler = aAtCmdHandler; |
|
114 |
FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() complete" ) )); |
|
115 |
return KErrNone; |
|
116 |
} |
|
117 |
||
118 |
// --------------------------------------------------------------------------- |
|
119 |
// Checks if data is in queue |
|
120 |
// --------------------------------------------------------------------------- |
|
121 |
// |
|
122 |
TBool CDunDownstream::IsDataInQueue( const TDesC8* aDataToPush ) |
|
123 |
{ |
|
124 |
FTRACE(FPrint( _L("CDunDownstream::IsDataInQueue()" ) )); |
|
125 |
if ( !iPushData.iDataPusher ) |
|
126 |
{ |
|
127 |
FTRACE(FPrint( _L("CDunDownstream::IsDataInQueue() (iPushData.iDataPusher not initialized!) complete" ))); |
|
128 |
return EFalse; |
|
129 |
} |
|
130 |
TInt foundIndex = iPushData.iDataPusher->FindEventFromQueue( aDataToPush ); |
|
131 |
FTRACE(FPrint( _L("CDunDownstream::IsDataInQueue() complete" ) )); |
|
132 |
return ( foundIndex >= 0 ) ? ETrue : EFalse; |
|
133 |
} |
|
134 |
||
135 |
// --------------------------------------------------------------------------- |
|
136 |
// Adds data to event queue and starts sending if needed |
|
137 |
// --------------------------------------------------------------------------- |
|
138 |
// |
|
139 |
TInt CDunDownstream::AddToQueueAndSend( const TDesC8* aDataToPush, |
|
140 |
MDunCompletionReporter* aCallback ) |
|
141 |
{ |
|
142 |
FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend()" ) )); |
|
143 |
if ( !iPushData.iDataPusher ) |
|
144 |
{ |
|
145 |
FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() (iPushData.iDataPusher not initialized!) complete" ))); |
|
146 |
return KErrGeneral; |
|
147 |
} |
|
148 |
// Add to event queue. If something went wrong, just return |
|
149 |
TInt retTemp = iPushData.iDataPusher->AddToEventQueue( aDataToPush, aCallback ); |
|
150 |
if ( retTemp != KErrNone ) |
|
151 |
{ |
|
152 |
FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() (ERROR) complete" ))); |
|
153 |
return retTemp; |
|
154 |
} |
|
155 |
// Now push the data. If already active, push will start later, if not |
|
156 |
// active it will start immediately. |
|
157 |
iPushData.iDataPusher->SendQueuedData(); |
|
158 |
FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() complete" ) )); |
|
159 |
return KErrNone; |
|
160 |
} |
|
161 |
||
162 |
// --------------------------------------------------------------------------- |
|
163 |
// Starts downstream by issuing read request |
|
164 |
// --------------------------------------------------------------------------- |
|
165 |
// |
|
166 |
TInt CDunDownstream::StartStream() |
|
167 |
{ |
|
168 |
FTRACE(FPrint( _L("CDunDownstream::StartStream()" ) )); |
|
169 |
FTRACE(FPrint( _L("CDunDownstream::StartStream() (buffer=0x%08X)" ), iBufferPtr )); |
|
170 |
// Note: only start URC here. |
|
171 |
// The downstream read request is started when command mode ends. |
|
172 |
// This is done to make the data arrive in the correct order (reply vs. |
|
173 |
// data) with "ATD" command. |
|
174 |
TInt retVal = KErrNone; |
|
175 |
if ( iPushData.iAtCmdHandler ) |
|
176 |
{ |
|
177 |
retVal = iPushData.iAtCmdHandler->StartUrc(); |
|
178 |
} |
|
179 |
FTRACE(FPrint( _L("CDunDownstream::StartStream() complete" ) )); |
|
180 |
return retVal; |
|
181 |
} |
|
182 |
||
183 |
// --------------------------------------------------------------------------- |
|
184 |
// Stops transfer for read or write endpoints |
|
185 |
// --------------------------------------------------------------------------- |
|
186 |
// |
|
187 |
TInt CDunDownstream::Stop( TBool aStopMplex ) |
|
188 |
{ |
|
189 |
FTRACE(FPrint( _L("CDunDownstream::Stop() (Dir=%d)" ), iDirection)); |
|
190 |
if ( !iPushData.iDataPusher ) |
|
191 |
{ |
|
192 |
FTRACE(FPrint( _L("CDunDownstream::Stop() (iPushData.iDatapusher not initialized!) complete" ))); |
|
193 |
return KErrGeneral; |
|
194 |
} |
|
195 |
// Stop the downstream related AT command handling functionality |
|
196 |
if ( aStopMplex ) // optional |
|
197 |
{ |
|
198 |
if ( iPushData.iAtCmdHandler ) |
|
199 |
{ |
|
200 |
iPushData.iAtCmdHandler->StopAtCmdHandling(); |
|
201 |
} |
|
202 |
// Stop the multiplexer separately |
|
203 |
iPushData.iDataPusher->Stop(); |
|
204 |
} |
|
205 |
if ( iTransferState != EDunStateTransferring ) |
|
206 |
{ |
|
207 |
FTRACE(FPrint( _L("CDunDownstream::Stop() (not ready) complete" ))); |
|
208 |
return KErrNotReady; |
|
209 |
} |
|
210 |
// Stop only current operation |
|
211 |
if ( iOperationType == EDunOperationTypeRead ) |
|
212 |
{ |
|
213 |
if ( iNetwork ) |
|
214 |
{ |
|
215 |
iNetwork->ReadCancel(); |
|
216 |
Cancel(); |
|
217 |
FTRACE(FPrint( _L("CDunDownstream::Stop() (Network) cancelled" ))); |
|
218 |
} |
|
219 |
} |
|
220 |
else if ( iOperationType == EDunOperationTypeWrite ) |
|
221 |
{ |
|
222 |
iPushData.iDataPusher->StopOneEvent( iBufferPtr ); |
|
223 |
} |
|
224 |
iTransferState = EDunStateIdle; |
|
44
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
225 |
iOperationType = EDunOperationTypeUndefined; |
40 | 226 |
FTRACE(FPrint( _L("CDunDownstream::Stop() complete" ))); |
227 |
return KErrNone; |
|
228 |
} |
|
229 |
||
230 |
// --------------------------------------------------------------------------- |
|
231 |
// CDunDownstream::CDunDownstream |
|
232 |
// --------------------------------------------------------------------------- |
|
233 |
// |
|
234 |
CDunDownstream::CDunDownstream( MDunTransporterUtilityAux* aUtility ) : |
|
235 |
iUtility( aUtility ) |
|
236 |
{ |
|
237 |
Initialize(); |
|
238 |
} |
|
239 |
||
240 |
// --------------------------------------------------------------------------- |
|
241 |
// CDunDownstream::ConstructL |
|
242 |
// --------------------------------------------------------------------------- |
|
243 |
// |
|
244 |
void CDunDownstream::ConstructL() |
|
245 |
{ |
|
246 |
FTRACE(FPrint( _L("CDunDownstream::ConstructL()" ) )); |
|
247 |
if ( !iUtility ) |
|
248 |
{ |
|
249 |
User::Leave( KErrGeneral ); |
|
250 |
} |
|
251 |
FTRACE(FPrint( _L("CDunDownstream::ConstructL() complete" ) )); |
|
252 |
} |
|
253 |
||
254 |
// --------------------------------------------------------------------------- |
|
255 |
// Initializes this class |
|
256 |
// --------------------------------------------------------------------------- |
|
257 |
// |
|
258 |
void CDunDownstream::Initialize() |
|
259 |
{ |
|
260 |
// Don't initialize iUtility here (it is set through NewL) |
|
261 |
iPushData.iDataMode = EFalse; |
|
262 |
iPushData.iDataPusher = NULL; |
|
263 |
iPushData.iAtCmdHandler = NULL; |
|
264 |
} |
|
265 |
||
266 |
// --------------------------------------------------------------------------- |
|
267 |
// Issues transfer request for this stream |
|
268 |
// --------------------------------------------------------------------------- |
|
269 |
// |
|
270 |
TInt CDunDownstream::IssueRequest() |
|
271 |
{ |
|
272 |
// Set direction |
|
273 |
iDirection = static_cast<TDunDirection>( EDunStreamTypeDownstream | iOperationType ); |
|
274 |
||
275 |
FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (Dir=%d)" ), iDirection)); |
|
276 |
if ( !iPushData.iDataPusher ) |
|
277 |
{ |
|
278 |
FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (iPushData.iDataPusher not initialized!) complete" ) )); |
|
279 |
return KErrGeneral; |
|
280 |
} |
|
281 |
||
282 |
if ( iTransferState != EDunStateIdle ) |
|
283 |
{ |
|
284 |
FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (not ready) complete" ) )); |
|
285 |
return KErrNotReady; |
|
286 |
} |
|
287 |
||
288 |
if ( iOperationType == EDunOperationTypeRead ) |
|
289 |
{ |
|
290 |
iBufferPtr->SetLength( iBufferPtr->MaxLength() ); |
|
291 |
FTRACE(FPrint( _L("CDunDownstream::IssueRequest() trying to read %d bytes... (Dir=%d)" ), iBufferPtr->Length(), iDirection)); |
|
292 |
} |
|
293 |
else // iOperationType == EDunOperationTypeWrite |
|
294 |
{ |
|
295 |
FTRACE(FPrint( _L("CDunDownstream::IssueRequest() writing %d bytes... (Dir=%d)" ), iBufferPtr->Length(), iDirection)); |
|
296 |
} |
|
297 |
||
298 |
switch ( iDirection ) |
|
299 |
{ |
|
300 |
case EDunReaderDownstream: |
|
301 |
iStatus = KRequestPending; |
|
44
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
302 |
iTransferState = EDunStateTransferring; |
40 | 303 |
iNetwork->ReadOneOrMore( iStatus, *iBufferPtr ); |
304 |
SetActive(); |
|
305 |
FTRACE(FPrint( _L("CDunDownstream::IssueRequest() RComm ReadOneOrMore() requested" ) )); |
|
306 |
break; |
|
307 |
case EDunWriterDownstream: |
|
44
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
308 |
iTransferState = EDunStateTransferring; |
40 | 309 |
AddToQueueAndSend( iBufferPtr, this ); |
310 |
break; |
|
311 |
default: |
|
312 |
FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (ERROR) complete" ) )); |
|
313 |
return KErrGeneral; |
|
314 |
} |
|
315 |
||
316 |
FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (Dir=%d) complete" ), iDirection)); |
|
317 |
return KErrNone; |
|
318 |
} |
|
319 |
||
320 |
// --------------------------------------------------------------------------- |
|
321 |
// From class CActive. |
|
322 |
// Gets called when endpoint data read complete |
|
323 |
// --------------------------------------------------------------------------- |
|
324 |
// |
|
325 |
void CDunDownstream::RunL() |
|
326 |
{ |
|
327 |
FTRACE(FPrint( _L("CDunDownstream::RunL() (Dir=%d)" ), iDirection)); |
|
328 |
iTransferState = EDunStateIdle; |
|
329 |
if ( iOperationType != EDunOperationTypeRead ) |
|
330 |
{ |
|
331 |
FTRACE(FPrint( _L("CDunDownstream::RunL() (wrong operation type!) complete" ))); |
|
332 |
return; |
|
333 |
} |
|
334 |
||
335 |
TBool isError; |
|
336 |
TInt retTemp = iStatus.Int(); |
|
337 |
TInt stop = ProcessErrorCondition( retTemp, isError ); |
|
338 |
||
339 |
if ( !stop ) // no real error detected -> continue |
|
340 |
{ |
|
341 |
if ( !isError ) |
|
342 |
{ |
|
343 |
// Operation type was read so now set to write |
|
344 |
iOperationType = EDunOperationTypeWrite; |
|
345 |
} // if ( !isError ) |
|
346 |
||
347 |
IssueRequest(); |
|
348 |
||
349 |
} // if ( !stop ) |
|
350 |
else // stop -> tear down connection |
|
351 |
{ |
|
352 |
// Now CDunDataPusher notifies to write case so here we just notify the |
|
353 |
// read case. |
|
354 |
TDunConnectionReason connReason; |
|
355 |
connReason.iReasonType = EDunReasonTypeRW; |
|
356 |
connReason.iContext = GetMediaContext( EDunStreamTypeDownstream ); |
|
357 |
connReason.iSignalType = 0; |
|
358 |
connReason.iSignalHigh = EFalse; |
|
359 |
connReason.iDirection = iDirection; |
|
360 |
connReason.iErrorCode = retTemp; |
|
361 |
iUtility->DoNotifyConnectionNotOk( iComm, |
|
362 |
iSocket, |
|
363 |
connReason, |
|
364 |
iCallbacksR ); |
|
365 |
FTRACE(FPrint( _L("CDunDownstream::RunL() stop" ))); |
|
366 |
} // else |
|
367 |
||
368 |
FTRACE(FPrint( _L("CDunDownstream::RunL() complete" ))); |
|
369 |
} |
|
370 |
||
371 |
// --------------------------------------------------------------------------- |
|
372 |
// From class CActive. |
|
373 |
// Gets called on cancel |
|
374 |
// --------------------------------------------------------------------------- |
|
375 |
// |
|
376 |
void CDunDownstream::DoCancel() |
|
377 |
{ |
|
44
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
378 |
FTRACE(FPrint( _L("CDunDownstream::DoCancel()" ))); |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
379 |
FTRACE(FPrint( _L("CDunDownstream::DoCancel() complete" ))); |
40 | 380 |
} |
381 |
||
382 |
// --------------------------------------------------------------------------- |
|
383 |
// From class MDunStreamManipulator. |
|
384 |
// Gets called when outside party wants to push data to the existing stream |
|
385 |
// --------------------------------------------------------------------------- |
|
386 |
// |
|
387 |
TInt CDunDownstream::NotifyDataPushRequest( const TDesC8* aDataToPush, |
|
388 |
MDunCompletionReporter* aCallback ) |
|
389 |
{ |
|
390 |
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest()" ))); |
|
391 |
// If in data mode push the reply anyway as "CONNECT" or "NO CARRIER" |
|
392 |
// reply could arrive before/after the command mode information itself. |
|
393 |
TInt retVal = AddToQueueAndSend( aDataToPush, aCallback ); |
|
394 |
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest() complete" ))); |
|
395 |
return retVal; |
|
396 |
} |
|
397 |
||
398 |
// --------------------------------------------------------------------------- |
|
399 |
// From class MDunCompletionReporter. |
|
400 |
// Gets called when data push is complete |
|
401 |
// --------------------------------------------------------------------------- |
|
402 |
// |
|
403 |
void CDunDownstream::NotifyDataPushComplete( TBool aAllPushed ) |
|
404 |
{ |
|
405 |
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete()" ))); |
|
406 |
// Next just skip the notifications of atomic operations because also this |
|
407 |
// class initiates the pushing of atomic data. |
|
408 |
if ( !aAllPushed ) |
|
409 |
{ |
|
410 |
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (continue) complete" ))); |
|
411 |
return; |
|
412 |
} |
|
413 |
if ( !iPushData.iDataPusher ) |
|
414 |
{ |
|
415 |
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (iPushData.iDataPusher not initialized!) complete" ))); |
|
416 |
return; |
|
417 |
} |
|
418 |
// Now the multiplexer might have pushed the contained data in this class |
|
419 |
// or it might have pushed only the external data. If the pushed data |
|
420 |
// contains this classes data then reissue request, otherwise just clear |
|
421 |
// the queue. |
|
422 |
TInt foundIndex = iPushData.iDataPusher->FindEventFromQueue( iBufferPtr ); |
|
423 |
iPushData.iDataPusher->SignalCompletionAndClearQueue(); |
|
424 |
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (find event)" ))); |
|
425 |
if ( foundIndex >= 0 ) |
|
426 |
{ |
|
44
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
427 |
iTransferState = EDunStateIdle; |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
428 |
iOperationType = EDunOperationTypeUndefined; |
40 | 429 |
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (issue request)" ))); |
430 |
if ( iPushData.iDataMode ) |
|
431 |
{ |
|
432 |
iOperationType = EDunOperationTypeRead; |
|
433 |
IssueRequest(); |
|
434 |
} |
|
435 |
} |
|
436 |
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() complete" ))); |
|
437 |
} |
|
438 |
||
439 |
// --------------------------------------------------------------------------- |
|
440 |
// From class MDunCmdModeMonitor. |
|
441 |
// Notifies about command mode start |
|
442 |
// --------------------------------------------------------------------------- |
|
443 |
// |
|
444 |
void CDunDownstream::NotifyCommandModeStart() |
|
445 |
{ |
|
446 |
FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart()" ))); |
|
447 |
iPushData.iDataMode = EFalse; |
|
44
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
448 |
// Now the data mode has ended. If read operation then cancel it. |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
449 |
// Check for iTransferState here to minimize logging |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
450 |
if ( iTransferState==EDunStateTransferring && |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
451 |
iOperationType==EDunOperationTypeRead ) |
40 | 452 |
{ |
453 |
Stop( EFalse ); |
|
454 |
} |
|
455 |
FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart() complete" ))); |
|
456 |
} |
|
457 |
||
458 |
// --------------------------------------------------------------------------- |
|
459 |
// From class MDunCmdModeMonitor. |
|
460 |
// Notifies about command mode end |
|
461 |
// --------------------------------------------------------------------------- |
|
462 |
// |
|
463 |
void CDunDownstream::NotifyCommandModeEnd() |
|
464 |
{ |
|
465 |
FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd()" ))); |
|
466 |
iPushData.iDataMode = ETrue; |
|
44
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
467 |
// Command mode ends here so start reading from Dataport only if generic |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
468 |
// transferring state is EDunStateIdle. This is a reduced form of having |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
469 |
// read pending -> reissue not needed OR write pending -> reissue not needed |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
470 |
// (NotifyDataPushComplete() will reissue). |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
471 |
if ( iTransferState == EDunStateIdle ) |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
472 |
{ |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
473 |
iOperationType = EDunOperationTypeRead; // just in case |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
474 |
IssueRequest(); |
7a45d2ea2f56
Revision: 201038
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
475 |
} |
40 | 476 |
FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd() complete" ))); |
477 |
} |