QtMobility Reference Documentation

SystemInfo QML Plugin

Overview

The System Information API gives the developer a convenient way to access various sources of information on a device within the powerful QtQuick environment.

Many signals that you may wish to use require that a property with a name beginning with 'monitor' be used, for example setting monitorStatusChanges to true will start status change events being emitted as signals (in the NetworkInfo element).

AlignedTimer

The AlignedTimer element allows timing functions in order to synchronize a number of activities. A one-shot feature is included as well as properties for minimum and maximum timer intervals.

BatteryInfo

The BatteryInfo element contains a set of functions and properties for interrogating and handling notifications of battery information. We will use the battery example, battery2.qml, to show how to use the element and the plugin.

The following QML code enables a number of events and defines several handlers.

     BatteryInfo {
         id: batinfo;

         property int battlevel: remainingCapacityPercent;
         property string oldstate;

         monitorChargerTypeChanges: true
         monitorChargingStateChanges: true
         monitorBatteryStatusChanges: true
         monitorRemainingCapacityPercentChanges: true
         monitorRemainingCapacityChanges: true
         monitorRemainingChargingTimeChanges: true
         monitorCurrentFlowChanges: true

         onChargerTypeChanged:  {
         ...

In particular, when the battery level changes the handler

         onRemainingCapacityPercentChanged: doBatteryLevelChange(level)

calls

     function doBatteryLevelChange(level) {
         leveltext.text = "Level: "+ level +"%"
         floorParticles.burst(level);
         batlevel = level;
         batinfo.oldstate = img.state;
         img.state = "levelchange"
         //img.state = batinfo.oldstate;
         getPowerState();
     }

which results in a change of State to levelchange being handled after the function. The levelchange state then causes a suitable animation to run and display the new level.

         State {
             name: "levelchange"
             ...
             PropertyChanges {
                 target: bubblebounceanim
                 from: screen.height
                 to: screen.height - (screen.height * (batlevel / 100 ))
             }
             ...

DeviceInfo

In the battery2.qml example above we saw a BatteryInfo element used to set up various signal handlers, one for battery level changes. BatteryInfo is a specialized wrapper of the same class used for DeviceInfo. DeviceInfo is an element that contains properties, signals and handlers for a variety of components of the device. So it not only caters for the battery but also manufacturer id, the thermal state, keyboard, whether the device locked and so forth.

DisplayInfo

The DisplayInfo element contains properties relating to the physical display such as width and height, and also resolution information given as the width and height in dpi. Only one signal is available, orientationChanged.

The meaning of the values used in some of the properties and the reported orientation can be found in the QSystemDisplayInfo documentation.

GeneralInfo

This is a convenience class and is not expected to be used directly by developers.

NetworkInfo

The NetworkInfo element provides properties of a network connection and session and various signals. The QML plugin example, wifi.qml, gives a simple demonstration on how to use some of these properties.

     Item {
         id: wlan
         ...
         property int mode: NetworkInfo.WlanMode;
         ...
         NetworkInfo {
             id: wlaninfo
             mode: wlan.mode;
             property string img : getImage(networkStatus);

             function getImage(newStatus) {
                 if(newStatus == "Connected") {
                     return "images/wlan.svg";
                 }
                 return "images/wlan-noavail.svg";
             }

             onStatusChanged : {
                 img = getImage(newStatus)
             }
             monitorNameChanges: true;
             monitorSignalStrengthChanges: true
             monitorStatusChanges: true
             monitorModeChanges: true
         }

The Item element named wlan has its declared mode property set to the wireless lan mode enum. The NetworkInfo element wlaninfo also contains the connection status, represented by a string indicating a suitable image to display. The signal handler onStatusChanged will call the function that sets the image. Finally, in the NetworkInfo element we find a series of statements that enable signals for name changes, status changes, signal strength changes and mode changes.

ScreenSaver

The ScreenSaver element provides information about whether the screensaver has been delayed or inhibited and the ability to set the delayed boolean flag.

QML Elements

QML AlignedTimer Element

The AlignedTimer element allows applications to synchronize activity, such as network access, like checking for updates.

QML BatteryInfo Element

The BatteryInfo element allows you to receive battery change notifications from the device.

QML DeviceInfo Element

The DeviceInfo element allows you to access information anbout the device and receive notifications from the device.

QML DisplayInfo Element

The DisplayInfo element allows you to get information and receive notifications about the diplsay.

QML GeneralInfo Element

The GeneralInfo element allows you access to general system information and to receive notifications from the device.

QML NetworkInfo Element

The NetworkInfo element allows you to get information and receive notifications from the network.

QML ScreenSaver Element

The ScreenSaver element allows you to temporarily suppress and delay the screensaver from turning on or blanking the screen.

QML StorageInfo Element

The StorageInfo element provides access to disk storage information from the system.

Compatibility Notes

DeviceInfo NetworkInfo

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.