sapi_mediamanagement/mediamanagementservice/inc/mgservice.h
changeset 0 14df0fbfcc4e
equal deleted inserted replaced
-1:000000000000 0:14df0fbfcc4e
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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 the License "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:  This Class provides the core functionality to
       
    15 *				 Media Management SAPI Interafce
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __CMGSERVICE_H
       
    22 #define __CMGSERVICE_H
       
    23 #include <e32base.h>
       
    24 #include <clfcontentlisting.hrh>
       
    25 
       
    26 #include "mgservice.hrh"
       
    27 
       
    28 class CPostFilter;
       
    29 class MCLFSortingStyle;
       
    30 class MMgOperationObserver;
       
    31 class CLiwGenericParamList;
       
    32 class MCLFContentListingEngine;
       
    33 class MCLFItemListModel;
       
    34 class CClfOperationObserver;
       
    35 
       
    36 _LIT8( KMgAscending,   "Ascending" );
       
    37 
       
    38 /**
       
    39 * This Class is used to contain all the request
       
    40 * parameters of the client
       
    41 * 
       
    42 * @since  Series60 v3.2
       
    43 */
       
    44 class TMgServiceRequest
       
    45 {
       
    46 
       
    47     public:
       
    48         /**
       
    49         * Constructor
       
    50         * @since  Series60 v3.2
       
    51         * @param void
       
    52         * @return void
       
    53         */
       
    54         TMgServiceRequest():iFileType( KNullDesC8 ),
       
    55                             iFilterField( KNullDesC8 ),
       
    56         					iStartVal( KNullDesC ),
       
    57         					iEndVal( KNullDesC ),
       
    58         					iSortField( KNullDesC8 ),
       
    59         					iOrder( KMgAscending ),
       
    60         					iTransactionID( 0 )
       
    61     	{
       
    62 
       
    63     	}
       
    64 
       
    65     public:	
       
    66 
       
    67         TPtrC8 iFileType;
       
    68 	    TPtrC8 iFilterField;
       
    69 		TPtrC  iStartVal;
       
    70 		TPtrC  iEndVal;
       
    71 		TPtrC8 iSortField;
       
    72     	TPtrC8 iOrder;
       
    73     	TUint  iTransactionID;
       
    74 
       
    75 
       
    76 };
       
    77 
       
    78 // CLASS DECLARATION
       
    79 
       
    80 /**
       
    81 * This Class provides the core functionality of
       
    82 * Media Management SAPI
       
    83 * 
       
    84 * @since  Series60 v3.2
       
    85 */
       
    86 class CMgService : public CBase
       
    87     {
       
    88 
       
    89     public:
       
    90 
       
    91     	 /**
       
    92         * Returns the instance of CMgService.
       
    93         * @since  Series60 v3.2
       
    94         * @param  void
       
    95         * @return CMgService* return the instance of CMgService class
       
    96         */
       
    97          IMPORT_C static CMgService* NewL();
       
    98 
       
    99         /**
       
   100     	* Destructor.
       
   101     	*/
       
   102         virtual ~CMgService();
       
   103 
       
   104 
       
   105          /**
       
   106         * This function extract all media item matches with the given arguments
       
   107         * Leave with System wide error code if the operation did not
       
   108         * succeed.
       
   109         * @since  Series60 v3.2
       
   110         * @param aFileType 	It specifies the required media type
       
   111         * @param aFilterField It specifies the Filter criteria
       
   112         * @param aStartVal 	It specifies the start value for filter criteria
       
   113         * @param aEndVal   	It specifies the end value for filter criteria
       
   114         * @param aSortField	It specifies the field for sorting the result
       
   115         * @param aOrder		It specifies the sorting order Ascending/Descending
       
   116         * @param aServiceObserver It specifies Callback for Asynchronous request
       
   117         */
       
   118        	IMPORT_C void GetListL( const TMgServiceRequest& aInParameters,
       
   119 							    MMgOperationObserver* aServiceObserver );
       
   120 
       
   121          /**
       
   122         * Cancel the pending asynchronous request
       
   123         * @since  Series60 v3.2
       
   124         * @param  void
       
   125         * @return void
       
   126         */
       
   127         IMPORT_C TInt CancelL( TUint aTransactionID );
       
   128 
       
   129          /**
       
   130         * It will clear the  filter metadata field ,registered callback
       
   131         * and sorting fields
       
   132         * @since  Series60 v3.2
       
   133         * @param  void
       
   134         * @return void
       
   135         */
       
   136         void Clear();
       
   137 
       
   138 
       
   139    		/**
       
   140         * It will return the state of service class
       
   141         * @since  Series60 v3.2
       
   142         * @param  void
       
   143         * @return State(EMgFree/EMgBusy) which indicates the availability of class
       
   144         *		  for another request
       
   145         */
       
   146    		 IMPORT_C const TMgState& State() const;
       
   147 
       
   148    	private:
       
   149 
       
   150    		/**
       
   151         * It will set the metadata field on which the result
       
   152         * should be sorted
       
   153         * Leave with KErrNotSupported if aSortField is not valid.
       
   154         * @since Series60 v3.2
       
   155         * @param aSortField metadata field for sort the result
       
   156        	* @param aOrder specify the order of sorting Ascending(0)/Descending(1)
       
   157        	* @param aMediaTypes specify the media type for which this sorting
       
   158        	*					 should performed
       
   159         */
       
   160  	    void SetSortingFieldL(  const TDesC8& aSortField ,
       
   161  	    					    const TDesC8&  aOrder ,
       
   162         					    const RArray<TInt>& aMediaTypes,
       
   163         					    MCLFItemListModel* alistModel );
       
   164 
       
   165         /**
       
   166         * It will set the metadata field and values on which the result
       
   167         * should be filtered.
       
   168         * Leave with KErrNotSupported/KErrArgument
       
   169         * if aSortField or aStartVal/aEndVal is not valid  .
       
   170         * @since  Series60 v3.2
       
   171         * @param aFilterField filter criteria
       
   172         * @param aStartVal Start value of the filter criteria
       
   173         * @param aEndVal	End Value of the filter criteria
       
   174         * @param aMediaTypes specify the media type for which this
       
   175        	*		 filtering should be performed
       
   176         */
       
   177         void SetFilterMetaDataL( const TDesC8& aFilterField,
       
   178         					     const TDesC& aStartVal,
       
   179         					     const TDesC& aEndVal,
       
   180         					     const RArray<TInt>& aMediaTypes,
       
   181         					     MCLFItemListModel* alistModel );
       
   182 
       
   183         /**
       
   184         * Two-phased constructor
       
   185         * @since  Series60 v3.2
       
   186         * @param  void
       
   187         * @return void
       
   188         */
       
   189         void ConstructL();
       
   190 
       
   191    		/**
       
   192         * Constructor
       
   193         * @since  Series60 v3.2
       
   194         * @param void
       
   195         * @return void
       
   196         */
       
   197         CMgService();
       
   198 
       
   199          /**
       
   200         * It will convert the aFiletype string into equivalent mediatype ID
       
   201         * which is recognized by underlying framework.(i.e CLF)
       
   202         * Leave with KErrNotSupported If that media type is not supported.
       
   203         * @since  Series60 v3.2
       
   204         * @param aFileType Required filetype(e.g image/music) in string format
       
   205         * @param aMediaType contains the ID of given file type
       
   206         *
       
   207         */
       
   208         static void SetMediaTypeL (const TDesC8& aFileType,
       
   209         					RArray<TInt>& aMediaType);
       
   210 
       
   211         /**
       
   212         * This function will pass the request to CLF for
       
   213         * required media type
       
   214         * @since  Series60 v3.2
       
   215         * @param aFileType 	It specifies the required media type
       
   216         * @param aFilterField It specifies the Filter criteria
       
   217         * @param aStartVal 	It specifies the start value for filter criteria
       
   218         * @param aEndVal   	It specifies the end value for filter criteria
       
   219         * @param aSortField	It specifies the field for sorting the result
       
   220         * @param aOrder		It specifies the sorting order Ascending/Descending
       
   221         * @return 			System wide error code if the operation did not
       
   222         *         			succeed.
       
   223         */
       
   224         void SendRequestToClfL( const TDesC8& aFileType,
       
   225         					   const TDesC8& aFilterField,
       
   226         					   const TDesC& aStartVal,
       
   227         					   const TDesC& aEndVal,
       
   228         					   const TDesC8& aSortField,
       
   229         					   const TDesC8& aOrder,
       
   230         					   MCLFItemListModel* listModel );
       
   231 
       
   232          /**
       
   233         * This function will check whether metadata is supported for
       
   234         * requested mediafiles or not,If it is supported 
       
   235         * then convert it into equivalent metadata ID
       
   236         * @since  Series60 v3.2
       
   237         * @param aFilterData Input filter data in string format
       
   238         * @param aFilterMetaData Equivalent metadata Id filled by the function
       
   239         * @param aFilterDataType Datatype of the given aFilterData
       
   240         * @return void
       
   241         */
       
   242         static void GetMetaDataIdAndType( const TDesC8& aFilterData,
       
   243         						   TCLFDefaultFieldId& aFilterMetaData,
       
   244         						   TCLFItemDataType& aFilterDataType ,
       
   245         						   const RArray<TInt> &aMediaTypes );
       
   246 
       
   247 
       
   248     private:
       
   249 
       
   250     	/**
       
   251      	* indicates whether service class is busy or free to accept another request.
       
   252      	*/
       
   253     	TMgState iState;
       
   254 
       
   255        	/**
       
   256      	* stores the instance of the engine of CLF Framework
       
   257      	*/
       
   258     	MCLFContentListingEngine* iEngine;
       
   259 
       
   260 
       
   261     	/**
       
   262      	* store the instance of CPostfilter which filters the result
       
   263      	* as per the set filter criteria
       
   264      	*/
       
   265     	CPostFilter* iFilter;
       
   266 
       
   267     	/**
       
   268      	* store the instance of sorting style which sorts the result
       
   269      	* as per the set sort criteria
       
   270      	*/
       
   271        	MCLFSortingStyle* iSortingStyle;
       
   272 
       
   273        	/**
       
   274      	* store the instance of class which observes CLF event
       
   275      	*/
       
   276        	CClfOperationObserver* iClfObserver;
       
   277        	
       
   278        	/**
       
   279      	* stores the Cuurent TransactionID
       
   280      	*/
       
   281     	TUint  iTransactionID;
       
   282       };
       
   283 
       
   284 #endif __CMGSERVICE_H