imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h
changeset 14 2edacbf5d3f9
parent 0 2014ca87e772
child 15 7197e789b953
equal deleted inserted replaced
1:235a7fc86938 14:2edacbf5d3f9
    30 
    30 
    31 #include "thumbnailmanager.h"
    31 #include "thumbnailmanager.h"
    32 #include "thumbnailmanagerconstants.h" // TThumbnailServerRequestId
    32 #include "thumbnailmanagerconstants.h" // TThumbnailServerRequestId
    33 #include "thumbnailstore.h"     // TThumbnailPersistentSize
    33 #include "thumbnailstore.h"     // TThumbnailPersistentSize
    34 #include "tmshutdownobserver.h"
    34 #include "tmshutdownobserver.h"
       
    35 #include "tmformatobserver.h"
    35 
    36 
    36 // Needed for creating server thread.
    37 // Needed for creating server thread.
    37 const TUint KDefaultHeapSize = 160 * 1024;
    38 const TUint KDefaultHeapSize = 160 * 1024;
    38 
    39 
    39 class CThumbnailTaskProcessor;
    40 class CThumbnailTaskProcessor;
    42 class CThumbnailStore;
    43 class CThumbnailStore;
    43 class MIHLScaler;
    44 class MIHLScaler;
    44 class CThumbnailServerSession;
    45 class CThumbnailServerSession;
    45 class CThumbnailDiskUnmountObserver;
    46 class CThumbnailDiskUnmountObserver;
    46 class CThumbnailMemoryCardObserver;
    47 class CThumbnailMemoryCardObserver;
    47 class CThumbnailFormatObserver;
       
    48 
    48 
    49 /**
    49 /**
    50  * Helper function to destroy all objects which are referred to
    50  * Helper function to destroy all objects which are referred to
    51  * by pointers in a hash table.
    51  * by pointers in a hash table.
    52  * @since S60 v5.0
    52  * @since S60 v5.0
    73  *
    73  *
    74  *  @since S60 v5.0
    74  *  @since S60 v5.0
    75  */
    75  */
    76 NONSHARABLE_CLASS( CThumbnailServer ): public CPolicyServer,
    76 NONSHARABLE_CLASS( CThumbnailServer ): public CPolicyServer,
    77                                        public MMdESessionObserver,
    77                                        public MMdESessionObserver,
    78                                        public MTMShutdownObserver
    78                                        public MTMShutdownObserver,
       
    79                                        public MTMFormatObserver
    79     {
    80     {
    80 public:
    81 public:
    81 
    82 
    82     /**
    83     /**
    83      * Two-phased constructor
    84      * Two-phased constructor
   133     void HandleSessionError( CMdESession& aSession, TInt aError );    
   134     void HandleSessionError( CMdESession& aSession, TInt aError );    
   134     
   135     
   135     // from MTMShutdownObserver
   136     // from MTMShutdownObserver
   136     void ShutdownNotification();
   137     void ShutdownNotification();
   137 
   138 
       
   139     //From MTMFormatObserver
       
   140     void FormatNotification(TBool aFormat);    
       
   141     
   138     /**
   142     /**
   139      * Adds bitmap to bitmap pool. Server assumes ownership of the bitmap and
   143      * Adds bitmap to bitmap pool. Server assumes ownership of the bitmap and
   140      * implements reference counting to know when it is safe to delete
   144      * implements reference counting to know when it is safe to delete
   141      * the object. Reference count is increased if the bitmap already
   145      * the object. Reference count is increased if the bitmap already
   142      * exists in the pool.
   146      * exists in the pool.
   143      *
   147      *
   144      * @since S60 v5.0
   148      * @since S60 v5.0
   145      * @param aSession Server side session which owns the bitmap.
   149      * @param aSession Server side session which owns the bitmap.
   146      * @param aBitmap Bitmap to be added to pool.
   150      * @param aBitmap Bitmap to be added to pool.
       
   151      * @param aRequestId Session specific thumbnail request ID.
   147      */
   152      */
   148     void AddBitmapToPoolL( CThumbnailServerSession* aSession, CFbsBitmap*
   153     void AddBitmapToPoolL( CThumbnailServerSession* aSession, CFbsBitmap*
   149         aBitmap );
   154         aBitmap, TThumbnailServerRequestId aRequestId );
   150 
   155 
   151     /**
   156     /**
   152      * Store thumbnail.
   157      * Store thumbnail.
   153      *
   158      *
   154      * @since S60 v5.0
   159      * @since S60 v5.0
   160      * @param aThumbFromPath Thumbnail created from associated path.
   165      * @param aThumbFromPath Thumbnail created from associated path.
   161      * @param aThumbFromPath Check first if source uri exists.
   166      * @param aThumbFromPath Check first if source uri exists.
   162      */
   167      */
   163     void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aBitmap, const TSize&
   168     void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aBitmap, const TSize&
   164         aOriginalSize, const TBool aCropped, const TThumbnailSize aThumbnailSize,
   169         aOriginalSize, const TBool aCropped, const TThumbnailSize aThumbnailSize,
   165         const TThumbnailId aThumbnailId, const TBool aThumbFromPath = ETrue,
   170         const TInt64 aModified,
       
   171         const TBool aThumbFromPath = ETrue,
   166         const TBool aCheckExist = ETrue);
   172         const TBool aCheckExist = ETrue);
   167 
   173 
   168     /**
   174     /**
   169      * Fetch thumbnail image.
   175      * Fetch thumbnail image.
   170      *
   176      *
   182      */
   188      */
   183     void FetchThumbnailL( const TDesC& aPath, CFbsBitmap* & aThumbnail, 
   189     void FetchThumbnailL( const TDesC& aPath, CFbsBitmap* & aThumbnail, 
   184              TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize );
   190              TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize );
   185     
   191     
   186     /**
   192     /**
   187      * Fetch thumbnail image.
       
   188      *
       
   189      * @since S60 v5.0
       
   190      * @param aThumbnailId ID of the media object whose thumbnail is to be
       
   191      *              retrieved.
       
   192      * @param aThumbnail Pointer to get the fetched thumbnail bitmap.
       
   193      *                   Caller assumes ownership.
       
   194      */    
       
   195     void FetchThumbnailL( TThumbnailId aThumbnailId, CFbsBitmap* &
       
   196         aThumbnail, TDesC8* & aData, TThumbnailSize aThumbnailSize, TSize &aOriginalSize );
       
   197 
       
   198     /**
       
   199      * Delete thumbnails.
   193      * Delete thumbnails.
   200      *
   194      *
   201      * @since S60 v5.0
   195      * @since S60 v5.0
   202      * @param aPath           Path of the media object whose thumbnail is
   196      * @param aPath           Path of the media object whose thumbnail is
   203      *                        to be deleted.
   197      *                        to be deleted.
   318      * Get missing thumbnail sizes.
   312      * Get missing thumbnail sizes.
   319      *
   313      *
   320      * @since S60 v5.0
   314      * @since S60 v5.0
   321      * @param aPath Path associated to missing thumbnails
   315      * @param aPath Path associated to missing thumbnails
   322      * @param aMissingSizes Returns a list of thumbnail sizes not yet create related to the path
   316      * @param aMissingSizes Returns a list of thumbnail sizes not yet create related to the path
   323      */
   317 	 * @param aCheckGridSizeOnly check only is Grid size missing
   324     void GetMissingSizesAndIDsL( const TDesC& aPath, TInt aSourceType, RArray <
   318      */
   325         TThumbnailPersistentSize > & aMissingSizes, TBool& aMissingIDs);
   319     void GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray <
       
   320         TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly);
   326 
   321 
   327     /**
   322     /**
   328      * Fileserver
   323      * Fileserver
   329      *
   324      *
   330      * @since S60 v5.0
   325      * @since S60 v5.0
   368 
   363 
   369     /**
   364     /**
   370      * Update thumbnails in database
   365      * Update thumbnails in database
   371      *
   366      *
   372      * @since S60 v5.0
   367      * @since S60 v5.0
   373      * @param aItemId       TThumbnailId
       
   374      * @param aPath         (New) path for the Thumbnail
   368      * @param aPath         (New) path for the Thumbnail
   375      * @param aOrientation  Thumbnail orientation
   369      * @param aOrientation  Thumbnail orientation
   376      * @param aModified     Last modified
   370      * @param aModified     Last modified
   377      * @param TBool         EFalse, if new thumbs need to be created
   371      * @param TBool         EFalse, if new thumbs need to be created
   378      */  
   372      */  
   379     TBool UpdateThumbnailsL( const TThumbnailId aItemId, const TDesC& aPath,
   373     TBool UpdateThumbnailsL( const TDesC& aPath,
   380                              const TInt aOrientation, const TInt64 aModified );
   374                              const TInt aOrientation, const TInt64 aModified );
   381     
   375     
   382     /** 
   376     /** 
   383      * Resolve mime type from file extension
   377      * Resolve mime type from file extension
   384      *
   378      *
   430      * @since S60 v5.0
   424      * @since S60 v5.0
   431      * @param aPath Path to a file
   425      * @param aPath Path to a file
   432      * @return CThumbnailStore object
   426      * @return CThumbnailStore object
   433      */
   427      */
   434     CThumbnailStore* StoreForPathL( const TDesC& aPath );  
   428     CThumbnailStore* StoreForPathL( const TDesC& aPath );  
   435     
       
   436     /**
       
   437      * Update ID in database
       
   438      *
       
   439      * @since S60 v5.0
       
   440      * @param aItemId Id of item whose thumbnails are to be updated.
       
   441      * @param aNewPath Path property of the object to be updated.
       
   442      */  
       
   443     void UpdateIDL( const TDesC& aPath, const TThumbnailId aNewId );
       
   444     
   429     
   445     /**
   430     /**
   446      * Close Removable Stores
   431      * Close Removable Stores
   447      *
   432      *
   448      * @since S60 v5.0
   433      * @since S60 v5.0
   524      *
   509      *
   525      * @since S60 v5.0     
   510      * @since S60 v5.0     
   526      */
   511      */
   527     void OpenStoresL();
   512     void OpenStoresL();
   528     
   513     
   529  
   514     /**
       
   515      * Callback for reconnect timer
       
   516      *
       
   517      * @since S60 v5.0
       
   518      */
       
   519     static TInt ReconnectCallBack(TAny* aAny);
   530 
   520 
   531 private:
   521 private:
   532 
   522 
   533     /**
   523     /**
   534      * C++ default constructor
   524      * C++ default constructor
   570          * Bitmap object. Not owned directly by TThumbnailBitmapRef, but by
   560          * Bitmap object. Not owned directly by TThumbnailBitmapRef, but by
   571          * the server.
   561          * the server.
   572          * Not own.
   562          * Not own.
   573          */
   563          */
   574         CFbsBitmap* iBitmap;
   564         CFbsBitmap* iBitmap;
       
   565         
       
   566         /**
       
   567          * Request Id 
       
   568          */
       
   569         TThumbnailRequestId iRequestId;        
       
   570         
   575         };
   571         };
   576 
   572 
   577 private:
   573 private:
   578     // data
   574     // data
   579 
   575 
   648     */
   644     */
   649     RPointerArray<CThumbnailDiskUnmountObserver> iUnmountObservers;
   645     RPointerArray<CThumbnailDiskUnmountObserver> iUnmountObservers;
   650     
   646     
   651     CThumbnailMemoryCardObserver* iMMCObserver;
   647     CThumbnailMemoryCardObserver* iMMCObserver;
   652     
   648     
   653     CThumbnailFormatObserver* iFormatObserver;
   649     CTMFormatObserver* iFormatObserver;
   654 
   650 
   655     /**
   651     /**
   656      * Databases for each drive, identified by drive (EDriveC, etc).
   652      * Databases for each drive, identified by drive (EDriveC, etc).
   657      * New databases and created on-the-fly as new requests are received.
   653      * New databases and created on-the-fly as new requests are received.
   658      * Databases are closed when drives are dismounted.
   654      * Databases are closed when drives are dismounted.
   670      */
   666      */
   671     RArray < TThumbnailPersistentSize > iPersistentSizes;
   667     RArray < TThumbnailPersistentSize > iPersistentSizes;
   672     
   668     
   673     TBool iFormatting;
   669     TBool iFormatting;
   674     
   670     
       
   671     // reconnect timer
       
   672     CPeriodic* iReconnect;
       
   673     
   675 #ifdef _DEBUG
   674 #ifdef _DEBUG
   676     TUint32 iPlaceholderCounter;
   675     TUint32 iPlaceholderCounter;
   677 #endif
   676 #endif
   678 };
   677 };
   679 
   678