private static void ImportServer (AddressSpaceDataBase.ServersTableRow svr, string targetNamespace, UniqueName uniqueName, List <NodeDesign> nodes) { string name = NewName; XmlQualifiedName sftName = new XmlQualifiedName(NewName, targetNamespace); ObjectDesign sft = CreateFolder(sftName, svr.URLString, svr.URL.Path); sft.References = new Reference[] { new Reference() { IsInverse = true, ReferenceType = CreateXmlQualifiedName(Opc.Ua.BrowseNames.Organizes), TargetId = CreateXmlQualifiedName("ObjectsFolder") } }; nodes.Add(sft); List <InstanceDesign> cldrn = new List <InstanceDesign>(); foreach (AddressSpaceDataBase.TagsTableRow item in svr.GetTagsTableRows()) { ImportTag(item, targetNamespace, uniqueName, sft.SymbolicName, nodes, cldrn); } sft.Children = new ListOfChildren() { Items = cldrn.ToArray() }; }
internal OPCBrowseServer(AddressSpaceDataBase.ServersTableRow server, OpcDa::BrowseFilters filters) : base(server.URLString, null, filters, Opc.Specification.NONE) { CreatedEception = null; m_ServerDictionaryDescription = server; try { DefaultSpecification = server.Specification; Tag = (Server)Factory.GetServerForURL(server.URL, DefaultSpecification); m_SupportedLocales = server.Locales; State = state.dictionary; this.Browse(true); this.Expand(); } catch (Exception ex) { ReportException(ex); } }
/// <summary> /// Saves this instance and all children in the address space. /// </summary> /// <param name="addressSpace">The address space.</param> /// <param name="parentKey">The parent key.</param> /// <param name="root">if set to <c>true</c> it is root browe element.</param> public override void Save(AddressSpaceDataBase addressSpace, int parentKey, bool root) { if (Tag.IsConnected) { try { m_ServerDictionaryDescription = addressSpace.ServersTable.AddRow(ConnectDataObject, Tag); } catch (Exception ex) { ReportException(ex); } } else { m_ServerDictionaryDescription = addressSpace.ServersTable.AddRow(ConnectDataObject, m_Status, Tag.PreferedSpecyfication, Tag.Url, SuportedLocales); } base.Save(addressSpace, m_ServerDictionaryDescription.ID, root); }
/// <summary> /// Connects to the server and browses for top level nodes. /// </summary> /// <param name="addSubscriptions">if set to <c>true</c> add subscriptions.</param> internal void Connect() { // connect to server if not already connected. if (Tag.IsConnected) { return; } try { Tag.Connect(ConnectDataObject); Tag.ServerShutdown += new Opc.ServerShutdownEventHandler(server_ServerShutdown); m_SupportedLocales = Tag.GetSupportedLocales(); if (!string.IsNullOrEmpty(m_Locale)) { Tag.SetLocale(m_Locale); } Refresh(); m_ServerDictionaryDescription = null; CreatedEception = null; State = state.connected; } catch (Exception ex) { ReportException(ex); } }