mtpfws/mtpfw/inc/cmtpsession.h
changeset 0 d0791faffa3f
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 #ifndef CMTPSESSION_H
       
    22 #define CMTPSESSION_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <mtp/mmtpsession.h>
       
    26 #include <mtp/tmtptyperequest.h>
       
    27 #include <mtp/tmtptypeevent.h>
       
    28 
       
    29 #include "mtpdebug.h"
       
    30 
       
    31 /** 
       
    32 Implements the session level portion of the MTP communication model. It also 
       
    33 implements the data provider layer MTP session interface (@see MMTPSession).
       
    34 @internalComponent
       
    35  
       
    36 */
       
    37 class CMTPSession : 
       
    38     public CBase,
       
    39     public MMTPSession
       
    40     {
       
    41 public:
       
    42 
       
    43     static CMTPSession* NewLC(TUint32 aMTPId, TUint aUniqueId);
       
    44     ~CMTPSession();    
       
    45     
       
    46     TUint32 ExpectedTransactionId() const;
       
    47     void IncrementExpectedTransactionId();
       
    48     
       
    49     void SetActiveRequestL(const TMTPTypeRequest& aRequest);
       
    50     void SetTransactionPhase(TMTPTransactionPhase aPhase);
       
    51     TMTPTransactionPhase TransactionPhase() const;
       
    52     TInt RouteRequest(const TMTPTypeRequest& aRequest);
       
    53     void RouteRequestRegisterL(const TMTPTypeRequest& aRequest, TInt aDpId);
       
    54     TBool RouteRequestRegistered(TUint16 aOpCode) const;
       
    55     void RouteRequestUnregister(const TMTPTypeRequest& aRequest);
       
    56     TBool CheckPendingEvent(const TMTPTypeRequest& aRequest) const;
       
    57     void StorePendingEventL(const TMTPTypeEvent& aEvent);
       
    58     const TMTPTypeEvent& PendingEvent() const;
       
    59     
       
    60     void CompletePendingRequest(TInt aErr);
       
    61     TBool RequestPending() const;
       
    62     void SetRequestPending(TRequestStatus& aStatus);
       
    63 
       
    64 public: // From MMTPSession
       
    65 
       
    66     const TMTPTypeRequest& ActiveRequestL() const;
       
    67     TUint32 SessionMTPId() const;
       
    68     TUint SessionUniqueId() const;
       
    69     TAny* GetExtendedInterface(TUid aInterfaceUid);
       
    70     
       
    71 private:
       
    72 
       
    73     CMTPSession(TUint32 aMTPId, TUint aUniqueId);
       
    74     void ConstructL();
       
    75     
       
    76     static TBool RouteRequestMatchOpCode(const TUint16* aOpCode, const TMTPTypeRequest& aRequest);
       
    77     static TInt RouteRequestOrder(const TMTPTypeRequest& aLeft, const TMTPTypeRequest& aRight);
       
    78     
       
    79 private: // Owned
       
    80 
       
    81     /**
       
    82     FLOGGER debug trace member variable.
       
    83     */
       
    84     __FLOG_DECLARATION_MEMBER_MUTABLE;
       
    85 
       
    86     TUint32                 iExpectedTransactionId;
       
    87     TUint32                 iIdMTP;
       
    88     TUint                   iIdUnique;
       
    89     TMTPTransactionPhase    iTransactionPhase;
       
    90     RArray<TMTPTypeRequest> iRoutingRegistrations;
       
    91     TAny*                   iExtendedInterface;
       
    92     TMTPTypeEvent           iPendingEvent;
       
    93     TMTPTypeRequest         iActiveRequest;
       
    94     
       
    95 private: // Not owned
       
    96 
       
    97     TRequestStatus*         iRequestStatus;
       
    98     };
       
    99 
       
   100 #endif // CMTPSESSION_H