×
Namespaces

Variants
Actions
(Difference between revisions)

Working with QSystemDeviceInfo - System Information API - Part 1

From Nokia Developer Wiki
Jump to: navigation, search
kiran10182 (Talk | contribs)
m (Related articles)
hamishwillee (Talk | contribs)
m (Text replace - "<code cpp>" to "<code cpp-qt>")
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category:Draft]][[Category:Qt for Symbian]][[Category:Code Examples]]
+
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= [[Media:SystemDeviceInfo.zip]]  
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20100308
 +
|author= [[User:Kiran10182]]
 +
}}
 +
[[Category:Qt Mobility]]
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"  
 
|-
 
|-
Line 9: Line 31:
 
|'''Tested on devices''' || Nokia 5800 xPressMusic
 
|'''Tested on devices''' || Nokia 5800 xPressMusic
 
|-
 
|-
|'''Category''' || Qt for Symbian
+
|'''Category''' || Qt
 
|'''Subcategory''' || Qt Mobility API
 
|'''Subcategory''' || Qt Mobility API
 
|-
 
|-
Line 22: Line 44:
  
  
{{UnderConstruction}}
+
{{Tip|<b></b>
 +
* Please read this article before moving forward: [[Archived:Setting up environment for Qt Mobility API]]
 +
* Setup Carbide.c++ IDE as explained in this article: [[Working with Carbide.c++ IDE for Qt Mobility APIs]]
 +
}}
  
{{Tip| Read this article before moving forward: [[Setting up environment for Qt Mobility API]]}}
 
  
== Overview ==  
+
= Overview =  
 
This is a part 1 of the '''''QSystemDeviceInfo API''''' which is a part of the '''''System Information API''''' from '''''Qt Mobility project'''''.
 
This is a part 1 of the '''''QSystemDeviceInfo API''''' which is a part of the '''''System Information API''''' from '''''Qt Mobility project'''''.
  
== What is covered in QSystemDeviceInfo API Part 1 ==
+
= What is covered in QSystemDeviceInfo API Part 1 =
 
* It is a part of the System Information API.
 
* It is a part of the System Information API.
 
* This article covers information about
 
* This article covers information about
Line 45: Line 69:
  
  
== Capabilities required ==
+
= Capabilities required =
* ReadDeviceData
+
* [[Capabilities (Symbian Signed)/ReadDeviceData Capability|ReadDeviceData]]
  
  
== UI design (.ui file) ==
+
= UI design (.ui file) =
 
[[File:QSystemDeviceInfo UI.png]]
 
[[File:QSystemDeviceInfo UI.png]]
  
  
  
== Project configuration file (.Pro file) ==
+
= Project configuration file (.Pro file) =
 
* Add the Qt Mobility project configuration option in the .Pro file as shown below
 
* Add the Qt Mobility project configuration option in the .Pro file as shown below
<code cpp>
+
<code cpp-qt>
 
CONFIG += mobility
 
CONFIG += mobility
 
MOBILITY += systeminfo
 
MOBILITY += systeminfo
Line 63: Line 87:
  
 
* Add required capability in .pro file as shown below:
 
* Add required capability in .pro file as shown below:
<code cpp>
+
<code cpp-qt>
 
symbian:TARGET.CAPABILITY = ReadDeviceData
 
symbian:TARGET.CAPABILITY = ReadDeviceData
 
</code>
 
</code>
  
== Implementing QSystemDeviceInfo API ==
+
= Implementing QSystemDeviceInfo API =
 
* QSystemDeviceInfo API is a part of the QtMobility namespace. So declare the QtMobility namespace as shown below:
 
* QSystemDeviceInfo API is a part of the QtMobility namespace. So declare the QtMobility namespace as shown below:
<code cpp>
+
<code cpp-qt>
 
using namespace QtMobility;
 
using namespace QtMobility;
 
</code>
 
</code>
  
=== Header file===
+
== Header file==
<code cpp>
+
<code cpp-qt>
 
#ifndef SYSTEMDEVICEINFO_H
 
#ifndef SYSTEMDEVICEINFO_H
 
#define SYSTEMDEVICEINFO_H
 
#define SYSTEMDEVICEINFO_H
Line 103: Line 127:
  
  
=== Source file ===
+
== Source file ==
<code cpp>
+
<code cpp-qt>
 
