|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Remote File Engine Control API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef RRSFWCONTROL_H |
|
21 #define RRSFWCONTROL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <f32file.h> |
|
25 #include <e32def.h> |
|
26 #include <s32strm.h> |
|
27 #include <rsfwmountman.h> |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // Number of message slots to reserve for this client server session. |
|
32 const TUint KDefaultMessageSlots = 4; |
|
33 |
|
34 // Mounting options |
|
35 const TUint KMountFlagNull = 0x00; // nothing |
|
36 const TUint KMountFlagInteractive = 0x01; // do user prompting |
|
37 const TUint KMountFlagAskPassword = 0x02; // ask the user for password |
|
38 const TUint KMountFlagOffLine = 0x04; // mount in disconnected mode |
|
39 const TUint KMountFlagAsync = 0x10; // mount asynchronously |
|
40 const TUint KMountFlagAllocDriveLetter = 0x20; // find a free drive letter |
|
41 const TUint KMountFlagMountAtRfeOnly = 0x40; // mount only at the RFE |
|
42 |
|
43 // Mount states |
|
44 const TUint KMountStateDormant = 0x01; // only persistent metada on disk |
|
45 const TUint KMountStateMounted = 0x02; |
|
46 |
|
47 // Data types |
|
48 |
|
49 enum TMountControl |
|
50 { |
|
51 EMountControlPermanence |
|
52 }; |
|
53 |
|
54 enum TRfeError |
|
55 { |
|
56 EServerNotAvailable = 3 |
|
57 }; |
|
58 |
|
59 |
|
60 // CLASS DECLARATIONS |
|
61 |
|
62 class RRsfwControl : public RSessionBase |
|
63 { |
|
64 public: // Constructors and destructor |
|
65 /** |
|
66 * Constructor. |
|
67 */ |
|
68 IMPORT_C RRsfwControl(); |
|
69 |
|
70 public: // New functions |
|
71 /** |
|
72 * Connect to the server and create a session. |
|
73 * @since Series 60 3.1 |
|
74 * @param aServerName Server name. |
|
75 * @return Standard error code. |
|
76 */ |
|
77 IMPORT_C TInt Connect(); |
|
78 |
|
79 /** |
|
80 * Get the server version number. |
|
81 * @since Series 60 3.1 |
|
82 * @return The version number of the server. |
|
83 */ |
|
84 IMPORT_C TVersion Version(); |
|
85 |
|
86 /** |
|
87 * Mount a remote drive - synchronous version |
|
88 * @since Series 60 3.1 |
|
89 * @param aDriveLetter - letter of the drive to be mounted |
|
90 * @return error code. |
|
91 */ |
|
92 IMPORT_C TInt Mount(TInt aDriveLetter); |
|
93 |
|
94 |
|
95 /** |
|
96 * Mount a remote drive - synchronous version |
|
97 * @since Series 60 3.1 |
|
98 * @param aMountConfig mount configuration information |
|
99 * The following TRsfwMountConfig::iFlags are used in this function: |
|
100 * KMountFlagOffLine mount in disconnected mode |
|
101 * @param aStatus returned status code. |
|
102 * @return error code. |
|
103 */ |
|
104 IMPORT_C TInt Mount(const TRsfwMountConfig& aMountConfig); |
|
105 |
|
106 /** |
|
107 * Mount a remote drive - asynchronous version |
|
108 * @since Series 60 3.1 |
|
109 * @param aMountConfig mount configuration information |
|
110 * The following TRsfwMountConfig::iFlags are used in this function: |
|
111 * KMountFlagOffLine mount in disconnected mode |
|
112 * @param aStatus returned status code. |
|
113 * @return error code. |
|
114 */ |
|
115 IMPORT_C void Mount(const TRsfwMountConfig& aMountConfig, |
|
116 TRequestStatus& aStatus); |
|
117 |
|
118 /** |
|
119 * Dismount a remote drive by referring to the id of the volume in RFE |
|
120 * @since Series 60 3.1 |
|
121 * @param aVolumeId volume identifier (can be found in TRsfwMountInfo) |
|
122 * @return error code. |
|
123 */ |
|
124 IMPORT_C TInt DismountByVolumeId(TInt aVolumeId); |
|
125 |
|
126 /** |
|
127 * Dismount a remote drive by referring to the drive letter |
|
128 * @since Series 60 3.1 |
|
129 * @param aDriveLetter drive letter (can be found in TRsfwMountInfo) |
|
130 * @return error code. |
|
131 */ |
|
132 IMPORT_C TInt DismountByDriveLetter(TChar aDriveLetter); |
|
133 |
|
134 /** |
|
135 * Get information about the specified drive |
|
136 * @since Series 60 3.1 |
|
137 * @param aDriveLetter drive letter. |
|
138 * @param aMountInfo to be filled. |
|
139 * @return error code. |
|
140 */ |
|
141 IMPORT_C TInt GetMountInfo(const TChar& aDriveLetter, |
|
142 TRsfwMountInfo& aMountInfo); |
|
143 |
|
144 /** |
|
145 * Set mount connection state |
|
146 * @since Series 60 3.1 |
|
147 * @param aDriveLetter drive letter. |
|
148 * @param aState connection state: |
|
149 * KMountStronglyConnected or KMountNotConnected. |
|
150 * @return error code. |
|
151 */ |
|
152 IMPORT_C TInt SetMountConnectionState(const TChar& aDriveLetter, |
|
153 TUint aState); |
|
154 |
|
155 |
|
156 /** |
|
157 * Refresh a remote directory |
|
158 * |
|
159 * Ensures that contents of a remote directory are up to date. |
|
160 * Synchronous variant deletes the currently cached version. |
|
161 * Note that this function intentionally does not return directory |
|
162 * contents. All data should be read through the File Server instead. |
|
163 * |
|
164 * @param aPath the remote path |
|
165 * @return KErrArgument Path refers to a file |
|
166 * KErrNotFound path is not found from cache |
|
167 */ |
|
168 IMPORT_C TInt RefreshDirectory(const TDesC& aPath); |
|
169 |
|
170 /** |
|
171 * Cancels an active remote file upload or download |
|
172 * |
|
173 * @param aFile file name |
|
174 * @return The number of remote operations cancelled |
|
175 * or one of the system wide error codes. |
|
176 */ |
|
177 IMPORT_C TInt CancelRemoteTransfer(const TDesC& aFile); |
|
178 |
|
179 |
|
180 /** |
|
181 * Mount a remote drive - "blind request" version |
|
182 * @since Series 60 3.1 |
|
183 * @param aDriveLetter - letter of the drive to be mounted |
|
184 * @return error code. |
|
185 */ |
|
186 IMPORT_C TInt MountBlind(TInt aDriveLetter); |
|
187 |
|
188 |
|
189 |
|
190 private: |
|
191 static TInt StartServer(const TDesC& aServerName); |
|
192 static TInt CreateServerProcess(const TDesC& aServerName); |
|
193 TInt SendRequest(TInt aOpCode, |
|
194 TIpcArgs aArgs); |
|
195 void SendRequest(TInt aOpCode, |
|
196 TIpcArgs aArgs, |
|
197 TRequestStatus& aStatus); |
|
198 |
|
199 private: |
|
200 TIpcArgs iArgs; |
|
201 TPckgBuf<TRsfwMountConfig> iPckgBufMountConfig; // for asynchronous ipc |
|
202 }; |
|
203 |
|
204 |
|
205 #endif // RRSFWCONTROL_H |
|
206 |
|
207 // End of File |