Retrieving Versions and Device Type Information

This section explains the tasks that can be performed using System Utilities such as retrieving software and language package versions and device type information.

Retrieving the current software version

To retrieve the software version of the device, call GetSWVersion() function. This function sets the parameter passed to a Unicode string holding the current software version.

TBuf<KSysUtilVersionTextLength> version;
if( SysUtil::GetSWVersion( version ) == KErrNone )
     {     // Use the version string.     ...
     }

Retrieving the current software version for the current language package

To retrieve the software version of the device which is compatible with the currently installed language package, call GetLangSWVersion(). This function sets the parameter passed to a Unicode string holding the required software version.

Retrieving the current language package version

To retrieve the version of the currently installed language package, call GetLangVersion(). This function sets the parameter passed to a Unicode string holding the language package.

Note: The following functions read data from text files:

  • GetSWVersion() reads from Z:\\resource\\versions\\sw.txt

  • GetLangSWVersion() reads from Z:\\resource\\versions\\langsw.txt

  • GetLangVersion() reads from Z:\\resource\\versions\\lang.txt

The GetSWVersion() and GetLangSWVersion() functions convert the newline character "\n" to the Unicode newline character but GetLangVersion()function does not convert.

Retrieving the device type information

To retrieve the device type information, call GetDeviceTypeInfoL() function. It consists of a pointer to an instance of CDeviceTypeInformation. This instance contains the complete set of device type information attributes that are provisioned by the device manufacturer.

TPtrC16 modelNamePtrC;
if( User::LeaveIfError( deviceTypeInfo->GetModelName( modelNamePtrC ) ) == CDeviceTypeInformation::KDefaultValue )
          {
          // We have a default attribute value, do something else
          ...
          }
else
          {
          // We have a device creator supplied attribute value.
          ...
          }

Related concepts