summaryrefslogtreecommitdiff
path: root/app/pebbledinterface.cpp
blob: 4b56bed045d7952a923e1a4a56b36672af5693f0 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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("");
}