localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp
branchRCL_3
changeset 38 3dcb815346df
parent 23 27dcfaab8b5b
equal deleted inserted replaced
37:7e0ecb5b116a 38:3dcb815346df
   101 
   101 
   102 // ---------------------------------------------------------------------------
   102 // ---------------------------------------------------------------------------
   103 // Starts AT command handling
   103 // Starts AT command handling
   104 // ---------------------------------------------------------------------------
   104 // ---------------------------------------------------------------------------
   105 //
   105 //
   106 TInt CDunAtCmdPusher::IssueRequest( TDesC8& aCommand, TBool aNormalMode )
   106 TInt CDunAtCmdPusher::IssueRequest( TDesC8& aInput, TBool aNormalMode )
   107     {
   107     {
   108     FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest()") ));
   108     FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest()") ));
   109     FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() send ATEXT:") ));
   109     FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() send ATEXT:") ));
   110     FTRACE(FPrintRaw(aCommand) );
   110     FTRACE(FPrintRaw(aInput) );
   111     if ( iAtPushState!=EDunStateIdle && aNormalMode )
   111     if ( iAtPushState!=EDunStateIdle && aNormalMode )
   112         {
   112         {
   113         FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() (not ready) complete") ));
   113         FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() (not ready) complete") ));
   114         return KErrNotReady;
   114         return KErrNotReady;
   115         }
   115         }
       
   116     if ( iDownstream->IsDataInQueue(&iRecvBuffer) )
       
   117         {
       
   118         FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() (in queue!) complete") ));
       
   119         return KErrGeneral;
       
   120         }
   116     iStatus = KRequestPending;
   121     iStatus = KRequestPending;
   117     iAtCmdExt->HandleCommand( iStatus,
   122     iAtCmdExt->HandleCommand( iStatus,
   118                               aCommand,
   123                               aInput,
   119                               iRecvBuffer,
   124                               iRecvBuffer,
   120                               iReplyLeftPckg,
   125                               iReplyLeftPckg,
   121                               iReplyTypePckg );
   126                               iReplyTypePckg );
   122     SetActive();
   127     SetActive();
   123     iAtPushState = EDunStateAtCmdPushing;
   128     iAtPushState = EDunStateAtCmdPushing;
   130 // ---------------------------------------------------------------------------
   135 // ---------------------------------------------------------------------------
   131 //
   136 //
   132 TInt CDunAtCmdPusher::Stop()
   137 TInt CDunAtCmdPusher::Stop()
   133     {
   138     {
   134     FTRACE(FPrint( _L("CDunAtCmdPusher::Stop()") ));
   139     FTRACE(FPrint( _L("CDunAtCmdPusher::Stop()") ));
       
   140     SetEndOfCmdLine();
   135     if ( iAtPushState != EDunStateAtCmdPushing )
   141     if ( iAtPushState != EDunStateAtCmdPushing )
   136         {
   142         {
   137         FTRACE(FPrint( _L("CDunAtCmdHandler::Stop() (not ready) complete" )));
   143         FTRACE(FPrint( _L("CDunAtCmdHandler::Stop() (not ready) complete" )));
   138         return KErrNotReady;
   144         return KErrNotReady;
   139         }
   145         }
   140     // As the EDunStateAtCmdHandling can be set even when the actual request
   146     // As the EDunStateAtCmdHandling can be set even when the actual request
   141     // has completed (when replying with NotifyDataPushComplete() and setting
   147     // has completed (when replying with NotifyDataPushComplete() and setting
   142     // idle eventually), cancel the actual operation in DoCancel()
   148     // idle eventually), cancel the actual operation in DoCancel()
   143     Cancel();
   149     Cancel();
   144     iAtPushState = EDunStateIdle;
   150     iAtPushState = EDunStateIdle;
   145     SetEndOfCmdLine();
       
   146     FTRACE(FPrint( _L("CDunAtCmdPusher::Stop() complete") ));
   151     FTRACE(FPrint( _L("CDunAtCmdPusher::Stop() complete") ));
   147     return KErrNone;
   152     return KErrNone;
   148     }
   153     }
   149 
   154 
   150 // ---------------------------------------------------------------------------
   155 // ---------------------------------------------------------------------------
   478     {
   483     {
   479     FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete()") ));
   484     FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete()") ));
   480     // First check if error or stop condition detected
   485     // First check if error or stop condition detected
   481     if ( iReplyType==EReplyTypeError || iStop )
   486     if ( iReplyType==EReplyTypeError || iStop )
   482         {
   487         {
       
   488         SetEndOfCmdLine();
       
   489         iAtPushState = EDunStateIdle;
   483         iCallback->NotifyEndOfCmdLineProcessing();
   490         iCallback->NotifyEndOfCmdLineProcessing();
   484         iAtPushState = EDunStateIdle;
       
   485         FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete() (error reply) complete") ));
   491         FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete() (error reply) complete") ));
   486         return;
   492         return;
   487         }
   493         }
   488     // Secondly check only the case where push restart is required
   494     // Secondly check only the case where push restart is required
   489     if ( iReplyType==EReplyTypeOther && iReplyBytesLeft>0 )
   495     if ( iReplyType==EReplyTypeOther && iReplyBytesLeft>0 )