using System; using System.Security.Cryptography.X509Certificates; using OpcUa = Opc.Ua; namespace Hylasoft.Opc.Ua { /// /// This class defines the configuration options for the setup of the UA client session /// public class UaClientOptions { /// /// Specifies the (optional) certificate for the application to connect to the server /// public X509Certificate2 ApplicationCertificate { get; set; } /// /// Specifies the ApplicationName for the client application. /// public string ApplicationName { get; set; } /// /// Should untrusted certificates be silently accepted by the client? /// public bool AutoAcceptUntrustedCertificates { get; set; } /// /// Specifies the ConfigSectionName for the client configuration. /// public string ConfigSectionName { get; set; } /// /// default monitor interval in Milliseconds. /// public int DefaultMonitorInterval { get; set; } /// /// Specifies a name to be associated with the created sessions. /// public string SessionName { get; set; } /// /// Specifies the timeout for the sessions. /// public uint SessionTimeout { get; set; } /// /// Specify whether message exchange should be secured. /// public bool UseMessageSecurity { get; set; } /// /// The maximum number of notifications per publish request. /// The client’s responsibility is to send PublishRequests to the server, /// in order to enable the server to send PublishResponses back. /// The PublishResponses are used to deliver the notifications: but if there /// are no PublishRequests, the server cannot send a notification to the client. /// The server will also verify that the client is alive by checking that /// new PublishRequests are received – LifeTimeCount defines the number of /// PublishingIntervals to wait for a new PublishRequest, before realizing /// that the client is no longer active.The Subscription is then removed from /// the server. /// public uint SubscriptionLifetimeCount { get; set; } /// /// If there is no data to send after the next PublishingInterval, /// the server will skip it. But KeepAlive defines how many intervals may be skipped, /// before an empty notification is sent anyway: to give the client a hint that /// the subscription is still alive in the server and that there just has not been /// any data arriving to the client. /// public uint SubscriptionKeepAliveCount { get; set; } /// /// Gets or sets the max subscription count. /// public int MaxSubscriptionCount { get; set; } /// /// The maximum number of messages saved in the queue for each subscription. /// public int MaxMessageQueueSize { get; set; } /// /// The maximum number of notificates saved in the queue for each monitored item. /// public int MaxNotificationQueueSize { get; set; } /// /// Gets or sets the max publish request count. /// public int MaxPublishRequestCount { get; set; } /// /// The identity to connect to the OPC server as /// public OpcUa.UserIdentity UserIdentity { get; set; } /// /// Creates a client options object /// public UaClientOptions() { // Initialize default values: ApplicationName = "h-opc-client"; AutoAcceptUntrustedCertificates = true; ConfigSectionName = "h-opc-client"; DefaultMonitorInterval = 100; SessionName = "h-opc-client"; SessionTimeout = 60000U; UseMessageSecurity = false; SubscriptionLifetimeCount = 0; SubscriptionKeepAliveCount = 0; MaxSubscriptionCount = 100; MaxMessageQueueSize = 10; MaxNotificationQueueSize = 100; MaxPublishRequestCount = 20; } } }