/// <summary> /// Writes a list of Node attributes. /// </summary> /// <param name="client">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="WriteRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="WriteResponse"/>.</returns> public static async Task <WriteResponse> WriteAsync(this IRequestChannel client, WriteRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return((WriteResponse)await client.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Removes one or more MonitoredItems of a Subscription. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="DeleteMonitoredItemsRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="DeleteMonitoredItemsResponse"/>.</returns> public static async Task <DeleteMonitoredItemsResponse> DeleteMonitoredItemsAsync(this IRequestChannel channel, DeleteMonitoredItemsRequest request, CancellationToken token = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((DeleteMonitoredItemsResponse)await channel.RequestAsync(request, token).ConfigureAwait(false)); }
/// <summary> /// Removes one or more MonitoredItems of a Subscription. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="DeleteMonitoredItemsRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="DeleteMonitoredItemsResponse"/>.</returns> public static async Task <DeleteMonitoredItemsResponse> DeleteMonitoredItemsAsync(this IRequestChannel channel, DeleteMonitoredItemsRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return((DeleteMonitoredItemsResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Modifies MonitoredItems of a Subscription. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="ModifyMonitoredItemsRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="ModifyMonitoredItemsResponse"/>.</returns> public static async Task <ModifyMonitoredItemsResponse> ModifyMonitoredItemsAsync(this IRequestChannel channel, ModifyMonitoredItemsRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((ModifyMonitoredItemsResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Sets the monitoring mode for one or more MonitoredItems of a Subscription. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="SetMonitoringModeRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="SetMonitoringModeResponse"/>.</returns> public static async Task <SetMonitoringModeResponse> SetMonitoringModeAsync(this IRequestChannel channel, SetMonitoringModeRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((SetMonitoringModeResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Requests the next set of Query responses, when the information is too large to be sent in a single response. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="QueryNextRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="QueryNextResponse"/>.</returns> public static async Task <QueryNextResponse> QueryNextAsync(this IRequestChannel channel, QueryNextRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return((QueryNextResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Deletes one or more References of a Node. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="DeleteReferencesRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="DeleteReferencesResponse"/>.</returns> public static async Task <DeleteReferencesResponse> DeleteReferencesAsync(this IRequestChannel channel, DeleteReferencesRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((DeleteReferencesResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Creates and deletes triggering links for a triggering item. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="SetTriggeringRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="SetTriggeringResponse"/>.</returns> public static async Task <SetTriggeringResponse> SetTriggeringAsync(this IRequestChannel channel, SetTriggeringRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return((SetTriggeringResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Unregisters NodeIds that have been obtained via the RegisterNodes service. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="UnregisterNodesRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="UnregisterNodesResponse"/>.</returns> /// <seealso href="https://reference.opcfoundation.org/v104/Core/docs/Part4/5.8.6/">OPC UA specification Part 4: Services, 5.8.6</seealso> public static async Task <UnregisterNodesResponse> UnregisterNodesAsync(this IRequestChannel channel, UnregisterNodesRequest request, CancellationToken token = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((UnregisterNodesResponse)await channel.RequestAsync(request, token).ConfigureAwait(false)); }
/// <summary> /// Requests the Server to republish a NotificationMessage from its retransmission queue. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="RepublishRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="RepublishResponse"/>.</returns> internal static async Task <RepublishResponse> RepublishAsync(this IRequestChannel channel, RepublishRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((RepublishResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Translates one or more browse paths to NodeIds. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="TranslateBrowsePathsToNodeIdsRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="TranslateBrowsePathsToNodeIdsResponse"/>.</returns> public static async Task <TranslateBrowsePathsToNodeIdsResponse> TranslateBrowsePathsToNodeIdsAsync(this IRequestChannel channel, TranslateBrowsePathsToNodeIdsRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((TranslateBrowsePathsToNodeIdsResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Modifies a Subscription. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="ModifySubscriptionRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="ModifySubscriptionResponse"/>.</returns> /// <seealso href="https://reference.opcfoundation.org/v104/Core/docs/Part4/5.13.3/">OPC UA specification Part 4: Services, 5.13.3</seealso> public static async Task <ModifySubscriptionResponse> ModifySubscriptionAsync(this IRequestChannel channel, ModifySubscriptionRequest request, CancellationToken token = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((ModifySubscriptionResponse)await channel.RequestAsync(request, token).ConfigureAwait(false)); }
/// <summary> /// Creates a Subscription. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="CreateSubscriptionRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="CreateSubscriptionResponse"/>.</returns> public static async Task <CreateSubscriptionResponse> CreateSubscriptionAsync(this IRequestChannel channel, CreateSubscriptionRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((CreateSubscriptionResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Updates historical values or Events of one or more Nodes. /// </summary> /// <param name="client">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="HistoryUpdateRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="HistoryUpdateResponse"/>.</returns> public static async Task <HistoryUpdateResponse> HistoryUpdateAsync(this IRequestChannel client, HistoryUpdateRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((HistoryUpdateResponse)await client.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Reads historical values or Events of one or more Nodes. /// </summary> /// <param name="client">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="HistoryReadRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="HistoryReadResponse"/>.</returns> public static async Task <HistoryReadResponse> HistoryReadAsync(this IRequestChannel client, HistoryReadRequest request, CancellationToken token = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((HistoryReadResponse)await client.RequestAsync(request, token).ConfigureAwait(false)); }
/// <summary> /// Adds one or more References to one or more Nodes. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="AddReferencesRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="AddReferencesResponse"/>.</returns> public static async Task <AddReferencesResponse> AddReferencesAsync(this IRequestChannel channel, AddReferencesRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return((AddReferencesResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Closes a session. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="CloseSessionRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="CloseSessionResponse"/>.</returns> public static async Task <CloseSessionResponse> CloseSessionAsync(this IRequestChannel channel, CloseSessionRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return((CloseSessionResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Creates and deletes triggering links for a triggering item. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="SetTriggeringRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="SetTriggeringResponse"/>.</returns> public static async Task <SetTriggeringResponse> SetTriggeringAsync(this IRequestChannel channel, SetTriggeringRequest request, CancellationToken token = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((SetTriggeringResponse)await channel.RequestAsync(request, token).ConfigureAwait(false)); }
/// <summary> /// Requests the next set of Browse responses, when the information is too large to be sent in a single response. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="BrowseNextRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="BrowseNextResponse"/>.</returns> public static async Task <BrowseNextResponse> BrowseNextAsync(this IRequestChannel channel, BrowseNextRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((BrowseNextResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Activates a session. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="ActivateSessionRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="ActivateSessionResponse"/>.</returns> internal static async Task <ActivateSessionResponse> ActivateSessionAsync(this IRequestChannel channel, ActivateSessionRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((ActivateSessionResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Unregisters NodeIds that have been obtained via the RegisterNodes service. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="UnregisterNodesRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="UnregisterNodesResponse"/>.</returns> public static async Task <UnregisterNodesResponse> UnregisterNodesAsync(this IRequestChannel channel, UnregisterNodesRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return((UnregisterNodesResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
/// <summary> /// Closes a session. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="CloseSessionRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="CloseSessionResponse"/>.</returns> /// <seealso href="https://reference.opcfoundation.org/v104/Core/docs/Part4/5.6.4/">OPC UA specification Part 4: Services, 5.6.4</seealso> internal static async Task <CloseSessionResponse> CloseSessionAsync(this IRequestChannel channel, CloseSessionRequest request, CancellationToken token = default) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return((CloseSessionResponse)await channel.RequestAsync(request, token).ConfigureAwait(false)); }
/// <summary> /// Transfers a Subscription and its MonitoredItems from one Session to another. /// </summary> /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param> /// <param name="request">A <see cref="TransferSubscriptionsRequest"/>.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="TransferSubscriptionsResponse"/>.</returns> public static async Task <TransferSubscriptionsResponse> TransferSubscriptionsAsync(this IRequestChannel channel, TransferSubscriptionsRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return((TransferSubscriptionsResponse)await channel.RequestAsync(request).ConfigureAwait(false)); }
private static async Task SendRequest(IRequestChannel request, string message) { var response = await request.RequestAsync(Encoding.UTF8.GetBytes(message)); Console.WriteLine(Encoding.UTF8.GetString(response)); }