A client-side class that represents a server-side UPnP state variable. More...
#include <HClientStateVariable>
Inherited by HDefaultClientStateVariable.
Signals | |
void | valueChanged (const Herqq::Upnp::HClientStateVariable *source, const Herqq::Upnp::HStateVariableEvent &event) |
Public Member Functions | |
virtual | ~HClientStateVariable ()=0 |
HClientService * | parentService () const |
QVariant | value () const |
const HStateVariableInfo & | info () const |
bool | setValue (const QVariant &newValue) |
Protected Member Functions | |
HClientStateVariable (const HStateVariableInfo &info, HClientService *parent) |
HClientStateVariable
is a core component of the HUPnP's client-side Device Model and it models a UPnP state variable. The UPnP Device Architecture specifies a UPnP state variable as an item or aspect that models state in a service. In a way a state variable is an abstraction to a member variable inside a UPnP service.
A state variable can be evented in which case it notifies interested listeners of changes in its value. You can see if a state variable is evented by checking the HStateVariableInfo object using info() and you can connect to the signal valueChanged() to be notified when the value of the state variable changes. Note, only evented state variables emit the valueChanged() signal.
HClientStateVariable | ( | const HStateVariableInfo & | info, |
HClientService * | parent | ||
) | [protected] |
Creates a new instance.
info | specifies information of the state variable. This is often read from a service description document. |
parent | specifies the UPnP service instance that contains this state variable. |
~HClientStateVariable | ( | ) | [pure virtual] |
Destroys the instance.
An HClientStateVariable
is always destroyed by the HClientService
that contains it when it is being deleted. Further, unless you hold the ownership of the HClientStateVariable
instance, you should never destroy it.
HClientService * parentService | ( | ) | const |
Returns the HClientService that contains this state variable.
HClientStateVariable
exists, which ultimately is as long as the containing root device exists. QVariant value | ( | ) | const |
Returns the current value of the state variable.
const HStateVariableInfo & info | ( | ) | const |
Returns information about the state variable.
bool setValue | ( | const QVariant & | newValue ) |
Changes the value of the state variable.
If the instance is evented, the valueChanegd() signal is emitted after the value has been changed.
newValue | specifies the new value of the state variable. The new value must have the same underlying data type as the previous value (and the default value). If the new value has different data type, the value is not changed, no event is sent and false is returned. |
true | in case the new value was successfully set. |
false | in case the new value could not be set. |
void valueChanged | ( | const Herqq::Upnp::HClientStateVariable * | source, |
const Herqq::Upnp::HStateVariableEvent & | event | ||
) | [signal] |
This signal is emitted when the value of the state variable has changed.
source | specifies the state variable that sent the event. |
event | specifies information about the event that occurred. |