YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.snapcast.discovery.SnapcastNsd Class Reference

The Android side of the server discovery: browses the control service of a snapserver with NsdManager and gives every resolved service to the SnapcastDirectory. More...

Collaboration diagram for de.yaacc.snapcast.discovery.SnapcastNsd:
Collaboration graph

Public Member Functions

 SnapcastNsd (Context context, SnapcastDirectory directory, SnapcastDiscoveryLog log)
 
synchronized boolean isStarted ()
 
synchronized SnapcastDiscoveryReport.LockState lockState ()
 The state of the multicast lock, for the report.
 
synchronized void start ()
 Starts browsing.
 
synchronized void stop ()
 Stops browsing, drops the queue and releases the multicast lock.
 

Detailed Description

The Android side of the server discovery: browses the control service of a snapserver with NsdManager and gives every resolved service to the SnapcastDirectory.

Thin on purpose: what to accept (the address ranges, the cap, the merge, the names as display text) is decided by the pure classes; the order of the resolutions by ResolveQueue; which types are browsed by SnapcastServiceTypes. This class cannot be tested on the JVM.

Types. One discoverServices call per type (NsdManager takes one type per listener): the control port is announced as _snapcast-ctrl._tcp by Snapcast 0.33 and newer and as _snapcast-tcp._tcp by 0.32 and older, which browsing only the new name never found; the stream type _snapcast._tcp is browsed for the report only (a server that announces its stream but not its control port can be told from silence) and is never resolved or listed. Everything the callbacks report goes to the SnapcastDiscoveryLog for the report the user can read.

Lifetime. Nothing runs until start(), which the receivers page calls when it becomes visible, and everything stops with stop(): the discovery, the queue and the multicast lock. The lock is held only between the two (the platform documents it for the legacy NSD path of older releases; it needs CHANGE_WIFI_MULTICAST_STATE, which the app has for UPnP). No other permission is needed at the target API of the app.

Trust. The announcement is not authenticated and the service has no TXT records. The service name is display text and (with the type) the key to match a "lost" event; the address comes from the resolution as a number, so no name lookup happens here, and the connection later uses that InetAddress.

Member Function Documentation

◆ start()

synchronized void de.yaacc.snapcast.discovery.SnapcastNsd.start ( )

Starts browsing.

Does nothing when it runs already.

Here is the call graph for this function:

◆ stop()

synchronized void de.yaacc.snapcast.discovery.SnapcastNsd.stop ( )

Stops browsing, drops the queue and releases the multicast lock.

Does nothing when it is stopped.

Here is the call graph for this function:

The documentation for this class was generated from the following file: