Herqq

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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

# HDeviceHostConfiguration Class Reference
Device Hosting

This class is used to specify one or more device configurations to an HDeviceHost instance and to configure the functionality of the HDeviceHost that affect every hosted HServerDevice. More...

`#include <HDeviceHostConfiguration>`

Inheritance diagram for HDeviceHostConfiguration:

List of all members.

## Public Member Functions
| HDeviceHostConfiguration ()
| HDeviceHostConfiguration (const HDeviceConfiguration &)
virtual | ~HDeviceHostConfiguration ()
virtual HDeviceHostConfiguration * | clone () const
bool | add (const HDeviceConfiguration &deviceConfiguration)
void | clear ()
QList< const HDeviceConfiguration * > | deviceConfigurations () const
qint32 | individualAdvertisementCount () const
QList< QHostAddress > | networkAddressesToUse () const
qint32 | subscriptionExpirationTimeout () const
HDeviceModelCreator * | deviceModelCreator () const
HDeviceModelInfoProvider * | deviceModelInfoProvider () const
void | setDeviceModelCreator (const HDeviceModelCreator &creator)
void | setDeviceModelInfoProvider (const HDeviceModelInfoProvider &infoProvider)
void | setIndividualAdvertisementCount (qint32 count)
void | setSubscriptionExpirationTimeout (qint32 timeout)
bool | setNetworkAddressesToUse (const QList< QHostAddress > &addresses)
bool | isEmpty () const
bool | isValid () const
## Protected Member Functions
virtual void | doClone (HClonable *target) const
virtual HDeviceHostConfiguration * | newInstance () const

## Detailed Description

This class is used to specify one or more device configurations to an HDeviceHost instance and to configure the functionality of the HDeviceHost that affect every hosted HServerDevice.

The initialization of an HDeviceHost requires a valid host configuration. A valid host configuration contains at least one device configuration and a device model creator, as otherwise the host would have nothing to do and no means to create UPnP device and service objects.

The initialization of an HDeviceHost follows roughly these steps:

- Create an HDeviceHostConfiguration instance.
- Set the device model creator using setDeviceModelCreator().
- Create and setup one or more HDeviceConfiguration instances.
- Add the device configurations to the HDeviceHostConfiguration instance using add().
- Modify the behavior of the HDeviceHost by setting other variables of this class.
- Create an HDeviceHost and initialize it by passing the HDeviceHostConfiguration to its HDeviceHost::init() method.

Besides specifying the device configurations, you can configure an HDeviceHost in following ways:

- Specify how many times each resource advertisement is sent with setIndividualAdvertisementCount(). The default is 2.
- Specify the timeout for event subscriptions with setSubscriptionExpirationTimeout(). The default is 0, which means that an HDeviceHost respects the subscription timeouts requested by control points as long as the requested values are less than a day.
- Specify the network addresses an HDeviceHost should use in its operations with setNetworkAddressesToUse(). The default is the first found interface that is up. Non-loopback interfaces have preference, but if none are found the loopback is used. However, in this case UDP multicast is not available.

See also:
  HDeviceConfiguration, HDeviceHost

## Constructor & Destructor Documentation

HDeviceHostConfiguration | ( |  | ) |

Default constructor.

Creates a new, empty instance.

See also:
  isEmpty(), isValid()

HDeviceHostConfiguration | ( | const HDeviceConfiguration & |  | ) |

Creates a new instance.

Creates an instance with a single device configuration. This is a convenience method.

See also:
  isEmpty(), isValid()

~HDeviceHostConfiguration | ( |  | ) | `[virtual]`

Destroys the instance.

## Member Function Documentation

virtual void doClone | ( | HClonable * | target | ) | const`[protected, virtual]`

Clones the contents of this to the `target` object.

Every derived class that introduces member variables that should be copied as part of a cloning operation should override this method. The implementation should be something along these lines:

     void MyClonable::doClone(HClonable* target) const
     {
        MyClonable* myClonable = dynamic_cast<MyClonable*>(target);
        if (!myClonable)
        {
            return;
        }

        BaseClassOfMyClonable::doClone(target);

        // copy the variables introduced in *this* MyClonable
        // instance to "myClonable".
     }

Parameters:

  target | specifies the target object to which the contents of `this` instance are cloned.

Reimplemented from HClonable.

virtual HDeviceHostConfiguration* newInstance | ( |  | ) | const`[protected, virtual]`

Creates a new instance.

This method is used as part of object cloning. Because of that, it is important that every concrete (non-abstract) descendant class overrides this method regardless of the type location in the inheritance tree:

     MyClonable* MyClonable::newInstance() const
     {
         return new MyClonable();
     }

Remarks:
  - the object has to be heap-allocated and
  - the ownership of the object is passed to the caller.

