void sinkRegisterIsos() { var tEngs = TheThingRegistry.GetBaseEnginesAsThing(false, true); foreach (var t in tEngs) { if (TheThing.GetSafePropertyBool(t, "IsIsolated")) { IBaseEngine tBase = TheThingRegistry.GetBaseEngine(t, true); if (tBase != null && tBase.GetISOLater() != null) { TheThing tT = TheThingRegistry.GetThingByFunc(MyBaseEngine.GetEngineName(), s => s.DeviceType == TheISOlaterKPIs.eDeviceType && TheThing.GetSafePropertyString(s, "ISOLaterName") == t.EngineName); var tKPI = new TheISOlaterKPIs(tT, this, t.EngineName); TheThingRegistry.RegisterThing(tKPI); } } } List <TheThing> tDevList = TheThingRegistry.GetThingsByProperty(MyBaseEngine.GetEngineName(), Guid.Empty, "DeviceType", TheKPIReport.eDeviceType); if (tDevList.Count > 0) { foreach (TheThing tDev in tDevList) { if (tDev.GetObject() == null) { TheKPIReport cs = new TheKPIReport(tDev, this); TheThingRegistry.RegisterThing(cs); } } } }
//private ApplicationConfiguration m_configuration; private void GetEndpoints() { try { // set a short timeout because this is happening in the drop down event. EndpointConfiguration configuration = EndpointConfiguration.Create(); configuration.OperationTimeout = 20000; // Connect to the local discovery server and find the available servers. using (DiscoveryClient client = DiscoveryClient.Create(new Uri(Utils.Format("opc.tcp://{0}:4840", MyBaseThing.Address)), configuration)) { ApplicationDescriptionCollection servers = client.FindServers(null); // populate the drop down list with the discovery URLs for the available servers. for (int ii = 0; ii < servers.Count; ii++) { // don't show discovery servers. if (servers[ii].ApplicationType == ApplicationType.DiscoveryServer) { continue; } for (int jj = 0; jj < servers[ii].DiscoveryUrls.Count; jj++) { string discoveryUrl = servers[ii].DiscoveryUrls[jj]; // Many servers will use the '/discovery' suffix for the discovery endpoint. // The URL without this prefix should be the base URL for the server. if (discoveryUrl.EndsWith("/discovery")) { discoveryUrl = discoveryUrl.Substring(0, discoveryUrl.Length - "/discovery".Length); } TheThing tDev = TheThingRegistry.GetThingByFunc(MyBaseEngine.GetEngineName(), s => s.GetProperty("Address", false).ToString() == discoveryUrl); if (tDev == null) { TheOPCUARemoteServer tS = new TheOPCUARemoteServer(null, this, discoveryUrl); TheThingRegistry.RegisterThing(tS); } } } } } catch (Exception) { } finally { } }