diff options
author | Gergely Risko <gergely+context@risko.hu> | 2009-09-04 15:03:21 +0300 |
---|---|---|
committer | Gergely Risko <gergely+context@risko.hu> | 2009-09-04 15:03:21 +0300 |
commit | 4647c4139a2bb688da8a0d6002cf0f382d4aae2b (patch) | |
tree | 1557876f2b629507e0d698334b854ef3ce765d14 /libcontextsubscriber/src/contextkitplugin.h | |
parent | bb344b10d80e94d8c3ba3d33f5789019884162f6 (diff) |
Plugin abstraction.
Diffstat (limited to 'libcontextsubscriber/src/contextkitplugin.h')
-rw-r--r-- | libcontextsubscriber/src/contextkitplugin.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/libcontextsubscriber/src/contextkitplugin.h b/libcontextsubscriber/src/contextkitplugin.h new file mode 100644 index 00000000..6152a778 --- /dev/null +++ b/libcontextsubscriber/src/contextkitplugin.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2008, 2009 Nokia Corporation. + * + * Contact: Marius Vollmer <marius.vollmer@nokia.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef CONTEXTKITPLUGIN_H +#define CONTEXTKITPLUGIN_H + +#include <QString> +#include <QDBusConnection> +#include <QSet> +#include <QVariant> +#include <QMap> +#include "dbusnamelistener.h" +#include "propertyprovider.h" +namespace ContextSubscriber { + +extern "C" { + IProviderPlugin* contextKitPluginFactory(const QString& constructionString); +} + +class ContextKitPlugin : public IProviderPlugin +{ + Q_OBJECT + +public: + ContextKitPlugin(const QDBusConnection bus, const QString& busName); + void subscribe(QSet<QString> keys); + void unsubscribe(QSet<QString> keys); + +signals: + void ready(); + void failed(QString error); + void subscribeFinished(QString key); + void subscribeFailed(QString failedKey, QString error); + void valueChanged(QString key, QVariant value); + +private slots: + void onDBusValuesChanged(QMap<QString, QVariant> values); + void onDBusGetSubscriberFinished(QString objectPath); + void onDBusSubscribeFinished(QList<QString> keys); + void onDBusSubscribeFailed(QList<QString> keys, QString error); + void onProviderAppeared(); + void onProviderDisappeared(); + +private: + DBusNameListener *providerListener; ///< Listens to provider's (dis)appearance over DBus + SubscriberInterface *subscriberInterface; ///< The DBus interface for the Subscriber object + ManagerInterface *managerInterface; ///< The DBus interface for the Manager object + + QDBusConnection *connection; ///< The connection to DBus + QString busName; ///< The bus name of the DBus provider connected to +}; + + +} + +#endif |