mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h
changeset 0 d0791faffa3f
child 2 4843bb5893b6
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  @internalTechnology
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef CMTPIMAGEDP_H
       
    23 #define CMTPIMAGEDP_H
       
    24 
       
    25 #include <e32property.h> 
       
    26 #include <w32std.h> // PTP server/stack
       
    27 #include <e32hashtab.h> 
       
    28 #include <e32def.h>
       
    29 #include <mtp/cmtpdataproviderplugin.h>
       
    30 #include <comms-infras/commsdebugutility.h>
       
    31 
       
    32 #include <mtp/cmtpdataproviderplugin.h>
       
    33 #include "mmtpenumerationcallback.h"
       
    34 #include "cmtpimagedpobjectpropertymgr.h"
       
    35 
       
    36 class MMTPRequestProcessor;
       
    37 class CMTPImageDpThumbnailCreator;
       
    38 class CMTPImageDpObjectPropertyMgr;
       
    39 class CMTPImageDpMdeObserver;
       
    40 class CRepository;
       
    41 class CMTPImageDpRenameObject;
       
    42 
       
    43 const TInt KMaxExtNameLength = 4;
       
    44 
       
    45 /** 
       
    46 Implements the picture data provider plugin.
       
    47 @internalComponent
       
    48 */
       
    49 class CMTPImageDataProvider : public CMTPDataProviderPlugin,
       
    50                               public MMTPEnumerationCallback
       
    51     {
       
    52 public:
       
    53 
       
    54     static TAny* NewL(TAny* aParams);
       
    55     ~CMTPImageDataProvider();
       
    56     
       
    57 public:
       
    58     CMTPImageDpObjectPropertyMgr& PropertyMgr()const;
       
    59     CMTPImageDpThumbnailCreator&  ThumbnailManager() const;
       
    60     CRepository& Repository() const;
       
    61     
       
    62     TMTPFormatCode FindFormatL(const TDesC& aExtension);
       
    63     TBool GetCacheParentHandle(const TDesC& aParentPath, TUint32& aParentHandle);
       
    64     void  SetCacheParentHandle(const TDesC& aParentPath, TUint32 aParentHandle);
       
    65     void AppendDeleteObjectsArrayL(const TDesC& aSuid);
       
    66     void HandleDeleteObjectsArray();
       
    67     
       
    68 public: // From CMTPDataProviderPlugin
       
    69     void Cancel();
       
    70     void ProcessEventL(const TMTPTypeEvent& aEvent, MMTPConnection& aConnection);
       
    71     void ProcessNotificationL(TMTPNotification aNotification, const TAny* aParams);
       
    72     void ProcessRequestPhaseL(TMTPTransactionPhase aPhase, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection);
       
    73     void StartObjectEnumerationL(TUint32 aStorageId, TBool aPersistentFullEnumeration);
       
    74     void StartStorageEnumerationL();
       
    75     void Supported(TMTPSupportCategory aCategory, RArray<TUint>& aArray) const;
       
    76     void SupportedL(TMTPSupportCategory aCategory, CDesCArray& aStrings) const;
       
    77     
       
    78 public: // From MMTPEnumerationCallback    
       
    79     void NotifyStorageEnumerationCompleteL();
       
    80     void NotifyEnumerationCompleteL(TUint32 aStorageId, TInt aError);
       
    81            
       
    82 private:
       
    83     CMTPImageDataProvider(TAny* aParams);
       
    84     void ConstructL();
       
    85 
       
    86     TInt LocateRequestProcessorL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection);
       
    87     TInt LocateRequestProcessorL(const TMTPTypeEvent& aEvent, MMTPConnection& aConnection);    
       
    88     void SessionClosedL(const TMTPNotificationParamsSessionChange& aSession);
       
    89     void SessionOpenedL(const TMTPNotificationParamsSessionChange& aSession);
       
    90     void RenameObjectL(const TMTPNotificationParamsHandle& aParam);
       
    91     
       
    92     TUint QueryImageObjectCountL();
       
    93     
       
    94 private:
       
    95     struct SMTPImageDpParentCache
       
    96         {        
       
    97         TPath   iPath;
       
    98         TUint32 iHandle;
       
    99         };
       
   100     
       
   101 private:
       
   102 	/**
       
   103     FLOGGER debug trace member variable.
       
   104     */
       
   105     __FLOG_DECLARATION_MEMBER_MUTABLE;
       
   106     
       
   107     CMTPImageDpObjectPropertyMgr*       iPropertyMgr;    
       
   108     CMTPImageDpThumbnailCreator*        iThumbnailManager;
       
   109     CMTPImageDpMdeObserver*             iMdeObserver;
       
   110     CRepository*                        iRepository;
       
   111     CMTPImageDpRenameObject*            iRenameObject;
       
   112     
       
   113     /**
       
   114     The active request processors table.
       
   115     */ 
       
   116     RPointerArray<MMTPRequestProcessor> iActiveProcessors;
       
   117     
       
   118     /**
       
   119      * contain the image mapping of extenstion to formatcode
       
   120      */
       
   121     RHashMap<TBuf<KMaxExtNameLength>, TMTPFormatCode> iFormatMappings;
       
   122     
       
   123     SMTPImageDpParentCache  iParentCache;
       
   124     
       
   125     TUint                   iPrePictures;
       
   126     
       
   127     TInt                    iActiveProcessor;
       
   128     TBool                   iActiveProcessorRemoved;    
       
   129     TBool                   iEnumerated;
       
   130 	
       
   131 	RPointerArray<HBufC>    iDeleteObjectsArray;
       
   132     };
       
   133     
       
   134 #endif // CMTPIMAGEDP_H