williamr@2: /* williamr@2: * Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: RSFW Mount Manager API williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef CRSFWMOUNTMAN_H williamr@2: #define CRSFWMOUNTMAN_H williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: #include // mount entry constants williamr@2: williamr@2: class TRsfwMountInfo; williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CRsfwMountEntry; williamr@2: class CRsfwMountManImpl; williamr@2: class CDesC16Array; williamr@2: williamr@2: // CONSTANTS williamr@2: // the secure UID of the server, used as a P&S key category williamr@2: const TUid KRfeServerSecureUid = { 0x101F970D }; williamr@2: //the maximum number of remote drives williamr@2: const TInt KMaxRemoteDrives = 9; williamr@2: williamr@2: // DATA TYPES williamr@2: // Event types for MRsfwMountManObserver williamr@2: enum TMountManEvent williamr@2: { williamr@2: EMountManEventMountConfigurationChanged = 1, williamr@2: EMountManEventMounted williamr@2: }; williamr@2: williamr@2: // P&S keys williamr@2: // for notifying UI that a remote drive has been connected or disconnected williamr@2: enum TRfePSKeys williamr@2: { williamr@2: ERsfwPSKeyConnect williamr@2: }; williamr@2: williamr@2: // Connection states williamr@2: const TUint KMountStronglyConnected = 0x01; williamr@2: const TUint KMountConnecting = 0x02; // temporary state during establishing a connection williamr@2: // to the drive, not to be used via MountMan API williamr@2: const TUint KMountNotConnected = 0x03; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: /** williamr@2: * Interface for receiving mounting events williamr@2: * williamr@2: * @lib mountman.dll williamr@2: * @since Series 60 3.1 williamr@2: */ williamr@2: williamr@2: class MRsfwMountManObserver williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Handles an event emanating from a CRsfwMountMan class williamr@2: * williamr@2: * @param aEventType type of the event williamr@2: * @param aStatus status code williamr@2: * @param aArg miscellaneous arguments williamr@2: */ williamr@2: virtual void HandleMountManEventL(TMountManEvent aEvent, williamr@2: TInt aStatus, williamr@2: TAny* aArg) = 0; williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Encapsulates remote mount configuration. williamr@2: * williamr@2: * @lib rsfwmountman.dll williamr@2: * @since Series 60 3.1 williamr@2: */ williamr@2: class TRsfwMountConfig williamr@2: { williamr@2: public: // New functions williamr@2: IMPORT_C void ExternalizeL(RWriteStream& aStream) const; williamr@2: IMPORT_C void InternalizeL(RReadStream& aStream); williamr@2: williamr@2: public: // Data williamr@2: TChar iDriveLetter; williamr@2: TBuf iName; williamr@2: TBuf iUri; williamr@2: TBuf iUserName; williamr@2: TBuf iPassword; williamr@2: TBuf iAuxData; williamr@2: TUint iFlags; williamr@2: TInt iInactivityTimeout; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * Encapsulates remote mount status information. williamr@2: * williamr@2: * @lib rsfwmountman.dll williamr@2: * @since Series 60 3.1 williamr@2: */ williamr@2: class TRsfwMountStatus williamr@2: { williamr@2: public: // Data williamr@2: TInt iVolumeId; williamr@2: /** iMountState is not used and will be removed */ williamr@2: TUint iMountState; williamr@2: /** see KMountStronglyConnected and other connection states */ williamr@2: TUint iConnectionState; williamr@2: TInt iCachedSize; williamr@2: TInt iInactivityTime; williamr@2: TInt iInactivityTimeout; williamr@2: TBool iPermanence; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * Encapsulates all information about a mount. williamr@2: * williamr@2: * @lib rsfwmountman.dll williamr@2: * @since Series 60 3.1 williamr@2: */ williamr@2: class TRsfwMountInfo williamr@2: { williamr@2: public: // New functions williamr@2: void ExternalizeL(RWriteStream& aStream) const; williamr@2: void InternalizeL(RReadStream& aStream); williamr@2: williamr@2: public: // Data williamr@2: TRsfwMountConfig iMountConfig; williamr@2: TRsfwMountStatus iMountStatus; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Class for managing mounts to remote file repositories williamr@2: * williamr@2: * @lib mountman.dll williamr@2: * @since Series 60 3.1 williamr@2: */ williamr@2: williamr@2: class CRsfwMountMan : public CBase williamr@2: { williamr@2: public: // Constructors and destructor williamr@2: /** williamr@2: * Two-phased constructor. williamr@2: * williamr@2: * @param aDefaultFlags must be set to KMountFlagInteractive williamr@2: * if the user is to be prompted during the mount procedure. williamr@2: * Otherwise the parameter can be set to zero. williamr@2: * @param mount event observer williamr@2: * @return pointer to the created CRsfwMountMan object instance williamr@2: */ williamr@2: IMPORT_C static CRsfwMountMan* NewL(TUint aDefaultFlags, williamr@2: MRsfwMountManObserver* aMountManObserver); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C virtual ~CRsfwMountMan(); williamr@2: williamr@2: public: // New functions williamr@2: /** williamr@2: * Returns a list of friendly names of all mount configurations williamr@2: * in the mount configuration repository. williamr@2: * The entries are returned in the order that they appear in the williamr@2: * repository. williamr@2: * @param aNames friendly names williamr@2: * @return nothing williamr@2: */ williamr@2: IMPORT_C void GetMountNamesL(CDesC16Array* aNames) const; williamr@2: williamr@2: /** williamr@2: * Gets the mount configuration entry having the given friendly name. williamr@2: * The caller must make sure that the name is unique. williamr@2: * @param aId friendly name williamr@2: * @return a pointer to the configuration entry or NULL if not found williamr@2: */ williamr@2: IMPORT_C const CRsfwMountEntry* MountEntryL(const TDesC& aName) const; williamr@2: williamr@2: /** williamr@2: * Gets the mount configuration entry for the given drive letter. williamr@2: * @param aDriveLetter drive letter williamr@2: * @return a pointer to the configuration entry or NULL if not found williamr@2: */ williamr@2: IMPORT_C const CRsfwMountEntry* MountEntryL(TChar aDriveLetter) const; williamr@2: williamr@2: /** williamr@2: * Adds a mount configuration entry in the configurations and williamr@2: * mounts the drive in the File Server. williamr@2: * If the drive letter item is not set in the configuration, williamr@2: * a free letter will be allocated. williamr@2: * Then the EMountEntryItemDrive value in aMountEntry will be changed. williamr@2: * The EMountEntryItemIndex item of aMountEntry is used for williamr@2: * positioning the entry in a specific order in the configuration database williamr@2: * (the index itself is not stored) williamr@2: * williamr@2: * @param aMountEntry mount configuration entry williamr@2: * the ownership of the pointer is transferred to CRsfwMountMan williamr@2: * @return nothing williamr@2: * @leave KErrInUse selected drive letter already in used williamr@2: * @leave KErrInUse selected name is in use williamr@2: * @leave KErrInUse 9 remote drives already define williamr@2: * (Number of remote drives is limited by default to 9 so that drive williamr@2: * letters are also available for other technologies) williamr@2: * @leave KErrAccessDenied program does not have sufficient capabilities williamr@2: * required capabilities are DiskAdmin (to mount new remote drive in williamr@2: * File Server) and WriteDeviceData (to add new remote drive to williamr@2: * Central Repository) williamr@2: * @leave KErrNotFound williamr@2: * File System plug-in, Central Repository table etc. not found williamr@2: */ williamr@2: IMPORT_C void AddMountEntryL(CRsfwMountEntry* aMountEntry); williamr@2: williamr@2: /** williamr@2: * Deletes a mount entry from the configurations and unmounts the drive. williamr@2: * Nothing is done if the entry does not exist. williamr@2: * williamr@2: * @param aName name williamr@2: * @return nothing williamr@2: */ williamr@2: IMPORT_C void DeleteMountEntryL(const TDesC& aName); williamr@2: williamr@2: /** williamr@2: * Deletes a mount entry from the configurations and unmounts the drive. williamr@2: * Nothing is done if the entry does not exist. williamr@2: * williamr@2: * @param aDriveLetter drive letter williamr@2: * @return nothing williamr@2: */ williamr@2: IMPORT_C void DeleteMountEntryL(TChar aDriveLetter); williamr@2: williamr@2: williamr@2: /** williamr@2: * Gets a list of all drives as seen by the File Server williamr@2: * williamr@2: * Returns drive letters. williamr@2: * Letters for local drives are in the front of the list williamr@2: * Letters for remote drives in order defined in CenRep williamr@2: * The number of the drives is the same as the length of the list williamr@2: * williamr@2: * @param aDriveList returned drive list williamr@2: * @return number of remote drives williamr@2: */ williamr@2: IMPORT_C TInt GetAllDrivesL(TDriveList& aDriveList) const; williamr@2: williamr@2: /** williamr@2: * Gets a list of all remote drives as seen by the File Server williamr@2: * williamr@2: * The list contains the letters of the remote drives. williamr@2: * Letters for remote drives in order defined in CenRep williamr@2: * The number of the drives is the same as the length of the list williamr@2: * williamr@2: * @param aDriveList returned drive list williamr@2: * @return number of remote drives williamr@2: */ williamr@2: IMPORT_C TInt GetRemoteMountListL(TDriveList& aDriveList) const; williamr@2: williamr@2: /** williamr@2: * Gets mount information for an active remote drive. williamr@2: * williamr@2: * The information consists of static configuration information and williamr@2: * status information (such as strongly or weakly connected). williamr@2: * Note that if the drive is not atctive this function will williamr@2: * return -1, you need to use MountEntryL to get just the static williamr@2: * configuration information williamr@2: * williamr@2: * @param aDriveLetter drive letter of the mount williamr@2: * @param aMountInfo returned information williamr@2: * @return error code williamr@2: */ williamr@2: IMPORT_C TInt GetMountInfo(TChar aDriveLetter, TRsfwMountInfo& aMountInfo) const; williamr@2: williamr@2: /** williamr@2: * Sets the connection state of a mount for an active remote drive williamr@2: * williamr@2: * @param aDriveLetter drive letter of the mount williamr@2: * @param aConnectionState williamr@2: * The following connection states have been defined: williamr@2: * KMountStronglyConnected = strongly connected state williamr@2: * KMountWeaklyConnected = weakly connected state williamr@2: * KMountNotConnected = disconnected state williamr@2: * williamr@2: * @return error code williamr@2: */ williamr@2: IMPORT_C TInt SetMountConnectionState(TChar aDriveLetter, williamr@2: TUint aConnectionState); williamr@2: williamr@2: /** williamr@2: * Changes a mount configuration entry in the configurations williamr@2: * williamr@2: * @param aMountEntry mount configuration entry williamr@2: * the ownership of the pointer is transferred to CRsfwMountMan williamr@2: * @return nothing williamr@2: * @leave KErrInUse if the name of the mount is used by other mount williamr@2: * @leave KErrAccessDenied program does not have sufficient capabilities williamr@2: * required capabilities are DiskAdmin (to mount new remote drive in williamr@2: * File Server) and WriteDeviceData (to add new remote drive to williamr@2: * Central Repository) williamr@2: * @leave KErrNotFound if mount with given letter not found or williamr@2: * File System plug-in, Central Repository table etc. not found williamr@2: */ williamr@2: IMPORT_C void EditMountEntryL(CRsfwMountEntry* aMountEntry); williamr@2: williamr@2: williamr@2: /** williamr@2: * Refresh a remote directory williamr@2: * williamr@2: * Ensures that contents of a remote directory are up to date. williamr@2: * Synchronous variant deletes the currently cached version. williamr@2: * Note that this function intentionally does not return directory williamr@2: * contents. All data should be read through the File Server instead. williamr@2: * williamr@2: * @return KErrArgument Path refers to a file williamr@2: * KErrNotFound path is not found from cache williamr@2: */ williamr@2: IMPORT_C TInt RefreshDirectory(const TDesC& aPath); williamr@2: williamr@2: /** williamr@2: * Some applications have problems with handling remote files. williamr@2: * Function checks whether app with given UID is one of them. williamr@2: * williamr@2: * @param aUid UID of the application williamr@2: * @return ETrue if it is on the black list, otherwise EFalse williamr@2: */ williamr@2: IMPORT_C TBool IsAppOnBlackList(TUid aUid) const; williamr@2: williamr@2: williamr@2: /** williamr@2: * Cancels an active remote file upload or download williamr@2: * williamr@2: * @param aFile file name williamr@2: * @return one of the system wide error codes. williamr@2: */ williamr@2: IMPORT_C TInt CancelRemoteTransfer(const TDesC& aFile); williamr@2: williamr@2: williamr@2: /** williamr@2: * Sets the connection state of a mount for an active remote drive williamr@2: * sends a bling request, does not wait for reply williamr@2: * williamr@2: * @param aDriveLetter drive letter of the mount williamr@2: * @param aConnectionState williamr@2: * The following connection states have been defined: williamr@2: * KMountStronglyConnected = strongly connected state williamr@2: * KMountWeaklyConnected = weakly connected state williamr@2: * KMountNotConnected = disconnected state williamr@2: * williamr@2: * @return error code williamr@2: */ williamr@2: IMPORT_C TInt SetMountConnectionStateBlind(TChar aDriveLetter, williamr@2: TUint aConnectionState); williamr@2: williamr@2: williamr@2: private: williamr@2: /** williamr@2: * C++ default constructor williamr@2: */ williamr@2: CRsfwMountMan(); williamr@2: williamr@2: /** williamr@2: * Second phase constructor williamr@2: */ williamr@2: void ConstructL(TUint aDefaultFlags, williamr@2: MRsfwMountManObserver* aMountManObserver); williamr@2: williamr@2: private: // Data williamr@2: CRsfwMountManImpl* iMountManImpl; // implementation williamr@2: }; williamr@2: williamr@2: #endif // CRSFWMOUNTMAN_H williamr@2: williamr@2: // End of File