1.1 --- a/epoc32/include/sysutil.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/sysutil.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,210 @@
1.4 -sysutil.h
1.5 +/*
1.6 +* Copyright (c) 2000-2006 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* 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
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: SysUtil API provides functions for applications to retrieve
1.19 +* SW and language package versions and check whether there is
1.20 +* free space on a disk drive.
1.21 +*
1.22 +*/
1.23 +
1.24 +
1.25 +#ifndef SYSUTIL_H
1.26 +#define SYSUTIL_H
1.27 +
1.28 +#include <e32base.h>
1.29 +
1.30 +/**
1.31 +* Helper constant to allocate buffers for GetSWVersion, GetLangSWVersion,
1.32 +* GetLangVersion.
1.33 +*/
1.34 +const TInt KSysUtilVersionTextLength = 64;
1.35 +
1.36 +class RFs;
1.37 +
1.38 +/**
1.39 + * SysUtil provides various utility methods for applications.
1.40 + *
1.41 + * SysUtil API provides functions for applications to retrieve SW and language
1.42 + * package versions and check whether there is free space on a disk drive.
1.43 + *
1.44 + * @lib sysutil.lib
1.45 + * @since S60 v2.0
1.46 + */
1.47 +class SysUtil
1.48 + {
1.49 +
1.50 +public:
1.51 +
1.52 + /**
1.53 + * Obtains the software version string.
1.54 + *
1.55 + * @since S60 v2.0
1.56 + *
1.57 + * Usage example:
1.58 + * @code
1.59 + * TBuf<KSysUtilVersionTextLength> version;
1.60 + * if ( SysUtil::GetSWVersion( version ) == KErrNone )
1.61 + * {
1.62 + * // Use the version string.
1.63 + * ...
1.64 + * }
1.65 + * @endcode
1.66 + *
1.67 + * @param aValue On return, contains the software version string.
1.68 + * The buffer should have space for KSysUtilVersionTextLength
1.69 + * characters.
1.70 + *
1.71 + * @return KErrNone on success, or one of the Symbian error codes if reading
1.72 + * the version string fails.
1.73 + */
1.74 + IMPORT_C static TInt GetSWVersion( TDes& aValue );
1.75 +
1.76 + /**
1.77 + * Returns software version which the currently installed language package
1.78 + * is compatible with.
1.79 + *
1.80 + * @since S60 v2.0
1.81 + *
1.82 + * @param aValue On return, contains the version string.
1.83 + * The buffer should have space for KSysUtilVersionTextLength
1.84 + * characters.
1.85 + *
1.86 + * @return KErrNone on success, or one of the Symbian error codes if reading
1.87 + * the version string fails.
1.88 + */
1.89 + IMPORT_C static TInt GetLangSWVersion( TDes& aValue );
1.90 +
1.91 + /**
1.92 + * Obtains the version of the currently installed language package.
1.93 + *
1.94 + * @since S60 v2.0
1.95 + *
1.96 + * @param aValue On return, contains the language package version string.
1.97 + * The buffer should have space for KSysUtilVersionTextLength
1.98 + * characters.
1.99 + *
1.100 + * @return KErrNone on success, or one of the Symbian error codes if reading
1.101 + * the version string fails.
1.102 + */
1.103 + IMPORT_C static TInt GetLangVersion( TDes& aValue );
1.104 +
1.105 + /**
1.106 + * Checks if free FFS (internal flash file system) storage space is or will
1.107 + * fall below critical level. Static configuration value stored in Central
1.108 + * Repository is used to determine the critical level for the FFS drive.
1.109 + *
1.110 + * @since S60 v2.0
1.111 + *
1.112 + * @param aFs File server session. Must be given if available, e.g. from
1.113 + * EIKON environment. If NULL, this method will create a
1.114 + * temporary session, which causes the method to consume more
1.115 + * time and system resources.
1.116 + * @param aBytesToWrite Number of bytes the caller is about to write to
1.117 + * FFS. If value 0 is given, this method checks
1.118 + * if the current FFS space is already below critical
1.119 + * level.
1.120 + *
1.121 + * @return ETrue if FFS space would go below critical level after writing
1.122 + * aBytesToWrite more data, EFalse otherwise.
1.123 + *
1.124 + * @leave Leaves with one of the Symbian error codes if checking the FFS
1.125 + * space fails, for instance if there is not enough free memory to
1.126 + * create a temporary connection to file server.
1.127 + */
1.128 + IMPORT_C static TBool FFSSpaceBelowCriticalLevelL(
1.129 + RFs* aFs,
1.130 + TInt aBytesToWrite = 0 );
1.131 +
1.132 +
1.133 + /**
1.134 + * Checks if free MMC storage space is or will fall below critical
1.135 + * level. Static configuration value stored in Central Repository is
1.136 + * used to determine the critical level for the MMC drive.
1.137 + * PathInfo API is used to determine the drive letter for the MMC drive.
1.138 + *
1.139 + * @since S60 v2.0
1.140 + *
1.141 + * @param aFs File server session. Must be given if available, e.g. from
1.142 + * EIKON environment. If NULL, this method will create a
1.143 + * temporary session, which causes the method to consume more
1.144 + * time and system resources.
1.145 + * @param aBytesToWrite Number of bytes the caller is about to write to
1.146 + * MMC. If value 0 is given, this method checks
1.147 + * if the current MMC space is already below critical
1.148 + * level.
1.149 + *
1.150 + * @return ETrue if MMC space would go below critical level after writing
1.151 + * aBytesToWrite more data, EFalse otherwise.
1.152 + * EFalse if the system has no MMC drive support.
1.153 + *
1.154 + * @leave Leaves with one of the Symbian error codes if checking the MMC
1.155 + * space fails, for instance if the MMC drive contains no media or
1.156 + * there is not enough free memory to create a temporary connection to
1.157 + * file server.
1.158 + */
1.159 + IMPORT_C static TBool MMCSpaceBelowCriticalLevelL(
1.160 + RFs* aFs,
1.161 + TInt aBytesToWrite = 0 );
1.162 +
1.163 + /**
1.164 + * Checks if free disk drive storage space is or will fall below critical
1.165 + * level. Static configuration values stored in Central Repository are
1.166 + * used to determine a critical level for each drive.
1.167 + *
1.168 + * Usage example:
1.169 + * @code
1.170 + * TInt dataSize = 500;
1.171 + * if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFsSession, dataSize, EDriveC ) )
1.172 + * {
1.173 + * // Can not write the data, there's not enough free space on disk.
1.174 + * ...
1.175 + * }
1.176 + * else
1.177 + * {
1.178 + * // It's ok to actually write the data.
1.179 + * ...
1.180 + * }
1.181 + * @endcode
1.182 + *
1.183 + * @since S60 v2.0
1.184 + *
1.185 + * @param aFs File server session. Must be given if available, e.g. from
1.186 + * EIKON environment. If NULL, this method will create a
1.187 + * temporary session, which causes the method to consume more
1.188 + * time and system resources.
1.189 + * @param aBytesToWrite Number of bytes the caller is about to write to
1.190 + * disk. If value 0 is given, this method checks
1.191 + * if the current disk space is already below critical
1.192 + * level.
1.193 + * @param aDrive Identifies the disk drive to be checked. Numeric values
1.194 + * for identifying disk drives are defined in TDriveNumber
1.195 + * enumeration.
1.196 + *
1.197 + * @see TDriveNumber in f32file.h.
1.198 + *
1.199 + * @return ETrue if disk space would go below critical level after writing
1.200 + * aBytesToWrite more data, EFalse otherwise.
1.201 + *
1.202 + * @leave Leaves with one of the Symbian error codes if checking the disk
1.203 + * space fails, for instance if the drive contains no media or there
1.204 + * is not enough free memory to create a temporary connection to
1.205 + * file server.
1.206 + */
1.207 + IMPORT_C static TBool DiskSpaceBelowCriticalLevelL(
1.208 + RFs* aFs,
1.209 + TInt aBytesToWrite,
1.210 + TInt aDrive );
1.211 +
1.212 + };
1.213 +
1.214 +#endif // SYSUTIL_H