19 #include "HfdLights.h" 20 #include <QtCore/QDebug> 21 #include <QDBusArgument> 22 #include <QDBusConnection> 25 #define HFD_SERVICE_NAME "com.lomiri.hfd" 26 #define HFD_SERVICE_PATH "/com/lomiri/hfd" 27 #define HFD_SERVICE_INTERFACE "com.lomiri.hfd.Leds" 29 HfdLights::HfdLights(QObject* parent)
32 m_hfdInterface =
new QDBusInterface(
33 QStringLiteral(HFD_SERVICE_NAME),
34 QStringLiteral(HFD_SERVICE_PATH),
35 QStringLiteral(HFD_SERVICE_INTERFACE),
36 QDBusConnection::systemBus(),
41 bool HfdLights::init()
47 void HfdLights::turnOn()
49 m_hfdInterface->call(QStringLiteral(
"setState"), 0);
50 m_hfdInterface->call(QStringLiteral(
"setColor"), (quint32)m_color.rgba());
51 m_hfdInterface->call(QStringLiteral(
"setOnMs"), m_onMs);
52 m_hfdInterface->call(QStringLiteral(
"setOffMs"), m_offMs);
53 m_hfdInterface->call(QStringLiteral(
"setState"), 1);
56 void HfdLights::turnOff()
58 m_hfdInterface->call(QStringLiteral(
"setState"), 0);
59 m_hfdInterface->call(QStringLiteral(
"setColor"), (quint32)0);
60 m_hfdInterface->call(QStringLiteral(
"setOnMs"), 0);
61 m_hfdInterface->call(QStringLiteral(
"setOffMs"), 0);