Herqq
Public Member Functions | Protected Member Functions

HDeviceConfiguration Class Reference

This is a class for specifying a configuration to an HServerDevice that is to be created and hosted by an HDeviceHost. More...

#include <HDeviceConfiguration>

Inheritance diagram for HDeviceConfiguration:
HClonable

List of all members.

Public Member Functions

 HDeviceConfiguration ()
virtual ~HDeviceConfiguration ()
virtual HDeviceConfigurationclone () const
void setPathToDeviceDescription (const QString &pathToDeviceDescription)
QString pathToDeviceDescription () const
void setCacheControlMaxAge (qint32 maxAge=1800)
qint32 cacheControlMaxAge () const
bool isValid () const

Protected Member Functions

virtual void doClone (HClonable *target) const
virtual HDeviceConfigurationnewInstance () const

Detailed Description

This is a class for specifying a configuration to an HServerDevice that is to be created and hosted by an HDeviceHost.

A valid device configuration contains at least a path to a device description file. See setPathToDeviceDescription().

The other options available in this class affect the runtime behavior of a HDeviceHost in regard to the HServerDevice instance that is created based on the pathToDeviceDescription().

See also:
HDeviceHostConfiguration, HDeviceHost, HDeviceHost::init(), HServerDevice

Constructor & Destructor Documentation

Default constructor.

Creates a new, empty instance.

~HDeviceConfiguration ( ) [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:
targetspecifies the target object to which the contents of this instance are cloned.

Reimplemented from HClonable.

virtual HDeviceConfiguration* 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 HDeviceConfiguration* 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.

void setPathToDeviceDescription ( const QString &  pathToDeviceDescription)

Sets the path to the UPnP device description.

Parameters:
pathToDeviceDescriptionspecifies the path to the UPnP device description.
Remarks:
The provided path or the device description document is not validated in anyway. The device description validation occurs during the initialization of the HDeviceHost.
QString pathToDeviceDescription ( ) const

Returns the path to the device description.

Returns:
The path to the device description.
void setCacheControlMaxAge ( qint32  maxAge = 1800)

Sets the maximum age of presence announcements and discovery responses in seconds.

Parameters:
maxAgespecifies the maximum age of presence announcements and discovery messages. If a value smaller than 5 is specified, the max age is set to 5. If positive value larger than a day is specified, the max age is set to a day (60*60*24). The default is 1800 seconds, which equals to 30 minutes.
Attention:
the UDA instructs this value to be at least 30 minutes.
qint32 cacheControlMaxAge ( ) const

Returns the maximum age of presence announcements and discovery responses in seconds.

If the cache control max age has not been explicitly set, the return value is 1800.

Returns:
The maximum age of presence announcements and discovery responses in seconds.
bool isValid ( ) const

Indicates whether or not the object contains the necessary details for hosting an HServerDevice class in a HDeviceHost.

Return values:
truein case the object contains the necessary details for hosting an HServerDevice class in a HDeviceHost.
falseotherwise. In this case, the initialization of HDeviceHost cannot succeed. Make sure you have set the pathToDeviceDescription().
See also:
pathToDeviceDescription()