Public Member Functions | Protected Member Functions

HClientDevice Class Reference
[Device Model]

This is a client-side class that represents a server-side UPnP device. More...

#include <HClientDevice>

Inherited by HDefaultClientDevice.

List of all members.

Public Member Functions

virtual ~HClientDevice ()=0
HClientDeviceparentDevice () const
HClientDevicerootDevice () const
HClientServiceserviceById (const HServiceId &serviceId) const
HClientServices services () const
HClientServices servicesByType (const HResourceType &serviceType, HResourceType::VersionMatch versionMatch=HResourceType::Inclusive) const
HClientDevices embeddedDevices () const
HClientDevices embeddedDevicesByType (const HResourceType &deviceType, HResourceType::VersionMatch versionMatch=HResourceType::Inclusive) const
const HDeviceInfoinfo () const
QString description () const
QList< QUrl > locations (LocationUrlType urlType=AbsoluteUrl) const

Protected Member Functions

 HClientDevice (const HDeviceInfo &info, HClientDevice *parentDev=0)

Detailed Description

HClientDevice is a core component of the HUPnP's client-side Device Model and it models a UPnP device, both root and embedded. As detailed in the UPnP Device Architecture specification, a UPnP device is essentially a container for services and possibly for other (embedded) UPnP devices.

Using the class

The most common uses of HClientDevice involve reading the various device information elements originally set in the device description file and enumerating the exposed services. By calling info() you get an HDeviceInfo object from which you can read all the informational elements found in the device description. Calling services() gives you a list of HClientService instances the device exposes. Note that it is the services that contain the functionality and runtime status of the device.

Some devices also contain embedded devices, which you can get by calling embeddedDevices().

You can retrieve the device's description file by calling description() or you can manually read it from any of the locations returned by locations(). If the device is an embedded device, it always has a parent device, which you can get by calling parentDevice().

Remarks:
This class is not thread-safe.

Constructor & Destructor Documentation

HClientDevice ( const HDeviceInfo info,
HClientDevice parentDev = 0 
) [protected]

Creates a new instance.

Parameters:
infospecifies information of the device. This is often read from a device description document.
parentDevspecifies the parent device of this device, if any.
~HClientDevice (  ) [pure virtual]

Destroys the instance.


Member Function Documentation

HClientDevice * parentDevice (  ) const

Returns the parent device of this device, if any.

Returns:
the parent device of this device, if any, or a null pointer in case the device is a root device.
Remarks:
The pointer is guaranteed to be valid throughout the lifetime of this object.
HClientDevice * rootDevice (  ) const

Returns the root device of the device tree to which this device belongs.

Returns:
the root device of the device tree to which this device belongs.
Remarks:
This device could be the root device of the device tree in question, in which case a pointer to this instance is returned.
HClientService * serviceById ( const HServiceId serviceId ) const

Returns the service that has the specified service ID.

Parameters:
serviceIdspecifies the service to be returned.
Returns:
the service that has the specified service ID or a null pointer in case there is no service with the specified ID.
Remarks:
The pointer is guaranteed to be valid throughout the lifetime of this object.
HClientServices services (  ) const

Returns the services this device exports.

Returns:
the services this device exports. The collection is empty if the device has no services.
Remarks:
The pointers are guaranteed to be valid throughout the lifetime of this object.
HClientServices servicesByType ( const HResourceType serviceType,
HResourceType::VersionMatch  versionMatch = HResourceType::Inclusive 
) const

Returns the services of a specific UPnP service type.

Parameters:
serviceTypespecifies the UPnP service type of interest. Only services matching the type are returned.
versionMatchspecifies how the version information in argument serviceType should be used. The default is inclusive match, which essentially means that any service with a service type version that is less than or equal to the version specified in argument serviceType is successfully matched.
Returns:
the services of the specified type.
Remarks:
the pointers are guaranteed to be valid throughout the lifetime of this object.
HClientDevices embeddedDevices (  ) const

Returns the embedded devices of this device.

Returns:
the embedded devices of this device. The collection is empty if the device has no embedded devices.
Remarks:
the pointers are guaranteed to be valid throughout the lifetime of this object.
HClientDevices embeddedDevicesByType ( const HResourceType deviceType,
HResourceType::VersionMatch  versionMatch = HResourceType::Inclusive 
) const

Returns the embedded devices of a specific UPnP device type.

Parameters:
deviceTypespecifies the UPnP device type of interest. Only devices matching the type are returned.
versionMatchspecifies how the version information in argument deviceType should be used. The default is inclusive match, which essentially means that any device with a device type version that is less than or equal to the version specified in argument deviceType is successfully matched.
Returns:
the embedded devices of the specified type.
Remarks:
the pointers are guaranteed to be valid throughout the lifetime of this object.
const HDeviceInfo & info (  ) const

Returns information about the device.

Returns:
information about the device. This is often read from the device description.
QString description (  ) const

Returns the UPnP device description of this device.

Returns:
the UPnP device description that is associated to this device.
Remarks:
an embedded device returns the same device description as its root device.
QList< QUrl > locations ( LocationUrlType  urlType = AbsoluteUrl ) const

Returns a list of locations where the device is currently available.

Parameters:
urlTypespecifies whether the returned location URLs are absolute URLs for retrieving the device description. By default absolute URLs are returned and from these URLs the device description should be retrievable.
Returns:
a list of locations where the device is currently available.