ContextSubscriber::ContextKitPlugin Class Reference

Implementation of the ContextKit D-Bus protocol. More...

#include <contextkitplugin.h>

Inheritance diagram for ContextSubscriber::ContextKitPlugin:

ContextSubscriber::IProviderPlugin

List of all members.

Signals

void ready ()
 Emitted when the GetSubscriber call returns successfully.
void failed (QString error)
 Emitted when the GetSubscriber call fails or provider not on D-Bus at all.
void subscribeFinished (QString key)
 Emitted when Subscribe call succeeds on D-Bus.
void subscribeFailed (QString failedKey, QString error)
 Emitted when Subscribe call fails on D-Bus.
void valueChanged (QString key, QVariant value)
 Emitted when ValueChanged signal comes on D-Bus.

Public Member Functions

 ContextKitPlugin (const QDBusConnection bus, const QString &busName)
 Creates subscriber and manager interface, tries to get a subscriber instance from the manager and starts listening for provider appearing and disappearing on D-Bus.
void subscribe (QSet< QString > keys)
 Forwards the subscribe request to the wire.
void unsubscribe (QSet< QString > keys)
 Forwards the unsubscribe request to the wire.
void setDefaultNewProtocol (bool s)
void blockUntilReady ()
void blockUntilSubscribed (const QString &key)

Private Slots

void onNewValueChanged (QList< QVariant > value, quint64 timestamp, QDBusMessage message)
void onDBusValuesChanged (QMap< QString, QVariant > values)
 Forwards value changes from the wire to the upper layer (Provider).
void onDBusGetSubscriberFinished (QDBusObjectPath objectPath)
 Starts using the fresh subscriber interface when it is returned by the manager in response to the GetSubscriber call.
void onDBusGetSubscriberFailed (QDBusError err)
void onDBusSubscribeFinished (QList< QString > keys)
 Signals the Provider that the Subscribe call (old protocol) is finished.
void onDBusSubscribeFailed (QList< QString > keys, QString error)
 Signals the Provider that the Subscribe call (old protocol) has failed.
void onProviderAppeared ()
 Gets a new subscriber interface from manager when the provider appears.
void onProviderDisappeared ()
 Delete our subscriber interface when the provider goes away.
void newSubscribe (const QString &key)
void removePendingWatcher (const QString &key)

Private Member Functions

void reset ()
void useNewProtocol ()
QMap< QString, QVariant > & mergeNullsWithMap (QMap< QString, QVariant > &map, QStringList nulls) const

Static Private Member Functions

static QString keyToPath (QString key)
 Converts a key name to a protocol level object path.

Private Attributes

DBusNameListenerproviderListener
 Listens to provider's (dis)appearance over DBus.
SubscriberInterfacesubscriberInterface
 The D-Bus interface for the Subscriber object.
QDBusAbstractInterface * managerInterface
 The D-Bus interface for the Manager object.
QDBusConnection * connection
 The connection to DBus.
QString busName
 The D-Bus service name of the ContextKit provider connected to.
bool newProtocol
 The current provider on D-Bus speaks the new protocol only.
bool defaultNewProtocol
 Let's only try the new protocol to talk with the provider.
QHash< QString, QString > objectPathToKey
QHash< QString,
PendingSubscribeWatcher * > 
pendingWatchers
QSet< QString > pendingKeys


Detailed Description

Implementation of the ContextKit D-Bus protocol.

Constructor & Destructor Documentation

ContextSubscriber::ContextKitPlugin::ContextKitPlugin ( const QDBusConnection  bus,
const QString &  busName 
)

Creates subscriber and manager interface, tries to get a subscriber instance from the manager and starts listening for provider appearing and disappearing on D-Bus.


Member Function Documentation

void ContextSubscriber::ContextKitPlugin::subscribe ( QSet< QString >  keys  )  [virtual]

Forwards the subscribe request to the wire.

Implements ContextSubscriber::IProviderPlugin.

void ContextSubscriber::ContextKitPlugin::unsubscribe ( QSet< QString >  keys  )  [virtual]

Forwards the unsubscribe request to the wire.

Implements ContextSubscriber::IProviderPlugin.

void ContextSubscriber::ContextKitPlugin::setDefaultNewProtocol ( bool  s  ) 

void ContextSubscriber::ContextKitPlugin::blockUntilReady (  )  [virtual]

