summaryrefslogtreecommitdiff
path: root/app/pebbledinterface.cpp
diff options
context:
space:
mode:
authorTomasz Sterna <tomek@xiaoka.com>2014-07-07 00:50:22 +0200
committerTomasz Sterna <tomek@xiaoka.com>2014-07-09 01:57:32 +0200
commit54a34201f993c3dc5bff0347349e1727febacf97 (patch)
treec6c651b2d361187e2d73c2e06952d8282701c96d /app/pebbledinterface.cpp
parent7283842cbed6a378d430552d327eab4a27775538 (diff)
Implemented org.pebbled service QML interface
Diffstat (limited to 'app/pebbledinterface.cpp')
-rw-r--r--app/pebbledinterface.cpp82
1 files changed, 82 insertions, 0 deletions
diff --git a/app/pebbledinterface.cpp b/app/pebbledinterface.cpp
new file mode 100644
index 0000000..4b56bed
--- /dev/null
+++ b/app/pebbledinterface.cpp
@@ -0,0 +1,82 @@
+#include "pebbledinterface.h"
+
+PebbledInterface::PebbledInterface(QObject *parent) :
+ QObject(parent),
+ systemd()
+{
+ systemd = new QDBusInterface("org.freedesktop.systemd1",
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ QDBusConnection::systemBus(), this);
+
+ pebbled = new QDBusInterface("org.pebbled",
+ "/",
+ "org.pebbled",
+ QDBusConnection::sessionBus(), this);
+
+ QDBusReply<QDBusObjectPath> unit = systemd->call("LoadUnit", "pebbled.service");
+ if (not unit.isValid()) {
+ qWarning() << unit.error().message();
+ } else {
+ systemdUnit = unit.value().path();
+ }
+ qDebug() << "pebbled.service unit:" << systemdUnit;
+}
+
+bool PebbledInterface::enabled() const
+{
+ qDebug() << "enabled()";
+ // FIXME: implement
+ return true;
+}
+
+void PebbledInterface::setEnabled(bool enabled)
+{
+ bool doEmit = (this->enabled() != enabled);
+ qDebug() << "setEnabled" << this->enabled() << enabled;
+ // FIXME: implement
+ if (doEmit) emit enabledChanged();
+}
+
+bool PebbledInterface::active() const
+{
+ qDebug() << "active()";
+ // FIXME: implement
+ return true;
+}
+
+void PebbledInterface::setActive(bool active)
+{
+ bool doEmit = (this->active() != active);
+ qDebug() << "setActive" << this->active() << active;
+ // FIXME: implement
+ if (doEmit) emit activeChanged();
+}
+
+bool PebbledInterface::connected() const
+{
+ qDebug() << "connected()";
+ // FIXME: implement
+ return true;
+}
+
+QVariantMap PebbledInterface::pebble() const
+{
+ qDebug() << "pebble()";
+ // FIXME: implement
+ return QVariantMap();
+}
+
+QString PebbledInterface::name() const
+{
+ qDebug() << "name()";
+ // FIXME: implement
+ return QString("Pebble XXX");
+}
+
+QString PebbledInterface::address() const
+{
+ qDebug() << "address()";
+ // FIXME: implement
+ return QString("");
+}