/// <summary> /// Imports all controllers from the specified path and port /// and searchs for user defined interfaces for each controller. /// </summary> public void ImportAllControllers(IList <string> userDefinedInterfaces) { _logger.Debug(string.Format("Import controller tree skeleton on '{0}:{1}'", _adsAddress, _adsPort)); _alarmsImporter.ImportAlarms(); IReadOnlyCollection <IControllerTag> controllerTags = _findControllerTags.FindControllerTags(); if (controllerTags.IsNullOrEmpty()) { return; } IControllerTag anyControllerTag = controllerTags.First(); _tagListener.AddUdtHandler <CtrlCommonInterface>(anyControllerTag.GetCommonInterfaceDataType()); foreach (IControllerTag controllerTag in controllerTags) { Tag commonInterfaceTag = controllerTag.GetCommonInterfaceTag(); if (commonInterfaceTag != null) { _tagListener.ReadTagSynchronously(commonInterfaceTag); } } Controller controller = ImportControllerWithChildren(_rootController, controllerTags, userDefinedInterfaces, MaxChildImportDepth); _controllerTree.Initialize(controller); _alarmsImporter.AlarmsChanged += alarms => _controllerTree.UpdateAlarms(alarms); _controllerTree.UpdateAlarms(_alarmsImporter.GetAllImportedAlarms()); _logger.Debug(string.Format("Finished import of controller skeleton tree on '{0}:{1}'", _adsAddress, _adsPort)); }
private static ControllerTree SetupControllerTree() { var tree = new ControllerTree(); var tag = new Tag(); tag.Childs.Add(new Tag(NamingConventions.CommonInterface, "MAIN") { Value = new CtrlCommonInterface() { Info = new CtrlInfo() { CtrlId = 1 } } }); var controller = new Controller(new SimulatedTagController(null), new ControllerTagWrapper(tag)); tree.Initialize(controller); return(tree); }