homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfilldrivemngr.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:  Fill drive manager class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CMFMFILLDRIVEMNGR_H
       
    21 #define __CMFMFILLDRIVEMNGR_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include "cmfmcommon.h"
       
    25 
       
    26 // Forward declarations
       
    27 class CCmDriveInfo;
       
    28 
       
    29 /**
       
    30  *  CCmFmFillDriveMngr class
       
    31  *  Part of Fill manager. CCmFmFillDriveMngr manages
       
    32  *  driveId checking, which is executed before every fill
       
    33  *  operation.
       
    34  *
       
    35  *  @lib cmfillmanager.lib
       
    36  *
       
    37  *  @since S60 5.1
       
    38  */
       
    39 NONSHARABLE_CLASS( CCmFmFillDriveMngr ): public CBase
       
    40     {
       
    41 
       
    42 public:
       
    43 
       
    44     /**     
       
    45      * Two-phased constructor.
       
    46      *
       
    47      * @since S60 5.1
       
    48      * @param aFs, File server session
       
    49      * @param aDrives, dirve array
       
    50      * @return  pointer to CCmFmFillDriveMngr class
       
    51      */
       
    52     static CCmFmFillDriveMngr* NewL( RFs& aFs, 
       
    53         RPointerArray<CCmDriveInfo>& aDrives );
       
    54     
       
    55     /**
       
    56      * Two-phased constructor.
       
    57      *
       
    58      * @since S60 5.1
       
    59      * @param aFs, File server session
       
    60      * @param aDrives, dirve array
       
    61      * @return  pointer to CCmFmFillDriveMngr class
       
    62      */
       
    63     static CCmFmFillDriveMngr* NewLC( RFs& aFs, 
       
    64         RPointerArray<CCmDriveInfo>& aDrives );
       
    65 
       
    66     /**
       
    67      * Destructor.
       
    68      */
       
    69     virtual ~CCmFmFillDriveMngr();
       
    70     
       
    71 public: 
       
    72     
       
    73     /**
       
    74      * Checking Drive Id
       
    75      *
       
    76      * @since S60 5.1
       
    77      * @param None
       
    78      * @return TCmFmStatus status of the drive id check
       
    79      */    
       
    80     TCmFmStatus CheckDriveId();
       
    81 
       
    82     /**
       
    83      * Checkking if the Drive has a capasity for saving the file
       
    84      *
       
    85      * @since S60 5.1
       
    86      * @param aFileSize, size of the file
       
    87      * @param aDriveId, drive id
       
    88      * @param aDriveNumber, drive number ( -1 if no space left )
       
    89      * @return index to drive array
       
    90      */        
       
    91     TInt CheckFreeDiscSpace( TUint32 aFileSize, TUint& aDriveId, 
       
    92                              TInt& aDriveNumber );                           
       
    93     
       
    94 private:
       
    95 
       
    96     /**
       
    97      * Mounts file system
       
    98      *
       
    99      * @since S60 5.1
       
   100      * @param aFileServer, file server session
       
   101      * @param aVolInfo, drive info
       
   102      * @param aDriveNumber, drive number
       
   103      * @return error code
       
   104      */  
       
   105     TInt DoMountFileSystem( RFs& aFileServer, TVolumeInfo& aVolInfo, 
       
   106         TInt aDriveNumber );
       
   107     
       
   108     /**
       
   109      * Selects drive to be used
       
   110      *
       
   111      * @since S60 5.1
       
   112      * @param None
       
   113      * @return Drive number
       
   114      */    
       
   115     TInt SelectDrive();
       
   116 
       
   117 private:
       
   118 
       
   119     /**
       
   120      * Performs the first phase of two phase construction.
       
   121      *
       
   122      * @since S60 5.1
       
   123      * @param aFs, file server
       
   124      * @param aDrives, drive array
       
   125      */
       
   126     CCmFmFillDriveMngr( RFs& aFs, 
       
   127         RPointerArray<CCmDriveInfo>& aDrives );
       
   128 
       
   129     /**
       
   130      * Second-phase constructor.
       
   131      */
       
   132     void ConstructL();
       
   133     
       
   134 
       
   135 private:
       
   136     
       
   137     /**
       
   138      * File server session
       
   139      */ 
       
   140     RFs iFsSession;
       
   141     
       
   142     /**
       
   143      * Drive info array
       
   144      */ 
       
   145     RPointerArray<CCmDriveInfo>& iDrives;
       
   146     
       
   147     };
       
   148 
       
   149 #endif //  __CMFMFILLDRIVEMNGR_H