private void Sniffer_DeviceFound(MTConnectDevice device) { if (Configuration.Devices != null) { // Generate the Device ID Hash string deviceId = DataClient.GenerateDeviceId(device); // Check to make sure the Device is not already added if (!Configuration.Devices.Exists(o => o.DeviceId == deviceId)) { var conn = new Api.v2.Data.Connection(); conn.Address = device.IpAddress.ToString(); conn.PhysicalAddress = device.MacAddress.ToString(); conn.Port = device.Port; // Create a new Device and start it var d = new Device(deviceId, conn, device.DeviceName); Dispatcher.BeginInvoke(new Action(() => { Devices.Add(d); })); log.Info("New Device Added : " + deviceId + " : " + device.DeviceName + " : " + device.IpAddress + " : " + device.Port); } } }
private bool AddDevice(MTConnectSniffer.MTConnectDevice device) { // Generate the Device ID Hash string deviceId = GenerateDeviceId(device); // Check to make sure the Device is not already added if (!Configuration.Devices.Exists(o => o.DeviceId == deviceId)) { var conn = new Api.v2.Data.Connection(); conn.Address = device.IpAddress.ToString(); conn.PhysicalAddress = device.MacAddress.ToString(); conn.Port = device.Port; // Create a new Device and start it var d = new Device(deviceId, conn, device.DeviceName); Configuration.Devices.Add(d); StartDevice(d); log.Info("New Device Added : " + deviceId + " : " + device.DeviceName + " : " + device.IpAddress + " : " + device.Port); return(true); } return(false); }
private void Sniffer_DeviceFound(MTConnectDevice device) { // Generate the Device ID Hash string deviceId = DataClient.GenerateDeviceId(device); // Create a new Connection object var conn = new Api.v2.Data.Connection(); conn.Address = device.IpAddress.ToString(); conn.PhysicalAddress = device.MacAddress.ToString(); conn.Port = device.Port; // Create a new Device and start it var d = new Device(deviceId, conn, device.DeviceName); // Add Device to List Dispatcher.BeginInvoke(new Action(() => { Devices.Add(d); })); // Write to Logs string msg = "Device Found : " + deviceId + " : " + device.DeviceName + " : " + device.IpAddress + " : " + device.Port; Log(msg); log.Info(msg); }