mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovider.h
changeset 0 a2952bb97e68
child 9 bee149131e4b
child 25 d881023c13eb
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  media mtp data provider
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMEDIAMTPDATAPROVIDER_H
       
    20 #define CMEDIAMTPDATAPROVIDER_H
       
    21 
       
    22 #include <mtp/cmtpdataproviderplugin.h>
       
    23 
       
    24 #include "mediamtpdataproviderprocessor.h"
       
    25 #include "mmmtpenumerationcallback.h"
       
    26 #include "mmmtpdpconfig.h"
       
    27 
       
    28 // Forward declaration
       
    29 class MMmRequestProcessor;
       
    30 class CMediaMtpDataProviderEnumerator;
       
    31 class CMTPObjectMetaData;
       
    32 class CRenameObject;
       
    33 
       
    34 /**
       
    35 * Defines media mtp data provider plugin
       
    36 */
       
    37 class CMediaMtpDataProvider : public CMTPDataProviderPlugin,
       
    38     public MMTPEnumerationCallback,
       
    39     public MMmMtpDpConfig
       
    40     {
       
    41 public:
       
    42     /**
       
    43     * Two Phase Construction
       
    44     * @param aParams pointer to MMTPDataProviderFramework
       
    45     */
       
    46     static TAny* NewL( TAny* aParams );
       
    47 
       
    48     /**
       
    49     * Destructor.
       
    50     */
       
    51     ~CMediaMtpDataProvider();
       
    52 
       
    53 public:
       
    54     // from MMmMtpDpConfig
       
    55     const RArray<TUint>* GetSupportedFormat() const;
       
    56 
       
    57     const RArray<TUint>* GetSupportedPropertiesL( TUint32 aFormatCode ) const;
       
    58 
       
    59     const RArray<TUint>* GetAllSupportedProperties() const;
       
    60 
       
    61     /**
       
    62     * Get default storage Id from resource file, if not specify a storage Id
       
    63     * @return TUint32 Default storage Id which read from resource file
       
    64     */
       
    65     TUint32 GetDefaultStorageIdL() const;
       
    66 
       
    67     /**
       
    68     * @return the reference of CMmMtpDpMetadataAccessWrapper to enumerator
       
    69     */
       
    70     CMmMtpDpMetadataAccessWrapper& GetWrapperL();
       
    71 
       
    72 protected:
       
    73     // from CMTPDataProviderPlugin
       
    74     void Cancel();
       
    75 
       
    76     void ProcessEventL( const TMTPTypeEvent& aEvent,
       
    77         MMTPConnection& aConnection );
       
    78 
       
    79     void ProcessNotificationL( TMTPNotification aNotification,
       
    80         const TAny* aParams );
       
    81 
       
    82     /**
       
    83     * Process the request from initiator
       
    84     * @param aPhase    The request transaction phase
       
    85     * @param aRequest    The request to be processed
       
    86     * @param aConnection    The connection from which the request comes
       
    87     */
       
    88     void ProcessRequestPhaseL( TMTPTransactionPhase aPhase,
       
    89         const TMTPTypeRequest& aRequest,
       
    90         MMTPConnection& aConnection );
       
    91 
       
    92     void SessionOpenedL( const TMTPNotificationParamsSessionChange& aSession );
       
    93 
       
    94     /**
       
    95     * Notify the data provider that the session has been closed
       
    96     * @param aSession    The connection of the sesssion
       
    97     */
       
    98     void SessionClosedL( const TMTPNotificationParamsSessionChange& aSession );
       
    99 
       
   100     /**
       
   101     * Notify the data provider that the object has been changed
       
   102     * @param aObject    the changed object
       
   103     */
       
   104     void RenameObjectL( const TMTPNotificationParamsHandle& aObject );
       
   105 
       
   106     void StartObjectEnumerationL( TUint32 aStorageId );
       
   107 
       
   108     void StartStorageEnumerationL();
       
   109 
       
   110     /**
       
   111     * Defines the supported operations and formats of the data provider
       
   112     * @param aCategory Defines what MTP is quering the DP about
       
   113     * @param aArray Supported() edits array to append supported features
       
   114     */
       
   115     void Supported( TMTPSupportCategory aCategory, RArray<TUint>& aArray ) const;
       
   116 
       
   117     void SupportedL( TMTPSupportCategory aCategory, CDesCArray& aStrings ) const;
       
   118 
       
   119 protected:
       
   120     // From MMTPEnumerationCallback
       
   121     /**
       
   122     * enumeration completed
       
   123     */
       
   124     void NotifyEnumerationCompleteL( TUint32 aStorageId, TInt aError );
       
   125 
       
   126 private:
       
   127     /**
       
   128     * Standard C++ constructor
       
   129     * @param aParams    pointer to MMTPDataProviderFramework
       
   130     */
       
   131     CMediaMtpDataProvider( TAny* aParams );
       
   132 
       
   133     /**
       
   134     * Second-phase construction
       
   135     */
       
   136     void ConstructL();
       
   137 
       
   138     /**
       
   139     * Find or create a request processor that can process the request
       
   140     * @param aRequest    The request to be processed
       
   141     * @param aConnection The connection from which the request comes
       
   142     * @return the index of the found/created request processor
       
   143     */
       
   144     TInt LocateRequestProcessorL( const TMTPTypeRequest& aRequest,
       
   145         MMTPConnection& aConnection );
       
   146 
       
   147     /**
       
   148     * Find or create a request processor that can process the event
       
   149     * @param aEvent    The event to be processed
       
   150     * @param aConnection The connection from which the request comes
       
   151     * @return the index of the found/created request processor
       
   152     */
       
   153     TInt LocateRequestProcessorL( const TMTPTypeEvent& aEvent,
       
   154         MMTPConnection& aConnection );
       
   155 
       
   156     void InsertL( RArray<TUint>& aArray, const TUint aProperCode ) const;
       
   157 
       
   158     void GetSupportedFormatL();
       
   159 
       
   160     void GetSupportedPropL();
       
   161 
       
   162     void GetAllSupportedPropL();
       
   163 
       
   164 private:
       
   165     // data
       
   166     RPointerArray<MMmRequestProcessor> iActiveProcessors;
       
   167     CMediaMtpDataProviderEnumerator* iMediaEnumerator;
       
   168     RArray<TUint32> iPendingEnumerations;
       
   169 
       
   170     TInt iActiveProcessor;
       
   171     TBool iIsSessionOpen;
       
   172 
       
   173     CRenameObject *iRenameObject;
       
   174 
       
   175     RArray<TUint> iSupportedFormat;
       
   176 
       
   177     RArray<TUint> iSupportedPropAudio;
       
   178     RArray<TUint> iSupportedPropVideo;
       
   179     RArray<TUint> iSupportedPropAll;
       
   180 
       
   181     TUint32 iDefaultStorageId;
       
   182 
       
   183     };
       
   184 
       
   185 #endif // CMEDIAMTPDATAPROVIDER_H