Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends

ContextProvider::ServiceBackend Class Reference

A ServiceBackend is the real worker behind Service. More...

#include <servicebackend.h>

List of all members.

Public Member Functions

 ServiceBackend (QDBusConnection connection)
 Creates new ServiceBackend with the given QDBusConnection.
 ServiceBackend (QDBusConnection connection, const QString &busName)
 Creates new ServiceBackend with the given QDBusConnection and a service name to register.
virtual ~ServiceBackend ()
 Destroys the ServiceBackend.
bool sharedConnection ()
 Returns true iff the ServiceBackend shares its QDBusConnection with the provider program.
bool start ()
 Start the Service again after it has been stopped.
void stop ()
 Stop the service.
void addProperty (const QString &key, PropertyPrivate *property)
 Associate a PropertyPrivate object with this ServiceBackend.
void setAsDefault ()
 Sets the ServiceBackend object as the default one to use when constructing Property objects.
void setValue (const QString &key, const QVariant &val)
 Set the value of key to val.
void ref ()
 Increase the reference count by one. Service calls this.
void unref ()
 Decrease the reference count by one.

Static Public Member Functions

static ServiceBackendinstance (QDBusConnection connection)
 Returns a ServiceBackend instance for a given connection.
static ServiceBackendinstance (QDBusConnection::BusType busType, const QString &busName, bool autoStart)
 Returns a ServiceBackend instance for a given busType and busName.

Static Public Attributes

static ServiceBackenddefaultServiceBackend

Friends

class ::ServiceBackendUnitTest
class Service

Detailed Description

A ServiceBackend is the real worker behind Service.

Multiple Service instances can share same ServiceBackend. The backend is the actual worker that operates on D-Bus (register objects representing Property objects and possibly a bus name).

The Service class actually proxies all methods to the ServiceBackend.


Constructor & Destructor Documentation

ContextProvider::ServiceBackend::ServiceBackend ( QDBusConnection  connection  )  [explicit]

Creates new ServiceBackend with the given QDBusConnection.

The connection will be shared between Service and the provider program, and the ServiceBackend will not register any service names.

ContextProvider::ServiceBackend::ServiceBackend ( QDBusConnection  connection,
const QString &  busName 
)

Creates new ServiceBackend with the given QDBusConnection and a service name to register.

The connection will not be shared between the Service and the provider program.

ContextProvider::ServiceBackend::~ServiceBackend (  )  [virtual]

Destroys the ServiceBackend.

The backend is stopped. If this backend is the defaultServiceBackend, the defaultServiceBackend is set back to NULL.


Member Function Documentation

void ContextProvider::ServiceBackend::addProperty ( const QString &  key,
PropertyPrivate property 
)

Associate a PropertyPrivate object with this ServiceBackend.

The corresponding object will appear on D-Bus.

ServiceBackend * ContextProvider::ServiceBackend::instance ( QDBusConnection  connection  )  [static]

Returns a ServiceBackend instance for a given connection.

Creates the instance if it does not exist yet.

ServiceBackend * ContextProvider::ServiceBackend::instance ( QDBusConnection::BusType  busType,
const QString &  busName,
bool  autoStart 
) [static]

Returns a ServiceBackend instance for a given busType and busName.

Creates the instance if it does not exist yet.

void ContextProvider::ServiceBackend::ref (  ) 

Increase the reference count by one. Service calls this.

void ContextProvider::ServiceBackend::setAsDefault (  ) 

Sets the ServiceBackend object as the default one to use when constructing Property objects.

void ContextProvider::ServiceBackend::setValue ( const QString &  key,
const QVariant &  v 
)

Set the value of key to val.

A property named key must have been registered already, by creating a Property object for it.

bool ContextProvider::ServiceBackend::sharedConnection (  ) 

Returns true iff the ServiceBackend shares its QDBusConnection with the provider program.

bool ContextProvider::ServiceBackend::start (  ) 

Start the Service again after it has been stopped.

In the case of shared connection, the objects will be registered to D-Bus. In the case of non-shared connection, also the service name will be registered on D-Bus. Returns true on success, false otherwise.

void ContextProvider::ServiceBackend::stop (  ) 

Stop the service.

In the case of shared connection, this will cause the related objects to be unregistered, but the bus name will still be on D-Bus. In the case of non-shared connection, this will cause the service to disappear from D-Bus completely.

void ContextProvider::ServiceBackend::unref (  ) 

Decrease the reference count by one.

Service calls this. If the reference count goes to zero, stop the ServiceBackend instance. The instance is not removed from the instance map and not deleted, though.


Friends And Related Function Documentation

friend class ::ServiceBackendUnitTest [friend]
friend class Service [friend]

Member Data Documentation


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