#include "SystemDeviceInfo.h"
 
#include "SystemDeviceInfo.h"
  
Line 166: Line 190:
  
  
== Output ==
+
= Output =
 
[[File:QSystemDeviceInfo device.jpg]]
 
[[File:QSystemDeviceInfo device.jpg]]
  
  
  
== Useful functions ==
+
= Useful functions =
 +
* QString imei  ();
 +
* QString imsi ();
 +
* QString manufacturer ();
 +
* QString model ();
 +
* QString productName ();
 +
* int batteryLevel  () const;
 +
* QSystemDeviceInfo::BatteryStatus batteryStatus ();
 +
* QSystemDeviceInfo::Profile currentProfile ();
 +
* bool isDeviceLocked ();
 +
* QSystemDeviceInfo::SimStatus simStatus ();
  
 
+
=Keywords=
 
+
==Headers==
== Keywords ==
+
 
+
 
+
===Headers===
+
 
* #include <qsysteminfo.h>
 
* #include <qsysteminfo.h>
  
 
+
==Classes==
===Classes===
+
 
* QSystemDeviceInfo
 
* QSystemDeviceInfo
 +
* QString
 +
* QStringList
 +
* QButton
 +
* QLabel
  
 
+
= Example Application =
== Example Application ==
+
 
* A working example application is available to download from here: [[Media:SystemDeviceInfo.zip|QSystemDeviceInfo part1.zip]]
 
* A working example application is available to download from here: [[Media:SystemDeviceInfo.zip|QSystemDeviceInfo part1.zip]]
  
  
== Related articles ==  
+
= Related articles =
 
* [[Getting started with Qt Mobility APIs]]
 
* [[Getting started with Qt Mobility APIs]]
* [[Setting up environment for Qt Mobility API]]
+
* [[Archived:Setting up environment for Qt Mobility API]]
 +
* [[Working with Carbide.c++ IDE for Qt Mobility APIs]]
 
* [[Working with QSystemInfo - System Information API - Part 1]]
 
* [[Working with QSystemInfo - System Information API - Part 1]]
 
* [[Working with QSystemInfo - System Information API - Part 2]]
 
* [[Working with QSystemInfo - System Information API - Part 2]]
Line 200: Line 233:
 
* [[Working with QSystemNetworkInfo - System Information API - Part 2]]
 
* [[Working with QSystemNetworkInfo - System Information API - Part 2]]
  
== Reference links==
+
= Reference links=
 