Implements HClonable.

virtual HDeviceHostConfiguration* clone | ( |  | ) | const`[virtual]`

Returns a deep copy of the instance.

Returns:
  a deep copy of the instance.

Remarks:
  - the ownership of the returned object is transferred to the caller.

Reimplemented from HClonable.

bool add | ( | const HDeviceConfiguration & | deviceConfiguration | ) |

Adds a device configuration.

Parameters:

  deviceConfiguration | specifies the device configuration to be added. The configuration is added only if it is valid, see HDeviceConfiguration::isValid().

Returns:
  true in case the configuration was added. Only valid HDeviceConfiguration instances are added, see HDeviceConfiguration::isValid().

void clear | ( |  | ) |

Removes device configurations.

Remarks:
  This method removes the device configurations, but it does not reset other set attributes to their default values.

QList< const HDeviceConfiguration * > deviceConfigurations | ( |  | ) | const

Returns the currently stored device configurations.

Returns:
  The currently stored device configurations. The returned list contains pointers to const device configuration objects this instance owns. The ownership of the objects is not transferred.

qint32 individualAdvertisementCount | ( |  | ) | const

Indicates how many times the device host sends each individual advertisement / announcement.

The default value is 2.

Returns:
  how many times the device host sends each individual advertisement / announcement.

See also:
  setIndividualAdvertisementCount()

QList< QHostAddress > networkAddressesToUse | ( |  | ) | const

Returns the network addresses a device host should use in its operations.

Returns:
  The network addresses a device host should use in its operations.

See also:
  setNetworkAddressesToUse()

qint32 subscriptionExpirationTimeout | ( |  | ) | const

Returns the timeout the device host uses for subscriptions.

The default value is zero, which means that the device host honors the timeouts requested by control points up to a day. Larger values are set to a day.

Returns:
  The timeout in seconds the device host uses for subscriptions.

See also:
  setSubscriptionExpirationTimeout()

HDeviceModelCreator * deviceModelCreator | ( |  | ) | const

Returns the device model creator the HDeviceHost should use to create HServerDevice instances.

Returns:
  The device model creator the HDeviceHost should use to create HServerDevice instances.

See also:
  setDeviceModelCreator()

HDeviceModelInfoProvider * deviceModelInfoProvider | ( |  | ) | const

Returns the device model info provider the HDeviceHost should use to validate device model components.

Returns:
  The device model info provider the HDeviceHost should use to validate device model components.

void setDeviceModelCreator | ( | const HDeviceModelCreator & | creator | ) |

Sets the device model creator the HDeviceHost should use to create HServerDevice instances.

Parameters:

  creator | specifies the device model creator the HDeviceHost should use to create HServerDevice instances.

See also:
  deviceModelCreator()

void setDeviceModelInfoProvider | ( | const HDeviceModelInfoProvider & | infoProvider | ) |

Sets the device model info provider the HDeviceHost should use to validate device model components.

Parameters:

  infoProvider | specifies the device model info provider the HDeviceHost should use to validate device model components.

void setIndividualAdvertisementCount | ( | qint32 | count | ) |

Specifies how many times the device host sends each individual advertisement / announcement.

By default, each advertisement is sent twice.

Parameters:

  count | specifies how many times the device host sends each individual advertisement / announcement. If the provided value is smaller than 1 the advertisement count is set to 1.

See also:
  individualAdvertisementCount()

void setSubscriptionExpirationTimeout | ( | qint32 | timeout | ) |

Specifies the timeout the device host uses for subscriptions.

The default value is zero, which means that the device host honors the timeouts requested by control points.

Parameters:

  timeout | specifies the desired timeout in seconds. If timeout is greater than zero the device host will use the timeout as such for subscriptions. If timeout is zero the device host will honor the timeout requested by control points. If timeout is negative the subscription timeout is set to a day.

Note:
  the maximum expiration timeout value is a day. Larger values are set to a day. This applies to the timeout requests made by control points as well.

See also:
  subscriptionExpirationTimeout()

bool setNetworkAddressesToUse | ( | const QList< QHostAddress > & | addresses | ) |

Defines the network addresses the device host should use in its operations.

Parameters:

  addresses | specifies the network addresses the device host should use in its operations.

See also:
  networkAddressesToUse()

bool isEmpty | ( |  | ) | const

Indicates if the instance contains any device configurations.

Returns:
  true in case the instance contains no device configurations. In this case the object cannot be used to initialize an HDeviceHost.

See also:
  isValid()

bool isValid | ( |  | ) | const

Indicates if the object is valid, i.e it can be used to initialize an HDeviceHost instance.

Returns:
  true if the object is valid. A valid object is not empty and its deviceModelCreator() is set.