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, a ClientError.argument Error is raised.

    If the action has an arguments array in the device model, the argName 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) or nil. For an action that takes no arguments, the set, 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 a ClientError.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, or field is nil

    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, a ClientError.state Error is thrown.

    Throws

    ClientError.state if call is invoked before setting all arguments that do not have default values

    Declaration

    Swift

    func call()