diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-06-16 16:30:18 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-06-19 11:19:42 +0200 |
commit | 21c3f2360967138d9dfc13a3985fb92ca1c44027 (patch) | |
tree | f5f3e326ce1d768e1dacdcc0fc0407f6fdd41523 /services/qt4/dbus-info-service/dbus-info-service.cpp | |
parent | 161a7ba4a460f06ee15969eaf9352f25e9aa5663 (diff) | |
download | json-dbus-bridge-examples-21c3f2360967138d9dfc13a3985fb92ca1c44027.tar.gz json-dbus-bridge-examples-21c3f2360967138d9dfc13a3985fb92ca1c44027.tar.xz |
[dbus-info-service] add qt4 dbus service
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'services/qt4/dbus-info-service/dbus-info-service.cpp')
-rw-r--r-- | services/qt4/dbus-info-service/dbus-info-service.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/services/qt4/dbus-info-service/dbus-info-service.cpp b/services/qt4/dbus-info-service/dbus-info-service.cpp new file mode 100644 index 0000000..ef93a26 --- /dev/null +++ b/services/qt4/dbus-info-service/dbus-info-service.cpp @@ -0,0 +1,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; +} + |