/// <summary> /// Initializes a new instance of the <see cref="UaTcpSessionService"/> class. /// </summary> /// <param name="localDescription">The <see cref="ApplicationDescription"/> of the local application.</param> /// <param name="localCertificate">The <see cref="X509Certificate2"/> of the local application.</param> /// <param name="userIdentity">The user identity or null if anonymous. Supports <see cref="AnonymousIdentity"/>, <see cref="UserNameIdentity"/>, <see cref="IssuedIdentity"/> and <see cref="X509Identity"/>.</param> /// <param name="remoteEndpoint">The <see cref="EndpointDescription"/> of the remote application. Obtained from a prior call to UaTcpDiscoveryClient.GetEndpoints.</param> public UaTcpSessionService(ApplicationDescription localDescription, X509Certificate2 localCertificate, IUserIdentity userIdentity, EndpointDescription remoteEndpoint) { if (localDescription == null) { throw new ArgumentNullException(nameof(localDescription)); } this.LocalDescription = localDescription; this.LocalCertificate = localCertificate; this.UserIdentity = userIdentity; if (remoteEndpoint == null) { throw new ArgumentNullException(nameof(remoteEndpoint)); } this.RemoteEndpoint = remoteEndpoint; this.Subscriptions = new SubscriptionCollection(this); this.stateMachineTask = this.StateMachine(this.cancellationTokenSource.Token); }
/// <summary> /// Initializes a new instance of the <see cref="UaTcpSessionService"/> class. /// </summary> /// <param name="localDescription">The <see cref="ApplicationDescription"/> of the local application.</param> /// <param name="localCertificate">The <see cref="X509Certificate2"/> of the local application.</param> /// <param name="userIdentity">The user identity or null if anonymous. Supports <see cref="AnonymousIdentity"/>, <see cref="UserNameIdentity"/>, <see cref="IssuedIdentity"/> and <see cref="X509Identity"/>.</param> /// <param name="discoveryUrl">The url of the remote application</param> public UaTcpSessionService(ApplicationDescription localDescription, X509Certificate2 localCertificate, IUserIdentity userIdentity, string discoveryUrl) { if (localDescription == null) { throw new ArgumentNullException(nameof(localDescription)); } this.LocalDescription = localDescription; this.LocalCertificate = localCertificate; this.UserIdentity = userIdentity; if (string.IsNullOrEmpty(discoveryUrl)) { throw new ArgumentNullException(nameof(discoveryUrl)); } this.discoveryUrl = discoveryUrl; this.Subscriptions = new SubscriptionCollection(this); this.stateMachineTask = this.StateMachine(this.cancellationTokenSource.Token); }
/// <summary> /// Initializes a new instance of the <see cref="UaTcpSessionClient"/> class. /// </summary> /// <param name="localDescription">The <see cref="ApplicationDescription"/> of the local application.</param> /// <param name="localCertificate">The <see cref="X509Certificate2"/> of the local application.</param> /// <param name="userIdentity">The user identity or null if anonymous. Supports <see cref="AnonymousIdentity"/>, <see cref="UserNameIdentity"/>, <see cref="IssuedIdentity"/> and <see cref="X509Identity"/>.</param> /// <param name="remoteEndpoint">The <see cref="EndpointDescription"/> of the remote application. Obtained from a prior call to UaTcpDiscoveryClient.GetEndpoints.</param> public UaTcpSessionClient(ApplicationDescription localDescription, X509Certificate2 localCertificate, IUserIdentity userIdentity, EndpointDescription remoteEndpoint) { this.innerChannel = new UaTcpSessionChannel(localDescription, localCertificate, userIdentity, remoteEndpoint); this.semaphore = new SemaphoreSlim(1); }