2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
26 class CDeviceTypeInformation;
29 Constant conveying the size of the preallocated descriptor buffers used with
30 the SysUtil version APIs.
32 @see SysUtil::GetSWVersion
33 @see SysUtil::GetLangSWVersion
34 @see SysUtil::GetLangVersion
38 const TInt KSysUtilVersionTextLength = 64;
42 SysUtil provides various system utility methods, as follows:
43 - Functions for applications to retrieve SW and language package versions
44 strings for display purposes
45 - Functions to check whether there is free space on a disk drive before
46 file creation or writing.
47 - Functions to retrieve Device Type information (e.g. phone model) for display
50 Version, Attribute strings and free space thresholds are provisioned by
51 the device creator into the ROM. For details on this see the
52 'SGL.TS0017.324 BAFL How-To FAQ Document' in the OS Developer Library.
60 IMPORT_C static TInt GetSWVersion( TDes& aValue );
61 IMPORT_C static TInt GetLangSWVersion( TDes& aValue );
62 IMPORT_C static TInt GetLangVersion( TDes& aValue );
63 IMPORT_C static TInt GetPRInformation( TDes& aValue );
66 IMPORT_C static TBool FFSSpaceBelowCriticalLevel_OldL(
68 TInt aBytesToWrite = 0 );
69 IMPORT_C static TBool MMCSpaceBelowCriticalLevel_OldL(
71 TInt aBytesToWrite = 0 );
72 IMPORT_C static TBool DiskSpaceBelowCriticalLevel_OldL(
77 IMPORT_C static TInt GetMMCDriveLetter( RFs & aFs );
78 IMPORT_C static TInt GetFFSDriveLetter( RFs & aFs );
81 IMPORT_C static CDeviceTypeInformation* GetDeviceTypeInfoL();
83 IMPORT_C static TBool FFSSpaceBelowCriticalLevelL(
85 TInt64 aBytesToWrite = 0 );
86 IMPORT_C static TBool MMCSpaceBelowCriticalLevelL(
88 TInt64 aBytesToWrite = 0 );
89 IMPORT_C static TBool DiskSpaceBelowCriticalLevelL(
96 This class is used to hold the device type information attributes and provides
97 member functions to return the attribute values. These values are strings of
98 UTF-16 characters and no format must be assumed or implied as it varies from
99 one device manufacturer to the next. Please note that this information does not
100 identify a unique device but identifies the type of device.
102 An instance of this class cannot be created by user code. If device type
103 information attributes are required then the user should use
104 SysUtil::GetDeviceTypeInfoL which will return a pointer to an instance of this
105 class. This instance will contain a full set of device type information
106 attributes that have been provisioned by the device creator. For
107 details of how these are provisioned see 'XXX xxx' document in the OS Developer
110 For standard device type information attributes (attributes which are common
111 to all device creators) named functions have been provided. These functions
112 also offer the advantage of a default value being provided when an attribute
113 has not been provisioned by the device creator. If a default value has been
114 retrieved KDefaultValue will be returned.
116 Callers who do not care about whether a default value is retrieved or not can
117 use the API as follows:
120 TPtrC16 modelNamePtrC;
121 User::LeaveIfError( deviceTypeInfo->GetModelName(modelNamePtrC) );
124 Where callers wish to avoid the default value it can be tested for as follows:
127 TPtrC16 modelNamePtrC;
128 if (User::LeaveIfError( deviceTypeInfo->GetModelName(modelNamePtrC)) == CDeviceTypeInformation::KDefaultValue)
130 // We have a default attribute value, do something else
135 // We have a device creator supplied attribute value.
140 In addition to named functions, two additional generic functions are provided
141 that can be used to retrieve any additional device type information attributes
142 which may be provided by a device creator. These functions can also be used to
143 retrieve the standard attributes; however, it is recommended that the named
144 functions be used instead.
146 Any code which owns an instance of this class has the responsibility of
147 destroying it. This may be achieved by calling delete on the pointer or using
153 NONSHARABLE_CLASS(CDeviceTypeInformation) : public CBase
155 public: //publishedAll
157 The maximum length of a device attribute string value.
159 static const TInt KMaxAttributeLength = 64;
162 This const is a value returned from calls to the named
163 CDeviceTypeInformation APIs. It indicates to the caller that the returned
164 device type information attribute, stored in CDeviceTypeInformation, is a
165 default value. This occurs when the device creator does not provision the
168 static const TInt KDefaultValue = 1;
169 public: // publishedAll
170 IMPORT_C ~CDeviceTypeInformation();
171 static CDeviceTypeInformation* NewL();
172 IMPORT_C TInt GetManufacturerName( TPtrC16& aValue ) const;
173 IMPORT_C TInt GetModelName( TPtrC16& aValue ) const;
174 IMPORT_C TInt GetModelCode( TPtrC16& aValue ) const;
175 IMPORT_C TInt GetRevisionID( TPtrC16& aValue ) const;
176 IMPORT_C TInt GetDefaultDeviceName( TPtrC16& aValue ) const;
177 IMPORT_C TInt GetUIPlatformName( TPtrC16& aValue ) const;
178 IMPORT_C TInt GetUIPlatformVersion( TPtrC16& aValue ) const;
179 IMPORT_C TInt GetUIPlatformVersion( TUint16& aMajor, TUint16& aMinor ) const;
180 IMPORT_C TInt GetOSVersion( TPtrC16& aValue ) const;
181 IMPORT_C TInt GetOSVersion( TUint16& aMajor, TUint16& aMinor ) const;
183 public: // publishedPartner
184 IMPORT_C TInt GetAttribute( const TUid& aAttributeUid, TPtrC16& aValue ) const;
186 CDeviceTypeInformation();