hyperion.ng/include/utils/SysInfo.h
redPanther 0aa467cceb populate zeroconf/avahi/bonjour records via json api (#419)
* start of integrating a bonkour service browser

* some experiments

* blub

* bonjour browser via jsonrpc ...

* fix indention

* - make leddevice as component
- extend sysinfo with domain
- add more data for  bonjour browser (e.g. split domain and hostname)

* code cleanup

* add translation

* use component names instead of ids

* fix compile
2017-03-21 17:55:46 +01:00

57 lines
1.2 KiB
C++

#pragma once
#include <QObject>
#include <QString>
#include <QByteArray>
class SysInfo : public QObject
{
public:
struct HyperionSysInfo
{
QString kernelType;
QString kernelVersion;
QString architecture;
QString wordSize;
QString productType;
QString productVersion;
QString prettyName;
QString hostName;
QString domainName;
};
~SysInfo();
static HyperionSysInfo get();
private:
SysInfo();
static SysInfo* _instance;
HyperionSysInfo _sysinfo;
struct QUnixOSVersion
{
QString productType;
QString productVersion;
QString prettyName;
};
QString machineHostName();
QString currentCpuArchitecture();
QString kernelType();
QString kernelVersion();
bool findUnixOsVersion(QUnixOSVersion &v);
QByteArray getEtcFileFirstLine(const char *fileName);
bool readEtcRedHatRelease(QUnixOSVersion &v);
bool readEtcDebianVersion(QUnixOSVersion &v);
bool readEtcOsRelease(SysInfo::QUnixOSVersion &v);
bool readEtcFile(SysInfo::QUnixOSVersion &v, const char *filename, const QByteArray &idKey, const QByteArray &versionKey, const QByteArray &prettyNameKey);
QByteArray getEtcFileContent(const char *filename);
QString unquote(const char *begin, const char *end);
bool readEtcLsbRelease(SysInfo::QUnixOSVersion &v);
};