williamr@2
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 2006-2009 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@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.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@4
|
14 |
* Description:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@4
|
19 |
|
williamr@2
|
20 |
#ifndef SYSUTIL_H
|
williamr@2
|
21 |
#define SYSUTIL_H
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#include <e32base.h>
|
williamr@2
|
24 |
|
williamr@4
|
25 |
class RFs;
|
williamr@4
|
26 |
class CDeviceTypeInformation;
|
williamr@4
|
27 |
|
williamr@2
|
28 |
/**
|
williamr@4
|
29 |
Constant conveying the size of the preallocated descriptor buffers used with
|
williamr@4
|
30 |
the SysUtil version APIs.
|
williamr@4
|
31 |
|
williamr@4
|
32 |
@see SysUtil::GetSWVersion
|
williamr@4
|
33 |
@see SysUtil::GetLangSWVersion
|
williamr@4
|
34 |
@see SysUtil::GetLangVersion
|
williamr@4
|
35 |
@publishedAll
|
williamr@4
|
36 |
@released
|
williamr@2
|
37 |
*/
|
williamr@2
|
38 |
const TInt KSysUtilVersionTextLength = 64;
|
williamr@2
|
39 |
|
williamr@2
|
40 |
|
williamr@2
|
41 |
/**
|
williamr@4
|
42 |
SysUtil provides various system utility methods, as follows:
|
williamr@4
|
43 |
- Functions for applications to retrieve SW and language package versions
|
williamr@4
|
44 |
strings for display purposes
|
williamr@4
|
45 |
- Functions to check whether there is free space on a disk drive before
|
williamr@4
|
46 |
file creation or writing.
|
williamr@4
|
47 |
- Functions to retrieve Device Type information (e.g. phone model) for display
|
williamr@4
|
48 |
purposes.
|
williamr@4
|
49 |
|
williamr@4
|
50 |
Version, Attribute strings and free space thresholds are provisioned by
|
williamr@4
|
51 |
the device creator into the ROM. For details on this see the
|
williamr@4
|
52 |
'SGL.TS0017.324 BAFL How-To FAQ Document' in the OS Developer Library.
|
williamr@4
|
53 |
|
williamr@4
|
54 |
@publishedAll
|
williamr@4
|
55 |
@released
|
williamr@4
|
56 |
*/
|
williamr@2
|
57 |
class SysUtil
|
williamr@2
|
58 |
{
|
williamr@2
|
59 |
public:
|
williamr@2
|
60 |
IMPORT_C static TInt GetSWVersion( TDes& aValue );
|
williamr@2
|
61 |
IMPORT_C static TInt GetLangSWVersion( TDes& aValue );
|
williamr@2
|
62 |
IMPORT_C static TInt GetLangVersion( TDes& aValue );
|
williamr@4
|
63 |
IMPORT_C static TInt GetPRInformation( TDes& aValue );
|
williamr@4
|
64 |
|
williamr@4
|
65 |
private:
|
williamr@4
|
66 |
IMPORT_C static TBool FFSSpaceBelowCriticalLevel_OldL(
|
williamr@2
|
67 |
RFs* aFs,
|
williamr@2
|
68 |
TInt aBytesToWrite = 0 );
|
williamr@4
|
69 |
IMPORT_C static TBool MMCSpaceBelowCriticalLevel_OldL(
|
williamr@2
|
70 |
RFs* aFs,
|
williamr@2
|
71 |
TInt aBytesToWrite = 0 );
|
williamr@4
|
72 |
IMPORT_C static TBool DiskSpaceBelowCriticalLevel_OldL(
|
williamr@2
|
73 |
RFs* aFs,
|
williamr@2
|
74 |
TInt aBytesToWrite,
|
williamr@2
|
75 |
TInt aDrive );
|
williamr@4
|
76 |
public:
|
williamr@4
|
77 |
IMPORT_C static TInt GetMMCDriveLetter( RFs & aFs );
|
williamr@4
|
78 |
IMPORT_C static TInt GetFFSDriveLetter( RFs & aFs );
|
williamr@4
|
79 |
|
williamr@4
|
80 |
public:
|
williamr@4
|
81 |
IMPORT_C static CDeviceTypeInformation* GetDeviceTypeInfoL();
|
williamr@4
|
82 |
|
williamr@4
|
83 |
IMPORT_C static TBool FFSSpaceBelowCriticalLevelL(
|
williamr@4
|
84 |
RFs* aFs,
|
williamr@4
|
85 |
TInt64 aBytesToWrite = 0 );
|
williamr@4
|
86 |
IMPORT_C static TBool MMCSpaceBelowCriticalLevelL(
|
williamr@4
|
87 |
RFs* aFs,
|
williamr@4
|
88 |
TInt64 aBytesToWrite = 0 );
|
williamr@4
|
89 |
IMPORT_C static TBool DiskSpaceBelowCriticalLevelL(
|
williamr@4
|
90 |
RFs* aFs,
|
williamr@4
|
91 |
TInt64 aBytesToWrite,
|
williamr@4
|
92 |
TInt aDrive );
|
williamr@4
|
93 |
};
|
williamr@2
|
94 |
|
williamr@4
|
95 |
/**
|
williamr@4
|
96 |
This class is used to hold the device type information attributes and provides
|
williamr@4
|
97 |
member functions to return the attribute values. These values are strings of
|
williamr@4
|
98 |
UTF-16 characters and no format must be assumed or implied as it varies from
|
williamr@4
|
99 |
one device manufacturer to the next. Please note that this information does not
|
williamr@4
|
100 |
identify a unique device but identifies the type of device.
|
williamr@4
|
101 |
|
williamr@4
|
102 |
An instance of this class cannot be created by user code. If device type
|
williamr@4
|
103 |
information attributes are required then the user should use
|
williamr@4
|
104 |
SysUtil::GetDeviceTypeInfoL which will return a pointer to an instance of this
|
williamr@4
|
105 |
class. This instance will contain a full set of device type information
|
williamr@4
|
106 |
attributes that have been provisioned by the device creator. For
|
williamr@4
|
107 |
details of how these are provisioned see 'XXX xxx' document in the OS Developer
|
williamr@4
|
108 |
Library.
|
williamr@4
|
109 |
|
williamr@4
|
110 |
For standard device type information attributes (attributes which are common
|
williamr@4
|
111 |
to all device creators) named functions have been provided. These functions
|
williamr@4
|
112 |
also offer the advantage of a default value being provided when an attribute
|
williamr@4
|
113 |
has not been provisioned by the device creator. If a default value has been
|
williamr@4
|
114 |
retrieved KDefaultValue will be returned.
|
williamr@4
|
115 |
|
williamr@4
|
116 |
Callers who do not care about whether a default value is retrieved or not can
|
williamr@4
|
117 |
use the API as follows:
|
williamr@4
|
118 |
|
williamr@4
|
119 |
@code
|
williamr@4
|
120 |
TPtrC16 modelNamePtrC;
|
williamr@4
|
121 |
User::LeaveIfError( deviceTypeInfo->GetModelName(modelNamePtrC) );
|
williamr@4
|
122 |
@endcode
|
williamr@4
|
123 |
|
williamr@4
|
124 |
Where callers wish to avoid the default value it can be tested for as follows:
|
williamr@4
|
125 |
|
williamr@4
|
126 |
@code
|
williamr@4
|
127 |
TPtrC16 modelNamePtrC;
|
williamr@4
|
128 |
if (User::LeaveIfError( deviceTypeInfo->GetModelName(modelNamePtrC)) == CDeviceTypeInformation::KDefaultValue)
|
williamr@4
|
129 |
{
|
williamr@4
|
130 |
// We have a default attribute value, do something else
|
williamr@4
|
131 |
...
|
williamr@4
|
132 |
}
|
williamr@4
|
133 |
else
|
williamr@4
|
134 |
{
|
williamr@4
|
135 |
// We have a device creator supplied attribute value.
|
williamr@4
|
136 |
...
|
williamr@4
|
137 |
}
|
williamr@4
|
138 |
@endcode
|
williamr@4
|
139 |
|
williamr@4
|
140 |
In addition to named functions, two additional generic functions are provided
|
williamr@4
|
141 |
that can be used to retrieve any additional device type information attributes
|
williamr@4
|
142 |
which may be provided by a device creator. These functions can also be used to
|
williamr@4
|
143 |
retrieve the standard attributes; however, it is recommended that the named
|
williamr@4
|
144 |
functions be used instead.
|
williamr@4
|
145 |
|
williamr@4
|
146 |
Any code which owns an instance of this class has the responsibility of
|
williamr@4
|
147 |
destroying it. This may be achieved by calling delete on the pointer or using
|
williamr@4
|
148 |
the CleanupStack.
|
williamr@4
|
149 |
|
williamr@4
|
150 |
@publishedAll
|
williamr@4
|
151 |
@released
|
williamr@4
|
152 |
*/
|
williamr@4
|
153 |
NONSHARABLE_CLASS(CDeviceTypeInformation) : public CBase
|
williamr@4
|
154 |
{
|
williamr@4
|
155 |
public: //publishedAll
|
williamr@4
|
156 |
/**
|
williamr@4
|
157 |
The maximum length of a device attribute string value.
|
williamr@4
|
158 |
*/
|
williamr@4
|
159 |
static const TInt KMaxAttributeLength = 64;
|
williamr@4
|
160 |
|
williamr@4
|
161 |
/**
|
williamr@4
|
162 |
This const is a value returned from calls to the named
|
williamr@4
|
163 |
CDeviceTypeInformation APIs. It indicates to the caller that the returned
|
williamr@4
|
164 |
device type information attribute, stored in CDeviceTypeInformation, is a
|
williamr@4
|
165 |
default value. This occurs when the device creator does not provision the
|
williamr@4
|
166 |
attribute value.
|
williamr@4
|
167 |
*/
|
williamr@4
|
168 |
static const TInt KDefaultValue = 1;
|
williamr@4
|
169 |
public: // publishedAll
|
williamr@4
|
170 |
IMPORT_C ~CDeviceTypeInformation();
|
williamr@4
|
171 |
static CDeviceTypeInformation* NewL();
|
williamr@4
|
172 |
IMPORT_C TInt GetManufacturerName( TPtrC16& aValue ) const;
|
williamr@4
|
173 |
IMPORT_C TInt GetModelName( TPtrC16& aValue ) const;
|
williamr@4
|
174 |
IMPORT_C TInt GetModelCode( TPtrC16& aValue ) const;
|
williamr@4
|
175 |
IMPORT_C TInt GetRevisionID( TPtrC16& aValue ) const;
|
williamr@4
|
176 |
IMPORT_C TInt GetDefaultDeviceName( TPtrC16& aValue ) const;
|
williamr@4
|
177 |
IMPORT_C TInt GetUIPlatformName( TPtrC16& aValue ) const;
|
williamr@4
|
178 |
IMPORT_C TInt GetUIPlatformVersion( TPtrC16& aValue ) const;
|
williamr@4
|
179 |
IMPORT_C TInt GetUIPlatformVersion( TUint16& aMajor, TUint16& aMinor ) const;
|
williamr@4
|
180 |
IMPORT_C TInt GetOSVersion( TPtrC16& aValue ) const;
|
williamr@4
|
181 |
IMPORT_C TInt GetOSVersion( TUint16& aMajor, TUint16& aMinor ) const;
|
williamr@4
|
182 |
|
williamr@4
|
183 |
public: // publishedPartner
|
williamr@4
|
184 |
IMPORT_C TInt GetAttribute( const TUid& aAttributeUid, TPtrC16& aValue ) const;
|
williamr@4
|
185 |
private:
|
williamr@4
|
186 |
CDeviceTypeInformation();
|
williamr@4
|
187 |
void ConstructL();
|
williamr@4
|
188 |
private:
|
williamr@4
|
189 |
class TImpl;
|
williamr@4
|
190 |
TImpl* iImpl;
|
williamr@4
|
191 |
};
|
williamr@2
|
192 |
|
williamr@2
|
193 |
#endif // SYSUTIL_H
|