epoc32/include/mw/rsfwmountman.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/rsfwmountman.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,391 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  RSFW Mount Manager API
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef CRSFWMOUNTMAN_H
    1.23 +#define CRSFWMOUNTMAN_H
    1.24 +
    1.25 +#include <e32cmn.h>
    1.26 +#include <e32base.h>
    1.27 +#include <f32file.h>
    1.28 +#include <s32strm.h>
    1.29 +
    1.30 +#include <rsfwmountentry.h> // mount entry constants
    1.31 +
    1.32 +class TRsfwMountInfo;
    1.33 +
    1.34 +// FORWARD DECLARATIONS
    1.35 +class CRsfwMountEntry;
    1.36 +class CRsfwMountManImpl;
    1.37 +class CDesC16Array;
    1.38 +
    1.39 +// CONSTANTS
    1.40 +// the secure UID of the server, used as a P&S key category
    1.41 +const TUid KRfeServerSecureUid = { 0x101F970D };
    1.42 +//the maximum number of remote drives
    1.43 +const TInt KMaxRemoteDrives = 9;
    1.44 +
    1.45 +// DATA TYPES
    1.46 +// Event types for MRsfwMountManObserver
    1.47 +enum TMountManEvent
    1.48 +    {
    1.49 +    EMountManEventMountConfigurationChanged = 1,
    1.50 +    EMountManEventMounted
    1.51 +    };
    1.52 +
    1.53 +// P&S keys
    1.54 +// for notifying UI that a remote drive has been connected or disconnected
    1.55 +enum TRfePSKeys
    1.56 +	{
    1.57 +	ERsfwPSKeyConnect
    1.58 +	};
    1.59 +
    1.60 +// Connection states
    1.61 +const TUint KMountStronglyConnected = 0x01;
    1.62 +const TUint KMountConnecting = 0x02; // temporary state during establishing a connection
    1.63 +                                     // to the drive, not to be used via MountMan API
    1.64 +const TUint KMountNotConnected      = 0x03;
    1.65 +
    1.66 +// CLASS DECLARATION
    1.67 +/**
    1.68 + *  Interface for receiving mounting events
    1.69 + *
    1.70 + *  @lib mountman.dll
    1.71 + *  @since Series 60 3.1
    1.72 + */
    1.73 +
    1.74 +class MRsfwMountManObserver
    1.75 +    {
    1.76 +public:
    1.77 +    /**
    1.78 +     * Handles an event emanating from a CRsfwMountMan class
    1.79 +     *
    1.80 +     * @param aEventType type of the event
    1.81 +     * @param aStatus status code
    1.82 +     * @param aArg miscellaneous arguments
    1.83 +     */
    1.84 +    virtual void HandleMountManEventL(TMountManEvent aEvent,
    1.85 +                                      TInt aStatus,
    1.86 +                                      TAny* aArg) = 0;
    1.87 +    };
    1.88 +
    1.89 +/**
    1.90 + *  Encapsulates remote mount configuration.
    1.91 + *
    1.92 + *  @lib rsfwmountman.dll
    1.93 + *  @since Series 60 3.1
    1.94 + */
    1.95 +class TRsfwMountConfig
    1.96 +    {
    1.97 +public:   // New functions
    1.98 +    IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
    1.99 +    IMPORT_C void InternalizeL(RReadStream& aStream);
   1.100 +
   1.101 +public:   // Data
   1.102 +    TChar                         iDriveLetter;
   1.103 +    TBuf<KMaxMountNameLength>     iName;
   1.104 +    TBuf<KMaxMountUriLength>      iUri;
   1.105 +    TBuf<KMaxMountUserNameLength> iUserName;
   1.106 +    TBuf<KMaxMountPasswordLength> iPassword;
   1.107 +    TBuf<KMaxMountAuxDataLength>  iAuxData;
   1.108 +    TUint                         iFlags;
   1.109 +    TInt                          iInactivityTimeout;
   1.110 +    };
   1.111 +    
   1.112 +
   1.113 +/**
   1.114 + *  Encapsulates remote mount status information.
   1.115 + *
   1.116 + *  @lib rsfwmountman.dll
   1.117 + *  @since Series 60 3.1
   1.118 + */
   1.119 +class TRsfwMountStatus
   1.120 +    {
   1.121 +public:   // Data
   1.122 +    TInt                          iVolumeId;
   1.123 +    /** iMountState is not used and will be removed */
   1.124 +    TUint                         iMountState;  
   1.125 +    /** see KMountStronglyConnected and other connection states */
   1.126 +    TUint                         iConnectionState; 
   1.127 +    TInt                          iCachedSize;
   1.128 +    TInt                          iInactivityTime;
   1.129 +    TInt                          iInactivityTimeout;
   1.130 +    TBool                         iPermanence;
   1.131 +    };
   1.132 +    
   1.133 +
   1.134 +/**
   1.135 + *  Encapsulates all information about a mount.
   1.136 + *
   1.137 + *  @lib rsfwmountman.dll
   1.138 + *  @since Series 60 3.1
   1.139 + */
   1.140 +class TRsfwMountInfo
   1.141 +    {
   1.142 +public:   // New functions
   1.143 +    void ExternalizeL(RWriteStream& aStream) const;
   1.144 +    void InternalizeL(RReadStream& aStream);
   1.145 +
   1.146 +public:   // Data
   1.147 +    TRsfwMountConfig                  iMountConfig;
   1.148 +    TRsfwMountStatus                  iMountStatus;
   1.149 +    }; 
   1.150 +    
   1.151 +
   1.152 +
   1.153 +
   1.154 +// CLASS DECLARATION
   1.155 +
   1.156 +/**
   1.157 + *  Class for managing mounts to remote file repositories
   1.158 + *
   1.159 + *  @lib mountman.dll
   1.160 + *  @since Series 60 3.1
   1.161 + */
   1.162 +
   1.163 +class CRsfwMountMan : public CBase
   1.164 +    {
   1.165 +public: // Constructors and destructor
   1.166 +    /**
   1.167 +     * Two-phased constructor.
   1.168 +     *
   1.169 +     * @param aDefaultFlags must be set to KMountFlagInteractive
   1.170 +     *   if the user is to be prompted during the mount procedure.
   1.171 +     *   Otherwise the parameter can be set to zero.
   1.172 +     * @param mount event observer
   1.173 +     * @return pointer to the created CRsfwMountMan object instance
   1.174 +     */
   1.175 +    IMPORT_C static CRsfwMountMan* NewL(TUint aDefaultFlags,
   1.176 +                                    MRsfwMountManObserver* aMountManObserver);
   1.177 +
   1.178 +    /**
   1.179 +     * Destructor.
   1.180 +     */
   1.181 +    IMPORT_C virtual ~CRsfwMountMan();
   1.182 +
   1.183 +public: // New functions
   1.184 +    /**
   1.185 +     * Returns a list of friendly names of all mount configurations
   1.186 +     * in the mount configuration repository.
   1.187 +     * The entries are returned in the order that they appear in the
   1.188 +     * repository.
   1.189 +     * @param aNames friendly names
   1.190 +     * @return nothing
   1.191 +     */
   1.192 +    IMPORT_C void GetMountNamesL(CDesC16Array* aNames) const;
   1.193 +
   1.194 +    /**
   1.195 +     * Gets the mount configuration entry having the given friendly name.
   1.196 +     * The caller must make sure that the name is unique.
   1.197 +     * @param aId friendly name
   1.198 +     * @return a pointer to the configuration entry or NULL if not found
   1.199 +     */
   1.200 +    IMPORT_C const CRsfwMountEntry* MountEntryL(const TDesC& aName) const;
   1.201 +
   1.202 +    /**
   1.203 +     * Gets the mount configuration entry for the given drive letter.
   1.204 +     * @param aDriveLetter drive letter
   1.205 +     * @return a pointer to the configuration entry or NULL if not found
   1.206 +     */
   1.207 +    IMPORT_C const CRsfwMountEntry* MountEntryL(TChar aDriveLetter) const;
   1.208 +
   1.209 +    /**
   1.210 +     * Adds a mount configuration entry in the configurations and
   1.211 +     * mounts the drive in the File Server.
   1.212 +     * If the drive letter item is not set in the configuration,
   1.213 +     * a free letter will be allocated.
   1.214 +     * Then the EMountEntryItemDrive value in aMountEntry will be changed.
   1.215 +     * The EMountEntryItemIndex item of aMountEntry is used for
   1.216 +     * positioning the entry in a specific order in the configuration database
   1.217 +     * (the index itself is not stored)
   1.218 +     *
   1.219 +     * @param aMountEntry mount configuration entry
   1.220 +     *  the ownership of the pointer is transferred to CRsfwMountMan
   1.221 +     * @return nothing
   1.222 +     * @leave KErrInUse selected drive letter already in used
   1.223 +     * @leave KErrInUse selected name is in use
   1.224 +     * @leave KErrInUse 9 remote drives already define
   1.225 +     * (Number of remote drives is limited by default to 9 so that drive 
   1.226 +     *  letters are also available for other technologies)
   1.227 +     * @leave KErrAccessDenied program does not have sufficient capabilities
   1.228 +     *        required capabilities are DiskAdmin (to mount new remote drive in 
   1.229 +     *        File Server) and WriteDeviceData (to add new remote drive to
   1.230 +     *         Central Repository)
   1.231 +     * @leave KErrNotFound
   1.232 +     *        File System plug-in, Central Repository table etc. not found
   1.233 +     */
   1.234 +    IMPORT_C void AddMountEntryL(CRsfwMountEntry* aMountEntry);
   1.235 +
   1.236 +    /**
   1.237 +     * Deletes a mount entry from the configurations and unmounts the drive.
   1.238 +     * Nothing is done if the entry does not exist.
   1.239 +     *
   1.240 +     * @param aName name
   1.241 +     * @return nothing
   1.242 +     */
   1.243 +    IMPORT_C void DeleteMountEntryL(const TDesC& aName);
   1.244 +
   1.245 +    /**
   1.246 +     * Deletes a mount entry from the configurations and unmounts the drive.
   1.247 +     * Nothing is done if the entry does not exist.
   1.248 +     *
   1.249 +     * @param aDriveLetter drive letter
   1.250 +     * @return nothing
   1.251 +     */
   1.252 +    IMPORT_C void DeleteMountEntryL(TChar aDriveLetter);
   1.253 +
   1.254 +  
   1.255 +    /**
   1.256 +     * Gets a list of all drives as seen by the File Server
   1.257 +     *
   1.258 +     * Returns drive letters. 
   1.259 +     * Letters for local drives are in the front of the list
   1.260 +     * Letters for remote drives in order defined in CenRep
   1.261 +     *   The number of the drives is the same as the length of the list
   1.262 +     *
   1.263 +     * @param aDriveList returned drive list
   1.264 +     * @return number of remote drives
   1.265 +     */
   1.266 +    IMPORT_C TInt GetAllDrivesL(TDriveList& aDriveList) const;
   1.267 +
   1.268 +    /**
   1.269 +     * Gets a list of all remote drives as seen by the File Server
   1.270 +     *
   1.271 +     * The list contains the letters of the remote drives.
   1.272 +     * Letters for remote drives in order defined in CenRep
   1.273 +     *   The number of the drives is the same as the length of the list
   1.274 +     *
   1.275 +     * @param aDriveList returned drive list
   1.276 +     * @return number of remote drives
   1.277 +     */
   1.278 +    IMPORT_C TInt GetRemoteMountListL(TDriveList& aDriveList) const;
   1.279 +    
   1.280 +    /**
   1.281 +     * Gets mount information for an active remote drive.
   1.282 +     *
   1.283 +     * The information consists of static configuration information and
   1.284 +     *   status information (such as strongly or weakly connected).
   1.285 +     * Note that if the drive is not atctive this function will 
   1.286 +     * return -1, you need to use MountEntryL to get just the static 
   1.287 +     * configuration information
   1.288 +     *
   1.289 +     * @param aDriveLetter drive letter of the mount
   1.290 +     * @param aMountInfo returned information
   1.291 +     * @return error code
   1.292 +     */
   1.293 +    IMPORT_C TInt GetMountInfo(TChar aDriveLetter, TRsfwMountInfo& aMountInfo) const;
   1.294 +
   1.295 +    /**
   1.296 +     * Sets the connection state of a mount for an active remote drive
   1.297 +     *
   1.298 +     * @param aDriveLetter drive letter of the mount
   1.299 +     * @param aConnectionState
   1.300 +     *   The following connection states have been defined:
   1.301 +     *     KMountStronglyConnected = strongly connected state
   1.302 +     *     KMountWeaklyConnected   = weakly connected state
   1.303 +     *     KMountNotConnected      = disconnected state
   1.304 +     *
   1.305 +     * @return error code
   1.306 +     */
   1.307 +    IMPORT_C TInt SetMountConnectionState(TChar aDriveLetter,
   1.308 +                                          TUint aConnectionState);
   1.309 +
   1.310 +    /**
   1.311 +     * Changes a mount configuration entry in the configurations
   1.312 +     *  
   1.313 +     * @param aMountEntry mount configuration entry
   1.314 +     *  the ownership of the pointer is transferred to CRsfwMountMan
   1.315 +     * @return nothing
   1.316 +     * @leave KErrInUse if the name of the mount is used by other mount
   1.317 +     * @leave KErrAccessDenied program does not have sufficient capabilities
   1.318 +     *        required capabilities are DiskAdmin (to mount new remote drive in 
   1.319 +     *        File Server) and WriteDeviceData (to add new remote drive to
   1.320 +     *         Central Repository)
   1.321 +     * @leave KErrNotFound if mount with given letter not found or
   1.322 +     *        File System plug-in, Central Repository table etc. not found
   1.323 +     */
   1.324 +    IMPORT_C void EditMountEntryL(CRsfwMountEntry* aMountEntry);
   1.325 +    
   1.326 +    
   1.327 +     /**
   1.328 +     * Refresh a remote directory
   1.329 +     *
   1.330 +     * Ensures that contents of a remote directory are up to date.
   1.331 +     * Synchronous variant deletes the currently cached version.
   1.332 +     * Note that this function intentionally does not return directory
   1.333 +     * contents. All data should be read through the File Server instead.
   1.334 +     *
   1.335 +     * @return KErrArgument Path refers to a file
   1.336 +     *         KErrNotFound path is not found from cache
   1.337 +     */
   1.338 +    IMPORT_C TInt RefreshDirectory(const TDesC& aPath);
   1.339 +
   1.340 +    /**
   1.341 +     * Some applications have problems with handling remote files.
   1.342 +     * Function checks whether app with given UID is one of them.
   1.343 +     *  
   1.344 +     * @param aUid UID of the application
   1.345 +     * @return ETrue if it is on the black list, otherwise EFalse
   1.346 +     */    
   1.347 +    IMPORT_C TBool IsAppOnBlackList(TUid aUid) const;
   1.348 +    
   1.349 +    
   1.350 +     /**
   1.351 +     * Cancels an active remote file upload or download
   1.352 +     * 
   1.353 +     * @param aFile file name
   1.354 +     * @return one of the system wide error codes.
   1.355 +     */    
   1.356 +    IMPORT_C TInt CancelRemoteTransfer(const TDesC& aFile);
   1.357 +    
   1.358 +    
   1.359 +    /**
   1.360 +     * Sets the connection state of a mount for an active remote drive
   1.361 +     * sends a bling request, does not wait for reply
   1.362 +     *
   1.363 +     * @param aDriveLetter drive letter of the mount
   1.364 +     * @param aConnectionState
   1.365 +     *   The following connection states have been defined:
   1.366 +     *     KMountStronglyConnected = strongly connected state
   1.367 +     *     KMountWeaklyConnected   = weakly connected state
   1.368 +     *     KMountNotConnected      = disconnected state
   1.369 +     *
   1.370 +     * @return error code
   1.371 +     */
   1.372 +    IMPORT_C TInt SetMountConnectionStateBlind(TChar aDriveLetter,
   1.373 +                                          TUint aConnectionState);
   1.374 +
   1.375 +    
   1.376 +private:
   1.377 +    /**
   1.378 +     * C++ default constructor
   1.379 +     */
   1.380 +    CRsfwMountMan();
   1.381 +    
   1.382 +    /**
   1.383 +     * Second phase constructor
   1.384 +     */
   1.385 +    void ConstructL(TUint aDefaultFlags,
   1.386 +                    MRsfwMountManObserver* aMountManObserver);
   1.387 +
   1.388 +private: // Data
   1.389 +    CRsfwMountManImpl* iMountManImpl; // implementation
   1.390 +    };
   1.391 +
   1.392 +#endif // CRSFWMOUNTMAN_H
   1.393 +
   1.394 +// End of File