localconnectivityservice/dun/utils/src/DunDownstream.cpp
branchRCL_3
changeset 38 3dcb815346df
parent 15 c47ebe2ac36c
equal deleted inserted replaced
37:7e0ecb5b116a 38:3dcb815346df
   114     FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() complete" ) ));
   114     FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() complete" ) ));
   115     return KErrNone;
   115     return KErrNone;
   116     }
   116     }
   117 
   117 
   118 // ---------------------------------------------------------------------------
   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 // ---------------------------------------------------------------------------
   119 // Adds data to event queue and starts sending if needed
   136 // Adds data to event queue and starts sending if needed
   120 // ---------------------------------------------------------------------------
   137 // ---------------------------------------------------------------------------
   121 //
   138 //
   122 TInt CDunDownstream::AddToQueueAndSend( const TDesC8 *aPushedData,
   139 TInt CDunDownstream::AddToQueueAndSend( const TDesC8* aDataToPush,
   123                                         MDunCompletionReporter* aCallback )
   140                                         MDunCompletionReporter* aCallback )
   124     {
   141     {
   125     FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend()" ) ));
   142     FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend()" ) ));
   126     if ( !iPushData.iDataPusher )
   143     if ( !iPushData.iDataPusher )
   127         {
   144         {
   128         FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() (iPushData.iDataPusher not initialized!) complete" )));
   145         FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() (iPushData.iDataPusher not initialized!) complete" )));
   129         return KErrGeneral;
   146         return KErrGeneral;
   130         }
   147         }
   131     // Add to event queue. If something went wrong, just return
   148     // Add to event queue. If something went wrong, just return
   132     TInt retTemp = iPushData.iDataPusher->AddToEventQueue( aPushedData, aCallback );
   149     TInt retTemp = iPushData.iDataPusher->AddToEventQueue( aDataToPush, aCallback );
   133     if ( retTemp != KErrNone )
   150     if ( retTemp != KErrNone )
   134         {
   151         {
   135         FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() (ERROR) complete" )));
   152         FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() (ERROR) complete" )));
   136         return retTemp;
   153         return retTemp;
   137         }
   154         }
   147 // ---------------------------------------------------------------------------
   164 // ---------------------------------------------------------------------------
   148 //
   165 //
   149 TInt CDunDownstream::StartStream()
   166 TInt CDunDownstream::StartStream()
   150     {
   167     {
   151     FTRACE(FPrint( _L("CDunDownstream::StartStream()" ) ));
   168     FTRACE(FPrint( _L("CDunDownstream::StartStream()" ) ));
       
   169     FTRACE(FPrint( _L("CDunDownstream::StartStream() (buffer=0x%08X)" ), iBufferPtr ));
   152     // Note: only start URC here.
   170     // Note: only start URC here.
   153     // The downstream read request is started when command mode ends.
   171     // The downstream read request is started when command mode ends.
   154     // This is done to make the data arrive in the correct order (reply vs.
   172     // This is done to make the data arrive in the correct order (reply vs.
   155     // data) with "ATD" command.
   173     // data) with "ATD" command.
   156     TInt retVal = KErrNone;
   174     TInt retVal = KErrNone;
   361 // ---------------------------------------------------------------------------
   379 // ---------------------------------------------------------------------------
   362 // From class MDunStreamManipulator.
   380 // From class MDunStreamManipulator.
   363 // Gets called when outside party wants to push data to the existing stream
   381 // Gets called when outside party wants to push data to the existing stream
   364 // ---------------------------------------------------------------------------
   382 // ---------------------------------------------------------------------------
   365 //
   383 //
   366 TInt CDunDownstream::NotifyDataPushRequest( const TDesC8 *aPushedData,
   384 TInt CDunDownstream::NotifyDataPushRequest( const TDesC8* aDataToPush,
   367                                             MDunCompletionReporter* aCallback )
   385                                             MDunCompletionReporter* aCallback )
   368     {
   386     {
   369     FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest()" )));
   387     FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest()" )));
   370     // If in data mode push the reply anyway as "CONNECT" or "NO CARRIER"
   388     // If in data mode push the reply anyway as "CONNECT" or "NO CARRIER"
   371     // reply could arrive before/after the command mode information itself.
   389     // reply could arrive before/after the command mode information itself.
   372     TInt retVal = AddToQueueAndSend( aPushedData, aCallback );
   390     TInt retVal = AddToQueueAndSend( aDataToPush, aCallback );
   373     FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest() complete" )));
   391     FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest() complete" )));
   374     return retVal;
   392     return retVal;
   375     }
   393     }
   376 
   394 
   377 // ---------------------------------------------------------------------------
   395 // ---------------------------------------------------------------------------