BACnet.Ethernet.EthernetPort._getCaptureDevice C# (CSharp) Method

_getCaptureDevice() private method

Retrieves the capture device that is used by this port
private _getCaptureDevice ( ) : SharpPcap.LibPcap.LibPcapLiveDevice
return SharpPcap.LibPcap.LibPcapLiveDevice
        private LibPcapLiveDevice _getCaptureDevice()
        {
            var devices = LibPcapLiveDeviceList.Instance.Where(dev => dev.Interface != null);

            if(_options.DeviceName != null)
                return devices.Where(dev => dev.Name == _options.DeviceName).FirstOrDefault();
            else
            {
                foreach(var device in devices)
                {
                    if (device.LinkType == PacketDotNet.LinkLayers.Ethernet
                        && device.Interface.MacAddress != null)
                        return device;
                }

                return null;
            }
        }