Modifies the data variable for consuming values by a specified action, for the push data consumption model.
This method always makes the data variable writable; however, its status code and source timestamp will not be writable, i.e. OPC UA clients will not be able to modify them. If you need a different behavior, use one of the WriteFunction(UADataVariable,Type,Func<UAAttributeData,UAStatusCode>) method overloads instead.
This method does not change the readability access of the data variable. By default, data variables are readable. If you need a data variable that is writable but non-readable, combine this method with calling Readable(UADataVariable,Boolean) method with the 'readable' parameter set to false.
Unless the write value action throws a OpcLabs.EasyOpc.UA.UAStatusCodeException, a "Good" status code will be returned as the outcome of the OPC UA write operation. If the write value action function throws OpcLabs.EasyOpc.UA.UAStatusCodeException, the OpcLabs.EasyOpc.UA.UAStatusCodeException.StatusCode of the exception will become the outcome of the OPC UA write operation. For performance reasons, however, if you want to return status codes other than "Good" as OPC UA write operation outcomes, it is recommended that you use one of the WriteValueFunction<TValue>(UADataVariable,Type,Func<TValue,UAStatusCode>) method overloads instead. With these methods, you specify a write value function that returns the OpcLabs.EasyOpc.UA.UAStatusCode that is the OPC UA write operation outcome, allowing the status code be passed without the ineffective throwing and catching of the OpcLabs.EasyOpc.UA.UAStatusCodeException.
Overload List
| Overload | Description |
| WriteValueAction<TValue>(UADataVariable,Type,Action<TValue>) | Makes a data variable that consumes the attribute data using the write value action. Specify the declared type. |
| WriteValueAction<TValue>(UADataVariable,TypeCode,Action<TValue>) | Makes a data variable that consumes the attribute data using the write value action. Specify the declared type code. |
| WriteValueAction<TValue>(UADataVariable,UANodeId,Action<TValue>) | Makes a data variable that consumes the attribute data using the write value action. Specify the data type Id. |
| WriteValueAction<TValue>(UADataVariable,UANodeId,Int32,Action<TValue>) | Makes a data variable that consumes the attribute data using the write value action. Specify the data type Id, and array rank. |
| WriteValueAction<TValue>(UADataVariable,UANodeId,IReadOnlyList<Int32>,Action<TValue>) | Makes a data variable that consumes the attribute data using the write value action. Specify the data type Id, and array dimensions list. |
| WriteValueAction<TValue>(UADataVariable,Action<TValue>) | Makes a data variable that consumes the attribute data using the write value action. The declared type is specified using generic type parameter. |
| WriteValueAction<TValue>(UADataVariable,Action<TValue>,Int32[]) | Makes a data variable that consumes the attribute data using the write value action, and specifying array dimensions. The declared type is specified using generic type parameter. |
Requirements
Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows
See Also