How can I find out the software build version of a Symbian device?
Article Metadata
Compatibility
S60 2nd Edition
Article
Overview
How can I find out the software build version of a S60 device in numeric format?
Description
The method SysUtil::GetSWVersion(TDes& aValue) returns the device software version information as a string. The same information is returned in a dialog when the sequence *#0000# is entered in phone idle view. Sometimes it is useful for an application to know the version information as integer values. The following code demonstrates how to extract the software version as unsigned integer values from the string:
#include <SysUtil.h> // link against sysutil.lib
void GetNumericSWVersionL(TUint& aMajor, TUint& aMinor, TUint& aBuild)
{
TBuf<KSysUtilVersionTextLength> versionString;
User::LeaveIfError(SysUtil::GetSWVersion(versionString));
TLex parser(versionString);
// Skip non-digit characters from the beginning
while(!parser.Peek().IsDigit())
parser.Get();
// Get major version value
User::LeaveIfError(parser.Val(aMajor));
// Next character should be '.'
if(parser.Get() != '.')
User::Leave(KErrBadDescriptor);
// Get minor version value
User::LeaveIfError(parser.Val(aMinor));
// If next char is '.' or '(', string contains
// also the build version
TChar next = parser.Get();
if(next == '.'
| next == '(')
User::LeaveIfError(parser.Val(aBuild));
else
aBuild = 0;
}


(no comments yet)