mtpfws/mtpfw/inc/cmtpconnectionmgr.h
changeset 0 d0791faffa3f
child 6 f8e15b44d440
child 17 aabe5387f5ce
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef CMTPCONNECTIONMGR_H
       
    23 #define CMTPCONNECTIONMGR_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include "mmtpconnectionmgr.h"
       
    27 #include "mtpdebug.h"
       
    28 
       
    29 class CMTPConnection;
       
    30 class CMTPTransportPlugin;
       
    31 class MMTPTransportConnection;
       
    32 
       
    33 /**
       
    34 Implements the connection manager singleton. The connection manager is a 
       
    35 container class responsible for loading, storing, and managing 
       
    36 @see CMTPTransportPlugin instances. The connection manager uses the ECOM 
       
    37 framework to load and unload transport plug-ins on demand. 
       
    38 
       
    39 The connection manager is not responsible for controlling or scheduling 
       
    40 transport connections, but is notified by the loaded transport plug-ins as 
       
    41 @see MMTPTransportConnection instances are created. At which time it will 
       
    42 create and bind a new @see CMTPConnection instance to the 
       
    43 @see MMTPTransportConnection instance being registered.
       
    44 */
       
    45 class CMTPConnectionMgr : 
       
    46     public CBase,
       
    47     public MMTPConnectionMgr
       
    48     {
       
    49 public:
       
    50 
       
    51     static CMTPConnectionMgr* NewL();
       
    52     ~CMTPConnectionMgr();
       
    53     
       
    54     IMPORT_C CMTPConnection& ConnectionL(TUint aConnectionId) const;
       
    55     TUint ConnectionCount() const;
       
    56     CMTPConnection& operator[](TInt aIndex) const;
       
    57     IMPORT_C void StartTransportL(TUid aTransport);
       
    58     IMPORT_C void StartTransportL(TUid aTransport, const TAny* aParameter);  
       
    59     IMPORT_C void QueueTransportL( TUid aTransport, const TAny* aParameter );
       
    60     IMPORT_C void SetClientSId(TUid aSecureId);  
       
    61     IMPORT_C void StopTransport(TUid aTransport);
       
    62     IMPORT_C void StopTransport( TUid aTransport, TBool aByBearer );
       
    63     IMPORT_C void StopTransports();
       
    64     IMPORT_C TInt TransportCount() const;
       
    65     IMPORT_C TUid TransportUid();
       
    66 	
       
    67 	    
       
    68 private: // From MMTPConnectionMgr
       
    69 
       
    70     void ConnectionClosed(MMTPTransportConnection& aTransportConnection);
       
    71     void ConnectionOpenedL(MMTPTransportConnection& aTransportConnection);
       
    72     TBool DeleteConnection(TUint aConnectionId);
       
    73     TUid ClientSId();
       
    74     
       
    75 private:
       
    76 
       
    77     CMTPConnectionMgr();
       
    78     
       
    79     TInt ConnectionFind(TUint aConnectionId) const;
       
    80     static TInt ConnectionOrderCompare(const CMTPConnection& aFirst, const CMTPConnection& aSecond);
       
    81 
       
    82     void SuspendTransportL( TUid aTransport );
       
    83     void UnsuspendTransport( TUid aTransport );
       
    84     void ResumeSuspendedTransport();
       
    85     static TInt DoResumeSuspendedTransport( TAny* aSelf );
       
    86 private:
       
    87 
       
    88     RPointerArray<CMTPConnection>   iConnections;
       
    89     TLinearOrder<CMTPConnection>    iConnectionOrder;
       
    90     TInt                            iShutdownConnectionIdx;
       
    91     CMTPTransportPlugin*            iTransport;
       
    92     TUid                            iTransportUid;
       
    93     TUint							iTransportCount;
       
    94     TUid 							iSecureId;
       
    95     
       
    96     /**
       
    97      * Array storing the UIDs of the suspended transport plugins
       
    98      */
       
    99     RArray< TUid >                  iSuspendedTransports;
       
   100     
       
   101     /**
       
   102      * Active object which starts suspended transport asynchronously
       
   103      */
       
   104     CAsyncCallBack*                 iTransportTrigger;
       
   105     
       
   106     /**
       
   107     FLOGGER debug trace member variable.
       
   108     */
       
   109     __FLOG_DECLARATION_MEMBER_MUTABLE;
       
   110     };
       
   111 #endif // CMTPCONNECTIONMGR_H