Herqq
Public Slots | Signals | Public Member Functions | Protected Member Functions

HClientService Class Reference

A client-side class that represents a server-side UPnP service. More...

#include <HClientService>

Inherited by HDefaultClientService.

List of all members.

Public Slots

void notifyListeners ()

Signals

void stateChanged (const Herqq::Upnp::HClientService *source)

Public Member Functions

virtual ~HClientService ()=0
HClientDeviceparentDevice () const
const HServiceInfoinfo () const
QString description () const
const HClientActionsactions () const
const HClientStateVariablesstateVariables () const
bool isEvented () const
QVariant value (const QString &stateVarName, bool *ok=0) const

Protected Member Functions

 HClientService (const HServiceInfo &info, HClientDevice *parentDevice)

Detailed Description

A client-side class that represents a server-side UPnP service.

HClientService is a core component of the HUPnP's client-side Device Model and it models a UPnP service. The UPnP Device Architecture specifies a UPnP service as "Logical functional unit. Smallest units of control. Exposes actions and models the state of a physical device with state variables". In other words, a UPnP service is the entry point for accessing certain type of functionality and state of the containing device.

Using the class

You can retrieve the containing device, the parent device, using parentDevice(). You can retrieve all the actions the service contains by calling actions(), Similarly, you can retrieve all the state variables of the service by calling stateVariables().

The class exposes all the details in the device description concerning a service through info(). From the returned HServiceInfo object you can retrieve the serviceId and serviceType along with various URLs found in the device description, such as the:

However, the above URLs usually provide informational value only, since HUPnP provides a simpler interface for everything those URLs expose:

See also:
Device Model
Remarks:
This class is not thread-safe.

Constructor & Destructor Documentation

HClientService ( const HServiceInfo info,
HClientDevice parentDevice 
) [protected]

Creates a new instance.

Parameters:
infospecifies information of the service.
parentDevicespecifies the device instance that contains this service.

Default constructor for derived classes.

~HClientService ( ) [pure virtual]

Destroys the instance.


Member Function Documentation

HClientDevice * parentDevice ( ) const

Returns the parent HClientDevice that contains this service instance.

Returns:
The parent HClientDevice that contains this service instance.
const HServiceInfo & info ( ) const

Returns information about the service.

Returns:
information about the service. This information is usually read from a device description document.
QString description ( ) const

Returns the full service description.

Returns:
The full service description.
const HClientActions & actions ( ) const

Returns the actions the service supports.

Returns:
The actions the service supports.
Remarks:
The ownership of the returned objects is not transferred. Do not delete the returned objects.
const HClientStateVariables & stateVariables ( ) const

Returns the state variables of the service.

Returns:
The state variables of the service.
Remarks:
The ownership of the returned objects is not transferred. Do not delete the returned objects.
bool isEvented ( ) const

Indicates whether or not the service contains state variables that are evented.

Returns:
true in case the service contains one or more state variables that are evented.
Remarks:
In case the service is not evented, the stateChanged() signal will never be emitted and the notifyListeners() method does nothing.
QVariant value ( const QString &  stateVarName,
bool *  ok = 0 
) const

Returns the value of the specified state variable, if such exists.

This is a convenience method for retrieving a state variable by name and getting its value.

Parameters:
stateVarNamespecifies the name of the state variable.
okspecifies a pointer to a bool, which will contain true if the specified state variable was found and its value was returned. This is optional.
Returns:
The value of the specified state variable, if such exists. If this service does not contain the specified state variable, an invalid QVariant is returned.
Remarks:
The value of the state variable may be represented by an invalid QVariant. Because of this, if you want to be sure that the specified state variable was found and its value was returned, you should use the ok parameter.
void notifyListeners ( ) [slot]

Explicitly forces stateChanged() event to be emitted if the service is evented.

Otherwise this method does nothing.

void stateChanged ( const Herqq::Upnp::HClientService source) [signal]

This signal is emitted when the state of one or more state variables has changed.

Parameters:
sourcespecifies the source of the event.
Remarks:
This signal has thread affinity to the thread where the object resides. Do not connect to this signal from other threads.