mtpfws/mtpfw/src/cmtpconnectionmgr.cpp
changeset 49 c20dd21d1eb4
parent 35 c4c427c00f31
child 52 866b4af7ffbe
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    16 #include "cmtpconnectionmgr.h"
    16 #include "cmtpconnectionmgr.h"
    17 
    17 
    18 #include "cmtpconnection.h"
    18 #include "cmtpconnection.h"
    19 #include "cmtptransportplugin.h"
    19 #include "cmtptransportplugin.h"
    20 #include "mmtptransportconnection.h"
    20 #include "mmtptransportconnection.h"
       
    21 #include "mtpdebug.h"
       
    22 #include "OstTraceDefinitions.h"
       
    23 #ifdef OST_TRACE_COMPILER_IN_USE
       
    24 #include "cmtpconnectionmgrTraces.h"
       
    25 #endif
       
    26 
    21 
    27 
    22 // Class constants.
    28 // Class constants.
    23 __FLOG_STMT(_LIT8(KComponent,"ConnectionMgr");)
       
    24 
    29 
    25 const TUint KMTPUsbTransportUid  = 0x102827B2;
    30 const TUint KMTPUsbTransportUid  = 0x102827B2;
    26 const TUint KMTPBTTransportUid  = 0x10286FCB;
    31 const TUint KMTPBTTransportUid  = 0x10286FCB;
    27 
    32 
    28 /**
    33 /**
    42     {
    47     {
    43     StopTransport( iTransportUid, ETrue );
    48     StopTransport( iTransportUid, ETrue );
    44     iConnections.ResetAndDestroy();    
    49     iConnections.ResetAndDestroy();    
    45     iSuspendedTransports.Close();
    50     iSuspendedTransports.Close();
    46     delete iTransportTrigger;
    51     delete iTransportTrigger;
    47     __FLOG_CLOSE;
       
    48     }
    52     }
    49 
    53 
    50 /**
    54 /**
    51 Provides a reference to the connection with the specified connection identifier.
    55 Provides a reference to the connection with the specified connection identifier.
    52 @param aConnectionId The connection identifier.
    56 @param aConnectionId The connection identifier.
    54 @leave KErrNotFound If a connection with the specified identifier does not 
    58 @leave KErrNotFound If a connection with the specified identifier does not 
    55 exist.
    59 exist.
    56 */
    60 */
    57 EXPORT_C CMTPConnection& CMTPConnectionMgr::ConnectionL(TUint aConnectionId) const
    61 EXPORT_C CMTPConnection& CMTPConnectionMgr::ConnectionL(TUint aConnectionId) const
    58     {   
    62     {   
    59     __FLOG(_L8("ConnectionL - Entry"));
    63     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_CONNECTIONL_ENTRY );
       
    64     
    60     
    65     
    61     TInt idx(ConnectionFind(aConnectionId));
    66     TInt idx(ConnectionFind(aConnectionId));
    62     
    67     
    63     __FLOG_VA((_L8("idx is %d "), idx));
    68     OstTrace1( TRACE_NORMAL, CMTPCONNECTIONMGR_CONNECTIONL, "idx is %d", idx );    
    64     __ASSERT_ALWAYS((idx != KErrNotFound), User::Invariant());
    69     __ASSERT_ALWAYS((idx != KErrNotFound), User::Invariant());
    65     
    70     
    66     __FLOG(_L8("ConnectionL - Exit"));
    71     OstTraceFunctionExit0( CMTPCONNECTIONMGR_CONNECTIONL_EXIT );
    67     return *iConnections[idx];
    72     return *iConnections[idx];
    68     }
    73     }
    69 
    74 
    70 /**
    75 /**
    71 Provides a count of the number of currently open connections.
    76 Provides a count of the number of currently open connections.
    95     return iTransportUid;
   100     return iTransportUid;
    96     }
   101     }
    97 
   102 
    98 void CMTPConnectionMgr::ConnectionCloseComplete(const TUint& /*aConnUid*/)
   103 void CMTPConnectionMgr::ConnectionCloseComplete(const TUint& /*aConnUid*/)
    99     {
   104     {
   100     __FLOG(_L8("ConnectionCloseComplete - Entry"));
   105     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_CONNECTIONCLOSECOMPLETE_ENTRY );
       
   106     
   101     if (iTransportUid.iUid != KMTPUsbTransportUid )
   107     if (iTransportUid.iUid != KMTPUsbTransportUid )
   102         {
   108         {
   103         ResumeSuspendedTransport();
   109         ResumeSuspendedTransport();
   104         }
   110         }
   105     else
   111     else
   106         {
   112         {
   107         iResumeCalled = ETrue;
   113         iResumeCalled = ETrue;
   108         }
   114         }
   109     
   115     
   110     __FLOG(_L8("ConnectionCloseComplete - exit"));
   116     OstTraceFunctionExit0( CMTPCONNECTIONMGR_CONNECTIONCLOSECOMPLETE_EXIT );
   111     }
   117     }
   112 
   118 
   113 EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport)
   119 EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport)
   114     {
   120     {
   115     __FLOG(_L8("StartTransportL - Entry"));
   121     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_ENTRY );
   116     
   122     
   117     //When USB plug out, BT will start Master mode to reconnect remote device. Else BT will start slave mode to listen connection.
   123     //When USB plug out, BT will start Master mode to reconnect remote device. Else BT will start slave mode to listen connection.
   118     if(aTransport.iUid == KMTPBTTransportUid && iRemoteDevice.iDeviceAddr != 0 && aTransport != iTransportUid)
   124     if(aTransport.iUid == KMTPBTTransportUid && iRemoteDevice.iDeviceAddr != 0 && aTransport != iTransportUid)
   119         {
   125         {
   120         __FLOG(_L8("StartTransportL with parameter!"));
   126         OstTrace0( TRACE_NORMAL, CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT, "StartTransportL with parameter!" );
   121         TMTPBTRemoteDeviceBuf tmpdata(iRemoteDevice);
   127         TMTPBTRemoteDeviceBuf tmpdata(iRemoteDevice);
   122         StartTransportL( aTransport, &tmpdata );
   128         StartTransportL( aTransport, &tmpdata );
   123         iRemoteDevice.iDeviceAddr = 0;
   129         iRemoteDevice.iDeviceAddr = 0;
   124         iRemoteDevice.iDeviceServicePort = 0;
   130         iRemoteDevice.iDeviceServicePort = 0;
   125         }
   131         }
   126     else
   132     else
   127         {
   133         {
   128         __FLOG(_L8("StartTransportL without parameter!"));
   134         OstTrace0( TRACE_NORMAL, DUP1_CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT, "StartTransportL without parameter!" );
   129         StartTransportL( aTransport, NULL );
   135         StartTransportL( aTransport, NULL );
   130         }
   136         }
   131     __FLOG(_L8("StartTransportL - Exit"));
   137     OstTraceFunctionExit0( CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_EXIT );
   132     }
   138     }
   133 
   139 
   134 /**
   140 /**
   135 Loads and starts up the MTP transport plug-in with the specified 
   141 Loads and starts up the MTP transport plug-in with the specified 
   136 CMTPTransportPlugin interface implementation UID. Only one MTP transport 
   142 CMTPTransportPlugin interface implementation UID. Only one MTP transport 
   141 @leave One of the system wide error codes, if a processing failure occurs.
   147 @leave One of the system wide error codes, if a processing failure occurs.
   142 @see StopTransport
   148 @see StopTransport
   143 */
   149 */
   144 EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport, const TAny* aParameter)
   150 EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport, const TAny* aParameter)
   145     {
   151     {
   146     __FLOG(_L8("StartTransportL - Entry"));
   152     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_TANYPOINTER_ENTRY );
   147     
   153     
   148     if (iTransport)
   154     if (iTransport)
   149         {
   155         {
   150         __FLOG(_L8("The transport is not none."));
   156         OstTrace0( TRACE_NORMAL, CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_TANYPOINTER, "The transport is not none." );
       
   157         
       
   158         
   151         if (aTransport != iTransportUid)
   159         if (aTransport != iTransportUid)
   152             {
   160             {
   153             // Multiple transports not currently supported.
   161             // Multiple transports not currently supported.
   154             __FLOG(_L8("Multiple transports are not supported now!"));
   162             OstTrace0( TRACE_NORMAL, DUP1_CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_TANYPOINTER, "Multiple transports are not supported now!" );
   155             User::Leave(KErrNotSupported);
   163             User::Leave(KErrNotSupported);
   156             }
   164             }
   157         else
   165         else
   158             {
   166             {
   159             __FLOG_1(_L8("Relaunch the transport 0x%X"), iTransportUid.iUid);
   167             OstTrace1( TRACE_NORMAL, DUP2_CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_TANYPOINTER, "Relaunch the transport 0x%X",  iTransportUid.iUid); 
   160             if(aTransport.iUid == KMTPBTTransportUid)
   168             if(aTransport.iUid == KMTPBTTransportUid)
   161                 {
   169                 {
   162                 iTransport->Stop(*this);
   170                 iTransport->Stop(*this);
   163                 delete iTransport;
   171                 delete iTransport;
   164                 iTransportCount--;
   172                 iTransportCount--;
   165                 iTransport = CMTPTransportPlugin::NewL(aTransport, aParameter);
   173                 iTransport = CMTPTransportPlugin::NewL(aTransport, aParameter);
   166                 
   174                 
   167                 TRAPD(err, iTransport->StartL(*this));
   175                 TRAPD(err, iTransport->StartL(*this));
   168                 if (err != KErrNone)
   176                 if (err != KErrNone)
   169                     {
   177                     {
   170                     __FLOG_VA( ( _L8("StartTransportL error, error code = %d"), err) );
   178                     OstTraceDef1( OST_TRACE_CATEGORY_PRODUCTION, TRACE_IMPORTANT, DUP3_CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_TANYPOINTER, 
       
   179                             "StartTransportL error, error code = %d",  err); 
   171                     delete iTransport;
   180                     delete iTransport;
   172                     iTransport = NULL;
   181                     iTransport = NULL;
   173                     
   182                     
   174                     User::Leave(err);
   183                     User::Leave(err);
   175                     }
   184                     }
   180 
   189 
   181             }
   190             }
   182         }
   191         }
   183     else
   192     else
   184         {
   193         {
   185         __FLOG(_L8("begin start transport."));
   194         OstTrace0( TRACE_NORMAL, DUP4_CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_TANYPOINTER, "begin start transport." );        
   186         iTransport = CMTPTransportPlugin::NewL(aTransport, aParameter);
   195         iTransport = CMTPTransportPlugin::NewL(aTransport, aParameter);
   187 
   196 
   188         TRAPD(err, iTransport->StartL(*this));
   197         TRAPD(err, iTransport->StartL(*this));
   189         if (err != KErrNone)
   198         if (err != KErrNone)
   190             {
   199             {
   191             __FLOG_VA( ( _L8("StartTransportL error, error code = %d"), err) );
   200             OstTrace1( TRACE_NORMAL, DUP5_CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_TANYPOINTER, "StartTransportL error, error code = %d",  err); 
   192             delete iTransport;
   201             delete iTransport;
   193             iTransport = NULL;
   202             iTransport = NULL;
   194             User::Leave(err);
   203             User::Leave(err);
   195             }
   204             }
   196         iTransportUid = aTransport;       
   205         iTransportUid = aTransport;       
   205             {
   214             {
   206             //Suspend BT transport to handle switching with Mass Storage 
   215             //Suspend BT transport to handle switching with Mass Storage 
   207             SuspendTransportL( iTransportUid);
   216             SuspendTransportL( iTransportUid);
   208             }
   217             }
   209         }
   218         }
   210 		
   219 		    
   211 	__FLOG(_L8("StartTransportL - Exit"));
   220     OstTraceFunctionExit0( CMTPCONNECTIONMGR_STARTTRANSPORTL_TUINT_TANYPOINTER_EXIT );
   212     }
   221     }
   213 
   222 
   214 /**
   223 /**
   215 Queue the transport to start when there is no running transport
   224 Queue the transport to start when there is no running transport
   216 @param aTransport, The CMTPTransportPlugin interface implementation UID.
   225 @param aTransport, The CMTPTransportPlugin interface implementation UID.
   217 @param aParameter, reserved
   226 @param aParameter, reserved
   218 @leave One of the system wide error codes, if the operation fails.
   227 @leave One of the system wide error codes, if the operation fails.
   219 */
   228 */
   220 EXPORT_C void CMTPConnectionMgr::QueueTransportL( TUid aTransport, const TAny* /*aParameter*/ )
   229 EXPORT_C void CMTPConnectionMgr::QueueTransportL( TUid aTransport, const TAny* /*aParameter*/ )
   221     {
   230     {
   222     __FLOG_VA( ( _L8("+QueueTransportL( 0x%08X )"), aTransport.iUid ) );
   231     OstTraceFunctionEntry0(CMTPCONNECTIONMGR_QUEUETRANSPORTL_ENTRY);
       
   232     OstTrace1( TRACE_NORMAL, CMTPCONNECTIONMGR_QUEUETRANSPORTL, "QueueTransportL( 0x%08X )", aTransport.iUid);
       
   233     
   223     __ASSERT_DEBUG( ( KErrNotFound == iSuspendedTransports.Find( aTransport ) ), User::Invariant() );
   234     __ASSERT_DEBUG( ( KErrNotFound == iSuspendedTransports.Find( aTransport ) ), User::Invariant() );
   224     iSuspendedTransports.InsertL( aTransport, 0 );
   235     iSuspendedTransports.InsertL( aTransport, 0 );
   225     __FLOG( _L8("-QueueTransportL") );
   236     OstTraceFunctionExit0(CMTPCONNECTIONMGR_QUEUETRANSPORTL_EXIT);
   226     }
   237     }
   227 
   238 
   228 EXPORT_C void CMTPConnectionMgr::SetClientSId(TUid aSecureId)
   239 EXPORT_C void CMTPConnectionMgr::SetClientSId(TUid aSecureId)
   229 	{
   240 	{
   230 	iSecureId=aSecureId;
   241 	iSecureId=aSecureId;
   246 @param aTransport The CMTPTransportPlugin interface implementation UID.
   257 @param aTransport The CMTPTransportPlugin interface implementation UID.
   247 @param aByBearer If ETrue, it means the transport plugin is stopped because the bearer is turned off or not activated.
   258 @param aByBearer If ETrue, it means the transport plugin is stopped because the bearer is turned off or not activated.
   248 */
   259 */
   249 EXPORT_C void CMTPConnectionMgr::StopTransport( TUid aTransport, TBool aByBearer )
   260 EXPORT_C void CMTPConnectionMgr::StopTransport( TUid aTransport, TBool aByBearer )
   250     {
   261     {
   251 	__FLOG(_L8("StopTransport - Entry"));
   262 	OstTraceFunctionEntry0( CMTPCONNECTIONMGR_STOPTRANSPORT_ENTRY );
   252 	
   263     OstTrace1( TRACE_NORMAL, CMTPCONNECTIONMGR_STOPTRANSPORT, "aTransport is 0x%X", aTransport.iUid);
   253 
   264 
   254     __FLOG_1(_L8("aTransport is 0x%X"), aTransport.iUid);
       
   255     __FLOG_1(_L8("iTransportUid is 0x%X"), iTransportUid.iUid);
       
   256     
       
   257     TInt transportId = iTransportUid.iUid;
   265     TInt transportId = iTransportUid.iUid;
   258 
   266 
   259     if ( aByBearer )
   267     if ( aByBearer )
   260         {
   268         {
   261         UnsuspendTransport( aTransport );
   269         UnsuspendTransport( aTransport );
   279 			iResumeCalled = EFalse;            
   287 			iResumeCalled = EFalse;            
   280             }
   288             }
   281 
   289 
   282         }
   290         }
   283     
   291     
   284 	__FLOG(_L8("StopTransport - Exit"));
   292     OstTraceFunctionExit0( CMTPCONNECTIONMGR_STOPTRANSPORT_EXIT );
   285     }
   293     }
   286 
   294 
   287 /**
   295 /**
   288 Shuts down and unloads all active MTP transport plug-ins.
   296 Shuts down and unloads all active MTP transport plug-ins.
   289 */
   297 */
   326     iRemoteDevice.iDeviceServicePort = aPSMPort;
   334     iRemoteDevice.iDeviceServicePort = aPSMPort;
   327     }
   335     }
   328 
   336 
   329 TBool CMTPConnectionMgr::ConnectionClosed(MMTPTransportConnection& aTransportConnection)
   337 TBool CMTPConnectionMgr::ConnectionClosed(MMTPTransportConnection& aTransportConnection)
   330     {
   338     {
   331     __FLOG(_L8("ConnectionClosed - Entry"));
   339     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_CONNECTIONCLOSED_ENTRY );
   332     
   340     
   333     TInt idx(ConnectionFind(aTransportConnection.BoundProtocolLayer().ConnectionId()));
   341     TInt idx(ConnectionFind(aTransportConnection.BoundProtocolLayer().ConnectionId()));
   334     __FLOG_VA((_L8("idx is %d "), idx));
   342     OstTrace1( TRACE_NORMAL, CMTPCONNECTIONMGR_CONNECTIONCLOSED, "idx is %d", idx );
   335     __ASSERT_DEBUG((idx != KErrNotFound), User::Invariant());
   343     __ASSERT_DEBUG((idx != KErrNotFound), User::Invariant());
   336     
   344     
   337     CMTPConnection* connection(iConnections[idx]);
   345     CMTPConnection* connection(iConnections[idx]);
   338     
   346     
   339     __FLOG(_L8("ConnectionClosed - Exit"));
   347     OstTraceFunctionExit0( CMTPCONNECTIONMGR_CONNECTIONCLOSED_EXIT);
   340     return connection->ConnectionSuspended();
   348     return connection->ConnectionSuspended();
   341     }
   349     }
   342     
   350     
   343 void CMTPConnectionMgr::ConnectionOpenedL(MMTPTransportConnection& aTransportConnection)
   351 void CMTPConnectionMgr::ConnectionOpenedL(MMTPTransportConnection& aTransportConnection)
   344     {   
   352     {   
   345     __FLOG(_L8("ConnectionOpenedL - Entry"));
   353     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_CONNECTIONOPENEDL_ENTRY );
   346     
   354   
   347     TUint impUid = aTransportConnection.GetImplementationUid();
   355     TUint impUid = aTransportConnection.GetImplementationUid();
   348     TInt idx = ConnectionFind(impUid);
   356     TInt idx = ConnectionFind(impUid);
   349     CMTPConnection* connection = NULL;
   357     CMTPConnection* connection = NULL;
   350     
   358     
   351     if (idx == KErrNotFound)
   359     if (idx == KErrNotFound)
   359         {
   367         {
   360         connection = iConnections[idx];
   368         connection = iConnections[idx];
   361         }
   369         }
   362     connection->ConnectionResumedL(aTransportConnection);
   370     connection->ConnectionResumedL(aTransportConnection);
   363     
   371     
   364     __FLOG(_L8("ConnectionOpenedL - Exit"));
   372     OstTraceFunctionExit0( CMTPCONNECTIONMGR_CONNECTIONOPENEDL_EXIT );
   365     }
   373     }
   366 
   374 
   367 EXPORT_C TUid CMTPConnectionMgr::ClientSId()
   375 EXPORT_C TUid CMTPConnectionMgr::ClientSId()
   368 	{
   376 	{
   369 	return iSecureId;
   377 	return iSecureId;
   374 CMTPConnectionMgr::CMTPConnectionMgr() :
   382 CMTPConnectionMgr::CMTPConnectionMgr() :
   375     iConnectionOrder(ConnectionOrderCompare),
   383     iConnectionOrder(ConnectionOrderCompare),
   376     iShutdownConnectionIdx(KErrNotFound),
   384     iShutdownConnectionIdx(KErrNotFound),
   377 	iTransportUid(KNullUid)
   385 	iTransportUid(KNullUid)
   378     {
   386     {
   379     __FLOG_OPEN(KMTPSubsystem, KComponent);
       
   380     iRemoteDevice.iDeviceAddr = 0;
   387     iRemoteDevice.iDeviceAddr = 0;
   381     iRemoteDevice.iDeviceServicePort = 0;
   388     iRemoteDevice.iDeviceServicePort = 0;
   382     iResumeCalled = EFalse;
   389     iResumeCalled = EFalse;
   383     }
   390     }
   384 
   391 
   389 @return The connection table index of the required connection, or KErrNotFound
   396 @return The connection table index of the required connection, or KErrNotFound
   390 if the connection identifier could not be found.
   397 if the connection identifier could not be found.
   391 */ 
   398 */ 
   392 TInt CMTPConnectionMgr::ConnectionFind(TUint aConnectionId) const
   399 TInt CMTPConnectionMgr::ConnectionFind(TUint aConnectionId) const
   393     {
   400     {
   394     __FLOG_VA((_L8("ConnectionFind - Entry with connectionId %d "), aConnectionId));
   401     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_CONNECTIONFIND_ENTRY );
       
   402     OstTrace1( TRACE_NORMAL, CMTPCONNECTIONMGR_CONNECTIONFIND, "connectionId %d", aConnectionId);
       
   403     
   395     TInt ret(KErrNotFound);
   404     TInt ret(KErrNotFound);
   396     
   405     
   397     const TUint noConnections = iConnections.Count();
   406     const TUint noConnections = iConnections.Count();
   398     for (TUint i(0); ((i < noConnections) && (ret == KErrNotFound)); i++)
   407     for (TUint i(0); ((i < noConnections) && (ret == KErrNotFound)); i++)
   399         {
   408         {
   402             {
   411             {
   403             ret = i;
   412             ret = i;
   404             break;
   413             break;
   405             }
   414             }
   406         }
   415         }
   407     __FLOG(_L8("ConnectionFind - Exit"));    
   416     OstTraceFunctionExit0( CMTPCONNECTIONMGR_CONNECTIONFIND_EXIT );
   408     return ret;
   417     return ret;
   409     }
   418     }
   410 
   419 
   411 /**
   420 /**
   412 Determines the relative order of two CMTPConnection objects based on their 
   421 Determines the relative order of two CMTPConnection objects based on their 
   425 @param aTransport, The implementation UID of the suspended transport plugin
   434 @param aTransport, The implementation UID of the suspended transport plugin
   426 @leave One of the system wide error codes, if the operation fails.
   435 @leave One of the system wide error codes, if the operation fails.
   427 */
   436 */
   428 void CMTPConnectionMgr::SuspendTransportL( TUid aTransport )
   437 void CMTPConnectionMgr::SuspendTransportL( TUid aTransport )
   429     {
   438     {
   430     __FLOG_1( _L8("+SuspendTransportL( 0x%08X )"), aTransport );
   439     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_SUSPENDTRANSPORTL_ENTRY );
       
   440     OstTrace1( TRACE_NORMAL, CMTPCONNECTIONMGR_SUSPENDTRANSPORTL, "SuspendTransportL( 0x%08X )", aTransport.iUid );
       
   441     
       
   442     
   431     if ( KErrNotFound == iSuspendedTransports.Find( aTransport ) )
   443     if ( KErrNotFound == iSuspendedTransports.Find( aTransport ) )
   432         {
   444         {
   433         iSuspendedTransports.AppendL( aTransport );
   445         iSuspendedTransports.AppendL( aTransport );
   434         }
   446         }
   435     __FLOG( _L8("-SuspendTransportL") );
   447     OstTraceFunctionExit0( CMTPCONNECTIONMGR_SUSPENDTRANSPORTL_EXIT );
   436     }
   448     }
   437 
   449 
   438 /**
   450 /**
   439 Remove transport from the suspended transports list
   451 Remove transport from the suspended transports list
   440 @param aTransport, The CMTPTransportPlugin interface implementation UID 
   452 @param aTransport, The CMTPTransportPlugin interface implementation UID 
   441 */
   453 */
   442 void CMTPConnectionMgr::UnsuspendTransport( TUid aTransport )
   454 void CMTPConnectionMgr::UnsuspendTransport( TUid aTransport )
   443     {
   455     {
   444     __FLOG_1( _L8("+UnsuspendTransport( 0x%08X )"), aTransport.iUid );
   456     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_UNSUSPENDTRANSPORT_ENTRY );
       
   457     OstTrace1( TRACE_NORMAL, CMTPCONNECTIONMGR_UNSUSPENDTRANSPORT, "Transport uid is 0x%08X;", aTransport.iUid );
       
   458     
       
   459     
   445     TInt idx = iSuspendedTransports.Find( aTransport );
   460     TInt idx = iSuspendedTransports.Find( aTransport );
   446     if ( KErrNotFound != idx )
   461     if ( KErrNotFound != idx )
   447         {
   462         {
   448         __FLOG_1( _L8("Remove the number %d suspended transport"), idx );
   463         OstTrace1( TRACE_NORMAL, DUP1_CMTPCONNECTIONMGR_UNSUSPENDTRANSPORT, "Remove the number %d suspended transport", idx );
   449         iSuspendedTransports.Remove( idx );
   464         iSuspendedTransports.Remove( idx );
   450         }
   465         }
   451     __FLOG( _L8("-UnsuspendTransport") );
   466     OstTraceFunctionExit0( CMTPCONNECTIONMGR_UNSUSPENDTRANSPORT_EXIT );
   452     }
   467     }
   453 
   468 
   454 /**
   469 /**
   455 Prepare to resume suspended transport
   470 Prepare to resume suspended transport
   456 */
   471 */
   457 void CMTPConnectionMgr::ResumeSuspendedTransport()
   472 void CMTPConnectionMgr::ResumeSuspendedTransport()
   458     {
   473     {
   459     __FLOG( _L8("+ResumeSuspendedTransport") );
   474     OstTraceFunctionEntry0( CMTPCONNECTIONMGR_RESUMESUSPENDEDTRANSPORT_ENTRY );
   460     const TInt count = iSuspendedTransports.Count();
   475     const TInt count = iSuspendedTransports.Count();
   461     __FLOG_1(_L8("The count number is %d"), count);
   476     OstTrace1(TRACE_NORMAL, CMTPCONNECTIONMGR_RESUMESUSPENDEDTRANSPORT, "The count number is %d", count);
   462     __FLOG_1(_L8("The transportport id is 0x%X"), iTransportUid.iUid);
   477     OstTrace1(TRACE_NORMAL, DUP1_CMTPCONNECTIONMGR_RESUMESUSPENDEDTRANSPORT, "The transportport id is 0x%X", iTransportUid.iUid);
   463     
   478     
   464     if ( ( count > 0 )
   479     if ( ( count > 0 )
   465         // If the transport was just switched and suspended, it shouldn't be resumed.
   480         // If the transport was just switched and suspended, it shouldn't be resumed.
   466         && (( iTransportUid != iSuspendedTransports[count-1] ) || iTransportUid.iUid == KMTPBTTransportUid))
   481         && (( iTransportUid != iSuspendedTransports[count-1] ) || iTransportUid.iUid == KMTPBTTransportUid))
   467         {
   482         {
   468         __FLOG( _L8("Found suspended transport(s).") );
   483         OstTrace0(TRACE_NORMAL, DUP2_CMTPCONNECTIONMGR_RESUMESUSPENDEDTRANSPORT, "Found suspended transport(s).");
   469         if ( !iTransportTrigger )
   484         if ( !iTransportTrigger )
   470             {
   485             {
   471             iTransportTrigger = new( ELeave ) CAsyncCallBack( CActive::EPriorityStandard );
   486             iTransportTrigger = new( ELeave ) CAsyncCallBack( CActive::EPriorityStandard );
   472             }
   487             }
   473        
   488        
   474         if ( !iTransportTrigger->IsActive())
   489         if ( !iTransportTrigger->IsActive())
   475             {
   490             {
   476             __FLOG( _L8("Set call back function!") );
   491             OstTrace0(TRACE_NORMAL, DUP3_CMTPCONNECTIONMGR_RESUMESUSPENDEDTRANSPORT, "Set call back function!");
   477             TCallBack callback( CMTPConnectionMgr::DoResumeSuspendedTransport, this );
   492             TCallBack callback( CMTPConnectionMgr::DoResumeSuspendedTransport, this );
   478             iTransportTrigger->Set( callback );
   493             iTransportTrigger->Set( callback );
   479             iTransportTrigger->CallBack();            
   494             iTransportTrigger->CallBack();            
   480             }
   495             }
   481         else
   496         else
   482             {
   497             {
   483             __FLOG( _L8("Call back has been set!") );
   498             OstTrace0(TRACE_NORMAL, DUP4_CMTPCONNECTIONMGR_RESUMESUSPENDEDTRANSPORT, "Call back has been set!");
   484             }
   499             }
   485 
   500 
   486         }
   501         }
   487     __FLOG( _L8("-ResumeSuspendedTransport") );
   502     OstTraceFunctionExit0( DUP1_CMTPCONNECTIONMGR_RESUMESUSPENDEDTRANSPORT_EXIT );
   488     }
   503     }
   489 
   504 
   490 /**
   505 /**
   491 Resume suspended transport
   506 Resume suspended transport
   492 @param aSelf, The memory address of the CMTPConnectionMgr instance
   507 @param aSelf, The memory address of the CMTPConnectionMgr instance