mtpfws/mtpfw/src/cmtpconnectionmgr.cpp
branchRCL_3
changeset 1 f8e15b44d440
parent 0 d0791faffa3f
child 2 4843bb5893b6
equal deleted inserted replaced
0:d0791faffa3f 1:f8e15b44d440
    91 EXPORT_C TUid CMTPConnectionMgr::TransportUid()
    91 EXPORT_C TUid CMTPConnectionMgr::TransportUid()
    92     {
    92     {
    93     return iTransportUid;
    93     return iTransportUid;
    94     }
    94     }
    95 
    95 
       
    96 void CMTPConnectionMgr::ConnectionCloseComplete(const TUint& /*aConnUid*/)
       
    97     {
       
    98     if (iIsTransportStopping)
       
    99         {
       
   100         iIsTransportStopping = EFalse;
       
   101         ResumeSuspendedTransport();
       
   102         }
       
   103     }
       
   104 
    96 EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport)
   105 EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport)
    97     {
   106     {
    98     StartTransportL( aTransport, NULL );
   107     StartTransportL( aTransport, NULL );
    99     }
   108     }
   100 
   109 
   185         {
   194         {
   186         if ( !aByBearer )
   195         if ( !aByBearer )
   187             {
   196             {
   188             TRAP_IGNORE( SuspendTransportL( aTransport ) );
   197             TRAP_IGNORE( SuspendTransportL( aTransport ) );
   189             }
   198             }
       
   199         iIsTransportStopping = ETrue;
   190         iTransport->Stop(*this);
   200         iTransport->Stop(*this);
   191         delete iTransport;
   201         delete iTransport;
   192         iTransport = NULL;
   202         iTransport = NULL;
   193         iTransportUid = KNullUid;
   203         iTransportUid = KNullUid;
   194         iTransportCount--;
   204         iTransportCount--;
   195 
   205         }
   196 
   206     
   197         }
       
   198     if ( aByBearer )
   207     if ( aByBearer )
   199         {
   208         {
   200         UnsuspendTransport( aTransport );
   209         UnsuspendTransport( aTransport );
   201         }
   210         }
   202 		
   211 		
   225 EXPORT_C TInt CMTPConnectionMgr::TransportCount() const
   234 EXPORT_C TInt CMTPConnectionMgr::TransportCount() const
   226     {
   235     {
   227 	return iTransportCount;
   236 	return iTransportCount;
   228     }
   237     }
   229 
   238 
   230 void CMTPConnectionMgr::ConnectionClosed(MMTPTransportConnection& aTransportConnection)
   239 TBool CMTPConnectionMgr::ConnectionClosed(MMTPTransportConnection& aTransportConnection)
   231     {
   240     {
   232     __FLOG(_L8("ConnectionClosed - Entry"));
   241     __FLOG(_L8("ConnectionClosed - Entry"));
   233     
   242     
   234     TInt idx(ConnectionFind(aTransportConnection.BoundProtocolLayer().ConnectionId()));
   243     TInt idx(ConnectionFind(aTransportConnection.BoundProtocolLayer().ConnectionId()));
   235     __FLOG_VA((_L8("idx is %d "), idx));
   244     __FLOG_VA((_L8("idx is %d "), idx));
   236     __ASSERT_DEBUG((idx != KErrNotFound), User::Invariant());
   245     __ASSERT_DEBUG((idx != KErrNotFound), User::Invariant());
   237     
   246     
   238     CMTPConnection* connection(iConnections[idx]);
   247     CMTPConnection* connection(iConnections[idx]);
   239     connection->ConnectionSuspended();
       
   240     
       
   241     ResumeSuspendedTransport();
       
   242     
   248     
   243     __FLOG(_L8("ConnectionClosed - Exit"));
   249     __FLOG(_L8("ConnectionClosed - Exit"));
       
   250     return connection->ConnectionSuspended();
   244     }
   251     }
   245     
   252     
   246 void CMTPConnectionMgr::ConnectionOpenedL(MMTPTransportConnection& aTransportConnection)
   253 void CMTPConnectionMgr::ConnectionOpenedL(MMTPTransportConnection& aTransportConnection)
   247     {   
   254     {   
   248     __FLOG(_L8("ConnectionOpenedL - Entry"));
   255     __FLOG(_L8("ConnectionOpenedL - Entry"));
   265     connection->ConnectionResumedL(aTransportConnection);
   272     connection->ConnectionResumedL(aTransportConnection);
   266     
   273     
   267     __FLOG(_L8("ConnectionOpenedL - Exit"));
   274     __FLOG(_L8("ConnectionOpenedL - Exit"));
   268     }
   275     }
   269 
   276 
   270 TBool CMTPConnectionMgr::DeleteConnection(TUint aConnectionId)
       
   271     {
       
   272     __FLOG(_L8("DeleteConnection - Entry"));
       
   273     
       
   274     TBool ret = EFalse;    
       
   275     TInt idx = ConnectionFind(aConnectionId);
       
   276     
       
   277     if (idx != KErrNotFound)
       
   278         {
       
   279         CMTPConnection* connection(iConnections[idx]);
       
   280         iConnections.Remove(idx);
       
   281         delete connection;
       
   282         ret = ETrue;
       
   283         }
       
   284     
       
   285     __FLOG(_L8("DeleteConnection - Entry"));
       
   286     
       
   287     return ret;
       
   288     }
       
   289 
       
   290 EXPORT_C TUid CMTPConnectionMgr::ClientSId()
   277 EXPORT_C TUid CMTPConnectionMgr::ClientSId()
   291 	{
   278 	{
   292 	return iSecureId;
   279 	return iSecureId;
   293 	}
   280 	}
   294 /**
   281 /**
   295 Constructor.
   282 Constructor.
   296 */
   283 */
   297 CMTPConnectionMgr::CMTPConnectionMgr() :
   284 CMTPConnectionMgr::CMTPConnectionMgr() :
   298     iConnectionOrder(ConnectionOrderCompare),
   285     iConnectionOrder(ConnectionOrderCompare),
   299     iShutdownConnectionIdx(KErrNotFound),
   286     iShutdownConnectionIdx(KErrNotFound),
   300 	iTransportUid(KNullUid)
   287 	iTransportUid(KNullUid),
       
   288 	iIsTransportStopping(EFalse)
   301     {
   289     {
   302     __FLOG_OPEN(KMTPSubsystem, KComponent);    
   290     __FLOG_OPEN(KMTPSubsystem, KComponent);    
   303     }
   291     }
   304 
   292 
   305 /**
   293 /**