void ContextSubscriber::ContextKitPlugin::blockUntilSubscribed ( const QString &  key  )  [virtual]

void ContextSubscriber::ContextKitPlugin::ready (  )  [signal]

Emitted when the GetSubscriber call returns successfully.

Reimplemented from ContextSubscriber::IProviderPlugin.

void ContextSubscriber::ContextKitPlugin::failed ( QString  error  )  [signal]

Emitted when the GetSubscriber call fails or provider not on D-Bus at all.

Reimplemented from ContextSubscriber::IProviderPlugin.

void ContextSubscriber::ContextKitPlugin::subscribeFinished ( QString  key  )  [signal]

Emitted when Subscribe call succeeds on D-Bus.

Reimplemented from ContextSubscriber::IProviderPlugin.

void ContextSubscriber::ContextKitPlugin::subscribeFailed ( QString  failedKey,
QString  error 
) [signal]

Emitted when Subscribe call fails on D-Bus.

Reimplemented from ContextSubscriber::IProviderPlugin.

void ContextSubscriber::ContextKitPlugin::valueChanged ( QString  key,
QVariant  value 
) [signal]

Emitted when ValueChanged signal comes on D-Bus.

Reimplemented from ContextSubscriber::IProviderPlugin.

void ContextSubscriber::ContextKitPlugin::onNewValueChanged ( QList< QVariant >  value,
quint64  timestamp,
QDBusMessage  message 
) [private, slot]

void ContextSubscriber::ContextKitPlugin::onDBusValuesChanged ( QMap< QString, QVariant >  values  )  [private, slot]

Forwards value changes from the wire to the upper layer (Provider).

void ContextSubscriber::ContextKitPlugin::onDBusGetSubscriberFinished ( QDBusObjectPath  objectPath  )  [private, slot]

Starts using the fresh subscriber interface when it is returned by the manager in response to the GetSubscriber call.

void ContextSubscriber::ContextKitPlugin::onDBusGetSubscriberFailed ( QDBusError  err  )  [private, slot]

void ContextSubscriber::ContextKitPlugin::onDBusSubscribeFinished ( QList< QString >  keys  )  [private, slot]

Signals the Provider that the Subscribe call (old protocol) is finished.

void ContextSubscriber::ContextKitPlugin::onDBusSubscribeFailed ( QList< QString >  keys,
QString  error 
) [private, slot]

Signals the Provider that the Subscribe call (old protocol) has failed.

void ContextSubscriber::ContextKitPlugin::onProviderAppeared (  )  [private, slot]

Gets a new subscriber interface from manager when the provider appears.

void ContextSubscriber::ContextKitPlugin::onProviderDisappeared (  )  [private, slot]

Delete our subscriber interface when the provider goes away.

void ContextSubscriber::ContextKitPlugin::newSubscribe ( const QString &  key  )  [private, slot]

void ContextSubscriber::ContextKitPlugin::removePendingWatcher ( const QString &  key  )  [private, slot]

QString ContextSubscriber::ContextKitPlugin::keyToPath ( QString  key  )  [static, private]

Converts a key name to a protocol level object path.

There is a distinction, because core properties have the form /org/maemo/contextkit/Screen/TopEdge on D-Bus level, but on higher levels they are Screen.TopEdge. Non-core properties should simply have a name like /com/nokia/modem/Specific/Feature, so they can be used as object paths without further conversions.

void ContextSubscriber::ContextKitPlugin::reset (  )  [private]

void ContextSubscriber::ContextKitPlugin::useNewProtocol (  )  [private]

QMap<QString, QVariant>& ContextSubscriber::ContextKitPlugin::mergeNullsWithMap ( QMap< QString, QVariant > &  map,
QStringList  nulls 
) const [private]


Member Data Documentation

Listens to provider's (dis)appearance over DBus.

The D-Bus interface for the Subscriber object.

QDBusAbstractInterface* ContextSubscriber::ContextKitPlugin::managerInterface [private]

The D-Bus interface for the Manager object.

The connection to DBus.

The D-Bus service name of the ContextKit provider connected to.

The current provider on D-Bus speaks the new protocol only.

Let's only try the new protocol to talk with the provider.

QHash<QString, QString> ContextSubscriber::ContextKitPlugin::objectPathToKey [private]


The documentation for this class was generated from the following files:

Generated on Thu Feb 21 18:31:19 2013 for libcontextsubscriber by  doxygen 1.5.6