• API Documentation
Show / Hide Table of Contents
  • Rssdp
    • AggregateSsdpDeviceLocator
    • CustomHttpHeader
    • CustomHttpHeadersCollection
    • DeviceAvailableEventArgs
    • DeviceEventArgs
    • DeviceNetworkType
    • DeviceNetworkTypeExtensions
    • DeviceUnavailableEventArgs
    • DiscoveredSsdpDevice
    • ExceptionExtensions
    • ISsdpLogger
    • NullLogger
    • ServiceEventArgs
    • SocketClosedException
    • SocketFactory
    • SsdpDevice
    • SsdpDeviceExtensions
    • SsdpDeviceIcon
    • SsdpDeviceLocator
    • SsdpDevicePropertiesCollection
    • SsdpDeviceProperty
    • SsdpDevicePublisher
    • SsdpEmbeddedDevice
    • SsdpRootDevice
    • SsdpService
    • SsdpStandardsMode
    • SsdpTraceLogger
  • Rssdp.Infrastructure
    • DisposableManagedObjectBase
    • HttpParserBase<T>
    • HttpRequestParser
    • HttpResponseParser
    • ISocketFactory
    • ISsdpCommunicationsServer
    • ISsdpDeviceLocator
    • ISsdpDevicePublisher
    • IUdpSocket
    • IUpnpDeviceValidator
    • ReceivedUdpData
    • RequestReceivedEventArgs
    • ResponseReceivedEventArgs
    • SsdpCommunicationsServer
    • SsdpConstants
    • SsdpDeviceLocatorBase
    • SsdpDevicePublisherBase
    • UdpEndPoint
    • Upnp10DeviceValidator

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;

upnp:rootdevice urn:schemas-upnp-org:device:WANDevice:1 "uuid:9F15356CC-95FA-572E-0E99-85B456BD3012"

See Also
DeviceAvailable
DeviceUnavailable
StartListeningForNotifications()
StopListeningForNotifications()

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;

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

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;

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

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()
DeviceAvailable
DeviceUnavailable
NotificationFilter

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
StartListeningForNotifications()
DeviceAvailable
DeviceUnavailable
NotificationFilter

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
NotificationFilter
DeviceUnavailable
StartListeningForNotifications()
StopListeningForNotifications()

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>
See Also
DeviceAvailable
StartListeningForNotifications()
StopListeningForNotifications()

See Also

DiscoveredSsdpDevice
SsdpDevice
ISsdpDevicePublisher
In This Article
Back to top Copyright (c) 2015 Troy Willmot