homesync/contentmanager/mediaservant/applicationengine/inc/msengineao.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2008 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:  file sharing engine active object class definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __MSENGINEAO_H__
       
    21 #define __MSENGINEAO_H__
       
    22 
       
    23 
       
    24 // Include Files
       
    25 #include "contentmanager.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CMSEngine;
       
    29 class MMSEngineObserver;
       
    30 
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34  * Active object class for MSEngine
       
    35  *
       
    36  * @lib msengine.lib
       
    37  *
       
    38  * @since S60 5.1
       
    39  */
       
    40 NONSHARABLE_CLASS( CMSEngineAO ): public CActive
       
    41     {
       
    42 private:
       
    43     // Active object states
       
    44     enum TMSEngineAOState
       
    45         {
       
    46         EMSEngineStateNone = 0,
       
    47         EMSEngineHarvest,
       
    48         EMSEngineFill,
       
    49         EMSEngineStore,
       
    50         EMSEngineDeleteFiles,
       
    51         EMSEnginePreprocess,
       
    52         EMSEngineGetMetadata,
       
    53         EMSEnginePreprocessList,
       
    54         EMSEngineDeleteMetadata,
       
    55         EMSUpdateFillLists
       
    56         };
       
    57 
       
    58 public:
       
    59 
       
    60     /**
       
    61      * Two-phased constructor.
       
    62      *
       
    63      * @since S60 5.1
       
    64      * @param CMSEngine*, pointer to mediaservant engine.
       
    65      * @return 5.1
       
    66      */
       
    67     static CMSEngineAO* NewL( CMSEngine* aEngine );
       
    68 
       
    69     /**
       
    70      * Destructor.
       
    71      */
       
    72     virtual ~CMSEngineAO();
       
    73 
       
    74     /**
       
    75      * Scans media Servers
       
    76      *
       
    77      * @since S60 5.1
       
    78      * @param None
       
    79      * @return None
       
    80      */
       
    81     TInt ScanMediaServersL();
       
    82 
       
    83     /**
       
    84      * Start fill operation
       
    85      *
       
    86      * @since S60 5.1
       
    87      * @param None
       
    88      * @return None
       
    89      */
       
    90     void ExecuteFillL();
       
    91 
       
    92     /**
       
    93      * Start store operation
       
    94      *
       
    95      * @since S60 5.1
       
    96      * @param None
       
    97      * @return TInt, error code
       
    98      */
       
    99     TInt ExecuteStoreL();
       
   100 
       
   101     /**
       
   102      * Sets observer for active object
       
   103      *
       
   104      * @since S60 5.1
       
   105      * @param MMSEngineObserver*, pointer to the observer object.
       
   106      * @return None
       
   107      */
       
   108     IMPORT_C void SetObserver(MMSEngineObserver* aObserver);
       
   109 
       
   110     /**
       
   111      * Cancels current operation
       
   112      *
       
   113      * @since S60 5.1
       
   114      * @param None
       
   115      * @return None
       
   116      */
       
   117     void StopOperation();
       
   118 
       
   119     /**
       
   120      * Informs server that application is shutting down
       
   121      *
       
   122      * @since S60 5.1
       
   123      * @param None
       
   124      * @return None         
       
   125      */
       
   126     void ApplicationExit();
       
   127 
       
   128     /**
       
   129      * Deletes filled files
       
   130      *
       
   131      * @since S60 5.1
       
   132      * @param None
       
   133      * @return TInt, error code
       
   134      */
       
   135     TInt DeleteFilledFilesL();
       
   136 
       
   137     /**
       
   138      * Preprocesses file information for store.
       
   139      *
       
   140      * @since S60 5.1
       
   141      * @param None
       
   142      * @return None         
       
   143      */
       
   144     TInt ExecuteStorePreProcessingL();
       
   145 
       
   146     /**
       
   147      * Preprocesses file information for fill.
       
   148      *
       
   149      * @since S60 5.1
       
   150      * @param None
       
   151      * @return None         
       
   152      */
       
   153     TInt ExecuteFillPreProcessingL();
       
   154 
       
   155     /**
       
   156      * Gets metadata
       
   157      *
       
   158      * @since S60 5.1
       
   159      * @param aCollector, group of metadata categories
       
   160      * @return None
       
   161      */
       
   162     void GetFilteredMetadataL( CCmSqlPropertyCollector*& aCollector );
       
   163 
       
   164     /**
       
   165      * Preprocesses one fill list.
       
   166      *
       
   167      * @since S60 5.1
       
   168      * @param aListName, list name to be preprocessed
       
   169      * @return TInt, error code
       
   170      */
       
   171     TInt PreProcessFillListL( const TDesC8& aListName );
       
   172 
       
   173     /**
       
   174      * Update fill lists.
       
   175      *
       
   176      * @since S60 5.1
       
   177      * @param None
       
   178      * @return None         
       
   179      */
       
   180     void UpdateFillListsL();
       
   181 
       
   182     /**
       
   183      * Deletes metadata collected from given servers.
       
   184      *
       
   185      * @since S60 5.1
       
   186      * @param aServerList, list of servers
       
   187      * @return None
       
   188      */
       
   189     void DeleteMetadataL();
       
   190         
       
   191 protected:
       
   192     
       
   193 // From base class CActive
       
   194 
       
   195     /**
       
   196      * From CActive
       
   197      * See base class definition
       
   198      */
       
   199     virtual void RunL();
       
   200 
       
   201     /**
       
   202      * From CActive
       
   203      * See base class definition
       
   204      */
       
   205     virtual void DoCancel();
       
   206 
       
   207 private:
       
   208 
       
   209     /**
       
   210      * C++ default constructor.
       
   211      * @param aEngine*, pointer to mediaservant engine
       
   212      */
       
   213     CMSEngineAO( CMSEngine* aEngine );
       
   214 
       
   215     /**
       
   216      * By default Symbian 2nd phase constructor is private.
       
   217      */
       
   218     void ConstructL();
       
   219 
       
   220     /**
       
   221      * Opens Content Manager session
       
   222      * @since S60 5.1
       
   223      * @param None
       
   224      * @return TInt, error code
       
   225      */
       
   226     TInt OpenServerSession();
       
   227 
       
   228     /**
       
   229      * Closes Content Manager session
       
   230      *
       
   231      * @since S60 5.1
       
   232      * @param None
       
   233      * @return TInt, error code
       
   234      */
       
   235     TInt CloseServerSession();
       
   236 
       
   237 private:
       
   238 
       
   239     /**
       
   240      * file sharing engine pointer
       
   241      */
       
   242     CMSEngine*                  iEngine;            // not owned
       
   243 
       
   244     /**
       
   245      * mediaserver session handle
       
   246      */
       
   247     RContentManager             iContentManager;    // owned
       
   248 
       
   249     /**
       
   250      * engine observer
       
   251      */
       
   252     MMSEngineObserver*          iObserver;          // not owned
       
   253 
       
   254     /**
       
   255      * current operation
       
   256      */
       
   257     TCmService                  iCurrentService;
       
   258 
       
   259     /**
       
   260      * Active object state
       
   261      */
       
   262     TMSEngineAOState           iState;
       
   263     };
       
   264 
       
   265 #endif  // __MSENGINEAO_H__
       
   266 
       
   267 // End of file