1 /* |
|
2 * Copyright (c) 2005-2009 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: CSConFTP header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _SCONFTP_H_ |
|
20 #define _SCONFTP_H_ |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <obexobjects.h> |
|
26 |
|
27 #include "sconconstants.h" |
|
28 |
|
29 class CSConInboxHandler; |
|
30 class CSConFsHandler; |
|
31 |
|
32 //============================================================ |
|
33 // Class CSConFTP declaration |
|
34 //============================================================ |
|
35 class CSConFTP : public CBase |
|
36 { |
|
37 public: |
|
38 // construct / destruct |
|
39 static CSConFTP* NewL(); |
|
40 ~CSConFTP(); |
|
41 |
|
42 // methods |
|
43 /** |
|
44 * Gets object that contains folder listing from inbox or file system |
|
45 * @param aObject CObexBufObject object |
|
46 * @return KErrNone if no errors, else system wide error codes. |
|
47 */ |
|
48 virtual TInt GetFolderObjectL( CObexBufObject*& aObject ); |
|
49 |
|
50 /** |
|
51 * Gets object that contains a file from file system |
|
52 * @param aFileObject CObexFileObject object |
|
53 * @return KErrNone if no errors, else system wide error codes. |
|
54 */ |
|
55 virtual TInt GetFileObjectL( CObexFileObject*& aFileObject ); |
|
56 |
|
57 /** |
|
58 * Initializes the receiving from the client. |
|
59 * @param aObject CObexBufObject object |
|
60 * @param aObject CBufFlat object |
|
61 * @return KErrNone if no error, else system wide error codes. |
|
62 */ |
|
63 virtual TInt PutFileObjectInitL( CObexBufObject*& aObject, |
|
64 CBufFlat*& aBuffer ); |
|
65 |
|
66 /** |
|
67 * Stores the relayed file object to inbox or file system. |
|
68 * @param aObject CObexBufObject object |
|
69 * @return KErrNone if no error, else system wide error codes. |
|
70 */ |
|
71 virtual TInt PutFileObjectFinalizeL( CObexBufObject*& aObject ); |
|
72 |
|
73 /** |
|
74 * Changes the current path. The path can point to inbox or file system |
|
75 * @param aPathName The name of the new path |
|
76 * @param aFlags Flag value of OBEX Setpath operation |
|
77 * @return KErrNone if no error, else system wide error codes. |
|
78 */ |
|
79 virtual TInt SetPathL( const TPtrC aPathName, const TUint8 aFlags ); |
|
80 |
|
81 /** |
|
82 * Creates a new folder to file system |
|
83 * @param aFolderName The name of the folder to be created |
|
84 * @return KErrNone if no error, else system wide error codes. |
|
85 */ |
|
86 virtual TInt CreateFolderL( const TPtrC aFolderName ); |
|
87 |
|
88 /** |
|
89 * Deletes file/folder from inbox or file system |
|
90 * @param aObjectName The name of the object (file or folder) to be created |
|
91 * @return KErrNone if no error, else system wide error codes. |
|
92 */ |
|
93 virtual TInt DeleteObjectL( const TPtrC aObjectName ); |
|
94 |
|
95 /** |
|
96 * Gets the current path |
|
97 * @param aPath The name of the current path |
|
98 * @return KErrNone if no error, else system wide error codes. |
|
99 */ |
|
100 virtual TInt GetPath( TDes& aPath ); |
|
101 |
|
102 /** |
|
103 * Abort file transfer |
|
104 * @param aObject The OBEX stack object which will reseted |
|
105 * @return KErrNone if no error, else system wide error codes. |
|
106 */ |
|
107 virtual TInt AbortFileTransfer( CObexBufObject*& aObject ); |
|
108 |
|
109 /** |
|
110 * Set used transfer profile |
|
111 * @param aProfile The profile id |
|
112 * @return none |
|
113 */ |
|
114 virtual void SetProfile( TSConProfile aProfile ); |
|
115 |
|
116 /** |
|
117 * Set backup status |
|
118 * @param aValue Is backup started or not |
|
119 * @return none |
|
120 */ |
|
121 virtual void SetBackupStarted( TBool aValue ); |
|
122 |
|
123 /** |
|
124 * Set the used media information |
|
125 * @param aMedia The media which is currently used |
|
126 * @return none |
|
127 */ |
|
128 virtual void SetUsedMedia( TSConUsedMedia aMedia ); |
|
129 |
|
130 /** |
|
131 * Check is current drive space below critical level |
|
132 * @param aFilesize, additional free space needed |
|
133 * @return ETrue if below critical |
|
134 */ |
|
135 virtual TBool IsCurrentDiskSpaceBelowCritical( TUint32 aFilesize = 0 ); |
|
136 |
|
137 /** |
|
138 * Read received ConML protocol packet |
|
139 * @param aBuffer The buffer for the data |
|
140 * @return KErrNone if no error, else system wide error codes. |
|
141 */ |
|
142 virtual TInt ReadWBXMLDataL( CBufFlat*& aBuffer ); |
|
143 |
|
144 /** |
|
145 * Delete OBEX stack's temp file |
|
146 * @param none |
|
147 * @return KErrNone if no error, else system wide error codes. |
|
148 */ |
|
149 virtual void DeleteTempFile(); |
|
150 |
|
151 /** |
|
152 * Move or rename file/folder |
|
153 * @param aSource |
|
154 * @param aTarget |
|
155 * @return KErrNone if no error, else system wide error codes. |
|
156 */ |
|
157 virtual TInt MoveFile( const TDesC& aSource, const TDesC& aTarget ); |
|
158 |
|
159 /** |
|
160 * Copy file/folder |
|
161 * @param aSource |
|
162 * @param aTarget |
|
163 * @return KErrNone if no error, else system wide error codes. |
|
164 */ |
|
165 virtual TInt CopyFile( const TDesC& aSource, const TDesC& aTarget ); |
|
166 |
|
167 /** |
|
168 * Set read-only attribute to file or folder |
|
169 * @param aTarget file or folder fullname |
|
170 * @param aReadOnly set read-only permission to ETrue or EFalse |
|
171 * @return KErrNone if no error, else system wide error codes. |
|
172 */ |
|
173 virtual TInt SetReadOnly( const TDesC& aTarget, const TBool aReadOnly ); |
|
174 |
|
175 /** |
|
176 * Set hidden attribute to file or folder |
|
177 * @param aTarget file or folder fullname |
|
178 * @param aHidden set read-only permission to ETrue or EFalse |
|
179 * @return KErrNone if no error, else system wide error codes. |
|
180 */ |
|
181 virtual TInt SetHidden( const TDesC& aTarget, const TBool aHidden ); |
|
182 |
|
183 private: |
|
184 // methods |
|
185 /** |
|
186 * Get absolute path from given relative foldername |
|
187 * @param aFolderName relative or absolute filename |
|
188 * @param aFullPath return absolete path of file/folder |
|
189 * @return KErrNone if no error, else system wide error codes. |
|
190 */ |
|
191 virtual TInt GetAbsolutePath( const TDesC& aFolderName, TDes& aFullPath ); |
|
192 |
|
193 /** |
|
194 * Checks if user can see/access to the drive |
|
195 * @param aDriveNumber drive to be tested |
|
196 * @return ETrue if user can see drive. |
|
197 */ |
|
198 TBool IsDriveVisible( const TInt aDriveNumber ); |
|
199 |
|
200 /** |
|
201 * Checks if user access to the current volume |
|
202 * @param none |
|
203 * @return ETrue if volume is ok. |
|
204 */ |
|
205 TBool IsCurrentVolumeOK(); |
|
206 |
|
207 /** |
|
208 * Go to (sub)directory |
|
209 * @param aPath (sub)directory |
|
210 * @param aFlags used to check if new folder(s) should be created |
|
211 * @return KErrNone if no error, else system wide error codes. |
|
212 */ |
|
213 TInt SetPathForwardL( const TPtrC aPath, const TUint8 aFlags ); |
|
214 |
|
215 /** |
|
216 * Go to parent directory |
|
217 * @param aPath subdirectory under parent (additional) |
|
218 * @return KErrNone if no error, else system wide error codes. |
|
219 */ |
|
220 TInt SetPathBackwardL( const TPtrC aPath ); |
|
221 |
|
222 /** |
|
223 * Get volume name (Memory card name) |
|
224 * @param aDriveNumber drive where to read |
|
225 * @param aVolumeName if name found return volume name, else localised string |
|
226 * @return KErrNone if no error, else system wide error codes. |
|
227 */ |
|
228 TInt GetVolumeNameL(const TInt aDriveNumber, TDes8& aVolumeName); |
|
229 |
|
230 /** |
|
231 * Updates drive information (iCurrentDrive and iCurrentDriveTypeNumber) |
|
232 * @param none |
|
233 * @return none, leaves if error occurs. |
|
234 */ |
|
235 void UpdateDriveTypeInfoL(); |
|
236 |
|
237 CSConFTP(); |
|
238 virtual void ConstructL(); |
|
239 |
|
240 private: |
|
241 CSConInboxHandler* iSConInboxHandler; // Object saving-fetching |
|
242 CBufFlat* iBuffer; // Temporary buffer |
|
243 CSConFsHandler* iSConFsHandler; // Object saving-fetching |
|
244 TBuf<KObexObjectDescriptionSize> iPathName; // Path |
|
245 TFileName iTempFileName; // Temp file name |
|
246 RFs iFs; |
|
247 TSConProfile iProfile; // Used profile |
|
248 TBool iBackupStarted; |
|
249 TSConUsedMedia iMedia; |
|
250 TInt iCurrentDrive; |
|
251 TInt iCurrentDriveTypeNumber; // DEV=1, DEV2=2, MMC=1, MMC2=2. |
|
252 TInt iCriticalDiskLevel; |
|
253 }; |
|
254 |
|
255 IMPORT_C CSConFTP* CreateCSConFTPL(); |
|
256 typedef CSConFTP* (*TSConCreateCSConFTPFunc) (); |
|
257 |
|
258 |
|
259 #endif // SCONFTP |
|
260 |
|
261 // End of file |
|