Commit dfd68243 authored by Aard's avatar Aard

[sysinfo] Drop included systeminfo, and move Qt5 version

parent 8166af9f
......@@ -13,10 +13,7 @@ public_headers = \
HEADERS = \
$${public_headers} \
sandbox_p.h \
ssucoreconfig.h \
mobility-booty/qofonoservice_linux_p.h \
mobility-booty/qsysteminfo_linux_common_p.h \
mobility-booty/qsysteminfo_dbus_p.h
ssucoreconfig.h
SOURCES = \
sandbox.cpp \
......@@ -26,15 +23,11 @@ SOURCES = \
ssulog.cpp \
ssuvariables.cpp \
ssurepomanager.cpp \
ssusettings.cpp \
mobility-booty/qofonoservice_linux.cpp \
mobility-booty/qsysteminfo_linux_common.cpp \
ssusettings.cpp
#CONFIG += mobility link_pkgconfig
CONFIG += link_pkgconfig
QT += network xml dbus
#MOBILITY += systeminfo
PKGCONFIG += libsystemd-journal boardname
PKGCONFIG += libsystemd-journal boardname Qt5SystemInfo
install_headers.files = $${public_headers}
......
This directory contains the handful of bits used from QtSystemInfo, to avoid
pulling in the whole X11 stack.
This diff is collapsed.
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QOFONOSERVICE_H
#define QOFONOSERVICE_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
//#include "qmobilityglobal.h"
#include <QtDBus/qdbusabstractinterface.h>
#include <QtDBus/qdbuscontext.h>
struct QOfonoProperties
{
QDBusObjectPath path;
QVariantMap properties;
};
Q_DECLARE_METATYPE(QOfonoProperties)
typedef QList<QOfonoProperties> QOfonoPropertyMap;
Q_DECLARE_METATYPE(QOfonoPropertyMap)
//QTM_BEGIN_NAMESPACE
class QOfonoManagerInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
QOfonoManagerInterface( QObject *parent = 0);
~QOfonoManagerInterface();
QDBusObjectPath currentModem();
QList<QDBusObjectPath> getModems();
Q_SIGNALS:
void propertyChangedContext(const QString &path, const QString &item, const QDBusVariant &value);
protected:
void connectNotify(const char *signal);
void disconnectNotify(const char *signal);
private:
QVariant getProperty(const QString &property);
};
class QOfonoDBusHelper: public QObject, protected QDBusContext
{
Q_OBJECT
public:
QOfonoDBusHelper(QObject *parent = 0);
~QOfonoDBusHelper();
public Q_SLOTS:
void propertyChanged(const QString &item, const QDBusVariant &value);
Q_SIGNALS:
void propertyChangedContext(const QString &path, const QString &item, const QDBusVariant &value);
};
class QOfonoModemInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
QOfonoModemInterface(const QString &dbusModemPathName, QObject *parent = 0);
~QOfonoModemInterface();
bool isPowered();
QString getSerial();
private:
QVariant getProperty(const QString &property);
};
class QOfonoNetworkRegistrationInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
QOfonoNetworkRegistrationInterface(const QString &dbusModemPathName, QObject *parent = 0);
~QOfonoNetworkRegistrationInterface();
int getSignalStrength();
QList<QDBusObjectPath> getOperators();
QString getOperatorName();
QString getStatus();
QString getTechnology();
quint16 getLac();
quint32 getCellId();
protected:
void connectNotify(const char *signal);
void disconnectNotify(const char *signal);
private:
QVariant getProperty(const QString &property);
Q_SIGNALS:
void propertyChangedContext(const QString &path, const QString &item, const QDBusVariant &value);
};
class QOfonoNetworkOperatorInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
QOfonoNetworkOperatorInterface(const QString &dbusPathName, QObject *parent = 0);
~QOfonoNetworkOperatorInterface();
QString getMcc();
QString getMnc();
QString getStatus();
QStringList getTechnologies();
private:
QVariant getProperty(const QString &property);
};
class QOfonoSimInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
QOfonoSimInterface(const QString &dbusModemPathName, QObject *parent = 0);
~QOfonoSimInterface();
bool isPresent();
QString getHomeMcc();
QString getHomeMnc();
QString getImsi();
QString pinRequired();
private:
QVariant getProperty(const QString &property);
};
class QOfonoConnectionManagerInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
QOfonoConnectionManagerInterface(const QString &dbusPathName, QObject *parent = 0);
~QOfonoConnectionManagerInterface();
QString bearer();
private:
QVariant getProperty(const QString &);
};
//QTM_END_NAMESPACE
#endif //QOFONOSERVICE_H
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSYSTEMINFO_DBUS_P_H
#define QSYSTEMINFO_DBUS_P_H
static bool ofonoAvailable()
{
if (QDBusConnection::systemBus().isConnected()) {
QDBusReply<bool> reply = QDBusConnection::systemBus().interface()->isServiceRegistered("org.ofono");
if (reply.isValid() && reply.value())
return reply.value();
}
return false;
}
#endif // QSYSTEMINFO_DBUS_P_H
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qsysteminfo_linux_common_p.h"
#include <QTimer>
#include <QFile>
#include <QDir>
#include <QCryptographicHash>
#include <QVariantMap>
#include <QTextStream>
#include <QDebug>
#include <QDBusReply>
#include <QDBusConnectionInterface>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <unistd.h>
#include "qofonoservice_linux_p.h"
#include "qsysteminfo_dbus_p.h"
//QTM_BEGIN_NAMESPACE
QSystemDeviceInfoLinuxCommonPrivate::QSystemDeviceInfoLinuxCommonPrivate(QObject *parent)
: QObject(parent)
{
}
QSystemDeviceInfoLinuxCommonPrivate::~QSystemDeviceInfoLinuxCommonPrivate()
{
}
QString QSystemDeviceInfoLinuxCommonPrivate::imei()
{
#if !defined(QT_NO_CONNMAN)
if (ofonoAvailable()) {
QOfonoManagerInterface ofonoManager;
QString modem = ofonoManager.currentModem().path();
if (!modem.isEmpty()) {
QOfonoModemInterface modemIface(modem,this);
QString imei = modemIface.getSerial();
if (!imei.isEmpty())
return imei;
}
}
#endif // QT_NO_CONNMAN
return QString();
}
QString QSystemDeviceInfoLinuxCommonPrivate::manufacturer()
{
QFile vendorId("/sys/devices/virtual/dmi/id/board_vendor");
if (vendorId.open(QIODevice::ReadOnly)) {
QTextStream cpuinfo(&vendorId);
return cpuinfo.readLine().trimmed();
} else {
QFile file("/proc/cpuinfo");
if (!file.open(QIODevice::ReadOnly)) {
qDebug() << "Could not open /proc/cpuinfo";
} else {
QTextStream cpuinfo(&file);
QString line = cpuinfo.readLine();
while (!line.isNull()) {
line = cpuinfo.readLine();
if (line.contains("vendor_id"))
return line.split(": ").at(1).trimmed();
}
}
}
return QString();
}
QByteArray QSystemDeviceInfoLinuxCommonPrivate::uniqueDeviceID()
{
QCryptographicHash hash(QCryptographicHash::Sha1);
// Return the DBUS machine ID
QByteArray dbusId = QDBusConnection::localMachineId();
hash.addData(dbusId);
return hash.result().toHex();
}
//#include "moc_qsysteminfo_linux_common_p.cpp"
//QTM_END_NAMESPACE
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSYSTEMINFO_LINUX_COMMON_P_H
#define QSYSTEMINFO_LINUX_COMMON_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
/*
#include "qsysteminfo.h"
#include "qsystemdeviceinfo.h"
*/
#include "qofonoservice_linux_p.h"
//QTM_BEGIN_NAMESPACE
class QSystemDeviceInfoLinuxCommonPrivate : public QObject
{
Q_OBJECT
public:
QSystemDeviceInfoLinuxCommonPrivate(QObject *parent = 0);
virtual ~QSystemDeviceInfoLinuxCommonPrivate();
QByteArray uniqueDeviceID(); //1.2
QString imei();
QString manufacturer();
};
//QTM_END_NAMESPACE
#endif // QSYSTEMINFO_LINUX_COMMON_P_H
......@@ -22,10 +22,7 @@ extern "C" {
#include "../constants.h"
#include "mobility-booty/qsysteminfo_linux_common_p.h"
//#include <QSystemDeviceInfo>
//QTM_USE_NAMESPACE
#include <QDeviceInfo>
SsuDeviceInfo::SsuDeviceInfo(QString model): QObject(){
......@@ -285,10 +282,10 @@ QString SsuDeviceInfo::deviceModel(){
QString SsuDeviceInfo::deviceUid(){
QString IMEI;
//QSystemDeviceInfo devInfo;
QSystemDeviceInfoLinuxCommonPrivate devInfo;
QDeviceInfo devInfo;
IMEI = devInfo.imei();
/// @todo properly check number of imeis, ...
IMEI = devInfo.imei(0);
// this might not be completely unique (or might change on reflash), but works for now
if (IMEI == ""){
......
......@@ -12,6 +12,7 @@ BuildRequires: pkgconfig(Qt5DBus)
BuildRequires: pkgconfig(Qt5Network)
BuildRequires: pkgconfig(Qt5Xml)
BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(Qt5SystemInfo)
BuildRequires: pkgconfig(libzypp)
BuildRequires: pkgconfig(libsystemd-journal)
BuildRequires: oneshot
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment