-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupsservice.cpp
36 lines (30 loc) · 990 Bytes
/
upsservice.cpp
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
#include <QDebug>
#include <QThread>
#include <QMap>
#include <QUuid>
#include "upsservice.h"
#include "upsservice_interface.h"
UpsService::UpsService(const QString& configPath, const QString &upsDeviceName, QObject *parent) :
SigmaService("UpsService", configPath, new UpsServiceSettings, parent)
{
#ifdef __arm__
QDBusConnection connection = QDBusConnection::systemBus();
#else
QDBusConnection connection = QDBusConnection::sessionBus();
#endif
this->m_upsServiceSettings = dynamic_cast<UpsServiceSettings*>(this->serviceSettings());
if(upsDeviceName != nullptr)
{
this->m_upsController = new UpsController(this, upsDeviceName);
}
else
{
this->m_upsController = new UpsController(this);
}
// Forward driver signals
connect(m_upsController, &UpsController::newUpsState, [=](const QString &upsState) { emit newUpsState(upsState); });
}
void UpsService::handleQuitSignal()
{
qDebug() << "Closing Ups service...\n";
}