×
Namespaces

Variants
Actions

How can I find out the software build version of a Symbian device?

From Nokia Developer Wiki
Jump to: navigation, search



Article Metadata
Compatibility
Platform(s): S60 1st Edition
S60 2nd Edition
S60 2nd Edition (initial release)
S60 1st Edition
Article
Created: User:Technical writer 2 (17 Feb 2005)
Last edited: hamishwillee (14 Jun 2012)

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;
    }

This page was last modified on 14 June 2012, at 04:54.
13 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×