Herqq

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

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

# HClientService Class Reference
Device Model

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
HClientDevice * | parentDevice () const
const HServiceInfo & | info () const
QString | description () const
const HClientActions & | actions () const
const HClientStateVariables & | stateVariables () 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:

- scpdUrl, which returns the URL for fetching the service description,
- controlUrl, which returns the URL to be used in action invocation and
- eventSubUrl, which returns the URL used in event (un)subscriptions.

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

- You can retrieve the service description of a service using description().
- Action invocation is abstracted into the HClientAction class.
- You can receive all the event notifications from a UPnP service by connecting to the stateChanged() signal. You do not need to worry about UPnP eventing at all, since HUPnP handles that for you.

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:

  info | specifies information of the service.
  parentDevice | specifies 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:

  stateVarName | specifies the name of the state variable.
  ok | specifies 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:

  source | specifies 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.