using System;
namespace Rssdp.Infrastructure
{
///
/// Interface for components that discover the existence of SSDP devices.
///
///
/// Discovering devices includes explicit search requests as well as listening for broadcast status notifications.
///
///
///
///
public interface ISsdpDeviceLocator
{
///
/// Event raised when a device becomes available or is found by a search request.
///
///
///
///
///
event EventHandler DeviceAvailable;
///
/// Event raised when a device explicitly notifies of shutdown or a device expires from the cache.
///
///
///
///
///
event EventHandler DeviceUnavailable;
///
/// Sets or returns a string containing the filter for notifications. Notifications not matching the filter will not raise the or events.
///
///
/// Device alive/byebye notifications whose NT header does not match this filter value will still be captured and cached internally, but will not raise events about device availability. Usually used with either a device type of uuid NT header value.
/// Example filters follow;
/// upnp:rootdevice
/// urn:schemas-upnp-org:device:WANDevice:1
/// "uuid:9F15356CC-95FA-572E-0E99-85B456BD3012"
///
///
///
///
///
string NotificationFilter
{
get;
set;
}
///
/// Asynchronously performs a search for all devices using the default search timeout, and returns an awaitable task that can be used to retrieve the results.
///
/// A task whose result is an of instances, representing all found devices.
System.Threading.Tasks.Task> SearchAsync();
///
/// Performs a search for the specified search target (criteria) and default search timeout.
///
/// The criteria for the search. Value can be;
///
/// - Root devicesupnp:rootdevice
/// - Specific device by UUIDuuid:<device uuid>
/// - Device typeFully qualified device type starting with urn: i.e urn:schemas-upnp-org:Basic:1
///
///
/// A task whose result is an of instances, representing all found devices.
System.Threading.Tasks.Task> SearchAsync(string searchTarget);
///
/// Performs a search for the specified search target (criteria) and search timeout.
///
/// The criteria for the search. Value can be;
///
/// - Root devicesupnp:rootdevice
/// - Specific device by UUIDuuid:<device uuid>
/// - Device typeA device namespace and type in format of urn:<device namespace>:device:<device type>:<device version> i.e urn:schemas-upnp-org:device:Basic:1
/// - Service typeA service namespace and type in format of urn:<service namespace>:service:<servicetype>:<service version> i.e urn:my-namespace:service:MyCustomService:1
///
///
/// The amount of time to wait for network responses to the search request. Longer values will likely return more devices, but increase search time. A value between 1 and 5 is recommended by the UPnP 1.1 specification. Specify TimeSpan.Zero to return only devices already in the cache.
///
/// By design RSSDP does not support 'publishing services' as it is intended for use with non-standard UPnP devices that don't publish UPnP style services. However, it is still possible to use RSSDP to search for devices implementing these services if you know the service type.
///
/// A task whose result is an of instances, representing all found devices.
System.Threading.Tasks.Task> SearchAsync(string searchTarget, TimeSpan searchWaitTime);
///
/// Performs a search for all devices using the specified search timeout.
///
/// The amount of time to wait for network responses to the search request. Longer values will likely return more devices, but increase search time. A value between 1 and 5 is recommended by the UPnP 1.1 specification. Specify TimeSpan.Zero to return only devices already in the cache.
/// A task whose result is an of instances, representing all found devices.
System.Threading.Tasks.Task> SearchAsync(TimeSpan searchWaitTime);
///
/// Starts listening for broadcast notifications of service availability.
///
///
/// When called the system will listen for 'alive' and 'byebye' notifications. This can speed up searching, as well as provide dynamic notification of new devices appearing on the network, and previously discovered devices disappearing.
///
///
///
///
///
void StartListeningForNotifications();
///
/// Stops listening for broadcast notifications of service availability.
///
///
/// Does nothing if this instance is not already listening for notifications.
///
/// Throw if the property is true.
///
///
///
///
void StopListeningForNotifications();
}
}