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 HDevice. More...
#include <HDeviceHostConfiguration>
Public Member Functions | |
HDeviceHostConfiguration () | |
HDeviceHostConfiguration (const HDeviceConfiguration &) | |
virtual | ~HDeviceHostConfiguration () |
virtual HDeviceHostConfiguration * | clone () const |
bool | add (const HDeviceConfiguration &deviceConfiguration) |
QList< const HDeviceConfiguration * > | deviceConfigurations () const |
qint32 | individualAdvertisementCount () const |
QList< QHostAddress > | networkAddressesToUse () const |
qint32 | subscriptionExpirationTimeout () const |
ThreadingModel | threadingModel () const |
void | setIndividualAdvertisementCount (qint32 count) |
void | setSubscriptionExpirationTimeout (qint32 timeout) |
bool | setNetworkAddressesToUse (const QList< QHostAddress > &addresses) |
void | setThreadingModel (ThreadingModel arg) |
bool | isEmpty () const |
Protected Member Functions | |
virtual void | doClone (HClonable *target) const |
virtual HDeviceHostConfiguration * | newInstance () const |
The initialization of an HDeviceHost requires a valid configuration. A valid host configuration contains at least one device configuration, as otherwise the host would have nothing to do. Because of this the initialization of an HDeviceHost follows roughly these steps:
Besides specifying the device configurations, you can configure an HDeviceHost in following ways:
enum ThreadingModel |
This enumeration specifies the threading models the HDeviceHost may use in its operations in regard to user code invocation.
SingleThreaded |
User code is invoked only from the thread in which the HDeviceHost lives. This value is often used in situations where an HDevice being run by the device host has thread affinity. For instance, this is the case with |
MultiThreaded |
User code may be invoked from an arbitrary thread. This value should be used in situations where the HDevices run by the device host are thread-safe. |
Default constructor.
Creates a new, empty instance.
HDeviceHostConfiguration | ( | const HDeviceConfiguration & | arg | ) |
Creates a new instance.
Creates an instance with a single device configuration. This is a convenience method.
~HDeviceHostConfiguration | ( | ) | [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. |
Implements HClonable.
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 descendant class overrides this method:
MyClonable* MyClonable::newInstance() const { return new MyClonable(); }
Implements HClonable.
HDeviceHostConfiguration * clone | ( | ) | const [virtual] |
Returns a deep copy of the instance.
Reimplemented from HClonable.
bool add | ( | const HDeviceConfiguration & | deviceConfiguration | ) |
Adds a device configuration.
deviceConfiguration | specifies the device configuration to be added. The configuration is added only if it is valid ( |
QList< const HDeviceConfiguration * > deviceConfigurations | ( | ) | const |
Returns the currently stored device configurations.
qint32 individualAdvertisementCount | ( | ) | const |
Indicates how many times the device host sends each individual advertisement / announcement.
The default value is 2.
QList< QHostAddress > networkAddressesToUse | ( | ) | const |
Returns the network addresses a device host should use in its operations.
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.
HDeviceHostConfiguration::ThreadingModel threadingModel | ( | ) | const |
Returns the user code threading model the HDeviceHost uses in its operations.
void setIndividualAdvertisementCount | ( | qint32 | count | ) |
Specifies how many times the device host sends each individual advertisement / announcement.
By default, each advertisement is sent twice.
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. |
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.
timeout | specifies the desired timeout in seconds.
|
bool setNetworkAddressesToUse | ( | const QList< QHostAddress > & | addresses | ) |
Defines the network addresses the device host should use in its operations.
addresses | specifies the network addresses the device host should use in its operations. |
void setThreadingModel | ( | ThreadingModel | arg | ) |
Sets the user code threading model the HDeviceHost should use in its operations.
This value specifies how an HDeviceHost invokes user code in regard to thread safety. If the value is HDeviceHostConfiguration::SingleThreaded user code is invoked only from the thread in which the HDeviceHost instance is run. If the value is HDeviceHostConfiguration::MultiThreaded user code may be invoked from any thread at any time. The default is HDeviceHostConfiguration::MultiThreaded.
arg | specifies the user code threading model the HDeviceHost should use in its operations. |
bool isEmpty | ( | ) | const |
Indicates if the instance contains any device configurations.