* [http://qt.nokia.com/ Qt - cross-platform application and UI framework]
 
* [http://qt.nokia.com/ Qt - cross-platform application and UI framework]
 
* [http://labs.trolltech.com/page/Projects/QtMobility Qt Mobility API]
 
* [http://labs.trolltech.com/page/Projects/QtMobility Qt Mobility API]
* [http://qt.nokia.com/developer/new-qt-apis New Qt APIs Beta - Mobility Project]
+
* [http://qt.nokia.com/developer/qt-roadmap New Qt APIs Beta - Mobility Project]
* SDK help
+
* SDK help[[Category:Code Examples]][[Category:MeeGo Harmattan]] [[Category:Symbian]]

Latest revision as of 04:23, 11 October 2012

Article Metadata
Code ExampleCompatibility
Platform(s):
Symbian
Article
Created: kiran10182 (08 Mar 2010)
Last edited: hamishwillee (11 Oct 2012)
ID Creation date 8-March-2010
Platform S60 3rd Edition, FP1, FP2

S60 5th Edition

Tested on devices Nokia 5800 xPressMusic
Category Qt Subcategory Qt Mobility API


Keywords (APIs, classes, methods, functions): QSystemDeviceInfo, QString, QStringList, QButton, QLabel


Tip.pngTip: 


Contents

[edit] Overview

This is a part 1 of the QSystemDeviceInfo API which is a part of the System Information API from Qt Mobility project.

[edit] What is covered in QSystemDeviceInfo API Part 1

  • It is a part of the System Information API.
  • This article covers information about
    • IMEI of the device
    • IMSI information
    • Manufacturer information
    • Model information
    • Product information
    • Battery level
    • Battery status
    • Current profile
    • SIM card status
    • Device status


[edit] Capabilities required


[edit] UI design (.ui file)

QSystemDeviceInfo UI.png


[edit] Project configuration file (.Pro file)

  • Add the Qt Mobility project configuration option in the .Pro file as shown below
CONFIG += mobility
MOBILITY += systeminfo


  • Add required capability in .pro file as shown below:
symbian:TARGET.CAPABILITY = ReadDeviceData

[edit] Implementing QSystemDeviceInfo API

  • QSystemDeviceInfo API is a part of the QtMobility namespace. So declare the QtMobility namespace as shown below:
using namespace QtMobility;

[edit] Header file

#ifndef SYSTEMDEVICEINFO_H
#define SYSTEMDEVICEINFO_H
 
#include <QtGui/QWidget>
#include "ui_SystemDeviceInfo.h"
#include <qsysteminfo.h>
 
using namespace QtMobility;
class SystemDeviceInfo : public QWidget
{
Q_OBJECT
 
public:
SystemDeviceInfo(QWidget *parent = 0);
~SystemDeviceInfo();
 
public slots:
void listDeviceInformation();
void resetAllFields();
private:
Ui::SystemDeviceInfo ui;
QSystemDeviceInfo* deviceInfo;
};
 
#endif // SYSTEMDEVICEINFO_H


[edit] Source file

#include "SystemDeviceInfo.h"
 
SystemDeviceInfo::SystemDeviceInfo(QWidget *parent)
: QWidget(parent), deviceInfo(NULL)
{
ui.setupUi(this);
deviceInfo = new QSystemDeviceInfo;
QObject::connect(ui.listDeviceInfoButton,
SIGNAL(clicked()),
this,
SLOT(listDeviceInformation()));
QObject::connect(ui.resetButton,
SIGNAL(clicked()),
this,
SLOT(resetAllFields()));
}
 
SystemDeviceInfo::~SystemDeviceInfo()
{
delete deviceInfo;
}
 
void SystemDeviceInfo::listDeviceInformation()
{
if(deviceInfo)
{
ui.imeiLabel->setText(deviceInfo->imei());
ui.imsiLabel->setText(deviceInfo->imsi());
ui.manufacturerLabel->setText(deviceInfo->manufacturer());
ui.modelLabel->setText(deviceInfo->model());
ui.productLabel->setText(deviceInfo->productName());
ui.batteryLabel->setText(QString::number(deviceInfo->batteryLevel()));
ui.batteryStatusLabel->setText(QString::number(
(QSystemDeviceInfo::BatteryStatus)deviceInfo->batteryStatus()));
ui.profileLabel->setText(QString::number(
(QSystemDeviceInfo::Profile)deviceInfo->currentProfile()));
ui.simLabel->setText(QString::number(
(QSystemDeviceInfo::SimStatus)deviceInfo->simStatus()));
ui.deviceLabel->setText(QString::number((int)deviceInfo->isDeviceLocked()));
}
}
 
void SystemDeviceInfo::resetAllFields()
{
if(deviceInfo)
{
ui.imeiLabel->clear();
ui.imsiLabel->clear();
ui.manufacturerLabel->clear();
ui.modelLabel->clear();
ui.productLabel->clear();
ui.batteryLabel->clear();
ui.batteryStatusLabel->clear();
ui.profileLabel->clear();
ui.simLabel->clear();
ui.deviceLabel->clear();
}
}


[edit] Output

QSystemDeviceInfo device.jpg


[edit] Useful functions

  • QString imei ();
  • QString imsi ();
  • QString manufacturer ();
  • QString model ();
  • QString productName ();
  • int batteryLevel () const;
  • QSystemDeviceInfo::BatteryStatus batteryStatus ();
  • QSystemDeviceInfo::Profile currentProfile ();
  • bool isDeviceLocked ();
  • QSystemDeviceInfo::SimStatus simStatus ();

[edit] Keywords

[edit] Headers

  • #include <qsysteminfo.h>

[edit] Classes

  • QSystemDeviceInfo
  • QString
  • QStringList
  • QButton
  • QLabel

[edit] Example Application


[edit] Related articles

[edit] Reference links

This page was last modified on 11 October 2012, at 04:23.
130 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.

×