Update nymea dbus interface
This commit is contained in:
parent
f4b6003664
commit
a81497e760
2
debian/control
vendored
2
debian/control
vendored
@ -7,6 +7,8 @@ Build-Depends: debhelper (>= 9.0.0),
|
||||
dh-systemd,
|
||||
qt5-default,
|
||||
qtbase5-dev,
|
||||
qtbase5-dev-tools,
|
||||
libqt5bluetooth5,
|
||||
qtconnectivity5-dev
|
||||
Standards-Version: 3.9.7
|
||||
|
||||
|
||||
@ -31,14 +31,14 @@ bool NymeadService::available() const
|
||||
|
||||
void NymeadService::enableBluetooth(const bool &enable)
|
||||
{
|
||||
if (!m_nymeadHardwareInterface) {
|
||||
if (!m_nymeadHardwareBluetoothInterface) {
|
||||
qCWarning(dcNymeaService()) << "Could not enable/disable bluetooth hardware resource. D-Bus interface not available.";
|
||||
return;
|
||||
}
|
||||
|
||||
qCDebug(dcNymeaService()) << "Request nymea to" << (enable ? "enable" : "disable") << "bluetooth resources";
|
||||
|
||||
QDBusMessage query = m_nymeadHardwareInterface->call("EnableBluetooth", enable);
|
||||
QDBusMessage query = m_nymeadHardwareBluetoothInterface->call("EnableBluetooth", enable);
|
||||
if(query.type() != QDBusMessage::ReplyMessage) {
|
||||
qCWarning(dcNymeaService()) << "Could not enable/disable bluetooth on dbus:" << query.errorName() << query.errorMessage();
|
||||
return;
|
||||
@ -91,6 +91,14 @@ bool NymeadService::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_nymeadHardwareBluetoothInterface = new QDBusInterface("io.guh.nymead", "/io/guh/nymead/HardwareManager/BluetoothLEManager", "io.guh.nymead", QDBusConnection::systemBus(), this);
|
||||
if (!m_nymeadHardwareBluetoothInterface->isValid()) {
|
||||
qCWarning(dcNymeaService()) << "Invalid D-Bus HardwareManager BluetoothLE interface.";
|
||||
m_nymeadHardwareBluetoothInterface->deleteLater();
|
||||
m_nymeadHardwareBluetoothInterface = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
setAvailable(true);
|
||||
return true;
|
||||
}
|
||||
@ -117,5 +125,10 @@ void NymeadService::serviceUnregistered(const QString &serviceName)
|
||||
m_nymeadHardwareInterface = nullptr;
|
||||
}
|
||||
|
||||
if (m_nymeadHardwareBluetoothInterface) {
|
||||
m_nymeadHardwareBluetoothInterface->deleteLater();
|
||||
m_nymeadHardwareBluetoothInterface = nullptr;
|
||||
}
|
||||
|
||||
setAvailable(false);
|
||||
}
|
||||
|
||||
@ -22,7 +22,9 @@ public:
|
||||
private:
|
||||
QDBusServiceWatcher *m_serviceWatcher = nullptr;
|
||||
PushButtonAgent *m_pushButtonAgent = nullptr;
|
||||
|
||||
QDBusInterface *m_nymeadHardwareInterface = nullptr;
|
||||
QDBusInterface *m_nymeadHardwareBluetoothInterface = nullptr;
|
||||
|
||||
bool m_pushbuttonEnabled = false;
|
||||
bool m_available = false;
|
||||
|
||||
Reference in New Issue
Block a user