2
* Copyright (C) 2011-2015 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License version 3, as published by
6
* the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
#ifndef ABSTRACTDBUSSERVICEMONITOR_H
18
#define ABSTRACTDBUSSERVICEMONITOR_H
22
#include <QDBusConnection>
24
class QDBusAbstractInterface;
25
class QDBusServiceWatcher;
27
class Q_DECL_EXPORT AbstractDBusServiceMonitor : public QObject
30
Q_PROPERTY(bool serviceAvailable READ serviceAvailable NOTIFY serviceAvailableChanged)
33
explicit AbstractDBusServiceMonitor(const QString &service, const QString &path, const QString &interface,
34
const QDBusConnection &connection = QDBusConnection::sessionBus(),
36
~AbstractDBusServiceMonitor();
38
QDBusAbstractInterface* dbusInterface() const;
40
bool serviceAvailable() const;
43
void serviceAvailableChanged(bool available);
46
void createInterface(const QString &service);
47
void destroyInterface(const QString &service);
50
const QString m_service;
52
const QString m_interface;
53
const QDBusConnection m_busConnection;
54
QDBusServiceWatcher* m_watcher;
55
QDBusAbstractInterface* m_dbusInterface;
58
#endif // ABSTRACTDBUSSERVICEMONITOR_H