Example #1
0
 public TestModule(IBrowseServices <EndpointModel> browser,
                   IHistoricAccessServices <EndpointModel> history,
                   INodeServices <EndpointModel> nodes, IUploadServices <EndpointModel> upload)
 {
     _browser = browser ?? throw new ArgumentNullException(nameof(browser));
     _history = history ?? throw new ArgumentNullException(nameof(history));
     _nodes   = nodes ?? throw new ArgumentNullException(nameof(nodes));
     _upload  = upload ?? throw new ArgumentNullException(nameof(upload));
 }
Example #2
0
 /// <summary>
 /// Create controller with service
 /// </summary>
 /// <param name="browse"></param>
 /// <param name="nodes"></param>
 /// <param name="historian"></param>
 /// <param name="twin"></param>
 public EndpointMethodsController(IBrowseServices <EndpointModel> browse,
                                  INodeServices <EndpointModel> nodes, IHistoricAccessServices <EndpointModel> historian,
                                  ITwinServices twin)
 {
     _browse    = browse ?? throw new ArgumentNullException(nameof(browse));
     _historian = historian ?? throw new ArgumentNullException(nameof(historian));
     _nodes     = nodes ?? throw new ArgumentNullException(nameof(nodes));
     _twin      = twin ?? throw new ArgumentNullException(nameof(twin));
 }
Example #3
0
 /// <summary>
 /// Create controller with service
 /// </summary>
 /// <param name="supervisor"></param>
 /// <param name="activator"></param>
 /// <param name="nodes"></param>
 /// <param name="historian"></param>
 /// <param name="browse"></param>
 public SupervisorMethodsController(ISupervisorServices supervisor,
                                    IActivationServices <string> activator,
                                    INodeServices <EndpointModel> nodes, IHistoricAccessServices <EndpointModel> historian,
                                    IBrowseServices <EndpointModel> browse)
 {
     _supervisor = supervisor ?? throw new ArgumentNullException(nameof(supervisor));
     _browse     = browse ?? throw new ArgumentNullException(nameof(browse));
     _historian  = historian ?? throw new ArgumentNullException(nameof(historian));
     _nodes      = nodes ?? throw new ArgumentNullException(nameof(nodes));
     _activator  = activator ?? throw new ArgumentNullException(nameof(activator));
 }
Example #4
0
 /// <summary>
 /// Create controller with service
 /// </summary>
 /// <param name="browse"></param>
 /// <param name="nodes"></param>
 /// <param name="historian"></param>
 /// <param name="publisher"></param>
 /// <param name="export"></param>
 /// <param name="twin"></param>
 public EndpointMethodsController(IBrowseServices <EndpointModel> browse,
                                  INodeServices <EndpointModel> nodes, IHistoricAccessServices <EndpointModel> historian,
                                  IPublishServices <EndpointModel> publisher, IUploadServices <EndpointModel> export,
                                  ITwinServices twin)
 {
     _browse    = browse ?? throw new ArgumentNullException(nameof(browse));
     _historian = historian ?? throw new ArgumentNullException(nameof(historian));
     _nodes     = nodes ?? throw new ArgumentNullException(nameof(nodes));
     _twin      = twin ?? throw new ArgumentNullException(nameof(twin));
     _publisher = publisher ?? throw new ArgumentNullException(nameof(publisher));
     _export    = export ?? throw new ArgumentNullException(nameof(export));
 }
Example #5
0
 /// <summary>
 /// Create controller with service
 /// </summary>
 /// <param name="supervisor"></param>
 /// <param name="browse"></param>
 /// <param name="discover"></param>
 /// <param name="activator"></param>
 /// <param name="nodes"></param>
 /// <param name="historian"></param>
 /// <param name="publisher"></param>
 /// <param name="logger"></param>
 public SupervisorMethodsController(ISupervisorServices supervisor,
                                    IDiscoveryServices discover, IActivationServices <string> activator,
                                    INodeServices <EndpointModel> nodes, IHistoricAccessServices <EndpointModel> historian,
                                    IBrowseServices <EndpointModel> browse, IPublishServices <EndpointModel> publisher,
                                    ILogger logger)
 {
     _supervisor = supervisor ?? throw new ArgumentNullException(nameof(supervisor));
     _browse     = browse ?? throw new ArgumentNullException(nameof(browse));
     _historian  = historian ?? throw new ArgumentNullException(nameof(historian));
     _nodes      = nodes ?? throw new ArgumentNullException(nameof(nodes));
     _publisher  = publisher ?? throw new ArgumentNullException(nameof(publisher));
     _discover   = discover ?? throw new ArgumentNullException(nameof(discover));
     _activator  = activator ?? throw new ArgumentNullException(nameof(activator));
     _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #6
0
        /// <summary>
        /// Browse all references if max references is null and user
        /// wants all. If user has requested maximum to return use
        /// <see cref="IBrowseServices{T}.NodeBrowseFirstAsync"/>
        /// </summary>
        /// <param name="endpoint"></param>
        /// <param name="service"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <BrowseResultModel> NodeBrowseAsync <T>(
            this IBrowseServices <T> service, T endpoint, BrowseRequestModel request)
        {
            if (request.MaxReferencesToReturn != null)
            {
                return(await service.NodeBrowseFirstAsync(endpoint, request));
            }
            while (true)
            {
                var result = await service.NodeBrowseFirstAsync(endpoint, request);

                while (result.ContinuationToken != null)
                {
                    try {
                        var next = await service.NodeBrowseNextAsync(endpoint,
                                                                     new BrowseNextRequestModel {
                            ContinuationToken  = result.ContinuationToken,
                            Header             = request.Header,
                            NodeIdsOnly        = request.NodeIdsOnly,
                            ReadVariableValues = request.ReadVariableValues,
                            TargetNodesOnly    = request.TargetNodesOnly
                        });

                        result.References.AddRange(next.References);
                        result.ContinuationToken = next.ContinuationToken;
                    }
                    catch (Exception) {
                        await Try.Async(() => service.NodeBrowseNextAsync(endpoint,
                                                                          new BrowseNextRequestModel {
                            ContinuationToken = result.ContinuationToken,
                            Abort             = true
                        }));

                        throw;
                    }
                }
                return(result);
            }
        }
 /// <summary>
 /// Create controller with service
 /// </summary>
 /// <param name="browser"></param>
 public BrowseController(IBrowseServices <string> browser)
 {
     _broser = browser;
 }