/* ========================================================================
* Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/
using System;
using System.Threading;
using System.Threading.Tasks;
using Opc.Ua.Client.Subscriptions.MonitoredItems;
namespace Opc.Ua.Client.Subscriptions
{
///
/// Subscription services
///
public interface ISubscription : IAsyncDisposable
{
///
/// Created subscription
///
bool Created { get; }
///
/// The current publishing interval on the server
///
TimeSpan CurrentPublishingInterval { get; }
///
/// The current priority of the subscription
///
byte CurrentPriority { get; }
///
/// The current lifetime count on the server
///
uint CurrentLifetimeCount { get; }
///
/// The current keep alive count on the server
///
uint CurrentKeepAliveCount { get; }
///
/// The current publishing enabled state
///
bool CurrentPublishingEnabled { get; }
///
/// Current max notifications per publish
///
uint CurrentMaxNotificationsPerPublish { get; }
///
/// Monitored items
///
IMonitoredItemCollection MonitoredItems { get; }
///
/// Number of missing notification messages detected by the
/// gap-walking sequence-number tracker for this subscription.
/// Each missing slot triggers a republish attempt — see
/// .
///
long MissingMessageCount { get; }
///
/// Number of republish requests issued for this subscription
/// (counts every attempt, regardless of whether the server still
/// holds the message in its retransmission queue).
///
long RepublishMessageCount { get; }
///
/// Tells the server to refresh all conditions being
/// monitored by the subscription.
///
///
ValueTask ConditionRefreshAsync(
CancellationToken ct = default);
///
/// Mark this subscription as durable on the server (OPC UA Part 4
/// §5.13.9 SetSubscriptionDurable). A durable subscription
/// retains its monitored item state and message queue across
/// session disconnects for the requested
/// , so a later
/// transfer-on-load can take over without losing buffered
/// notifications.
///
/// Requested lifetime as a
/// . The server may revise downwards.
/// Whole hours are sent on the wire (the
/// SetSubscriptionDurable service uses an hour granularity);
/// sub-hour components round up to the next whole hour.
/// Cancellation token.
/// The server-revised lifetime as a
/// (whole-hour precision).
/// Raised when the
/// subscription is not yet created on the server, or when the
/// server rejects the call (e.g. it has monitored items already
/// — per spec SetSubscriptionDurable must be called
/// before any items are added).
ValueTask SetAsDurableAsync(
TimeSpan lifetime,
CancellationToken ct = default);
}
}