summaryrefslogtreecommitdiffstats
path: root/services/qt4/dbus-info-service/dbus-info-service.cpp
blob: ef93a260e963b2a4400398c719960a141d1cf3eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

#include <QtCore/QCoreApplication>
#include <QtDBus/QtDBus>

#include "service.h"

int main(int argc, char *argv[])
{
	QCoreApplication app(argc, argv);

	if (!QDBusConnection::sessionBus().isConnected()) {
		fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
				"To start it, run:\n"
				"\teval `dbus-launch --auto-syntax`\n");
		return 1;
	}

	if (!QDBusConnection::sessionBus().registerService("com.pengutronix.jdb.systeminfo")) {
		fprintf(stderr, "%s\n",
				qPrintable(QDBusConnection::sessionBus().lastError().message()));
		exit(1);
	}

	QObject o;
	SystemInfo systemInfo(&o);
	if (!QDBusConnection::sessionBus().registerObject("/", &o)) {
		fprintf(stderr, "%s\n",
				qPrintable(QDBusConnection::sessionBus().lastError().message()));
		exit(1);
	}
	app.exec();

	return 0;
}