localconnectivityservice/dun/utils/src/DunUpstream.cpp
branchRCL_3
changeset 19 0aa8cc770c8a
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
       
     1 /*
       
     2 * Copyright (c) 2008-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  * TODO: When local media is of type RComm, listening on it is started with
       
    20  * RComm::NotifyDataAvailable() call. Check that USB ACM port and Irda RCOMM
       
    21  * (and any other new media in the future) behaves correctly so that when
       
    22  * RComm::ReadOneOrMore() is issued, the read is issued immediately without
       
    23  * checking for new data. If waiting for new data happens in this
       
    24  * NotifyDataAvailable/ReadOneOrMore combination, raise a defect to Symbian.
       
    25  */
       
    26 
       
    27 #include "DunTransporter.h"
       
    28 #include "DunUpstream.h"
       
    29 #include "DunDebug.h"
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // Two-phased constructor.
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CDunUpstream* CDunUpstream::NewL( MDunTransporterUtilityAux* aUtility )
       
    36     {
       
    37     CDunUpstream* self = new (ELeave) CDunUpstream( aUtility );
       
    38     CleanupStack::PushL( self );
       
    39     self->ConstructL();
       
    40     CleanupStack::Pop( self );
       
    41     return self;
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // Destructor.
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CDunUpstream::~CDunUpstream()
       
    49     {
       
    50     FTRACE(FPrint( _L("CDunUpstream::~CDunUpstream()" )));
       
    51     ResetData();
       
    52     FTRACE(FPrint( _L("CDunUpstream::~CDunUpstream() complete" )));
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // Resets data to initial values
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 void CDunUpstream::ResetData()
       
    60     {
       
    61     // APIs affecting this:
       
    62     // IssueRequest()
       
    63     Stop();
       
    64     // InitializeForAtParsing()
       
    65     delete iParseData.iAtCmdHandler;
       
    66     iParseData.iAtCmdHandler = NULL;
       
    67     // AddConnMonCallbackL()
       
    68     iCallbacksR.Close();
       
    69     iCallbacksW.Close();
       
    70     // AddSkippedErrorL()
       
    71     iOkErrorsR.Close();
       
    72     iOkErrorsW.Close();
       
    73     // Internal
       
    74     Initialize();
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // Sets activity callback for this stream
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 TInt CDunUpstream::SetActivityCallback(
       
    82     MDunActivityManager* aActivityCallback )
       
    83     {
       
    84     if ( !aActivityCallback )
       
    85         {
       
    86         FTRACE(FPrint( _L("CDunUpstream::SetActivityCallback() (aActivityCallback) not initialized!" ) ));
       
    87         return KErrGeneral;
       
    88         }
       
    89     if ( iActivityData.iActivityCallback )
       
    90         {
       
    91         FTRACE(FPrint( _L("CDunUpstream::SetActivityCallback() (already exists) complete" ) ));
       
    92         return KErrAlreadyExists;
       
    93         }
       
    94     iActivityData.iActivityCallback = aActivityCallback;
       
    95     return KErrNone;
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // Initializes this stream for AT command notifications
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 TInt CDunUpstream::InitializeForAtParsing(
       
   103     MDunStreamManipulator* aStreamCallback,
       
   104     const TDesC8* aConnectionName,
       
   105     MDunCmdModeMonitor* aCallbackUp,
       
   106     MDunCmdModeMonitor* aCallbackDown )
       
   107     {
       
   108     FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing()" ) ));
       
   109     if ( iParseData.iAtCmdHandler )
       
   110         {
       
   111         FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing() (already exists) complete" ) ));
       
   112         return KErrAlreadyExists;
       
   113         }
       
   114     TInt retTrap = KErrNone;
       
   115     CDunAtCmdHandler* atCmdHandler = NULL;
       
   116     TRAP( retTrap, atCmdHandler = CDunAtCmdHandler::NewL(this,
       
   117                                                          aStreamCallback,
       
   118                                                          aConnectionName) );
       
   119     if ( retTrap != KErrNone )
       
   120         {
       
   121         FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing() (trapped!) complete" ) ));
       
   122         return retTrap;
       
   123         }
       
   124     atCmdHandler->AddCmdModeCallback( aCallbackUp );
       
   125     atCmdHandler->AddCmdModeCallback( aCallbackDown );
       
   126     iParseData.iDataMode = EFalse;
       
   127     iParseData.iAtCmdHandler = atCmdHandler;
       
   128     FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing() complete" ) ));
       
   129     return KErrNone;
       
   130     }
       
   131 
       
   132 // ---------------------------------------------------------------------------
       
   133 // Starts upstream by issuing read request
       
   134 // ---------------------------------------------------------------------------
       
   135 //
       
   136 TInt CDunUpstream::StartStream()
       
   137     {
       
   138     FTRACE(FPrint( _L("CDunUpstream::StartStream()" ) ));
       
   139     if ( !iNetwork )
       
   140         {
       
   141         FTRACE(FPrint( _L("CDunUpstream::StartStream() (iNetwork) not initialized!" ) ));
       
   142         return KErrGeneral;
       
   143         }
       
   144     if ( !iComm && !iSocket )
       
   145         {
       
   146         FTRACE(FPrint( _L("CDunUpstream::StartStream() (iComm&iSocket) not initialized!" ) ));
       
   147         return KErrGeneral;
       
   148         }
       
   149     iOperationType = EDunOperationTypeRead;
       
   150     TInt retVal = IssueRequest();
       
   151     FTRACE(FPrint( _L("CDunUpstream::StartStream() complete" ) ));
       
   152     return retVal;
       
   153     }
       
   154 
       
   155 // ---------------------------------------------------------------------------
       
   156 // Stops transfer for read or write endpoints
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 TInt CDunUpstream::Stop()
       
   160     {
       
   161     FTRACE(FPrint( _L("CDunUpstream::Stop() (Dir=%d)" ), iDirection));
       
   162     // Don't stop CDunAtCmdHandler here as it is downstream related!
       
   163     if ( iTransferState != EDunStateTransferring )
       
   164         {
       
   165         FTRACE(FPrint( _L("CDunUpstream::Stop() (not ready) complete" )));
       
   166         return KErrNotReady;
       
   167         }
       
   168     // Stop only current operation
       
   169     if ( iOperationType == EDunOperationTypeRead )
       
   170         {
       
   171         if ( iComm )
       
   172             {
       
   173             iComm->ReadCancel();
       
   174             FTRACE(FPrint( _L("CDunUpstream::Stop() (RComm) cancelled" )));
       
   175             }
       
   176         else if ( iSocket )
       
   177             {
       
   178             iSocket->CancelRecv();
       
   179             FTRACE(FPrint( _L("CDunUpstream::Stop() (RSocket) cancelled" )));
       
   180             }
       
   181         }
       
   182     else if ( iOperationType == EDunOperationTypeWrite )
       
   183         {
       
   184         if ( iNetwork )
       
   185             {
       
   186             iNetwork->WriteCancel();
       
   187             FTRACE(FPrint( _L("CDunUpstream::Stop() (Network) cancelled" )));
       
   188             }
       
   189         }
       
   190     Cancel();
       
   191     iTransferState = EDunStateIdle;
       
   192     // Notify parent about inactivity
       
   193     if ( iActivityData.iActivityCallback && iActivityData.iNotified )
       
   194         {
       
   195         iActivityData.iActivityCallback->NotifyChannelInactivity();
       
   196         iActivityData.iNotified = EFalse;
       
   197         }
       
   198     FTRACE(FPrint( _L("CDunUpstream::Stop() complete" )));
       
   199     return KErrNone;
       
   200     }
       
   201 
       
   202 // ---------------------------------------------------------------------------
       
   203 // Data transmission state (if read completed)
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 TBool CDunUpstream::DataReadStatus()
       
   207     {
       
   208     return iActivityData.iDataRead;
       
   209     }
       
   210 
       
   211 // ---------------------------------------------------------------------------
       
   212 // CDunUpstream::CDunUpstream
       
   213 // ---------------------------------------------------------------------------
       
   214 //
       
   215 CDunUpstream::CDunUpstream( MDunTransporterUtilityAux* aUtility ) :
       
   216     iUtility( aUtility )
       
   217     {
       
   218     Initialize();
       
   219     }
       
   220 
       
   221 // ---------------------------------------------------------------------------
       
   222 // CDunUpstream::ConstructL
       
   223 // ---------------------------------------------------------------------------
       
   224 //
       
   225 void CDunUpstream::ConstructL()
       
   226     {
       
   227     FTRACE(FPrint( _L("CDunUpstream::ConstructL()" ) ));
       
   228     if ( !iUtility )
       
   229         {
       
   230         User::Leave( KErrGeneral );
       
   231         }
       
   232     FTRACE(FPrint( _L("CDunUpstream::ConstructL() complete" ) ));
       
   233     }
       
   234 
       
   235 // ---------------------------------------------------------------------------
       
   236 // Initializes this class
       
   237 // ---------------------------------------------------------------------------
       
   238 //
       
   239 void CDunUpstream::Initialize()
       
   240     {
       
   241     // Don't initialize iUtility here (it is set through NewL)
       
   242     iActivityData.iActivityCallback = NULL;
       
   243     iActivityData.iDataRead = EFalse;
       
   244     iActivityData.iNotified = EFalse;
       
   245     iParseData.iDataMode = EFalse;
       
   246     iParseData.iAtCmdHandler = NULL;
       
   247     }
       
   248 
       
   249 // ---------------------------------------------------------------------------
       
   250 // Issues transfer request for this stream
       
   251 // ---------------------------------------------------------------------------
       
   252 //
       
   253 TInt CDunUpstream::IssueRequest()
       
   254     {
       
   255     // Set direction
       
   256     iDirection = static_cast<TDunDirection>( EDunStreamTypeUpstream | iOperationType );
       
   257 
       
   258     FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (Dir=%d)" ), iDirection));
       
   259 
       
   260     if ( iTransferState != EDunStateIdle )
       
   261         {
       
   262         FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (not ready) complete" ) ));
       
   263         return KErrNotReady;
       
   264         }
       
   265 
       
   266     if ( iOperationType == EDunOperationTypeRead )
       
   267         {
       
   268         iBufferPtr->SetLength( iBufferPtr->MaxLength() );
       
   269         FTRACE(FPrint( _L("CDunUpstream::IssueRequest() trying to read %d bytes... (Dir=%d)" ), iBufferPtr->Length(), iDirection));
       
   270         }
       
   271     else // iOperationType == EDunOperationTypeWrite
       
   272         {
       
   273         FTRACE(FPrint( _L("CDunUpstream::IssueRequest() writing %d bytes... (Dir=%d)" ), iBufferPtr->Length(), iDirection));
       
   274         }
       
   275 
       
   276     switch ( iDirection )
       
   277         {
       
   278         case EDunReaderUpstream:
       
   279             if ( iComm )
       
   280                 {
       
   281                 iStatus = KRequestPending;
       
   282                 iComm->ReadOneOrMore( iStatus, *iBufferPtr );
       
   283                 FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RComm ReadOneOrMore() requested" ) ));
       
   284                 }
       
   285             else if ( iSocket )
       
   286                 {
       
   287                 iStatus = KRequestPending;
       
   288                 iSocket->RecvOneOrMore( *iBufferPtr, 0, iStatus, iReadLengthSocket );
       
   289                 FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RSocket RecvOneOrMore() requested" ) ));
       
   290                 }
       
   291             else
       
   292                 {
       
   293                 FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (ERROR) complete" ) ));
       
   294                 return KErrGeneral;
       
   295                 }
       
   296             break;
       
   297         case EDunWriterUpstream:
       
   298             iStatus = KRequestPending;
       
   299             iNetwork->Write( iStatus, *iBufferPtr );
       
   300             FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RComm Write() requested" ) ));
       
   301             break;
       
   302         default:
       
   303             FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (ERROR) complete" ) ));
       
   304             return KErrGeneral;
       
   305         }
       
   306 
       
   307     SetActive();
       
   308     iTransferState = EDunStateTransferring;
       
   309 
       
   310     FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (Dir=%d) complete" ), iDirection));
       
   311     return KErrNone;
       
   312     }
       
   313 
       
   314 // ---------------------------------------------------------------------------
       
   315 // Processes data that was read
       
   316 // ---------------------------------------------------------------------------
       
   317 //
       
   318 TBool CDunUpstream::ProcessReadData()
       
   319     {
       
   320     FTRACE(FPrint( _L("CDunUpstream::ProcessReadData()" )));
       
   321     // The following will be transferred to Dataport
       
   322     if ( iParseData.iDataMode )
       
   323         {
       
   324         iOperationType = EDunOperationTypeWrite;
       
   325         FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (next write) complete" )));
       
   326         return ETrue;
       
   327         }
       
   328     if ( !iParseData.iAtCmdHandler )  // optional
       
   329         {
       
   330         FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (no handler) complete" )));
       
   331         return ETrue;
       
   332         }
       
   333     // The following will be transferred to parser
       
   334     TInt retTemp = KErrNone;
       
   335     TBool moreNeeded = EFalse;
       
   336     retTemp = iParseData.iAtCmdHandler->AddDataForParsing( *iBufferPtr,
       
   337                                                            moreNeeded );
       
   338     if ( retTemp!=KErrNone || !moreNeeded )
       
   339         {
       
   340         // If error or no error but no more data needed, don't reissue
       
   341         FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (no reissue) complete" )));
       
   342         return EFalse;
       
   343         }
       
   344     // If no error and more data needed, reissue
       
   345     FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (reissue) complete" )));
       
   346     return ETrue;
       
   347     }
       
   348 
       
   349 // ---------------------------------------------------------------------------
       
   350 // Manages activity in a channel
       
   351 // ---------------------------------------------------------------------------
       
   352 //
       
   353 TInt CDunUpstream::ManageChannelActivity()
       
   354     {
       
   355     FTRACE(FPrint( _L("CDunUpstream::ManageChannelActivity()" )));
       
   356     if ( iActivityData.iDataRead )
       
   357         {
       
   358         FTRACE(FPrint( _L("CDunUpstream::ManageChannelActivity() (not ready) complete" )));
       
   359         return KErrNotReady;
       
   360         }
       
   361     iActivityData.iDataRead = ETrue;
       
   362     if ( iActivityData.iActivityCallback && !iActivityData.iNotified )
       
   363         {
       
   364         iActivityData.iActivityCallback->NotifyChannelActivity();
       
   365         iActivityData.iNotified = ETrue;
       
   366         }
       
   367     FTRACE(FPrint( _L("CDunUpstream::ManageChannelActivity() complete" )));
       
   368     return KErrNone;
       
   369     }
       
   370 
       
   371 // ---------------------------------------------------------------------------
       
   372 // From class CActive.
       
   373 // Gets called when endpoint data read/write complete
       
   374 // ---------------------------------------------------------------------------
       
   375 //
       
   376 void CDunUpstream::RunL()
       
   377     {
       
   378     FTRACE(FPrint( _L("CDunUpstream::RunL() (Dir=%d)" ), iDirection));
       
   379     iTransferState = EDunStateIdle;
       
   380 
       
   381     TBool isError;
       
   382     TInt retTemp = iStatus.Int();
       
   383     TInt stop = ProcessErrorCondition( retTemp, isError );
       
   384 
       
   385     if ( !stop )  // no real error detected -> continue
       
   386         {
       
   387         TBool reIssue = ETrue;
       
   388         if ( !isError )
       
   389             {
       
   390             if ( iOperationType == EDunOperationTypeRead )
       
   391                 {
       
   392                 ManageChannelActivity();
       
   393                 reIssue = ProcessReadData();
       
   394                 }  // if ( iOperationType == EDunOperationTypeRead )
       
   395             else // iOperationType == EDunOperationTypeWrite
       
   396                 {
       
   397                 iOperationType = EDunOperationTypeRead;
       
   398                 }
       
   399             }  // if ( !isError )
       
   400 
       
   401         if ( reIssue )
       
   402             {
       
   403             IssueRequest();
       
   404             }
       
   405 
       
   406         }  // if ( !stop )
       
   407     else  // stop -> tear down connection
       
   408         {
       
   409         FTRACE(FPrint( _L("CDunUpstream::RunL() stop" )));
       
   410         TDunConnectionReason connReason;
       
   411         connReason.iReasonType = EDunReasonTypeRW;
       
   412         connReason.iContext = GetMediaContext( EDunStreamTypeUpstream );
       
   413         connReason.iSignalType = 0;
       
   414         connReason.iSignalHigh = EFalse;
       
   415         connReason.iDirection = iDirection;
       
   416         connReason.iErrorCode = retTemp;
       
   417         if ( iOperationType == EDunOperationTypeRead )
       
   418             {
       
   419             iUtility->DoNotifyConnectionNotOk( iComm,
       
   420                                                iSocket,
       
   421                                                connReason,
       
   422                                                iCallbacksR );
       
   423             }
       
   424         else  // iOperationType == EDunOperationTypeWrite
       
   425             {
       
   426             iUtility->DoNotifyConnectionNotOk( iComm,
       
   427                                                iSocket,
       
   428                                                connReason,
       
   429                                                iCallbacksW );
       
   430             }
       
   431         }  // else
       
   432 
       
   433     FTRACE(FPrint( _L("CDunUpstream::RunL() complete" )));
       
   434     }
       
   435 
       
   436 // ---------------------------------------------------------------------------
       
   437 // From class CActive.
       
   438 // Gets called on cancel
       
   439 // ---------------------------------------------------------------------------
       
   440 //
       
   441 void CDunUpstream::DoCancel()
       
   442     {
       
   443     }
       
   444 
       
   445 // ---------------------------------------------------------------------------
       
   446 // From class MDunAtCmdStatusReporter
       
   447 // Notifies about parser's need to get more data
       
   448 // ---------------------------------------------------------------------------
       
   449 //
       
   450 void CDunUpstream::NotifyParserNeedsMoreData()
       
   451     {
       
   452     FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData()" )));
       
   453     IssueRequest();  // iOperationType must be read here (don't set)
       
   454     FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData() complete" )));
       
   455     }
       
   456 
       
   457 // ---------------------------------------------------------------------------
       
   458 // From class MDunAtCmdStatusReporter
       
   459 // Notifies about editor mode reply
       
   460 // ---------------------------------------------------------------------------
       
   461 //
       
   462 void CDunUpstream::NotifyEditorModeReply( TBool aStart )
       
   463     {
       
   464     FTRACE(FPrint( _L("CDunUpstream::NotifyEditorModeReply()" )));
       
   465     if ( iParseData.iDataMode )
       
   466         {
       
   467         FTRACE(FPrint( _L("CDunUpstream::NotifyEditorModeReply() (not ready) complete" )));
       
   468         return;
       
   469         }
       
   470     // If start of editor mode then just reissue the read request
       
   471     // If continuation then echo and reissue the read request
       
   472     if ( aStart )
       
   473         {
       
   474         IssueRequest();
       
   475         FTRACE(FPrint( _L("CDunUpstream::NotifyEditorModeReply() (start) complete" )));
       
   476         return;
       
   477         }
       
   478     iParseData.iAtCmdHandler->SendEchoCharacter( iBufferPtr, this );
       
   479     FTRACE(FPrint( _L("CDunUpstream::NotifyEditorModeReply() complete" )));
       
   480     }
       
   481 
       
   482 // ---------------------------------------------------------------------------
       
   483 // From class MDunAtCmdHandler
       
   484 // Starts URC message handling
       
   485 // ---------------------------------------------------------------------------
       
   486 //
       
   487 TInt CDunUpstream::StartUrc()
       
   488     {
       
   489     FTRACE(FPrint( _L("CDunUpstream::StartUrc()" )));
       
   490     TInt retVal = KErrNone;
       
   491     if ( iParseData.iAtCmdHandler )  // optional
       
   492         {
       
   493         retVal = iParseData.iAtCmdHandler->StartUrc();
       
   494         }
       
   495     FTRACE(FPrint( _L("CDunUpstream::StartUrc() complete" )));
       
   496     return retVal;
       
   497     }
       
   498 
       
   499 // ---------------------------------------------------------------------------
       
   500 // From class MDunAtCmdHandler
       
   501 // Stops AT command handling downstream related activity (also URC)
       
   502 // ---------------------------------------------------------------------------
       
   503 //
       
   504 TInt CDunUpstream::StopAtCmdHandling()
       
   505     {
       
   506     FTRACE(FPrint( _L("CDunUpstream::StopAtCmdHandling()" )));
       
   507     TInt retVal = KErrNone;
       
   508     if ( iParseData.iAtCmdHandler )  // optional
       
   509         {
       
   510         retVal = iParseData.iAtCmdHandler->StopUrc();
       
   511         if ( retVal != KErrNone )
       
   512             {
       
   513             iParseData.iAtCmdHandler->Stop();
       
   514             FTRACE(FPrint( _L("CDunUpstream::StopAtCmdHandling() (iAtCmdHandler) complete" )));
       
   515             return retVal;
       
   516             }
       
   517         retVal = iParseData.iAtCmdHandler->Stop();
       
   518         }
       
   519     FTRACE(FPrint( _L("CDunUpstream::StopAtCmdHandling() complete" )));
       
   520     return retVal;
       
   521     }
       
   522 
       
   523 // ---------------------------------------------------------------------------
       
   524 // From class MDunCmdModeMonitor.
       
   525 // Notifies about command mode start
       
   526 // ---------------------------------------------------------------------------
       
   527 //
       
   528 void CDunUpstream::NotifyCommandModeStart()
       
   529     {
       
   530     FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeStart()" )));
       
   531     iParseData.iDataMode = EFalse;
       
   532     // Stop processing (just to be sure).
       
   533     // This will stop any possibly pending operations of
       
   534     // CDunAtCmdHandler and CDunAtUrcHandler. CDunDownstream will take care of
       
   535     // clearing (and stopping) non-callback write queues.
       
   536     StopAtCmdHandling();
       
   537     // Also restart the URC handling after the data mode
       
   538     StartUrc();
       
   539     FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeStart() complete" )));
       
   540     }
       
   541 
       
   542 // ---------------------------------------------------------------------------
       
   543 // From class MDunCmdModeMonitor.
       
   544 // Notifies about command mode end
       
   545 // ---------------------------------------------------------------------------
       
   546 //
       
   547 void CDunUpstream::NotifyCommandModeEnd()
       
   548     {
       
   549     FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeEnd()" )));
       
   550     iParseData.iDataMode = ETrue;
       
   551     // Stop processing (mandatory).
       
   552     // This will stop any possibly pending operations of
       
   553     // CDunAtCmdHandler and CDunAtUrcHandler. CDunDownstream will take care of
       
   554     // clearing (and stopping) non-callback write queues.
       
   555     StopAtCmdHandling();
       
   556     // The follow is needed because stopping the AT command handling here
       
   557     // prevents the subsequent AT command handling notification to reach the
       
   558     // NotifyAtCmdHandlingEnd() in this class (the notification starts from
       
   559     // CDunAtCmdPusher's SetToIdleAndNotifyEnd()).
       
   560     // So here we have to do the block "if ( aStartIndex < 0 )" in function
       
   561     // NotifyAtCmdHandlingEnd().
       
   562     IssueRequest();
       
   563     FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeEnd() complete" )));
       
   564     }
       
   565 
       
   566 // ---------------------------------------------------------------------------
       
   567 // From class MDunAtCmdEchoer.
       
   568 // Notifies about command mode end
       
   569 // ---------------------------------------------------------------------------
       
   570 //
       
   571 void CDunUpstream::NotifyEchoComplete()
       
   572     {
       
   573     FTRACE(FPrint( _L("CDunUpstream::NotifyEchoComplete()" )));
       
   574     IssueRequest();
       
   575     FTRACE(FPrint( _L("CDunUpstream::NotifyEchoComplete() complete" )));
       
   576     }