Connectivity Software User's Guide and Reference
WriteValueFunction Method (SparkplugMetricExtension)



OpcLabs.EasySparkplug Assembly > OpcLabs.EasySparkplug Namespace > SparkplugMetricExtension Class : WriteValueFunction Method
Modifies the metric for consuming values by a specified function, for the push data consumption model.

This method always makes the metric writable; however, its timestamp will not be writable, i.e. Sparkplug host application will not be able to modify them. If you need a different behavior, use one of the WriteFunction(SparkplugMetric,Type,Func<SparkplugData,Boolean>) method overloads instead.

This method does not change the readability access of the metric. By default, metrics are readable. If you need a metric that is writable but non-readable, combine this method with calling Readable(SparkplugMetric,Boolean) method with the 'readable' parameter set to false.

The write function returns a boolean that indicates the outcome of the Sparkplug write operation. If the outcome of your write operation should always be successful, you can make your code a bit simpler by using one of WriteValueAction<TValue>(SparkplugMetric,Type,Action<TValue>) method overloads instead.

Overload List
OverloadDescription
Makes a metric that consumes the Sparkplug data using the write value function. Specify the declared type.  
Makes a metric that consumes the Sparkplug data using the write value function. Specify the declared type code.  
Makes a metric that consumes the Sparkplug data using the write value function. Specify the declared Sparkplug data type.  
Makes a metric that consumes the Sparkplug data using the write value function. The declared type is specified using generic type parameter.  
Remarks

 

Sparkplug is a trademark of Eclipse Foundation, Inc. "MQTT" is a trademark of the OASIS Open standards consortium. Other related terms are trademarks of their respective owners. Any use of these terms on this site is for descriptive purposes only and does not imply any sponsorship, endorsement or affiliation.

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