mtpdataproviders/mtppictbridgedp/inc/cptpserver.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 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 PTPSERVER_H
       
    23 #define PTPSERVER_H
       
    24 
       
    25 
       
    26 #include "s60dependency.h"
       
    27 
       
    28 #include <e32svr.h>   
       
    29 #include <mtp/cmtptypeobjectinfo.h>
       
    30 
       
    31 #include "ptpdef.h"
       
    32 #include "rptp.h"
       
    33 #include "cptpsession.h"
       
    34 #include "cmtppictbridgedp.h"
       
    35 
       
    36 //FORWARD DECLARATION
       
    37 
       
    38 class MMTPDataProviderFramework;
       
    39 class TMTPTypeEvent;
       
    40 class CMTPPictBridgePrinter;
       
    41 class CMTPObjectMetaData;
       
    42 class CFileMan;
       
    43 
       
    44 static const TInt KMTPMaxPtpFolderPathLength = 256;
       
    45 
       
    46 /**
       
    47 *  A server class to initialize server. 
       
    48 *
       
    49 *  @since S60 5.2
       
    50 */
       
    51 NONSHARABLE_CLASS(CPtpServer) : public CServer2
       
    52     {
       
    53      
       
    54 public:
       
    55     static CPtpServer* NewL(MMTPDataProviderFramework& aFramework, CMTPPictBridgeDataProvider& aDataProvider);
       
    56     ~CPtpServer();
       
    57 
       
    58 public:// from CServer2, creates a new session.
       
    59     CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const;
       
    60     
       
    61 public:
       
    62     const TDesC& PtpFolder();
       
    63       
       
    64     void GetObjectHandleByNameL(const TDesC& aNameAndPath, TUint32& aHandle);
       
    65     void GetObjectNameByHandleL(TDes& aNameAndPath, const TUint32 aHandle);
       
    66 
       
    67     void SendEventL(TMTPTypeEvent& ptpEvent);
       
    68     void AddTemporaryObjectL(const TDesC& aPathAndFileName, TUint32& aHandle);
       
    69     void RemoveTemporaryObjects();
       
    70     void RemoveObjectL(const TDesC& aSuid);
       
    71     void NotifyOnMtpSessionOpen(CPtpSession* aSession);
       
    72 
       
    73     inline CMTPPictBridgePrinter* Printer() const{ return iPrinterP; }
       
    74     inline TInt NumSession() const { return iNumSession; }
       
    75     inline void IncrementSessionCount(){ iNumSession++; }
       
    76     inline void DecrementSessionCount(){ iNumSession--; }
       
    77     inline TUint32 DeviceDiscoveryHandle() const{ return iDataProvider.DeviceDiscoveryHandle(); }
       
    78     inline TBool MtpSessionOpen() const{ return iMtpSessionOpen; }
       
    79 
       
    80     MMTPDataProviderFramework& Framework() const;
       
    81 
       
    82     void MtpSessionOpened();
       
    83     void MtpSessionClosed();
       
    84     void CancelNotifyOnMtpSessionOpen(CPtpSession* aSession);
       
    85 
       
    86 private:    
       
    87     CPtpServer(MMTPDataProviderFramework& aFramework, CMTPPictBridgeDataProvider& aDataProvider);
       
    88     void ConstructL();
       
    89 
       
    90 private:   
       
    91     TBuf<KMTPMaxPtpFolderPathLength> iPtpFolder;
       
    92     CMTPPictBridgePrinter* iPrinterP;  // owned
       
    93     TInt iNumSession;
       
    94     MMTPDataProviderFramework& iFramework;
       
    95     CMTPPictBridgeDataProvider& iDataProvider;
       
    96     RPointerArray<CMTPObjectMetaData> iTemporaryObjects;
       
    97     TBool iMtpSessionOpen;
       
    98     CPtpSession* iSessionOpenNotifyClientP;
       
    99     CFileMan*          iFileMan;
       
   100     /**
       
   101     FLOGGER debug trace member variable.
       
   102     */
       
   103     __FLOG_DECLARATION_MEMBER_MUTABLE;
       
   104     };
       
   105 #endif // PTPSERVER_H
       
   106