epoc32/include/mw/rsfwmountman.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* 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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  RSFW Mount Manager API
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef CRSFWMOUNTMAN_H
williamr@2
    20
#define CRSFWMOUNTMAN_H
williamr@2
    21
williamr@2
    22
#include <e32cmn.h>
williamr@2
    23
#include <e32base.h>
williamr@2
    24
#include <f32file.h>
williamr@2
    25
#include <s32strm.h>
williamr@2
    26
williamr@2
    27
#include <rsfwmountentry.h> // mount entry constants
williamr@2
    28
williamr@2
    29
class TRsfwMountInfo;
williamr@2
    30
williamr@2
    31
// FORWARD DECLARATIONS
williamr@2
    32
class CRsfwMountEntry;
williamr@2
    33
class CRsfwMountManImpl;
williamr@2
    34
class CDesC16Array;
williamr@2
    35
williamr@2
    36
// CONSTANTS
williamr@2
    37
// the secure UID of the server, used as a P&S key category
williamr@2
    38
const TUid KRfeServerSecureUid = { 0x101F970D };
williamr@2
    39
//the maximum number of remote drives
williamr@2
    40
const TInt KMaxRemoteDrives = 9;
williamr@2
    41
williamr@2
    42
// DATA TYPES
williamr@2
    43
// Event types for MRsfwMountManObserver
williamr@2
    44
enum TMountManEvent
williamr@2
    45
    {
williamr@2
    46
    EMountManEventMountConfigurationChanged = 1,
williamr@2
    47
    EMountManEventMounted
williamr@2
    48
    };
williamr@2
    49
williamr@2
    50
// P&S keys
williamr@2
    51
// for notifying UI that a remote drive has been connected or disconnected
williamr@2
    52
enum TRfePSKeys
williamr@2
    53
	{
williamr@2
    54
	ERsfwPSKeyConnect
williamr@2
    55
	};
williamr@2
    56
williamr@2
    57
// Connection states
williamr@2
    58
const TUint KMountStronglyConnected = 0x01;
williamr@2
    59
const TUint KMountConnecting = 0x02; // temporary state during establishing a connection
williamr@2
    60
                                     // to the drive, not to be used via MountMan API
williamr@2
    61
const TUint KMountNotConnected      = 0x03;
williamr@2
    62
williamr@2
    63
// CLASS DECLARATION
williamr@2
    64
/**
williamr@2
    65
 *  Interface for receiving mounting events
williamr@2
    66
 *
williamr@2
    67
 *  @lib mountman.dll
williamr@2
    68
 *  @since Series 60 3.1
williamr@2
    69
 */
williamr@2
    70
williamr@2
    71
class MRsfwMountManObserver
williamr@2
    72
    {
williamr@2
    73
public:
williamr@2
    74
    /**
williamr@2
    75
     * Handles an event emanating from a CRsfwMountMan class
williamr@2
    76
     *
williamr@2
    77
     * @param aEventType type of the event
williamr@2
    78
     * @param aStatus status code
williamr@2
    79
     * @param aArg miscellaneous arguments
williamr@2
    80
     */
williamr@2
    81
    virtual void HandleMountManEventL(TMountManEvent aEvent,
williamr@2
    82
                                      TInt aStatus,
williamr@2
    83
                                      TAny* aArg) = 0;
williamr@2
    84
    };
williamr@2
    85
williamr@2
    86
/**
williamr@2
    87
 *  Encapsulates remote mount configuration.
williamr@2
    88
 *
williamr@2
    89
 *  @lib rsfwmountman.dll
williamr@2
    90
 *  @since Series 60 3.1
williamr@2
    91
 */
williamr@2
    92
