Action
public protocol Action
An Action to be sent to the server. The action is sent by calling the
call
method.
The set
method returns the Action
instance to allow
the fields of the action to be set in fluent style.
See VirtualDevice.createAction
-
Set the value of an argument in the
Action
. The arguments are determined by the action in the device model. The arguments can be set in any order. The value is validated according to the constraints in the device model. If the value is not valid, or the named arguement does not exist in the device model, aClientError.argument
Error is raised.If the action has an
arguments
array in the device model, theargName
must match one of the argument names in the array. To support device models which have only a single, un-named argument,argName
may be passed as “” (an empty String) ornil
. For an action that takes no arguments, theset
, the code only needs to invoke the icall
method. An attempt to set an argument value for an action that does not take arguments will result in aClientError.argument
Error.All arguments defined in the action that do not have default values must be set before calling
call
.return: this Action instance
Throws
ClientError.argument
if the value is not valid, orfield
isnil
See
VirtualDevice.createAction
Declaration
Swift
func set(argumentName: String, value: Any?) throws -> Action
Parameters
argName
the name of an argument from the action
value
the value to set
-
Send the action.
The onError handler of the parent virtual device will be called if there is error sending the action.
All fields defined in the action that do not have default values must be set before invoking
call
otherwise, aClientError.state
Error is thrown.Throws
ClientError.state
ifcall
is invoked before setting all arguments that do not have default valuesDeclaration
Swift
func call()