SetMonitoringMode
Each MonitoredItem has 3 monitoring modes:
| Mode | Server-Side Sampling | Server-Side Push | Uses |
|---|---|---|---|
| Disabled (0) | × | × | Fully stopped (neither sampling nor push) |
| Sampling (1) | ✓ | × | Sample but do not push |
| Reporting (2, Default) | ✓ | ✓ | Operating Normally |
(Consistent with Part 4, §5.12.2 .)
- To cancel your entire subscription (rather than individual issues MI), see below
PublishingEnabled. - To modify the sampling parameters, see Modify.
Batch Cut
public IReadOnlyList<StatusCode> SetMonitoringMode(
MonitoringMode mode,
IReadOnlyList<uint> miHandles);
// Temporarily suspend all data collection (e.g., during equipment maintenance)
var statuses = sub.SetMonitoringMode(MonitoringMode.Disabled, allHandles);
Returns status codes item by item, in the same miHandles order as. If the entire RPC returns a status code other than "Good," a is thrown OpcUaException; if null is passed miHandles ArgumentNullException, a is thrown; if an empty array is passed, an empty list is returned. Items for which the switch was successful SDK are remembered and restored according to the new pattern when reconnecting or rebuilding (see Subscription Resumes Automatically)。
Single MI Cut
public StatusCode SetMode(uint monitoredItemHandle, MonitoringMode mode);
sub.SetMode(handle, MonitoringMode.Disabled); // Pause a certain MI
sub.SetMode(handle, MonitoringMode.Reporting); // Restore
Enable or Disable the Entire Feed (PublishingEnabled)
If you want to cancel the entire subscription (rather than individual issues MI), use PublishingEnabled:
sub.PublishingEnabled = StatusCode.Good; // Open → SetPublishingMode(1)
sub.PublishingEnabled = StatusCode.Bad; // Close → SetPublishingMode(0)
PublishingEnabled of StatusCode typeWrite only Properties, When I run it, it doesn't compile.. Any value Good other than is treated as "off." Switch resultDoes not return a status code to external systems, CallerI can't tell if this switch was turned on successfully. — You need to check whether there is any data left in your subscription.
Comparison of Three Particle Sizes
| Particle size | API | Applicable |
|---|---|---|
| Subscribe to the entire series | sub.PublishingEnabled | Temporary Service Suspension (Maintenance) |
| A batch of MI | sub.SetMonitoringMode(mode, handles) | Some modules are down |
| Single MI | sub.SetMode(handle, mode) | Precise Control |
| Delete Completely | sub.Remove(handle) / sub.Dispose() | I don't want it anymore—ever. |