| 1 | // Copyright (C) 2019 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include <private/opcuamethodargument_p.h> |
| 5 | |
| 6 | /*! |
| 7 | \qmltype MethodArgument |
| 8 | \inqmlmodule QtOpcUa |
| 9 | \brief Arguments for OpcUa method calls. |
| 10 | \since QtOpcUa 5.13 |
| 11 | |
| 12 | When calling methods which require arguments, this type is used. |
| 13 | |
| 14 | This example shows how to call a method with two double arguments. |
| 15 | \code |
| 16 | QtOpcUa.MethodNode { |
| 17 | ... |
| 18 | inputArguments: [ |
| 19 | QtOpcUa.MethodArgument { |
| 20 | value: 3 |
| 21 | type: QtOpcUa.Constants.Double |
| 22 | }, |
| 23 | QtOpcUa.MethodArgument { |
| 24 | value: 4 |
| 25 | type: QtOpcUa.Constants.Double |
| 26 | } |
| 27 | ] |
| 28 | } |
| 29 | \endcode |
| 30 | */ |
| 31 | |
| 32 | /*! |
| 33 | \qmlproperty variant MethodArgument::value |
| 34 | |
| 35 | The value of the argument. |
| 36 | */ |
| 37 | |
| 38 | /*! |
| 39 | \qmlproperty QOpcUa::Types MethodNode::type |
| 40 | |
| 41 | Sets the type of the argument that is expected by the server. |
| 42 | The value variant is converted to that type when calling the method. |
| 43 | The type has to match the method on the server exactly, otherwise |
| 44 | the method call will fail. |
| 45 | |
| 46 | \sa MethodNode::callMethod |
| 47 | */ |
| 48 | |
| 49 | OpcUaMethodArgument::OpcUaMethodArgument(QObject *parent) : QObject(parent) |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | QVariant OpcUaMethodArgument::value() const |
| 54 | { |
| 55 | return m_value; |
| 56 | } |
| 57 | |
| 58 | QOpcUa::Types OpcUaMethodArgument::type() const |
| 59 | { |
| 60 | return m_type; |
| 61 | } |
| 62 | |
| 63 | void OpcUaMethodArgument::setValue(QVariant value) |
| 64 | { |
| 65 | m_value = value; |
| 66 | } |
| 67 | |
| 68 | void OpcUaMethodArgument::setType(QOpcUa::Types type) |
| 69 | { |
| 70 | m_type = type; |
| 71 | } |
| 72 | |