'DeclarationPublic Event Poll As SparkplugProducerPollEventHandler
'UsageDim instance As EasySparkplugEdgeNodeCore Dim handler As SparkplugProducerPollEventHandler AddHandler instance.Poll, handler
public event SparkplugProducerPollEventHandler Poll
public: event SparkplugProducerPollEventHandler^ Poll
The event handler receives an argument of type SparkplugProducerPollEventArgs containing data related to this event. The following SparkplugProducerPollEventArgs properties provide information specific to this event.
| Property | Description |
|---|---|
| Device | The device associated with this event, if any. (Inherited from OpcLabs.EasySparkplug.OperationModel.SparkplugProducerProcessedEventArgs) |
| EdgeNode | The edge node associated with this event. (Inherited from OpcLabs.EasySparkplug.OperationModel.SparkplugProducerProcessedEventArgs) |
| Handled | (Inherited from System.ComponentModel.HandledEventArgs) |
| MetricName | The name of the metric associated with this event. Empty if the event is not associated with a metric. (Inherited from OpcLabs.EasySparkplug.OperationModel.SparkplugProducerProcessedEventArgs) |
| Result | The payload that is the result of the Sparkplug poll. |
Handle this event to implement custom code that polls for the data and creates the payload be to be published.
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:
- The publishing is locked (LockPublishing). This means that data changes in individual metrics will not be immediately published.
- Metrics that are readable and pollable are polled (SparkplugMetric.PerformPoll).
- 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.
Instead of adding an event handler to this event, you can use the ISparkplugProducerExtension.PollFunction method and specify the function that polls for the data and returns the payload to be published.
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.