Herqq

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

# HServerAction Class Reference
Device Model

A class that represents a server-side UPnP action. More...

`#include <HServerAction>`

Inherited by HDefaultServerAction.

List of all members.

## 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)

## Detailed Description

A class that represents a server-side UPnP action.

`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().

See also:
  HActionInfo, HServerService

Remarks:
  This class is not thread-safe.

## Constructor & Destructor Documentation

HServerAction | ( | const HActionInfo & | info,
|  | HServerService * | parentService
| ) |  | `[protected]`

Creates a new instance.

Parameters:

  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.

## Member Function Documentation

HServerService* parentService | ( |  | ) | const

Returns the parent service of the action.

Returns:
  The parent service of the action.

Warning:
  the pointer is guaranteed to point to a valid object as long as the `HServerAction` exists, which ultimately is as long as the containing root device exists.

See also:
  HServerDevice

const HActionInfo& info | ( |  | ) | const

Returns information about the action that is read from the service description.

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();
     }

Parameters:

  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.

Returns:
  UpnpSuccess on success. Any other value indicates that an error occurred.