This is a class for specifying a configuration to an HServerDevice that is to be created and hosted by an HDeviceHost. More...
#include <HDeviceConfiguration>
Public Member Functions | |
HDeviceConfiguration () | |
virtual | ~HDeviceConfiguration () |
virtual HDeviceConfiguration * | clone () 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 HDeviceConfiguration * | newInstance () const |
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().
Default constructor.
Creates a new, empty instance.
~HDeviceConfiguration | ( | ) | [virtual] |
Destroys the instance.
void doClone | ( | HClonable * | target ) | const [protected, virtual] |
Clones the contents of this to the target
object.
Every derived class has to override this method. Further, 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". }
target | specifies the target object to which the contents of this instance are cloned. |
Reimplemented from HClonable.
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 descendant class overrides this method:
MyClonable* MyClonable::newInstance() const { return new MyClonable(); }
Implements HClonable.
HDeviceConfiguration * clone | ( | ) | const [virtual] |
Returns a deep copy of the instance.
Reimplemented from HClonable.
void setPathToDeviceDescription | ( | const QString & | pathToDeviceDescription ) |
Sets the path to the UPnP device description.
pathToDeviceDescription | specifies the path to the UPnP device description. |
QString pathToDeviceDescription | ( | ) | const |
Returns the path to the device description.
void setCacheControlMaxAge | ( | qint32 | maxAge = 1800 ) |
Sets the maximum age of presence announcements and discovery responses in seconds.
maxAge | specifies 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. |
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.
bool isValid | ( | ) | const |
Indicates whether or not the object contains the necessary details for hosting an HServerDevice class in a HDeviceHost.
true | in case the object contains the necessary details for hosting an HServerDevice class in a HDeviceHost. |
false | otherwise. In this case, the initialization of HDeviceHost cannot succeed. Make sure you have set the pathToDeviceDescription(). |