2 * Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: RSFW Mount Manager API
19 #ifndef CRSFWMOUNTMAN_H
20 #define CRSFWMOUNTMAN_H
27 #include <rsfwmountentry.h> // mount entry constants
31 // FORWARD DECLARATIONS
32 class CRsfwMountEntry;
33 class CRsfwMountManImpl;
37 // the secure UID of the server, used as a P&S key category
38 const TUid KRfeServerSecureUid = { 0x101F970D };
39 //the maximum number of remote drives
40 const TInt KMaxRemoteDrives = 9;
43 // Event types for MRsfwMountManObserver
46 EMountManEventMountConfigurationChanged = 1,
51 // for notifying UI that a remote drive has been connected or disconnected
58 const TUint KMountStronglyConnected = 0x01;
59 const TUint KMountConnecting = 0x02; // temporary state during establishing a connection
60 // to the drive, not to be used via MountMan API
61 const TUint KMountNotConnected = 0x03;
65 * Interface for receiving mounting events
68 * @since Series 60 3.1
71 class MRsfwMountManObserver
75 * Handles an event emanating from a CRsfwMountMan class
77 * @param aEventType type of the event
78 * @param aStatus status code
79 * @param aArg miscellaneous arguments
81 virtual void HandleMountManEventL(TMountManEvent aEvent,
87 * Encapsulates remote mount configuration.
89 * @lib rsfwmountman.dll
90 * @since Series 60 3.1
92 class TRsfwMountConfig
94 public: // New functions
95 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
96 IMPORT_C void InternalizeL(RReadStream& aStream);
100 TBuf<KMaxMountNameLength> iName;
101 TBuf<KMaxMountUriLength> iUri;
102 TBuf<KMaxMountUserNameLength> iUserName;
103 TBuf<KMaxMountPasswordLength> iPassword;
104 TBuf<KMaxMountAuxDataLength> iAuxData;
106 TInt iInactivityTimeout;
111 * Encapsulates remote mount status information.
113 * @lib rsfwmountman.dll
114 * @since Series 60 3.1
116 class TRsfwMountStatus
120 /** iMountState is not used and will be removed */
122 /** see KMountStronglyConnected and other connection states */
123 TUint iConnectionState;
125 TInt iInactivityTime;
126 TInt iInactivityTimeout;
132 * Encapsulates all information about a mount.
134 * @lib rsfwmountman.dll
135 * @since Series 60 3.1
139 public: // New functions
140 void ExternalizeL(RWriteStream& aStream) const;
141 void InternalizeL(RReadStream& aStream);
144 TRsfwMountConfig iMountConfig;
145 TRsfwMountStatus iMountStatus;
154 * Class for managing mounts to remote file repositories
157 * @since Series 60 3.1
160 class CRsfwMountMan : public CBase
162 public: // Constructors and destructor
164 * Two-phased constructor.
166 * @param aDefaultFlags must be set to KMountFlagInteractive
167 * if the user is to be prompted during the mount procedure.
168 * Otherwise the parameter can be set to zero.
169 * @param mount event observer
170 * @return pointer to the created CRsfwMountMan object instance
172 IMPORT_C static CRsfwMountMan* NewL(TUint aDefaultFlags,
173 MRsfwMountManObserver* aMountManObserver);
178 IMPORT_C virtual ~CRsfwMountMan();
180 public: // New functions
182 * Returns a list of friendly names of all mount configurations
183 * in the mount configuration repository.
184 * The entries are returned in the order that they appear in the
186 * @param aNames friendly names
189 IMPORT_C void GetMountNamesL(CDesC16Array* aNames) const;
192 * Gets the mount configuration entry having the given friendly name.
193 * The caller must make sure that the name is unique.
194 * @param aId friendly name
195 * @return a pointer to the configuration entry or NULL if not found
197 IMPORT_C const CRsfwMountEntry* MountEntryL(const TDesC& aName) const;
200 * Gets the mount configuration entry for the given drive letter.
201 * @param aDriveLetter drive letter
202 * @return a pointer to the configuration entry or NULL if not found
204 IMPORT_C const CRsfwMountEntry* MountEntryL(TChar aDriveLetter) const;
207 * Adds a mount configuration entry in the configurations and
208 * mounts the drive in the File Server.
209 * If the drive letter item is not set in the configuration,
210 * a free letter will be allocated.
211 * Then the EMountEntryItemDrive value in aMountEntry will be changed.
212 * The EMountEntryItemIndex item of aMountEntry is used for
213 * positioning the entry in a specific order in the configuration database
214 * (the index itself is not stored)
216 * @param aMountEntry mount configuration entry
217 * the ownership of the pointer is transferred to CRsfwMountMan
219 * @leave KErrInUse selected drive letter already in used
220 * @leave KErrInUse selected name is in use
221 * @leave KErrInUse 9 remote drives already define
222 * (Number of remote drives is limited by default to 9 so that drive
223 * letters are also available for other technologies)
224 * @leave KErrAccessDenied program does not have sufficient capabilities
225 * required capabilities are DiskAdmin (to mount new remote drive in
226 * File Server) and WriteDeviceData (to add new remote drive to
227 * Central Repository)
228 * @leave KErrNotFound
229 * File System plug-in, Central Repository table etc. not found
231 IMPORT_C void AddMountEntryL(CRsfwMountEntry* aMountEntry);
234 * Deletes a mount entry from the configurations and unmounts the drive.
235 * Nothing is done if the entry does not exist.
240 IMPORT_C void DeleteMountEntryL(const TDesC& aName);
243 * Deletes a mount entry from the configurations and unmounts the drive.
244 * Nothing is done if the entry does not exist.
246 * @param aDriveLetter drive letter
249 IMPORT_C void DeleteMountEntryL(TChar aDriveLetter);
253 * Gets a list of all drives as seen by the File Server
255 * Returns drive letters.
256 * Letters for local drives are in the front of the list
257 * Letters for remote drives in order defined in CenRep
258 * The number of the drives is the same as the length of the list
260 * @param aDriveList returned drive list
261 * @return number of remote drives
263 IMPORT_C TInt GetAllDrivesL(TDriveList& aDriveList) const;
266 * Gets a list of all remote drives as seen by the File Server
268 * The list contains the letters of the remote drives.
269 * Letters for remote drives in order defined in CenRep
270 * The number of the drives is the same as the length of the list
272 * @param aDriveList returned drive list
273 * @return number of remote drives
275 IMPORT_C TInt GetRemoteMountListL(TDriveList& aDriveList) const;
278 * Gets mount information for an active remote drive.
280 * The information consists of static configuration information and
281 * status information (such as strongly or weakly connected).
282 * Note that if the drive is not atctive this function will
283 * return -1, you need to use MountEntryL to get just the static
284 * configuration information
286 * @param aDriveLetter drive letter of the mount
287 * @param aMountInfo returned information
290 IMPORT_C TInt GetMountInfo(TChar aDriveLetter, TRsfwMountInfo& aMountInfo) const;
293 * Sets the connection state of a mount for an active remote drive
295 * @param aDriveLetter drive letter of the mount
296 * @param aConnectionState
297 * The following connection states have been defined:
298 * KMountStronglyConnected = strongly connected state
299 * KMountWeaklyConnected = weakly connected state
300 * KMountNotConnected = disconnected state
304 IMPORT_C TInt SetMountConnectionState(TChar aDriveLetter,
305 TUint aConnectionState);
308 * Changes a mount configuration entry in the configurations
310 * @param aMountEntry mount configuration entry
311 * the ownership of the pointer is transferred to CRsfwMountMan
313 * @leave KErrInUse if the name of the mount is used by other mount
314 * @leave KErrAccessDenied program does not have sufficient capabilities
315 * required capabilities are DiskAdmin (to mount new remote drive in
316 * File Server) and WriteDeviceData (to add new remote drive to
317 * Central Repository)
318 * @leave KErrNotFound if mount with given letter not found or
319 * File System plug-in, Central Repository table etc. not found
321 IMPORT_C void EditMountEntryL(CRsfwMountEntry* aMountEntry);
325 * Refresh a remote directory
327 * Ensures that contents of a remote directory are up to date.
328 * Synchronous variant deletes the currently cached version.
329 * Note that this function intentionally does not return directory
330 * contents. All data should be read through the File Server instead.
332 * @return KErrArgument Path refers to a file
333 * KErrNotFound path is not found from cache
335 IMPORT_C TInt RefreshDirectory(const TDesC& aPath);
338 * Some applications have problems with handling remote files.
339 * Function checks whether app with given UID is one of them.
341 * @param aUid UID of the application
342 * @return ETrue if it is on the black list, otherwise EFalse
344 IMPORT_C TBool IsAppOnBlackList(TUid aUid) const;
348 * Cancels an active remote file upload or download
350 * @param aFile file name
351 * @return one of the system wide error codes.
353 IMPORT_C TInt CancelRemoteTransfer(const TDesC& aFile);
357 * Sets the connection state of a mount for an active remote drive
358 * sends a bling request, does not wait for reply
360 * @param aDriveLetter drive letter of the mount
361 * @param aConnectionState
362 * The following connection states have been defined:
363 * KMountStronglyConnected = strongly connected state
364 * KMountWeaklyConnected = weakly connected state
365 * KMountNotConnected = disconnected state
369 IMPORT_C TInt SetMountConnectionStateBlind(TChar aDriveLetter,
370 TUint aConnectionState);
375 * C++ default constructor
380 * Second phase constructor
382 void ConstructL(TUint aDefaultFlags,
383 MRsfwMountManObserver* aMountManObserver);
386 CRsfwMountManImpl* iMountManImpl; // implementation
389 #endif // CRSFWMOUNTMAN_H