using System;
namespace Rssdp
{
///
/// Event arguments for the event.
///
public sealed class DeviceUnavailableEventArgs : EventArgs
{
private readonly DiscoveredSsdpDevice _DiscoveredDevice;
private readonly bool _Expired;
///
/// Full constructor.
///
/// A instance representing the device that has become unavailable.
/// A boolean value indicating whether this device is unavailable because it expired, or because it explicitly sent a byebye notification.. See for more detail.
/// Thrown if the parameter is null.
public DeviceUnavailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool expired)
{
if (discoveredDevice == null)
{
throw new ArgumentNullException(nameof(discoveredDevice));
}
_DiscoveredDevice = discoveredDevice;
_Expired = expired;
}
///
/// Returns true if the device is considered unavailable because it's cached information expired before a new alive notification or search result was received. Returns false if the device is unavailable because it sent an explicit notification of it's unavailability.
///
public bool Expired
{
get { return _Expired; }
}
///
/// A reference to a instance containing the discovery details of the removed device.
///
public DiscoveredSsdpDevice DiscoveredDevice
{
get { return _DiscoveredDevice; }
}
}
}