Module "upnp.classes.argument"

The base object for UPnP action arguments.

Copyright © 2012 Thijs Schreijer, LuaUPnP is licensed under GPLv3

Release: Version 0.1, LuaUPnP

Tables

Argument fields/properties Members of the argument object

Functions

argument:check (value) Check a value against the arguments related statevariable.
argument:getupnp (value) Formats the argument value in upnp format.
argument:initialize () Initializes the argument object.
argument:parsefromxml (xmldoc, creator, parent, service) Argument constructor method, creates a new argument, parsed from an XML 'argument' element.


Tables

Argument fields/properties
Members of the argument object

Fields

  • name: name of the argument
  • parent: the owning action object
  • direction: of the argument either 'in' or 'out'
  • statevariable: the related statevariable object
  • position: position on the argument list of the owning action

Functions

argument:check (value)
Check a value against the arguments related statevariable. This will coerce booleans and numbers, including min/max/step values. Only values not convertable will return an error.

Parameters:

  • value: the argument value

Return values:

  1. value (in corresponding lua type) on success, nil on failure
  2. error string, if failure
  3. error number, if failure
argument:getupnp (value)
Formats the argument value in upnp format.

Parameters:

  • value: the Lua typed value to be formatted as UPnP type, according to the UPnP type set in the related statevariable for this argument

Return value:

The value in UPnP format as a Lua string.
argument:initialize ()
Initializes the argument object. Will be called upon instantiation of an object, override this method to set default values for all properties.
argument:parsefromxml (xmldoc, creator, parent, service)
Argument constructor method, creates a new argument, parsed from an XML 'argument' element.

Parameters:

  • xmldoc: an IXML object containing the 'argument' element
  • creator: callback function to create individual sub objects, see creator().
  • parent: the parent action object for the argument to be created
  • service: the service to attach to. Required because the parent relationships in the hierarchy haven't been set yet while parsing and the argument needs to access the statevariable list to check whether the related statevariable actually exists

Return value:

argument object or nil + error message

Valid XHTML 1.0!