A class that represents a server-side UPnP action. More...
Inherited by HDefaultServerAction.
Public Member Functions | |
virtual | ~HServerAction ()=0 |
HServerService * | parentService () const |
const HActionInfo & | info () const |
qint32 | invoke (const HActionArguments &inArgs, HActionArguments *outArgs=0) |
Protected Member Functions | |
HServerAction (const HActionInfo &info, HServerService *parentService) |
HServerAction
is a core component of the HUPnP's server-side Device Model and it models a UPnP action. The UPnP Device Architecture specifies a UPnP action as command, which takes one or more input or output arguments and that may have a return value.
This class is used to invoke the server-side UPnP actions directly in process. You can get information of the action using info(), which includes the action's input and output arguments. You can invoke an action synchronously using invoke().
HServerAction | ( | const HActionInfo & | info, |
HServerService * | parentService | ||
) | [protected] |
Creates a new instance.
info | specifies information of the action. This is usually read from a service description document. |
parentService | specifies the UPnP service instance that contains this action. |
~HServerAction | ( | ) | [pure virtual] |
Destroys the instance.
An HServerAction
is always destroyed by the HServerService
that contains it when it is being deleted. Further, unless you hold the ownership of the HServerAction
instance, you should never destroy it.
HServerService * parentService | ( | ) | const |
Returns the parent service of the action.
HServerAction
exists, which ultimately is as long as the containing root device exists.const HActionInfo & info | ( | ) | const |
Returns information about the action that is read from the service description.
qint32 invoke | ( | const HActionArguments & | inArgs, |
HActionArguments * | outArgs = 0 |
||
) |
Invokes the action synchronously.
For example,
Herqq::Upnp::HActionArguments inArgs = action->info().inputArguments(); inArgs.setValue("EchoInArgument", "Ping"); Herqq::Upnp::HActionArguments outArgs; qint32 retVal = action->invoke(inArgs, &outArgs); if (retVal == Herqq::Upnp::HServerAction::Success) { qDebug() << outArgs.value("EchoOutArgument").toString(); }
inArgs | specifies the input arguments for the action. |
outArgs | specifies a pointer to HActionArguments instance created by the user. This can be null in which case the output arguments will not be set even if the action has output arguments. If the parameter is specified and the action has output arguments, the values of the arguments will be set accordingly. If the action doesn't have output arguments, the parameter is ignored. |