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

Decides when mDNS discovery runs: only while at least one receivers page is visible and the setting SnapcastSettings#KEY_SUPPORT is on. More...

Collaboration diagram for de.yaacc.multiroom.discovery.DiscoveryGate:
Collaboration graph

Classes

interface  Discovery
 The scan: SnapcastNsd in the app. More...
 
class  Lease
 One page of the gate, given back at most once. More...
 

Public Member Functions

 DiscoveryGate (BooleanSupplier enabled, Discovery discovery, Runnable onDisabled)
 
synchronized void pageStarted ()
 A receivers page became visible.
 
synchronized void pageStopped ()
 A receivers page was hidden.
 
synchronized Lease pageLease ()
 A holder that is not a receivers page but wants the scan while it is open (the server list window of the settings, task 11.6) takes a lease.
 
synchronized void settingChanged ()
 The setting changed (or may have): look at it again.
 
synchronized boolean isRunning ()
 True while the scan runs.
 

Detailed Description

Decides when mDNS discovery runs: only while at least one receivers page is visible and the setting SnapcastSettings#KEY_SUPPORT is on.

The setting is read each time (not once at start), so a change shows live: switching it on while a page is open starts the scan, switching it off stops it at once and tells the directory to drop the servers that only the scan knew. Pure; the scan and the directory are behind small interfaces.

Thread safe. The callbacks are called with the gate's lock held (they are quick: the scan hands its work to the platform), so a start and a stop can never be reordered. Nothing calls back into the gate from them.

Constructor & Destructor Documentation

◆ DiscoveryGate()

de.yaacc.multiroom.discovery.DiscoveryGate.DiscoveryGate ( BooleanSupplier enabled,
Discovery discovery,
Runnable onDisabled )
Parameters
enabledreads the setting; a failure counts as off
onDisabledcalled once each time the setting is found off after it was on (and at the first look): the directory forgets what the scan found

Member Function Documentation

◆ pageLease()

synchronized Lease de.yaacc.multiroom.discovery.DiscoveryGate.pageLease ( )

A holder that is not a receivers page but wants the scan while it is open (the server list window of the settings, task 11.6) takes a lease.

Closing it ends that page once: a second close, or a close after the holder was destroyed and closed on another path, can not take the count of another page, so the count can not go below what the other pages hold and can not stay up either.

Referenced by de.yaacc.fcast.discovery.FCastHub.diagnosticsOpened(), and de.yaacc.snapcast.SnapcastHub.diagnosticsOpened().

Here is the call graph for this function:
Here is the caller graph for this function:

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