// --- Event Handlers --- void DevicesSuccessful(MTConnect.MTConnectDevices.Document document) { foreach (var device in document.Devices) { var dataItems = device.GetDataItems(); foreach (var dataItem in dataItems) { Console.WriteLine(dataItem.Id + " : " + dataItem.Name); } } }
private void Probe_Successful(MTConnect.MTConnectDevices.Document document) { probeHeader = document.Header; SendProbeHeader(document.Header); foreach (var device in document.Devices) { var dataItems = device.GetDataItems(); SendProbeDataItems(dataItems); probeData = dataItems; } }
private void Probe_Successful(MTConnect.MTConnectDevices.Document document) { IncrementProbeRequests(); if (document.UserObject != null) { var sender = document.UserObject as ProbeSender; if (sender != null) { // Get the MAC Address of the sender var macAddress = GetMacAddress(sender.Address); foreach (var device in document.Devices) { DeviceFound?.Invoke(new MTConnectDevice(sender.Address, sender.Port, macAddress, device.Name)); } } } }
private void Probe_Successful(MTConnect.MTConnectDevices.Document document) { try { var device = document.UserObject as TrakHound.MTConnectSniffer.MTConnectDevice; if (device != null) { Dispatcher.BeginInvoke(new Action(() => { lock (_lock) { if (Devices != null) { bool match = false; // Check Device List to see if the Device has already been added match = Devices.ToList().Exists(o => o.Agent != null && o.Agent.Address == device.IpAddress.ToString() && o.Agent.Port == device.Port && o.Agent.DeviceName == device.DeviceName); // If Device is not already added then add it if (!match && document.Devices.Count > 0) { DevicesNotAdded++; var info = new DeviceInfo(device.IpAddress.ToString(), device.Port, document.Devices[0]); DeviceInfos.Add(info); } else { DevicesAlreadyAdded++; } } } }), System.Windows.Threading.DispatcherPriority.Background, new object[] { }); } } catch (Exception ex) { logger.Error(ex); } }