Exemple #1
0
        public IActionResult MakeOpcUaVar(string clientKey, string subDisplayName)
        {
            OpcUaVariableViewModel opcUaVariableViewModel = new OpcUaVariableViewModel
            {
                ClientKey = clientKey
            };

            if (subDisplayName == null)
            {
                Program.UarcCollector.OpcUaVerbindungen.TryGetValue(clientKey, out UarcOpcUaClient client);

                opcUaVariableViewModel.Subscriptions = new List <string>();

                List <Subscription> subscriptions = new List <Subscription>();
                subscriptions = client.Subscriptions.ToList();
                foreach (Subscription sub in subscriptions)
                {
                    opcUaVariableViewModel.Subscriptions.Add(sub.DisplayName);
                }
            }
            else
            {
                opcUaVariableViewModel.SubDisplayName = subDisplayName;
            }

            return(View(opcUaVariableViewModel));
        }
Exemple #2
0
        public IActionResult OverviewOpcUaVar(string clientKey, string subDisplayName)
        {
            OpcUaVariableViewModel opcUaVariableViewModel = new OpcUaVariableViewModel
            {
                ClientKey      = clientKey,
                SubDisplayName = subDisplayName
            };

            Program.UarcCollector.OpcUaVerbindungen.TryGetValue(clientKey, out UarcOpcUaClient client);
            Subscription subscription = client.Subscriptions.ToList().Find(x => x.DisplayName == subDisplayName);

            opcUaVariableViewModel.Vars = subscription.MonitoredItems.ToList();

            return(View(opcUaVariableViewModel));
        }
Exemple #3
0
        public async Task <IActionResult> CreateOpcUaVar(string clientKey, string subDisplayName, string varDisplayName, string nodeId, int samplingInterval)
        {
            try
            {
                Program.UarcCollector.OpcUaVerbindungen.TryGetValue(clientKey, out UarcOpcUaClient client);

                await client.AddMonitoredItemToSubscriptionInListAsync(subDisplayName, varDisplayName, nodeId, samplingInterval);
            }
            catch (Exception e)
            {
                throw e;
            }

            OpcUaVariableViewModel opcUaVariableViewModel = new OpcUaVariableViewModel
            {
                ClientKey      = clientKey,
                VarDisplayName = varDisplayName
            };

            return(View(opcUaVariableViewModel));
        }