localconnectivityservice/dun/utils/src/DunDataPusher.cpp
branchRCL_3
changeset 15 c47ebe2ac36c
parent 0 c3e98f10fcf4
child 38 3dcb815346df
equal deleted inserted replaced
12:031b9cffe6e4 15:c47ebe2ac36c
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   310     {
   310     {
   311     // Don't initialize iUtility here (it is set through NewL)
   311     // Don't initialize iUtility here (it is set through NewL)
   312     // Don't initialize iStreamCallback here (it is set through NewL)
   312     // Don't initialize iStreamCallback here (it is set through NewL)
   313     iPushState = EDunStateIdle;
   313     iPushState = EDunStateIdle;
   314     iEventIndex = 0;
   314     iEventIndex = 0;
   315     iEPReady = EFalse;
       
   316     iSocket = NULL;
   315     iSocket = NULL;
   317     iComm = NULL;
   316     iComm = NULL;
   318     }
   317     }
   319 
   318 
   320 // ---------------------------------------------------------------------------
   319 // ---------------------------------------------------------------------------
   334         {
   333         {
   335         FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() (buffer mismatch) complete" )));
   334         FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() (buffer mismatch) complete" )));
   336         return KErrGeneral;
   335         return KErrGeneral;
   337         }
   336         }
   338     iStatus = KRequestPending;
   337     iStatus = KRequestPending;
   339     if ( !iEPReady )
       
   340         {
       
   341         SetActive();
       
   342         TRequestStatus* requestStatus = &iStatus;
       
   343         User::RequestComplete( requestStatus, KErrNone );
       
   344         return KErrNone;
       
   345         }
       
   346     const TDesC8 *pushedData = iEventQueue[iEventIndex].iPushedData;
   338     const TDesC8 *pushedData = iEventQueue[iEventIndex].iPushedData;
   347     if ( iComm )
   339     if ( iComm )
   348         {
   340         {
   349         iComm->Write( iStatus, *pushedData );
   341         iComm->Write( iStatus, *pushedData );
   350         FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RComm Write() requested" ) ));
   342         FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RComm Write() requested" ) ));
   453         iSocket->CancelWrite();
   445         iSocket->CancelWrite();
   454         FTRACE(FPrint( _L("CDunDataPusher::DoCancel() (RSocket) cancelled" )));
   446         FTRACE(FPrint( _L("CDunDataPusher::DoCancel() (RSocket) cancelled" )));
   455         }
   447         }
   456     FTRACE(FPrint( _L("CDunDataPusher::DoCancel() complete" )));
   448     FTRACE(FPrint( _L("CDunDataPusher::DoCancel() complete" )));
   457     }
   449     }
   458 
       
   459 // ---------------------------------------------------------------------------
       
   460 // From class MDunEndpointReady.
       
   461 // Gets called when endpoint is ready
       
   462 // ---------------------------------------------------------------------------
       
   463 //
       
   464 void CDunDataPusher::NotifyEndpointReady()
       
   465     {
       
   466     FTRACE(FPrint( _L("CDunDataPusher::NotifyEndpointReady()" )));
       
   467     iEPReady = ETrue;
       
   468     FTRACE(FPrint( _L("CDunDataPusher::NotifyEndpointReady() complete" )));
       
   469     }
       
   470 
       
   471 // ---------------------------------------------------------------------------
       
   472 // From class MDunEndpointReady.
       
   473 // Gets called when endpoint is not ready
       
   474 // ---------------------------------------------------------------------------
       
   475 //
       
   476 void CDunDataPusher::NotifyEndpointNotReady()
       
   477     {
       
   478     FTRACE(FPrint( _L("CDunDataPusher::NotifyEndpointNotReady()" )));
       
   479     iEPReady = EFalse;
       
   480     FTRACE(FPrint( _L("CDunDataPusher::NotifyEndpointNotReady() complete" )));
       
   481     }