Interface ISsdpDeviceLocator
Interface for components that discover the existence of SSDP devices.
Namespace: Rssdp.Infrastructure
Assembly: cs.temp.dll.dll
Syntax
public interface ISsdpDeviceLocator
Remarks
Discovering devices includes explicit search requests as well as listening for broadcast status notifications.
Properties
IsSearching
Returns a boolean indicating whether or not a search is currently active.
Declaration
bool IsSearching { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
NotificationFilter
Sets or returns a string containing the filter for notifications. Notifications not matching the filter will not raise the DeviceAvailable or DeviceUnavailable events.
Declaration
string NotificationFilter { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
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;
See Also
Methods
SearchAsync(String, CancellationToken)
Performs a search for the specified search target (criteria) and default search timeout.
Declaration
Task<IEnumerable<DiscoveredSsdpDevice>> SearchAsync(string searchTarget, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description | ||||||
|---|---|---|---|---|---|---|---|---|
| System.String | searchTarget | The criteria for the search. Value can be;
|
||||||
| System.Threading.CancellationToken | cancellationToken | An optional System.Threading.CancellationToken that can be used to cancel the search request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> | A task whose result is an System.Collections.Generic.IEnumerable<T> of DiscoveredSsdpDevice instances, representing all found devices. |
SearchAsync(String, TimeSpan, CancellationToken)
Performs a search for the specified search target (criteria) and search timeout.
Declaration
Task<IEnumerable<DiscoveredSsdpDevice>> SearchAsync(string searchTarget, TimeSpan searchWaitTime, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| System.String | searchTarget | The criteria for the search. Value can be;
|
||||||||
| System.TimeSpan | searchWaitTime | 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. |
||||||||
| System.Threading.CancellationToken | cancellationToken | An optional System.Threading.CancellationToken that can be used to cancel the search request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> | A task whose result is an System.Collections.Generic.IEnumerable<T> of DiscoveredSsdpDevice instances, representing all found devices. |
Remarks
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 implemetning these services if you know the service type.
SearchAsync(CancellationToken)
Aynchronously performs a search for all devices using the default search timeout, and returns an awaitable task that can be used to retrieve the results.
Declaration
Task<IEnumerable<DiscoveredSsdpDevice>> SearchAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> | A task whose result is an System.Collections.Generic.IEnumerable<T> of DiscoveredSsdpDevice instances, representing all found devices. |
SearchAsync(TimeSpan, CancellationToken)
Performs a search for all devices using the specified search timeout.
Declaration
Task<IEnumerable<DiscoveredSsdpDevice>> SearchAsync(TimeSpan searchWaitTime, CancellationToken cancellationToken = default(CancellationToken))
Parameters
| Type | Name | Description |
|---|---|---|
| System.TimeSpan | searchWaitTime | 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. |
| System.Threading.CancellationToken | cancellationToken | An optional System.Threading.CancellationToken that can be used to cancel the search request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> | A task whose result is an System.Collections.Generic.IEnumerable<T> of DiscoveredSsdpDevice instances, representing all found devices. |
StartListeningForNotifications()
Starts listening for broadcast notifications of service availability.
Declaration
void StartListeningForNotifications()
Remarks
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.
See Also
StopListeningForNotifications()
Stops listening for broadcast notifications of service availability.
Declaration
void StopListeningForNotifications()
Remarks
Does nothing if this instance is not already listening for notifications.
Exceptions
| Type | Condition |
|---|---|
| System.ObjectDisposedException | Throw if the IsDisposed property is true. |
See Also
Events
DeviceAvailable
Event raised when a device becomes available or is found by a search request.
Declaration
event EventHandler<DeviceAvailableEventArgs> DeviceAvailable
Event Type
| Type | Description |
|---|---|
| System.EventHandler<DeviceAvailableEventArgs> |
See Also
DeviceUnavailable
Event raised when a device explicitly notifies of shutdown or a device expires from the cache.
Declaration
event EventHandler<DeviceUnavailableEventArgs> DeviceUnavailable
Event Type
| Type | Description |
|---|---|
| System.EventHandler<DeviceUnavailableEventArgs> |