Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:How to get system information using PySymbian

From Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 1st Edition, S60 2nd Edition, S60 3rd Edition
S60 5th Edition
Article
Keywords: sysinfo
Created: cyke64 (15 Mar 2007)
Last edited: hamishwillee (31 May 2013)

Contents

Overview

This article shows how to retrieve system information in Python.

Preconditions

Note: The function ring_type is not available for S60 1st Edition.

The value returned by the battery function may be incorrect while the device is being charged.

Source code

from sysinfo import *
 
 
print "Battery level:", battery()
 
print "Signal strenght:", signal_bars()
 
print "Signal strenght in dBm:", signal_dbm()
 
print "Display resolution:", str(display_pixels()[0]) + "x" + str(display_pixels()[1])
 
print "Display size:", str(display_twips()[0]) + "x" + str(display_twips()[1]), "twips"
 
print "Free space:", free_drivespace()
 
print "IMEI:", imei()
 
print "RAM free/total:", str(free_ram()) + "/" + str(total_ram())
 
print "ROM:", total_rom()
 
print "Active profile:", active_profile()
 
print "Ring type:", ring_type()
 
print "Operating system version:", os_version()
 
print "Firmware version:", sw_version()

Postconditions

The information is displayed.

Additional information

The following functions are available in the sysinfo module:

  • active_profile()

Returns the currently active profile as a string, which can be one of the following: 'general', 'silent', 'meeting', 'outdoor', 'pager', 'offline', , 'drive' or 'user <profile value>'.

  • battery()

Returns the current battery level. On devices based on S60 2nd Edition Feature Pack 1 (S60 2.1) or earlier the value ranges from 0 (empty) to 7 (full). On newer devices the value ranges from 0 (empty) to 100 (full). On the emulator the value is always 0.

  • display_twips()

Returns the width and height of the display in twips. A twip is 1/1440 of an inch or 1/567 of a centimeter.

  • display_pixels()

Returns the width and height of the display in pixels.

  • free_drivespace()

Returns a dictionary with the available drive letters as keys and the free storage space on each drive as values.

  • imei()

Returns the IMEI code of the device as a Unicode string. If used on an emulator, the returned string will always be u'000000000000000'.

  • max_ramdrive_size()

Returns the maximum size of the RAM drive on the device.

  • total_ram()

Returns the amount of RAM memory on the device.

  • free_ram()

Returns the amount of free RAM memory available on the device.

  • total_rom()

Returns the amount of read-only ROM memory on the device.

  • ring_type()

Returns the current ringing type as a string, which can be one of the following: 'normal', 'ascending', 'ring once', 'beep', or 'silent'.

  • signal_bars()

Returns the current network signal strength ranging from 0 to 7, with 0 meaning no signal and 7 meaning a strong signal. If used on an emulator, the returned value will always be 0.

  • signal_dbm()

Available starting with SDK 2.8. Returns the current network signal strength in dBm. If used on an emulator, the returned value will always be 0.

  • sw_version()

Returns the software version as a Unicode string. If used on an emulator, the returned string will always be u'emulator'. For example, a software version can be returned as u'V 30.0.015 15-07-08 RM-159 N95(c)NMP'.

  • os_version()
    Returns the operating system version number of the device as a three element tuple (major version, minor version, build number). The elements are as follows:
    • The major version number, ranging from 0 to 127 inclusive
    • The minor version number, ranging from 0 to 99 inclusive
    • The build number, ranging from 0 to 32767 inclusive.

Known issues

On Nokia N80 the sw_version function returns error -46.

On Nokia N95 and Nokia E90 the max_ramdrive_size function returns KErrNotSupported.

This page was last modified on 31 May 2013, at 01:09.
36 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.

×