Signals | Public Member Functions

HStateVariable Class Reference
[Device Model]

Class that represents a UPnP state variable. More...

#include <HStateVariable>

Inheritance diagram for HStateVariable:
HReadableStateVariable HWritableStateVariable

List of all members.

Signals

void valueChanged (const Herqq::Upnp::HStateVariableEvent &event)

Public Member Functions

virtual ~HStateVariable ()=0
HServiceparentService () const
QVariant value () const
const HStateVariableInfoinfo () const
HWritableStateVariablewritable ()
HReadableStateVariablereadable ()

Detailed Description

HStateVariable is a core component of the HUPnP 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 UPnP state variable is an abstraction to a member variable, since it is always contained within 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.

See also:
HReadableStateVariable, HWritableStateVariable, HService
Remarks:
The methods introduced in this class are thread-safe, but the QObject base class is largely not. However, the signal valueChanged() has thread affinity and any connections to it must be done in the thread where the instance of HStateVariable resides.

Constructor & Destructor Documentation

~HStateVariable (  )  [pure virtual]

Destroys the instance.

An HStateVariable is always destroyed by the containing HService when it is being deleted. You should never destroy an HStateVariable.


Member Function Documentation

HService * parentService (  )  const

Returns the HService that contains this state variable.

Returns:
the HService that contains this state variable.
Warning:
the pointer is guaranteed to point to a valid object as long as the HStateVariable exists, which ultimately is as long as the containing root HDevice exists.
See also:
HDevice
QVariant value (  )  const

Returns the value of the state variable.

Returns:
the value of the state variable.
const HStateVariableInfo & info (  )  const

Returns information about the state variable that is read from the service description.

Returns:
information about the state variable that is read from the service description.
HWritableStateVariable * writable (  ) 

Attempts to cast the instance to HWritableStateVariable.

This is a helper method for performing a dynamic cast.

Returns:
this instance as HWritableStateVariable when the dynamic type of the instance is HWritableStateVariable. Otherwise zero is returned.
HReadableStateVariable * readable (  ) 

Attempts to cast the instance to HReadableStateVariable.

This is a helper method for performing a dynamic cast.

Returns:
this instance as HReadableStateVariable when the dynamic type of the instance is HReadableStateVariable. Otherwise zero is returned.
void valueChanged ( const Herqq::Upnp::HStateVariableEvent event  )  [signal]

This signal is emitted when the value of the state variable has changed.

Parameters:
event specifies information about the event that occurred.
Remarks:
This signal has thread affinity to the thread where the object resides. Do not connect to this signal from other threads.