Connectivity Software User's Guide and Reference
PerformPoll Method (EasySparkplugEdgeNodeCore)



OpcLabs.EasySparkplug Assembly > OpcLabs.EasySparkplug Namespace > EasySparkplugEdgeNodeCore Class : PerformPoll Method
Performs the periodic polling of data from the data source, and publishes the data payload.
Syntax
'Declaration
 
Public Sub PerformPoll() 
'Usage
 
Dim instance As EasySparkplugEdgeNodeCore
 
instance.PerformPoll()
public void PerformPoll()
public:
void PerformPoll(); 
Exceptions
ExceptionDescription

A method call was invalid for the object's current state.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

An operation was performed on a disposed object.
Remarks

This method first raises the ISparkplugProducerEvents.Poll event (in the implementations, this is usually done through calling the virtual OnPoll method).

If the event is handled (its System.ComponentModel.HandledEventArgs.Handled property is set to true), your code is expected to collect the data for publishing itself, providing the whole payload at once, in the event result (OpcLabs.EasySparkplug.OperationModel.SparkplugProducerPollEventArgs.Result). The component will then send the payload out (if there is anything to publish), by internally calling the PublishDataPayload method. The individual metrics will not be polled (read) by the component.

If the event is not handled (its System.ComponentModel.HandledEventArgs.Handled property remains at false), the component will poll (read) the individual metrics, and then publish the data that has changed. This is done in following steps:

  1. The publishing is locked (LockPublishing). This means that data changes in individual metrics will not be immediately published.
  2. Metrics that are readable and pollable are polled (SparkplugMetric.PerformPoll).
  3. The publishing is unlocked (UnlockPublishing). At this point, if any of the polled metrics data has changed, the component will assemble the payload consisting of the changed data, and publish it.

This method is meant for invocation from your code when PublishingInterval equals to System.Threading.Timeout.Infinite, and the polling is therefore not done periodically by the producer.

The producer must be started, otherwise System.InvalidOperationException is thrown.

 

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