class TRsfwMountConfig
williamr@2
    93
    {
williamr@2
    94
public:   // New functions
williamr@2
    95
    IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
    96
    IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
    97
williamr@2
    98
public:   // Data
williamr@2
    99
    TChar                         iDriveLetter;
williamr@2
   100
    TBuf<KMaxMountNameLength>     iName;
williamr@2
   101
    TBuf<KMaxMountUriLength>      iUri;
williamr@2
   102
    TBuf<KMaxMountUserNameLength> iUserName;
williamr@2
   103
    TBuf<KMaxMountPasswordLength> iPassword;
williamr@2
   104
    TBuf<KMaxMountAuxDataLength>  iAuxData;
williamr@2
   105
    TUint                         iFlags;
williamr@2
   106
    TInt                          iInactivityTimeout;
williamr@2
   107
    };
williamr@2
   108
    
williamr@2
   109
williamr@2
   110
/**
williamr@2
   111
 *  Encapsulates remote mount status information.
williamr@2
   112
 *
williamr@2
   113
 *  @lib rsfwmountman.dll
williamr@2
   114
 *  @since Series 60 3.1
williamr@2
   115
 */
williamr@2
   116
class TRsfwMountStatus
williamr@2
   117
    {
williamr@2
   118
public:   // Data
williamr@2
   119
    TInt                          iVolumeId;
williamr@2
   120
    /** iMountState is not used and will be removed */
williamr@2
   121
    TUint                         iMountState;  
williamr@2
   122
    /** see KMountStronglyConnected and other connection states */
williamr@2
   123
    TUint                         iConnectionState; 
williamr@2
   124
    TInt                          iCachedSize;
williamr@2
   125
    TInt                          iInactivityTime;
williamr@2
   126
    TInt                          iInactivityTimeout;
williamr@2
   127
    TBool                         iPermanence;
williamr@2
   128
    };
williamr@2
   129
    
williamr@2
   130
williamr@2
   131
/**
williamr@2
   132
 *  Encapsulates all information about a mount.
williamr@2
   133
 *
williamr@2
   134
 *  @lib rsfwmountman.dll
williamr@2
   135
 *  @since Series 60 3.1
williamr@2
   136
 */
williamr@2
   137
class TRsfwMountInfo
williamr@2
   138
    {
williamr@2
   139
public:   // New functions
williamr@2
   140
    void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   141
    void InternalizeL(RReadStream& aStream);
williamr@2
   142
williamr@2
   143
public:   // Data
williamr@2
   144
    TRsfwMountConfig                  iMountConfig;
williamr@2
   145
    TRsfwMountStatus                  iMountStatus;
williamr@2
   146
    }; 
williamr@2
   147
    
williamr@2
   148
williamr@2
   149
williamr@2
   150
williamr@2
   151
// CLASS DECLARATION
williamr@2
   152
williamr@2
   153
/**
williamr@2
   154
 *  Class for managing mounts to remote file repositories
williamr@2
   155
 *
williamr@2
   156
 *  @lib mountman.dll
williamr@2
   157
 *  @since Series 60 3.1
williamr@2
   158
 */
williamr@2
   159
williamr@2
   160
