1 sysutil.h |
1 /* |
|
2 * Copyright (c) 2000-2006 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: SysUtil API provides functions for applications to retrieve |
|
15 * SW and language package versions and check whether there is |
|
16 * free space on a disk drive. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef SYSUTIL_H |
|
22 #define SYSUTIL_H |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 /** |
|
27 * Helper constant to allocate buffers for GetSWVersion, GetLangSWVersion, |
|
28 * GetLangVersion. |
|
29 */ |
|
30 const TInt KSysUtilVersionTextLength = 64; |
|
31 |
|
32 class RFs; |
|
33 |
|
34 /** |
|
35 * SysUtil provides various utility methods for applications. |
|
36 * |
|
37 * SysUtil API provides functions for applications to retrieve SW and language |
|
38 * package versions and check whether there is free space on a disk drive. |
|
39 * |
|
40 * @lib sysutil.lib |
|
41 * @since S60 v2.0 |
|
42 */ |
|
43 class SysUtil |
|
44 { |
|
45 |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Obtains the software version string. |
|
50 * |
|
51 * @since S60 v2.0 |
|
52 * |
|
53 * Usage example: |
|
54 * @code |
|
55 * TBuf<KSysUtilVersionTextLength> version; |
|
56 * if ( SysUtil::GetSWVersion( version ) == KErrNone ) |
|
57 * { |
|
58 * // Use the version string. |
|
59 * ... |
|
60 * } |
|
61 * @endcode |
|
62 * |
|
63 * @param aValue On return, contains the software version string. |
|
64 * The buffer should have space for KSysUtilVersionTextLength |
|
65 * characters. |
|
66 * |
|
67 * @return KErrNone on success, or one of the Symbian error codes if reading |
|
68 * the version string fails. |
|
69 */ |
|
70 IMPORT_C static TInt GetSWVersion( TDes& aValue ); |
|
71 |
|
72 /** |
|
73 * Returns software version which the currently installed language package |
|
74 * is compatible with. |
|
75 * |
|
76 * @since S60 v2.0 |
|
77 * |
|
78 * @param aValue On return, contains the version string. |
|
79 * The buffer should have space for KSysUtilVersionTextLength |
|
80 * characters. |
|
81 * |
|
82 * @return KErrNone on success, or one of the Symbian error codes if reading |
|
83 * the version string fails. |
|
84 */ |
|
85 IMPORT_C static TInt GetLangSWVersion( TDes& aValue ); |
|
86 |
|
87 /** |
|
88 * Obtains the version of the currently installed language package. |
|
89 * |
|
90 * @since S60 v2.0 |
|
91 * |
|
92 * @param aValue On return, contains the language package version string. |
|
93 * The buffer should have space for KSysUtilVersionTextLength |
|
94 * characters. |
|
95 * |
|
96 * @return KErrNone on success, or one of the Symbian error codes if reading |
|
97 * the version string fails. |
|
98 */ |
|
99 IMPORT_C static TInt GetLangVersion( TDes& aValue ); |
|
100 |
|
101 /** |
|
102 * Checks if free FFS (internal flash file system) storage space is or will |
|
103 * fall below critical level. Static configuration value stored in Central |
|
104 * Repository is used to determine the critical level for the FFS drive. |
|
105 * |
|
106 * @since S60 v2.0 |
|
107 * |
|
108 * @param aFs File server session. Must be given if available, e.g. from |
|
109 * EIKON environment. If NULL, this method will create a |
|
110 * temporary session, which causes the method to consume more |
|
111 * time and system resources. |
|
112 * @param aBytesToWrite Number of bytes the caller is about to write to |
|
113 * FFS. If value 0 is given, this method checks |
|
114 * if the current FFS space is already below critical |
|
115 * level. |
|
116 * |
|
117 * @return ETrue if FFS space would go below critical level after writing |
|
118 * aBytesToWrite more data, EFalse otherwise. |
|
119 * |
|
120 * @leave Leaves with one of the Symbian error codes if checking the FFS |
|
121 * space fails, for instance if there is not enough free memory to |
|
122 * create a temporary connection to file server. |
|
123 */ |
|
124 IMPORT_C static TBool FFSSpaceBelowCriticalLevelL( |
|
125 RFs* aFs, |
|
126 TInt aBytesToWrite = 0 ); |
|
127 |
|
128 |
|
129 /** |
|
130 * Checks if free MMC storage space is or will fall below critical |
|
131 * level. Static configuration value stored in Central Repository is |
|
132 * used to determine the critical level for the MMC drive. |
|
133 * PathInfo API is used to determine the drive letter for the MMC drive. |
|
134 * |
|
135 * @since S60 v2.0 |
|
136 * |
|
137 * @param aFs File server session. Must be given if available, e.g. from |
|
138 * EIKON environment. If NULL, this method will create a |
|
139 * temporary session, which causes the method to consume more |
|
140 * time and system resources. |
|
141 * @param aBytesToWrite Number of bytes the caller is about to write to |
|
142 * MMC. If value 0 is given, this method checks |
|
143 * if the current MMC space is already below critical |
|
144 * level. |
|
145 * |
|
146 * @return ETrue if MMC space would go below critical level after writing |
|
147 * aBytesToWrite more data, EFalse otherwise. |
|
148 * EFalse if the system has no MMC drive support. |
|
149 * |
|
150 * @leave Leaves with one of the Symbian error codes if checking the MMC |
|
151 * space fails, for instance if the MMC drive contains no media or |
|
152 * there is not enough free memory to create a temporary connection to |
|
153 * file server. |
|
154 */ |
|
155 IMPORT_C static TBool MMCSpaceBelowCriticalLevelL( |
|
156 RFs* aFs, |
|
157 TInt aBytesToWrite = 0 ); |
|
158 |
|
159 /** |
|
160 * Checks if free disk drive storage space is or will fall below critical |
|
161 * level. Static configuration values stored in Central Repository are |
|
162 * used to determine a critical level for each drive. |
|
163 * |
|
164 * Usage example: |
|
165 * @code |
|
166 * TInt dataSize = 500; |
|
167 * if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFsSession, dataSize, EDriveC ) ) |
|
168 * { |
|
169 * // Can not write the data, there's not enough free space on disk. |
|
170 * ... |
|
171 * } |
|
172 * else |
|
173 * { |
|
174 * // It's ok to actually write the data. |
|
175 * ... |
|
176 * } |
|
177 * @endcode |
|
178 * |
|
179 * @since S60 v2.0 |
|
180 * |
|
181 * @param aFs File server session. Must be given if available, e.g. from |
|
182 * EIKON environment. If NULL, this method will create a |
|
183 * temporary session, which causes the method to consume more |
|
184 * time and system resources. |
|
185 * @param aBytesToWrite Number of bytes the caller is about to write to |
|
186 * disk. If value 0 is given, this method checks |
|
187 * if the current disk space is already below critical |
|
188 * level. |
|
189 * @param aDrive Identifies the disk drive to be checked. Numeric values |
|
190 * for identifying disk drives are defined in TDriveNumber |
|
191 * enumeration. |
|
192 * |
|
193 * @see TDriveNumber in f32file.h. |
|
194 * |
|
195 * @return ETrue if disk space would go below critical level after writing |
|
196 * aBytesToWrite more data, EFalse otherwise. |
|
197 * |
|
198 * @leave Leaves with one of the Symbian error codes if checking the disk |
|
199 * space fails, for instance if the drive contains no media or there |
|
200 * is not enough free memory to create a temporary connection to |
|
201 * file server. |
|
202 */ |
|
203 IMPORT_C static TBool DiskSpaceBelowCriticalLevelL( |
|
204 RFs* aFs, |
|
205 TInt aBytesToWrite, |
|
206 TInt aDrive ); |
|
207 |
|
208 }; |
|
209 |
|
210 #endif // SYSUTIL_H |