Public Member Functions | Private Member Functions

HDeviceProxy Class Reference
[Device Model]

A class that is used at client-side to represent a UPnP device. More...

#include <HDeviceProxy>

Inheritance diagram for HDeviceProxy:
HDevice

List of all members.

Public Member Functions

 HDeviceProxy ()
virtual ~HDeviceProxy ()
HDeviceProxyparentProxyDevice () const
HDeviceProxyrootProxyDevice () const
HServiceProxyserviceProxyById (const HServiceId &serviceId) const
HDeviceProxies embeddedProxyDevices () const
HServiceProxies serviceProxies () const
HServiceProxies serviceProxiesByType (const HResourceType &serviceType, HResourceType::VersionMatch versionMatch=HResourceType::InclusiveVersionMatch) const

Private Member Functions

virtual HServicesSetupDatacreateServices ()

Detailed Description

A proxy device is a pure client-side concept utilized by HControlPoint. This class, or a class derived from this is instantiated by HControlPoint for each discovered UPnP device that is added into the control of an HControlPoint.

As an HDevice, the HDeviceProxy relies fully on the HUPnP Device Model and thus it is used similarly to server-side HDevice classes. Unlike the HDevice at server-side, however, the HDeviceProxy at client-side is usually only responsible of providing helper methods for accessing the server side.

As HControlPoint allows the creation and use of custom HDeviceProxy types, you can use the HDeviceProxy as a base for more refined proxies that could provide more fine-grained APIs to communicate with a particular device type. For instance, if there is a UPnP device type you would like to use from the client side using a statically typed API, you could create a class derived from the HDeviceProxy. This class would provide the desired API hiding all the things relating to action invocation and converting state variable notifications to Qt signals.

Note:
Creating a custom HDeviceProxy often means that you should create custom HServiceProxy classes as well. In that case you should override the createServices() method and instantiate the desired HServiceProxy types there.
Remarks:
the methods introduced in this class are thread-safe, but the QObject base class is largely not.
See also:
HControlPoint, HServiceProxy

Constructor & Destructor Documentation

HDeviceProxy (  ) 

Creates a new instance.

~HDeviceProxy (  )  [virtual]

Destroys the instance.


Member Function Documentation

HServicesSetupData * createServices (  )  [private, virtual]

HDeviceProxy provides default implementation for this, but if you want to associate specific HServiceProxy types with this HDeviceProxy type you have to override this method.

Warning:
At the moment the API doesn't explicitly require the creation of HServiceProxy types. In the future this will be changed. Furthermore, creating types not derived from HServiceProxy results in undefined behavior.

Reimplemented from HDevice.

HDeviceProxy * parentProxyDevice (  )  const

Returns the parent device proxy of this device.

This is a helper method that returns the parent HDevice of this device statically cast to HDeviceProxy.

Returns:
the parent device proxy of this device.
HDeviceProxy * rootProxyDevice (  )  const

Returns the root device proxy of this device tree.

This is a helper method that returns the root HDevice of this device tree statically cast to HDeviceProxy.

Returns:
the root device proxy of this device tree.
HServiceProxy * serviceProxyById ( const HServiceId serviceId  )  const

Returns a service proxy that matches the provided service ID.

This is a helper method that returns the a HService matching the specified serviceID statically cast to HServiceProxy.

Parameters:
serviceId specifies the service to be returned.
Returns:
the root proxy device of this device tree.
HDeviceProxies embeddedProxyDevices (  )  const

Returns the embedded device proxies of this device.

This is a helper method that returns the embedded HDevice instances of this device statically cast to HDeviceProxy instances.

Returns:
the embedded device proxies of this device.
HServiceProxies serviceProxies (  )  const

Returns service proxies of this device.

This is a helper method that returns HService instances of this device statically cast to HServiceProxy instances.

Returns:
the service proxies of this device.
HServiceProxies serviceProxiesByType ( const HResourceType serviceType,
HResourceType::VersionMatch  versionMatch = HResourceType::InclusiveVersionMatch 
) const

Returns service proxies of this device.

This is a helper method that returns HService instances of this device statically cast to HServiceProxy instances.

Parameters:
serviceType specifies the UPnP service type of interest. Only services matching the type are returned.
versionMatch specifies 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 proxies of the specified type.