class CRsfwMountMan : public CBase
williamr@2
   161
    {
williamr@2
   162
public: // Constructors and destructor
williamr@2
   163
    /**
williamr@2
   164
     * Two-phased constructor.
williamr@2
   165
     *
williamr@2
   166
     * @param aDefaultFlags must be set to KMountFlagInteractive
williamr@2
   167
     *   if the user is to be prompted during the mount procedure.
williamr@2
   168
     *   Otherwise the parameter can be set to zero.
williamr@2
   169
     * @param mount event observer
williamr@2
   170
     * @return pointer to the created CRsfwMountMan object instance
williamr@2
   171
     */
williamr@2
   172
    IMPORT_C static CRsfwMountMan* NewL(TUint aDefaultFlags,
williamr@2
   173
                                    MRsfwMountManObserver* aMountManObserver);
williamr@2
   174
williamr@2
   175
    /**
williamr@2
   176
     * Destructor.
williamr@2
   177
     */
williamr@2
   178
    IMPORT_C virtual ~CRsfwMountMan();
williamr@2
   179
williamr@2
   180
public: // New functions
williamr@2
   181
    /**
williamr@2
   182
     * Returns a list of friendly names of all mount configurations
williamr@2
   183
     * in the mount configuration repository.
williamr@2
   184
     * The entries are returned in the order that they appear in the
williamr@2
   185
     * repository.
williamr@2
   186
     * @param aNames friendly names
williamr@2
   187
     * @return nothing
williamr@2
   188
     */
williamr@2
   189
    IMPORT_C void GetMountNamesL(CDesC16Array* aNames) const;
williamr@2
   190
williamr@2
   191
    /**
williamr@2
   192
     * Gets the mount configuration entry having the given friendly name.
williamr@2
   193
     * The caller must make sure that the name is unique.
williamr@2
   194
     * @param aId friendly name
williamr@2
   195
     * @return a pointer to the configuration entry or NULL if not found
williamr@2
   196
     */
williamr@2
   197
    IMPORT_C const CRsfwMountEntry* MountEntryL(const TDesC& aName) const;
williamr@2
   198
williamr@2
   199
    /**
williamr@2
   200
     * Gets the mount configuration entry for the given drive letter.
williamr@2
   201
     * @param aDriveLetter drive letter
williamr@2
   202
     * @return a pointer to the configuration entry or NULL if not found
williamr@2
   203
     */
williamr@2
   204
    IMPORT_C const CRsfwMountEntry* MountEntryL(TChar aDriveLetter) const;
williamr@2
   205
williamr@2
   206
    /**
williamr@2
   207
     * Adds a mount configuration entry in the configurations and
williamr@2
   208
     * mounts the drive in the File Server.
williamr@2
   209
     * If the drive letter item is not set in the configuration,
williamr@2
   210
     * a free letter will be allocated.
williamr@2
   211
     * Then the EMountEntryItemDrive value in aMountEntry will be changed.
williamr@2
   212
     * The EMountEntryItemIndex item of aMountEntry is used for
williamr@2
   213
     * positioning the entry in a specific order in the configuration database
williamr@2
   214
     * (the index itself is not stored)
williamr@2
   215
     *
williamr@2
   216
     * @param aMountEntry mount configuration entry
williamr@2
   217
     *  the ownership of the pointer is transferred to CRsfwMountMan
williamr@2
   218
     * @return nothing
williamr@2
   219
     * @leave KErrInUse selected drive letter already in used
williamr@2
   220
     * @leave KErrInUse selected name is in use
williamr@2
   221
     * @leave KErrInUse 9 remote drives already define
williamr@2
   222
     * (Number of remote drives is limited by default to 9 so that drive 
williamr@2
   223
     *  letters are also available for other technologies)
williamr@2
   224
     * @leave KErrAccessDenied program does not have sufficient capabilities
williamr@2
   225
     *        required capabilities are DiskAdmin (to mount new remote drive in 
williamr@2
   226
     *        File Server) and WriteDeviceData (to add new remote drive to
williamr@2
   227
     *         Central Repository)
williamr@2
   228
     * @leave KErrNotFound
williamr@2
   229
     *        File System plug-in, Central Repository table etc. not found
williamr@2
   230
     */
williamr@2
   231
    IMPORT_C void AddMountEntryL(CRsfwMountEntry* aMountEntry);
williamr@2
   232
williamr@2
   233
    /**
williamr@2
   234
     * Deletes a mount entry from the configurations and unmounts the drive.
williamr@2
   235
     * Nothing is done if the entry does not exist.
williamr@2
   236
     *
williamr@2
   237
     * @param aName name
williamr@2
   238
     * @return nothing
williamr@2
   239
     */
williamr@2
   240
    IMPORT_C void DeleteMountEntryL(const TDesC& aName);
williamr@2
   241
williamr@2
   242
    /**
williamr@2
   243
     * Deletes a mount entry from the configurations and unmounts the drive.
williamr@2
   244
     * Nothing is done if the entry does not exist.
williamr@2
   245
     *
williamr@2
   246
     * @param aDriveLetter drive letter
williamr@2
   247
     * @return nothing
williamr@2
   248
     */
williamr@2
   249
    IMPORT_C void DeleteMountEntryL(TChar aDriveLetter);
williamr@2
   250
williamr@2
   251
  
williamr@2
   252
    /**
williamr@2
   253
     * Gets a list of all drives as seen by the File Server
williamr@2
   254
     *
williamr@2
   255
     * Returns drive letters. 
williamr@2
   256
     * Letters for local drives are in the front of the list
williamr@2
   257
     * Letters for remote drives in order defined in CenRep
williamr@2
   258
     *   The number of the drives is the same as the length of the list
williamr@2
   259
     *
williamr@2
   260
     * @param aDriveList returned drive list
williamr@2
   261
     * @return number of remote drives
williamr@2
   262
     */
williamr@2
   263
    IMPORT_C TInt GetAllDrivesL(TDriveList& aDriveList) const;
williamr@2
   264
williamr@2
   265
    /**
williamr@2
   266
     * Gets a list of all remote drives as seen by the File Server
williamr@2
   267
     *
williamr@2
   268
     * The list contains the letters of the remote drives.
williamr@2
   269
     * Letters for remote drives in order defined in CenRep
williamr@2
   270
     *   The number of the drives is the same as the length of the list
williamr@2
   271
     *
williamr@2
   272
     * @param aDriveList returned drive list
williamr@2
   273
     * @return number of remote drives
williamr@2
   274
     */
williamr@2
   275
    IMPORT_C TInt GetRemoteMountListL(TDriveList& aDriveList) const;
williamr@2
   276
    
williamr@2
   277
    /**
williamr@2
   278
     * Gets mount information for an active remote drive.
williamr@2
   279
     *
williamr@2
   280
     * The information consists of static configuration information and
williamr@2
   281
     *   status information (such as strongly or weakly connected).
williamr@2
   282
     * Note that if the drive is not atctive this function will 
williamr@2
   283
     * return -1, you need to use MountEntryL to get just the static 
williamr@2
   284
     * configuration information
williamr@2
   285
     *
williamr@2
   286
     * @param aDriveLetter drive letter of the mount
williamr@2
   287
     * @param aMountInfo returned information
williamr@2
   288
     * @return error code
williamr@2
   289
     */
williamr@2
   290
    IMPORT_C TInt GetMountInfo(TChar aDriveLetter, TRsfwMountInfo& aMountInfo) const;
williamr@2
   291
williamr@2
   292
    /**
williamr@2
   293
     * Sets the connection state of a mount for an active remote drive
williamr@2
   294
     *
williamr@2
   295
     * @param aDriveLetter drive letter of the mount
williamr@2
   296
     * @param aConnectionState
williamr@2
   297
     *   The following connection states have been defined:
williamr@2
   298
     *     KMountStronglyConnected = strongly connected state
williamr@2
   299
     *     KMountWeaklyConnected   = weakly connected state
williamr@2
   300
     *     KMountNotConnected      = disconnected state
williamr@2
   301
     *
williamr@2
   302
     * @return error code
williamr@2
   303
     */
williamr@2
   304
    IMPORT_C TInt SetMountConnectionState(TChar aDriveLetter,
williamr@2
   305
                                          TUint aConnectionState);
williamr@2
   306
williamr@2
   307
    /**
williamr@2
   308
     * Changes a mount configuration entry in the configurations
williamr@2
   309
     *  
williamr@2
   310
     * @param aMountEntry mount configuration entry
williamr@2
   311
     *  the ownership of the pointer is transferred to CRsfwMountMan
williamr@2
   312
     * @return nothing
williamr@2
   313
     * @leave KErrInUse if the name of the mount is used by other mount
williamr@2
   314
     * @leave KErrAccessDenied program does not have sufficient capabilities
williamr@2
   315
     *        required capabilities are DiskAdmin (to mount new remote drive in 
williamr@2
   316
     *        File Server) and WriteDeviceData (to add new remote drive to
williamr@2
   317
     *         Central Repository)
williamr@2
   318
     * @leave KErrNotFound if mount with given letter not found or
williamr@2
   319
     *        File System plug-in, Central Repository table etc. not found
williamr@2
   320
     */
williamr@2
   321
    IMPORT_C void EditMountEntryL(CRsfwMountEntry* aMountEntry);
williamr@2
   322
    
williamr@2
   323
    
williamr@2
   324
     /**
williamr@2
   325
     * Refresh a remote directory
williamr@2
   326
     *
williamr@2
   327
     * Ensures that contents of a remote directory are up to date.
williamr@2
   328
     * Synchronous variant deletes the currently cached version.
williamr@2
   329
     * Note that this function intentionally does not return directory
williamr@2
   330
     * contents. All data should be read through the File Server instead.
williamr@2
   331
     *
williamr@2
   332
     * @return KErrArgument Path refers to a file
williamr@2
   333
     *         KErrNotFound path is not found from cache
williamr@2
   334
     */
williamr@2
   335
    IMPORT_C TInt RefreshDirectory(const TDesC& aPath);
williamr@2
   336
williamr@2
   337
    /**
williamr@2
   338
     * Some applications have problems with handling remote files.
williamr@2
   339
     * Function checks whether app with given UID is one of them.
williamr@2
   340
     *  
williamr@2
   341
     * @param aUid UID of the application
williamr@2
   342
     * @return ETrue if it is on the black list, otherwise EFalse
williamr@2
   343
     */    
williamr@2
   344
    IMPORT_C TBool IsAppOnBlackList(TUid aUid) const;
williamr@2
   345
    
williamr@2
   346
    
williamr@2
   347
     /**
williamr@2
   348
     * Cancels an active remote file upload or download
williamr@2
   349
     * 
williamr@2
   350
     * @param aFile file name
williamr@2
   351
     * @return one of the system wide error codes.
williamr@2
   352
     */    
williamr@2
   353
    IMPORT_C TInt CancelRemoteTransfer(const TDesC& aFile);
williamr@2
   354
    
williamr@2
   355
    
williamr@2
   356
    /**
williamr@2
   357
     * Sets the connection state of a mount for an active remote drive
williamr@2
   358
     * sends a bling request, does not wait for reply
williamr@2
   359
     *
williamr@2
   360
     * @param aDriveLetter drive letter of the mount
williamr@2
   361
     * @param aConnectionState
williamr@2
   362
     *   The following connection states have been defined:
williamr@2
   363
     *     KMountStronglyConnected = strongly connected state
williamr@2
   364
     *     KMountWeaklyConnected   = weakly connected state
williamr@2
   365
     *     KMountNotConnected      = disconnected state
williamr@2
   366
     *
williamr@2
   367
     * @return error code
williamr@2
   368
     */
williamr@2
   369
    IMPORT_C TInt SetMountConnectionStateBlind(TChar aDriveLetter,
williamr@2
   370
                                          TUint aConnectionState);
williamr@2
   371
williamr@2
   372
    
williamr@2
   373
private:
williamr@2
   374
    /**
williamr@2
   375
     * C++ default constructor
williamr@2
   376
     */
williamr@2
   377
    CRsfwMountMan();
williamr@2
   378
    
williamr@2
   379
    /**
williamr@2
   380
     * Second phase constructor
williamr@2
   381
     */
williamr@2
   382
    void ConstructL(TUint aDefaultFlags,
williamr@2
   383
                    MRsfwMountManObserver* aMountManObserver);
williamr@2
   384
williamr@2
   385
private: // Data
williamr@2
   386
    CRsfwMountManImpl* iMountManImpl; // implementation
williamr@2
   387
    };
williamr@2
   388
williamr@2
   389
#endif // CRSFWMOUNTMAN_H
williamr@2
   390
williamr@2
   391
// End of File